/*!==============================
 * Homeroom — Free Student Portal Dashboard Template
 * Author: uiCookies — https://uicookies.com/
 * License: Free for personal & commercial use — https://uicookies.com/license/
 * Design layer: indigo + coral on warm paper, Nunito display / Figtree body.
 * Rebrand by editing the custom properties in section 1.
 *===============================*/

/* ------------------------------------------------------------------
   1. Design tokens (light theme)
------------------------------------------------------------------ */
:root {
  /* Brand */
  --hr-primary:        #4f46e5;   /* indigo */
  --hr-primary-strong: #4338ca;
  --hr-primary-soft:   #eeedff;
  --hr-primary-ink:    #3730a3;   /* indigo text on soft backgrounds */
  --hr-on-primary:     #ffffff;
  --hr-coral:          #ff7a5c;   /* accent */
  --hr-coral-strong:   #f2603f;
  --hr-coral-soft:     #fff0eb;
  --hr-coral-ink:      #b1361b;
  --hr-on-coral:       #2a0f08;

  /* Surfaces & text */
  --hr-bg:        #faf7f2;   /* warm paper */
  --hr-surface:   #ffffff;
  --hr-surface-2: #f5f2fa;   /* soft lavender inset */
  --hr-surface-3: #ece8f5;
  --hr-ink:       #1e1b3a;
  --hr-ink-2:     #3d3960;
  --hr-muted:     #625e7d;
  --hr-line:      #ece7f0;
  --hr-line-2:    #dcd5e6;

  /* Status */
  --hr-success:      #177245;
  --hr-success-soft: #e4f5eb;
  --hr-warning:      #9a5a00;
  --hr-warning-soft: #fdf0d8;
  --hr-danger:       #b4233a;
  --hr-danger-soft:  #fde7ea;
  --hr-teal:         #0f766e;
  --hr-teal-soft:    #dff4f1;

  /* Subjects (identity colours; text labels always accompany them) */
  --s-eng:   #e5484d;
  --s-maths: #5b54e8;
  --s-sci:   #0d9488;
  --s-hist:  #d97706;
  --s-geo:   #0284c7;
  --s-span:  #db2777;
  --s-art:   #9333ea;
  --s-comp:  #65a30d;
  --s-pe:    #ea580c;
  --s-music: #a16207;
  --s-tutor: #64748b;

  /* Type */
  --hr-font-display: "Nunito", "Trebuchet MS", system-ui, sans-serif;
  --hr-font-body:    "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Shape, depth, layout */
  --hr-radius:    22px;
  --hr-radius-md: 16px;
  --hr-radius-sm: 12px;
  --hr-shadow-sm: 0 1px 2px rgba(30, 27, 58, .04), 0 4px 14px rgba(30, 27, 58, .05);
  --hr-shadow:    0 2px 6px rgba(30, 27, 58, .05), 0 14px 34px rgba(30, 27, 58, .08);
  --hr-shadow-lg: 0 24px 60px rgba(30, 27, 58, .18);
  --hr-ring:      0 0 0 4px rgba(79, 70, 229, .22);
  --hr-topbar-h:  68px;
  --hr-rail-w:    96px;
  --hr-tabbar-h:  58px;
  --hr-ease:      cubic-bezier(.22, .61, .36, 1);

  /* Bootstrap bridge */
  --bs-body-font-family: var(--hr-font-body);
  --bs-body-bg: var(--hr-bg);
  --bs-body-color: var(--hr-ink);
  --bs-emphasis-color: var(--hr-ink);
  --bs-secondary-color: var(--hr-muted);
  --bs-border-color: var(--hr-line-2);
  --bs-link-color: var(--hr-primary);
  --bs-link-hover-color: var(--hr-primary-strong);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color-rgb: 67, 56, 202;
  --bs-focus-ring-color: rgba(79, 70, 229, .25);
  --bs-tertiary-bg: var(--hr-surface-2);
}

/* Dark theme — its own steps, not an automatic inversion */
[data-bs-theme="dark"] {
  --hr-primary:        #8f88ff;
  --hr-primary-strong: #a8a2ff;
  --hr-primary-soft:   rgba(143, 136, 255, .16);
  --hr-primary-ink:    #cbc7ff;
  --hr-on-primary:     #141233;
  --hr-coral:          #ff8a70;
  --hr-coral-strong:   #ffa18b;
  --hr-coral-soft:     rgba(255, 138, 112, .15);
  --hr-coral-ink:      #ffb3a1;
  --hr-on-coral:       #2a0f08;

  --hr-bg:        #12112a;
  --hr-surface:   #1b1a37;
  --hr-surface-2: #242247;
  --hr-surface-3: #2e2b56;
  --hr-ink:       #f2f0fb;
  --hr-ink-2:     #d6d2f0;
  --hr-muted:     #aaa6cb;
  --hr-line:      #2d2a52;
  --hr-line-2:    #3c3968;

  --hr-success:      #5fd598;
  --hr-success-soft: rgba(95, 213, 152, .14);
  --hr-warning:      #f5b957;
  --hr-warning-soft: rgba(245, 185, 87, .14);
  --hr-danger:       #ff8597;
  --hr-danger-soft:  rgba(255, 133, 151, .14);
  --hr-teal:         #4fd1c5;
  --hr-teal-soft:    rgba(79, 209, 197, .14);

  --s-eng:   #ff6b6f;
  --s-maths: #8f88ff;
  --s-sci:   #2dd4bf;
  --s-hist:  #f59e0b;
  --s-geo:   #38bdf8;
  --s-span:  #f472b6;
  --s-art:   #c084fc;
  --s-comp:  #a3e635;
  --s-pe:    #fb923c;
  --s-music: #eab308;
  --s-tutor: #94a3b8;

  --hr-shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --hr-shadow:    0 2px 6px rgba(0, 0, 0, .25), 0 14px 34px rgba(0, 0, 0, .25);
  --hr-shadow-lg: 0 24px 60px rgba(0, 0, 0, .5);
  --hr-ring:      0 0 0 4px rgba(143, 136, 255, .3);

  --bs-body-bg: var(--hr-bg);
  --bs-body-color: var(--hr-ink);
  --bs-emphasis-color: var(--hr-ink);
  --bs-secondary-color: var(--hr-muted);
  --bs-border-color: var(--hr-line-2);
  --bs-link-color: var(--hr-primary);
  --bs-link-hover-color: var(--hr-primary-strong);
  --bs-link-color-rgb: 143, 136, 255;
  --bs-link-hover-color-rgb: 168, 162, 255;
  --bs-tertiary-bg: var(--hr-surface-2);
  color-scheme: dark;
}

/* ------------------------------------------------------------------
   2. Base
------------------------------------------------------------------ */
html { -webkit-text-size-adjust: 100%; }
body { position: relative; }
body {
  background: var(--hr-bg);
  color: var(--hr-ink);
  font-family: var(--hr-font-body);
  font-size: .9375rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s var(--hr-ease), color .25s var(--hr-ease);
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--hr-font-display);
  color: var(--hr-ink);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.005em;
}
a { color: var(--hr-primary); text-decoration: none; transition: color .15s var(--hr-ease); }
a:hover { color: var(--hr-primary-strong); }
img { max-width: 100%; height: auto; }
strong, b { font-weight: 700; }
code { color: var(--hr-coral-ink); font-size: .85em; }
::selection { background: var(--hr-primary); color: var(--hr-on-primary); }

:focus-visible { outline: 3px solid var(--hr-primary); outline-offset: 2px; border-radius: 6px; }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline: none; box-shadow: var(--hr-ring); }

.ic { width: 20px; height: 20px; flex: none; }
.ic-sm { width: 16px; height: 16px; }

.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: 2000;
  background: var(--hr-primary); color: var(--hr-on-primary);
  padding: .7rem 1.1rem; border-radius: 999px; font-weight: 700;
  transition: top .2s var(--hr-ease);
}
.skip-link:focus { top: 12px; color: var(--hr-on-primary); }

/* Subject identity: set --subj, derive soft fill and readable ink */
[class*=" s-"], [class^="s-"] {
  --subj-soft: color-mix(in srgb, var(--subj) 12%, var(--hr-surface));
  --subj-ink: color-mix(in srgb, var(--subj) 62%, var(--hr-ink));
}
.s-eng   { --subj: var(--s-eng); }
.s-maths { --subj: var(--s-maths); }
.s-sci   { --subj: var(--s-sci); }
.s-hist  { --subj: var(--s-hist); }
.s-geo   { --subj: var(--s-geo); }
.s-span  { --subj: var(--s-span); }
.s-art   { --subj: var(--s-art); }
.s-comp  { --subj: var(--s-comp); }
.s-pe    { --subj: var(--s-pe); }
.s-music { --subj: var(--s-music); }
.s-tutor { --subj: var(--s-tutor); }

