/* Shared semantic colors keep each palette consistent across the workspace. */
:root {
  color-scheme:light;
  --muted:#53655c; --surface-soft:#edf2e8; --button-ink:#ffffff;
  --nav-active:#315a4c; --nav-ink:#edf3f0;
  --warning-bg:#fff1d6; --warning-ink:#73501a;
  --error-bg:#fbe9e7; --error-ink:#913a34;
  --success-bg:#e5f1df; --success-ink:#355d2e;
  --info-bg:#e8f0fa; --info-ink:#365b81;
}
html[data-theme="ocean"] {
  --ink:#20394d; --muted:#4e6576; --accent:#17618a; --accent-dark:#114969;
  --line:#cedde7; --control-line:#6e8392; --bg:#edf4f8; --white:#ffffff; --sidebar:#13384e;
  --surface-soft:#e1eef6; --nav-active:#24546e;
}
html[data-theme="forest"] {
  --ink:#283c2c; --muted:#53664f; --accent:#3c6533; --accent-dark:#2d4c27;
  --line:#d3dfcb; --control-line:#75846b; --bg:#f0f4e9; --white:#fcfef8; --sidebar:#293f23;
  --surface-soft:#e5eddc; --nav-active:#465f38;
}
html[data-theme="paper"] {
  --ink:#43372d; --muted:#706052; --accent:#805133; --accent-dark:#633c25;
  --line:#e4d5c1; --control-line:#8c7b66; --bg:#f6efe2; --white:#fffcf5; --sidebar:#47372b;
  --surface-soft:#efe4d2; --nav-active:#69503a;
}
html[data-theme="midnight"] {
  color-scheme:dark;
  --ink:#e8edf5; --muted:#b0bfd0; --accent:#88c8f5; --accent-dark:#b0dcfa;
  --line:#43556a; --control-line:#8aa0b8; --bg:#111b28; --white:#1b293a; --sidebar:#0c1420;
  --surface-soft:#25374b; --button-ink:#10283c; --nav-active:#304c68;
  --warning-bg:#42361e; --warning-ink:#f6d68d;
  --error-bg:#482929; --error-ink:#ffb9b0;
  --success-bg:#243e30; --success-ink:#b4dfb1;
  --info-bg:#223e59; --info-ink:#b6dcff;
}
.topbar,.metric,.quick-actions,.auth-card,.skip-link,input,select,textarea,.complete-check {
  background:var(--white); color:var(--ink); border-color:var(--line);
}
.button {color:var(--button-ink)}
.button.secondary {background:var(--white);color:var(--ink);border-color:var(--line)}
.button.secondary:hover,.complete-check:hover {background:var(--surface-soft);color:var(--accent)}
.global-search,.daily-brief,.brief-mark,.count,.pill.selected,.date-tile,pre,.secret,
.calendar-day.outside,.is-today,.calendar-event,.relationship-map,.upload-dropzone.drag-active {
  background:var(--surface-soft);border-color:var(--line);color:var(--ink);
}
input,select,textarea,.global-search {border-color:var(--control-line)}
.global-search input {background:transparent}
.avatar,.topbar-avatar {background:var(--surface-soft);color:var(--ink)}
.daily-brief p,.daily-brief strong,.row-title {color:var(--ink)}
.metric>span,.metric i,.metric-foot,.pill,.matter-number,.priority,.activity a,
.event-row p,.date-tile span,.quick-actions>span,.quick-actions a,.empty,
.tabs a,.day-number,.calendar-event small,footer,.breadcrumb-separator {color:var(--muted)}
.tabs a.selected,.activity a,.quick-actions a {color:var(--accent)}
th {background:var(--surface-soft);color:var(--muted);border-color:var(--line)}
td,.metric-foot,.document-row,.task-row,.event-row,.tabs,footer,.workspace-updates {border-color:var(--line)}
tbody tr:hover,.event-row:hover {background:var(--surface-soft)}
.badge {background:var(--surface-soft);color:var(--ink)}
.badge.green,.badge.pale,.message {background:var(--success-bg);color:var(--success-ink)}
.badge.amber,.notice,.message.warning,.calendar-event.deadline,.amber:not(.dot) {background:var(--warning-bg);color:var(--warning-ink)}
.badge.blue,.message.info {background:var(--info-bg);color:var(--info-ink)}
.message.error {background:var(--error-bg);color:var(--error-ink)}
.errorlist {color:var(--error-ink)}
.priority.high {color:var(--warning-ink)}
.file-icon {background:var(--surface-soft);color:var(--accent)}
.sidebar .nav-link,.sidebar .nav-icon,.sidebar .workspace-label,.sidebar .brand-caption,
.sidebar-bottom,.sidebar .text-button,.sidebar .user-card small,.sidebar .user-card strong {color:var(--nav-ink)}
.nav-link:hover,.nav-link.active,.mobile-navigation a[aria-current=page] {background:var(--nav-active)}
.mobile-navigation button {background:var(--white);color:var(--ink)}
.auth-shell {background:var(--bg)}
.map-node {fill:var(--white);stroke:var(--accent)}
.map-name,.map-caption,.map-label {fill:var(--ink)}
.map-label {stroke:var(--surface-soft)}
.map-edge {stroke:var(--muted)}
.relationship-map marker path {fill:var(--muted)}
.relationship-map a:focus .map-node,.relationship-map a:hover .map-node {stroke:var(--accent)}
input.ai-toggle {background:var(--surface-soft);border-color:var(--muted)}
input.ai-toggle::before {background:var(--muted)}
input.ai-toggle:checked {background:var(--accent);border-color:var(--accent)}
input.ai-toggle:checked::before {background:var(--button-ink)}
:focus-visible {outline:3px solid var(--accent);outline-offset:3px}
.sidebar :focus-visible,.mobile-navigation :focus-visible {outline-color:var(--nav-ink)}
::placeholder {color:var(--muted);opacity:1}
.theme-fieldset {border:0;padding:0;margin:20px 0}
.theme-fieldset legend {font-weight:600;margin-bottom:12px}
.theme-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,175px),1fr));gap:14px}
.theme-card {border:2px solid var(--line);border-radius:10px;padding:12px;cursor:pointer;margin:0;background:var(--white);min-width:0}
.theme-card:has(input:checked) {border-color:var(--accent);box-shadow:0 0 0 1px var(--accent)}
.theme-card:focus-within {outline:3px solid var(--accent);outline-offset:3px}
.theme-choice {display:flex;gap:9px;align-items:center;margin:12px 0 5px}
.theme-choice input {width:18px;height:18px;margin:0;flex-shrink:0;accent-color:var(--accent)}
.theme-description {display:block;color:var(--muted);font-weight:400;font-size:0.75rem}
.theme-preview {display:flex;height:75px;border-radius:5px;overflow:hidden;background:var(--preview-bg)}
.preview-sidebar {width:24%;background:var(--preview-sidebar)}
.preview-content {padding:10px;flex:1;display:grid;gap:6px}
.preview-content span {background:var(--preview-panel);border-radius:2px}
.preview-content span:first-child {width:60%;background:var(--preview-accent)}
.preview-classic {--preview-bg:#f5f6f2;--preview-sidebar:#173f36;--preview-panel:#ffffff;--preview-accent:#246454}
.preview-midnight {--preview-bg:#111b28;--preview-sidebar:#0c1420;--preview-panel:#25374b;--preview-accent:#88c8f5}
.preview-ocean {--preview-bg:#edf4f8;--preview-sidebar:#13384e;--preview-panel:#ffffff;--preview-accent:#17618a}
.preview-forest {--preview-bg:#f0f4e9;--preview-sidebar:#293f23;--preview-panel:#fcfef8;--preview-accent:#3c6533}
.preview-paper {--preview-bg:#f6efe2;--preview-sidebar:#47372b;--preview-panel:#fffcf5;--preview-accent:#805133}
@media(forced-colors:active) {.theme-card:has(input:checked){border-color:Highlight}.theme-preview{border:1px solid CanvasText}}
@media print {html[data-theme]{--bg:#fff;--white:#fff;--ink:#000;--muted:#333;--accent:#164b36;--surface-soft:#eee;color-scheme:light}}
