/* =========================================================================
   Nova School Management — design system
   Tokens are RGB triplets so Tailwind utilities (bg-surface/50 etc.) work.
   ========================================================================= */

:root {
  --canvas: 245 247 251;
  --surface: 255 255 255;
  --subtle: 241 245 249;
  --ink: 15 23 42;
  --ink-2: 51 65 85;
  --muted: 100 116 139;
  --line: 226 232 240;
  --line-strong: 203 213 225;
  --brand: 37 99 235;
  --brand-ink: 29 78 216;
  --navy: 23 37 84;
  --accent: 14 165 233;
  --success: 22 163 74;
  --warning: 217 119 6;
  --danger: 220 38 38;
  --neutral: 100 116 139;

  --sidebar-bg: 23 37 84;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 72px;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgb(15 23 42 / .04), 0 2px 8px -2px rgb(15 23 42 / .04);
  --shadow-sm: 0 1px 2px rgb(15 23 42 / .06), 0 1px 3px rgb(15 23 42 / .04);
  --shadow-md: 0 4px 12px -2px rgb(15 23 42 / .08), 0 2px 4px -2px rgb(15 23 42 / .05);
  --shadow-lg: 0 16px 40px -8px rgb(15 23 42 / .18), 0 4px 12px -4px rgb(15 23 42 / .08);
  --ring: 0 0 0 3px rgb(var(--brand) / .25);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

.dark {
  --canvas: 8 13 26;
  --surface: 15 23 42;
  --subtle: 22 32 54;
  --ink: 241 245 249;
  --ink-2: 203 213 225;
  --muted: 148 163 184;
  --line: 34 46 68;
  --line-strong: 51 65 85;
  --brand: 59 130 246;
  --brand-ink: 147 197 253;
  --navy: 30 58 138;
  --accent: 56 189 248;
  --success: 34 197 94;
  --warning: 245 158 11;
  --danger: 248 113 113;
  --neutral: 148 163 184;
  --sidebar-bg: 11 20 46;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-md: 0 6px 16px -4px rgb(0 0 0 / .5);
  --shadow-lg: 0 20px 48px -8px rgb(0 0 0 / .65);
  --ring: 0 0 0 3px rgb(var(--brand) / .4);
  color-scheme: dark;
}

* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { font-feature-settings: "cv11", "ss01"; font-size: 14px; line-height: 1.5; background: rgb(var(--canvas)); color: rgb(var(--ink)); overflow-x: hidden; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.font-display { letter-spacing: -0.02em; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
::selection { background: rgb(var(--brand) / .18); }
[hidden] { display: none !important; }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: rgb(var(--brand)); color: #fff; padding: 8px 12px; border-radius: var(--radius); transition: top .15s; }
.skip-link:focus { top: 12px; }

/* Scrollbars */
.thin-scroll { scrollbar-width: thin; scrollbar-color: rgb(var(--line-strong)) transparent; }
.thin-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.thin-scroll::-webkit-scrollbar-thumb { background: rgb(var(--line-strong)); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }

/* =========================================================================
   Layout shell
   ========================================================================= */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px 32px 48px; outline: none; }
@media (max-width: 1023px) { .page { padding: 20px 20px 40px; } }
@media (max-width: 639px) { .page { padding: 16px 16px 40px; } }
.page-enter { animation: pageIn .28s var(--ease); }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Sidebar (light) ---------- */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; width: var(--sidebar-w); flex-shrink: 0;
  background: rgb(var(--surface)); color: rgb(var(--ink-2));
  display: flex; flex-direction: column; z-index: 40;
  transition: width .22s var(--ease), transform .25s var(--ease);
  border-right: 1px solid rgb(var(--line));
}
.sb-brand { display: flex; align-items: center; justify-content: space-between; height: 72px; padding: 0 18px; flex-shrink: 0; }
.sb-logo { display: flex; align-items: center; gap: 11px; min-width: 0; border-radius: var(--radius); }
.sb-logo img { flex-shrink: 0; width: 38px; height: 38px; }
.sb-wordmark { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-name { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 17px; color: rgb(var(--ink)); letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; font-weight: 500; color: rgb(var(--muted)); margin-top: 1px; }

.sb-campus { position: relative; padding: 2px 14px 14px; flex-shrink: 0; }
.campus-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: linear-gradient(135deg, rgb(37 99 235), rgb(14 165 233)); text-align: left; transition: box-shadow .15s, transform .15s; box-shadow: 0 8px 18px -8px rgb(37 99 235 / .6); }
.campus-btn:hover { box-shadow: 0 10px 22px -8px rgb(37 99 235 / .75); }
.campus-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: rgb(255 255 255 / .2); flex-shrink: 0; }
.campus-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.campus-name { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.campus-sub { font-size: 11px; color: rgb(255 255 255 / .8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.campus-chev { width: 15px; height: 15px; color: rgb(255 255 255 / .85); flex-shrink: 0; }
.dm-campus { left: 14px; right: 14px; top: calc(100% - 6px); }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 14px 12px; scrollbar-width: none; }
.sb-nav::-webkit-scrollbar { display: none; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-group-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: rgb(var(--muted) / .8); padding: 0 10px 6px; white-space: nowrap; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; height: 38px; padding: 0 12px;
  border-radius: 10px; color: rgb(var(--ink-2)); font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.75; color: rgb(var(--muted)); }
.nav-link:hover { background: rgb(var(--subtle)); color: rgb(var(--ink)); }
.nav-link.active { background: rgb(var(--brand) / .09); color: rgb(var(--brand)); font-weight: 600; }
.nav-link.active svg { color: rgb(var(--brand)); }
.nav-link.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: rgb(var(--brand)); }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: rgb(var(--brand) / .1); color: rgb(var(--brand)); }
.nav-count.warn { background: rgb(var(--warning) / .14); color: rgb(var(--warning)); }
.sb-footer { padding: 10px 14px 14px; border-top: 1px solid rgb(var(--line)); display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.sb-promo { margin: 4px 0 10px; padding: 14px; border-radius: 12px; background: linear-gradient(160deg, rgb(var(--brand) / .08), rgb(var(--accent) / .1)); border: 1px solid rgb(var(--brand) / .12); }
.sb-promo .t { font-weight: 700; font-size: 13.5px; color: rgb(var(--ink)); display: flex; align-items: center; gap: 6px; }
.sb-promo .t svg { width: 16px; height: 16px; color: rgb(var(--brand)); }
.sb-promo p { font-size: 12px; color: rgb(var(--muted)); margin: 4px 0 10px; line-height: 1.45; }
@media (min-width: 1024px) { .sb-collapsed .sb-promo { display: none; } }
.sb-collapse-btn svg { transition: transform .2s; }

/* Collapsed (desktop only) */
@media (min-width: 1024px) {
  .sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  .sb-collapsed .sb-wordmark, .sb-collapsed .campus-text, .sb-collapsed .campus-chev,
  .sb-collapsed .nav-link span, .sb-collapsed .nav-count, .sb-collapsed .nav-group-label { display: none; }
  .sb-collapsed .sb-brand { padding: 0 20px; }
  .sb-collapsed .campus-btn { padding: 6px; justify-content: center; }
  .sb-collapsed .nav-link { justify-content: center; padding: 0; }
  .sb-collapsed .nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgb(255 255 255 / .06); }
  .sb-collapsed .sb-collapse-btn svg { transform: rotate(180deg); }
}
.sb-overlay { display: none; }
@media (max-width: 1023px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); width: min(288px, 86vw); }
  .sb-open .sidebar { transform: none; }
  .sb-open .sb-overlay { display: block; position: fixed; inset: 0; background: rgb(2 6 23 / .5); z-index: 39; animation: fade .2s; backdrop-filter: blur(2px); }
}
@keyframes fade { from { opacity: 0; } }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 16px;
  padding: 0 32px; background: rgb(var(--surface) / .92); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid rgb(var(--line));
}
@media (max-width: 1023px) { .topbar { padding: 0 16px 0 12px; gap: 10px; } }
.tb-title { min-width: 0; flex: 0 1 auto; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgb(var(--muted)); white-space: nowrap; }
.crumbs a:hover { color: rgb(var(--ink)); }
.crumbs svg { width: 12px; height: 12px; }
.tb-heading { font-family: Manrope, Inter, sans-serif; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search { position: relative; flex: 1; max-width: 420px; margin-left: auto; }
.tb-search input { width: 100%; height: 38px; padding: 0 40px 0 38px; border-radius: var(--radius); background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); font-size: 13.5px; color: rgb(var(--ink)); transition: border-color .15s, box-shadow .15s; }
.tb-search input::placeholder { color: rgb(var(--muted)); }
.tb-search input:focus { outline: none; border-color: rgb(var(--brand)); box-shadow: var(--ring); }
.tb-search input::-webkit-search-cancel-button { display: none; }
.tb-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: rgb(var(--muted)); pointer-events: none; }
.tb-search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; font-size: 11px; font-family: ui-monospace, monospace; color: rgb(var(--muted)); border: 1px solid rgb(var(--line)); border-bottom-width: 2px; border-radius: 5px; background: rgb(var(--subtle)); }
@media (max-width: 767px) {
  .tb-search { display: none; }
  .tb-search.mobile-open { display: block; position: fixed; left: 0; right: 0; top: 0; height: var(--topbar-h); max-width: none; padding: 13px 12px; background: rgb(var(--surface)); z-index: 60; border-bottom: 1px solid rgb(var(--line)); }
  .tb-search.mobile-open .tb-search-icon { left: 24px; }
  .tb-search.mobile-open .kbd { display: none; }
  .tb-search.mobile-open .search-results { left: 12px; right: 12px; }
}
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; max-height: 420px; overflow: auto; z-index: 70; }
.sr-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: rgb(var(--muted)); padding: 8px 10px 4px; }
.sr-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: var(--radius); text-align: left; }
.sr-item:hover, .sr-item.is-active { background: rgb(var(--subtle)); }
.sr-item svg { width: 16px; height: 16px; color: rgb(var(--muted)); }

