/* Refined white: shared semantic palette. Keep layout and reading-size rules in workspace.css. */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #fcfcfd;
  --surface: #ffffff;
  --well: #f8fafc;
  --rail: #ffffff;
  --active: #f1f4f8;
  --ink: #20242d;
  --muted: #626c7c;
  --faint: #626c7c;
  --line: #e4e8ef;
  --control: #b4bfce;
  --primary: #2463eb;
  --primary-dark: #1b50c7;
  --on-primary: #ffffff;
  --accent: var(--primary);
  --tint: #eff5ff;
  --selection: #d9e7ff;
  --focus-halo: rgb(36 99 235 / 16%);
  --shadow-color: rgb(24 39 66 / 10%);
  --highlight: rgb(255 255 255 / 75%);
  --scrim: rgb(17 24 39 / 38%);
  --positive-ink: #376048;
  --positive-bg: #edf5ef;
  --positive-border: #c5d9cb;
  --warning-ink: #785a20;
  --warning-bg: #faf3e3;
  --warning-border: #e5d5ad;
  --negative-ink: #a33b3f;
  --negative-bg: #fceef0;
  --negative-border: #e9c5c9;
  --neutral-ink: #626c7c;
  --neutral-bg: #f1f4f8;
  --info-ink: #285c9d;
  --info-bg: #eff5ff;
  --chart-soft: #a8c3f4;
  --radius-panel: 16px;
  --radius-control: 10px;
  --shadow: none;
  --green-bg: var(--tint);
  --amber: var(--warning-ink);
  --border: var(--line);
  --control-shadow: inset 0 1px 0 var(--highlight), 0 1px 2px var(--shadow-color);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12161c;
  --surface: #1c222b;
  --well: #171d25;
  --rail: #171d25;
  --active: #2b3441;
  --ink: #edf2fa;
  --muted: #b2bdce;
  --faint: #b2bdce;
  --line: #333e4e;
  --control: #697b92;
  --primary: #91baff;
  --primary-dark: #afccff;
  --on-primary: #142b4a;
  --tint: #293d59;
  --selection: #354f75;
  --focus-halo: rgb(145 186 255 / 19%);
  --shadow-color: rgb(0 0 0 / 28%);
  --highlight: rgb(255 255 255 / 9%);
  --scrim: rgb(0 0 0 / 60%);
  --positive-ink: #b4d9bd;
  --positive-bg: #283e30;
  --positive-border: #48684f;
  --warning-ink: #e5cb93;
  --warning-bg: #443b27;
  --warning-border: #6d5d3b;
  --negative-ink: #f0b5bc;
  --negative-bg: #472e36;
  --negative-border: #76505b;
  --neutral-ink: #b2bdce;
  --neutral-bg: #2b3441;
  --info-ink: #b1d0ff;
  --info-bg: #293d59;
  --chart-soft: #5275ad;
}
:root[data-theme="eye"] {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --well: #f7faf7;
  --rail: #edf2ef;
  --active: #dde8e2;
  --ink: #203d37;
  --muted: #52665e;
  --faint: #5b6c64;
  --line: #dde6e0;
  --control: #84958d;
  --primary: #176b61;
  --primary-dark: #10544c;
  --on-primary: #ffffff;
  --tint: #edf6f2;
  --selection: #d9eee4;
  --focus-halo: rgb(23 107 97 / 14%);
  --shadow-color: rgb(36 58 42 / 10%);
  --highlight: rgb(255 255 255 / 65%);
  --scrim: rgb(31 44 35 / 38%);
  --positive-ink: #245f45;
  --positive-bg: #eaf4ee;
  --positive-border: #c5d9cb;
  --warning-ink: #80570f;
  --warning-bg: #fff5de;
  --warning-border: #e5d5ad;
  --negative-ink: #963f36;
  --negative-bg: #fceeea;
  --negative-border: #e9c6c0;
  --neutral-ink: #52615b;
  --neutral-bg: #edf1ee;
  --info-ink: #275b75;
  --info-bg: #edf4f7;
  --chart-soft: #aacbb8;
}

html { background: var(--bg); scrollbar-color: var(--control) var(--bg); }
body { background: var(--bg); color: var(--ink); }
::selection { color: var(--ink); background: var(--selection); }
input, select, textarea { caret-color: var(--primary); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--primary); outline-offset: 3px;
}
h1, h2, h3 { color: var(--ink); letter-spacing: -.025em; }
h1 { font-weight: 650; }
.icon { stroke-width: 1.7; }
.sidebar { background: var(--rail); border-right-color: var(--line); }
.topbar { background: var(--surface); border-bottom-color: var(--line); }
/* Brand SVG fills follow the active palette in brand.css. */
.sidebar nav a { color: var(--muted); border-radius: 10px; }
.sidebar nav a:hover { background: var(--well); color: var(--ink); }
.sidebar nav a.active { background: var(--tint); color: var(--primary); }
.sidebar nav a.active .icon { color: var(--primary); }
.avatar { background: var(--tint); color: var(--primary); }
.avatar.pale { background: var(--active); color: var(--ink); }

