/* Theme tokens. The light palette preserves the original interface. */
:root {
  --surface: #ffffff;
  --surface-raised: #fafbfc;
  --focus-ring: #7562df;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 40px;
  min-height: 40px;
  font-size: 12px;
}
.theme-toggle > span[aria-hidden] { font-size: 18px; line-height: 1; }
.appearance-card { margin-bottom: 22px; }
.appearance-card label { max-width: 360px; margin: 18px 0 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
}
html[data-theme="dark"] {
  --bg: #10141d;
  --surface: #191f2b;
  --surface-raised: #202838;
  --ink: #edf0f7;
  --muted: #a6afc2;
  --line: #30394c;
  --purple: #ad9cff;
  --soft: #302a49;
  --green: #83d9b3;
  --focus-ring: #bdadff;
}
html[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
html[data-theme="dark"] :is(aside, .card, .agent, .leadcard, .day, dialog) {
  background: var(--surface);
  color: var(--ink);
}
html[data-theme="dark"] header { background: #171d28ed; }
html[data-theme="dark"] button { background: var(--surface-raised); color: var(--ink); }
html[data-theme="dark"] button:hover { background: #30374c; border-color: #8e7acb; }
html[data-theme="dark"] button.primary {
  background: #8170df;
  border-color: #8170df;
  color: #fff;
}
html[data-theme="dark"] button.primary:hover { background: #7160cc; }
html[data-theme="dark"] :is(.icon, .nav, .link) { background: transparent; }
html[data-theme="dark"] :is(.nav, label, .stat-label, .breadcrumb b, .lane h3, .plan li) {
  color: #b6bfd1;
}
html[data-theme="dark"] :is(.link, .nav.active, .event) { color: #c3b6ff; }
html[data-theme="dark"] :is(.nav.active, .event, .agent-icon, .brand em) { background: var(--soft); }
html[data-theme="dark"] .nav .count { background: #242d40; }
html[data-theme="dark"] :is(.brand-sub, .navlabel, .stat-note, .chart-labels, .legend, footer, th) {
  color: #a1acc0;
}
html[data-theme="dark"] .demo { color: #a9c2b4; }
html[data-theme="dark"] .hero { background: #27223c; border-color: #42385d; }
html[data-theme="dark"] .hero .orb { background: #423463; color: #cbbaff; }
html[data-theme="dark"] .hero p { color: #c0b4d9; }
html[data-theme="dark"] .avatar { background: #3d3641; color: #e1c99c; }
html[data-theme="dark"] .company .avatar { background: #3a2f56 !important; color: #d0bfff !important; }
html[data-theme="dark"] .sidebar-bottom .company { background: #211e31 !important; }
html[data-theme="dark"] :is(input, select, textarea) {
  background: #121925;
  border-color: #3a455c;
  color: var(--ink);
}
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: #939eb5; }
html[data-theme="dark"] :is(th, .dayhead) { background: #202737; }
html[data-theme="dark"] :is(td, .task) { border-bottom-color: var(--line); }
html[data-theme="dark"] :is(.badge, .log) { background: #302b46; color: #c5b7f4; }
html[data-theme="dark"] :is(.badge.green, .up) { background: #203c34; color: #9be1bf; }
html[data-theme="dark"] .badge.orange { background: #423522; color: #edc17d; }
html[data-theme="dark"] .badge.gray { background: #2b3445; color: #b9c3d6; }
html[data-theme="dark"] .notice { background: #383122; color: #e5c98f; }
html[data-theme="dark"] .lane { background: #1d2534; }
html[data-theme="dark"] .today { background: #2b253f; }
html[data-theme="dark"] .progress { background: #333047; }
html[data-theme="dark"] .dot.gray { background: #6c7892; }
html[data-theme="dark"] .chart g { stroke: #30384b; }
html[data-theme="dark"] .chart path[stroke="#d8dce6"] { stroke: #6d7890; }
html[data-theme="dark"] #toast { background: #e7e0ff; color: #242034; }
html[data-theme="dark"] dialog::backdrop { background: #030710b3; }
@media (max-width: 760px) {
  .theme-button-label { display: none; }
  .topright { gap: 7px; }
  .theme-toggle { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) { aside { transition: none; } }
/* Paper documents stay white even when the application's theme is dark. */
@media print {
  html[data-theme] { color-scheme: light; --ink: #202736; --line: #dfe3eb; --bg: #f5f6f8; --muted: #667080; }
  html[data-theme] :is(dialog, .document, .document td) { background: white !important; color: #202736 !important; }
  html[data-theme] :is(.document th, .document .totals) { background: #f4f5f8 !important; color: #202736 !important; }
  html[data-theme] .document .sub, html[data-theme] .document .muted { color: #667080 !important; }
}