.tb-actions { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
@media (max-width: 767px) { .tb-actions { margin-left: auto; gap: 2px; } }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: rgb(var(--warning)); background: rgb(var(--warning) / .1); border: 1px solid rgb(var(--warning) / .2); white-space: nowrap; cursor: help; margin-right: 4px; }
.demo-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgb(var(--warning) / .2); }
@media (max-width: 1199px) { .demo-pill { font-size: 0; gap: 0; padding: 0; width: 26px; justify-content: center; } }
.notif-badge { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: rgb(var(--danger)); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid rgb(var(--canvas)); box-sizing: content-box; line-height: 1; }
.theme-sun { display: none; }
.dark .theme-sun { display: block; }
.dark .theme-moon { display: none; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 3px; border-radius: 999px; margin-left: 4px; }
.profile-btn:hover { background: rgb(var(--subtle)); }
@media (min-width: 1280px) { .profile-btn { padding: 3px 8px 3px 3px; } }
.profile-text { flex-direction: column; line-height: 1.2; text-align: left; }

/* =========================================================================
   Primitives
   ========================================================================= */
.icon-btn { position: relative; width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--radius); color: rgb(var(--ink-2)); transition: background .15s, color .15s; flex-shrink: 0; }
.icon-btn:hover { background: rgb(var(--subtle)); color: rgb(var(--ink)); }
.icon-btn svg { width: 19px; height: 19px; stroke-width: 1.75; }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-sm svg { width: 16px; height: 16px; }
.icon-btn-dark { color: rgb(203 213 225); }
.icon-btn-dark:hover { background: rgb(255 255 255 / .08); color: #fff; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--radius); font-size: 13.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; user-select: none; }
.btn svg { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 12px; gap: 5px; }
.btn-xs svg { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14px; }
.btn-primary { background: rgb(var(--brand)); color: #fff; box-shadow: 0 1px 2px rgb(var(--brand) / .3), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-primary:hover:not(:disabled) { background: rgb(29 78 216); }
.dark .btn-primary:hover:not(:disabled) { background: rgb(37 99 235); }
.btn-secondary { background: rgb(var(--surface)); color: rgb(var(--ink)); border-color: rgb(var(--line)); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: rgb(var(--subtle)); border-color: rgb(var(--line-strong)); }
.btn-ghost { color: rgb(var(--ink-2)); }
.btn-ghost:hover:not(:disabled) { background: rgb(var(--subtle)); color: rgb(var(--ink)); }
.btn-danger { background: rgb(var(--danger)); color: #fff; }
.btn-danger:hover:not(:disabled) { background: rgb(185 28 28); }
.btn-success { background: rgb(var(--success)); color: #fff; }
.btn-success:hover:not(:disabled) { background: rgb(21 128 61); }
.btn-link { color: rgb(var(--brand)); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; border-radius: 4px; }
.btn-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.btn-link svg { width: 14px; height: 14px; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards & sections */
.card { background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; }
.card-head.bordered { border-bottom: 1px solid rgb(var(--line)); }
.card-title { font-family: Manrope, Inter, sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: rgb(var(--ink)); }
.card-sub { font-size: 12.5px; color: rgb(var(--muted)); margin-top: 1px; }
.card-body { padding: 0 20px 20px; }
@media (max-width: 639px) { .card-head { padding: 14px 16px; } .card-body { padding: 0 16px 16px; } }
.divider { height: 1px; background: rgb(var(--line)); }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgb(var(--muted)); }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h2 { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 24px; letter-spacing: -0.025em; line-height: 1.25; color: rgb(var(--ink)); }
.page-head p { color: rgb(var(--muted)); margin-top: 4px; font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 639px) { .page-head h2 { font-size: 21px; } .page-head { margin-bottom: 18px; } .page-actions { width: 100%; } .page-actions .btn-primary { flex: 1; } }

/* KPI */
.kpi { padding: 18px 20px; position: relative; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; font-weight: 500; color: rgb(var(--muted)); }
.kpi-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: rgb(var(--tone, var(--brand)) / .1); color: rgb(var(--tone, var(--brand))); }
.kpi-icon svg { width: 17px; height: 17px; stroke-width: 2; }
.kpi-value { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 28px; letter-spacing: -0.03em; line-height: 1.1; margin-top: 10px; font-variant-numeric: tabular-nums; color: rgb(var(--ink)); }
.kpi-value small { font-size: 15px; font-weight: 700; color: rgb(var(--muted)); margin-left: 2px; letter-spacing: 0; }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; color: rgb(var(--muted)); flex-wrap: wrap; }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; padding: 1px 6px 1px 4px; border-radius: 5px; }
.trend svg { width: 13px; height: 13px; stroke-width: 2.25; }
.trend-up { color: rgb(var(--success)); background: rgb(var(--success) / .1); }
.trend-down { color: rgb(var(--danger)); background: rgb(var(--danger) / .1); }
.trend-flat { color: rgb(var(--muted)); background: rgb(var(--subtle)); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid > * + * { border-left: 1px solid rgb(var(--line)); }
@media (max-width: 1199px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-grid > *:nth-child(3) { border-left: 0; } .kpi-grid > *:nth-child(n+3) { border-top: 1px solid rgb(var(--line)); } }
@media (max-width: 539px) { .kpi-grid { grid-template-columns: 1fr; } .kpi-grid > * + * { border-left: 0; border-top: 1px solid rgb(var(--line)); } .kpi { padding: 16px; } .kpi-value { font-size: 26px; } }
.mini-stat { display: flex; flex-direction: column; gap: 2px; }
.mini-stat .v { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.mini-stat .l { font-size: 12.5px; color: rgb(var(--muted)); }
.stat-strip { display: flex; flex-wrap: wrap; gap: 0; }
.stat-strip > * { padding: 14px 20px; flex: 1 1 140px; }
.stat-strip > * + * { border-left: 1px solid rgb(var(--line)); }
@media (max-width: 639px) { .stat-strip > * { flex-basis: 50%; padding: 12px 16px; } .stat-strip > *:nth-child(odd) { border-left: 0; } .stat-strip > *:nth-child(n+3) { border-top: 1px solid rgb(var(--line)); } }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; color: rgb(var(--tone)); background: rgb(var(--tone) / .1); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge-success { --tone: var(--success); }
.badge-warning { --tone: var(--warning); }
.badge-danger { --tone: var(--danger); }
.badge-info { --tone: var(--brand); }
.badge-accent { --tone: var(--accent); }
.badge-neutral { --tone: var(--neutral); }
.dark .badge { background: rgb(var(--tone) / .16); }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 500; background: rgb(var(--subtle)); color: rgb(var(--ink-2)); border: 1px solid rgb(var(--line)); white-space: nowrap; }
.chip svg { width: 12px; height: 12px; }

/* Avatars */
.avatar { --av: var(--brand); width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: rgb(var(--av)); background: rgb(var(--av) / .12); }
.dark .avatar { background: rgb(var(--av) / .22); color: rgb(var(--av) / 1); filter: brightness(1.25); }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-xl { width: 76px; height: 76px; font-size: 24px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px rgb(var(--surface)); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person-name { font-weight: 600; color: rgb(var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.person-sub { font-size: 12px; color: rgb(var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: rgb(var(--ink-2)); }
.label .req { color: rgb(var(--danger)); margin-left: 2px; }
.hint { font-size: 12px; color: rgb(var(--muted)); }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius); background: rgb(var(--surface));
  border: 1px solid rgb(var(--line-strong)); color: rgb(var(--ink)); font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.dark .input, .dark .select, .dark .textarea { background: rgb(var(--subtle)); border-color: rgb(var(--line)); }
.input::placeholder, .textarea::placeholder { color: rgb(var(--muted) / .8); }
.input:hover, .select:hover, .textarea:hover { border-color: rgb(var(--muted) / .6); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: rgb(var(--brand)); box-shadow: var(--ring); }
.input:disabled, .select:disabled { background: rgb(var(--subtle)); color: rgb(var(--muted)); cursor: not-allowed; }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input-sm, .select-sm { height: 34px; font-size: 13px; }
.is-invalid .input, .is-invalid .select, .is-invalid .textarea, .input.is-invalid { border-color: rgb(var(--danger)); }
.is-invalid .input:focus, .is-invalid .select:focus, .input.is-invalid:focus { box-shadow: 0 0 0 3px rgb(var(--danger) / .2); }
.field-error { display: none; align-items: center; gap: 5px; font-size: 12px; color: rgb(var(--danger)); font-weight: 500; }
.field-error svg { width: 13px; height: 13px; }
.is-invalid .field-error { display: flex; }
.input-group { position: relative; }
.input-group > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: rgb(var(--muted)); pointer-events: none; }
.input-group .input { padding-left: 34px; }
.input-prefix { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: rgb(var(--muted)); font-size: 14px; pointer-events: none; }
.input-prefix + .input { padding-left: 26px; }
@media (max-width: 767px) { .input, .select, .textarea { font-size: 16px; } .input-sm, .select-sm { font-size: 15px; } }

.checkbox { width: 16px; height: 16px; accent-color: rgb(var(--brand)); cursor: pointer; }
.switch { position: relative; width: 36px; height: 20px; border-radius: 999px; background: rgb(var(--line-strong)); transition: background .2s; flex-shrink: 0; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .2s var(--ease); }
.switch[aria-checked="true"] { background: rgb(var(--brand)); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: rgb(var(--subtle)); border: 1px solid rgb(var(--line)); }
.segmented button { height: 28px; padding: 0 11px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: rgb(var(--muted)); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.segmented button svg { width: 15px; height: 15px; }
.segmented button:hover { color: rgb(var(--ink)); }
.segmented button.active { background: rgb(var(--surface)); color: rgb(var(--ink)); box-shadow: var(--shadow-sm); }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; }
.toolbar .input-group { flex: 1 1 260px; max-width: 360px; }
.toolbar .select { width: auto; min-width: 140px; }
@media (max-width: 767px) {
  .toolbar { padding: 12px 16px; }
  .toolbar .input-group { flex-basis: 100%; max-width: none; }
  .toolbar .select { flex: 1 1 calc(50% - 5px); min-width: 0; }
}
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: rgb(var(--brand)); color: #fff; font-size: 11px; font-weight: 700; }

/* Tabs */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid rgb(var(--line)); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 10px 0 12px; font-size: 13.5px; font-weight: 600; color: rgb(var(--muted)); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: rgb(var(--ink)); }
.tab[aria-selected="true"] { color: rgb(var(--brand)); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: rgb(var(--brand)); }
.tab .count { font-size: 11px; padding: 0 6px; border-radius: 999px; background: rgb(var(--subtle)); color: rgb(var(--muted)); line-height: 18px; }
.tab[aria-selected="true"] .count { background: rgb(var(--brand) / .1); color: rgb(var(--brand)); }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 12px; font-weight: 600; color: rgb(var(--muted)); background: rgb(var(--subtle) / .6); padding: 10px 16px; white-space: nowrap; border-bottom: 1px solid rgb(var(--line)); border-top: 1px solid rgb(var(--line)); }
.dark .table th { background: rgb(var(--subtle) / .5); }
.table td { padding: 11px 16px; border-bottom: 1px solid rgb(var(--line)); vertical-align: middle; color: rgb(var(--ink-2)); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: rgb(var(--subtle) / .6); }
.table tr.is-clickable { cursor: pointer; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .ta-r { text-align: right; }
.table .ta-c { text-align: center; }
.table td.strong { color: rgb(var(--ink)); font-weight: 600; }
.table .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; color: rgb(var(--muted)); }
.th-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; font-weight: 600; border-radius: 4px; }
.th-sort:hover { color: rgb(var(--ink)); }
.th-sort svg { width: 13px; height: 13px; opacity: .45; }
.th-sort.sorted { color: rgb(var(--ink)); }
.th-sort.sorted svg { opacity: 1; color: rgb(var(--brand)); }
.table-compact td { padding-top: 8px; padding-bottom: 8px; }
.row-selected td { background: rgb(var(--brand) / .05) !important; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid rgb(var(--line)); font-size: 13px; color: rgb(var(--muted)); flex-wrap: wrap; }
.pg-btns { display: flex; align-items: center; gap: 4px; }
.pg-btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--radius); display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; color: rgb(var(--ink-2)); font-variant-numeric: tabular-nums; }
.pg-btn svg { width: 16px; height: 16px; }
.pg-btn:hover:not(:disabled) { background: rgb(var(--subtle)); }
.pg-btn.active { background: rgb(var(--brand)); color: #fff; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-gap { padding: 0 4px; }
@media (max-width: 639px) { .pagination { padding: 12px 16px; } .pg-num { display: none; } }

/* Dropdowns */
.dropdown-menu { position: absolute; top: calc(100% + 6px); z-index: 50; min-width: 200px; background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 5px; animation: pop .14s var(--ease); color: rgb(var(--ink)); }
.dm-right { right: 0; }
.dm-left { left: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dm-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 10px; height: 34px; border-radius: 6px; font-size: 13.5px; color: rgb(var(--ink-2)); text-align: left; white-space: nowrap; }
.dm-item svg { width: 16px; height: 16px; color: rgb(var(--muted)); stroke-width: 1.85; }
.dm-item:hover, .dm-item:focus-visible { background: rgb(var(--subtle)); color: rgb(var(--ink)); box-shadow: none; }
.dm-item.danger, .dm-item.danger svg { color: rgb(var(--danger)); }
.dm-item.is-current { color: rgb(var(--brand)); }
.dm-item .check { margin-left: auto; color: rgb(var(--brand)); }
.dm-sep { height: 1px; background: rgb(var(--line)); margin: 5px -5px; }
.dm-head { padding: 8px 10px 10px; border-bottom: 1px solid rgb(var(--line)); margin: -5px -5px 5px; padding: 12px 14px; }
.dm-notif { width: min(380px, calc(100vw - 24px)); padding: 0; }
@media (max-width: 639px) { .dm-notif { position: fixed; left: 12px; right: 12px; top: 66px; width: auto; } }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgb(var(--line)); position: relative; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: rgb(var(--brand) / .04); }
.notif-item.unread::after { content: ""; position: absolute; right: 16px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: rgb(var(--brand)); }
.notif-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; color: rgb(var(--tone)); background: rgb(var(--tone) / .1); }
.notif-ico svg { width: 16px; height: 16px; }

