/* Mobile PWA app shell and semantic design system. */
:root{
  --user-font-size:16px;--app-font:system-ui,-apple-system,"Segoe UI","PingFang TC","Microsoft JhengHei",sans-serif;
  --page-padding:clamp(12px,4vw,24px);--card-padding:clamp(12px,3.8vw,20px);--section-gap:clamp(12px,3.5vw,24px);
  --control-height:44px;--radius:14px;--content-max-width:920px;--header-height:calc(58px + env(safe-area-inset-top));--bottom-nav-height:calc(66px + env(safe-area-inset-bottom));
  --density-card-padding:var(--card-padding);--density-row-height:52px;--density-gap:var(--section-gap);
  --font-caption:clamp(10px,calc(var(--user-font-size)*.72),15px);--font-small:clamp(11px,calc(var(--user-font-size)*.84),18px);
  --font-body:clamp(12px,var(--user-font-size),22px);--font-label:clamp(12px,calc(var(--user-font-size)*.92),20px);
  --font-button:clamp(12px,calc(var(--user-font-size)*.92),18px);--font-card-title:clamp(16px,calc(var(--user-font-size)*1.16),25px);
  --font-page-title:clamp(23px,calc(var(--user-font-size)*1.5),34px);--font-brand:clamp(20px,calc(var(--user-font-size)*1.38),30px);--font-nav:clamp(10px,calc(var(--user-font-size)*.72),15px);
}
html[data-density="compact"]{--density-card-padding:clamp(10px,3vw,15px);--density-row-height:46px;--density-gap:clamp(9px,2.6vw,16px)}
html[data-density="comfortable"]{--density-card-padding:clamp(16px,4.5vw,24px);--density-row-height:60px;--density-gap:clamp(18px,4.8vw,30px)}