/* ------------------------------------------------------------------
   3. App shell — top bar, side rail, bottom tab bar, footer
------------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--hr-topbar-h);
  background: color-mix(in srgb, var(--hr-bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--hr-line);
}
.topbar-inner {
  height: 100%;
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .65rem; color: var(--hr-ink); margin-right: auto; min-width: 0; }
.brand:hover { color: var(--hr-ink); }
.brand-mark { width: 38px; height: 38px; flex: none; }
.bm-bg { fill: var(--hr-primary); }
.bm-line { fill: none; stroke: var(--hr-on-primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.bm-sun { fill: var(--hr-coral); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--hr-font-display); font-weight: 900; font-size: 1.2rem; letter-spacing: -.01em; }
.brand-school { font-size: .72rem; color: var(--hr-muted); font-weight: 600; margin-top: 2px; white-space: nowrap; }

.term-chip {
  display: none; align-items: center; gap: .45rem;
  padding: .4rem .8rem; border-radius: 999px;
  background: var(--hr-surface); border: 1px solid var(--hr-line);
  font-size: .8rem; font-weight: 700; color: var(--hr-ink-2); white-space: nowrap;
}
.term-chip .ic { width: 16px; height: 16px; color: var(--hr-coral-strong); }

.portal-switch {
  display: none; padding: 4px; gap: 2px;
  background: var(--hr-surface-2); border-radius: 999px;
}
.portal-switch a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .85rem; border-radius: 999px;
  font-size: .82rem; font-weight: 700; color: var(--hr-muted);
}
.portal-switch a .ic { width: 16px; height: 16px; }
.portal-switch a:hover { color: var(--hr-ink); }
.portal-switch a[aria-current="page"] { background: var(--hr-surface); color: var(--hr-primary-ink); box-shadow: var(--hr-shadow-sm); }

.topbar-actions { display: flex; align-items: center; gap: .35rem; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: var(--hr-ink-2);
  transition: background-color .15s var(--hr-ease), color .15s var(--hr-ease);
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--hr-surface-2); color: var(--hr-ink); }
.icon-btn-dot {
  position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--hr-coral-strong); box-shadow: 0 0 0 2px var(--hr-bg);
}
.theme-toggle .ic-sun { display: none; }
[data-bs-theme="dark"] .theme-toggle .ic-sun { display: block; }
[data-bs-theme="dark"] .theme-toggle .ic-moon { display: none; }

.account-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: 3px 10px 3px 3px; border-radius: 999px; margin-left: .25rem;
  border: 1px solid var(--hr-line); background: var(--hr-surface); color: var(--hr-ink);
  font-weight: 700; font-size: .88rem;
}
.account-btn:hover, .account-btn[aria-expanded="true"] { border-color: var(--hr-line-2); }
.account-name { display: none; }

/* Initials avatars */
.avatar {
  --av: var(--hr-primary);
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  background: color-mix(in srgb, var(--av) 16%, var(--hr-surface));
  color: color-mix(in srgb, var(--av) 70%, var(--hr-ink));
  font-family: var(--hr-font-display); font-weight: 900; font-size: .95rem; letter-spacing: .02em;
}
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.15rem; }
.av-indigo { --av: var(--s-maths); }
.av-coral  { --av: var(--hr-coral-strong); }
.av-teal   { --av: var(--s-sci); }
.av-amber  { --av: var(--s-hist); }
.av-pink   { --av: var(--s-span); }
.av-sky    { --av: var(--s-geo); }
.av-violet { --av: var(--s-art); }
.av-green  { --av: var(--s-comp); }
.av-orange { --av: var(--s-pe); }
.av-slate  { --av: var(--s-tutor); }

/* Dropdowns */
.dropdown-menu {
  --bs-dropdown-bg: var(--hr-surface);
  --bs-dropdown-border-color: var(--hr-line);
  --bs-dropdown-border-radius: 18px;
  --bs-dropdown-color: var(--hr-ink);
  --bs-dropdown-link-color: var(--hr-ink-2);
  --bs-dropdown-link-hover-bg: var(--hr-surface-2);
  --bs-dropdown-link-hover-color: var(--hr-ink);
  --bs-dropdown-link-active-bg: var(--hr-primary-soft);
  --bs-dropdown-link-active-color: var(--hr-primary-ink);
  --bs-dropdown-divider-bg: var(--hr-line);
  --bs-dropdown-padding-x: .4rem;
  --bs-dropdown-padding-y: .4rem;
  box-shadow: var(--hr-shadow-lg);
}
.dropdown-item { display: flex; align-items: center; gap: .6rem; border-radius: 12px; padding: .55rem .75rem; font-weight: 600; font-size: .9rem; }
.dropdown-item .ic { width: 18px; height: 18px; color: var(--hr-muted); }
.account-menu { min-width: 250px; }
.account-card { display: flex; align-items: center; gap: .75rem; padding: .5rem .6rem .35rem; }
.account-card strong { display: block; font-family: var(--hr-font-display); font-size: 1rem; }
.account-card span span { font-size: .8rem; color: var(--hr-muted); }

.notif-menu { width: min(360px, calc(100vw - 24px)); padding: .5rem; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: .4rem .6rem .6rem; font-family: var(--hr-font-display); font-weight: 800; }
.notif {
  display: flex; gap: .75rem; padding: .65rem; border-radius: 14px; color: var(--hr-ink);
  font-size: .88rem; line-height: 1.35;
}
.notif:hover { background: var(--hr-surface-2); color: var(--hr-ink); }
.notif strong { display: block; font-weight: 700; }
.notif-meta { display: block; color: var(--hr-muted); font-size: .8rem; margin-top: 2px; }
.notif-ic, .news-ic {
  display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 12px;
}
.notif-ic .ic { width: 18px; height: 18px; }

.tone-primary { background: var(--hr-primary-soft); color: var(--hr-primary-ink); }
.tone-coral   { background: var(--hr-coral-soft); color: var(--hr-coral-ink); }
.tone-success { background: var(--hr-success-soft); color: var(--hr-success); }
.tone-warning { background: var(--hr-warning-soft); color: var(--hr-warning); }
.tone-danger  { background: var(--hr-danger-soft); color: var(--hr-danger); }
.tone-teal    { background: var(--hr-teal-soft); color: var(--hr-teal); }

/* Side rail (desktop) */
.rail {
  display: none;
  position: absolute; z-index: 1020; left: 0; top: var(--hr-topbar-h); bottom: 0;
  width: var(--hr-rail-w);
  background: var(--hr-surface);
  border-right: 1px solid var(--hr-line);
}
.rail ul, .tabbar ul { list-style: none; margin: 0; padding: 0; }
.rail ul { position: sticky; top: var(--hr-topbar-h); display: flex; flex-direction: column; gap: .35rem; padding: 1rem .5rem; max-height: calc(100vh - var(--hr-topbar-h)); overflow-y: auto; }
.rail-link, .tab-link {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  color: var(--hr-muted); font-family: var(--hr-font-display); font-weight: 800;
  text-align: center; line-height: 1.1;
}
.rail-link { padding: .45rem .15rem .55rem; border-radius: 16px; font-size: .72rem; }
.rail-ic, .tab-ic {
  position: relative; display: grid; place-items: center;
  width: 54px; height: 34px; border-radius: 999px;
  transition: background-color .15s var(--hr-ease), color .15s var(--hr-ease);
}
.rail-ic .ic { width: 22px; height: 22px; }
.rail-link:hover { color: var(--hr-ink); }
.rail-link:hover .rail-ic { background: var(--hr-surface-2); }
.rail-link.active { color: var(--hr-ink); }
.rail-link.active .rail-ic, .tab-link.active .tab-ic { background: var(--hr-primary-soft); color: var(--hr-primary-ink); }
.rail-link.active .ic, .tab-link.active .ic { stroke-width: 2.4; }
.nav-badge {
  position: absolute; top: -3px; right: 6px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--hr-coral-strong); color: #fff;
  font-family: var(--hr-font-body); font-size: .66rem; font-weight: 700;
  box-shadow: 0 0 0 2px var(--hr-surface);
}
[data-bs-theme="dark"] .nav-badge { color: var(--hr-on-coral); }

/* Bottom tab bar (mobile) */
.tabbar {
  position: sticky; z-index: 1030; bottom: 0;
  background: color-mix(in srgb, var(--hr-surface) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--hr-line);
  box-shadow: 0 -8px 24px rgba(30, 27, 58, .06);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul { display: grid; grid-template-columns: repeat(6, 1fr); height: var(--hr-tabbar-h); padding: 0 .25rem; }
.tab-link { justify-content: center; gap: .2rem; height: 100%; font-size: .66rem; letter-spacing: .01em; }
.tab-ic { width: 46px; height: 28px; }
.tab-ic .ic { width: 21px; height: 21px; }
.tab-link.active { color: var(--hr-ink); }
.tab-link .nav-badge { right: 2px; }

/* Main column and footer */
.app-main { padding: 1.25rem 1rem 2rem; min-height: calc(100vh - var(--hr-topbar-h) - 120px); }
.page { max-width: 1320px; margin: 0 auto; }
.app-footer {
  border-top: 1px solid var(--hr-line);
  padding: 1.25rem 1rem 1.5rem;
  color: var(--hr-muted); font-size: .84rem;
}
.footer-inner { max-width: 1320px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: .35rem 1.5rem; justify-content: space-between; }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--hr-ink-2); font-weight: 600; }
.footer-inner a:hover { color: var(--hr-primary); }

@media (min-width: 576px) {
  .app-main { padding: 1.5rem 1.5rem 2.5rem; }
  .app-footer { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 768px) {
  .portal-switch { display: inline-flex; }
  .topbar-inner { padding: 0 1.25rem; gap: 1rem; }
}
@media (min-width: 992px) {
  .rail { display: block; }
  .tabbar { display: none; }
  .app-main { margin-left: var(--hr-rail-w); padding: 2rem 2.25rem 3rem; }
  .app-footer { margin-left: var(--hr-rail-w); padding: 1.25rem 2.25rem; }
  .topbar-inner { padding: 0 1.5rem 0 1.75rem; }
  .brand { min-width: 0; }
}
@media (min-width: 1200px) {
  .term-chip { display: inline-flex; }
  .account-name { display: inline; }
}
@media (max-width: 400px) {
  .brand-school { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .topbar-actions { gap: .1rem; }
}

/* ------------------------------------------------------------------
   4. Shared components
------------------------------------------------------------------ */
.card-hr {
  background: var(--hr-surface);
  border: 1px solid var(--hr-line);
  border-radius: var(--hr-radius);
  box-shadow: var(--hr-shadow-sm);
  padding: 1.25rem;
}
.card-hr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-hr-head h2 { font-size: 1.15rem; margin: 0; }
.card-hr-sub { margin: .15rem 0 0; font-size: .85rem; color: var(--hr-muted); }
.card-hr-sub strong { color: var(--hr-ink); }
.card-hr-link {
  display: inline-flex; align-items: center; gap: .35rem; margin-top: .75rem;
  font-weight: 700; font-size: .88rem; white-space: nowrap;
}
.card-hr-link .ic { transition: transform .2s var(--hr-ease); }
.card-hr-link:hover .ic { transform: translateX(3px); }
.stack { display: flex; flex-direction: column; gap: 1.5rem; height: 100%; }
@media (min-width: 576px) { .card-hr { padding: 1.5rem; } }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; margin-bottom: 1.5rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem; margin: 0 0 .35rem;
  font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--hr-coral-ink);
}
.page-head h1 { font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.3rem); font-weight: 900; margin: 0; }
.page-sub { margin: .35rem 0 0; color: var(--hr-muted); max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .7rem; border-radius: 999px;
  background: var(--hr-surface-2); color: var(--hr-ink-2);
  font-size: .76rem; font-weight: 700; line-height: 1.3; white-space: nowrap;
}
.chip .ic { width: 14px; height: 14px; }
.chip-primary { background: var(--hr-primary-soft); color: var(--hr-primary-ink); }
.chip-coral   { background: var(--hr-coral-soft); color: var(--hr-coral-ink); }
.chip-success { background: var(--hr-success-soft); color: var(--hr-success); }
.chip-warning { background: var(--hr-warning-soft); color: var(--hr-warning); }
.chip-danger  { background: var(--hr-danger-soft); color: var(--hr-danger); }
.chip-soft    { background: var(--hr-surface-2); color: var(--hr-muted); }
.chip-subj    { background: var(--subj-soft); color: var(--subj-ink); }

