@media screen {
  #auth-form .auth-fields { position:relative; overflow:hidden; border:1px solid var(--line); border-radius:14px; padding:12px; margin:16px auto; }
  #auth-form .auth-verified { position:absolute; inset:0; display:grid; place-items:center; color:var(--teal); font-size:30px; font-weight:700; background:var(--panel-bg,transparent); }
  #auth-form[data-login-phase="verified"] .auth-fields { border-color:var(--teal); box-shadow:0 0 0 4px #147d7412; }
  #auth-form .auth-fields label { display:block; margin:0; }
  #auth-form .auth-fields label + label { border-top:1px solid var(--line); margin-top:12px; padding-top:12px; }
  .theme-toggle, .account .theme-toggle {
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    min-height:40px; padding:8px 13px; border:1px solid #2c406d; border-radius:11px;
    background:#111d3c; color:#e8efff; font-size:12px; font-weight:700; white-space:nowrap;
    box-shadow:none; transition:background-color .18s ease,border-color .18s ease,color .18s ease;
  }
  .theme-toggle:hover, .account .theme-toggle:hover { background:#1a2a50; border-color:#5789ca; }
  .theme-toggle svg { display:block; flex:none; width:18px; height:18px; }
  .theme-toggle:focus-visible { outline:2px solid #49a8ff; outline-offset:3px; }
  .auth-panel { position:relative; }
  .theme-toggle--auth { position:absolute; top:24px; inset-inline-end:24px; z-index:1; }
  .theme-toolbar { display:flex; justify-content:flex-end; margin-bottom:12px; }

  html[data-theme="light"] {
    color-scheme:light; color:#172b48; background:#f3f6fc;
    --navy:#152b49; --teal:#087a42; --muted:#536782; --line:#d9e3f0;
  }
  html[data-theme="light"] body,
  html[data-theme="light"] .workspace,
  html[data-theme="light"] .auth-panel {
    color:#172b48; background-color:#f3f6fc;
    background-image:radial-gradient(ellipse at 80% 15%,#dceefa80,transparent 45%),linear-gradient(#7c9cc01a 1px,transparent 1px),linear-gradient(90deg,#7c9cc01a 1px,transparent 1px);
  }
  html[data-theme="light"] aside, html[data-theme="light"] .topbar { background:#fff; color:#213650; border-color:#dce5f1; }
  html[data-theme="light"] aside .brand { color:#122747; border-color:#e3eaf3; }
  html[data-theme="light"] .nav-caption, html[data-theme="light"] .sidebar-footer,
  html[data-theme="light"] .sidebar-footer small, html[data-theme="light"] .breadcrumb,
  html[data-theme="light"] .page-heading p, html[data-theme="light"] .workspace-footer { color:#536782; }
  html[data-theme="light"] .sidebar-footer { border-color:#e1e9f3; }
  html[data-theme="light"] .breadcrumb b, html[data-theme="light"] .account { color:#172b48; }
  html[data-theme="light"] nav a { color:#405673; }
  html[data-theme="light"] nav a:hover { color:#12345b; background:#edf4fb; }
  html[data-theme="light"] nav a.active { color:#126b39; background:#e3f7e9; box-shadow:inset -3px 0 #17b94a; }
  html[data-theme="light"] nav .nav-icon { color:#087ac3; }
  html[data-theme="light"] .eyebrow, html[data-theme="light"] .text-button { color:#08783e; }
  html[data-theme="light"] .panel, html[data-theme="light"] .stat,
  html[data-theme="light"] .auth-card, html[data-theme="light"] dialog {
    background:#fff; color:#172b48; border-color:#dce5f1; box-shadow:0 14px 36px #183b6410;
  }
  html[data-theme="light"] .hero { background:linear-gradient(120deg,#e9f3ff,#e5f8ed); border-color:#cfe3ef; }
  html[data-theme="light"] .hero h2, html[data-theme="light"] .stat strong,
  html[data-theme="light"] .empty h3 { color:#142c4d; }
  html[data-theme="light"] .stat .stat-label, html[data-theme="light"] .stat .stat-foot,
  html[data-theme="light"] .section-head span, html[data-theme="light"] .readiness p,
  html[data-theme="light"] .quick-link small, html[data-theme="light"] .hero p { color:#536782; }
  html[data-theme="light"] .stat::before { background:linear-gradient(135deg,#e3f0ff,#dcf7e9); color:#0879ca; }
  html[data-theme="light"] .quick-link { color:#172b48; background:#f8fbff; border-color:#dce6f2; }
  html[data-theme="light"] .quick-link:hover, html[data-theme="light"] .stat:hover { background:#f5faff; border-color:#75afe8; box-shadow:0 12px 30px #2e77bf1c; }
  html[data-theme="light"] .section-head, html[data-theme="light"] .dialog-footer { border-color:#e1e9f3; }
  html[data-theme="light"] .readiness strong { color:#087a42; }
  html[data-theme="light"] .readiness .warning { color:#8c5911; }
  html[data-theme="light"] .primary, html[data-theme="light"] .hero .primary { background:#29df21; color:#082715; }
  html[data-theme="light"] .primary:hover, html[data-theme="light"] .hero .primary:hover { background:#23ca20; box-shadow:0 8px 24px #18a93c33; }
  html[data-theme="light"] .secondary { color:#244466; background:#fff; border-color:#cbd9ea; }
  html[data-theme="light"] .secondary:hover { background:#edf5ff; border-color:#67a7e6; }
  html[data-theme="light"] .icon-button { color:#244466; }
  html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea { background:#fff; color:#172b48; border-color:#cbd9ea; }
  html[data-theme="light"] input::placeholder, html[data-theme="light"] textarea::placeholder { color:#687e99; }
  html[data-theme="light"] .auth-story { background:radial-gradient(ellipse at 20% 80%,#d8f2e7,#eaf4ff 55%,#f5f8ff); color:#152c4a; border-color:#dce5f1; }
  html[data-theme="light"] .auth-story p, html[data-theme="light"] .auth-story>small,
  html[data-theme="light"] .auth-card p, html[data-theme="light"] .auth-card .fine { color:#536782; }
  html[data-theme="light"] .auth-story .eyebrow { color:#08783e; }
  html[data-theme="light"] .table-meta, html[data-theme="light"] th { background:#f1f6fc; color:#405875; border-color:#dce6f1; }
  html[data-theme="light"] td { border-color:#e4ebf4; }
  html[data-theme="light"] tbody tr:hover { background:#f4f9ff; }
  html[data-theme="light"] td button { color:#075b90; background:#e4f3ff; }
  html[data-theme="light"] td button.delete { color:#a52e3e; background:#fff0f1; }
  html[data-theme="light"] .badge { background:#e3f6e9; color:#12673b; }
  html[data-theme="light"] .view-active { color:#fff; background:#0875df; border-color:#0875df; }
  html[data-theme="light"] .lesson { background:#e5f8ef; color:#173d34; border-color:#25a866; }
  html[data-theme="light"] .lesson.practical { background:#e8f2ff; border-color:#268ce1; }
  html[data-theme="light"] .lesson span, html[data-theme="light"] .semester-label,
  html[data-theme="light"] .timetable-empty { color:#536782; }
  html[data-theme="light"] .timetable-cell { scrollbar-color:#9ab6d2 #edf3f9; }
  html[data-theme="light"] .error { background:#fff0f1; border-color:#efb8bf; color:#a12137; }
  html[data-theme="light"] #loading { background:#e9f5ff; color:#15567e; }
  html[data-theme="light"] #toast { background:#d9f9df; color:#10452b; }
  html[data-theme="light"] #update-banner { background:#e8f1fd; color:#173558; }
  html[data-theme="light"] dialog::backdrop { background:#0d1a3980; }
  html[data-theme="light"] .preferences-page .transfer-tabs a,
  html[data-theme="light"] .preferences-page .transfer-link { border-color:#cbd9ea; }
  html[data-theme="light"] .preferences-page .transfer-tabs a[aria-current="page"] { background:#0875df; color:white; }
  html[data-theme="light"] .preferences-page .preference-0 { background:#d8f5e4; }
  html[data-theme="light"] .preferences-page .preference-1 { background:#e0efff; }
  html[data-theme="light"] .preferences-page .preference-2 { background:#ffe8e8; }
  html[data-theme="light"] .preferences-page.transfer-page .table-scroll th { background:#f1f6fc; }
  html[data-theme="light"] .theme-toggle, html[data-theme="light"] .account .theme-toggle { background:#fff; color:#294868; border-color:#cbd9ea; }
  html[data-theme="light"] .theme-toggle:hover, html[data-theme="light"] .account .theme-toggle:hover { background:#edf5ff; border-color:#74a9dc; }

  @media(max-width:480px) {
    .theme-toggle, .account .theme-toggle { min-width:40px; padding:8px; }
    .theme-toggle__label { display:none; }
    .theme-toggle--auth { top:18px; inset-inline-end:18px; }
  }
}
@media print { .theme-toggle, .theme-toolbar { display:none !important; } }

/* Give the active password field the soft illuminated edge of the reference. */
@media screen {
  #auth-form input[name="password"]:focus-visible {
    outline:2px solid #e27659;
    outline-offset:2px;
    border-color:#e27659;
    box-shadow:0 0 0 4px rgba(226,118,89,.18), 0 0 18px rgba(226,118,89,.28);
  }
}
@media screen and (prefers-reduced-motion: no-preference) {
  #auth-form input[name="password"] {
    transition:border-color .18s ease, box-shadow .18s ease, outline-color .18s ease;
  }
}


/* MotionLab's pill interaction: a 450ms reveal and a 140ms press. */
@media screen and (prefers-reduced-motion: no-preference) {
  button.primary, a.primary {
    position:relative; isolation:isolate; overflow:hidden;
    transition:scale .14s cubic-bezier(.22,1,.36,1), opacity .3s, background-color .2s, box-shadow .2s;
  }
  button.primary::after, a.primary::after {
    content:''; display:block; position:absolute; z-index:-1;
    inset-block:2px; left:2px; width:0; border-radius:inherit;
    background:rgba(255,255,255,.82); pointer-events:none;
    transition:width .45s cubic-bezier(.16,1,.3,1);
  }
  button.primary:not(:disabled):hover::after, button.primary:focus-visible::after,
  a.primary:hover::after, a.primary:focus-visible::after { width:calc(100% - 4px); }
  button.primary:not(:disabled):active { transform:none; scale:.97; }
  a.primary:active { scale:.97; }
  #navigation a { transition:background-color .2s, color .25s; }
}

body[data-read-only="true"] :is(#day-save,#pref-save,#pref-reset,#pref-preview,#pref-commit,#alt-generate,#alt-save,#alt-lock,#alt-unlock,#alt-select-all,#open-import,#validate-import,#skip-import,#save-import,#preview-restore,#restore-backup) { display:none!important; }
#read-only-note { padding:10px 20px; background:#17334d; color:#fff; }


@media screen {
  html[data-theme="light"] {
    color:#30382b;
    background:#faf8f2;
    --navy:#30382b;
    --teal:#2a5b53;
    --muted:#4a533f;
    --line:#c7cdb7;
  }
  html[data-theme="light"] :is(body,.workspace,.auth-panel) {
    color:#30382b;
    background:#faf8f2;
  }
  html[data-theme="light"] .auth-story {
    background:#f3f6e9;
    color:#30382b;
  }
  html[data-theme="light"] :is(aside,.topbar,.panel,dialog,.auth-card,.stat) {
    color:#30382b;
    border-color:#c7cdb7;
  }
  html[data-theme="light"] :is(.primary,.hero .primary,.view-active,nav a.active) {
    color:white;
    background:#52633d;
    border-color:#52633d;
  }
  html[data-theme="light"] :is(.primary,.hero .primary):hover {
    color:white;
    background:#3f4934;
    box-shadow:none;
  }
  html[data-theme="light"] :is(.table-meta,th) {
    color:#30382b;
    background:#f3f6e9;
    border-color:#c7cdb7;
  }
  html[data-theme="light"] .lesson {
    background:#f3f6e9;
    border-color:#6e7f52;
    color:#30382b;
  }
  html[data-theme="light"] .lesson.practical {
    background:#f0fdf4;
    border-color:#22c55e;
  }
}
