/*!==============================================================
 * Gradebook — Free Teacher Dashboard Template
 * Author: uiCookies · https://uicookies.com/
 * License: Free for personal & commercial use — https://uicookies.com/license/
 * Design layer: forest green, warm cream and terracotta.
 * Newsreader (display serif) + IBM Plex Sans (data and UI).
 *==============================================================*/

/* ------------------------------------------------------------------
   1. Design tokens — change these to rebrand
------------------------------------------------------------------ */
:root {
  /* Surfaces */
  --bg:          #f3ede1;   /* warm cream page */
  --surface:     #fffcf5;   /* cards */
  --surface-2:   #f8f2e6;   /* inset, table headers */
  --surface-3:   #f1e9d9;   /* hover */
  --line:        #e4dac7;
  --line-2:      #d4c7ae;
  --line-soft:   #eee6d6;
  --rule:        rgba(29, 90, 65, .07);  /* exercise-book lines */

  /* Text */
  --ink:         #1e2a23;
  --ink-2:       #3f4b44;
  --muted:       #5f6961;

  /* Brand: forest green */
  --brand:        #1d5a41;
  --brand-strong: #154532;
  --brand-ink:    #1d5a41;
  --brand-soft:   #e1ece3;
  --brand-fill:   #2e7a57;
  --on-brand:     #fdf8ec;

  /* Accent: terracotta */
  --accent:       #a64a28;   /* text-safe on cream (4.9:1 on --bg) */
  --accent-fill:  #b0512d;   /* buttons */
  --accent-hover: #9a4526;
  --accent-soft:  #f6e2d6;
  --accent-ink:   #8f3d1f;
  --on-accent:    #fffaf2;

  /* Status */
  --warn-soft:   #f5e8c8;
  --warn-ink:    #7a5410;
  --danger:      #b3261e;
  --danger-ink:  #9b2c1c;
  --ok-soft:     #dcebdf;
  --ok-ink:      #1d4a33;

  /* Subjects (identity dots; chips always carry text too) */
  --chem: #d9804f;  --chem-soft: #f7e4d9;  --chem-ink: #7a3419;
  --phys: #5a6fd0;  --phys-soft: #e3e7f6;  --phys-ink: #2b3b86;
  --sci:  #11663f;  --sci-soft:  #dcede1;  --sci-ink:  #174a31;

  /* Score scale (diverging: terracotta — neutral — green) */
  --s1: #f0c9b6;  --s1-ink: #6b2811;
  --s2: #f8e3d6;  --s2-ink: #7a3a1f;
  --s3: #f1ece1;  --s3-ink: #3d4640;
  --s4: #dcebdf;  --s4-ink: #1d4a33;
  --s5: #bfdcc8;  --s5-ink: #113a25;

  /* Charts (validated pair) */
  --chart-1: #0f724b;
  --chart-2: #d4703f;
  --grid:    #ebe3d3;
  --axis:    #cfc3aa;

  /* Sidebar */
  --side-bg:     #173d2d;
  --side-bg-2:   #1c4735;
  --side-ink:    #efe7d4;
  --side-muted:  #a8bfb0;
  --side-line:   rgba(239, 231, 212, .12);
  --side-hover:  rgba(255, 248, 230, .07);
  --side-active: rgba(255, 248, 230, .12);
  --side-accent: #e58c63;

  --focus: #c2603c;

  --shadow-sm: 0 1px 2px rgba(30, 42, 35, .05);
  --shadow-md: 0 1px 2px rgba(30, 42, 35, .04), 0 10px 28px -14px rgba(30, 42, 35, .16);
  --shadow-lg: 0 24px 60px -18px rgba(20, 35, 27, .35);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans:  "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --side-w: 264px;
  --side-w-mini: 84px;
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22, .61, .36, 1);

  --bs-body-font-family: var(--sans);
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-link-color-rgb: 29, 90, 65;
  --bs-focus-ring-color: rgba(194, 96, 60, .35);
}

[data-bs-theme="dark"] {
  --bg:          #111714;
  --surface:     #18201c;
  --surface-2:   #1d2621;
  --surface-3:   #242e29;
  --line:        #2c3832;
  --line-2:      #3a4841;
  --line-soft:   #222b26;
  --rule:        rgba(143, 210, 173, .05);

  --ink:         #ede6d6;
  --ink-2:       #cfc9ba;
  --muted:       #9ea79f;

  --brand:        #83c9a2;
  --brand-strong: #9ad6b4;
  --brand-ink:    #8fd2ad;
  --brand-soft:   #1f3a2d;
  --brand-fill:   #4fa57b;
  --on-brand:     #0d1f16;

  --accent:       #ee9d79;
  --accent-fill:  #e0845a;
  --accent-hover: #ea9670;
  --accent-soft:  #3a261d;
  --accent-ink:   #f3b194;
  --on-accent:    #1d0f08;

  --warn-soft:   #3a3019;
  --warn-ink:    #efcf85;
  --danger:      #f08a7e;
  --danger-ink:  #f5a397;
  --ok-soft:     #1f3a2c;
  --ok-ink:      #b7e3c8;

  --chem: #e0915f;  --chem-soft: #3a2519;  --chem-ink: #f2bf9f;
  --phys: #6f86e0;  --phys-soft: #232a45;  --phys-ink: #bcc8f5;
  --sci:  #2f8a5f;  --sci-soft:  #1b3527;  --sci-ink:  #a9dcbf;

  --s1: #5a2a1c;  --s1-ink: #f7d9cb;
  --s2: #3d2a21;  --s2-ink: #eed2c4;
  --s3: #262d29;  --s3-ink: #dcdcd2;
  --s4: #1f3a2c;  --s4-ink: #cfe8d8;
  --s5: #25583f;  --s5-ink: #e4f5ea;

  --chart-1: #45a87b;
  --chart-2: #b4552f;
  --grid:    #26302b;
  --axis:    #3a4841;

  --side-bg:     #0d1712;
  --side-bg-2:   #122019;
  --side-ink:    #e6e0d0;
  --side-muted:  #92a79a;
  --side-line:   rgba(230, 224, 208, .09);
  --side-accent: #ee9d79;

  --focus: #ee9d79;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .25), 0 12px 30px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .7);

  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-border-color: var(--line);
  --bs-link-color-rgb: 143, 210, 173;
  color-scheme: dark;
}

/* ------------------------------------------------------------------
   2. Base
------------------------------------------------------------------ */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .95rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); font-weight: 500; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--brand-ink); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
abbr[title] { text-decoration: none; cursor: help; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: none;
}
.ic { width: 1.15em; height: 1.15em; flex-shrink: 0; }

html:not(.js) .js-only { display: none !important; }

.skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 3000;
  background: var(--brand); color: var(--on-brand);
  padding: .65rem 1.1rem; border-radius: var(--radius-sm); font-weight: 600;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------
   3. Buttons, form controls
------------------------------------------------------------------ */
.btn {
  --bs-btn-font-weight: 600;
  --bs-btn-font-size: .9rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-padding-y: .55rem;
  --bs-btn-border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  letter-spacing: .005em; text-decoration: none !important;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-sm { --bs-btn-padding-x: .75rem; --bs-btn-padding-y: .38rem; --bs-btn-font-size: .84rem; --bs-btn-border-radius: 8px; }
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-color: var(--on-brand);
  --bs-btn-hover-bg: var(--brand-strong); --bs-btn-hover-border-color: var(--brand-strong); --bs-btn-hover-color: var(--on-brand);
  --bs-btn-active-bg: var(--brand-strong); --bs-btn-active-border-color: var(--brand-strong); --bs-btn-active-color: var(--on-brand);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); --bs-btn-disabled-color: var(--on-brand);
}
.btn-accent {
  --bs-btn-bg: var(--accent-fill); --bs-btn-border-color: var(--accent-fill); --bs-btn-color: var(--on-accent);
  --bs-btn-hover-bg: var(--accent-hover); --bs-btn-hover-border-color: var(--accent-hover); --bs-btn-hover-color: var(--on-accent);
  --bs-btn-active-bg: var(--accent-hover); --bs-btn-active-border-color: var(--accent-hover); --bs-btn-active-color: var(--on-accent);
}
.btn-outline {
  --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line-2); --bs-btn-color: var(--ink);
  --bs-btn-hover-bg: var(--surface-3); --bs-btn-hover-border-color: var(--line-2); --bs-btn-hover-color: var(--ink);
  --bs-btn-active-bg: var(--surface-3); --bs-btn-active-border-color: var(--line-2); --bs-btn-active-color: var(--ink);
  --bs-btn-disabled-bg: var(--surface); --bs-btn-disabled-border-color: var(--line); --bs-btn-disabled-color: var(--muted);
}
.btn-quiet {
  --bs-btn-bg: var(--brand-soft); --bs-btn-border-color: transparent; --bs-btn-color: var(--brand-ink);
  --bs-btn-hover-bg: var(--brand-soft); --bs-btn-hover-border-color: var(--brand-fill); --bs-btn-hover-color: var(--brand-ink);
  --bs-btn-active-bg: var(--brand-soft); --bs-btn-active-color: var(--brand-ink);
}
.btn-danger-text { --bs-btn-bg: transparent; --bs-btn-color: var(--danger-ink); --bs-btn-hover-bg: var(--accent-soft); --bs-btn-hover-color: var(--danger-ink); }