.subj-label { margin: 0; font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--subj-ink); }
.subj-bar { width: 4px; border-radius: 4px; background: var(--subj); align-self: stretch; }
.subj-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--subj); flex: none; }

/* Buttons */
.btn {
  --bs-btn-font-family: var(--hr-font-body);
  --bs-btn-font-weight: 700;
  --bs-btn-font-size: .9rem;
  --bs-btn-padding-x: 1.1rem;
  --bs-btn-padding-y: .58rem;
  --bs-btn-border-radius: 999px;
  --bs-btn-focus-box-shadow: var(--hr-ring);
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
}
.btn .ic { width: 18px; height: 18px; }
.btn-sm { --bs-btn-font-size: .8rem; --bs-btn-padding-x: .85rem; --bs-btn-padding-y: .38rem; --bs-btn-border-radius: 999px; }
.btn-lg { --bs-btn-font-size: 1rem; --bs-btn-padding-x: 1.4rem; --bs-btn-padding-y: .75rem; --bs-btn-border-radius: 999px; }
.btn-primary {
  --bs-btn-bg: var(--hr-primary); --bs-btn-border-color: var(--hr-primary); --bs-btn-color: var(--hr-on-primary);
  --bs-btn-hover-bg: var(--hr-primary-strong); --bs-btn-hover-border-color: var(--hr-primary-strong); --bs-btn-hover-color: var(--hr-on-primary);
  --bs-btn-active-bg: var(--hr-primary-strong); --bs-btn-active-border-color: var(--hr-primary-strong); --bs-btn-active-color: var(--hr-on-primary);
  --bs-btn-disabled-bg: var(--hr-primary); --bs-btn-disabled-border-color: var(--hr-primary); --bs-btn-disabled-color: var(--hr-on-primary);
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .55);
}
.btn-coral {
  --bs-btn-bg: var(--hr-coral); --bs-btn-border-color: var(--hr-coral); --bs-btn-color: var(--hr-on-coral);
  --bs-btn-hover-bg: var(--hr-coral-strong); --bs-btn-hover-border-color: var(--hr-coral-strong); --bs-btn-hover-color: var(--hr-on-coral);
  --bs-btn-active-bg: var(--hr-coral-strong); --bs-btn-active-border-color: var(--hr-coral-strong); --bs-btn-active-color: var(--hr-on-coral);
  box-shadow: 0 6px 16px -6px rgba(242, 96, 63, .6);
}
.btn-soft {
  --bs-btn-bg: var(--hr-primary-soft); --bs-btn-border-color: transparent; --bs-btn-color: var(--hr-primary-ink);
  --bs-btn-hover-bg: color-mix(in srgb, var(--hr-primary) 20%, var(--hr-surface)); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: var(--hr-primary-ink);
  --bs-btn-active-bg: color-mix(in srgb, var(--hr-primary) 24%, var(--hr-surface)); --bs-btn-active-border-color: transparent; --bs-btn-active-color: var(--hr-primary-ink);
  white-space: nowrap;
}
.btn-ghost {
  --bs-btn-bg: transparent; --bs-btn-border-color: var(--hr-line-2); --bs-btn-color: var(--hr-ink-2);
  --bs-btn-hover-bg: var(--hr-surface-2); --bs-btn-hover-border-color: var(--hr-line-2); --bs-btn-hover-color: var(--hr-ink);
  --bs-btn-active-bg: var(--hr-surface-3); --bs-btn-active-border-color: var(--hr-line-2); --bs-btn-active-color: var(--hr-ink);
}
.btn-icon { --bs-btn-padding-x: 0; width: 40px; height: 40px; }

/* Forms */
.form-label { font-weight: 700; font-size: .86rem; color: var(--hr-ink); margin-bottom: .35rem; }
.form-text { color: var(--hr-muted); font-size: .8rem; }
.form-control, .form-select {
  background-color: var(--hr-surface);
  border: 1.5px solid var(--hr-line-2);
  border-radius: var(--hr-radius-sm);
  color: var(--hr-ink);
  padding: .6rem .85rem;
  font-size: .92rem;
}
.form-select { padding-right: 2.25rem; }
.form-control::placeholder { color: color-mix(in srgb, var(--hr-muted) 80%, transparent); }
.form-control:focus, .form-select:focus { background-color: var(--hr-surface); color: var(--hr-ink); border-color: var(--hr-primary); box-shadow: var(--hr-ring); }
textarea.form-control { min-height: 110px; resize: vertical; }
.form-check-input { border: 1.5px solid var(--hr-line-2); background-color: var(--hr-surface); width: 1.15em; height: 1.15em; margin-top: .2em; }
.form-check-input:checked { background-color: var(--hr-primary); border-color: var(--hr-primary); }
.form-check-input:focus { box-shadow: var(--hr-ring); border-color: var(--hr-primary); }
.form-check-label { font-size: .9rem; }
.was-validated .form-control:invalid, .was-validated .form-select:invalid, .form-control.is-invalid { border-color: var(--hr-danger); }
.invalid-feedback { color: var(--hr-danger); font-weight: 600; font-size: .8rem; }
.form-success {
  display: none; align-items: flex-start; gap: .7rem;
  padding: .9rem 1rem; border-radius: var(--hr-radius-md);
  background: var(--hr-success-soft); color: var(--hr-success); font-weight: 600; font-size: .9rem;
}
.form-success.is-visible { display: flex; }
.form-success .ic { margin-top: 2px; }

/* Segmented tabs (used for status filters, terms, day/week) */
.seg-tabs {
  display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 4px;
  background: var(--hr-surface-2); border: 1px solid var(--hr-line);
  border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tab {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 0; background: transparent; color: var(--hr-muted);
  padding: .48rem 1rem; border-radius: 999px;
  font-family: var(--hr-font-display); font-weight: 800; font-size: .88rem; white-space: nowrap;
  transition: background-color .15s var(--hr-ease), color .15s var(--hr-ease), box-shadow .15s var(--hr-ease);
}
.seg-tab:hover { color: var(--hr-ink); }
.seg-tab[aria-selected="true"], .seg-tab[aria-pressed="true"], .seg-tab.active {
  background: var(--hr-surface); color: var(--hr-ink); box-shadow: var(--hr-shadow-sm);
}
.seg-tab .count {
  min-width: 22px; padding: 0 6px; height: 20px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--hr-surface-3); color: var(--hr-ink-2); font-family: var(--hr-font-body); font-size: .72rem; font-weight: 700;
}
.seg-tab[aria-selected="true"] .count, .seg-tab.active .count { background: var(--hr-primary); color: var(--hr-on-primary); }

/* No-JS: show every tab pane */
html:not(.js) .tab-content > .tab-pane { display: block; opacity: 1; margin-bottom: 2rem; }

/* Progress */
.mini-progress, .bar {
  display: block; width: 88px; height: 7px; border-radius: 999px;
  background: var(--hr-surface-3); overflow: hidden;
}
.mini-progress > span, .bar > span { display: block; height: 100%; border-radius: inherit; background: var(--subj, var(--hr-primary)); }

/* Legend rows (ring breakdowns) */
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .88rem; }
.legend-list li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: .6rem; }
.legend-list strong { font-weight: 700; }
.key { width: 12px; height: 12px; border-radius: 4px; }
.key-primary { background: var(--hr-primary); }
.key-coral { background: var(--hr-coral); }
.key-muted { background: var(--hr-line-2); }

/* Rings (SVG) */
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-track { stroke: var(--hr-surface-3); }
.ring-fill { stroke: var(--hr-primary); stroke-linecap: round; transition: stroke-dasharray 1.1s var(--hr-ease); }
.ring-target { stroke: var(--hr-ink); stroke-width: 15; }
.ring-coral .ring-fill { stroke: var(--hr-coral); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label strong { font-family: var(--hr-font-display); font-size: 1.55rem; font-weight: 900; }
.ring-label span { font-size: .74rem; color: var(--hr-muted); font-weight: 600; }
.ring-lg { width: 144px; height: 144px; }
.ring-sm { width: 84px; height: 84px; }
.ring-sm circle { stroke-width: 12; }
.ring-sm .ring-label strong { font-size: 1.05rem; }

/* Empty state */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--hr-muted); }
.empty-state .ic { width: 40px; height: 40px; color: var(--hr-primary); margin-bottom: .5rem; }
.empty-state h3 { font-size: 1.05rem; }

