/* Theme preference belongs to the browser, independently of workspace data. */
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:38px;padding:8px 12px;border:1px solid var(--line);border-radius:9px;background:var(--paper);color:var(--ink);font-size:12px;white-space:nowrap}
.theme-toggle:hover{border-color:#83a995;background:#edf3ef}
.theme-toggle svg{width:17px;height:17px}
.theme-sun{display:none}
[data-theme="light"] .theme-moon{display:none}
[data-theme="light"] .theme-sun{display:block}

:root[data-theme="dark"]{color-scheme:dark;--bg:#0b1220;--paper:#121e32;--ink:#e5e9ef;--muted:#a1abb7;--line:#2e3740;--green:#8fbce9;--soft-green:#243445;--field:#0d1728;--surface:#0f1a2c;--hover:#26313d;color:var(--ink);background:var(--bg)}
[data-theme="dark"] body{background:var(--bg);color:var(--ink)}
[data-theme="dark"] :is(.sidebar,.topbar,.panel,.stat,.business-card,.welcome-card,.connection-card,dialog){background:var(--paper);border-color:var(--line);color:var(--ink)}
[data-theme="dark"] :is(.button,.section-toolbar select){background:var(--paper);border-color:#3c4755;color:#d9e0ea}
[data-theme="dark"] :is(.button:hover,.icon-button:hover,.theme-toggle:hover){background:var(--hover);border-color:#677e9b}
[data-theme="dark"] .button.primary{background:#93c0eb;border-color:#93c0eb;color:#10202f}
[data-theme="dark"] .button.primary:hover{background:#afd3f8;border-color:#afd3f8;color:#10202f}
[data-theme="dark"] .brand-icon{background:#366084;color:#fff}
[data-theme="dark"] .avatar{background:#3b352b;color:#e5d4b4}
[data-theme="dark"] :is(.breadcrumb strong,.task-title,.welcome-step strong,.posting-detail>strong,.connection-card strong){color:var(--ink)}
[data-theme="dark"] :is(.page-heading p,.panel-heading p,.task-meta,.tab,.stat-top,.stat-caption,.empty p,.link-card small,.metric-label,.metric-number span,.metric-bottom,.weekly-caption,.settings-card p,.field,.field small,.welcome-card p,.welcome-step small,.capture-hint,.posting-detail>span,.posting-count>small,.posting-count>strong>span,.posting-footnote,.recurring-row strong>span,.recurring-row small,.business-card p,.business-card>small,.connection-card small,.connection-setup p,.tool-description p,.tool-input-fields small,.action-help,.command-event small,.raw-mode){color:var(--muted)}
[data-theme="dark"] :is(.nav-label,.eyebrow,.brand-sub,.version,.today-chip,.day,.optional-mark){color:#9ca5b2}
[data-theme="dark"] :is(.nav-item,.icon-button,.search,.search input,.text-button){color:#a9b5c3}
[data-theme="dark"] .nav-item:hover{background:#202933;color:#dce4ef}
[data-theme="dark"] :is(.nav-item.active,.tab.active,.text-button:hover){color:#a4c9f2}
[data-theme="dark"] :is(.nav-count,.count-pill){background:#2b3440;color:#b1bece}
[data-theme="dark"] .active .nav-count{background:#344961;color:#b9d7fd}
[data-theme="dark"] :is(.workspace,.profile,.tabs,.task-row,.metric,.add-row,.quick-capture,.recurring-row,.command-event,.connection-setup,.business-card>small,.modal-actions){border-color:var(--line)}
[data-theme="dark"] :is(.field input,.field select,.field textarea,.quick-capture input,.posting-date input,.brand-filter select){background:var(--field);color:#e1e6ee;border-color:#3c4857}
[data-theme="dark"] :is(input,textarea)::placeholder{color:#949fab}
[data-theme="dark"] :is(.field input,.field select,.field textarea,.quick-capture input):focus{border-color:#87add9;box-shadow:0 0 0 3px #83adda22}
[data-theme="dark"] .search input{background:transparent;color:var(--ink)}
[data-theme="dark"] .search:focus-within{outline-color:#7c9abe}
[data-theme="dark"] .search kbd{color:#a5b1bf;border-color:#404d5d}
[data-theme="dark"] .task-check{background:var(--field);border-color:#667689;accent-color:#8fbce9}
[data-theme="dark"] .task-check:checked{background:#93c0eb;border-color:#93c0eb}
[data-theme="dark"] .task-check:checked:after{color:#10202f}
[data-theme="dark"] .task-row.done .task-title{color:#8e9fb2}
[data-theme="dark"] .overdue{color:#f0b29e}
[data-theme="dark"] :is(.sage,.priority.low){background:#263444;color:#b2ccf0}
[data-theme="dark"] .lavender{background:#352e48;color:#d1bff3}
[data-theme="dark"] :is(.peach,.priority.medium){background:#403725;color:#e9cf9b}
[data-theme="dark"] .blue{background:#243c4a;color:#b3d9f0}
[data-theme="dark"] .priority.high{background:#482f2c;color:#f3bcae}
[data-theme="dark"] :is(.daily-banner,.posting-summary){background:#1c2836;border-color:#3a4a5d;color:#e3ebf8}
[data-theme="dark"] :is(.daily-banner p,.banner-tag,.posting-summary p,.posting-summary h2>span,.posting-summary-note,.posting-summary .eyebrow){color:#b0bcce}
[data-theme="dark"] .banner-icon{background:#263445;border-color:#42546c;color:#b8d3f6}
[data-theme="dark"] :is(.empty-icon,.connection-badge){background:#25303e;border-color:#3c4a5d;color:#b0c2dc}
[data-theme="dark"] :is(.link-card:hover,.add-row:hover,.welcome-step:hover){background:var(--hover);border-color:#6b81a0}
[data-theme="dark"] :is(.welcome-card,.command-review){border-color:#42556d;box-shadow:none}
[data-theme="dark"] :is(.welcome-step,.quick-capture,.connection-setup,.posting-overview .posting-footnote){background:var(--surface);border-color:var(--line)}
[data-theme="dark"] :is(.step-number,.quick-plus,.welcome-step svg,.welcome-card .eyebrow,.connection-setup code,.tool-description code,.required-mark){color:#b1c3dd}
[data-theme="dark"] .day-clear{background:linear-gradient(180deg,var(--paper),#192430)}
[data-theme="dark"] .day-clear .empty-icon{background:#2a3c54;border-color:#465975;color:#b2cef3}
[data-theme="dark"] .decision{background:#2b291f;border-color:#514b33}
[data-theme="dark"] .decision p{color:#c3b9c7}
[data-theme="dark"] :is(.decision-tag,.connection-label){color:#d5bf8e}
[data-theme="dark"] .decision-recommendation{border-color:#887443}
[data-theme="dark"] .day>span{background:#242c36;color:#b3becc}
[data-theme="dark"] .day.current>span{background:#365e87;color:#fff}
[data-theme="dark"] .notice{background:#232f3d;color:#bbc9dc}
[data-theme="dark"] .storage-warning{background:#3b3021;border-color:#79603b;color:#f1d7a8}
[data-theme="dark"] :is(.danger-text,.form-error){color:#f2aca4}
[data-theme="dark"] dialog::backdrop{background:#04080cb8}
[data-theme="dark"] .toast{background:#a0c2e9;color:#122030;box-shadow:0 6px 30px #0005}
[data-theme="dark"] #toast-undo{color:#172e4a;border-color:#527196}
[data-theme="dark"] .connection-card.selected{background:#263445;border-color:#637a98}
[data-theme="dark"] :is(.command-json,.result-text){background:var(--field);border-color:#3c4857;color:#c0d1e8}
[data-theme="dark"] .command-status{background:#403725;color:#e9cf9b}
[data-theme="dark"] :is(.command-status.status-success,.today-label,.action-loading){background:#263447;border-color:#3c4c63;color:#bbd2f2}
[data-theme="dark"] .posting-weekdays legend{color:var(--muted)}
[data-theme="dark"] .posting-weekdays span{background:var(--field);border-color:#404a57;color:#a7b1be}
[data-theme="dark"] .posting-weekdays input:checked+span{background:#2c3e54;border-color:#88a0c0;color:#c8ddfb}
[data-theme="dark"] progress.progress{background:#303a45}
[data-theme="dark"] progress.progress::-webkit-progress-bar{background:#303a45}
[data-theme="dark"] progress.progress::-webkit-progress-value{background:#8bafdc}
[data-theme="dark"] progress.progress::-moz-progress-bar{background:#8bafdc}
[data-theme="dark"] footer{color:#9aa5b3}
[data-theme="dark"] .theme-toggle{background:#232f3d;color:#c5d7ed;border-color:#495a71}

@media(max-width:650px){.theme-toggle{padding:8px;width:38px;flex-shrink:0}.theme-label{display:none}.topbar-actions{gap:12px}.topbar .search input{width:105px}}

/* Navy accents and keyboard focus. */
[data-theme="dark"] .brand-icon>span{color:#bfdbfe}
[data-theme="dark"] :is(.workspace-dot,.local-dot){background:#7aabf5}
[data-theme="dark"] :is(button,a,input,select,textarea):focus-visible,[data-theme="dark"] .posting-weekdays input:focus-visible+span{outline-color:#8ab8ff}
