/* Shared surfaces and an explicit, readable dark palette. */
:root{color-scheme:light;--surface:#fff;--surface-soft:#f3f6f6;--surface-raised:#fff;--text-main:#22364a;--text-muted:#697b88;--border-subtle:#dce4e7;--accent:#315c73;--focus:#5e8fa5;--input-bg:#f8faf9;--success-text:#2c6a56;--warning-text:#8a5d22;--danger-text:#a34342}
html[data-theme="dark"]{color-scheme:dark;--bg:#101c27;--surface:#182936;--surface-soft:#203543;--surface-raised:#223845;--text-main:#e5edf2;--text-muted:#a9bbc8;--border-subtle:#37505f;--accent:#aad4e4;--focus:#9dcddd;--input-bg:#13232f;--success-text:#a4ddc2;--warning-text:#f0ce95;--danger-text:#ffb6ad;--ink:var(--text-main);--muted:var(--text-muted);--line:var(--border-subtle);--forest:#aad4e4;--forest-dark:#315f73;--navy:#a9cadf;--navy-deep:#101e2b;--blue:#a9caeb;--teal:#98d3ca;--copper:#e1b08e;--violet:#c4b4e3;--lime:#bad6dd;--soft:#203543;--shadow:0 8px 30px #00000012}
html[data-theme="dark"] body{background:var(--bg);color:var(--text-main)}
html[data-theme="dark"] .login-shell{background:#142330;color:var(--text-main)}
html[data-theme="dark"] :is(.card,.catalog-card,.announcement-card,.doctor-card,.course-card,.stat-card,.map-main,.modal,.tour-card,.welcome-notice,.notification-settings,.profile-card,.search-examples button,.mobile-nav){background:var(--surface);border-color:var(--border-subtle);box-shadow:none}
html[data-theme="dark"] :is(.topbar,.login-form-panel){background:#142330;border-color:var(--border-subtle)}
html[data-theme="dark"] .sidebar{background:#10202e;border-color:var(--border-subtle)}
html[data-theme="dark"] .sidebar :is(.nav-item,.help-button,.profile-button,.sidebar-onboarding){color:#c0d0dd}
html[data-theme="dark"] .sidebar :is(.nav-item.active,.nav-item:hover,.sidebar-onboarding.active){background:#2b465a;color:#fff}
html[data-theme="dark"] .sidebar :is(.sidebar-footer,.profile-button){border-color:#344958}
html[data-theme="dark"] .sidebar :is(small,.sidebar-section-label){color:#a1b5c5}
html[data-theme="dark"] :is(.main-content,.modal,.tour-card,.welcome-notice,.login-form-panel) :where(h1,h2,h3,h4){color:var(--text-main)}
html[data-theme="dark"] :is(.main-content,.modal,.tour-card,.welcome-notice,.login-form-panel) :where(p,small,dt,dd,label){color:var(--text-muted)}
html[data-theme="dark"] :is(.breadcrumb,.breadcrumb strong,.campus-clock strong,.grade-value,.stat-card strong,.week-label,.schedule-day-heading,.section-title,.lesson-time,.detail-item strong,.request-row strong,.employee-row strong,.assignment-row strong,.submission-row strong,.notification-copy strong,.notification-content strong,.setting-choice strong){color:var(--text-main)}
html[data-theme="dark"] :is(.eyebrow,.page-subtitle,.muted,.text-muted,.breadcrumb span,.campus-clock small,.lesson-tag,.lesson-detail p,.lesson-time small,.slot-info small,.slot-time span,.course-meta,.event-meta,.place-details,.place-status,.event-footer,.catalog-category,.progress-caption,.progress-label,.next-step,.list-meta,.notification-meta,.notification-date,.search-page-label,.search-results-heading>span,.search-page-result small,.search-start p,.count-label,.doctor-filter-count){color:var(--text-muted)}
html[data-theme="dark"] :is(.text-link,.teacher-link,.map-result strong,.map-result-code,.map-building-links button,.map-place-facts dt,.map-floor-overview button,.date-jump button,.search-page-result strong,.search-page-result .search-result-category){color:var(--accent)}
html[data-theme="dark"] :is(.field input,.field select,.field textarea,.search-input,.doctor-search input,.doctor-search select,.doctor-filters input,.doctor-filters select,.academic-filter-panel input,.academic-filter-panel select,.semester-filter select,.map-search-input,.map-floor-controls select,.settings-row select){background:var(--input-bg);border-color:var(--border-subtle);color:var(--text-main)}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#8fa5b7}
html[data-theme="dark"] :is(input,select,textarea):focus{outline-color:var(--focus)}
html[data-theme="dark"] .search-field{background:var(--input-bg);border-color:var(--border-subtle);color:var(--text-muted)}
html[data-theme="dark"] .search-field input,html[data-theme="dark"] .map-search-input input{background:transparent;color:var(--text-main)}
html[data-theme="dark"] .topbar .search-button{background:var(--surface);color:var(--text-muted);border-color:var(--border-subtle)}
html[data-theme="dark"] :is(.icon-button,.btn-secondary,.date-button,.filter-button,.filter-chip,.map-floor-controls button,.map-result,.map-building-links b){background:var(--surface-raised);color:var(--accent);border-color:var(--border-subtle)}
html[data-theme="dark"] .btn-primary,html[data-theme="dark"] .login-form .btn-primary{background:#386d82;color:#f7fcff;border-color:#4a8297}
html[data-theme="dark"] .btn-primary:hover,html[data-theme="dark"] .login-form .btn-primary:hover{background:#40768b}
html[data-theme="dark"] :is(.btn-secondary:hover,.icon-button:hover,.filter-chip:hover,.search-page-result:hover,.search-examples button:hover,.map-result:hover,.map-building-links button:hover){background:#294352}
html[data-theme="dark"] .btn-ghost{color:var(--text-muted)}
html[data-theme="dark"] .btn-ghost:hover{background:var(--surface-soft)}
html[data-theme="dark"] .btn-danger{background:#482e32;color:var(--danger-text);border-color:#765056}
html[data-theme="dark"] :is(.academic-filter-panel input,.academic-filter-panel select):focus{background:var(--input-bg)}
html[data-theme="dark"] :is(.filter-chip.active,.filter-button.active,.academic-status.active,.date-button.active,.content-scope-tabs button.active,.catalog-board-view .active,.map-floor-controls button.active){background:#345d71;color:#f5fbff;border-color:#6a94a6}
html[data-theme="dark"] .date-button strong{color:var(--text-main)}
html[data-theme="dark"] :is(.segmented,.content-scope-tabs,.map-view-switch,.academic-status,.doctor-filters,.date-jump,.request-summary,.detail-box,.settings-app-tour){background:var(--surface-soft);border-color:var(--border-subtle);color:var(--text-muted)}
html[data-theme="dark"] :is(.segmented button,.content-scope-tabs button,.map-view-switch button){color:var(--text-muted)}
html[data-theme="dark"] :is(.segmented button.active,.map-view-switch button.active){background:#3a5668;color:#f5fbff;box-shadow:none}
html[data-theme="dark"] :is(.academic-status-count,.count-label,.map-amenities>span,.map-result-code,.map-building-links button,.notification-kind,.notification-icon,.empty-icon,.search-start-icon,.avatar,.action-icon,.icon-circle,.icon-tile,.catalog-emblem,.service-icon,.place-icon){background:#284252;color:#bbd9e5}
html[data-theme="dark"] .academic-status.active .academic-status-count{background:#517c8e;color:#fff}
html[data-theme="dark"] :is(.badge,.status-gray,.status-pending){background:#2b414f;color:#c4d3dd}
html[data-theme="dark"] :is(.status-blue,.status-new,.status-ready,.status-completed){background:#233f58;color:#b9d8f5}
html[data-theme="dark"] :is(.status-green,.status-open){background:#203e37;color:#b5e1cd}
html[data-theme="dark"] :is(.status-amber,.status-in_progress,.status-needs_info){background:#483c29;color:#f0cf97}
html[data-theme="dark"] :is(.status-red,.status-rejected,.status-closed){background:#492e35;color:#ffc1b7}
html[data-theme="dark"] :is(.tone-blue,.icon-tile.blue){background:#263e55;color:#b6d5ee}
html[data-theme="dark"] :is(.tone-teal,.tone-green){background:#223f3c;color:#acd7ce}
html[data-theme="dark"] :is(.tone-copper,.tone-amber,.icon-tile.amber){background:#493c2d;color:#e9c29a}
html[data-theme="dark"] .tone-violet{background:#3d3450;color:#d8c8f1}
html[data-theme="dark"] .hero-card{background:linear-gradient(118deg,#24485a,#1a3446);border:1px solid #35596b}
html[data-theme="dark"] .hero-card :is(h2,h3,strong){color:#f4f8fb}
html[data-theme="dark"] .hero-card :is(p,.hero-meta,.hero-count,.teacher-link){color:#c8dbe6}
html[data-theme="dark"] .hero-footer .btn{background:#bdd8df;color:#1b3745}
html[data-theme="dark"] :is(.onboarding-card,.residence-summary){background:#223845;border-color:#3b5665}
html[data-theme="dark"] .onboarding-card :is(h2,p,.progress-caption,.next-step){color:var(--text-main)}
html[data-theme="dark"] .onboarding-card .btn{background:var(--surface-raised);color:var(--accent);border-color:var(--border-subtle)}
html[data-theme="dark"] :is(.progress-track,.onboarding-card .progress-track,.assessment-progress){background:#3b4f5b}
html[data-theme="dark"] :is(.progress-fill,.onboarding-card .progress-fill){background:#94bdca}
html[data-theme="dark"] :is(.notice,.change-notice,.notice-success,.message,.message.staff,.notification-item,.notification-item.unread,.notification-entry,.notification-row,.notification-row.unread,.map-consultation){background:#203746;border-color:#39586a;color:var(--text-muted)}
html[data-theme="dark"] :is(.notice strong,.change-notice strong){color:#c6e1ec}
html[data-theme="dark"] :is(.notice-warning,.conflict-label){background:#41392a;border-color:#786348;color:#efd5a4}
html[data-theme="dark"] :is(.employee-dashboard .stat-card:nth-child(1),.employee-dashboard .stat-card:nth-child(2),.employee-dashboard .stat-card:nth-child(3)){background:var(--surface-soft);border-color:var(--border-subtle)}
html[data-theme="dark"] :is(.lesson-row,.request-row,.slot-row,.invoice-row,.academic-status-tabs,.academic-filter-heading,.map-floor-overview,.map-building-links,.map-floor-directory,.notification-feed>.filter-row,.search-page-result,.message-header,.assignment-row,.submission-row,.housing-service-button,.food-menu-row){border-color:var(--border-subtle)}
html[data-theme="dark"] :is(.week-column,.week-column-head,.week-lesson,.clinic-slot,.clinic-date,.booking-row,.event-preview,.today-empty,.housing-request-row){background:var(--surface);border-color:var(--border-subtle);color:var(--text-main)}
html[data-theme="dark"] :is(.week-lesson.is-booking,.clinic-available,.clinic-date.active,.clinic-slot.active){background:#284554;color:var(--text-main)}
html[data-theme="dark"] .mobile-nav{border-top-color:var(--border-subtle)}
html[data-theme="dark"] .mobile-nav .nav-item{color:#a8bdcd}
html[data-theme="dark"] .mobile-nav .nav-item.active{background:#2b4658;color:#d6e9f1}
html[data-theme="dark"] .modal-backdrop{background:#050d16b8}
html[data-theme="dark"] .modal-header{border-color:var(--border-subtle)}
html[data-theme="dark"] .modal-close,html[data-theme="dark"] .modal-header .icon-button{background:#2d4351;color:#d0e0e9}
html[data-theme="dark"] .tour-highlight{outline-color:#8bb9cd}
html[data-theme="dark"] .skip-link{background:var(--surface-raised);color:var(--text-main)}
html[data-theme="dark"] .login-form-wrap>.eyebrow{color:#d5b891}
html[data-theme="dark"] .login-form-wrap>.muted{color:var(--text-muted)}
html[data-theme="dark"] .login-help{color:var(--text-muted)}
html[data-theme="dark"] .map-building-subtitle{color:var(--text-main)!important}
html[data-theme="dark"] :is(.map-caption,.map-view-heading p,.map-detail>p:not(.eyebrow),.map-place-facts dd,.map-search-summary,.map-result small,.map-building-links button small,.map-floor-directory-heading>span,.map-navigator-preview p){color:var(--text-muted)}
html[data-theme="dark"] :is(.map-navigator-preview,.map-no-results){background:#203542;border-color:var(--border-subtle);color:var(--text-muted)}
html[data-theme="dark"] .map-navigator-icon{background:#2c4658;color:#b9d9e8}
html[data-theme="dark"] :is(.map-floor-overview button.active,.map-floor-overview button:hover,.map-result.is-selected,.map-building-links button.active){background:#2e4d61;border-color:#7098ad;color:#d1e6ee}
html[data-theme="dark"] .map-canvas{background:#152b31}
html[data-theme="dark"] .university-map-svg>rect:first-child{fill:#192e35;stroke:#3a565d}
html[data-theme="dark"] .university-map-svg>path[stroke="#fffdf8"]{stroke:#3f535a}
html[data-theme="dark"] .university-map-svg>path[stroke="#d4daca"]{stroke:#6c7e7b}
html[data-theme="dark"] .university-map-svg>path[stroke="#fff"]{stroke:#233c47}
html[data-theme="dark"] .university-map-svg>rect[fill="#e1e7e6"]{fill:#344b55}
html[data-theme="dark"] .map-building-body{fill:#514a35;stroke:#897d58}
html[data-theme="dark"] .map-tone-blue .map-building-body{fill:#2d4b5d;stroke:#52798d}
html[data-theme="dark"] .map-tone-green .map-building-body{fill:#334d41;stroke:#60816c}
html[data-theme="dark"] .map-tone-violet .map-building-body{fill:#484158;stroke:#776c92}
html[data-theme="dark"] :is(.map-building-letter,.map-building-name,.map-room-number){fill:#e0ebef}
html[data-theme="dark"] :is(.map-building-action,.map-tiny){fill:#b5c8cc}
html[data-theme="dark"] .map-room rect{fill:#294957;stroke:#587b8e}
html[data-theme="dark"] :is(.map-room:hover,.map-room:focus,.map-room.is-selected) rect{fill:#3a5e72;stroke:#a6cede}
html[data-theme="dark"] :is(.map-building:hover,.map-building:focus,.map-building.is-selected) .map-building-body{stroke:#d2e6ed}
html[data-theme="dark"] :is(.map-building-shadow){fill:#00000035}
/* Search and selects share one baseline, including wrapped labels and Safari search inputs. */
:is(.academic-filter-panel .academic-filters,.doctor-filters,.schedule-filters){align-items:end}
:is(.academic-filter-panel,.doctor-filters,.schedule-filters) .field{display:flex;flex-direction:column;min-width:0;margin:0}
:is(.academic-filter-panel,.doctor-filters,.schedule-filters) .field>label{min-height:17px;line-height:17px;margin:0 0 8px;display:block}
:is(.academic-filter-panel,.doctor-filters,.schedule-filters) .field>:is(input,select){height:48px;min-height:48px;margin:0;padding:11px 13px;line-height:24px;border-radius:10px;box-sizing:border-box;font-size:13px}
.doctor-filters .doctor-search{max-width:none;margin:0}
input[type="search"]{-webkit-appearance:none;appearance:none}
/* Settings and grade detail use the same surface system in both languages. */
.settings-layout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;align-items:start}
.settings-section{min-width:0;margin:0}
.settings-section h2{font-size:20px;margin:0 0 12px}
.settings-section>p,.settings-help{font-size:12px;color:var(--text-muted);line-height:1.7}
.settings-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:24px 0}
.setting-choice{min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:18px 8px;min-height:96px;background:var(--surface-soft);border:1px solid var(--border-subtle);border-radius:12px;color:var(--text-muted);font-size:12px}
.setting-choice[aria-pressed="true"]{border-color:var(--accent);color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.setting-choice svg{width:25px;height:25px}
.settings-row{display:flex;align-items:center;justify-content:space-between;gap:22px;padding:20px 0;border-top:1px solid var(--border-subtle)}
.settings-row>div{min-width:0;flex:1}
.settings-row strong{display:block;font-size:13px;font-weight:600;line-height:1.6}
.settings-row p{font-size:12px;margin:5px 0 0;line-height:1.6;color:var(--text-muted)}
.settings-row select{width:min(175px,45%);height:46px;padding:8px 12px;border:1px solid var(--border-subtle);border-radius:10px;background:var(--input-bg);color:var(--text-main)}
.settings-switch{display:inline-flex;align-items:center;justify-content:center;flex:0 0 46px;cursor:pointer}
.settings-switch input[type="checkbox"]{appearance:none;width:44px;height:26px;margin:0;border:1px solid #a5b5bf;border-radius:20px;background:#cad6dd;position:relative;cursor:pointer;transition:background .15s}
.settings-switch input[type="checkbox"]::after{content:"";position:absolute;width:18px;height:18px;border-radius:50%;background:#fff;left:3px;top:3px;box-shadow:0 1px 4px #0002;transition:transform .15s}
.settings-switch input[type="checkbox"]:checked{background:#376e81;border-color:#376e81}
.settings-switch input[type="checkbox"]:checked::after{transform:translateX(18px)}
.settings-switch input[type="checkbox"]:focus-visible{outline:3px solid var(--focus);outline-offset:3px}
.settings-app-tour{border:1px solid var(--border-subtle);border-radius:14px;padding:20px;background:var(--surface-soft);margin-top:20px}
.settings-app-tour p{font-size:12px;line-height:1.7;color:var(--text-muted)}
.login-form-panel{position:relative}
.login-preferences{display:flex;gap:10px;justify-content:flex-end;position:absolute;right:24px;top:22px}
.login-preferences button{background:var(--surface-soft);border:1px solid var(--border-subtle);border-radius:9px;min-width:38px;min-height:38px;padding:8px;color:var(--text-main);font-size:12px}
.theme-toggle{flex-shrink:0}
.grade-total{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:20px;border:1px solid var(--border-subtle);background:var(--surface-soft);border-radius:14px;margin-bottom:20px}
.grade-total strong{font-size:32px;color:var(--text-main);letter-spacing:-.04em}
.grade-total p{font-size:12px;color:var(--text-muted);margin:6px 0 0}
.assessment-list{display:grid;gap:0;margin-top:24px}
.assessment-item{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;border-bottom:1px solid var(--border-subtle);padding:17px 0}
.assessment-item>div:first-child{flex:1;min-width:0}
.assessment-item h3{font-size:14px;margin:0 0 6px}
.assessment-item p,.assessment-item small{font-size:12px;line-height:1.6;color:var(--text-muted);margin:0}
.assessment-item strong{white-space:nowrap;font-size:16px;color:var(--text-main)}
.assessment-progress{height:7px;border-radius:8px;background:#dde8eb;overflow:hidden;margin-top:12px}
.assessment-progress>span,.assessment-progress>div{display:block;height:100%;background:#668b9a;border-radius:8px}
.grade-summary-rule,.grade-final{margin-top:20px;padding:16px 18px;border-radius:12px;background:var(--surface-soft);font-size:12px;line-height:1.75;color:var(--text-muted)}
@media(max-width:1000px){.settings-layout{grid-template-columns:1fr}.settings-options{max-width:520px}}
@media(max-width:600px){.settings-layout{gap:18px}.settings-section{padding:22px}.settings-options{gap:7px}.setting-choice{font-size:11px;min-height:85px}.settings-row{gap:14px}.settings-row select{font-size:12px;width:140px}.settings-row strong{font-size:12px}.settings-row p{font-size:11px}.grade-total{padding:16px}.grade-total strong{font-size:27px}.assessment-item{gap:12px}.assessment-item strong{font-size:14px}.login-preferences{position:static;margin:0 0 22px}.theme-toggle.icon-button{width:30px;height:32px;padding:5px}.topbar-actions{gap:7px}}
@media(prefers-reduced-motion:reduce){.settings-switch input[type="checkbox"],.settings-switch input[type="checkbox"]::after{transition:none}}
html[data-theme="dark"] .map-route-summary{background:#253e4b;color:var(--accent)}
html[data-theme="dark"] .map-route-step{border-color:var(--border-subtle);background:var(--surface)}
html[data-theme="dark"] .map-route-step:hover{background:var(--surface-soft);border-color:#779baa}
html[data-theme="dark"] .map-route-step>span{background:#315568;color:#d2e8f0}
html[data-theme="dark"] .map-route-step strong{color:var(--accent)}
html[data-theme="dark"] .map-route-step small{color:var(--text-muted)}
html[data-theme="dark"] .map-route-halo{stroke:#10232d}
html[data-theme="dark"] .map-route-line{stroke:#efb383}
html[data-theme="dark"] .map-route-endpoint{fill:#efb383;stroke:#10232d}
html[data-theme="dark"] .map-route-accessible input{accent-color:#7ba8bc}
.settings-row.settings-switch{display:flex;flex:none;width:100%;justify-content:space-between}
.settings-row.settings-switch>span{min-width:0;flex:1}
.settings-row.settings-switch small{display:block;line-height:1.6;margin-top:5px;color:var(--text-muted)}
.settings-row.settings-switch input{flex:none}
.settings-layout>.settings-app-tour{margin-top:0}
.topbar,.workspace{min-width:0}
.topbar .breadcrumb{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.topbar-actions{flex:0 0 auto}
.settings-app-tour>.btn,.settings-app-tour>.text-link{margin:10px 12px 0 0}
.grade-score-button{display:inline-flex;flex-direction:column;align-items:flex-end;gap:3px;border:0;border-radius:8px;background:transparent;color:var(--text-main);padding:6px 8px;margin:-6px -8px;line-height:1.6}
.grade-score-button:hover{background:var(--surface-soft)}
.grade-score-button small{display:flex!important;align-items:center;gap:3px;color:var(--accent)!important;font-size:10px}
.grade-score-button .icon{width:13px;height:13px}
.grade-subject-link{font-size:13px;font-weight:600;line-height:1.6;align-items:flex-start}
.grade-subject-link .icon{width:14px;height:14px;margin-top:3px}
html[data-theme="dark"] .grades-table-wrap{background:var(--surface);border-color:var(--border-subtle)}
html[data-theme="dark"] .grades-table th{background:var(--surface-soft);color:var(--text-muted);border-color:var(--border-subtle)}
html[data-theme="dark"] .grades-table td{color:var(--text-main);border-color:var(--border-subtle)}
html[data-theme="dark"] .grades-table:has(td[data-label]) :is(tr,td:first-child){border-color:var(--border-subtle)}
html[data-theme="dark"] .grades-table:has(td[data-label]) td::before{color:var(--text-muted)}
html[data-theme="dark"] :is(.stat-card>span,.stat-card p,.academic-courses summary){color:var(--text-muted)}
html[data-theme="dark"] .tone-blue{background:#263e55!important;color:#b6d5ee!important}
html[data-theme="dark"] .tone-teal{background:#223f3c!important;color:#acd7ce!important}
html[data-theme="dark"] :is(.tone-copper,.tone-amber){background:#493c2d!important;color:#e9c29a!important}
html[data-theme="dark"] .tone-violet{background:#3d3450!important;color:#d8c8f1!important}
@media(max-width:1000px){.topbar{gap:12px}.onboarding-layout{grid-template-columns:minmax(0,1fr)}.onboarding-layout>.card{min-width:0}}
html[data-theme="dark"] .modal-header{background:var(--surface);border-color:var(--border-subtle)}
.assessment-item{display:block}
.assessment-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}
.assessment-heading>div{min-width:0;flex:1}
.assessment-heading>.assessment-score{flex:none;white-space:nowrap}
.assessment-comment{margin-top:10px!important}
.grade-total>div:first-child{flex:0 0 110px}
.grade-total>div:first-child>strong{display:block}
.grade-total>div:last-child{flex:1;min-width:0}
.grade-total .eyebrow{display:block;font-size:9px;line-height:1.7;margin-bottom:9px}
.grade-total h3{font-size:16px;margin:0 0 7px}
.grade-final{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.grade-final h3{font-size:15px;margin:7px 0}
@media(max-width:600px){.grade-total{display:block}.grade-total>div:first-child{margin-bottom:18px}.grade-total>div:first-child>strong{font-size:34px}.grade-total h3{font-size:15px}.grade-final{grid-template-columns:1fr;gap:10px}}
html[data-theme="dark"] :is(.quick-service strong,.housing-service-copy strong,.invoice-amount,.slot-time strong,.event-date,.place-card h2,.housing-request-row h3,.detail-item strong,.profile-mini strong){color:var(--text-main)}
html[data-theme="dark"] :is(.quick-service,.quick-service small,.housing-service-copy small,.housing-service-button,.notification-item-meta){color:var(--text-muted)}
html[data-theme="dark"] :is(.quick-service:hover,.housing-service-button:hover){background:var(--surface-soft)}
html[data-theme="dark"] .housing-service-button .housing-service-icon{background:#2a4351;color:#b6d7e2}

/* Dark-theme audit: each legacy surface has a paired text colour. Keep these
   overrides scoped so the established light palette and login artwork stay intact. */
html[data-theme="dark"]{--control-border:#668293;--success-bg:#203e37;--warning-bg:#483c29;--danger-bg:#492e35}
html[data-theme="dark"] :is(.service-card,.campus-feature,.sports-section-grid>.empty-state,.today-section-links>a,.housing-service-button,.more-menu-item,.search-result,.demo-account){background:var(--surface);color:var(--text-main);border-color:var(--border-subtle);box-shadow:none}
html[data-theme="dark"] :is(.service-card:hover,.service-card:focus-visible,.more-menu-item:hover,.search-result:hover,.demo-account:hover,.today-section-links>a:hover){background:var(--surface-soft);border-color:var(--control-border)}
html[data-theme="dark"] :is(.profile-mini,.booking-card,.booking-confirm,.resource-card,.upload-field,.file-preview,.review-result,.demo-panel,.form-help,.notification-preferences,.schedule-editor-preview,.section-contact,.mentor-card,.sidebar-support){background:var(--surface-soft);color:var(--text-muted);border-color:var(--border-subtle)}
html[data-theme="dark"] :is(.profile-mini strong,.section-contact>strong,.payment-total strong,.event-preview strong,.week-title,.week-column-head strong,.schedule-period>strong,.grade-result strong,.teacher-details p strong,.food-menu-row b,.today-section-links>a,.help-faq summary,.review-score,.review-result h3,.lesson-title){color:var(--text-main)}
html[data-theme="dark"] :is(.profile-mini span,.profile-mini>svg,.section-contact>span,.sport-section-details>div,.booked-label,.payment-total,.lesson-meta,.lesson-time>span,.schedule-footnote,.week-time,.week-empty,.clinic-slot span,.date-note,.date-summary,.date-summary strong,.date-summary span,.day-heading,.tour-progress,.catalog-footnote,.announcement-meta,.announcement-footer>span,.menu-caption,.map-floor-controls,.map-route-preview,.map-route-preview span,.academic-courses>summary span,.grade-caption,.grade-result>span,.message-meta,.message-meta strong,.notification-mark,.notification-preferences small,.page-footer,.prototype-note,.form-help,.empty-state){color:var(--text-muted)}
html[data-theme="dark"] :is(.today-section-links small,.today-section-links>a:nth-child(2) small,.campus-feature-body p,.campus-feature .eyebrow,.booking-card p,.booking-confirm p,.resource-card p,.review-result p,.help-faq details p,.mentor-card p,.mentor-card small){color:var(--text-muted)}
html[data-theme="dark"] :is(.section-contact>a,.notification-mark:hover,.forgot-password,.login-about,.place-card .place-hours,.food-menu-section h3){color:var(--accent)}
html[data-theme="dark"] :is(.onboarding-card .progress-caption strong,.progress-caption strong){color:var(--text-main)}
html[data-theme="dark"] :is(.step-number,.task-number,.task-check,.resource-cover,.doctor-avatar,.section-sport-icon,.notification-symbol,.nav-count,.demo-badge){background:#284252;color:#bbd9e5;border-color:var(--control-border)}
html[data-theme="dark"] :is(.onboarding-step.completed>.step-number,.done .task-number,.done .task-check){background:var(--success-bg);color:var(--success-text);border-color:#568879}
html[data-theme="dark"] .service-card .service-icon{background:#263e55;color:#b6d5ee}
html[data-theme="dark"] .service-card:nth-child(3n+2) .service-icon{background:#3d3450;color:#d8c8f1}
html[data-theme="dark"] .service-card:nth-child(3n) .service-icon{background:#493c2d;color:#e9c29a}
html[data-theme="dark"] :is(.tone-gray,.tone-purple,.tone-peach){background:#284252;color:#bbd9e5}
html[data-theme="dark"] .tone-purple{background:#3d3450;color:#d8c8f1}
html[data-theme="dark"] .tone-peach{background:#493c2d;color:#e9c29a}
html[data-theme="dark"] :is(.campus-art,.campus-feature-art){background:#203543;color:var(--text-muted)}
html[data-theme="dark"] .campus-feature-art .badge{background:var(--surface-raised);color:var(--text-main)}
html[data-theme="dark"] .btn-light,html[data-theme="dark"] .hero-card .btn-light{background:#bdd8df;color:#173747;border-color:#bdd8df}
html[data-theme="dark"] .btn-light:hover{background:#d4e7ec;color:#173747}
html[data-theme="dark"] :is(.hero-time span,.hero-count,.hero-top,.hero-teacher,.hero-type){color:#c8dbe6}
html[data-theme="dark"] .hero-teacher:hover{color:#fff}
html[data-theme="dark"] .hero-type{border-color:#597481;background:#284b5b}
html[data-theme="dark"] :is(.action-row,.grade-preview-row,.schedule-footnote,.profile-cover,.profile-button,.help-faq details,.event-footer,.section-contact,.request-heading-actions,.today-section-links>a,.quick-service){border-color:var(--border-subtle)}
html[data-theme="dark"] :is(.action-row>svg:last-child,.request-row>svg,.request-row-end>svg,.search-result>svg:last-child,.search-page-result>svg,.map-result>.icon,.catalog-resource-row>svg,.academic-filter-heading h2 svg){color:var(--text-muted)}
html[data-theme="dark"] .message.message-staff{background:#243b4c;border-color:#476171}
html[data-theme="dark"] :is(.notice-success,.booking-confirm.is-success){background:var(--success-bg);color:var(--success-text);border-color:#477262}
html[data-theme="dark"] .success-copy{color:var(--success-text)!important}
html[data-theme="dark"] :is(.notice-warning,.booking-card.conflict,.schedule-editor-preview:has(.conflict-list)){background:var(--warning-bg);color:var(--warning-text);border-color:#806c4c}
html[data-theme="dark"] :is(.notice-warning strong,.notice-warning p,.notice-warning small,.conflict-list li,.booking-card.conflict p){color:var(--warning-text)}
html[data-theme="dark"] :is(.form-error,.error-banner){color:var(--danger-text)}
html[data-theme="dark"] .error-banner{background:var(--danger-bg);border-color:#80575c}
html[data-theme="dark"] :is(.clinic-occupied,.clinic-slot:disabled){background:#25323c;color:#aab8c2;border-color:#50626f;opacity:1}
html[data-theme="dark"] .clinic-slot:disabled span{color:#aab8c2}
html[data-theme="dark"] .clinic-slot:not(:disabled):hover{background:#2c4c58;color:var(--text-main);border-color:#83a8b4}
html[data-theme="dark"] :is(.week-column.current-day,.week-column.current-day .week-column-head){background:#203543;border-color:#678898}
html[data-theme="dark"] .week-edit{color:var(--warning-text)!important}
html[data-theme="dark"] :is(.academic-status:hover,.schedule-controls .date-button:not(.active):hover,.housing-service-button:hover){background:#294352;border-color:var(--control-border)}
html[data-theme="dark"] .notification-item.is-unread{background:#203746;border-color:#668b9e}
html[data-theme="dark"] .notification-dot{background:#badced;border-color:#142330}
html[data-theme="dark"] .notification-count{background:#a9d0e1;color:#142330}
html[data-theme="dark"] .schedule-date-picker{background:var(--surface-soft);border-color:var(--border-subtle);color:var(--text-muted)}
html[data-theme="dark"] :is(.schedule-date-picker input,.transfer-form input,.transfer-form select){background:var(--input-bg);color:var(--text-main);border-color:var(--control-border)}
html[data-theme="dark"] :is(.field input,.field select,.field textarea,.search-field,.map-search-input,.doctor-filters input,.doctor-filters select,.academic-filter-panel input,.academic-filter-panel select,.semester-filter select,.settings-row select){border-color:var(--control-border)}
html[data-theme="dark"] option{background:var(--input-bg);color:var(--text-main)}
html[data-theme="dark"] :is(button,a,input,select,textarea,[tabindex]):focus-visible{outline:2px solid var(--focus);outline-offset:3px}
html[data-theme="dark"] :is(.btn,.setting-choice):disabled{background:#253743;color:#a9bbc8;border-color:#4e6573;opacity:1;cursor:not-allowed}
html[data-theme="dark"] :is(input,select,textarea):disabled{background:#25323c;color:#aab8c2;opacity:1}
html[data-theme="dark"] .settings-switch input[type="checkbox"]{background:#354d5c;border-color:#7893a2}
html[data-theme="dark"] .settings-switch input[type="checkbox"]:checked{background:#376e81;border-color:#83adbd}
html[data-theme="dark"] .settings-switch input[type="checkbox"]:disabled{opacity:.65}
html[data-theme="dark"] .toast{background:#2c4b60;color:#f4f8fb;border-color:#688a9d}
html[data-theme="dark"] :is(.toast.error,.toast-error){background:#593b3c;color:#ffe5dd;border-color:#94716b}

html[data-theme="dark"] :is(.doctor-meta,.search-caption,.topbar-title,.login-divider,.login-divider span,.login-note,.login-footer){color:var(--text-muted)}
html[data-theme="dark"] .onboarding-task.done{background:var(--surface-soft)}
html[data-theme="dark"] .place-card .place-status{background:var(--surface-soft);color:var(--text-muted)}
html[data-theme="dark"] .place-card .place-icon{background:#493c2d;color:#e9c29a}
html[data-theme="dark"] :is(.notice-success strong,.notice-success p,.notice-success small){color:var(--success-text)}
html[data-theme="dark"] .conflict-label{color:var(--warning-text)}
html[data-theme="dark"] .notification-item .notification-symbol.tone-green{background:var(--success-bg);color:var(--success-text)}
html[data-theme="dark"] .notification-item .notification-symbol.tone-amber{background:var(--warning-bg);color:var(--warning-text)}
html[data-theme="dark"] .settings-switch input[type="checkbox"]::after{background:#fff}
html[data-theme="dark"] .housing-steps{color:var(--text-muted)}
html[data-theme="dark"] .search-examples button{color:var(--accent)}
/* Shared row titles also cover populated clinic appointments. */
html[data-theme="dark"] .request-row-main strong{color:var(--text-main)}
html[data-theme="dark"] .request-row-main small{color:var(--text-muted)}

.topbar .settings-button[aria-current="page"]{box-shadow:inset 0 0 0 1px var(--accent);color:var(--accent)}
@media(max-width:600px){.topbar .settings-button{width:30px;height:32px;padding:5px;flex-shrink:0}}