/* Modal + offcanvas */
.modal-content { background: var(--hr-surface); color: var(--hr-ink); border: 1px solid var(--hr-line); border-radius: var(--hr-radius); box-shadow: var(--hr-shadow-lg); }
.modal-header, .modal-footer { border-color: var(--hr-line); padding: 1.1rem 1.4rem; }
.modal-body { padding: 1.25rem 1.4rem; }
.modal-title { font-size: 1.2rem; font-weight: 900; }
.modal-backdrop { --bs-backdrop-bg: #14122e; --bs-backdrop-opacity: .45; }
.offcanvas-backdrop { background: #14122e; }
.offcanvas-backdrop.show { opacity: .45; }
.btn-close { border-radius: 50%; padding: .6rem; }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ------------------------------------------------------------------
   5. Home (index.html)
------------------------------------------------------------------ */
.hello {
  position: relative; overflow: hidden; isolation: isolate;
  height: 100%;
  padding: 1.5rem;
  border-radius: var(--hr-radius);
  color: #fff;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 138, 112, .38) 0%, transparent 55%),
    linear-gradient(135deg, #4338ca 0%, #5a4fe6 45%, #7462f0 100%);
  box-shadow: 0 18px 40px -18px rgba(67, 56, 202, .65);
}
.hello-deco { position: absolute; z-index: -1; right: -86px; top: -64px; width: 250px; opacity: .55; }
.hd-sun { fill: #ffb199; opacity: .85; }
.hd-ray { stroke: #ffb199; stroke-width: 5; stroke-linecap: round; opacity: .7; }
.hd-wave { fill: none; stroke: rgba(255, 255, 255, .28); stroke-width: 6; stroke-linecap: round; }
.hd-wave-2 { stroke: rgba(255, 255, 255, .16); }
.hd-star { fill: #ffd98a; }
.hello-date { margin: 0 0 .35rem; font-weight: 700; font-size: .85rem; color: rgba(255, 255, 255, .82); }
.hello-title { color: #fff; font-size: clamp(1.8rem, 1.3rem + 2vw, 2.7rem); font-weight: 900; margin: 0 0 .5rem; letter-spacing: -.015em; }
.hello-lead { max-width: 46ch; margin: 0 0 1.4rem; color: rgba(255, 255, 255, .9); font-size: 1rem; }
.hello-lead strong { color: #fff; }
.hello-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.hello-stats > :first-child { grid-column: 1 / -1; }
.hello-stat {
  display: flex; flex-direction: column; gap: .15rem;
  padding: .85rem 1rem; border-radius: var(--hr-radius-md);
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .2);
  color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hello-stat-link { transition: background-color .15s var(--hr-ease), transform .15s var(--hr-ease); }
.hello-stat-link:hover { background: rgba(255, 255, 255, .2); color: #fff; transform: translateY(-2px); }
.hs-label { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 700; color: rgba(255, 255, 255, .85); text-transform: uppercase; letter-spacing: .06em; }
.hs-label .ic { width: 15px; height: 15px; }
.hs-value { font-family: var(--hr-font-display); font-weight: 900; font-size: 1.3rem; line-height: 1.2; }
.hs-sub { font-size: .82rem; color: rgba(255, 255, 255, .85); }
.hs-meter { display: block; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .22); margin: .3rem 0 .15rem; overflow: hidden; }
.hs-meter span { display: block; height: 100%; border-radius: inherit; background: #ffd98a; }
@media (min-width: 576px) {
  .hello { padding: 2rem; }
  .hello-stats { grid-template-columns: repeat(3, 1fr); gap: .75rem; }
  .hello-stats > :first-child { grid-column: auto; }
  .hello-deco { right: -40px; top: -20px; width: 360px; max-width: 80%; opacity: .95; }
}

.attend-card { display: flex; flex-direction: column; }
.attend-body { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; flex: 1; }
.attend-body .legend-list { flex: 1; min-width: 150px; }
@media (max-width: 575.98px) { .attend-body { gap: 1.1rem; } .attend-card .ring-lg { width: 116px; height: 116px; } .attend-card .ring-label strong { font-size: 1.3rem; } }
.attend-note {
  display: flex; align-items: center; gap: .5rem; margin: 1.1rem 0 0; padding: .7rem .9rem;
  border-radius: var(--hr-radius-sm); background: var(--hr-success-soft); color: var(--hr-success);
  font-size: .84rem; font-weight: 600;
}
.attend-note .ic { width: 16px; height: 16px; }

/* Clock chip */
.clock-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .35rem .75rem; border-radius: 999px;
  background: var(--hr-coral-soft); color: var(--hr-coral-ink);
  font-weight: 800; font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--hr-coral-strong); box-shadow: 0 0 0 0 rgba(242, 96, 63, .55); animation: hr-pulse 2s infinite; }
@keyframes hr-pulse { 0% { box-shadow: 0 0 0 0 rgba(242, 96, 63, .5); } 70% { box-shadow: 0 0 0 9px rgba(242, 96, 63, 0); } 100% { box-shadow: 0 0 0 0 rgba(242, 96, 63, 0); } }

/* Today timeline */
.timeline { --tl-time: 42px; list-style: none; margin: 0; padding: 0; }
.tl-item { position: relative; display: grid; grid-template-columns: var(--tl-time) 1fr; column-gap: 1.6rem; }
.tl-item::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--tl-time) + .8rem - 1px); width: 2px; background: var(--hr-line);
}
.tl-item:first-child::before { top: 1.2rem; }
.tl-item:last-child::before { bottom: auto; height: 1.2rem; }
.tl-item::after {
  content: ""; position: absolute; top: 1.2rem; left: calc(var(--tl-time) + .8rem - 6px);
  width: 12px; height: 12px; border-radius: 50%; transform: translateY(-50%);
  background: var(--hr-surface); border: 2.5px solid var(--subj, var(--hr-line-2));
}
.tl-time { padding-top: .72rem; text-align: right; font-size: .78rem; font-weight: 700; color: var(--hr-muted); font-variant-numeric: tabular-nums; }
.tl-card {
  margin-bottom: .55rem; padding: .6rem .9rem;
  border-radius: var(--hr-radius-md); border: 1.5px solid transparent;
  background: var(--subj-soft, transparent);
  transition: background-color .2s var(--hr-ease), border-color .2s var(--hr-ease), opacity .2s var(--hr-ease);
}
.tl-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.tl-title { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-size: .98rem; }
.tl-meta { margin: .1rem 0 0; font-size: .82rem; color: var(--hr-muted); }
.tl-topic { display: none; margin: .45rem 0 0; font-size: .86rem; color: var(--hr-ink-2); }
.tl-status:empty { display: none; }
.tl-status {
  flex: none; padding: .15rem .55rem; border-radius: 999px;
  font-size: .7rem; font-weight: 800; letter-spacing: .02em;
  background: var(--hr-surface); color: var(--hr-muted);
}
.tl-progress, .tl-left { display: none; }
.tl-item.is-short .tl-card { padding-top: .45rem; padding-bottom: .45rem; }
.tl-item.is-break .tl-card { background: transparent; border: 1.5px dashed var(--hr-line-2); }
.tl-item.is-break .tl-title { font-size: .86rem; color: var(--hr-muted); font-family: var(--hr-font-body); font-weight: 700; }
.tl-item.is-break::after { width: 8px; height: 8px; left: calc(var(--tl-time) + .8rem - 4px); background: var(--hr-line-2); border: 0; }
.tl-item.is-club .tl-card { background: transparent; border: 1.5px solid var(--subj-soft); }
.tl-item.is-done .tl-card { opacity: .62; }
.tl-item.is-done::after { background: var(--subj, var(--hr-line-2)); }
.tl-item.is-done.is-break::after { background: var(--hr-line-2); }
.tl-item.is-next .tl-status { background: var(--hr-coral-soft); color: var(--hr-coral-ink); }
.tl-item.is-now .tl-card {
  background: var(--hr-surface); border-color: var(--hr-primary);
  box-shadow: 0 10px 28px -12px rgba(79, 70, 229, .45);
  padding: .85rem 1rem .9rem;
}
.tl-item.is-now .tl-title { font-size: 1.08rem; }
.tl-item.is-now .tl-topic, .tl-item.is-now .tl-progress, .tl-item.is-now .tl-left { display: block; }
.tl-item.is-now .tl-status { background: var(--hr-primary); color: var(--hr-on-primary); }
.tl-item.is-now::after { width: 16px; height: 16px; left: calc(var(--tl-time) + .8rem - 8px); background: var(--hr-primary); border: 3px solid var(--hr-surface); box-shadow: 0 0 0 3px var(--hr-primary-soft); top: 1.45rem; }
.tl-item.is-now .tl-time { color: var(--hr-primary-ink); padding-top: .95rem; }
.tl-progress { height: 6px; border-radius: 999px; background: var(--hr-surface-3); margin-top: .7rem; overflow: hidden; }
.tl-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--hr-primary), var(--hr-coral)); transition: width .6s var(--hr-ease); }
.tl-left { margin: .35rem 0 0; font-size: .78rem; font-weight: 700; color: var(--hr-primary-ink); }
.demo-note { display: flex; gap: .45rem; align-items: flex-start; margin: .75rem 0 0; font-size: .78rem; color: var(--hr-muted); }
.demo-note .ic { margin-top: 2px; }
.demo-note[hidden] { display: none; }

/* Due + grades lists */
.due-list, .grade-list, .news-list, .event-list { list-style: none; margin: 0; padding: 0; }
.due-item {
  display: grid; grid-template-columns: 4px 1fr; column-gap: .9rem; row-gap: .5rem;
  padding: .85rem 0; border-top: 1px solid var(--hr-line);
}
.due-item:first-child { border-top: 0; padding-top: .15rem; }
.due-item .subj-bar { grid-row: span 2; }
.due-title { font-family: var(--hr-font-body); font-size: .98rem; font-weight: 700; margin: .1rem 0 .1rem; }
.due-title a { color: var(--hr-ink); }
.due-title a:hover { color: var(--hr-primary); }
.due-meta { margin: 0; font-size: .82rem; color: var(--hr-muted); }
.due-side { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.due-state { font-size: .78rem; font-weight: 600; color: var(--hr-muted); }
@media (min-width: 576px) {
  .due-item { grid-template-columns: 4px 1fr auto; align-items: center; }
  .due-item .subj-bar { grid-row: auto; }
  .due-side { flex-direction: column; align-items: flex-end; gap: .45rem; }
}

.grade-item { display: flex; align-items: center; gap: .9rem; padding: .75rem 0; border-top: 1px solid var(--hr-line); }
.grade-item:first-child { border-top: 0; padding-top: .15rem; }
.grade-badge {
  display: grid; place-items: center; flex: none;
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--subj-soft); color: var(--subj-ink);
  font-family: var(--hr-font-display); font-weight: 900; font-size: 1.05rem;
}
.grade-main { flex: 1; min-width: 0; }
.grade-main h3 { font-family: var(--hr-font-body); font-size: .95rem; font-weight: 700; margin: 0; }
.grade-main p { margin: .1rem 0 0; font-size: .8rem; color: var(--hr-muted); }
.grade-side { text-align: right; flex: none; }
.grade-side strong { display: block; font-family: var(--hr-font-display); font-weight: 900; font-size: 1.1rem; }
.delta { display: inline-flex; align-items: center; gap: .2rem; font-size: .76rem; font-weight: 700; }
.delta .ic { width: 14px; height: 14px; }
.delta-up { color: var(--hr-success); }
.delta-down { color: var(--hr-danger); }
.delta-flat { color: var(--hr-muted); }

/* Announcements */
.news-feature {
  display: grid; grid-template-columns: 1fr; gap: 1rem;
  padding: .75rem; margin-bottom: .5rem;
  border-radius: var(--hr-radius-md); background: var(--hr-surface-2);
}
.news-feature img { width: 100%; height: 160px; object-fit: cover; border-radius: 12px; }
.news-feature h3 { font-size: 1.05rem; margin: .2rem 0 .35rem; }
.news-feature p { margin: 0; font-size: .88rem; color: var(--hr-ink-2); }
.news-kicker { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem !important; font-weight: 700; color: var(--hr-muted) !important; }
@media (min-width: 576px) {
  .news-feature { grid-template-columns: 200px 1fr; align-items: center; }
  .news-feature img { height: 150px; }
}
.news-list li { display: flex; gap: .9rem; padding: .9rem .25rem; border-top: 1px solid var(--hr-line); }
.news-list li:first-child { border-top: 0; }
.news-ic { width: 42px; height: 42px; }
.news-list h3 { font-family: var(--hr-font-body); font-size: .95rem; font-weight: 700; margin: .1rem 0 .2rem; }
.news-list p { margin: 0; font-size: .86rem; color: var(--hr-ink-2); }
.news-list .news-meta { margin-top: .3rem; font-size: .76rem; color: var(--hr-muted); font-weight: 600; }

/* Events */
.event { display: grid; grid-template-columns: 52px 1fr; gap: .9rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--hr-line); }
.event:first-child { border-top: 0; padding-top: 0; }
.event > .chip { display: none; }
.event-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; height: 56px; border-radius: 14px;
  background: var(--hr-primary-soft); color: var(--hr-primary-ink); line-height: 1;
}
.event-date span { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.event-date strong { font-family: var(--hr-font-display); font-size: 1.35rem; font-weight: 900; margin-top: 3px; }
.event-date.is-accent { background: var(--hr-coral-soft); color: var(--hr-coral-ink); }
.event h3 { font-family: var(--hr-font-body); font-size: .93rem; font-weight: 700; margin: 0 0 .2rem; }
.event p { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: 0; font-size: .8rem; color: var(--hr-muted); }
.event p .ic { width: 14px; height: 14px; }
@media (min-width: 576px) {
  .event { grid-template-columns: 52px 1fr auto; }
  .event > .chip { display: inline-flex; }
}

/* ------------------------------------------------------------------
   6. Assignments
------------------------------------------------------------------ */
.summary-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.5rem; }
.stat-tile {
  display: flex; flex-direction: column; gap: .15rem;
  padding: 1rem 1.1rem; border-radius: var(--hr-radius-md);
  background: var(--hr-surface); border: 1px solid var(--hr-line); box-shadow: var(--hr-shadow-sm);
}
.stat-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 700; color: var(--hr-muted); }
.stat-label .ic { width: 16px; height: 16px; }
.stat-value { font-family: var(--hr-font-display); font-weight: 900; font-size: 1.65rem; line-height: 1.15; }
.stat-sub { font-size: .8rem; color: var(--hr-muted); }
@media (min-width: 768px) { .summary-row { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.toolbar-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar-controls .form-select { width: auto; min-width: 170px; border-radius: 999px; padding-top: .5rem; padding-bottom: .5rem; font-weight: 600; }

.assign-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.assign-item {
  position: relative;
  display: grid; grid-template-columns: 4px 1fr; column-gap: 1rem; row-gap: .6rem;
  padding: 1rem 1.1rem; border-radius: var(--hr-radius-md);
  background: var(--hr-surface); border: 1px solid var(--hr-line); box-shadow: var(--hr-shadow-sm);
  transition: border-color .15s var(--hr-ease), box-shadow .15s var(--hr-ease), transform .15s var(--hr-ease);
}
.assign-item:hover { border-color: color-mix(in srgb, var(--subj) 40%, var(--hr-line)); box-shadow: var(--hr-shadow); transform: translateY(-1px); }
.assign-item .subj-bar { grid-row: span 2; }
.assign-title { font-family: var(--hr-font-body); font-size: 1.02rem; font-weight: 700; margin: .15rem 0 .15rem; }
.assign-open { all: unset; cursor: pointer; }
.assign-open::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.assign-open:focus-visible::after { outline: 3px solid var(--hr-primary); outline-offset: 2px; }
.assign-open:hover { color: var(--hr-primary); }
.assign-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin: 0; font-size: .82rem; color: var(--hr-muted); }
.assign-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.assign-meta .ic { width: 14px; height: 14px; }
.assign-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .9rem; }
.assign-side .bar { width: 110px; }
.assign-chev { display: none; color: var(--hr-muted); }
.assign-item[hidden] { display: none; }
@media (min-width: 768px) {
  .assign-item { grid-template-columns: 4px 1fr auto 20px; align-items: center; padding: 1.1rem 1.25rem; }
  .assign-item .subj-bar { grid-row: auto; }
  .assign-side { flex-direction: column; align-items: flex-end; gap: .45rem; }
  .assign-chev { display: block; }
}
.grade-pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .65rem; border-radius: 999px;
  background: var(--subj-soft, var(--hr-primary-soft)); color: var(--subj-ink, var(--hr-primary-ink));
  font-family: var(--hr-font-display); font-weight: 900; font-size: .9rem;
}
.grade-pill small { font-family: var(--hr-font-body); font-weight: 700; font-size: .76rem; opacity: .9; }