.link-btn {
  background: none; border: 0; padding: .2rem 0; color: var(--brand-ink);
  font: 600 .84rem/1.3 var(--sans); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-more { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; font-size: .85rem; white-space: nowrap; }
.link-more .ic { width: 1em; height: 1em; transition: transform .15s var(--ease); }
.link-more:hover .ic { transform: translateX(2px); }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn .ic { width: 20px; height: 20px; }
.icon-btn-sm { width: 34px; height: 34px; }
.icon-btn-sm .ic { width: 17px; height: 17px; }
.has-dot .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-fill); box-shadow: 0 0 0 2px var(--bg); }

.form-label, .toolbar-field label, .toolbar-label { font-weight: 600; font-size: .84rem; color: var(--ink-2); margin-bottom: .35rem; }
.form-label .optional { font-weight: 400; color: var(--muted); margin-left: .35rem; }
.form-control, .form-select {
  background-color: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  border-radius: 10px; font-size: .92rem; padding: .55rem .8rem;
}
.form-select { padding-right: 2.25rem; }
.form-control::placeholder { color: var(--muted); opacity: .85; }
.form-control:focus, .form-select:focus { background-color: var(--surface); border-color: var(--brand-fill); color: var(--ink); }
.form-control-sm, .form-select-sm { font-size: .86rem; padding-top: .38rem; padding-bottom: .38rem; border-radius: 8px; }
.form-control[aria-invalid="true"], .form-select[aria-invalid="true"] { border-color: var(--danger); background-color: var(--accent-soft); }
.form-check-input { background-color: var(--surface); border-color: var(--line-2); }
.form-check-input:checked { background-color: var(--brand-fill); border-color: var(--brand-fill); }
.form-check-label { font-size: .9rem; }
.field-error { display: none; margin-top: .35rem; font-size: .82rem; font-weight: 500; color: var(--danger-ink); }
.field-error.show { display: block; }
.form-success {
  display: flex; gap: .6rem; align-items: flex-start; margin-top: 1rem; padding: .8rem 1rem;
  border-radius: 12px; background: var(--ok-soft); color: var(--ok-ink); font-weight: 500; font-size: .9rem;
}
.form-success[hidden] { display: none; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }

/* ------------------------------------------------------------------
   4. App shell: sidebar, topbar, footer
------------------------------------------------------------------ */
.app { min-height: 100vh; }
.app-main { display: flex; flex-direction: column; flex: 1 1 0%; min-height: 100vh; min-width: 0; }
.app-main > main { flex: 1 0 auto; }

.sidebar {
  --bs-offcanvas-width: 288px;
  --bs-offcanvas-bg: var(--side-bg);
  --bs-offcanvas-color: var(--side-ink);
  background: linear-gradient(180deg, var(--side-bg-2), var(--side-bg) 40%) !important;
  background-color: var(--side-bg) !important;
  color: var(--side-ink);
  display: flex; flex-direction: column;
}
@media (min-width: 992px) {
  .app { display: flex; background: linear-gradient(to right, var(--side-bg) var(--side-w), transparent 0); }
  .sidebar-collapsed .app { background: linear-gradient(to right, var(--side-bg) var(--side-w-mini), transparent 0); }
  .sidebar {
    position: sticky; top: 0; height: 100vh; width: var(--side-w); flex: 0 0 var(--side-w);
    overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--side-line) transparent;
    transition: width .22s var(--ease), flex-basis .22s var(--ease);
    z-index: 1030;
  }
}
@media (max-width: 991.98px) {
  .sidebar { overflow-y: auto; }
  /* Without JavaScript the offcanvas cannot open, so show the menu inline. */
  html:not(.js) .sidebar.offcanvas-lg { position: static; visibility: visible; transform: none; width: 100%; height: auto; }
  html:not(.js) .sidebar-foot { display: none; }
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1.3rem 1.1rem 1rem 1.25rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: var(--side-ink); text-decoration: none !important; min-width: 0; }
.brand-mark {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px; background: #c2603c; color: #fbf6ea;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
}
.brand-mark .ic { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 1.42rem; font-weight: 500; line-height: 1; letter-spacing: -.01em; }
.brand-sub { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--side-muted); margin-top: .3rem; white-space: nowrap; }
.sidebar-close { color: var(--side-ink); }
.sidebar-close:hover { background: var(--side-hover); color: #fff; }

.sidebar-nav { padding: .5rem .85rem; flex: 1 0 auto; }
.side-heading {
  font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--side-muted); padding: 1rem .7rem .45rem;
}
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-link {
  position: relative; display: flex; align-items: center; gap: .8rem;
  padding: .62rem .75rem; border-radius: 10px; color: var(--side-ink); font-weight: 500; font-size: .93rem;
  text-decoration: none !important; white-space: nowrap;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.side-link .ic { width: 20px; height: 20px; color: var(--side-muted); transition: color .15s var(--ease); }
.side-link:hover { background: var(--side-hover); color: #fff; }
.side-link:hover .ic { color: var(--side-ink); }
.side-link[aria-current="page"] { background: var(--side-active); color: #fff; }
.side-link[aria-current="page"] .ic { color: var(--side-accent); }
.side-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -.85rem; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--side-accent);
}
.side-link:focus-visible { outline-color: var(--side-accent); }
.side-count {
  margin-left: auto; min-width: 26px; padding: .05rem .45rem; border-radius: 999px; text-align: center;
  background: var(--side-accent); color: #2a1208; font-size: .72rem; font-weight: 700;
}

.sidebar-foot { padding: 1rem .85rem 1.1rem; display: grid; gap: .9rem; }
.term-card { padding: .95rem 1rem; border-radius: 12px; background: var(--side-hover); border: 1px solid var(--side-line); }
.term-card-label { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; font-weight: 600; }
.term-card-week { color: var(--side-muted); font-weight: 500; }
.term-track { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); margin: .6rem 0 .5rem; overflow: hidden; }
.term-track span { display: block; height: 100%; border-radius: 99px; background: var(--side-accent); }
.term-card-note { font-size: .76rem; color: var(--side-muted); }
.side-profile { display: flex; align-items: center; gap: .7rem; padding: .35rem .3rem; border-top: 1px solid var(--side-line); padding-top: 1rem; }
.side-profile-text { display: flex; flex-direction: column; min-width: 0; }
.side-profile-name { font-weight: 600; font-size: .88rem; white-space: nowrap; }
.side-profile-role { font-size: .74rem; color: var(--side-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Collapsed rail (desktop) */
@media (min-width: 992px) {
  .sidebar-collapsed .sidebar { width: var(--side-w-mini); flex-basis: var(--side-w-mini); }
  .sidebar-collapsed .sidebar-head { padding-left: 0; padding-right: 0; justify-content: center; }
  .sidebar-collapsed .brand-text,
  .sidebar-collapsed .side-label,
  .sidebar-collapsed .side-profile-text,
  .sidebar-collapsed .side-count,
  .sidebar-collapsed .term-card {
    position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important;
    clip: rect(0 0 0 0) !important; white-space: nowrap !important; padding: 0 !important; margin: -1px !important; border: 0 !important;
  }
  .sidebar-collapsed .side-heading { font-size: 0; padding: .9rem 0 .5rem; }
  .sidebar-collapsed .side-heading::after { content: ""; display: block; height: 1px; margin: 0 .6rem; background: var(--side-line); }
  .sidebar-collapsed .side-link { justify-content: center; padding: .7rem 0; }
  .sidebar-collapsed .side-link[aria-current="page"]::before { left: -.85rem; }
  .sidebar-collapsed .side-profile { justify-content: center; padding-left: 0; padding-right: 0; }
  .sidebar-collapsed .side-link:hover::after,
  .sidebar-collapsed .side-link:focus-visible::after {
    content: attr(data-tip); position: fixed; left: calc(var(--side-w-mini) + 6px); margin-top: 0;
    padding: .35rem .6rem; border-radius: 8px; background: var(--ink); color: var(--surface);
    font-size: .8rem; font-weight: 600; white-space: nowrap; pointer-events: none; z-index: 2000; box-shadow: var(--shadow-md);
  }
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: .6rem;
  height: 68px; padding: 0 clamp(1rem, 2.5vw, 2rem);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.3) blur(10px);
  -webkit-backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-search { position: relative; align-items: center; flex: 0 1 380px; margin-left: .25rem; }
.topbar-search .search-ic { position: absolute; left: .8rem; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.topbar-search input {
  width: 100%; height: 40px; padding: 0 2.4rem 0 2.4rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: .9rem;
}
.topbar-search input::placeholder { color: var(--muted); }
.topbar-search input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.search-kbd {
  position: absolute; right: .6rem; padding: .05rem .4rem; border-radius: 5px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--muted); font: 600 .72rem var(--sans); box-shadow: none;
}
.topbar-search input:focus ~ .search-kbd,
.topbar-search input:not(:placeholder-shown) ~ .search-kbd { display: none; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1050;
  list-style: none; margin: 0; padding: .35rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto;
}
.search-results li {
  display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 8px; cursor: pointer; font-size: .9rem;
}
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--surface-3); }
.search-results .sr-kind { margin-left: auto; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.search-results .sr-empty { color: var(--muted); cursor: default; }
.search-results .avatar { width: 26px; height: 26px; font-size: .62rem; }
.search-results .sr-ic { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--brand-soft); color: var(--brand-ink); }
.search-results .sr-ic .ic { width: 15px; height: 15px; }