/* Modals & drawers */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgb(2 6 23 / .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .18s; }
.modal { background: rgb(var(--surface)); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; animation: modalIn .22s var(--ease); border: 1px solid rgb(var(--line)); }
.modal-sm { max-width: 420px; }
.modal-lg { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 24px 16px; border-bottom: 1px solid rgb(var(--line)); }
.modal-title { font-family: Manrope, Inter, sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
.modal-desc { font-size: 13px; color: rgb(var(--muted)); margin-top: 2px; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid rgb(var(--line)); background: rgb(var(--subtle) / .5); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.modal-foot .foot-note { margin-right: auto; font-size: 12px; color: rgb(var(--muted)); display: flex; align-items: center; gap: 6px; }
.modal-foot .foot-note svg { width: 14px; height: 14px; }
@media (max-width: 639px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-width: none !important; border-radius: 16px 16px 0 0; max-height: 92dvh; animation: sheetIn .26s var(--ease); }
  .modal-head, .modal-body { padding-left: 16px; padding-right: 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-radius: 0; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .foot-note { flex-basis: 100%; }
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
.confirm-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: rgb(var(--tone)); background: rgb(var(--tone) / .1); margin-bottom: 14px; }
.confirm-icon svg { width: 22px; height: 22px; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 80; background: rgb(2 6 23 / .4); animation: fade .18s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: rgb(var(--surface)); z-index: 81; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: drawerIn .26s var(--ease); border-left: 1px solid rgb(var(--line)); }
@keyframes drawerIn { from { transform: translateX(30px); opacity: 0; } }

/* Toasts */
.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; width: min(380px, calc(100vw - 32px)); }
@media (max-width: 639px) { .toast-root { right: 16px; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: auto; } }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: var(--radius-lg); background: rgb(var(--surface)); border: 1px solid rgb(var(--line)); box-shadow: var(--shadow-lg); animation: toastIn .28s var(--ease); }
.toast.leaving { animation: toastOut .2s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }
.toast-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgb(var(--tone)); flex-shrink: 0; margin-top: 1px; }
.toast-ico svg { width: 13px; height: 13px; stroke-width: 3; }
.toast-title { font-weight: 600; font-size: 13.5px; color: rgb(var(--ink)); }
.toast-msg { font-size: 12.5px; color: rgb(var(--muted)); margin-top: 1px; }