/* Drawer */
.drawer { --bs-offcanvas-width: min(600px, 100vw); --bs-offcanvas-bg: var(--hr-surface); --bs-offcanvas-color: var(--hr-ink); border-left: 1px solid var(--hr-line) !important; }
.drawer .offcanvas-header { align-items: flex-start; gap: 1rem; padding: 1.4rem 1.5rem 1rem; border-bottom: 1px solid var(--hr-line); }
.drawer .offcanvas-title { font-size: 1.35rem; font-weight: 900; margin: .35rem 0 .5rem; }
.drawer .offcanvas-body { padding: 1.25rem 1.5rem 2rem; }
.drawer-facts { display: flex; flex-wrap: wrap; gap: .4rem; }
.drawer-section + .drawer-section { margin-top: 1.6rem; }
.drawer-section h3 { display: flex; align-items: center; gap: .45rem; font-size: 1rem; margin-bottom: .65rem; }
.drawer-section h3 .ic { width: 18px; height: 18px; color: var(--hr-primary); }
.prose p { margin: 0 0 .7rem; color: var(--hr-ink-2); }
.prose ul { padding-left: 1.2rem; margin: 0 0 .7rem; color: var(--hr-ink-2); }
.prose li { margin-bottom: .3rem; }
.resource-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.resource-list li {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem;
  border-radius: var(--hr-radius-sm); border: 1px solid var(--hr-line); font-size: .88rem; font-weight: 600;
}
.resource-list li span:last-child { margin-left: auto; font-weight: 500; font-size: .78rem; color: var(--hr-muted); }
.resource-list .ic { color: var(--hr-primary); }
.rubric-wrap { overflow-x: auto; border: 1px solid var(--hr-line); border-radius: var(--hr-radius-md); }
.rubric { width: 100%; border-collapse: collapse; font-size: .85rem; }
.rubric th, .rubric td { padding: .65rem .8rem; border-bottom: 1px solid var(--hr-line); text-align: left; vertical-align: top; }
.rubric thead th { background: var(--hr-surface-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--hr-muted); font-weight: 800; }
.rubric tbody th { font-weight: 700; color: var(--hr-ink); min-width: 120px; }
.rubric td { color: var(--hr-ink-2); }
.rubric td.pts { text-align: right; font-weight: 800; font-family: var(--hr-font-display); white-space: nowrap; color: var(--hr-ink); }
.rubric tfoot td, .rubric tfoot th { border-bottom: 0; font-weight: 800; color: var(--hr-ink); background: var(--hr-surface-2); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  padding: 1.5rem 1rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--hr-line-2); border-radius: var(--hr-radius-md);
  background: var(--hr-surface-2); color: var(--hr-ink-2);
  transition: border-color .15s var(--hr-ease), background-color .15s var(--hr-ease);
}
.dropzone:hover, .dropzone.is-over { border-color: var(--hr-primary); background: var(--hr-primary-soft); }
.dropzone:focus-within { border-color: var(--hr-primary); box-shadow: var(--hr-ring); }
.dropzone-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--hr-surface); color: var(--hr-primary); box-shadow: var(--hr-shadow-sm); margin-bottom: .25rem; }
.dropzone strong { font-family: var(--hr-font-display); font-size: 1rem; }
.dropzone small { color: var(--hr-muted); }
.dropzone u { color: var(--hr-primary); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.file-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .45rem; }
.file-list li { display: flex; align-items: center; gap: .65rem; padding: .5rem .5rem .5rem .75rem; border-radius: var(--hr-radius-sm); background: var(--hr-surface-2); font-size: .86rem; }
.file-list .ic { color: var(--hr-primary); }
.file-list .file-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.file-list .file-size { color: var(--hr-muted); font-size: .78rem; white-space: nowrap; }
.file-remove { border: 0; background: transparent; color: var(--hr-muted); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.file-remove:hover { background: var(--hr-surface-3); color: var(--hr-danger); }
.submit-error { display: none; margin-top: .6rem; color: var(--hr-danger); font-weight: 600; font-size: .85rem; }
.submit-error.is-visible { display: block; }
.local-note { display: flex; gap: .4rem; align-items: flex-start; font-size: .78rem; color: var(--hr-muted); margin: .6rem 0 0; }
.local-note .ic { width: 14px; height: 14px; margin-top: 3px; }
.feedback-box { padding: 1rem 1.1rem; border-radius: var(--hr-radius-md); background: var(--hr-success-soft); }
.feedback-box .grade-pill { margin-bottom: .5rem; }
.feedback-box p { margin: 0; color: var(--hr-ink-2); }
.feedback-box .who { margin-top: .5rem; font-size: .8rem; font-weight: 700; color: var(--hr-success); }
.turned-in { padding: 1rem 1.1rem; border-radius: var(--hr-radius-md); background: var(--hr-primary-soft); color: var(--hr-primary-ink); font-weight: 600; font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }

/* ------------------------------------------------------------------
   7. Grades
------------------------------------------------------------------ */
.overall-card { display: flex; align-items: center; gap: 1.25rem; }
.overall-card .ring { width: 116px; height: 116px; }
.overall-card h2 { font-size: 1.1rem; margin: 0 0 .15rem; }
.overall-card p { margin: 0; color: var(--hr-muted); font-size: .86rem; }
.overall-card .overall-grade { font-family: var(--hr-font-display); font-weight: 900; font-size: 2.1rem; line-height: 1; color: var(--hr-primary-ink); margin: .25rem 0 .35rem; }

.report-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.report-table th, .report-table td { padding: .9rem .75rem; border-bottom: 1px solid var(--hr-line); vertical-align: middle; }
.report-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--hr-muted); font-weight: 800; border-bottom-width: 1.5px; padding-top: .25rem; }
.report-table tbody tr:last-child td, .report-table tbody tr:last-child th { border-bottom: 0; }
.report-subj { display: flex; align-items: center; gap: .75rem; }
.report-subj .subj-bar { width: 4px; height: 38px; align-self: center; }
.report-subj strong { display: block; font-size: .95rem; }
.report-subj span { font-size: .8rem; color: var(--hr-muted); }
.report-pct { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-pct .bar { width: 90px; }
.report-comment { font-size: .86rem; color: var(--hr-ink-2); max-width: 46ch; margin: 0; }
@media (max-width: 767.98px) {
  .report-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .report-table, .report-table tbody, .report-table tr, .report-table td, .report-table th { display: block; }
  .report-table tr { position: relative; padding: .9rem 0; border-bottom: 1px solid var(--hr-line); }
  .report-table tbody tr:last-child { border-bottom: 0; }
  .report-table th, .report-table td { border: 0 !important; padding: 0; }
  .report-table td.col-grade { position: absolute; right: 0; top: .9rem; }
  .report-table td.col-pct { margin: .6rem 0 .5rem; }
  .report-table th { padding-right: 60px; }
}

.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: .75rem; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; list-style: none; margin: 0; padding: 0; font-size: .84rem; font-weight: 600; color: var(--hr-ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: .45rem; }
.lk { display: inline-block; width: 18px; height: 3px; border-radius: 2px; background: var(--hr-primary); }
.lk-coral { background: var(--hr-coral-strong); }
.chart-compare { display: flex; align-items: center; gap: .5rem; }
.chart-compare label { font-size: .82rem; font-weight: 700; color: var(--hr-muted); white-space: nowrap; margin: 0; }
.chart-compare .form-select { width: auto; padding-top: .4rem; padding-bottom: .4rem; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.chart-wrap { position: relative; }
.chart-wrap:focus-visible { outline: 3px solid var(--hr-primary); outline-offset: 4px; border-radius: 12px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--hr-line); stroke-width: 1; }
.chart-axis text { fill: var(--hr-muted); font-size: 12px; font-family: var(--hr-font-body); font-variant-numeric: tabular-nums; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line-main { stroke: var(--hr-primary); }
.chart-line-compare { stroke: var(--hr-coral-strong); }
.chart-area { fill: var(--hr-primary); opacity: .1; }
.chart-dot { stroke: var(--hr-surface); stroke-width: 2; }
.chart-dot-main { fill: var(--hr-primary); }
.chart-dot-compare { fill: var(--hr-coral-strong); }
.chart-end { fill: var(--hr-ink); font-size: 12px; font-weight: 700; font-family: var(--hr-font-body); }
.chart-cross { stroke: var(--hr-line-2); stroke-width: 1; }
.chart-tip {
  position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none;
  min-width: 150px; padding: .6rem .75rem; border-radius: 12px;
  background: var(--hr-ink); color: var(--hr-bg); box-shadow: var(--hr-shadow);
  font-size: .8rem; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.chart-tip.is-on { opacity: 1; transform: none; }
.chart-tip .tip-title { font-weight: 700; margin-bottom: .3rem; opacity: .8; }
.chart-tip .tip-row { display: flex; align-items: center; gap: .5rem; }
.chart-tip .tip-row strong { font-size: .95rem; min-width: 44px; }
.chart-tip .lk { width: 12px; }
.chart-data { margin-top: .75rem; }
.chart-data summary { cursor: pointer; font-weight: 700; font-size: .85rem; color: var(--hr-primary); width: max-content; }
.chart-data table { width: 100%; margin-top: .5rem; font-size: .84rem; border-collapse: collapse; }
.chart-data th, .chart-data td { padding: .4rem .5rem; border-bottom: 1px solid var(--hr-line); text-align: left; font-variant-numeric: tabular-nums; }
.chart-data thead th { color: var(--hr-muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }

.insight { display: flex; gap: .8rem; padding: .9rem 0; border-top: 1px solid var(--hr-line); }
.insight:first-of-type { border-top: 0; padding-top: 0; }
.insight h3 { font-family: var(--hr-font-body); font-size: .95rem; font-weight: 700; margin: 0 0 .15rem; }
.insight p { margin: 0; font-size: .86rem; color: var(--hr-ink-2); }

/* ------------------------------------------------------------------
   8. Timetable
------------------------------------------------------------------ */
.tt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.tt-nav { display: flex; align-items: center; gap: .35rem; }
.tt-nav-label { font-family: var(--hr-font-display); font-weight: 800; min-width: 9.5rem; text-align: center; }
.day-picker { display: none; }
.tt-card { padding: .75rem; }
.tt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tt {
  --t0: 510;            /* 08:30 in minutes */
  --t1: 1000;           /* 16:40 */
  --ppm: 1.3px;         /* pixels per minute */
  --axis: 52px;
}
.tt-heads, .tt-grid { display: grid; grid-template-columns: var(--axis) repeat(5, minmax(0, 1fr)); }
.tt-heads { position: sticky; top: 0; z-index: 4; background: var(--hr-surface); border-bottom: 1px solid var(--hr-line); }
.tt-head { padding: .6rem .25rem .7rem; text-align: center; line-height: 1.15; }
.tt-head span { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--hr-muted); }
.tt-head strong { display: inline-grid; place-items: center; min-width: 34px; height: 34px; margin-top: .25rem; border-radius: 999px; font-family: var(--hr-font-display); font-size: 1.1rem; font-weight: 900; }
.tt-head.is-today span { color: var(--hr-primary-ink); }
.tt-head.is-today strong { background: var(--hr-primary); color: var(--hr-on-primary); padding: 0 .5rem; }
.tt-axis, .tt-col { position: relative; height: calc((var(--t1) - var(--t0)) * var(--ppm)); }
.tt-axis span { position: absolute; right: .55rem; top: calc((var(--m) - var(--t0)) * var(--ppm)); transform: translateY(-50%); font-size: .72rem; font-weight: 700; color: var(--hr-muted); font-variant-numeric: tabular-nums; }
.tt-col {
  border-left: 1px solid var(--hr-line);
  background-image: repeating-linear-gradient(to bottom, var(--hr-line) 0 1px, transparent 1px calc(60 * var(--ppm)));
  background-position: 0 calc(30 * var(--ppm));
}
.tt-col.is-today { background-color: color-mix(in srgb, var(--hr-primary) 5%, transparent); }
.tt-lesson, .tt-band {
  position: absolute; left: 4px; right: 4px;
  top: calc((var(--s) - var(--t0)) * var(--ppm) + 2px);
  height: calc((var(--e) - var(--s)) * var(--ppm) - 4px);
}
.tt-lesson {
  z-index: 1; overflow: hidden;
  padding: .35rem .5rem; border-radius: 12px;
  background: var(--subj-soft); border-left: 4px solid var(--subj);
  line-height: 1.25;
}
.tt-lesson strong { display: block; font-family: var(--hr-font-display); font-weight: 800; font-size: .84rem; color: var(--hr-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-lesson span { display: block; font-size: .72rem; color: var(--hr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-lesson .tt-topic { display: none; }
.tt-lesson.is-short { padding-top: .15rem; padding-bottom: .15rem; }
.tt-lesson.is-short strong { display: inline; font-size: .74rem; }
.tt-lesson.is-short span { display: inline; }
.tt-lesson.is-club { background: transparent; border: 1.5px dashed var(--subj); border-left-width: 4px; border-left-style: solid; }
.tt-band {
  left: 0; right: 0; display: grid; place-items: center;
  background: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--hr-line-2) 60%, transparent) 7px 8px);
  font-size: .7rem; font-weight: 700; color: var(--hr-muted);
}
.tt-now {
  position: absolute; z-index: 3; left: -1px; right: 0; height: 2px;
  top: calc((var(--now) - var(--t0)) * var(--ppm));
  background: var(--hr-coral-strong); pointer-events: none;
}
.tt-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--hr-coral-strong); }
.tt-axis .tt-now-tag {
  position: absolute; z-index: 2; right: 4px; top: calc((var(--now) - var(--t0)) * var(--ppm)); transform: translateY(-50%);
  padding: .1rem .4rem; border-radius: 999px; background: var(--hr-coral-strong); color: #fff;
  font-size: .68rem; font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 3px var(--hr-surface);
}
[data-bs-theme="dark"] .tt-axis .tt-now-tag { color: var(--hr-on-coral); }
.tt[data-view="week"] { min-width: 700px; }
.tt[data-view="day"] .tt-heads, .tt[data-view="day"] .tt-grid { grid-template-columns: var(--axis) 1fr; }
.tt[data-view="day"] .tt-head:not(.is-selected):not(.tt-corner), .tt[data-view="day"] .tt-col:not(.is-selected) { display: none; }
.tt[data-view="day"] { --ppm: 1.65px; }
.tt[data-view="day"] .tt-heads { display: none; }
.tt[data-view="day"] .tt-lesson { padding: .5rem .8rem; }
.tt[data-view="day"] .tt-lesson.is-short { padding-top: .3rem; padding-bottom: .3rem; }
.tt[data-view="day"] .tt-lesson strong { font-size: .95rem; }
.tt[data-view="day"] .tt-lesson.is-short strong { font-size: .82rem; }
.tt[data-view="day"] .tt-lesson span { font-size: .8rem; }
.tt[data-view="day"] .tt-lesson .tt-topic { display: block; color: var(--hr-ink-2); margin-top: .15rem; white-space: normal; }
.tt[data-view="day"] .tt-lesson.is-short .tt-topic { display: none; }
.js .day-picker { display: flex; }
.day-picker { gap: .35rem; }
.day-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  border: 1px solid var(--hr-line); background: var(--hr-surface); color: var(--hr-ink-2);
  font-family: var(--hr-font-display); font-weight: 800; font-size: .8rem; line-height: 1;
}
.day-btn small { display: block; font-size: .62rem; font-weight: 700; color: var(--hr-muted); margin-top: 2px; }
.day-btn[aria-pressed="true"] { background: var(--hr-primary); border-color: var(--hr-primary); color: var(--hr-on-primary); }
.day-btn[aria-pressed="true"] small { color: inherit; opacity: .85; }
.tt-days-row { display: none; }
.js .tt-days-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.js .tt-wrap[data-mode="week"] .tt-days-row { display: none; }
.subject-key { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .75rem; font-size: .85rem; }
.subject-key li { display: flex; align-items: center; gap: .5rem; }
.subject-key span:last-child { color: var(--hr-muted); margin-left: auto; font-size: .78rem; font-variant-numeric: tabular-nums; }
.week-notes { list-style: none; margin: 0; padding: 0; }
.week-notes li { display: flex; gap: .8rem; padding: .8rem 0; border-top: 1px solid var(--hr-line); }
.week-notes li:first-child { border-top: 0; padding-top: 0; }
.week-notes h3 { font-family: var(--hr-font-body); font-size: .92rem; font-weight: 700; margin: 0 0 .1rem; }
.week-notes p { margin: 0; font-size: .82rem; color: var(--hr-muted); }

/* ------------------------------------------------------------------
   9. Messages
------------------------------------------------------------------ */
.inbox {
  display: grid; grid-template-columns: 1fr;
  background: var(--hr-surface); border: 1px solid var(--hr-line);
  border-radius: var(--hr-radius); box-shadow: var(--hr-shadow-sm); overflow: hidden;
}
.inbox-list { display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid var(--hr-line); }
.inbox-tools { padding: 1rem 1rem .5rem; display: grid; gap: .75rem; }
.search-field { position: relative; }
.search-field .ic { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--hr-muted); pointer-events: none; }
.search-field .form-control { padding-left: 2.5rem; border-radius: 999px; background: var(--hr-surface-2); border-color: transparent; }
.search-field .form-control:focus { background: var(--hr-surface); }
.filter-chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.filter-chip {
  border: 1px solid var(--hr-line-2); background: transparent; color: var(--hr-ink-2);
  padding: .3rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 700;
}
.filter-chip[aria-pressed="true"] { background: var(--hr-ink); border-color: var(--hr-ink); color: var(--hr-bg); }
.thread-list { list-style: none; margin: 0; padding: .25rem .5rem .75rem; overflow-y: auto; flex: 1; }
.thread {
  position: relative; display: grid; grid-template-columns: 44px 1fr; gap: .75rem;
  width: 100%; padding: .8rem .75rem; border: 0; border-radius: var(--hr-radius-md);
  background: transparent; color: var(--hr-ink); text-align: left;
  transition: background-color .15s var(--hr-ease);
}
.thread:hover { background: var(--hr-surface-2); }
.thread[aria-current="true"] { background: var(--hr-primary-soft); }
.thread-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.thread-name { font-weight: 700; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-time { flex: none; font-size: .74rem; color: var(--hr-muted); font-weight: 600; }
.thread-subject { display: block; font-size: .84rem; font-weight: 600; color: var(--hr-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-preview { display: block; font-size: .8rem; color: var(--hr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread.is-unread .thread-name::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: .4rem; border-radius: 50%; background: var(--hr-coral-strong); vertical-align: middle; }
.thread.is-unread .thread-subject { color: var(--hr-ink); font-weight: 700; }
.thread-body { min-width: 0; }
.thread-tag { display: inline-block; margin-top: .3rem; }
.thread-list li[hidden] { display: none; }

.inbox-convo { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.convo-head { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--hr-line); }
.convo-head h2 { font-size: 1.02rem; margin: 0; }
.convo-head p { margin: 0; font-size: .8rem; color: var(--hr-muted); }
.convo-head .convo-who { flex: 1; min-width: 0; }
.convo-back { display: none; }
.js .convo-back { display: inline-grid; }
.convo-subject { padding: .7rem 1rem; border-bottom: 1px solid var(--hr-line); background: var(--hr-surface-2); font-size: .85rem; font-weight: 700; color: var(--hr-ink-2); display: flex; align-items: center; gap: .5rem; }
.convo-subject .ic { width: 16px; height: 16px; color: var(--hr-primary); }
.convo-body { flex: 1; overflow-y: auto; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.day-sep { align-self: center; margin: .35rem 0; padding: .15rem .7rem; border-radius: 999px; background: var(--hr-surface-2); font-size: .72rem; font-weight: 700; color: var(--hr-muted); }
.msg { display: flex; flex-direction: column; max-width: min(78%, 520px); }
.msg-in { align-self: flex-start; }
.msg-out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: .7rem .95rem; border-radius: 20px; font-size: .92rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.msg-in .bubble { background: var(--hr-surface-2); color: var(--hr-ink); border-bottom-left-radius: 6px; }
.msg-out .bubble { background: var(--hr-primary); color: var(--hr-on-primary); border-bottom-right-radius: 6px; }
.msg-meta { margin-top: .25rem; font-size: .72rem; color: var(--hr-muted); font-weight: 600; padding: 0 .3rem; }
.msg-attach { display: inline-flex; align-items: center; gap: .5rem; margin-top: .35rem; padding: .5rem .75rem; border-radius: 12px; border: 1px solid var(--hr-line); background: var(--hr-surface); font-size: .82rem; font-weight: 700; color: var(--hr-ink-2); }
.msg-attach .ic { width: 16px; height: 16px; color: var(--hr-primary); }
.composer { display: flex; align-items: flex-end; gap: .5rem; padding: .75rem; border-top: 1px solid var(--hr-line); background: var(--hr-surface); }
.composer .form-control { min-height: 46px; max-height: 160px; resize: none; border-radius: 22px; padding: .7rem 1rem; background: var(--hr-surface-2); border-color: transparent; }
.composer .form-control:focus { background: var(--hr-surface); }
.composer .btn-icon { width: 46px; height: 46px; flex: none; }
.composer-error { display: none; padding: 0 1rem .6rem; color: var(--hr-danger); font-size: .8rem; font-weight: 600; background: var(--hr-surface); }
.composer-error.is-visible { display: block; }

@media (max-width: 991.98px) {
  .js .inbox:not(.is-open) .inbox-convo { display: none; }
  .js .inbox.is-open .inbox-list { display: none; }
  .js .inbox.is-open .inbox-convo { height: calc(100vh - var(--hr-topbar-h) - var(--hr-tabbar-h) - 1.5rem); height: calc(100dvh - var(--hr-topbar-h) - var(--hr-tabbar-h) - 1.5rem); min-height: 420px; }
  .inbox { scroll-margin-top: calc(var(--hr-topbar-h) + .75rem); }
  .js .inbox { border-radius: var(--hr-radius); }
  .inbox-list { border-bottom: 0; }
}
@media (min-width: 992px) {
  .inbox { grid-template-columns: minmax(290px, 360px) 1fr; height: clamp(600px, calc(100vh - var(--hr-topbar-h) - 11rem), 860px); }
  .inbox-list { border-bottom: 0; border-right: 1px solid var(--hr-line); }
  .js .convo-back { display: none; }
  .convo-body { padding: 1.5rem; }
}

/* ------------------------------------------------------------------
   10. Parent view
------------------------------------------------------------------ */
.child-switch { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.5rem; }
.child-tab {
  display: flex; align-items: center; gap: .75rem; text-align: left;
  padding: .5rem 1.25rem .5rem .5rem; border-radius: 999px;
  border: 2px solid var(--hr-line); background: var(--hr-surface); color: var(--hr-ink);
  box-shadow: var(--hr-shadow-sm);
  transition: border-color .15s var(--hr-ease), background-color .15s var(--hr-ease);
}
.child-tab:hover { border-color: var(--hr-line-2); }
.child-tab.active { border-color: var(--hr-primary); background: var(--hr-primary-soft); }
.child-tab strong { display: block; font-family: var(--hr-font-display); font-weight: 900; font-size: 1rem; line-height: 1.2; }
.child-tab span span { font-size: .78rem; color: var(--hr-muted); font-weight: 600; }
.child-tab .check { display: none; width: 22px; height: 22px; border-radius: 50%; background: var(--hr-primary); color: var(--hr-on-primary); place-items: center; margin-left: .25rem; }
.child-tab .check .ic { width: 14px; height: 14px; stroke-width: 3; }
.child-tab.active .check { display: inline-grid; }
.pane-title { font-size: 1.25rem; margin-bottom: 1rem; }
.js .pane-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.overview-tile { flex-direction: row; align-items: center; gap: 1rem; }
.row > [class*="col"] > .stat-tile { height: 100%; }
.overview-tile .ring-sm { flex: none; }

.fee-list { list-style: none; margin: 0; padding: 0; }
.fee-item { display: grid; grid-template-columns: 42px 1fr auto; gap: .85rem; align-items: center; padding: .85rem 0; border-top: 1px solid var(--hr-line); }
.fee-item:first-child { border-top: 0; padding-top: 0; }
.fee-item h3 { font-family: var(--hr-font-body); font-size: .93rem; font-weight: 700; margin: 0; }
.fee-item p { margin: .1rem 0 0; font-size: .8rem; color: var(--hr-muted); }
.fee-amount { text-align: right; }
.fee-amount strong { display: block; font-family: var(--hr-font-display); font-size: 1.05rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.fee-item.is-paid h3 { text-decoration: line-through; text-decoration-color: var(--hr-muted); color: var(--hr-muted); }
.fee-total {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  margin-top: 1rem; padding: 1rem 1.1rem; border-radius: var(--hr-radius-md);
  background: var(--hr-surface-2);
}
.fee-total p { margin: 0; font-size: .82rem; color: var(--hr-muted); font-weight: 600; }
.fee-total strong { display: block; font-family: var(--hr-font-display); font-size: 1.5rem; font-weight: 900; color: var(--hr-ink); line-height: 1.1; }
.balance-row { display: flex; align-items: center; gap: .6rem; margin-top: .9rem; font-size: .84rem; color: var(--hr-ink-2); }
.balance-row .ic { color: var(--hr-warning); width: 18px; height: 18px; }

.slip-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.slip { display: flex; flex-direction: column; border: 1px solid var(--hr-line); border-radius: var(--hr-radius-md); overflow: hidden; background: var(--hr-surface); }
.slip-top { flex: 1; display: grid; grid-template-columns: 1fr; gap: .9rem; align-content: start; padding: .75rem .75rem 1rem; }
.slip-top > div:last-child { padding: 0 .35rem; }
.slip-thumb, .slip-art { width: 100%; height: 132px; object-fit: cover; border-radius: 12px; }
.slip-art {
  display: grid; place-items: center; color: var(--subj);
  background:
    radial-gradient(circle at 18% 30%, color-mix(in srgb, var(--subj) 22%, transparent) 0 22px, transparent 23px),
    radial-gradient(circle at 84% 72%, color-mix(in srgb, var(--hr-coral) 26%, transparent) 0 30px, transparent 31px),
    radial-gradient(circle at 70% 20%, color-mix(in srgb, var(--subj) 14%, transparent) 0 12px, transparent 13px),
    var(--subj-soft);
}
.slip-art .ic { width: 46px; height: 46px; stroke-width: 1.6; }
.slip h3 { font-family: var(--hr-font-body); font-size: .98rem; font-weight: 700; margin: .35rem 0 .3rem; }
.slip p { margin: 0; font-size: .84rem; color: var(--hr-ink-2); }
.slip-facts { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .6rem !important; color: var(--hr-muted) !important; font-size: .8rem !important; }
.slip-facts span { display: inline-flex; align-items: center; gap: .3rem; }
.slip-facts .ic { width: 14px; height: 14px; }
.slip-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding: .75rem 1rem; border-top: 1px solid var(--hr-line); background: var(--hr-surface-2); }
.slip-form { padding: 1rem; border-top: 1px solid var(--hr-line); }
.slip.is-signed .slip-actions { background: var(--hr-success-soft); }
.slip-signed { display: inline-flex; align-items: center; gap: .4rem; color: var(--hr-success); font-weight: 700; font-size: .85rem; }

.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.alert-item { display: grid; grid-template-columns: 38px 1fr; gap: .8rem; padding: .85rem; border-radius: var(--hr-radius-md); border: 1px solid var(--hr-line); }
.alert-item .notif-ic { width: 38px; height: 38px; }
.alert-item h3 { font-family: var(--hr-font-body); font-size: .92rem; font-weight: 700; margin: 0 0 .15rem; }
.alert-item p { margin: 0; font-size: .82rem; color: var(--hr-ink-2); }
.alert-item .alert-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .55rem; }
.alert-item.is-urgent { border-color: color-mix(in srgb, var(--hr-danger) 35%, var(--hr-line)); background: color-mix(in srgb, var(--hr-danger-soft) 60%, var(--hr-surface)); }

.teacher-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); }
.teacher { display: flex; align-items: center; gap: .8rem; padding: .8rem .85rem; border: 1px solid var(--hr-line); border-radius: var(--hr-radius-md); }
.teacher div { flex: 1; min-width: 0; }
.teacher strong { display: block; font-size: .92rem; }
.teacher span { font-size: .8rem; color: var(--hr-muted); }

.pay-lines { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.pay-lines label { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: var(--hr-radius-sm); border: 1.5px solid var(--hr-line); cursor: pointer; font-size: .9rem; }
.pay-lines label:has(input:checked) { border-color: var(--hr-primary); background: var(--hr-primary-soft); }
.pay-lines .form-check-input { margin: 0; flex: none; }
.pay-lines span:nth-of-type(1) { flex: 1; font-weight: 600; }
.pay-lines strong { font-variant-numeric: tabular-nums; }
.pay-method { display: grid; gap: .5rem; }
.pay-method label { display: flex; align-items: center; gap: .75rem; padding: .7rem .85rem; border-radius: var(--hr-radius-sm); border: 1.5px solid var(--hr-line); cursor: pointer; font-size: .9rem; font-weight: 600; }
.pay-method label:has(input:checked) { border-color: var(--hr-primary); background: var(--hr-primary-soft); }
.pay-method .form-check-input { margin: 0; }
.pay-method small { display: block; font-weight: 500; color: var(--hr-muted); }
.pay-summary { display: flex; justify-content: space-between; align-items: center; padding: .85rem 0 0; margin-top: 1rem; border-top: 1px solid var(--hr-line); font-weight: 700; }
.pay-summary strong { font-family: var(--hr-font-display); font-size: 1.4rem; font-weight: 900; }

/* ------------------------------------------------------------------
   11. Motion, print
------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .rail, .tabbar, .app-footer, .skip-link, .no-print, .tt-toolbar, .tt-days-row { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  body { background: #fff; }
  .card-hr { box-shadow: none; }
  .tt[data-view] { min-width: 0; }
}

/* ------------------------------------------------------------------
   12. Progressive-enhancement helpers
------------------------------------------------------------------ */
html:not(.js) .js-only { display: none !important; }
.js .no-js-only { display: none !important; }
.table-wrap { overflow-x: auto; }
.term-title { font-size: 1.05rem; margin: 0 0 .75rem; }
.js .term-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.term-summary { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.chart-title { font-size: 1.15rem; margin: 0; }
.chart-fallback { margin: 0; padding: 1rem; border-radius: var(--hr-radius-sm); background: var(--hr-surface-2); color: var(--hr-muted); font-size: .88rem; }
@media (max-width: 575.98px) {
  .seg-tab { padding: .45rem .75rem; font-size: .8rem; }
  .card-hr-head .seg-tabs { width: 100%; }
  .card-hr-head .seg-tabs .seg-tab { flex: 1; justify-content: center; }
}
.tt-day-label { margin: 0; font-family: var(--hr-font-display); font-weight: 800; font-size: 1.05rem; }
.composer { position: relative; }
.composer-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }
.composer-file:focus-visible + .composer-attach { box-shadow: var(--hr-ring); }
.composer-attach { flex: none; width: 46px; height: 46px; cursor: pointer; }
.attach-hint { margin: 0; padding: .5rem 1rem 0; background: var(--hr-surface); font-size: .8rem; font-weight: 700; color: var(--hr-primary-ink); }
.attach-hint[hidden] { display: none; }
.thread-empty { padding: 1.5rem 1rem; text-align: center; color: var(--hr-muted); font-size: .88rem; }
.convo-head h2:focus { outline: none; }
.stat-grade { font-size: .95rem; font-weight: 800; color: var(--hr-primary-ink); background: var(--hr-primary-soft); padding: .1rem .45rem; border-radius: 8px; vertical-align: middle; margin-left: .25rem; }
.overview-tile .stat-label { display: block; margin-bottom: .3rem; }
.balance-row.tone-text-danger .ic { color: var(--hr-danger); }
.balance-row.tone-text-warning .ic { color: var(--hr-warning); }
.card-hr-head .btn { flex: none; white-space: nowrap; }
@media (max-width: 575.98px) {
  .child-switch { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
  html:not(.js) .child-switch { display: none; }
  .child-tab { padding: .4rem .6rem .4rem .4rem; gap: .5rem; }
  .child-tab .avatar { width: 36px; height: 36px; font-size: .8rem; }
  .child-tab strong { font-size: .9rem; }
  .child-tab span span { font-size: .7rem; }
  .child-tab .check { display: none !important; }
  .overview-tile { flex-direction: column; align-items: flex-start; gap: .6rem; }
  .overview-tile .ring-sm { width: 72px; height: 72px; }
  .overview-tile .ring-sm .ring-label strong { font-size: .9rem; }
  .stat-tile { padding: .9rem; }
  .stat-value { font-size: 1.4rem; }
}
/* Only flag problems: valid fields keep their normal look */
.was-validated .form-control:valid, .was-validated .form-select:valid { border-color: var(--hr-line-2); background-image: none; padding-right: .85rem; }
.was-validated .form-select:valid { padding-right: 2.25rem; background-image: var(--bs-form-select-bg-img); }
.was-validated .form-check-input:valid { border-color: var(--hr-line-2); }
.was-validated .form-check-input:valid:checked { background-color: var(--hr-primary); border-color: var(--hr-primary); }
.was-validated .form-check-input:valid ~ .form-check-label { color: inherit; }
.tt:not(.shows-today) .tt-now-tag { display: none; }
/* Greeting card: stats sit at the bottom when the row is taller than its copy */
.hello { display: flex; flex-direction: column; }
.hello-stats { margin-top: auto; }
@media (min-width: 1200px) and (max-width: 1439.98px) {
  .attend-body { gap: 1rem; flex-wrap: nowrap; }
  .attend-card .ring-lg { width: 112px; height: 112px; }
  .attend-card .ring-label strong { font-size: 1.2rem; }
  .attend-body .legend-list { min-width: 0; font-size: .84rem; }
}
@media (max-width: 575.98px) {
  .toolbar-controls { width: 100%; flex-wrap: nowrap; }
  .toolbar-controls .form-select { flex: 1; min-width: 0; }
  .toolbar-controls .btn { flex: none; padding-left: .8rem; padding-right: .8rem; }
}

/* Completed lessons retain readable text; state labels convey completion. */
.tl-item.is-done .tl-card{opacity:1}
.avatar{color:var(--hr-ink)}
.tt-axis .tt-now-tag{color:var(--hr-on-coral)}
.convo-body:focus-visible{outline:3px solid var(--hr-primary);outline-offset:-4px}