.topbar-end { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.term-select { position: relative; display: flex; align-items: center; }
.term-select .ic { position: absolute; left: .7rem; width: 17px; height: 17px; color: var(--brand-ink); pointer-events: none; }
.term-select .form-select {
  height: 40px; padding: 0 2rem 0 2.2rem; border-radius: 10px; border-color: var(--line);
  font-weight: 600; font-size: .86rem; background-color: var(--surface); background-position: right .6rem center; cursor: pointer;
}
.theme-toggle .theme-ic-dark { display: none; }
[data-bs-theme="dark"] .theme-toggle .theme-ic-light { display: none; }
[data-bs-theme="dark"] .theme-toggle .theme-ic-dark { display: inline-flex; }
.theme-toggle span { display: inline-flex; }

.avatar-btn { border: 0; padding: 0; background: none; border-radius: 50%; margin-left: .25rem; }
.avatar-btn .avatar { width: 38px; height: 38px; font-size: .78rem; }

.dropdown-menu {
  --bs-dropdown-bg: var(--surface); --bs-dropdown-color: var(--ink); --bs-dropdown-border-color: var(--line);
  --bs-dropdown-link-color: var(--ink); --bs-dropdown-link-hover-bg: var(--surface-3); --bs-dropdown-link-hover-color: var(--ink);
  --bs-dropdown-link-active-bg: var(--brand-soft); --bs-dropdown-link-active-color: var(--ink);
  --bs-dropdown-divider-bg: var(--line); --bs-dropdown-border-radius: 14px; --bs-dropdown-font-size: .9rem;
  box-shadow: var(--shadow-lg); padding: .4rem;
}
.dropdown-item { display: flex; align-items: center; gap: .6rem; border-radius: 8px; padding: .5rem .7rem; }
.dropdown-item .ic { color: var(--muted); }
.account-menu { min-width: 240px; }
.account-head { display: flex; flex-direction: column; padding: .55rem .7rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .35rem; }
.account-name { font-weight: 600; }
.account-mail { font-size: .8rem; color: var(--muted); }
.notify-menu { width: min(360px, calc(100vw - 24px)); padding: 0; }
.notify-head { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1rem .6rem; border-bottom: 1px solid var(--line); }
.notify-title { font-family: var(--serif); font-size: 1.1rem; }
.notify-list { list-style: none; margin: 0; padding: .35rem; }
.notify-list li { display: flex; gap: .75rem; padding: .7rem .65rem; border-radius: 10px; font-size: .86rem; line-height: 1.45; color: var(--ink-2); }
.notify-list li.is-unread { background: var(--surface-2); }
.notify-list li.is-unread strong { color: var(--ink); }
.notify-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; background: var(--brand-soft); color: var(--brand-ink); }
.notify-ic.tone-accent { background: var(--accent-soft); color: var(--accent); }
.notify-ic .ic { width: 16px; height: 16px; }
.notify-time { display: block; margin-top: .2rem; font-size: .75rem; color: var(--muted); }

.term-banner {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  margin: 1rem clamp(1rem, 2.5vw, 2rem) 0; padding: .75rem 1rem; border-radius: 12px;
  background: var(--warn-soft); color: var(--warn-ink); font-size: .9rem;
}
.term-banner[hidden] { display: none; }
.term-banner .ic { width: 20px; height: 20px; }
.term-banner p { flex: 1 1 240px; }

.app-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1.5rem;
  padding: 1.4rem clamp(1rem, 2.5vw, 2rem) 1.6rem; margin-top: 2.5rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem;
}
.app-footer a { font-weight: 600; }

.toast-stack { position: fixed; right: 1rem; bottom: 1rem; z-index: 3000; display: grid; gap: .5rem; max-width: min(380px, calc(100vw - 2rem)); }
.toast-msg {
  display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toast-in .25s var(--ease);
}
.toast-msg .ic { color: var(--side-accent); margin-top: .1rem; }
.toast-msg.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------------
   5. Page scaffolding
------------------------------------------------------------------ */
.page { padding: 0 clamp(1rem, 2.5vw, 2rem); max-width: 1480px; width: 100%; min-width: 0; margin: 0 auto; }
.page:focus { outline: none; }

.page-head {
  position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.25rem 2rem; padding: 2.2rem 0 1.6rem 1.6rem; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
}
.page-head::before,
.page-head::after { content: ""; position: absolute; top: 0; bottom: -1px; width: 1px; background: var(--accent); opacity: .55; }
.page-head::before { left: 0; }
.page-head::after { left: 4px; opacity: .3; }
.page-head-text { max-width: 720px; }
.eyebrow {
  display: block; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: .6rem;
}
.page-head h1 { font-size: clamp(2.1rem, 1.5rem + 2vw, 3rem); font-weight: 500; letter-spacing: -.022em; line-height: 1.05; }
.page-head h1 em { font-style: italic; color: var(--accent); }
.lede { margin-top: .75rem; color: var(--ink-2); font-size: 1.02rem; max-width: 62ch; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.card-desk {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.4rem; box-shadow: var(--shadow-md);
}
.card-desk-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.card-eyebrow { font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .3rem; }
.card-title { font-size: 1.38rem; font-weight: 500; }
.card-foot-note { display: flex; gap: .5rem; align-items: flex-start; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line-soft); font-size: .82rem; color: var(--muted); }
.card-foot-note .ic { margin-top: .12rem; }

