/* Keep the original light palette available; dark is the first-visit default. */
:root { color-scheme: light; }
.theme-toggle { display: grid; place-items: center; flex-shrink: 0; }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle:hover { background: var(--bg); }

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4edf7;
  --muted: #9aabbd;
  --line: #2a394b;
  --teal: #66d5bd;
  --bg: #0f1722;
  --sidebar: #121d2b;
  --surface: #182432;
  --surface-raised: #1e2d3e;
  --field: #121e2d;
}
[data-theme="dark"] ::selection { color: #eafff8; background: #246c60; }
[data-theme="dark"] .sidebar { border-right: 1px solid var(--line); }
[data-theme="dark"] .workspace,
[data-theme="dark"] .mini-label,
[data-theme="dark"] .private-label { color: #94a6b9; }
[data-theme="dark"] .source small { color: #a0b1c4; }
[data-theme="dark"] .topbar,
[data-theme="dark"] .stats article,
[data-theme="dark"] .table-card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .info-card,
[data-theme="dark"] .job-card,
[data-theme="dark"] dialog { background: var(--surface); }
[data-theme="dark"] .topbar,
[data-theme="dark"] .icon-button { color: #b5c4d5; }
[data-theme="dark"] .topbar i { color: #6f8299; }
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .search input {
  background: var(--field); border-color: var(--line); color: var(--ink);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #8d9fb3; opacity: 1; }
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #66d5bd1c; }
[data-theme="dark"] .primary { color: #071c17; background: #66d5bd; border-color: #66d5bd; box-shadow: 0 3px 12px #00000020; }
[data-theme="dark"] .secondary { background: var(--surface-raised); border-color: #37495f; color: #d5e1ee; }
[data-theme="dark"] .danger { background: #37262e; border-color: #71424d; color: #ffb4ba; }
[data-theme="dark"] .pill,
[data-theme="dark"] .badge,
[data-theme="dark"] .section-heading h2 span { background: #273649; color: #bdcddd; }
[data-theme="dark"] .pill.connected,
[data-theme="dark"] .badge.green { background: #1c3c37; color: #8de4c6; }
[data-theme="dark"] .notice { background: #182f2e; border-color: #2b4a44; }
[data-theme="dark"] .notice-icon { background: #23453e; color: #8de4c6; }
[data-theme="dark"] .notice p { color: #a4c6bb; }
[data-theme="dark"] .notice .secondary { background: #234239; border-color: #416456; color: #d0f3e5; }
[data-theme="dark"] .eyebrow { color: #93bdb9; }
[data-theme="dark"] .stat-label,
[data-theme="dark"] .stat-label > span,
[data-theme="dark"] .stats small,
[data-theme="dark"] .stats strong > span,
[data-theme="dark"] .accent-stat small { color: #a2b3c8; }
[data-theme="dark"] .stats .accent-stat { background: #1c2c43; border-color: #344964; }
[data-theme="dark"] .table-toolbar select,
[data-theme="dark"] .live-label,
[data-theme="dark"] .search span { color: #a9bacd; }
[data-theme="dark"] th { background: #141f2e; color: #aabbd0; }
[data-theme="dark"] sup { color: #8fa4bd; }
[data-theme="dark"] td { border-color: #263547; color: #bdccdd; }
[data-theme="dark"] tbody tr:hover { background: #203344; }
[data-theme="dark"] tbody tr:focus-visible { outline: 2px solid var(--teal); outline-offset: -2px; }
[data-theme="dark"] .person-cell b { color: #e1edf9; }
[data-theme="dark"] .person-cell small { color: #9dafc5; }
[data-theme="dark"] .avatar { background: #234039; color: #a2e4d0; }
[data-theme="dark"] .empty-art { background: var(--field); border-color: var(--line); }
[data-theme="dark"] .ghost-line { background: #2b3c50; }
[data-theme="dark"] .empty-art b { background: var(--surface-raised); border-color: #3c574f; color: #8ed6bf; }
[data-theme="dark"] .empty p,
[data-theme="dark"] .table-footer,
[data-theme="dark"] .footnote,
[data-theme="dark"] .settings-card p,
[data-theme="dark"] .settings-card small,
[data-theme="dark"] .command-list,
[data-theme="dark"] .info-card p,
[data-theme="dark"] .job-card p,
[data-theme="dark"] .checkbox small,
[data-theme="dark"] .helper,
[data-theme="dark"] .message time { color: var(--muted); }
[data-theme="dark"] .card-icon { background: #243d58; color: #a0ccf3; }
[data-theme="dark"] .card-icon.bot { background: #234137; color: #a0d5ac; }
[data-theme="dark"] .connection-status,
[data-theme="dark"] .person-summary { background: var(--field); color: #b2c3d6; }
[data-theme="dark"] label,
[data-theme="dark"] .info-card b { color: #bdccdd; }
[data-theme="dark"] .command-list code { color: var(--teal); }
[data-theme="dark"] .pair-code { background: #1c3c37; color: #9de9cf; }
[data-theme="dark"] .job-card details { color: #f3b2b5; }
[data-theme="dark"] dialog { border-color: #3a4c62; box-shadow: 0 25px 90px #00000070; }
[data-theme="dark"] dialog::backdrop { background: #050a12b3; }
[data-theme="dark"] .message { border-color: #3e6c61; }
[data-theme="dark"] .toast { background: #285347; color: #ecfff7; border: 1px solid #4b8875; }
[data-theme="dark"] .toast.error { background: #613340; border-color: #a86878; }

@media (max-width: 480px) {
  .topbar { gap: 10px; }
  .topbar > div { gap: 7px; }
  .topbar > #breadcrumb { font-size: 10px; }
  .topbar i { margin: 0 5px; }
  .topbar .pill { font-size: 9px; padding: 6px 8px; }
}
