:root {
  color-scheme: light;
  --chart-label: #546b81;
  --chart-grid: #e1e8ef;
  --chart-bar: #078d7e;
  --chart-last: #0b4950;
}

:root[data-palette="red"] {
  --page: #f8f5f4;
  --ink: #302523;
  --muted: #705e5d;
  --line: #e7dbd8;
  --deep: #392321;
  --sidebar-bg: #321c1e;
  --nav-ink: #e7d5d3;
  --nav-muted: #ccb7b5;
  --nav-line: #674549;
  --nav-hover: #48272b;
  --nav-current-bg: #692e32;
  --nav-current-ink: #fff0eb;
  --nav-marker: #ff7973;
  --accent: #b22926;
  --accent-text: #922823;
  --accent-strong: #8e191a;
  --accent-line: #e3b7b2;
  --pale: #fbe8e5;
  --accent-tint: var(--pale);
  --button-fill: #c12d28;
  --button-hover: #9c231f;
  --focus: #c73b34;
  --feature-fill: #782c2d;
  --feature-hint: #ffdad5;
  --chart-bar: #e5322d;
  --chart-last: #922322;
  --bar-accent: var(--chart-bar);
  --summary-fill: #f8eeec;
  --summary-line: #dfc9c5;
  --auth-background: linear-gradient(135deg,#2e1b1c,#512a2b 58%,#842f2c);
}

:root[data-mode="dark"] {
  color-scheme: dark;
  --page: #10171f;
  --surface: #1b2530;
  --ink: #eef2f6;
  --deep: #eff5fa;
  --muted: #b3bfcc;
  --line: #394654;
  --sidebar-bg: #0c131b;
  --neutral-fill: #25313e;
  --neutral-hover: #303f4f;
  --control-text: #ced8e3;
  --control-line: #526172;
  --row-line: #33404c;
  --shadow: 0 4px 18px #0002;
  --accent: #78e0cb;
  --accent-text: #9debdc;
  --accent-strong: #adf5e4;
  --pale: #233e40;
  --accent-tint: var(--pale);
  --accent-line: #4b8178;
  --button-fill: #176f63;
  --button-hover: #207b70;
  --focus: #82e3cc;
  --feature-fill: #21434b;
  --feature-hint: #b4dcd5;
  --summary-fill: #233438;
  --summary-line: #47625f;
  --chart-label: #b9c7d3;
  --chart-grid: #40505e;
  --chart-bar: #53bda9;
  --chart-last: #a0e9d8;
  --bar-accent: var(--chart-bar);
  --bar-muted: #96a7b9;
  --auth-background: linear-gradient(135deg,#0b141c,#18232e 65%,#153b3c);
  --good-text: #9de7be;
  --good-bg: #244238;
  --warn-text: #ffd58c;
  --warn-bg: #4c3924;
  --error-text: #ffb5ba;
  --error-bg: #512e37;
  --weekday-text: #ffbb77;
  --weekday-bg: #47301f;
  --weekday-line: #96683f;
  --calendar-weekend: #ffacd0;
  --calendar-weekend-bg: #482739;
  --weekend-line: #8c4f70;
  --calendar-holiday: #ddc1ff;
  --calendar-holiday-bg: #392b4c;
  --calendar-holiday-line: #765a93;
}

:root[data-palette="red"][data-mode="dark"] {
  --sidebar-bg: #211719;
  --accent: #ff9188;
  --accent-text: #ffb5ad;
  --accent-strong: #ffc5bb;
  --accent-line: #965c56;
  --pale: #472e30;
  --button-fill: #b02e2c;
  --button-hover: #be3933;
  --focus: #ff9e95;
  --feature-fill: #5d3033;
  --feature-hint: #ffd3cb;
  --summary-fill: #372b2f;
  --summary-line: #6d4a4d;
  --chart-bar: #f56f64;
  --chart-last: #ffb8a9;
  --auth-background: linear-gradient(135deg,#171419,#262026 65%,#462728);
}

[data-mode="dark"] [data-workday-tone="work"] { --workday-fill: var(--good-bg); --workday-line: #447856; --workday-ink: var(--good-text); }
[data-mode="dark"] [data-workday-tone="scheduled_off"] { --workday-fill: var(--neutral-fill); --workday-line: var(--control-line); --workday-ink: var(--control-text); }
[data-mode="dark"] [data-workday-tone="transferred_off"] { --workday-fill: var(--warn-bg); --workday-line: #986c39; --workday-ink: var(--warn-text); }
[data-mode="dark"] [data-workday-tone="makeup"] { --workday-fill: #223852; --workday-line: #576fa3; --workday-ink: #b7d6ff; }
[data-mode="dark"] :is(dialog, textarea) { background: var(--surface); color: var(--ink); }
[data-mode="dark"] .google-map-credit { background: white; }

rs-appearance { display: block; width: 100%; font-size: var(--text-compact); }
rs-appearance details { margin: 0; padding-block: .5rem; }
rs-appearance summary { width: fit-content; color: inherit; padding: .25rem 0; }
.sidebar rs-appearance { border-block: 1px solid var(--nav-line,#345365); color: var(--nav-ink,#c3d3de); }
.auth-card rs-appearance { border-top: 1px solid var(--line); margin-top: 1rem; }
.appearance-options { display: grid; gap: .65rem; margin: .55rem 0 .25rem; }
.palette-options { display: flex; flex-wrap: wrap; gap: .4rem; }
.palette-options button { display: inline-flex; align-items: center; gap: .4rem; min-height: 32px; border: 1px solid transparent; border-radius: 6px; padding: .25rem .6rem; background: transparent; color: inherit; font: inherit; }
.palette-options button[aria-pressed="true"] { border-color: currentColor; font-weight: 650; }
.palette-options button::before { content: ''; width: .65rem; height: .65rem; border-radius: 50%; background: #0c9b88; }
.palette-options [data-choice-palette="red"]::before { background: #e5322d; }
.appearance-options label { display: flex; align-items: center; gap: .45rem; width: fit-content; color: inherit; cursor: pointer; margin: 0; }
.appearance-options input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--button-fill,#007366); }
@media print { rs-appearance { display: none; } }