/* Stat strip */
.stat-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem; overflow: hidden;
}
.stat { padding: 1.15rem 1.35rem 1.2rem; border-left: 1px solid var(--line-soft); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { display: flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.stat-label .ic { color: var(--brand-ink); width: 17px; height: 17px; }
.stat-value { font-size: 2.2rem; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; margin: .45rem 0 .25rem; color: var(--ink); }
.stat-value small { font-size: .5em; font-weight: 600; color: var(--muted); margin-left: .1rem; letter-spacing: 0; }
.stat-note { font-size: .8rem; color: var(--muted); }
.stat-note strong { color: var(--ink-2); font-weight: 600; }
.delta { display: inline-flex; align-items: center; gap: .25rem; font-weight: 600; }
.delta .ic { width: 14px; height: 14px; }
.delta-up { color: var(--brand-ink); }
.delta-down { color: var(--accent); }
@media (max-width: 991.98px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 420px) {
  .stat { padding: 1rem; }
  .stat-value { font-size: 1.8rem; }
}

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .9rem 1.2rem; margin-bottom: 1.4rem; }
.toolbar-inset { margin-bottom: .5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line-soft); align-items: center; }
.toolbar-field { display: flex; flex-direction: column; min-width: 0; }
.toolbar-field label, .toolbar-label { margin-bottom: .3rem; font-size: .76rem; letter-spacing: .02em; }
.toolbar-grow { flex: 1 1 200px; }
.toolbar-switch { justify-content: flex-end; padding-bottom: .35rem; }
.toolbar-switch .form-check { margin: 0; }
.toolbar-note { font-size: .86rem; color: var(--muted); padding-bottom: .5rem; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg-btn, .seg-radio label {
  display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .85rem; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2); font: 600 .85rem/1.2 var(--sans); cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.seg-btn span { font-weight: 500; color: var(--muted); font-size: .78rem; }
.seg-btn:hover, .seg-radio label:hover { color: var(--ink); background: var(--surface-3); }
.seg-btn[aria-pressed="true"], .seg-radio input:checked + label { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line); }
.seg-btn[aria-pressed="true"] span { color: var(--accent); }
.seg-sm .seg-btn { padding: .32rem .7rem; font-size: .82rem; }
.seg-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-radio input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Chips, pills, meters, avatars */
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .5rem .12rem .42rem; border-radius: 6px;
  font-size: .74rem; font-weight: 700; letter-spacing: .02em; line-height: 1.45; white-space: nowrap; vertical-align: .08em;
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; }
.chip-chem { background: var(--chem-soft); color: var(--chem-ink); } .chip-chem .chip-dot { background: var(--chem); }
.chip-phys { background: var(--phys-soft); color: var(--phys-ink); } .chip-phys .chip-dot { background: var(--phys); }
.chip-sci  { background: var(--sci-soft);  color: var(--sci-ink); }  .chip-sci  .chip-dot { background: var(--sci); }

.pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px;
  font-size: .76rem; font-weight: 600; white-space: nowrap;
}
.pill .ic { width: 13px; height: 13px; }
.pill-ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill-late { background: var(--warn-soft); color: var(--warn-ink); }
.pill-marking { background: var(--accent-soft); color: var(--accent-ink); }
.pill-open { background: var(--phys-soft); color: var(--phys-ink); }
.pill-returned { background: var(--ok-soft); color: var(--ok-ink); }

.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--brand-fill); }
.meter-accent span { background: var(--accent-fill); }

