:root {
    color-scheme: light;
    --navy: #101c32;
    --blue: #3067df;
    --primary-bg: #3067df;
    --primary-hover: #2457c5;
    --on-primary: #fff;
    --text: #19263b;
    --secondary: #536680;
    --muted: #69768b;
    --subtle: #8994a6;
    --line: #e5eaf1;
    --field-border: #dce3ed;
    --bg: #f5f7fb;
    --surface: #fff;
    --surface-soft: #f8f9fc;
    --surface-hover: #f4f7fb;
    --surface-disabled: #f3f5f8;
    --accent-bg: #eef4ff;
    --accent-border: #cfdef7;
    --accent-text: #285cb2;
    --accent-hover-bg: #e1ecff;
    --accent-hover-text: #204b96;
    --success-bg: #eaf7f1;
    --success-text: #168363;
    --purple-bg: #eef1fe;
    --purple-text: #6463c7;
    --danger-bg: #fff2f2;
    --danger-text: #a52626;
    --danger-border: #e7b6b6;
    --warning-bg: #fff5df;
    --warning-text: #75470a;
    --warning-border: #e8ae39;
    --warning-edge: #d78a13;
    --login-bg: #f6f8fc;
    --login-glow: #e9effc;
    --focus: #93b8ff;
    --log-bg: #edf2f8;
    --log-text: #34435a;
    --terminal-bg: #f5f7fb;
    --terminal-fg: #19263b;
    --terminal-selection: #c5d8f4;
    --group-ink-lightness: 32%;
    --group-bg-lightness: 95%;
    --group-border-lightness: 83%;
    --group-tint-alpha: .147;
    --group-0-ink: #2157a0;
    --group-0-bg: #eaf2ff;
    --group-0-border: #c8dcf8;
    --group-0-tint: #2157a026;
    --group-1-ink: #27644b;
    --group-1-bg: #eaf6ef;
    --group-1-border: #c7e6d2;
    --group-1-tint: #27644b26;
    --group-2-ink: #6941a0;
    --group-2-bg: #f2edfc;
    --group-2-border: #ded0f4;
    --group-2-tint: #6941a026;
    --group-3-ink: #805219;
    --group-3-bg: #fff4df;
    --group-3-border: #efdab0;
    --group-3-tint: #80521926;
    --group-4-ink: #176572;
    --group-4-bg: #e8f6f8;
    --group-4-border: #bfe3e9;
    --group-4-tint: #17657226;
    --group-5-ink: #96416d;
    --group-5-bg: #fceef5;
    --group-5-border: #efcede;
    --group-5-tint: #96416d26;
    --group-6-ink: #4b509b;
    --group-6-bg: #eff0fc;
    --group-6-border: #d3d6f4;
    --group-6-tint: #4b509b26;
    --group-7-ink: #944936;
    --group-7-bg: #fcf0eb;
    --group-7-border: #efd3c8;
    --group-7-tint: #94493626;
    --ink: var(--text);
    --green: var(--success-text);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --navy: #0c1422;
    --blue: #9ab9ff;
    --primary-bg: #3067df;
    --primary-hover: #4278eb;
    --on-primary: #fff;
    --text: #e3eaf5;
    --secondary: #c0cde0;
    --muted: #a8b6cb;
    --subtle: #91a2b9;
    --line: #2b3a50;
    --field-border: #3a4c65;
    --bg: #0d1522;
    --surface: #151f2f;
    --surface-soft: #1a2739;
    --surface-hover: #223249;
    --surface-disabled: #1c2737;
    --accent-bg: #20344f;
    --accent-border: #3a5780;
    --accent-text: #a5c5ff;
    --accent-hover-bg: #294364;
    --accent-hover-text: #c6daff;
    --success-bg: #173c32;
    --success-text: #8cddbd;
    --purple-bg: #302d50;
    --purple-text: #c5b9ff;
    --danger-bg: #40242b;
    --danger-text: #f3aaa9;
    --danger-border: #825058;
    --warning-bg: #3f321c;
    --warning-text: #f4ce89;
    --warning-border: #9d772f;
    --warning-edge: #d4a34a;
    --login-bg: #0d1522;
    --login-glow: #1c2e4a;
    --focus: #a5c5ff;
    --log-bg: #0b1422;
    --log-text: #d9e8fc;
    --terminal-bg: #101b2d;
    --terminal-fg: #e4eaf4;
    --terminal-selection: #344f73;
    --group-ink-lightness: 78%;
    --group-bg-lightness: 20%;
    --group-border-lightness: 38%;
    --group-tint-alpha: .18;
    --group-0-ink: #9ac4ff;
    --group-0-bg: #192e49;
    --group-0-border: #315479;
    --group-0-tint: #5296e22b;
    --group-1-ink: #94d7b6;
    --group-1-bg: #19362c;
    --group-1-border: #365e4b;
    --group-1-tint: #63bb8b26;
    --group-2-ink: #ccb4f4;
    --group-2-bg: #302542;
    --group-2-border: #5a407c;
    --group-2-tint: #aa84e826;
    --group-3-ink: #edc68b;
    --group-3-bg: #3c2e1b;
    --group-3-border: #705635;
    --group-3-tint: #c99a4f26;
    --group-4-ink: #8bd1df;
    --group-4-bg: #19343b;
    --group-4-border: #315b63;
    --group-4-tint: #56b8c926;
    --group-5-ink: #edadd0;
    --group-5-bg: #3a2433;
    --group-5-border: #70435c;
    --group-5-tint: #d17da826;
    --group-6-ink: #b8bdf6;
    --group-6-bg: #262c46;
    --group-6-border: #485780;
    --group-6-tint: #9097e826;
    --group-7-ink: #efb5a3;
    --group-7-bg: #3b2a25;
    --group-7-border: #735043;
    --group-7-tint: #ce907926;
    --ink: var(--text);
    --green: var(--success-text);
}
.theme-controls { position:relative;flex-shrink:0; }
.theme-controls .theme-toggle { display:grid;place-items:center;width:32px;height:32px;box-sizing:border-box;padding:6px;border:1px solid var(--field-border);border-radius:7px;background:var(--surface);color:var(--secondary);cursor:pointer;list-style:none; }
.theme-toggle::-webkit-details-marker { display:none; }
.theme-controls .theme-toggle:hover,.theme-controls button:hover { background:var(--surface-hover); }
.theme-controls :is(summary,button):focus-visible { outline:2px solid var(--focus);outline-offset:3px; }
.theme-controls svg { width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
.theme-controls .theme-toggle svg { display:none; }
:root[data-theme-preference="light"] .theme-controls .theme-sun,
:root[data-theme-preference="dark"] .theme-controls .theme-moon,
:root[data-theme-preference="system"] .theme-controls .theme-system { display:block; }
.theme-options { position:absolute;top:calc(100% + 6px);right:0;z-index:100;width:195px;padding:5px;border:1px solid var(--field-border);border-radius:9px;background:var(--surface);box-shadow:0 8px 24px #0003; }
.theme-controls .theme-options button { display:flex;align-items:center;gap:8px;width:100%;min-height:36px;padding:8px 10px;border:0;border-radius:5px;background:transparent;color:var(--text);font:inherit;font-size:13px;text-align:left;white-space:nowrap;cursor:pointer; }
.theme-options button::before { content:"";width:14px;flex-shrink:0; }
.theme-options button[aria-pressed="true"]::before { content:"✓"; }
.theme-controls .theme-options button[aria-pressed="true"] { background:var(--accent-bg);color:var(--accent-text); }
.theme-floating { position:absolute;top:18px;right:20px;z-index:2; }
:root { accent-color:var(--primary-bg); }
::selection { background:var(--terminal-selection);color:var(--text); }
@media(max-width:500px) { .topbar .theme-options { left:0;right:auto; } .theme-floating { top:10px;right:12px; } }