/* Every theme owns a real light and dark palette. */
html[data-theme="sage"][data-color-mode="light"]{--app-bg:#f3f5f1;--surface-1:#fffefa;--surface-2:#e9eee7;--surface-3:#dce5da;--text-primary:#26342b;--text-secondary:#58685d;--text-muted:#67766c;--border:#ccd7cd;--divider:#dde5dd;--accent:#60745f;--accent-hover:#516550;--accent-pressed:#415341;--accent-soft:#e1e9df;--accent-contrast:#fff;--header-bg:#f9fbf7;--bottom-nav-bg:#1f3027;--nav-active:#fff;--nav-inactive:#b9c6bd;--input-bg:#fff;--dialog-bg:#fffefa;--focus:#346b50}
html[data-theme="sage"][data-color-mode="dark"]{--app-bg:#151d18;--surface-1:#1d2821;--surface-2:#25322a;--surface-3:#304038;--text-primary:#edf3ee;--text-secondary:#c0cdc3;--text-muted:#96a69a;--border:#3e5044;--divider:#314138;--accent:#9bb79a;--accent-hover:#abc5aa;--accent-pressed:#7f9e80;--accent-soft:#2c3e31;--accent-contrast:#132018;--header-bg:#17211b;--bottom-nav-bg:#101713;--nav-active:#f4f8f4;--nav-inactive:#8fa196;--input-bg:#19231d;--dialog-bg:#1d2821;--focus:#a6cfb5}
html[data-theme="baby-blue"][data-color-mode="light"]{--app-bg:#f2f7fb;--surface-1:#ffffff;--surface-2:#e5f0f7;--surface-3:#d5e7f2;--text-primary:#203542;--text-secondary:#526c7b;--text-muted:#627a87;--border:#c8dce7;--divider:#dce8ef;--accent:#3c718e;--accent-hover:#315f79;--accent-pressed:#274d63;--accent-soft:#deedf6;--accent-contrast:#fff;--header-bg:#f7fbfd;--bottom-nav-bg:#173342;--nav-active:#fff;--nav-inactive:#b5cbd7;--input-bg:#fff;--dialog-bg:#fff;--focus:#2c7ea8}
html[data-theme="baby-blue"][data-color-mode="dark"]{--app-bg:#13202a;--surface-1:#1b2b36;--surface-2:#233844;--surface-3:#2c4755;--text-primary:#edf7fb;--text-secondary:#c1d8e3;--text-muted:#90acb9;--border:#3c5867;--divider:#2e4552;--accent:#82bddb;--accent-hover:#9bcae1;--accent-pressed:#67a8c8;--accent-soft:#243f4e;--accent-contrast:#10232d;--header-bg:#15242e;--bottom-nav-bg:#0d1820;--nav-active:#f2fbff;--nav-inactive:#84a5b5;--input-bg:#182833;--dialog-bg:#1b2b36;--focus:#9ed5ee}
html[data-theme="lavender"][data-color-mode="light"]{--app-bg:#f7f4fb;--surface-1:#fff;--surface-2:#eee8f6;--surface-3:#e2d8ef;--text-primary:#382d45;--text-secondary:#665775;--text-muted:#796984;--border:#d8cde4;--divider:#e8e0ef;--accent:#8063a0;--accent-hover:#6e528e;--accent-pressed:#594174;--accent-soft:#ede5f5;--accent-contrast:#fff;--header-bg:#fbf9fd;--bottom-nav-bg:#30253d;--nav-active:#fff;--nav-inactive:#c9bad7;--input-bg:#fff;--dialog-bg:#fff;--focus:#845fb0}
html[data-theme="lavender"][data-color-mode="dark"]{--app-bg:#201927;--surface-1:#2a2233;--surface-2:#362b42;--surface-3:#453651;--text-primary:#f7effb;--text-secondary:#dac9e4;--text-muted:#ad98bb;--border:#594868;--divider:#443650;--accent:#bea0d8;--accent-hover:#cfb4e5;--accent-pressed:#a783c5;--accent-soft:#3d304b;--accent-contrast:#25192e;--header-bg:#241c2c;--bottom-nav-bg:#17111d;--nav-active:#fff7ff;--nav-inactive:#a690b4;--input-bg:#261e2f;--dialog-bg:#2a2233;--focus:#d1b4e8}
html[data-theme="sakura"][data-color-mode="light"]{--app-bg:#fff5f6;--surface-1:#fff;--surface-2:#fae8eb;--surface-3:#f4d9de;--text-primary:#472d34;--text-secondary:#765963;--text-muted:#876770;--border:#e8ccd2;--divider:#f1dde1;--accent:#9b5365;--accent-hover:#874354;--accent-pressed:#713342;--accent-soft:#f7e2e7;--accent-contrast:#fff;--header-bg:#fffafb;--bottom-nav-bg:#42252e;--nav-active:#fff;--nav-inactive:#dfbdc5;--input-bg:#fff;--dialog-bg:#fff;--focus:#9b4058}
html[data-theme="sakura"][data-color-mode="dark"]{--app-bg:#281a1f;--surface-1:#342228;--surface-2:#422b33;--surface-3:#543740;--text-primary:#fff1f4;--text-secondary:#e5c8cf;--text-muted:#b89aa2;--border:#684650;--divider:#50343c;--accent:#dc94a5;--accent-hover:#e8abba;--accent-pressed:#c5778b;--accent-soft:#4a3039;--accent-contrast:#2b1920;--header-bg:#2c1d22;--bottom-nav-bg:#1b1014;--nav-active:#fff7f9;--nav-inactive:#b48d98;--input-bg:#302027;--dialog-bg:#342228;--focus:#f0adbd}
html[data-theme="peach"][data-color-mode="light"]{--app-bg:#fff6f1;--surface-1:#fff;--surface-2:#f9e9df;--surface-3:#f2d8ca;--text-primary:#493229;--text-secondary:#785c50;--text-muted:#866a5e;--border:#e7cfc3;--divider:#f0dfd7;--accent:#a7553d;--accent-hover:#914630;--accent-pressed:#773724;--accent-soft:#f8e3d9;--accent-contrast:#fff;--header-bg:#fffbf8;--bottom-nav-bg:#432c24;--nav-active:#fff;--nav-inactive:#dfc2b5;--input-bg:#fff;--dialog-bg:#fff;--focus:#a9472f}
html[data-theme="peach"][data-color-mode="dark"]{--app-bg:#291d18;--surface-1:#35261f;--surface-2:#432f26;--surface-3:#563c30;--text-primary:#fff2ec;--text-secondary:#e5cdbf;--text-muted:#b89d8f;--border:#6b4d40;--divider:#523b31;--accent:#e29a7f;--accent-hover:#edaf96;--accent-pressed:#c87d62;--accent-soft:#4c342a;--accent-contrast:#2b1b15;--header-bg:#2d201a;--bottom-nav-bg:#1b120e;--nav-active:#fff8f4;--nav-inactive:#b69788;--input-bg:#31221c;--dialog-bg:#35261f;--focus:#f1b09a}
html[data-theme="mint"][data-color-mode="light"]{--app-bg:#f1f8f5;--surface-1:#fff;--surface-2:#e1f1eb;--surface-3:#cfe7de;--text-primary:#233b33;--text-secondary:#526e64;--text-muted:#627b72;--border:#c2ddd3;--divider:#d9e9e3;--accent:#337763;--accent-hover:#286653;--accent-pressed:#1f5242;--accent-soft:#daf0e8;--accent-contrast:#fff;--header-bg:#f7fcfa;--bottom-nav-bg:#17382e;--nav-active:#fff;--nav-inactive:#afd0c4;--input-bg:#fff;--dialog-bg:#fff;--focus:#1c765d}
html[data-theme="mint"][data-color-mode="dark"]{--app-bg:#12221d;--surface-1:#1a2d26;--surface-2:#223a31;--surface-3:#2c4a3e;--text-primary:#edfaf5;--text-secondary:#bfddd2;--text-muted:#8fb4a7;--border:#3a5e50;--divider:#2d493e;--accent:#7bc8ad;--accent-hover:#96d6c0;--accent-pressed:#5fb296;--accent-soft:#24483b;--accent-contrast:#10251d;--header-bg:#142720;--bottom-nav-bg:#0b1813;--nav-active:#f3fffb;--nav-inactive:#80a99b;--input-bg:#172922;--dialog-bg:#1a2d26;--focus:#96dec5}
html[data-theme="oat"][data-color-mode="light"]{--app-bg:#faf6ee;--surface-1:#fffdf8;--surface-2:#efe7d8;--surface-3:#e5d8c5;--text-primary:#3f372c;--text-secondary:#6d6252;--text-muted:#7b705f;--border:#d9cdbb;--divider:#e8dfd1;--accent:#8a7354;--accent-hover:#786247;--accent-pressed:#62503a;--accent-soft:#eee4d3;--accent-contrast:#fff;--header-bg:#fdfaf4;--bottom-nav-bg:#362f26;--nav-active:#fff;--nav-inactive:#d0c2ad;--input-bg:#fffefa;--dialog-bg:#fffdf8;--focus:#876a42}
html[data-theme="oat"][data-color-mode="dark"]{--app-bg:#252119;--surface-1:#302b22;--surface-2:#3d362a;--surface-3:#4d4435;--text-primary:#f8f2e8;--text-secondary:#d8cebc;--text-muted:#aaa08d;--border:#605643;--divider:#494132;--accent:#c3aa82;--accent-hover:#d2bb95;--accent-pressed:#ab916a;--accent-soft:#443a2c;--accent-contrast:#261e15;--header-bg:#29241c;--bottom-nav-bg:#17140f;--nav-active:#fffaf1;--nav-inactive:#a79b87;--input-bg:#2c271f;--dialog-bg:#302b22;--focus:#dcc49d}
html[data-theme="ocean"][data-color-mode="light"]{--app-bg:#eef7fa;--surface-1:#fff;--surface-2:#dceef3;--surface-3:#c9e1e9;--text-primary:#183943;--text-secondary:#4a6d78;--text-muted:#5d7982;--border:#bdd7df;--divider:#d5e7ec;--accent:#347f98;--accent-hover:#286d85;--accent-pressed:#1d586d;--accent-soft:#d4ebf1;--accent-contrast:#fff;--header-bg:#f5fbfc;--bottom-nav-bg:#103845;--nav-active:#fff;--nav-inactive:#a5c9d4;--input-bg:#fff;--dialog-bg:#fff;--focus:#087e9f}
html[data-theme="ocean"][data-color-mode="dark"]{--app-bg:#0e222a;--surface-1:#162f39;--surface-2:#1e3d49;--surface-3:#27505e;--text-primary:#ecf9fc;--text-secondary:#b9dbe3;--text-muted:#87adb7;--border:#376370;--divider:#294d59;--accent:#68b7cf;--accent-hover:#83c6d9;--accent-pressed:#4b9db7;--accent-soft:#1f4654;--accent-contrast:#0a242d;--header-bg:#102730;--bottom-nav-bg:#08171d;--nav-active:#f1fcff;--nav-inactive:#77a4b0;--input-bg:#132b34;--dialog-bg:#162f39;--focus:#89d5e7}
html[data-theme="midnight"][data-color-mode="light"]{--app-bg:#f1f3f8;--surface-1:#fff;--surface-2:#e2e7f2;--surface-3:#d2daeb;--text-primary:#222b43;--text-secondary:#56617b;--text-muted:#68738c;--border:#c7cee0;--divider:#dce1ec;--accent:#485f9b;--accent-hover:#3a4f87;--accent-pressed:#2d3f70;--accent-soft:#dfe5f3;--accent-contrast:#fff;--header-bg:#f8f9fc;--bottom-nav-bg:#1a2443;--nav-active:#fff;--nav-inactive:#b5bfd9;--input-bg:#fff;--dialog-bg:#fff;--focus:#395ca8}
html[data-theme="midnight"][data-color-mode="dark"]{--app-bg:#0f1527;--surface-1:#171f36;--surface-2:#202a46;--surface-3:#2b385a;--text-primary:#f0f3ff;--text-secondary:#c4cbea;--text-muted:#929cc2;--border:#3b486d;--divider:#2c3858;--accent:#879ee2;--accent-hover:#9eb1ed;--accent-pressed:#6d84ca;--accent-soft:#26345b;--accent-contrast:#11182e;--header-bg:#11192d;--bottom-nav-bg:#090e1c;--nav-active:#fff;--nav-inactive:#7d88ae;--input-bg:#141c31;--dialog-bg:#171f36;--focus:#a7baf5}

/* Semantic states and compatibility aliases keep every legacy component theme-aware. */
:root{
  --success:#3f7f5b;--success-soft:color-mix(in srgb,var(--success) 16%,var(--surface-1));
  --warning:#a06a1f;--warning-soft:color-mix(in srgb,var(--warning) 17%,var(--surface-1));
  --danger:#b34d55;--danger-soft:color-mix(in srgb,var(--danger) 14%,var(--surface-1));
  --disabled-state:color-mix(in srgb,var(--text-muted) 48%,var(--surface-2));
  --text-heading:var(--text-primary);--text-body:var(--text-primary);--text-label:var(--text-secondary);--text-caption:var(--text-muted);
  --text-placeholder:var(--text-muted);--text-disabled:var(--text-muted);--text-on-accent:var(--accent-contrast);
  --text-on-warning:#fff;--text-on-danger:#fff;--text-on-success:#fff;
  --icon-primary:var(--text-primary);--icon-secondary:var(--text-secondary);--icon-muted:var(--text-muted);
  --link:var(--accent-hover);--link-hover:var(--accent-pressed);--brand-text:var(--text-heading);
  --input-text:var(--text-body);--input-placeholder:var(--text-placeholder);--input-border:var(--border);--input-focus:var(--focus);
  --input-disabled-bg:var(--disabled-state);--input-disabled-text:var(--text-disabled);
  --scope-bg:var(--surface-2);--scope-label:var(--text-secondary);--scope-value:var(--text-primary);--scope-accent:var(--accent);
  --calendar-text:var(--text-primary);--calendar-muted:var(--text-muted);--calendar-selected-bg:var(--accent);--calendar-selected-text:var(--text-on-accent);
  --calendar-today:var(--accent);--calendar-event:var(--danger);
  --tab-active-bg:var(--accent-soft);--badge-bg:var(--accent-soft);--badge-text:var(--text-primary);
  --empty-state-bg:var(--surface-2);--modal-surface:var(--dialog-bg);--toast-bg:var(--text-primary);--toast-text:var(--app-bg);
  --ink:var(--text-primary);--muted:var(--text-muted);--paper:var(--app-bg);--surface:var(--surface-1);
  --line:var(--border);--teal:var(--accent);--nav:var(--brand-text);--soft-green:var(--accent-soft);
  --coral:var(--danger);--yellow:var(--warning);--soft-clay:var(--danger-soft);
}
html[data-color-mode="dark"]{--success:#7fc39a;--warning:#e0ad62;--danger:#ef8e96;--text-on-warning:#261a08;--text-on-danger:#2b1115;--text-on-success:#10251a}

html{height:100%;overflow:hidden;background:var(--app-bg);color-scheme:light;font-size:var(--font-body);font-family:var(--app-font);-webkit-text-size-adjust:100%;touch-action:manipulation}
html[data-color-mode="dark"]{color-scheme:dark}
body{height:100%;min-height:0;margin:0;overflow:hidden;background:var(--app-bg);color:var(--text-primary);font-family:var(--app-font);overscroll-behavior:none}
body,button,input,select,textarea,.brand strong,.section-head h1,.section-head h2,.title-row h2,dialog h2,.stat strong{font-family:var(--app-font)}
*{scrollbar-width:none}*::-webkit-scrollbar{width:0;height:0;display:none}
.app-shell{height:100dvh;min-height:100dvh;display:grid;grid-template-rows:var(--header-height) minmax(0,1fr) var(--bottom-nav-height);overflow:hidden;background:var(--app-bg)}
.topbar.app-header{position:relative;inset:auto;z-index:50;height:var(--header-height);min-height:0;display:flex;align-items:flex-end;justify-content:flex-start;padding:0 max(var(--page-padding),env(safe-area-inset-right)) 12px max(var(--page-padding),env(safe-area-inset-left));background:var(--header-bg);border:0;border-bottom:1px solid var(--divider);box-shadow:none}
.app-header>strong{display:block;max-width:100%;font-size:var(--font-brand);line-height:1;letter-spacing:-.025em;white-space:nowrap;color:var(--brand-text);overflow:visible;text-overflow:clip}
main#app{grid-row:2;width:100%;max-width:var(--content-max-width);min-height:0;margin:0 auto;padding:var(--page-padding) max(var(--page-padding),env(safe-area-inset-right)) calc(var(--page-padding) + 4px) max(var(--page-padding),env(safe-area-inset-left));overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scroll-behavior:smooth;scroll-padding-top:var(--section-gap);background:var(--app-bg)}
.bottom-nav{grid-row:3;position:relative;inset:auto;z-index:40;width:100%;height:var(--bottom-nav-height);display:grid;grid-template-columns:repeat(4,minmax(0,1fr));justify-content:stretch;padding:4px max(4px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px,env(safe-area-inset-left));overflow:hidden;background:var(--bottom-nav-bg);box-shadow:0 -4px 18px color-mix(in srgb,var(--bottom-nav-bg) 28%,transparent)}
.bottom-nav button{width:100%;min-width:0;min-height:44px;border:0;border-radius:12px;background:transparent;color:var(--nav-inactive);display:grid;align-content:center;justify-items:center;gap:2px;padding:4px 2px;font-size:var(--font-nav);line-height:1.1;white-space:nowrap;transition:background .18s ease,color .18s ease,transform .18s ease}
.bottom-nav button.active{color:var(--nav-active);background:color-mix(in srgb,var(--nav-active) 11%,transparent)}
.bottom-nav .nav-label{max-width:100%;overflow:visible;text-overflow:clip;white-space:nowrap;font-size:var(--font-nav)}
.bottom-nav .nav-icon{width:24px;height:24px}.bottom-nav .nav-icon .app-icon{width:22px;height:22px}

/* Shared primitives inherit semantic tokens. */
.panel,.list-row,.stat,.account-row,.teacher-card,.student-progress-row,.report-group-list>button,.homework-summary-button,.progress-editor-list>button,.homework-history-list>button{background:var(--surface-1);color:var(--text-primary);border-color:var(--border);border-radius:var(--radius)}
.panel{padding:var(--density-card-padding);margin-bottom:var(--density-gap);box-shadow:0 5px 18px color-mix(in srgb,var(--text-primary) 5%,transparent)}
.meta,.empty,small,.settings-inline-status{color:var(--text-caption)}.eyebrow,.field{color:var(--text-label)}
.section-head{gap:12px;align-items:flex-start;margin:2px 0 var(--section-gap)}.section-head h1{font-size:var(--font-page-title);line-height:1.12;white-space:nowrap;word-break:keep-all;overflow-wrap:normal;color:var(--text-heading)}.section-head h2,.title-row h2,dialog h2{font-size:var(--font-card-title);line-height:1.2;color:var(--text-heading)}
.brand strong,.app-header>strong{color:var(--brand-text)}.auth-copy strong,.lesson-pay-preview strong,.active-teacher-view strong,.progress-tabs button.active{color:var(--text-heading)}
a{color:var(--link)}a:hover{color:var(--link-hover)}.icon-btn{color:var(--icon-primary)}
.btn,.icon-btn,input,select,textarea{min-height:var(--control-height);font-size:var(--font-button);border-color:var(--border);border-radius:10px}.btn,.icon-btn{background:var(--surface-1);color:var(--text-primary)}
.btn:hover,.icon-btn:hover{background:var(--surface-2);border-color:var(--accent)}.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--text-on-accent)}.btn.primary:hover{background:var(--accent-hover)}.btn.primary:active{background:var(--accent-pressed)}
input,select,textarea{background:var(--input-bg);color:var(--input-text);border:1px solid var(--input-border)}input::placeholder,textarea::placeholder{color:var(--input-placeholder);opacity:1}input:focus,select:focus,textarea:focus{outline:3px solid color-mix(in srgb,var(--input-focus) 34%,transparent);border-color:var(--input-focus)}
.pill,.auth-chip,.status-pill,.tag-list span,.active-teacher-view,.time-record,.progress-highlight,.schedule-scope-current{background:var(--accent-soft);color:var(--text-primary)}
.tabs{background:var(--surface-1);border-color:var(--border)}.tabs button{color:var(--text-secondary);font-size:var(--font-label)}.tabs button.active{background:var(--accent-soft);color:var(--text-primary);box-shadow:inset 0 -3px 0 var(--accent)}
.notice,.lesson-prep-note,.exam-alert,.compact-history>div:not(.empty),.student-assignment-row,.teacher-student-groups>article,.route-from-home,.lesson-homework,.reminder-days{background:var(--surface-2);color:var(--text-primary)}
.locked-lesson-time,.planned-time,.teacher-assignment-details article,.lesson-pay-preview,.family-location-editor,.duration-summary,.schedule-scope-current{background:var(--surface-2);color:var(--text-primary)}
.lesson-rate-controls input[readonly],.lesson-prep-field input[readonly]{background:var(--surface-2);color:var(--text-primary)}
.duration-summary.invalid,.account-row .account-delete-blocker,.teacher-account-state.unbound{color:var(--danger)}
.btn:disabled,.icon-btn:disabled,input:disabled,select:disabled,textarea:disabled{opacity:.62;color:var(--input-disabled-text);background:var(--input-disabled-bg);cursor:not-allowed}
.btn.danger{background:var(--danger);border-color:var(--danger);color:var(--text-on-danger)}.btn.warning{background:var(--warning-soft);border-color:var(--warning);color:var(--text-primary)}
.status-pill[data-status="disabled"],.teacher-status-badge:not(.active){background:var(--danger-soft);color:var(--danger)}.status-pill[data-status="invited"]{background:var(--warning-soft);color:var(--text-primary)}
.family-location-editor,.teacher-detail-overview,.teacher-lifecycle-zone,.teacher-advanced-actions,.teacher-form-section,.confirm-dialog ul{background:var(--surface-2)}
.day{color:var(--calendar-text);min-width:0;min-height:38px;font-size:var(--font-small)}.day-label,.day.other{color:var(--calendar-muted);white-space:nowrap}.day:hover{background:var(--accent-soft)}.day.today{border-color:var(--calendar-today)}.day.selected{background:var(--calendar-selected-bg);color:var(--calendar-selected-text)}.day.has::after{background:var(--calendar-event)}
.calendar-grid{grid-template-columns:repeat(7,minmax(0,1fr));gap:clamp(1px,1vw,4px);width:100%;overflow:hidden}.calendar-head strong{white-space:nowrap;font-size:var(--font-card-title);color:var(--text-heading)}.calendar-head .icon-btn{flex:0 0 44px}
.stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.stat{min-width:0;padding:var(--density-card-padding);text-align:center}.stat span{font-size:var(--font-caption)}.stat strong{font-size:var(--font-card-title);overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.report-group-list>button{grid-template-columns:minmax(0,1fr) auto 18px;min-height:var(--density-row-height);padding:var(--density-card-padding)}
.active-teacher-view,.schedule-scope-current{background:var(--scope-bg);border-left:4px solid var(--scope-accent);color:var(--scope-value)}.active-teacher-view span,.schedule-scope-current span,.schedule-scope-control label{color:var(--scope-label)}.active-teacher-view strong,.schedule-scope-current strong{color:var(--scope-value)}
.empty{background:var(--empty-state-bg);border-radius:10px}.empty+.btn.primary{color:var(--text-on-accent)}
.smart-page-header{position:relative;top:auto;background:var(--app-bg);backdrop-filter:none}.smart-page-header.collapsed{padding-block:8px}.smart-page-header.collapsed .meta{opacity:1}.smart-page-header.collapsed h1{font-size:var(--font-page-title)}

/* More is a native-like grouped hub. */
.more-page{display:grid;gap:var(--section-gap)}.more-page-heading h1{margin:0;font-size:var(--font-page-title);white-space:nowrap;color:var(--text-heading)}.more-page-heading p{margin:5px 0 0;color:var(--text-caption)}
.more-group{display:grid;gap:0}.more-group h2{margin:0 0 7px;padding-inline:5px;color:var(--text-label);font-size:var(--font-small);font-weight:700}.more-list{overflow:hidden;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface-1)}
.more-row{width:100%;min-height:max(52px,var(--density-row-height));display:grid;grid-template-columns:34px minmax(0,1fr) 24px;align-items:center;gap:10px;padding:10px var(--density-card-padding);border:0;border-bottom:1px solid var(--divider);background:transparent;color:var(--text-primary);text-align:left}.more-row:last-child{border-bottom:0}.more-row:hover,.more-row:focus-visible{background:var(--surface-2)}.more-row>.app-icon{color:var(--accent)}.more-row>span:nth-child(2){display:grid;gap:2px}.more-row strong{font-size:var(--font-label)}.more-row small{color:var(--text-muted);font-size:var(--font-caption)}.more-row>.app-icon:last-child{color:var(--text-muted)}

/* Accordion settings sheet. */
.settings-backdrop{background:color-mix(in srgb,#070b09 70%,transparent)}
.settings-drawer{inset:0 0 0 auto;width:min(520px,100vw);border:0;border-left:1px solid var(--border);background:var(--surface-1);color:var(--text-primary);transform:translateX(102%);box-shadow:-18px 0 55px color-mix(in srgb,#050807 34%,transparent)}
.settings-drawer.open{transform:translateX(0)}.settings-drawer-header{min-height:calc(68px + env(safe-area-inset-top));padding:max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) 12px 18px;background:var(--header-bg);border-color:var(--divider)}
.settings-close{display:grid;place-items:center;width:48px;height:48px;min-width:48px;min-height:48px;padding:0}.settings-close .app-icon{width:23px;height:23px}
.settings-drawer-body{padding:10px max(14px,env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));overflow-y:auto;overscroll-behavior:contain}
.settings-accordion{border-bottom:1px solid var(--divider)}.settings-accordion>summary{min-height:68px;display:grid;grid-template-columns:28px minmax(0,1fr) 22px;align-items:center;gap:10px;padding:10px 4px;list-style:none;cursor:pointer}.settings-accordion>summary::-webkit-details-marker{display:none}.settings-accordion>summary>.app-icon:first-child{color:var(--accent)}.settings-accordion>summary>.app-icon:last-child{color:var(--icon-muted);transition:transform .18s ease}.settings-accordion[open]>summary>.app-icon:last-child{transform:rotate(90deg)}.settings-accordion>summary>span:nth-child(2){display:grid;gap:3px}.settings-accordion>summary strong{font-size:var(--font-label);color:var(--text-heading)}.settings-accordion>summary small{font-size:var(--font-caption);color:var(--text-caption)}
.settings-accordion-panel{display:grid;gap:20px;padding:4px 2px 24px}.settings-accordion-panel>section+section{padding-top:20px;border-top:1px solid var(--divider)}.settings-accordion-panel h3{margin:0 0 12px;font-size:var(--font-card-title);color:var(--text-heading)}
.settings-choice-group{min-width:0;margin:0;padding:0;border:0}.settings-choice-group>legend{margin-bottom:9px;color:var(--text-label);font-size:var(--font-small);font-weight:700}.settings-choice-group>small{display:block;margin-top:8px;color:var(--text-caption)}
.segmented-control{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:4px;border:1px solid var(--border);border-radius:12px;background:var(--surface-2)}.segmented-control label{position:relative;min-width:0}.segmented-control input{position:absolute;width:1px;height:1px;opacity:0}.segmented-control span{min-height:44px;display:grid;place-items:center;padding:6px 4px;border-radius:8px;color:var(--text-secondary);font-size:var(--font-small);text-align:center}.segmented-control input:checked+span{background:var(--surface-1);color:var(--text-primary);box-shadow:0 2px 8px color-mix(in srgb,var(--text-primary) 10%,transparent)}.segmented-control input:focus-visible+span{outline:3px solid color-mix(in srgb,var(--focus) 35%,transparent)}
.theme-preview-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.theme-preview{min-width:0;display:grid;gap:7px;padding:8px;border:2px solid transparent;border-radius:12px;background:color-mix(in srgb,var(--preview-surface,var(--surface-2)) 62%,var(--surface-2));color:var(--text-primary);text-align:left}.theme-preview.selected{border-color:var(--preview-accent,var(--accent));box-shadow:0 0 0 2px color-mix(in srgb,var(--preview-accent,var(--accent)) 22%,transparent)}.theme-preview-canvas{height:58px;display:grid;grid-template-columns:1fr 2fr;grid-template-rows:1fr 1fr;gap:5px;padding:8px;border:1px solid var(--preview-border,var(--border));border-radius:8px;background:var(--preview-bg,var(--app-bg));pointer-events:none}.theme-preview-canvas i{grid-row:1/3;border-radius:5px;background:var(--preview-accent,var(--accent))}.theme-preview-canvas b,.theme-preview-canvas em{border-radius:4px;background:var(--preview-surface,var(--surface-1))}.theme-preview strong{font-size:var(--font-small)}
html[data-color-mode="light"] .theme-preview[data-theme-choice="sage"]{--preview-bg:#f3f5f1;--preview-surface:#fffefa;--preview-border:#ccd7cd;--preview-accent:#60745f}html[data-color-mode="dark"] .theme-preview[data-theme-choice="sage"]{--preview-bg:#151d18;--preview-surface:#25322a;--preview-border:#3e5044;--preview-accent:#9bb79a}
html[data-color-mode="light"] .theme-preview[data-theme-choice="baby-blue"]{--preview-bg:#f2f7fb;--preview-surface:#fff;--preview-border:#c8dce7;--preview-accent:#3c718e}html[data-color-mode="dark"] .theme-preview[data-theme-choice="baby-blue"]{--preview-bg:#13202a;--preview-surface:#233844;--preview-border:#3c5867;--preview-accent:#82bddb}
html[data-color-mode="light"] .theme-preview[data-theme-choice="lavender"]{--preview-bg:#f7f4fb;--preview-surface:#fff;--preview-border:#d8cde4;--preview-accent:#8063a0}html[data-color-mode="dark"] .theme-preview[data-theme-choice="lavender"]{--preview-bg:#201927;--preview-surface:#362b42;--preview-border:#594868;--preview-accent:#bea0d8}
html[data-color-mode="light"] .theme-preview[data-theme-choice="sakura"]{--preview-bg:#fff5f6;--preview-surface:#fff;--preview-border:#e8ccd2;--preview-accent:#9b5365}html[data-color-mode="dark"] .theme-preview[data-theme-choice="sakura"]{--preview-bg:#281a1f;--preview-surface:#422b33;--preview-border:#684650;--preview-accent:#dc94a5}
html[data-color-mode="light"] .theme-preview[data-theme-choice="peach"]{--preview-bg:#fff6f1;--preview-surface:#fff;--preview-border:#e7cfc3;--preview-accent:#a7553d}html[data-color-mode="dark"] .theme-preview[data-theme-choice="peach"]{--preview-bg:#291d18;--preview-surface:#432f26;--preview-border:#6b4d40;--preview-accent:#e29a7f}
html[data-color-mode="light"] .theme-preview[data-theme-choice="mint"]{--preview-bg:#f1f8f5;--preview-surface:#fff;--preview-border:#c2ddd3;--preview-accent:#337763}html[data-color-mode="dark"] .theme-preview[data-theme-choice="mint"]{--preview-bg:#12221d;--preview-surface:#223a31;--preview-border:#3a5e50;--preview-accent:#7bc8ad}
html[data-color-mode="light"] .theme-preview[data-theme-choice="oat"]{--preview-bg:#faf6ee;--preview-surface:#fffdf8;--preview-border:#d9cdbb;--preview-accent:#8a7354}html[data-color-mode="dark"] .theme-preview[data-theme-choice="oat"]{--preview-bg:#252119;--preview-surface:#3d362a;--preview-border:#605643;--preview-accent:#c3aa82}
html[data-color-mode="light"] .theme-preview[data-theme-choice="ocean"]{--preview-bg:#eef7fa;--preview-surface:#fff;--preview-border:#bdd7df;--preview-accent:#347f98}html[data-color-mode="dark"] .theme-preview[data-theme-choice="ocean"]{--preview-bg:#0e222a;--preview-surface:#1e3d49;--preview-border:#376370;--preview-accent:#68b7cf}
html[data-color-mode="light"] .theme-preview[data-theme-choice="midnight"]{--preview-bg:#f1f3f8;--preview-surface:#fff;--preview-border:#c7cee0;--preview-accent:#485f9b}html[data-color-mode="dark"] .theme-preview[data-theme-choice="midnight"]{--preview-bg:#0f1527;--preview-surface:#202a46;--preview-border:#3b486d;--preview-accent:#879ee2}
.font-choice-list{display:grid;gap:6px}.font-choice{position:relative;min-height:54px;display:grid;grid-template-columns:24px minmax(0,1fr);align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:var(--surface-1)}.font-choice input{width:20px;height:20px;accent-color:var(--accent)}.font-choice>span{display:grid;gap:2px;font-family:var(--preview-font)}.font-choice strong{font-size:var(--font-label)}.font-choice small{font-size:var(--font-caption);color:var(--text-muted)}.font-choice:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}.font-loading-status{min-height:1.4em;margin:8px 0 0;color:var(--text-muted);font-size:var(--font-caption)}
.font-size-stepper{display:grid;grid-template-columns:48px minmax(70px,1fr) 48px;gap:8px;align-items:center}.font-size-stepper button,.font-size-stepper input{height:48px;min-height:48px;border:1px solid var(--border);border-radius:10px;background:var(--surface-1);color:var(--text-primary);font-size:20px;text-align:center}.font-size-stepper input{font-variant-numeric:tabular-nums;font-weight:700}.font-size-stepper input::-webkit-inner-spin-button{display:none}
.safe-account-status>div{border-color:var(--divider)}.settings-data-actions,.settings-actions{gap:9px}.switch>span{background:var(--surface-3)}.switch>span::after{background:var(--surface-1)}.switch input:checked+span{background:var(--accent)}

dialog,.confirm-dialog,.conflict-dialog{background:var(--dialog-bg);color:var(--text-primary);border-color:var(--border)}dialog form,dialog form>header{background:var(--dialog-bg)}dialog form>header{border-color:var(--divider)}dialog::backdrop{background:color-mix(in srgb,#080b09 72%,transparent)}#modalBody{overscroll-behavior:contain}.form-actions{background:var(--dialog-bg);border-color:var(--divider)}
#toast{max-width:min(520px,calc(100vw - 24px));bottom:calc(var(--bottom-nav-height) + 10px);padding:11px 16px;border-radius:10px;background:var(--text-primary);color:var(--app-bg);white-space:normal;text-align:center}
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
:focus-visible{outline:3px solid color-mix(in srgb,var(--focus) 40%,transparent);outline-offset:2px}

@media(max-width:640px){
  :root{--content-max-width:100%;--page-padding:clamp(10px,3.5vw,16px)}
  .calendar-create-actions{width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.calendar-create-actions .btn{min-width:0;white-space:normal}
  .schedule-scope-control{margin-inline:0;padding:var(--density-card-padding)}
  .stats{grid-template-columns:1fr}.stat{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;text-align:left}.stat span{font-size:var(--font-small)}.stat strong{text-align:right;overflow-wrap:normal}
  .report-group-list>button{grid-template-columns:minmax(0,1fr) auto 16px}.report-group-list>button>strong{white-space:nowrap}
  dialog{width:100%;height:100dvh;max-width:none;max-height:none;margin:0;inset:0;border:0;border-radius:0}dialog form{height:100%;display:flex;flex-direction:column}dialog form>header{flex:0 0 auto;min-height:calc(58px + env(safe-area-inset-top));padding-top:max(10px,env(safe-area-inset-top));padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right))}#modalBody{flex:1;min-height:0;max-height:none;padding:16px max(14px,env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));overflow-y:auto}.form-actions{position:sticky;bottom:calc(-18px - env(safe-area-inset-bottom));margin:18px -14px calc(-18px - env(safe-area-inset-bottom));padding:12px 14px calc(12px + env(safe-area-inset-bottom))}
  .confirm-dialog,.conflict-dialog{width:calc(100% - 24px);height:auto;max-height:calc(100dvh - 24px);margin:auto;border:1px solid var(--border);border-radius:16px}
}
@media(max-width:380px){
  :root{--page-padding:10px}.app-header>strong{font-size:clamp(19px,7vw,var(--font-brand))}.bottom-nav{padding-inline:2px}.bottom-nav button{padding-inline:0}.bottom-nav .nav-icon{width:22px;height:22px}.bottom-nav .nav-label{font-size:clamp(9px,var(--font-nav),13px)}
  .section-head{flex-wrap:wrap}.section-head>*{min-width:0}.calendar-create-actions{grid-template-columns:1fr}.theme-preview-grid{gap:7px}.theme-preview{padding:6px}.settings-drawer-header h2{font-size:22px}
  .calendar-grid{gap:1px}.day{min-height:36px;padding:0}.day-label{padding-inline:0}
  .lesson-time-axis{grid-template-columns:auto minmax(10px,1fr) minmax(82px,auto) minmax(10px,1fr) auto;padding:.5rem;gap:.2rem}.lesson-axis-state span{display:none}
}
@media(max-width:430px){.report-group-list>button{grid-template-columns:minmax(0,1fr) auto}.report-group-list>button>:last-child{grid-column:1/-1;justify-self:start}.stats{grid-template-columns:1fr}.account-row{grid-template-columns:minmax(0,1fr) auto}.account-row-actions{grid-column:1/-1;justify-self:stretch}.account-row-actions .btn{flex:1}.calendar-head{align-items:flex-start;gap:8px}.calendar-head h1,.calendar-head h2{overflow-wrap:anywhere}}
@media(min-width:760px){.theme-preview-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.app-shell{--header-height:72px;--bottom-nav-height:72px}.topbar.app-header{justify-content:center}.app-header>strong{width:min(var(--content-max-width),calc(100% - 48px))}.bottom-nav{grid-template-columns:repeat(4,minmax(120px,180px));justify-content:center}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