.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  font-size: .72rem; font-weight: 700; letter-spacing: .02em; line-height: 1;
}
.av-0 { background: #dfe8d8; color: #2f4b36; }
.av-1 { background: #f1dccf; color: #773a20; }
.av-2 { background: #efe3c6; color: #634b1c; }
.av-3 { background: #dbe4ea; color: #2b475a; }
.av-4 { background: #efd9dc; color: #6b3240; }
.av-5 { background: #e2e6cc; color: #475120; }
[data-bs-theme="dark"] .av-0 { background: #25382b; color: #c9e2cf; }
[data-bs-theme="dark"] .av-1 { background: #3f2a1f; color: #f0c9b2; }
[data-bs-theme="dark"] .av-2 { background: #3b321d; color: #eedcaa; }
[data-bs-theme="dark"] .av-3 { background: #22323d; color: #c4d8e6; }
[data-bs-theme="dark"] .av-4 { background: #3e2429; color: #efc5cd; }
[data-bs-theme="dark"] .av-5 { background: #333a1d; color: #dbe3a9; }
.avatar-me { background: #c2603c; color: #fff8ee; }

.flag {
  display: inline-block; margin-left: .35rem; padding: 0 .3rem; border-radius: 4px; border: 1px solid var(--line-2);
  font-size: .62rem; font-weight: 700; letter-spacing: .04em; line-height: 1.5; color: var(--ink-2); vertical-align: .15em;
}
.gb-type {
  display: inline-block; padding: 0 .38rem; border-radius: 4px; font-size: .64rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1.6;
  background: var(--surface-3); color: var(--ink-2);
}
.t-test { background: var(--accent-soft); color: var(--accent-ink); }
.t-practical { background: var(--sci-soft); color: var(--sci-ink); }
.t-quiz { background: var(--phys-soft); color: var(--phys-ink); }
.t-essay { background: var(--warn-soft); color: var(--warn-ink); }

.empty-note { padding: 1.5rem 0 .5rem; text-align: center; color: var(--muted); font-size: .9rem; }
.empty-note[hidden] { display: none; }

/* ------------------------------------------------------------------
   6. Dashboard
------------------------------------------------------------------ */
/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item {
  position: relative; display: grid; grid-template-columns: 56px 26px minmax(0, 1fr) auto; column-gap: .85rem;
  padding: .7rem .6rem .75rem .4rem; border-radius: 12px;
}
.tl-item::before {
  content: ""; position: absolute; left: calc(.4rem + 56px + .85rem + 12.5px); top: 0; bottom: 0; width: 1px; background: var(--line);
}
.tl-item:first-child::before { top: 1.1rem; }
.tl-item:last-child::before { bottom: calc(100% - 1.1rem); }
.tl-time { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .88rem; line-height: 1.3; padding-top: .1rem; }
.tl-end { font-weight: 400; color: var(--muted); font-size: .76rem; }
.tl-node {
  position: relative; z-index: 1; display: grid; place-items: center; width: 26px; height: 26px; margin-top: .05rem;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line-2); color: var(--muted);
}
.tl-node .ic { width: 13px; height: 13px; }
.tl-title { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-weight: 600; line-height: 1.35; }
.tl-meta { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.tl-state { align-self: start; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .2rem .5rem; border-radius: 6px; }
.state-done { color: var(--muted); }
.state-now { background: var(--accent-fill); color: var(--on-accent); }
.state-next { background: var(--brand-soft); color: var(--brand-ink); }
.tl-item.is-done .tl-node { background: var(--brand-fill); border-color: var(--brand-fill); color: var(--on-brand); }
.tl-item.is-done .tl-title span:last-child { color: var(--ink-2); }
.tl-item.is-now { background: var(--accent-soft); }
.tl-item.is-now .tl-node { border-color: var(--accent-fill); background: var(--surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-fill) 22%, transparent); }
.tl-item.is-now .tl-node::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-fill); }
.tl-item.is-next .tl-node { border-color: var(--brand-fill); }
.tl-break .tl-title, .tl-admin .tl-title { font-weight: 500; color: var(--ink-2); }
.tl-event .tl-node { border-color: var(--accent); color: var(--accent); }
.tl-progress { height: 4px; border-radius: 99px; background: color-mix(in srgb, var(--accent-fill) 20%, transparent); margin-top: .55rem; max-width: 260px; overflow: hidden; }
.tl-progress span { display: block; height: 100%; background: var(--accent-fill); border-radius: 99px; }
.tl-link { display: inline-flex; align-items: center; gap: .3rem; margin-top: .4rem; font-size: .82rem; font-weight: 600; }
.tl-link .ic { width: 14px; height: 14px; }
@media (max-width: 575.98px) {
  .tl-item { grid-template-columns: 46px 22px minmax(0, 1fr); column-gap: .6rem; padding-right: .4rem; }
  .tl-item::before { left: calc(.4rem + 46px + .6rem + 10.5px); }
  .tl-node { width: 22px; height: 22px; }
  .tl-state { grid-column: 3; justify-self: start; margin-top: .45rem; }
}

/* Marking queue */
.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.queue-item { display: flex; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line-soft); }
.queue-item:last-child { border-bottom: 0; }
.queue-count {
  display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0;
  width: 60px; height: 60px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
}
.queue-count.is-urgent { background: var(--accent-soft); border-color: transparent; }
.queue-num { font-size: 1.45rem; font-weight: 700; line-height: 1; }
.queue-count.is-urgent .queue-num { color: var(--accent-ink); }
.queue-num-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: .2rem; }
.queue-body { flex: 1; min-width: 0; }
.queue-title { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-weight: 600; }
.queue-title a { color: var(--ink); }
.queue-meta { font-size: .8rem; color: var(--muted); margin: .15rem 0 .5rem; }
.queue-progress { font-size: .74rem; color: var(--muted); margin-top: .3rem; font-variant-numeric: tabular-nums; }

/* Charts */
.chart { margin: 0; }
.chart-plot { position: relative; min-height: 20px; }
.chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.chart-plot .axis-text { fill: var(--muted); font-size: 12px; }
.chart-plot .axis-label { fill: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.chart-plot .val-text { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.chart-plot .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart-plot .base-line { stroke: var(--axis); stroke-width: 1; }
.chart-plot .bar { fill: var(--chart-1); transition: opacity .15s; }
.chart-plot .bar-low { fill: var(--chart-2); }
.chart-plot .target-line { stroke: var(--accent); stroke-width: 1.5; }
.chart-plot .target-text { fill: var(--accent); font-size: 11.5px; font-weight: 600; }
.chart-plot .mark { cursor: default; outline: none; }
.chart-plot .mark .hit { fill: transparent; }
.chart-plot .mark:hover .bar, .chart-plot .mark:focus .bar { opacity: .82; }
.chart-plot .mark:focus-visible .hit { stroke: var(--focus); stroke-width: 2; rx: 6; }
.chart-plot .db-line { stroke: var(--line-2); stroke-width: 2; stroke-linecap: round; }
.chart-plot .db-last { fill: var(--surface); stroke: var(--muted); stroke-width: 2; }
.chart-plot .db-now { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.chart-plot .db-target { stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }
.chart-plot .row-band { fill: transparent; }
.chart-plot .mark:hover .row-band, .chart-plot .mark:focus .row-band { fill: var(--surface-2); }
.chart-caption { font-size: .8rem; color: var(--muted); margin-top: .75rem; }
.chart-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1.1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.chart-facts dt { font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.chart-facts dd { margin: .2rem 0 0; font-weight: 600; font-size: .95rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; list-style: none; padding: 0; margin: 0 0 .8rem; font-size: .8rem; color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: .45rem; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.sw-ok { background: var(--chart-1); }
.sw-low { background: var(--chart-2); }
.sw-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--chart-1); }
.sw-dot-hollow { background: var(--surface); border: 2px solid var(--muted); }
.sw-tick { display: inline-block; width: 2px; height: 14px; border-radius: 1px; background: var(--ink-2); }
.chart-table { width: 100%; margin-top: 1rem; font-size: .86rem; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: .45rem .6rem; border-bottom: 1px solid var(--line-soft); text-align: left; }
.chart-table thead th { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.chart-table td { text-align: right; }
.chart-table thead th:not(:first-child) { text-align: right; }
.js .chart-table-wrap:not(.is-shown) {
  position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important;
  clip: rect(0 0 0 0) !important; white-space: nowrap !important; margin: -1px !important; padding: 0 !important; border: 0 !important;
}
.chart-tip {
  position: fixed; z-index: 3000; pointer-events: none; min-width: 120px;
  padding: .5rem .7rem; border-radius: 10px; background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-lg); font-size: .8rem; line-height: 1.35;
  opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.chart-tip.is-on { opacity: 1; transform: none; }
.chart-tip strong { display: block; font-size: 1rem; font-weight: 700; }
.chart-tip span { opacity: .8; }

/* Register */
.register-tally { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.tally { display: inline-flex; align-items: baseline; gap: .3rem; padding: .3rem .65rem; border-radius: 8px; font-size: .82rem; color: var(--ink-2); background: var(--surface-2); }
.tally strong { font-size: 1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.tally-absent { background: var(--accent-soft); }
.tally-late { background: var(--warn-soft); }
.register-hint { font-size: .8rem; color: var(--muted); margin-bottom: .75rem; }
.register-grid { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
@media (min-width: 576px) { .register-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) { .register-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.reg-chip {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .5rem; align-items: center;
  width: 100%; padding: .38rem .5rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-align: left; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.reg-chip:hover { border-color: var(--line-2); background: var(--surface-2); }
.reg-chip .avatar { grid-row: span 2; width: 26px; height: 26px; font-size: .6rem; }
.reg-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reg-state { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--brand-ink); }
.reg-chip[data-state="absent"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent-fill) 45%, transparent); }
.reg-chip[data-state="absent"] .reg-state { color: var(--accent-ink); }
.reg-chip[data-state="absent"] .reg-name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.reg-chip[data-state="late"] { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn-ink) 35%, transparent); }
.reg-chip[data-state="late"] .reg-state { color: var(--warn-ink); }
.register-actions { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }

/* Submissions */
.subs { list-style: none; margin: 0; padding: 0; }
.sub-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: .9rem;
  padding: .8rem 0; border-bottom: 1px solid var(--line-soft);
}
.sub-item:last-child { border-bottom: 0; }
.sub-name { font-weight: 600; }
.sub-work { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; font-size: .84rem; color: var(--ink-2); margin-top: .1rem; }
.sub-when { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.sub-when .ic { width: 14px; height: 14px; }
@media (max-width: 767.98px) {
  .sub-item { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: .5rem; }
  .sub-when { grid-column: 2; grid-row: 2; }
  .sub-item .pill { grid-column: 3; grid-row: 1; }
  .sub-item .btn { grid-column: 3; grid-row: 2; }
}

/* Up next */
.card-next { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.next-photo { width: 100%; height: 170px; object-fit: cover; }
.next-body { padding: 1.2rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: .2rem; flex: 1; }
.next-meta { display: flex; align-items: center; gap: .5rem; font-size: .84rem; color: var(--muted); margin: .35rem 0 .9rem; }
.prep { border: 0; padding: 0; margin: 0 0 1rem; }
.prep legend { display: flex; justify-content: space-between; align-items: baseline; width: 100%; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .5rem; float: none; }
.prep-count { font-weight: 500; color: var(--muted); font-size: .78rem; }
.prep-item { display: flex; align-items: center; gap: .6rem; padding: .42rem 0; border-top: 1px dotted var(--line-2); font-size: .88rem; cursor: pointer; }
.prep-item input { width: 17px; height: 17px; accent-color: var(--brand-fill); flex-shrink: 0; }
.prep-item:has(input:checked) { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }

/* ------------------------------------------------------------------
   7. Classes
------------------------------------------------------------------ */
.class-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr)); gap: 1.4rem; }
.class-col[hidden] { display: none; }
.glance-card {
  height: 100%; padding: 1.35rem 1.4rem; border-radius: var(--radius); border: 1px dashed var(--line-2);
  background: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px), var(--surface-2);
  display: flex; flex-direction: column; gap: .2rem;
}
.glance-lede { font-size: .86rem; color: var(--muted); margin: .4rem 0 1rem; }
.glance-list { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: .55rem; }
.glance-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto 1.4rem; align-items: center; gap: .75rem; font-size: .86rem; }
.glance-name { display: flex; align-items: center; gap: .45rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.glance-bar { display: flex; gap: 3px; }
.glance-bar span { width: 14px; height: 10px; border-radius: 3px; background: var(--brand-fill); }
.glance-num { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.glance-card .link-more { margin-top: auto; }
.class-card {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.class-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.class-card:focus-within { box-shadow: var(--shadow-lg); }
.class-cover { position: relative; height: 128px; padding: 1rem 1.2rem; color: #fbf3e2; overflow: hidden; }
.cover-chem { background: linear-gradient(135deg, #98432a, #c46a43); }
.cover-phys { background: linear-gradient(135deg, #283b7a, #4b62b3); }
.cover-sci  { background: linear-gradient(135deg, #123f2c, #2a7250); }
[data-bs-theme="dark"] .cover-chem { background: linear-gradient(135deg, #5f2a19, #8b4629); }
[data-bs-theme="dark"] .cover-phys { background: linear-gradient(135deg, #1b2653, #34457f); }
[data-bs-theme="dark"] .cover-sci  { background: linear-gradient(135deg, #0c2a1d, #1c4e37); }
.cover-art { position: absolute; right: -10px; top: 0; width: 220px; height: 128px; color: rgba(255, 246, 228, .3); }
.class-code {
  position: absolute; left: 1.1rem; bottom: .15rem; font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 4rem; line-height: 1; letter-spacing: -.03em;
}
.class-stage {
  position: relative; display: inline-block; font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: .2rem .55rem; border-radius: 99px; background: rgba(255, 255, 255, .16);
}
.class-body { padding: 1.15rem 1.25rem .9rem; flex: 1; }
.class-title { font-size: 1.35rem; }
.class-title a { color: var(--ink); }
.class-course { font-size: .84rem; color: var(--muted); margin-top: .2rem; }
.class-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: 1rem 0; padding: .7rem 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.class-facts dt { font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.class-facts dd { margin: .1rem 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.class-avg { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.class-avg-label { font-size: .76rem; color: var(--muted); font-weight: 600; }
.class-avg-value { font-size: 2rem; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.class-avg-value small { font-size: .5em; color: var(--muted); }
.class-avg-diff { font-size: .78rem; font-weight: 600; }
.class-avg-diff.is-up { color: var(--brand-ink); }
.class-avg-diff.is-down { color: var(--accent); }
.spark { color: var(--chart-1); flex-shrink: 0; overflow: visible; }
.spark circle { fill: var(--chart-1); stroke: var(--surface); stroke-width: 2; }
.class-next { display: flex; gap: .55rem; align-items: flex-start; margin-top: 1rem; padding: .7rem .8rem; border-radius: 10px; background: var(--surface-2); font-size: .84rem; }
.class-next .ic { color: var(--accent); margin-top: .15rem; }
.class-next-when { display: block; font-weight: 600; }
.class-next-topic { display: block; color: var(--muted); }
.class-actions { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.class-actions a {
  display: flex; align-items: center; justify-content: center; gap: .4rem; padding: .75rem .5rem; font-size: .84rem; font-weight: 600;
  color: var(--ink-2); text-decoration: none; border-left: 1px solid var(--line-soft);
}
.class-actions a:first-child { border-left: 0; }
.class-actions a:hover { background: var(--surface-2); color: var(--brand-ink); }
.class-actions .ic { width: 16px; height: 16px; }

/* ------------------------------------------------------------------
   8. Gradebook grid
------------------------------------------------------------------ */
.gb-summary {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 1.2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.gb-sum { padding: .9rem 1.1rem; border-left: 1px solid var(--line-soft); min-width: 0; }
.gb-sum:first-child { border-left: 0; }
.gb-sum-label { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.gb-sum-value { font-size: 1.55rem; font-weight: 600; line-height: 1.2; margin-top: .2rem; }
.gb-sum-note { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-sum-status .gb-sum-value { color: var(--accent); }
@media (max-width: 991.98px) {
  .gb-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gb-sum:nth-child(4) { border-left: 0; }
  .gb-sum:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 575.98px) {
  .gb-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gb-sum:nth-child(n) { border-left: 1px solid var(--line-soft); border-top: 0; }
  .gb-sum:nth-child(odd) { border-left: 0; }
  .gb-sum:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .gb-sum:last-child { grid-column: span 2; }
}

.gb-frame { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); overflow: hidden; }
.gb-scroll { overflow: auto; max-height: min(74vh, 780px); overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.gb-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.gb-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-variant-numeric: tabular-nums; font-size: .92rem; }
.gb-table th, .gb-table td { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
.gb-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); vertical-align: bottom; text-align: left;
  padding: .75rem .7rem .7rem; border-bottom: 1px solid var(--line-2); font-weight: 600;
}
.gb-col { width: 128px; min-width: 128px; max-width: 128px; }
.gb-col-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: .4rem; font-size: .82rem; line-height: 1.25; color: var(--ink); }
.gb-col-meta { display: block; margin-top: .2rem; font-size: .72rem; font-weight: 500; color: var(--muted); }
.gb-col.is-active-col { background: color-mix(in srgb, var(--brand-soft) 70%, var(--surface-2)); box-shadow: inset 0 -2px 0 var(--brand-fill); }
.gb-sort {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .35rem; margin-left: -.35rem; border: 0; border-radius: 6px;
  background: none; color: var(--ink); font: 600 .82rem var(--sans); text-transform: uppercase; letter-spacing: .08em; cursor: pointer;
}
.gb-sort:hover { background: var(--surface-3); }
.gb-sort .ic { width: 14px; height: 14px; opacity: .35; transition: transform .15s; }
th[aria-sort="ascending"] .gb-sort .ic { opacity: 1; transform: rotate(180deg); }
th[aria-sort="descending"] .gb-sort .ic { opacity: 1; }

.gb-student {
  position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 500;
  min-width: 250px; max-width: 250px; padding: .4rem .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid var(--line-2) !important;
}
.gb-student .avatar { width: 28px; height: 28px; font-size: .62rem; margin-right: .6rem; vertical-align: middle; display: inline-grid; }
.gb-name { vertical-align: middle; }
.gb-table thead .gb-corner { left: 0; z-index: 4; min-width: 250px; border-right: 1px solid var(--line-2); }
.gb-table tbody tr.is-active-row .gb-student { background: color-mix(in srgb, var(--brand-soft) 60%, var(--surface)); box-shadow: inset 3px 0 0 var(--brand-fill); }
.gb-table tbody tr:hover .gb-student { background: var(--surface-2); }

.gb-cell {
  position: relative; height: 44px; padding: 0 .5rem; text-align: center; font-weight: 500; cursor: cell; outline: none;
  transition: background-color .2s var(--ease);
}
.gb-cell:focus { box-shadow: inset 0 0 0 2px var(--brand-strong); z-index: 0; }
[data-bs-theme="dark"] .gb-cell:focus { box-shadow: inset 0 0 0 2px var(--brand); }
.gb-cell.is-editing { z-index: 1; }
.gb-cell.is-edited::after { content: ""; position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-fill); }
.gb-cell.is-invalid { box-shadow: inset 0 0 0 2px var(--danger) !important; animation: gb-shake .28s; }
@keyframes gb-shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.gb-cell.is-flash { animation: gb-flash .7s var(--ease); }
@keyframes gb-flash { from { box-shadow: inset 0 0 0 2px var(--accent-fill); } }
.gb-input {
  position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); border: 0; border-radius: 5px;
  background: var(--surface); color: var(--ink); text-align: center; font: 600 .95rem var(--sans); font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 2px var(--brand-fill), 0 4px 12px -4px rgba(0, 0, 0, .25); outline: none; -moz-appearance: textfield;
}
.gb-input::-webkit-outer-spin-button, .gb-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gb-cell .gb-max { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: .68rem; color: var(--muted); pointer-events: none; z-index: 1; }
.gb-error {
  position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); z-index: 6; white-space: nowrap;
  padding: .3rem .55rem; border-radius: 6px; background: var(--danger); color: #fff; font-size: .74rem; font-weight: 600; pointer-events: none;
}
[data-bs-theme="dark"] .gb-error { color: #2a0d08; }

.gb-avg, .gb-avg-head, .gb-foot-avg { position: sticky; right: 0; border-left: 1px solid var(--line-2); border-right: 0 !important; }
.gb-avg { z-index: 1; width: 104px; min-width: 104px; text-align: center; font-weight: 700; }
.gb-table thead .gb-avg-head { z-index: 4; right: 0; text-align: center; min-width: 104px; }
.gb-table tfoot th, .gb-table tfoot td {
  position: sticky; bottom: 0; z-index: 2; background: var(--surface-2); border-top: 1px solid var(--line-2); border-bottom: 0;
  height: 44px; font-weight: 700; text-align: center; font-size: .86rem;
}
.gb-table tfoot .gb-foot-label { left: 0; z-index: 4; text-align: left; font-family: var(--serif); font-size: 1rem; font-weight: 500; }
.gb-table tfoot .gb-foot-avg { right: 0; z-index: 4; }

/* Score colour scale */
.gb-table .s1 { background-color: var(--s1); color: var(--s1-ink); }
.gb-table .s2 { background-color: var(--s2); color: var(--s2-ink); }
.gb-table .s3 { background-color: var(--s3); color: var(--s3-ink); }
.gb-table .s4 { background-color: var(--s4); color: var(--s4-ink); }
.gb-table .s5 { background-color: var(--s5); color: var(--s5-ink); }
.gb-table .sx { color: var(--muted); background-color: var(--surface); }
.gb-table tfoot .gb-foot { background-color: var(--surface-2); color: var(--ink); }
.gb-table tfoot .gb-foot.s1 { box-shadow: inset 0 -4px 0 var(--s1); }
.gb-table tfoot .gb-foot.s2 { box-shadow: inset 0 -4px 0 var(--s2); }
.gb-table tfoot .gb-foot.s3 { box-shadow: inset 0 -4px 0 var(--line-2); }
.gb-table tfoot .gb-foot.s4 { box-shadow: inset 0 -4px 0 var(--s4); }
.gb-table tfoot .gb-foot.s5 { box-shadow: inset 0 -4px 0 var(--s5); }
.gb-table.no-scale .gb-cell, .gb-table.no-scale .gb-avg { background-color: var(--surface); color: var(--ink); }
.gb-table.no-scale .gb-cell.sx { color: var(--muted); }
.gb-table.is-readonly .gb-cell { cursor: not-allowed; }
.gb-table tbody tr[hidden] { display: none; }

.gb-under { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; margin-top: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; list-style: none; margin: 0; padding: 0; font-size: .8rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: .4rem; }
.legend .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--line); }
.sw.s1 { background: var(--s1); } .sw.s2 { background: var(--s2); } .sw.s3 { background: var(--s3); }
.sw.s4 { background: var(--s4); } .sw.s5 { background: var(--s5); } .sw.sx { background: var(--surface); }
.gb-flags-key { font-size: .8rem; color: var(--muted); }
.gb-flags-key .flag { margin-left: .7rem; }
.gb-flags-key .flag:first-child { margin-left: 0; }

.kbd-help { margin-top: 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.kbd-help summary { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem; cursor: pointer; font-weight: 600; font-size: .9rem; list-style: none; }
.kbd-help summary::-webkit-details-marker { display: none; }
.kbd-help summary::after { content: "+"; margin-left: auto; color: var(--muted); font-weight: 500; font-size: 1.1rem; }
.kbd-help[open] summary::after { content: "–"; }
.kbd-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem 1.5rem; margin: 0; padding: .25rem 1rem 1rem; }
.kbd-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px dotted var(--line-2); font-size: .84rem; }
.kbd-list dt { font-weight: 500; white-space: nowrap; }
.kbd-list dd { margin: 0; color: var(--muted); text-align: right; }
kbd {
  display: inline-block; min-width: 1.6em; padding: .05rem .38rem; border-radius: 5px; border: 1px solid var(--line-2);
  border-bottom-width: 2px; background: var(--surface-2); color: var(--ink); font: 600 .74rem var(--sans); text-align: center; box-shadow: none;
}
@media (max-width: 575.98px) {
  .gb-table tbody .gb-avg { position: static; }
  .gb-table thead .gb-avg-head, .gb-table tfoot .gb-foot-avg { right: auto; }
  .gb-student, .gb-table thead .gb-corner { min-width: 150px; max-width: 150px; padding-left: .7rem; padding-right: .5rem; }
  .gb-student .avatar, .gb-student .flag { display: none !important; }
  .gb-col { width: 104px; min-width: 104px; max-width: 104px; }
  .gb-avg, .gb-table thead .gb-avg-head { width: 84px; min-width: 84px; }
}

/* ------------------------------------------------------------------
   9. Assignments + rubric builder
------------------------------------------------------------------ */
.assign-list { list-style: none; margin: 0; padding: 0; }
.assign-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 170px 78px; align-items: center; gap: 1.1rem;
  padding: 1rem 0; border-bottom: 1px solid var(--line-soft);
}
.assign-item:last-child { border-bottom: 0; }
.assign-item > .pill { justify-self: end; }
.assign-item[hidden] { display: none; }
.assign-item.is-new { animation: new-row 1.6s var(--ease); border-radius: 10px; }
@keyframes new-row { from { background: var(--accent-soft); } }
.assign-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin-bottom: .35rem; }
.assign-title { font-size: 1.12rem; font-weight: 500; }
.assign-title a { color: var(--ink); }
.assign-meta { display: flex; flex-wrap: wrap; gap: .15rem .9rem; font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.assign-progress { display: grid; gap: .25rem; font-size: .76rem; color: var(--muted); }
.assign-progress p { display: flex; justify-content: space-between; }
.assign-progress strong { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.assign-progress .meter { height: 5px; margin-bottom: .3rem; }
@media (max-width: 767.98px) {
  .assign-item { grid-template-columns: minmax(0, 1fr) auto; }
  .assign-progress { grid-column: 1 / -1; grid-row: 2; }
  .assign-item .pill { grid-column: 2; grid-row: 1; align-self: start; }
}

@media (min-width: 1200px) { .card-form { position: sticky; top: 88px; } }
.card-form:focus { outline: none; }
.rubric { margin: 1.2rem 0 0; padding: .9rem .8rem .8rem; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.rubric-legend { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; width: 100%; float: left; margin-bottom: .6rem; font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.rubric-total { font-family: var(--sans); font-size: .84rem; color: var(--muted); }
.rubric-total strong { font-size: 1.15rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.rubric-bar { clear: left; display: flex; gap: 2px; height: 8px; margin-bottom: .9rem; border-radius: 4px; overflow: hidden; }
.rubric-bar span { display: block; height: 100%; background: var(--brand-fill); transition: flex-grow .25s var(--ease); }
.rubric-bar span:nth-child(2n) { background: color-mix(in srgb, var(--brand-fill) 62%, var(--surface-2)); }
.rubric-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: .5rem; }
.rubric-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 76px 32px; align-items: center; gap: .4rem; }
.rubric-row .form-control { padding-left: .6rem; padding-right: .6rem; font-size: .88rem; }
.rubric-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-2); font-size: .74rem; font-weight: 700; color: var(--ink-2); }
.rubric-points { position: relative; }
.rubric-points .form-control { padding-right: 1.9rem !important; font-variant-numeric: tabular-nums; }
.rubric-unit { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); font-size: .74rem; color: var(--muted); pointer-events: none; }
.rubric-remove { color: var(--muted); }
.rubric-remove:hover { color: var(--danger-ink); background: var(--accent-soft); }
.rubric-row.is-new { animation: new-row 1.2s var(--ease); border-radius: 8px; }
.rubric .field-error { margin-top: .6rem; }
@media (max-width: 420px) {
  .rubric-row { grid-template-columns: minmax(0, 1fr) 84px 34px; }
  .rubric-num { display: none; }
}

/* ------------------------------------------------------------------
   10. Lesson plan board
------------------------------------------------------------------ */
.plan-toolbar { align-items: center; justify-content: space-between; }
.plan-stats { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; list-style: none; margin: 0; padding: 0; font-size: .88rem; color: var(--ink-2); }
.plan-stats li { display: inline-flex; align-items: center; gap: .4rem; }
.plan-stats strong { font-size: 1.05rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.sdot { width: 9px; height: 9px; border-radius: 50%; }
.sdot-taught { background: var(--muted); }
.sdot-ready { background: var(--brand-fill); }
.sdot-draft { background: transparent; border: 2px solid var(--accent-fill); }

.board {
  position: relative;
  display: grid; grid-template-columns: repeat(5, minmax(206px, 1fr)); gap: .8rem; align-items: start;
  overflow-x: auto; padding-bottom: .75rem; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.day-col { scroll-snap-align: start; background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem; min-width: 0; }
.board-wrap { position: relative; }
.board-wrap::before, .board-wrap::after {
  content: ""; position: absolute; top: 0; bottom: .75rem; width: 56px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .2s;
}
.board-wrap::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.board-wrap::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.board-wrap.more-left::before, .board-wrap.more-right::after { opacity: 1; }
.day-col.is-today { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface-2)); border-color: color-mix(in srgb, var(--accent-fill) 40%, var(--line)); }
.day-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .5rem; padding: .2rem .25rem .8rem; }
.day-name { font-size: 1.2rem; font-weight: 500; margin-right: auto; }
.day-date { font-family: var(--sans); font-size: .78rem; font-weight: 500; color: var(--muted); margin-left: .2rem; }
.today-badge { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 5px; background: var(--accent-fill); color: var(--on-accent); }
.day-count { font-size: .76rem; color: var(--muted); }
.day-cards { display: grid; gap: .6rem; }
.plan-card {
  position: relative; padding: .75rem .75rem .7rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); border-left: 3px solid var(--sci);
}
.plan-card[hidden] { display: none; }
.plan-card:has(.chip-chem) { border-left-color: var(--chem); }
.plan-card:has(.chip-phys) { border-left-color: var(--phys); }
.plan-card.status-taught { background: color-mix(in srgb, var(--surface) 70%, var(--surface-2)); }
.plan-card.status-taught .plan-title, .plan-card.status-taught .plan-obj { color: var(--ink-2); }
.plan-card.status-draft { border-style: dashed; border-left-style: solid; }
.plan-card.is-new { animation: new-row 1.6s var(--ease); }
.plan-top { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .45rem; margin-bottom: .45rem; }
.plan-period { font-size: .74rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .55rem; padding-top: .5rem; border-top: 1px dotted var(--line-2); }
.plan-status { margin-left: auto; display: inline-flex; align-items: center; gap: .35rem; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.plan-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status-taught .plan-status::before { background: var(--muted); }
.status-ready .plan-status::before { background: var(--brand-fill); }
.status-draft .plan-status::before { border: 2px solid var(--accent-fill); width: 9px; height: 9px; }
.status-taught .plan-status { color: var(--muted); }
.status-ready .plan-status { color: var(--brand-ink); }
.status-draft .plan-status { color: var(--accent); }
.plan-title { font-size: 1.04rem; font-weight: 600; line-height: 1.25; margin-bottom: .45rem; }
.plan-label { font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: .35rem; }
.plan-obj { margin: .2rem 0 .3rem; padding-left: 1rem; font-size: .8rem; line-height: 1.4; color: var(--ink); }
.plan-obj li::marker { color: var(--accent); }
.plan-obj li + li { margin-top: .15rem; }
.plan-res { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; margin: .3rem 0 0; padding: 0; }
.plan-res li { padding: .08rem .45rem; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); font-size: .72rem; color: var(--ink-2); }
.plan-edit {
  display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .5rem; margin-left: -.5rem;
  border: 0; border-radius: 6px; background: none; color: var(--brand-ink); font: 600 .78rem var(--sans); cursor: pointer;
}
.plan-edit .ic { width: 13px; height: 13px; }
.plan-edit:hover { background: var(--brand-soft); }
.plan-add {
  display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; margin-top: .6rem; padding: .6rem;
  border: 1.5px dashed var(--line-2); border-radius: 12px; background: transparent; color: var(--muted); font: 600 .84rem var(--sans); cursor: pointer;
}
.plan-add:hover { border-color: var(--brand-fill); color: var(--brand-ink); background: var(--surface); }
.plan-add .ic { width: 16px; height: 16px; }
@media (min-width: 1400px) { .board { grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; } }
@media (max-width: 767.98px) {
  .board { grid-template-columns: minmax(0, 1fr); overflow: visible; }
}

.desk-dialog {
  width: min(580px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.desk-dialog::backdrop { background: rgba(12, 26, 19, .5); backdrop-filter: blur(2px); }
.desk-dialog[open] { animation: dialog-in .22s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.1rem .8rem 1.4rem; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 1.2rem 1.4rem .6rem; }
.dialog-foot { display: flex; align-items: center; gap: .5rem; padding: .9rem 1.4rem 1.2rem; border-top: 1px solid var(--line-soft); }
.dialog-body fieldset legend { float: none; font-size: .84rem; }

/* ------------------------------------------------------------------
   11. Reports
------------------------------------------------------------------ */
.br-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .95rem; }
.br-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem 1rem; align-items: center; }
.br-title { display: flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 500; min-width: 0; }
.br-bar { grid-column: 1 / -1; grid-row: 2; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.br-bar span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--chart-1); }
.br-val { grid-column: 2; grid-row: 1; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }

.people { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.person { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line-soft); }
.person:last-child { border-bottom: 0; }
ol.people .person::before { counter-increment: p; content: counter(p); width: 1.2rem; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--muted); text-align: center; }
.person-main { flex: 1; min-width: 0; }
.person-name { font-weight: 600; }
.person-note { display: block; font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.person-note .ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: .3rem; }
.ic-up { color: var(--brand-ink); }
.ic-down { color: var(--accent); }
.person-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.tag-risk { padding: .05rem .45rem; border-radius: 5px; background: var(--accent-soft); color: var(--accent-ink); font-size: .74rem; font-weight: 600; }
.person-avg { padding: .3rem .55rem; border-radius: 8px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
.person-avg.s1 { background: var(--s1); color: var(--s1-ink); }
.person-avg.s2 { background: var(--s2); color: var(--s2-ink); }
.person-avg.s3 { background: var(--s3); color: var(--s3-ink); }
.person-avg.s4 { background: var(--s4); color: var(--s4-ink); }
.person-avg.s5 { background: var(--s5); color: var(--s5-ink); }
.is-loading { opacity: .55; transition: opacity .15s; }

/* ------------------------------------------------------------------
   12. Responsive shell tweaks
------------------------------------------------------------------ */
@media (max-width: 991.98px) {
  .topbar { height: 62px; }
  .page-head { padding-top: 1.6rem; }
}
@media (max-width: 575.98px) {
  .topbar { gap: .25rem; padding: 0 .75rem; }
  .term-select .form-select { padding-left: 2rem; padding-right: 1.8rem; font-size: .82rem; }
  .card-desk { padding: 1.1rem 1rem 1.15rem; }
  .card-desk-head { flex-wrap: wrap; }
  .page-head { padding-left: 1.1rem; }
  .page-head-actions .btn { flex: 1 1 auto; }
  .page-head h1 { font-size: 2.05rem; }
  .seg-btn { padding: .4rem .55rem; gap: .3rem; }
  .seg-sm .seg-btn { padding: .32rem .5rem; }
  .next-body { padding: 1.1rem 1rem 1.15rem; }
}

/* ------------------------------------------------------------------
   13. Print (reports and gradebook)
------------------------------------------------------------------ */
@media print {
  :root, [data-bs-theme="dark"] { --bg: #fff; --surface: #fff; --surface-2: #f6f6f3; --ink: #111; --muted: #555; --line: #ddd; }
  .sidebar, .topbar, .app-footer, .page-head-actions, .toolbar, .link-btn, .skip-link, .kbd-help, .toast-stack, .term-banner { display: none !important; }
  .app { display: block; }
  .card-desk, .stat-row, .gb-frame { box-shadow: none; break-inside: avoid; }
  .page-head { background: none; }
  .gb-scroll { max-height: none; overflow: visible; }
  .col-xl-7, .col-xl-5, .col-lg-6 { width: 100%; }
}

/* Bilingual switcher — retains the original Gradebook design */
#language-switcher{display:inline-flex;align-items:center;gap:5px;white-space:nowrap;border:1px solid var(--border,#d7d1c5);border-radius:10px;padding:4px 7px;background:var(--surface,#fffaf1);color:var(--text,#173d2d);font:600 12px/1.3 'IBM Plex Sans',sans-serif}#language-switcher button{border:0;border-radius:6px;background:transparent;color:inherit;padding:5px 7px;cursor:pointer;font-weight:700}#language-switcher button.active{background:#173d2d;color:#fff}#language-switcher button:focus-visible{outline:2px solid #c2603c;outline-offset:2px}@media(max-width:575px){#language-switcher{padding:2px;gap:2px}#language-switcher button{padding:5px}}

/* Plato.co Works V28 */
.pcw-zone input{width:165px;max-width:23vw;background:transparent;border:0;color:inherit;font:inherit;outline-offset:3px}.pcw-copyright-footer{flex-wrap:wrap;gap:.3rem 1rem}.pcw-copyright-footer p{margin:.15rem 0}.pcw-template-credit{font-size:.72rem;opacity:.72}@media(max-width:767px){.pcw-zone input{width:110px;max-width:28vw}.pcw-copyright-footer{padding:1rem;line-height:1.5}}

/* V41: price-class phone modal */
.pcw-lead-overlay[hidden],#pcw-lead-fallback[hidden]{display:none!important}.pcw-lead-overlay{position:fixed;inset:0;z-index:9999;background:#0e291fc4;display:grid;place-items:center;padding:16px}.pcw-lead-modal{position:relative;max-height:calc(100dvh - 32px);overflow:auto;width:min(100%,480px);background:#fffaf2;border-radius:22px;border:1px solid #e4d6c2;padding:clamp(22px,4vw,36px);box-shadow:0 24px 75px #0004;color:#203a2b}.pcw-lead-modal h2{font:500 33px/1.15 "Newsreader",Georgia,serif;margin:6px 0 12px}.pcw-lead-modal p{line-height:1.55;color:#667568}.pcw-lead-kicker{font-size:11px!important;letter-spacing:.12em;color:#ae5737!important;font-weight:750}.pcw-lead-close{position:absolute;right:15px;top:10px;font-size:28px;background:transparent;border:0;cursor:pointer;color:#5e6c60}.pcw-lead-modal form>label:first-child{display:block;font-weight:650;margin:18px 0 8px}.pcw-lead-modal input[type=tel]{display:block;width:100%;border:1px solid #d8c8b3;border-radius:11px;background:white;padding:13px;font-size:17px}.pcw-lead-consent{display:flex;gap:10px;align-items:flex-start;margin:15px 0;font-size:12px;line-height:1.5}.pcw-lead-consent input{margin-top:3px;accent-color:#1b6242}.pcw-lead-send,.pcw-lead-test-btn{width:100%;padding:13px;background:#195a3d;color:white;border:0;border-radius:11px;font-weight:700;cursor:pointer}.pcw-lead-test-btn{background:#e4eee4;color:#195a3d;margin-top:9px}.pcw-lead-send:disabled,.pcw-lead-test-btn:disabled{opacity:.5;cursor:not-allowed}.pcw-lead-modal small{display:block;margin-top:15px;color:#728073}.pcw-lead-modal a{color:#185c3c}#pcw-lead-status{font-size:12px;color:#a04930}body.pcw-lead-open{overflow:hidden}
