/* Loaded last. Keep light-mode colors together instead of changing dark styles. */
.theme-toggle{white-space:nowrap;font-size:11px;min-height:36px;flex-shrink:0}
.auth-theme-bar{display:flex;justify-content:flex-end;max-width:1200px;margin:0 auto;padding:18px 24px 0}
.auth-theme-bar+.auth-layout{min-height:calc(100vh - 60px)}
html[data-theme="light"]{color-scheme:light;--bg:#f3f5f8;--panel:#fff;--line:#d4dbe5;--muted:#586578;--text:#202b3c;--accent:#086d78;--amber:#855300;--red:#b32638}
html[data-theme="light"] :is(.sidebar,.topbar,dialog){background:#fff;border-color:var(--line)}
html[data-theme="light"] :is(button,.editor-toolbar){background:#edf1f6;color:var(--text);border-color:var(--line)}
html[data-theme="light"] button:hover{background:#e0e7ef}
html[data-theme="light"] :is(input,select,textarea,.search,.editor-surface){background:#fff;color:var(--text);border-color:#a9b5c5}
html[data-theme="light"] :is(input,textarea)::placeholder{color:#68778a;opacity:1}
html[data-theme="light"] :is(input,select,textarea):disabled{color:#596579;background:#f0f3f7;opacity:1}
html[data-theme="light"] :is(.nav-item,.tree-item,.tree-unit,.day-number,.more,.agenda-item,.work-link,.editor-toolbar button,.catalog-runs button){background:transparent;color:var(--text)}
html[data-theme="light"] :is(.nav-item.active,.selected,.task-item.active,.day.today){background:#e5f2f4;color:#075e69}
html[data-theme="light"] .nav-item.active{box-shadow:inset 2px 0 var(--accent)}
html[data-theme="light"] :is(.primary,.auth-submit,.today .day-number){background:#086d78;color:#fff;border-color:#086d78}
html[data-theme="light"] :is(.primary,.auth-submit):hover{background:#075661;color:#fff}
html[data-theme="light"] :is(.workspace-label,.metrics small,.breadcrumb,.assignee,.profile-upload,.auth-card label,.profile-feedback){color:var(--muted)}
html[data-theme="light"] :is(.tree-unit,.structure-unit,.tree-dot,.topbar .avatar,.profile-photo){border-color:#b7c4d3}
html[data-theme="light"] :is(.avatar,.person,.profile-photo,.profile-role,.nav-count,.notification-count,.calendar-mode){background:#e4eaf4;color:#354c70;border-color:#bfccdd}
html[data-theme="light"] :is(.day.outside,th){background:#f0f3f7}
html[data-theme="light"] .day.outside .day-number{color:#66758a}
html[data-theme="light"] :is(.event,.badge.normal){background:#e6edf9;color:#334f7c;border-left-color:#587db3}
html[data-theme="light"] :is(.event.high,.badge.high){background:#fff0d5;color:#785000}
html[data-theme="light"] :is(.event.critical,.badge.critical){background:#fce8ec;color:#9b2438}
html[data-theme="light"] .event:hover{filter:brightness(.97)}
html[data-theme="light"] .teal{color:#086d78}
html[data-theme="light"] .auth-error{color:var(--red)}
html[data-theme="light"] .upload-label{background:#f2f6fb;color:#415575;border-color:#9fadc1}
html[data-theme="light"] .editor-surface:focus{border-color:var(--accent)}
html[data-theme="light"] .editor-surface:empty:before{color:#68778a}
html[data-theme="light"] .catalog-row{background:var(--panel)}
html[data-theme="light"] .catalog-row:hover:not(.catalog-row-head){background:#edf4f6}
html[data-theme="light"] .catalog-row-head{background:#edf1f6}
html[data-theme="light"] #toast{background:#e0f2e9;color:#1b6247;border-color:#92b8a6}
html[data-theme="light"] dialog::backdrop{background:rgba(28,42,62,.38)}
html[data-theme="light"] input{accent-color:var(--accent)}
html[data-theme="light"] a{color:var(--accent)}
html[data-theme="light"] .brand{color:var(--text)}
html[data-theme="light"] :focus-visible{outline-color:var(--accent)}
@media(max-width:800px){.topbar{height:auto;min-height:57px;flex-wrap:wrap;padding-top:10px;padding-bottom:10px}.theme-toggle{min-height:40px}.auth-theme-bar{padding:12px 20px 0}}

/* Native button interaction (Space/Enter), styled as a theme switch. */
html[data-theme] .theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;width:100px;min-height:44px;padding:6px 2px;background:transparent;border:1px solid transparent;border-radius:4px;color:var(--muted)}
html[data-theme] .theme-toggle:hover{background:transparent;border-color:var(--line)}
.theme-toggle svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.theme-track{position:relative;display:block;width:46px;height:26px;border:1px solid var(--line);border-radius:14px;background:#303744;flex-shrink:0;transition:background .18s ease}
.theme-thumb{position:absolute;top:3px;left:3px;width:18px;height:18px;background:#dce5f2;border-radius:50%;transition:transform .18s ease,background .18s ease}
html[data-theme="dark"] .theme-moon{color:var(--accent)}
html[data-theme="light"] .theme-sun{color:var(--accent)}
html[data-theme="light"] .theme-track{background:#d8eef0;border-color:#83aeb4}
html[data-theme="light"] .theme-thumb{transform:translateX(20px);background:#086d78}
@media(prefers-reduced-motion:reduce){.theme-track,.theme-thumb{transition:none}}