/* Tooltip */
.tooltip { position: fixed; z-index: 120; pointer-events: none; padding: 6px 9px; border-radius: 6px; background: rgb(15 23 42); color: #fff; font-size: 12px; font-weight: 500; max-width: 260px; box-shadow: var(--shadow-md); animation: fade .12s; line-height: 1.4; }
.dark .tooltip { background: rgb(51 65 85); }

/* Empty / error / loading */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 24px; }
.empty-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: rgb(var(--subtle)); color: rgb(var(--muted)); margin-bottom: 14px; border: 1px solid rgb(var(--line)); }
.empty-ico svg { width: 22px; height: 22px; }
.empty.error .empty-ico { background: rgb(var(--danger) / .08); color: rgb(var(--danger)); border-color: rgb(var(--danger) / .15); }
.empty h4 { font-weight: 700; font-size: 15px; color: rgb(var(--ink)); }
.empty p { font-size: 13.5px; color: rgb(var(--muted)); margin-top: 4px; max-width: 360px; }
.skeleton { background: linear-gradient(90deg, rgb(var(--subtle)) 0%, rgb(var(--line)) 50%, rgb(var(--subtle)) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Progress & meters */
.meter { height: 6px; border-radius: 999px; background: rgb(var(--subtle)); overflow: hidden; }
.dark .meter { background: rgb(var(--line)); }
.meter > span { display: block; height: 100%; border-radius: 999px; background: rgb(var(--tone, var(--brand))); transition: width .5s var(--ease); }
.stack-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; }
.stack-bar > span { display: block; height: 100%; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

/* Callout */
.callout { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius); font-size: 13px; background: rgb(var(--tone, var(--brand)) / .07); border: 1px solid rgb(var(--tone, var(--brand)) / .18); color: rgb(var(--ink-2)); }
.callout svg { width: 16px; height: 16px; color: rgb(var(--tone, var(--brand))); flex-shrink: 0; margin-top: 2px; }

/* Lists */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; }
.list-row + .list-row { border-top: 1px solid rgb(var(--line)); }
@media (max-width: 639px) { .list-row { padding: 12px 16px; } }
.timeline { position: relative; }
.tl-item { position: relative; display: flex; gap: 12px; padding: 0 20px 18px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 35px; top: 34px; bottom: 2px; width: 1px; background: rgb(var(--line)); }
.tl-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: rgb(var(--tone)); background: rgb(var(--tone) / .1); box-shadow: 0 0 0 4px rgb(var(--surface)); }
.tl-ico svg { width: 15px; height: 15px; }
.date-tile { width: 46px; flex-shrink: 0; text-align: center; border-radius: 9px; border: 1px solid rgb(var(--line)); overflow: hidden; background: rgb(var(--surface)); }
.date-tile .m { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #fff; background: rgb(var(--tone, var(--brand))); padding: 2px 0; }
.date-tile .d { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 17px; padding: 3px 0 4px; color: rgb(var(--ink)); }

/* Chart container */
.chart-box { position: relative; width: 100%; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: rgb(var(--muted)); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Attendance controls */
.att-toggle { display: inline-flex; gap: 4px; }
.att-toggle button { width: 34px; height: 30px; border-radius: 7px; font-size: 12px; font-weight: 700; color: rgb(var(--muted)); border: 1px solid rgb(var(--line)); background: rgb(var(--surface)); transition: all .12s; }
.att-toggle button:hover { border-color: rgb(var(--tone)); color: rgb(var(--tone)); }
.att-toggle button.on { background: rgb(var(--tone)); border-color: rgb(var(--tone)); color: #fff; }
.att-toggle [data-s="present"] { --tone: var(--success); }
.att-toggle [data-s="absent"] { --tone: var(--danger); }
.att-toggle [data-s="late"] { --tone: var(--warning); }
.att-toggle [data-s="excused"] { --tone: var(--neutral); }

/* Calendar heatmap */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 11px; color: rgb(var(--muted)); text-align: center; font-weight: 600; padding-bottom: 2px; }
.cal-d { aspect-ratio: 1; border-radius: 6px; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: rgb(var(--ink-2)); background: rgb(var(--subtle)); }
.cal-d.present { background: rgb(var(--success) / .14); color: rgb(var(--success)); }
.cal-d.absent { background: rgb(var(--danger) / .9); color: #fff; }
.cal-d.late { background: rgb(var(--warning) / .85); color: #fff; }
.cal-d.excused { background: rgb(var(--neutral) / .35); color: rgb(var(--ink)); }
.cal-d.off { background: transparent; color: rgb(var(--muted) / .5); }
.cal-d.today { box-shadow: inset 0 0 0 2px rgb(var(--brand)); }

/* Timetable */
.tt { display: grid; grid-template-columns: 92px repeat(5, minmax(150px, 1fr)); min-width: 860px; }
.tt-h { padding: 10px 12px; font-size: 12px; font-weight: 600; color: rgb(var(--muted)); border-bottom: 1px solid rgb(var(--line)); background: rgb(var(--subtle) / .6); position: sticky; top: 0; }
.tt-h.today { color: rgb(var(--brand)); }
.tt-time { padding: 10px 12px; font-size: 12px; color: rgb(var(--muted)); border-bottom: 1px solid rgb(var(--line)); font-variant-numeric: tabular-nums; line-height: 1.35; }
.tt-time b { display: block; color: rgb(var(--ink-2)); font-weight: 600; }
.tt-cell { padding: 5px; border-bottom: 1px solid rgb(var(--line)); border-left: 1px solid rgb(var(--line)); min-height: 72px; }
.tt-break { grid-column: 2 / -1; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; font-weight: 600; color: rgb(var(--muted)); background: repeating-linear-gradient(135deg, rgb(var(--subtle) / .7) 0 8px, transparent 8px 16px); border-bottom: 1px solid rgb(var(--line)); border-left: 1px solid rgb(var(--line)); padding: 6px; }
.tt-break svg { width: 14px; height: 14px; }
.lesson { height: 100%; border-radius: 7px; padding: 7px 9px; background: rgb(var(--hue) / .08); border-left: 3px solid rgb(var(--hue)); display: flex; flex-direction: column; gap: 1px; min-height: 60px; transition: background .15s; }
.dark .lesson { background: rgb(var(--hue) / .14); }
.lesson:hover { background: rgb(var(--hue) / .14); }
.lesson .s { font-weight: 600; font-size: 12.5px; color: rgb(var(--ink)); line-height: 1.3; }
.lesson .t, .lesson .r { font-size: 11.5px; color: rgb(var(--muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson.dim { opacity: .3; }

/* Profile header */
.profile-cover { height: 84px; border-radius: 12px 12px 0 0; background: rgb(var(--navy)); position: relative; overflow: hidden; }
.profile-cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(600px 160px at 85% -20%, rgb(14 165 233 / .45), transparent 60%), radial-gradient(400px 140px at 10% 120%, rgb(37 99 235 / .5), transparent 60%); }
.profile-cover svg.pattern { position: absolute; right: 24px; top: 14px; opacity: .14; color: #fff; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; }
.dl dt { color: rgb(var(--muted)); }
.dl dd { color: rgb(var(--ink)); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 479px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }

/* Ring */
.ring { --p: 0; --tone: var(--brand); width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(rgb(var(--tone)) calc(var(--p) * 1%), rgb(var(--subtle)) 0); position: relative; flex-shrink: 0; }
.dark .ring { background: conic-gradient(rgb(var(--tone)) calc(var(--p) * 1%), rgb(var(--line)) 0); }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: rgb(var(--surface)); }
.ring span { position: relative; font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }

/* Settings nav */
.set-nav { display: flex; flex-direction: column; gap: 2px; }
.set-nav button { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500; color: rgb(var(--ink-2)); text-align: left; white-space: nowrap; }
.set-nav button svg { width: 17px; height: 17px; color: rgb(var(--muted)); }
.set-nav button:hover { background: rgb(var(--subtle)); }
.set-nav button.active { background: rgb(var(--surface)); color: rgb(var(--ink)); box-shadow: var(--shadow-sm); border: 1px solid rgb(var(--line)); }
.set-nav button.active svg { color: rgb(var(--brand)); }
@media (max-width: 1023px) { .set-nav { flex-direction: row; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; } .set-nav::-webkit-scrollbar { display: none; } }
.set-row { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 20px 0; }
.set-row + .set-row { border-top: 1px solid rgb(var(--line)); }
@media (max-width: 767px) { .set-row { grid-template-columns: 1fr; gap: 12px; } }

.choice-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; border: 1px solid rgb(var(--line)); cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: left; }
.choice-card:hover { border-color: rgb(var(--line-strong)); }
.choice-card.active { border-color: rgb(var(--brand)); box-shadow: var(--ring); }
.theme-preview { height: 64px; border-radius: 6px; overflow: hidden; display: flex; border: 1px solid rgb(var(--line)); }

/* Class cards */
.class-card { padding: 16px; display: flex; flex-direction: column; gap: 14px; transition: border-color .15s, box-shadow .15s; }
.class-card:hover { border-color: rgb(var(--line-strong)); box-shadow: var(--shadow-md); }

/* Receipt */
.receipt { border: 1px dashed rgb(var(--line-strong)); border-radius: 12px; padding: 20px; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.receipt-row span:first-child { color: rgb(var(--muted)); }

/* Utility */
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link { color: rgb(var(--brand)); font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-tone { color: rgb(var(--tone)); }
.grid-dash { display: grid; gap: 20px; }
.tone-success { --tone: var(--success); }
.tone-warning { --tone: var(--warning); }
.tone-danger { --tone: var(--danger); }
.tone-brand { --tone: var(--brand); }
.tone-info { --tone: var(--brand); }
.tone-accent { --tone: var(--accent); }
.tone-neutral { --tone: var(--neutral); }
.tone-navy { --tone: var(--navy); }
.dark .tone-navy { --tone: 129 140 248; }

/* Print: only the receipt */
@media print {
  body * { visibility: hidden !important; }
  .print-area, .print-area * { visibility: visible !important; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .modal-backdrop { background: none; backdrop-filter: none; }
}

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

/* Density */
.density-compact .table td { padding-top: 7px; padding-bottom: 7px; }
.density-compact .table th { padding-top: 8px; padding-bottom: 8px; }
.density-compact .list-row { padding-top: 9px; padding-bottom: 9px; }
@media (max-width: 639px) { .crumbs { display: none; } .tb-heading { font-size: 15px; } }
@media (max-width: 1023px) { .sb-collapse-btn { display: none; } }

/* =========================================================================
   Dashboard pieces (EduNova-style direction)
   ========================================================================= */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
@media (max-width: 1439px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .dash-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; } .dash-rail > * { margin: 0 !important; } }

/* Tinted stat cards with sparkline */
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1535px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 899px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card { position: relative; padding: 16px 16px 14px; border-radius: 14px; background: rgb(var(--tone) / .055); border: 1px solid rgb(var(--tone) / .16); overflow: hidden; min-width: 0; transition: transform .15s, box-shadow .15s; }
a.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.dark .stat-card { background: rgb(var(--tone) / .1); }
.stat-card .lbl { font-size: 13px; font-weight: 600; color: rgb(var(--tone)); }
.stat-card .ico { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgb(var(--tone) / .14); color: rgb(var(--tone)); }
.stat-card .ico svg { width: 19px; height: 19px; stroke-width: 2; }
.stat-card .val { font-family: Manrope, Inter, sans-serif; font-weight: 800; font-size: 26px; letter-spacing: -0.03em; margin-top: 10px; color: rgb(var(--ink)); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-card .val small { font-size: 14px; color: rgb(var(--muted)); font-weight: 700; }
.stat-card .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 6px; }
.stat-card .delta { font-size: 12px; color: rgb(var(--muted)); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.stat-card .delta b { font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.stat-card .delta b svg { width: 13px; height: 13px; stroke-width: 2.5; }
.stat-card .delta .up { color: rgb(var(--success)); }
.stat-card .delta .down { color: rgb(var(--danger)); }
.spark { flex-shrink: 0; width: 84px; height: 30px; }

/* Quick actions */
.qa-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 639px) { .qa-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.qa { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border-radius: 12px; text-align: center; font-size: 12.5px; font-weight: 600; color: rgb(var(--ink-2)); transition: background .15s, transform .15s; }
.qa:hover { background: rgb(var(--subtle)); transform: translateY(-1px); }
.qa .qi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: rgb(var(--tone)); background: rgb(var(--tone) / .1); }
.qa .qi svg { width: 20px; height: 20px; }

/* Today's schedule */
.sched { display: flex; flex-direction: column; }
.sched-item { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 0 16px 12px; }
.sched-item .tm { font-size: 11.5px; color: rgb(var(--muted)); font-variant-numeric: tabular-nums; padding-top: 9px; }
.sched-item .bx { border-left: 3px solid rgb(var(--tone)); background: rgb(var(--tone) / .06); border-radius: 0 9px 9px 0; padding: 8px 10px; min-width: 0; }
.sched-item .bx .t { font-weight: 600; font-size: 13px; color: rgb(var(--ink)); }
.sched-item .bx .s { font-size: 11.5px; color: rgb(var(--muted)); }
.sched-item.now .bx { box-shadow: inset 0 0 0 1px rgb(var(--tone) / .35); }
.sched-item.done { opacity: .55; }

/* Risk list */
.risk-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.risk-row + .risk-row { border-top: 1px solid rgb(var(--line)); }
@media (max-height: 820px) { .sb-promo { display: none; } }
