/* Final design: independent light/dark tokens; loaded after legacy fixed light styles. */
:root { color-scheme: light; --t-bg:#F7F9FE;--t-card:#FFFFFF;--t-text:#142745;--t-secondary:#435673;--t-border:#DBE5F3;--t-input:#FFFFFF;--t-accent:#0B58CF;--t-nav:#FFFFFF;--t-nav-muted:#47617F;--t-hover:#EAF2FF }
body.theme-dark {color-scheme:dark;--t-bg:#0B1426;--t-card:#17233A;--t-text:#F3F7FF;--t-secondary:#C4D0E3;--t-border:#344761;--t-input:#202E47;--t-accent:#8DB6FF;--t-nav:#111D32;--t-nav-muted:#D0DCF0;--t-hover:#253C63}
body.theme-dark,body.theme-dark .workspace{background:var(--t-bg)!important;color:var(--t-text)!important}
body.theme-dark .sidebar,body.theme-dark .topbar,body.theme-dark .bottom-nav,body.theme-dark footer{background:var(--t-nav)!important;color:var(--t-text)!important;border-color:var(--t-border)!important}
body.theme-dark .filter-panel,body.theme-dark .panel,body.theme-dark .metric,body.theme-dark .center-card,body.theme-dark .myroutine-box,body.theme-dark .calendar-detail,body.theme-dark .empty,body.theme-dark .paper-row,body.theme-dark .timeline-row,body.theme-dark .side-note,body.theme-dark .datepill,body.theme-dark .connection{background:var(--t-card)!important;color:var(--t-text)!important;border-color:var(--t-border)!important;box-shadow:0 8px 28px #0002!important}
body.theme-dark .next-card{background:linear-gradient(125deg,#232D4B,#303052)!important;border-color:#435273!important;color:var(--t-text)!important}
body.theme-dark .next-card *,body.theme-dark .next-card h2,body.theme-dark h1,body.theme-dark h2,body.theme-dark h3,body.theme-dark .brand strong,body.theme-dark .top-title strong,body.theme-dark .mini-brand,body.theme-dark .paper-main strong,body.theme-dark .center-name,body.theme-dark .metric strong,body.theme-dark .timer-face,body.theme-dark .quick-item b,body.theme-dark footer b{color:var(--t-text)!important}
body.theme-dark .muted,body.theme-dark .next-date,body.theme-dark .next-card .code,body.theme-dark .time-notice,body.theme-dark .paper-main small,body.theme-dark .timeline-body p,body.theme-dark .section-head .muted,body.theme-dark .save-feedback,body.theme-dark .tiny-note,body.theme-dark .center-caption,body.theme-dark .side-note small,body.theme-dark .brand small,body.theme-dark .datepill,body.theme-dark .selectors label,body.theme-dark .field{color:var(--t-secondary)!important}
body.theme-dark input:not([type=checkbox]):not([type=radio]),body.theme-dark select,body.theme-dark textarea{background:var(--t-input)!important;color:var(--t-text)!important;border-color:var(--t-border)!important}
body.theme-dark input::placeholder,body.theme-dark textarea::placeholder{color:#B2C3DA!important;opacity:1}
body.theme-dark .navlink,body.theme-dark .bottom-nav a{color:var(--t-nav-muted)!important}
body.theme-dark .navlink.active,body.theme-dark .navlink:hover{background:var(--t-hover)!important;color:#FFFFFF!important}
body.theme-dark .bottom-nav a.active,body.theme-dark .eyebrow,body.theme-dark .text-btn,body.theme-dark a:not(.navlink):not(.brand):not(.primary){color:var(--t-accent)!important}
body.theme-dark .bottom-nav a.active{color:#A9C8FF!important}
body.theme-dark .calendar-day{background:#25354F!important;color:#ECF3FF!important}
body.theme-dark .calendar-day.has-exam{background:#183F4D!important;color:#B9FFF2!important}
body.theme-dark .calendar-day.selected{outline-color:#9DC4FF!important}
body.theme-dark .quick-blue,body.theme-dark .quick-amber,body.theme-dark .quick-pink,body.theme-dark .quick-green,body.theme-dark .quick-lavender,body.theme-dark .quick-sky,body.theme-dark .quick-item{background:#203453!important;border:1px solid #39516E!important;color:#F4F8FF!important}
body.theme-dark .count-unit{background:#343957!important;border-color:#4C567D!important}
body.theme-dark .count-unit strong{color:#FFB5D0!important}body.theme-dark .count-unit span{color:#E8D7EE!important}
body.theme-dark .secondary,body.theme-dark .mode-btn{background:#2A3E5D!important;color:#F4F8FF!important;border-color:#536A8A!important}
body.theme-dark .welcome:not(.mood-morning):not(.mood-afternoon):not(.mood-evening):not(.mood-night){background:linear-gradient(110deg,#243758,#403157)!important;border-color:#566580!important}
body.theme-dark .welcome .muted{color:#213656!important}body.theme-dark .welcome h1{color:#074FBB!important}
body.theme-dark .banner-head,body.theme-dark .banner-small{color:var(--t-text)!important}
body.theme-dark .quick-icon{color:#FFFFFF!important;background:#375A89!important}
body.theme-dark .sidecaption{color:#C0D0E7!important}
body.theme-dark .admin-side{display:none!important}
/* Mood banner retains per-time readable colors, rather than forcing white text over pastel. */
body.theme-dark .welcome.mood-night h1,body.theme-dark .welcome.mood-night .muted{color:#FFFFFF!important}
body.theme-dark .welcome.mood-evening .muted,body.theme-dark .welcome.mood-morning .muted,body.theme-dark .welcome.mood-afternoon .muted{color:#244064!important}
/* Consistent focus and readable tap targets */
button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #65A6FF!important;outline-offset:2px}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--t-border);background:var(--t-card);color:var(--t-text);border-radius:12px;min-height:42px;padding:6px 10px;font-size:14px;font-weight:700;cursor:pointer}
@media(max-width:760px){.theme-toggle{min-width:43px;padding:6px}.theme-toggle .toggle-label{display:none}}

body:has(#authPanel).theme-dark{background:#0B1426!important;color:#F3F7FF!important}body:has(#authPanel).theme-dark .header,body:has(#authPanel).theme-dark .card,body:has(#authPanel).theme-dark .stat,body:has(#authPanel).theme-dark dialog,body:has(#authPanel).theme-dark .area,body:has(#authPanel).theme-dark .notice{background:#17233A!important;color:#F3F7FF!important;border-color:#344761!important}body:has(#authPanel).theme-dark h1,body:has(#authPanel).theme-dark h2,body:has(#authPanel).theme-dark p,body:has(#authPanel).theme-dark label,body:has(#authPanel).theme-dark td,body:has(#authPanel).theme-dark th,body:has(#authPanel).theme-dark .welcome h1{color:#F3F7FF!important}body:has(#authPanel).theme-dark .welcome{background:linear-gradient(120deg,#1D355B,#332850)!important;border-color:#40587D!important}body:has(#authPanel).theme-dark input,body:has(#authPanel).theme-dark select,body:has(#authPanel).theme-dark textarea{background:#202E47!important;color:#FFFFFF!important;border:1px solid #48617F!important}