/* Compact contact shadows give controls shape without dimming the white canvas. */
.button, .select-trigger, .reading-preferences > summary {
  border-radius: var(--radius-control);
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--control-shadow);
  font-weight: 500;
  transition: background-color 140ms ease-out, border-color 140ms ease-out, box-shadow 140ms ease-out;
}
.button:hover, .select-trigger:hover, .reading-preferences > summary:hover {
  background: var(--well); border-color: var(--control);
}
.button:active { background: var(--active); box-shadow: inset 0 1px 2px var(--shadow-color); }
.button.primary, .button.primary:focus { color: var(--on-primary); background: var(--primary); border-color: var(--primary); box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%), 0 2px 3px var(--shadow-color); }
.button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.button.subtle { background: var(--tint); color: var(--primary); border-color: transparent; box-shadow: none; }
.button.danger-subtle { background: transparent; color: var(--negative-ink); border-color: transparent; box-shadow: none; }
.button.danger-subtle:hover { background: var(--negative-bg); }
.main .back-link { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--control-shadow); font-weight: 500; }
.main .back-link:hover { background: var(--well); border-color: var(--control); color: var(--primary); }
.button:disabled, button:disabled, .button[aria-disabled="true"] { opacity: .55; box-shadow: none; cursor: not-allowed; }
.button[aria-busy="true"], button[aria-busy="true"] { cursor: progress; }
.library-tabs .button { border-radius: 0; box-shadow: none; background: transparent; color: var(--muted); }
.library-tabs .button.primary { background: transparent; color: var(--primary); border-color: transparent; border-bottom-color: var(--primary); }
.library-tabs .button:hover { background: transparent; color: var(--primary); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  border-radius: 9px; background: var(--surface); border-color: var(--control);
  color: var(--ink); box-shadow: inset 0 1px 2px var(--shadow-color);
}
input:focus, select:focus, textarea:focus, .select-trigger[aria-expanded="true"] {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-halo);
}
input:disabled, select:disabled, textarea:disabled { background: var(--well); color: var(--muted); }
input[readonly], textarea[readonly] { background: var(--well); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.search-field { border-color: var(--control); background: var(--surface); border-radius: 12px; box-shadow: var(--control-shadow); }
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-halo); }
.search-field input:not([type="checkbox"]):not([type="radio"]), .search-field input:focus { border: 0; box-shadow: none; outline: none; background: transparent; }
.search-field kbd { background: var(--well); border-color: var(--line); }
.select-dropdown, .reading-popover { background: var(--surface); border-color: var(--line); box-shadow: 0 12px 32px var(--shadow-color); }
.select-option[aria-selected="true"] { background: var(--tint); color: var(--primary); }
.select-option:hover, .select-option:focus { background: var(--active); }
.panel, .metric, .person-card, .outcome-kind-card { background: var(--surface); border-color: var(--line); }
.panel, .outcome-kind-card, .person-card { border-radius: var(--radius-panel); }
.outcome-kind-icon { color: var(--primary); }
.outcome-kind-card:hover { background: var(--tint); border-color: var(--control); }
.annual-bar rect, .bar-previous { fill: var(--chart-soft); }
.annual-bar.latest rect, .bar-current { fill: var(--primary); }
.annual-baseline, .chart-grid line { stroke: var(--line); }
.annual-total { color: var(--ink); }
.task-item:hover, .recent-row:hover { background: var(--well); }
.notification-badge { background: var(--primary); color: var(--on-primary); }
.notice-screen { --notice-surface: var(--surface); }
.login-story { background: var(--well); color: var(--ink); }
.login-form-side { background: var(--surface); }
.login-form-wrap input { background: var(--surface); }
.positive, .material-status.complete { color: var(--positive-ink); }
.material-status.incomplete { color: var(--warning-ink); }
mark { background: var(--warning-bg); color: var(--warning-ink); }
.preview-canvas { background: var(--well); }
/* Actual document images retain their original colors. */
.preview-canvas img, .profile-photo img, .person-avatar img { filter: none; }

/* Theme and text preferences share the existing header entry and remember this browser. */
.reading-preferences > summary .icon { width: 18px; height: 18px; }
.reading-popover { width: min(20rem, calc(100vw - 2rem)); border-radius: 14px; }
.preference-title { display: block; margin: 0 0 .65rem; font-size: .875rem; font-weight: 600; color: var(--ink); }
.theme-choices { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .5rem; margin: 0 0 1.15rem; }
.theme-choice { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: max(44px, 2.75rem); padding: .5rem .25rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: .875rem; box-shadow: var(--control-shadow); }
.theme-choice:hover, .reading-choices button:hover { border-color: var(--control); background: var(--well); }
.theme-choice[aria-pressed="true"], .reading-choices button[aria-pressed="true"] { background: var(--tint); border-color: var(--primary); color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.theme-swatch { width: .75rem; height: .75rem; flex-shrink: 0; border: 1px solid var(--control); border-radius: 50%; }
.theme-choice[data-theme-choice="light"] .theme-swatch { background: #fff; }
.theme-choice[data-theme-choice="dark"] .theme-swatch { background: #1c222b; }
.theme-choice[data-theme-choice="eye"] .theme-swatch { background: #edf2ef; }
.reading-choices { margin: 0 0 .8rem; }
.reading-choices button { min-height: max(44px, 2.75rem); border-radius: 9px; background: var(--surface); }
@media (max-width: 43.74em) {
  .reading-preferences:not(.login-preferences) .reading-popover { top: calc(var(--topbar-height, 3.5rem) + .5rem); }
  .reading-preferences > summary { min-width: 2.5rem; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (forced-colors: active) {
  .button, .theme-choice, .reading-choices button, input, select, textarea { border: 1px solid ButtonText; }
  .theme-choice[aria-pressed="true"], .reading-choices button[aria-pressed="true"] { outline: 2px solid Highlight; }
}
