:root, [data-theme="light"], [data-theme="glass"] {
  color-scheme: light;
  --canvas: #f3f6f8;
  --rail: #fafdfe;
  --surface: #fff;
  --surface-alt: #f7f9fb;
  --hover: #edf4f7;
  --line: #dce5e9;
  --line-strong: #bacbd3;
  --text: #162a38;
  --muted: #536975;
  --dim: #637782;
  --accent: #17676b;
  --accent-hover: #0e5358;
  --accent-ink: #fff;
  --accent-soft: #e0f1f0;
  --good: #22674e;
  --good-soft: #e2f3e9;
  --warn: #8c5516;
  --warn-soft: #fcf0d9;
  --danger: #a02e44;
  --danger-soft: #faeaf0;
  --chart-a: #197f81;
  --chart-b: #3a68aa;
  --chart-c: #ad6427;
  --shadow: 0 18px 50px rgb(16 44 59 / .14);
  --scrim: rgb(18 36 47 / .46);
  --radius: 10px;
  --font: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Microsoft YaHei UI", monospace;
  font-family: var(--font);
  font-size: 14px;
}

[data-theme="dark"], [data-theme="gray"], [data-theme="gradient"] {
  color-scheme: dark;
  --canvas: #141e28;
  --rail: #18242f;
  --surface: #1d2b37;
  --surface-alt: #233441;
  --hover: #2b3e4b;
  --line: #354a58;
  --line-strong: #526b7b;
  --text: #e9f1f4;
  --muted: #b4c6cf;
  --dim: #a0b5c0;
  --accent: #88d7d3;
  --accent-hover: #a1e4e0;
  --accent-ink: #132c30;
  --accent-soft: #294e52;
  --good: #a5e1bd;
  --good-soft: #244c40;
  --warn: #f2ca93;
  --warn-soft: #513e2a;
  --danger: #f5abb6;
  --danger-soft: #583541;
  --chart-a: #70d2cc;
  --chart-b: #93bafa;
  --chart-c: #f0b16d;
  --shadow: 0 18px 50px rgb(2 12 19 / .45);
  --scrim: rgb(6 16 22 / .69);
}

[data-theme="gray"] {
  --canvas: #1d1f23;
  --rail: #222429;
  --surface: #272a30;
  --surface-alt: #2e3238;
  --hover: #353b44;
  --line: #40454e;
  --line-strong: #59626e;
  --accent: #c4d5ec;
  --accent-hover: #d4e5fc;
  --accent-ink: #202630;
  --accent-soft: #3b4758;
}

[data-theme="gradient"] {
  --canvas: #221f35;
  --rail: #232137;
  --surface: #29283e;
  --surface-alt: #34324a;
  --hover: #403c57;
  --line: #494760;
  --line-strong: #655f7f;
  --accent: #dbc3f6;
  --accent-hover: #ead3ff;
  --accent-ink: #2e2241;
  --accent-soft: #493d63;
}

[data-theme="glass"] {
  --canvas: #e7f0f7;
  --rail: #eaf4fa;
  --surface: #f5fbff;
  --surface-alt: #ecf5fb;
  --hover: #e0edf6;
  --line: #cbdfe9;
  --accent: #245d83;
  --accent-hover: #19496a;
  --accent-soft: #dceef7;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--text); background: var(--canvas); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
button { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: default; opacity: .52; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
img, svg { display: block; }
h1, h2, h3, p, figure { margin: 0; }
input:not([type="checkbox"]):not([type="range"]):not([type="color"]), select, textarea {
  min-width: 0;
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input[type="checkbox"], input[type="range"] { accent-color: var(--accent); }
input[type="range"] { width: 100%; }
select { min-height: 36px; }
textarea { resize: vertical; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span, .field > label { font-size: .92rem; font-weight: 600; }
.inline-field { display: inline-flex; gap: 7px; align-items: center; }
.button, .icon-button {
  min-height: 36px;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--hover); border-color: var(--line-strong); }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.button.primary:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }
.button.danger { color: var(--danger); }
.button.danger:hover:not(:disabled) { background: var(--danger-soft); }
.button.danger.primary { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.button.subtle, .icon-button { background: transparent; border-color: transparent; color: var(--muted); }
.icon-button { width: 36px; padding: 6px; }
.icon { width: 17px; height: 17px; flex: none; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.form-message { color: var(--danger); font-size: .91rem; overflow-wrap: anywhere; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; animation-duration: 0s !important; }
}
