/* ==========================================================================
   Campus Suite console — design system
   Sheet-on-canvas layout, Geist type, one brand colour per edition.
   Tokens first, then base, layout, components, utilities, responsive.
   ========================================================================== */

:root {
  --font-ui: "Geist", "Anek Bangla", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Geist", "Anek Bangla", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-arabic: "Noto Naskh Arabic", "Amiri", "Traditional Arabic", serif;
  --font-bangla: "Anek Bangla", "Hind Siliguri", "Noto Sans Bengali", sans-serif;

  --canvas: #EBEFF5;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #F0F2F5;
  --line: #E4E7EC;
  --line-soft: #EEF0F3;
  --line-strong: #D3D8E0;
  --text: #121722;
  --text-2: #3A4250;
  --muted: #687080;
  --faint: #9BA2AE;
  --hover: rgba(18, 23, 34, .045);
  --scrim: rgba(12, 16, 24, .42);

  --ok: #15803D;      --ok-soft: #E7F5EC;    --ok-line: #BFE3CB;
  --warn: #B45309;    --warn-soft: #FDF3E2;  --warn-line: #F6D9A8;
  --bad: #CF2E3E;     --bad-soft: #FCEBEC;   --bad-line: #F4C3C8;
  --info: #1F6FD1;    --info-soft: #E8F1FC;  --info-line: #C3DAF6;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 11px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 10px 28px -10px rgba(16, 24, 40, .18), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 28px 70px -20px rgba(16, 24, 40, .32), 0 4px 12px rgba(16, 24, 40, .06);

  --sidebar-w: 256px;
  --topbar-h: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* Pathshala defaults (overridden per theme) */
  --brand-50: #F0F5FF;
  --brand-100: #E1EAFF;
  --brand-200: #C4D5FE;
  --brand-300: #97B5FC;
  --brand-400: #6592F9;
  --brand-500: #3B6EF5;
  --brand-600: #2556E0;
  --brand-700: #1D45B8;
  --brand-800: #1C3B91;
  --brand-900: #1B3272;
  --accent: #F2A516;
  --accent-soft: #FEF4DC;
  --accent-ink: #7A4B00;
}

[data-theme="pathshala"] {
  --canvas: #EAEEF5;
}

[data-theme="talim"] {
  --brand-50: #ECFAF6;
  --brand-100: #D2F3EA;
  --brand-200: #A6E5D5;
  --brand-300: #6FD0BA;
  --brand-400: #3DB39C;
  --brand-500: #1C9580;
  --brand-600: #0F7A68;
  --brand-700: #0D6254;
  --brand-800: #0E4F45;
  --brand-900: #0D4139;
  --accent: #D0643F;
  --accent-soft: #FCEEE8;
  --accent-ink: #7A2E14;
  --canvas: #E7EFEC;
}

[data-theme="lyceum"] {
  --brand-50: #FDF2F5;
  --brand-100: #FAE3EA;
  --brand-200: #F3C4D2;
  --brand-300: #E797AF;
  --brand-400: #D56487;
  --brand-500: #B83D65;
  --brand-600: #95284D;
  --brand-700: #7A1F3F;
  --brand-800: #641C36;
  --brand-900: #521A2F;
  --accent: #C0922E;
  --accent-soft: #FAF2DE;
  --accent-ink: #6B4E10;
  --canvas: #EFEBE8;
  --line: #E7E3E0;
  --line-soft: #F0EDEA;
  --line-strong: #D8D2CE;
  --surface-2: #F8F7F6;
  --surface-3: #F2F0EE;
}

:root {
  --brand: var(--brand-600);
  --brand-hover: var(--brand-700);
  --brand-soft: var(--brand-50);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand-500) 24%, transparent);
}

/* ---------- dark mode ---------- */
[data-mode="dark"] {
  --canvas: #0A0D12;
  --surface: #11151C;
  --surface-2: #161B23;
  --surface-3: #1C222B;
  --line: #232A35;
  --line-soft: #1C222B;
  --line-strong: #2E3643;
  --text: #E9EDF3;
  --text-2: #C2C9D4;
  --muted: #8C95A4;
  --faint: #677080;
  --hover: rgba(255, 255, 255, .05);
  --scrim: rgba(0, 0, 0, .6);
  --ok-soft: rgba(34, 197, 94, .12);   --ok: #4ADE80;   --ok-line: rgba(34, 197, 94, .3);
  --warn-soft: rgba(245, 158, 11, .12); --warn: #FBBF24; --warn-line: rgba(245, 158, 11, .3);
  --bad-soft: rgba(239, 68, 68, .13);  --bad: #F87171;  --bad-line: rgba(239, 68, 68, .3);
  --info-soft: rgba(59, 130, 246, .13); --info: #60A5FA; --info-line: rgba(59, 130, 246, .3);
  --brand-soft: color-mix(in srgb, var(--brand-500) 16%, transparent);
  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01" on, "cv11" on;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4, h5, p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
table { border-collapse: collapse; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand-500) 22%, transparent); }
[hidden] { display: none !important; }
[x-cloak] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 16px; height: 16px; flex: none; }
.icon-xs { width: 14px; height: 14px; flex: none; }
.icon-lg { width: 22px; height: 22px; flex: none; }
.icon-xl { width: 28px; height: 28px; flex: none; }

.tnum, .num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.arabic { font-family: var(--font-arabic); direction: rtl; unicode-bidi: isolate; }
.bangla { font-family: var(--font-bangla); }

/* ==========================================================================
   Shell
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.sidebar:hover { scrollbar-color: var(--line-strong) transparent; }
.nav-scrim { display: none; }

.sheet {
  margin: 10px 10px 10px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 40px -24px rgba(16, 24, 40, .16);
  height: calc(100vh - 20px);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-h);
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease);
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar .topbar-toggle { display: none; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { color: var(--faint); }
.crumbs .icon-xs { color: var(--faint); }
.crumbs strong { color: var(--text); font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.page {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 18px 28px 56px;
  flex: 1;
}
.page-narrow { max-width: 980px; }
.page-mid { max-width: 1200px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head-main { min-width: 0; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 6px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -.028em;
  color: var(--text);
}
.page-sub { margin-top: 6px; font-size: 14px; color: var(--muted); max-width: 70ch; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- sidebar parts ---------- */
.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 14px;
}
.crest {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  background: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 2px 6px -2px color-mix(in srgb, var(--brand-700) 60%, transparent);
  overflow: hidden;
}
.crest img { width: 100%; height: 100%; object-fit: cover; }
.crest svg { width: 24px; height: 24px; }
.brand-text { min-width: 0; }
.brand-name { font-weight: 620; font-size: 14px; line-height: 1.25; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.brand-meta { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.side-tools { display: grid; gap: 8px; padding: 0 2px 6px; }
.side-session, .side-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-2);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--line-strong) 70%, transparent);
  width: 100%;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.side-session:hover, .side-search:hover { background: var(--surface); border-color: var(--line-strong); }
.side-session .icon, .side-search .icon { width: 16px; height: 16px; color: var(--muted); }
.side-session > span, .side-search > span:not(.kbd) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-session strong { font-weight: 600; color: var(--text); }

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  font: 500 11px/1 var(--font-mono);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}

.nav { padding: 6px 0 12px; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .075em;
  color: var(--faint);
  padding: 0 10px 6px;
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 36px;
  padding: 0 10px;
  margin: 1px 0;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s, box-shadow .15s;
}
.nav-item .icon { color: var(--muted); transition: color .15s; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 560;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 0 0 1px var(--line);
}
.nav-item.is-active .icon { color: var(--brand); }
.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand-700);
  background: var(--brand-100);
}

.side-foot { margin-top: auto; padding-top: 10px; }
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  width: 100%;
  text-align: left;
  transition: background .15s;
}
.me:hover { background: var(--hover); }
.me-text { min-width: 0; flex: 1; }
.me-name { font-size: 13.5px; font-weight: 580; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 12px; color: var(--muted); }
.powered {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 10px 2px;
  font-size: 11.5px;
  color: var(--faint);
}
.powered svg { width: 16px; height: 16px; }
.powered b { color: var(--muted); font-weight: 600; }

/* ==========================================================================
   Tabs & segmented controls
   ========================================================================== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: -6px 0 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 12px;
  font-size: 14px;
  font-weight: 520;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); font-weight: 580; }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand);
}
.tab .count { font-size: 12px; color: var(--faint); font-weight: 500; }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
}
.seg > * {
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 540;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.seg > *:hover { color: var(--text); }
.seg > .is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs), 0 0 0 1px var(--line); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 550;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  cursor: pointer;
  user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--line-strong) 80%, var(--text) 20%); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn .icon { width: 17px; height: 17px; margin-left: -2px; }
.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 1px 2px rgba(16, 24, 40, .14);
}
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn-dark:hover { background: color-mix(in srgb, var(--text) 86%, var(--surface)); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--text); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-700); box-shadow: none; }
.btn-soft:hover { background: var(--brand-100); border-color: transparent; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad-line); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn-xs .icon { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon .icon { margin: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-xs.btn-icon { width: 26px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }
.btn-group .btn + .btn { margin-left: -1px; }

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .pip {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}

.link { color: var(--brand); font-weight: 550; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-muted { color: var(--muted); }
.link-muted:hover { color: var(--text); }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 550; color: var(--brand); }
.link-arrow .icon { width: 14px; height: 14px; transition: transform .15s; }
.link-arrow:hover .icon { transform: translateX(2px); }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 0;
}
.card-head.is-divided { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.card-title { font-size: 15px; font-weight: 610; letter-spacing: -.012em; display: flex; align-items: center; gap: 8px; }
.card-title .icon { color: var(--muted); width: 17px; height: 17px; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 16px 18px 18px; }
.card-body.is-flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-tint { background: var(--surface-2); }
.card-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.card-brand .card-sub, .card-brand .muted { color: rgba(255, 255, 255, .72); }

.section-title { font-size: 16px; font-weight: 620; letter-spacing: -.015em; }
.section-sub { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

/* ==========================================================================
   Stats
   ========================================================================== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.stat-row > .stat { padding: 16px 18px; }
.stat-row > .stat + .stat { border-left: 1px solid var(--line-soft); }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-label .icon { width: 15px; height: 15px; }
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 640;
  letter-spacing: -.03em;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-value small { font-size: 15px; font-weight: 520; color: var(--muted); letter-spacing: -.01em; margin-left: 2px; }
.stat-foot { margin-top: 8px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12.5px; }
.delta .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.delta-up { color: var(--ok); }
.delta-down { color: var(--bad); }
.delta-flat { color: var(--muted); }

.big-number {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Badges, status, chips
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid transparent;
}
.badge .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-bad { color: var(--bad); background: var(--bad-soft); }
.badge-info { color: var(--info); background: var(--info-soft); }
.badge-brand { color: var(--brand-700); background: var(--brand-soft); }
.badge-accent { color: var(--accent-ink); background: var(--accent-soft); }
.badge-outline { background: transparent; border-color: var(--line-strong); }
.badge-solid { color: #fff; background: var(--brand); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 520;
  color: var(--text-2);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--faint) 18%, transparent);
}
.status-ok::before { background: #22A15A; box-shadow: 0 0 0 3px color-mix(in srgb, #22A15A 18%, transparent); }
.status-warn::before { background: #E8950C; box-shadow: 0 0 0 3px color-mix(in srgb, #E8950C 20%, transparent); }
.status-bad::before { background: #E0414F; box-shadow: 0 0 0 3px color-mix(in srgb, #E0414F 18%, transparent); }
.status-info::before { background: #3483E6; box-shadow: 0 0 0 3px color-mix(in srgb, #3483E6 18%, transparent); }
.status-brand::before { background: var(--brand-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 18%, transparent); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 530;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { background: var(--surface-2); }
.chip .icon { width: 15px; height: 15px; color: var(--muted); }
.chip.is-on { color: var(--brand-700); background: var(--brand-soft); border-color: var(--brand-200); }
.chip.is-on .icon { color: var(--brand-600); }
.chip .x { margin-right: -4px; opacity: .6; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text-2);
  background: var(--surface-3);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.form-grid > * { grid-column: span 12; }
.form-grid > .c-6 { grid-column: span 6; }
.form-grid > .c-4 { grid-column: span 4; }
.form-grid > .c-3 { grid-column: span 3; }
.form-grid > .c-8 { grid-column: span 8; }
.form-grid > .c-9 { grid-column: span 9; }

.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.label { font-size: 13px; font-weight: 560; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label .req { color: var(--bad); margin-left: 2px; }
.label .opt { color: var(--faint); font-weight: 450; font-size: 12px; }
.hint { font-size: 12.5px; color: var(--muted); }
.field-error { font-size: 12.5px; color: var(--bad); font-weight: 500; }

.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
  min-width: 0;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--line-strong) 70%, var(--text) 30%); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-400); box-shadow: var(--ring); }
.input[readonly], .input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); }
.is-invalid .input, .is-invalid .select, .is-invalid .textarea, .input.is-invalid { border-color: var(--bad); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23687080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5'/%3E%3Cpath d='m7 9 5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 15px;
  cursor: pointer;
}
.input-sm, .select-sm { height: 34px; font-size: 13.5px; border-radius: 9px; }
.input-lg { height: 48px; font-size: 16px; border-radius: 12px; }

.input-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.input-wrap > .icon { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-wrap > .input { padding-left: 34px; }
.input-wrap > .kbd { position: absolute; right: 9px; }
.input-affix { display: flex; align-items: stretch; }
.input-affix > .affix {
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  font-size: 13.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: 10px 0 0 10px;
}
.input-affix > .input { border-radius: 0 10px 10px 0; }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 5px; background: var(--surface); display: grid; place-items: center; transition: background .15s, border-color .15s; flex: none; cursor: pointer; }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { content: ""; width: 10px; height: 10px; background: #fff; clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); }
.check input[type="radio"]:checked::after { width: 8px; height: 8px; border-radius: 50%; clip-path: none; }
.check input:focus-visible { box-shadow: var(--ring); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 21px; margin: 0; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; flex: none; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(15px); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.choice {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice:hover { background: var(--surface-2); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--brand-400); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand-400) inset; }
.choice-title { font-weight: 580; font-size: 14px; }
.choice-sub { font-size: 12.5px; color: var(--muted); }

.form-section {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr);
  gap: 24px 40px;
  padding: 26px 0;
  border-top: 1px solid var(--line-soft);
}
.form-section:first-of-type { border-top: 0; padding-top: 4px; }
.form-section-title { font-size: 15px; font-weight: 610; letter-spacing: -.01em; }
.form-section-sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.form-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 0 4px;
  margin-top: 8px;
  background: linear-gradient(to top, var(--surface) 70%, transparent);
}

input[type="file"] { font-size: 13px; color: var(--muted); max-width: 100%; }
input[type="file"]::file-selector-button {
  margin-right: 10px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: 550 13px var(--font-ui);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }
.card-body.is-flush > .list:last-child > .list-item:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.upload-box {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-2);
}
.upload-box .preview { width: 64px; height: 64px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; color: var(--faint); flex: none; }
.upload-box .preview img { width: 100%; height: 100%; object-fit: cover; }

/* ==========================================================================
   Toolbar & filters
   ========================================================================== */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .input-wrap { max-width: 340px; }
.toolbar-note { font-size: 13px; color: var(--muted); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  height: 40px;
  padding: 0 14px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table th a { display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--text); }
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr { transition: background .12s; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table .shrink { width: 1%; white-space: nowrap; }
.table .muted { color: var(--muted); }
.table-compact td { padding: 8px 12px; }
.table-compact th { height: 36px; padding: 0 12px; }
.table tr.is-selected td { background: var(--brand-soft); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: .55; transition: opacity .15s; }
.table tbody tr:hover .row-actions { opacity: 1; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.table .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.table th.sticky-col { background: var(--surface-2); z-index: 2; }

.pager { display: flex; align-items: center; gap: 4px; }
.pager a, .pager span {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 540;
  color: var(--text-2);
}
.pager a:hover { background: var(--hover); }
.pager .is-current { background: var(--text); color: var(--surface); }
.pager .is-disabled { color: var(--faint); }

/* ==========================================================================
   People
   ========================================================================== */
.avatar {
  --av: 34px;
  width: var(--av);
  height: var(--av);
  border-radius: 50%;
  flex: none;
  display: inline-grid;
  place-items: center;
  font-size: calc(var(--av) * .36);
  font-weight: 620;
  letter-spacing: -.02em;
  overflow: hidden;
  color: var(--tone-ink, #3A4250);
  background: var(--tone-bg, #EEF0F3);
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { --av: 22px; }
.avatar-sm { --av: 28px; }
.avatar-md { --av: 40px; }
.avatar-lg { --av: 52px; }
.avatar-xl { --av: 84px; }
.avatar-square { border-radius: 28%; }
.tone-1 { --tone-bg: #E3ECFF; --tone-ink: #2446A8; }
.tone-2 { --tone-bg: #DDF3E6; --tone-ink: #1C6B3C; }
.tone-3 { --tone-bg: #FDEDD3; --tone-ink: #8A4B06; }
.tone-4 { --tone-bg: #FBE4EA; --tone-ink: #9C2849; }
.tone-5 { --tone-bg: #EDE6FC; --tone-ink: #5A36A8; }
.tone-6 { --tone-bg: #D9F2F2; --tone-ink: #16676A; }
.tone-7 { --tone-bg: #FCE8DC; --tone-ink: #9A4418; }
.tone-8 { --tone-bg: #E8EBF0; --tone-ink: #3F4859; }
[data-mode="dark"] .avatar { --tone-bg: #232A35; --tone-ink: #C2C9D4; }

.avatars { display: flex; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar + .avatar { margin-left: -8px; }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { min-width: 0; }
.person-name { font-weight: 560; font-size: 14px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-name a:hover { color: var(--brand); }
.person-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================
   Data display
   ========================================================================== */
.kv { display: grid; grid-template-columns: minmax(120px, 36%) 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--line-soft);
  min-width: 0;
}
.list-item:first-child { border-top: 0; }
a.list-item:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 550; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12.5px; color: var(--muted); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-end { text-align: right; flex: none; }

.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.meter > span { height: 100%; background: var(--brand); border-radius: 999px; transition: width .6s var(--ease); }
.meter.is-stacked > span { border-radius: 0; }
.meter.is-stacked > span + span { box-shadow: -2px 0 0 var(--surface); }
.meter-sm { height: 6px; }
.meter-lg { height: 12px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--brand); }

.date-tile {
  width: 46px;
  flex: none;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  text-align: center;
}
.date-tile .m { font-size: 10.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--brand); padding: 2px 0; }
.date-tile .d { font-family: var(--font-display); font-size: 18px; font-weight: 650; letter-spacing: -.03em; padding: 3px 0 4px; line-height: 1.1; }
.date-tile.is-accent .m { background: var(--accent); }
.date-tile.is-muted .m { background: var(--muted); }

.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  background: var(--brand-soft);
  color: var(--brand-900);
  border: 1px solid var(--brand-100);
}
.callout .icon { color: var(--brand-600); margin-top: 1px; }
.callout-warn { background: var(--warn-soft); color: #6B3A06; border-color: var(--warn-line); }
.callout-warn .icon { color: var(--warn); }
.callout-bad { background: var(--bad-soft); color: #7A1C25; border-color: var(--bad-line); }
.callout-bad .icon { color: var(--bad); }
.callout-ok { background: var(--ok-soft); color: #14532D; border-color: var(--ok-line); }
.callout-ok .icon { color: var(--ok); }
[data-mode="dark"] .callout { color: var(--text); }

.empty { text-align: center; padding: 48px 24px; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.empty-icon .icon { width: 24px; height: 24px; }
.empty-title { font-size: 15.5px; font-weight: 610; }
.empty-text { font-size: 13.5px; color: var(--muted); margin: 6px auto 16px; max-width: 42ch; }

.divider-label { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin: 18px 0 10px; }
.divider-label::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.steps { display: flex; gap: 6px; }
.step { flex: 1; }
.step-bar { height: 4px; border-radius: 4px; background: var(--surface-3); }
.step.is-done .step-bar { background: var(--brand); }
.step.is-now .step-bar { background: linear-gradient(90deg, var(--brand) 50%, var(--surface-3) 50%); }
.step-label { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ==========================================================================
   Overlays: menus, modals, drawers, toasts, palette
   ========================================================================== */
.dropdown { position: relative; }
.menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-md);
  display: none;
}
.menu.is-left { right: auto; left: 0; }
.menu.is-up { top: auto; bottom: calc(100% + 6px); }
.dropdown.is-open > .menu { display: block; animation: pop .14s var(--ease); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
}
.menu-item:hover { background: var(--hover); color: var(--text); }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }
.menu-item .kbd { margin-left: auto; }
.menu-item.is-danger { color: var(--bad); }
.menu-item.is-danger .icon { color: var(--bad); }
.menu-sep { height: 1px; background: var(--line-soft); margin: 5px -6px; }
.menu-label { font-size: 11.5px; font-weight: 600; color: var(--faint); padding: 6px 10px 4px; text-transform: uppercase; letter-spacing: .06em; }

@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  display: none;
  animation: fade .15s ease;
}
.overlay.is-open { display: block; }
.modal {
  position: fixed;
  z-index: 90;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: none;
}
.modal.is-open { display: block; animation: pop .18s var(--ease); }
.modal-lg { width: min(820px, calc(100vw - 32px)); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-title { font-size: 17px; font-weight: 640; letter-spacing: -.02em; }
.modal-body { padding: 16px 22px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-soft); background: var(--surface-2); border-radius: 0 0 20px 20px; }

.drawer {
  position: fixed;
  z-index: 90;
  top: 10px;
  right: 10px;
  bottom: 10px;
  width: min(480px, calc(100vw - 20px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
}
.drawer.is-open { display: flex; animation: slide-in .2s var(--ease); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 14px; border-bottom: 1px solid var(--line-soft); }
.drawer-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-soft); }

.toasts { position: fixed; z-index: 120; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px 8px 14px;
  border-radius: 13px;
  background: #151A23;
  color: #F2F4F7;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: rise .22s var(--ease);
  max-width: min(560px, calc(100vw - 32px));
}
.toast .icon { width: 17px; height: 17px; color: #7EE2A8; }
.toast.is-error .icon { color: #FF9AA2; }
.toast.is-warn .icon { color: #FFD27A; }
.toast button { color: #AEB5C1; padding: 4px; border-radius: 6px; }
.toast button:hover { color: #fff; background: rgba(255, 255, 255, .1); }

.palette {
  position: fixed;
  z-index: 100;
  left: 50%;
  top: 12vh;
  transform: translateX(-50%);
  width: min(640px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
}
.palette.is-open { display: block; animation: pop .16s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); }
.palette-input .icon { color: var(--muted); width: 20px; height: 20px; }
.palette-input input { flex: 1; height: 58px; border: 0; outline: 0; background: transparent; font-size: 16.5px; }
.palette-results { max-height: min(56vh, 460px); overflow-y: auto; padding: 8px; }
.palette-group { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 10px 10px 6px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.palette-item .icon { color: var(--muted); }
.palette-item.is-active, .palette-item:hover { background: var(--brand-soft); }
.palette-item.is-active .icon { color: var(--brand); }
.palette-item .meta { margin-left: auto; font-size: 12px; color: var(--faint); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.palette-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ==========================================================================
   Charts (inline SVG)
   ========================================================================== */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-ui); font-size: 11px; fill: var(--faint); }
.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis { stroke: var(--line); }
.chart .bar { fill: var(--brand-500); }
.chart .bar-2 { fill: var(--brand-200); }
.chart .bar-accent { fill: var(--accent); }
.chart .bar-muted { fill: var(--surface-3); }
.chart .line { fill: none; stroke: var(--brand-600); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.chart .line-2 { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 4; }
.chart .dot { fill: var(--surface); stroke: var(--brand-600); stroke-width: 2; }
.chart .value { fill: var(--text-2); font-weight: 600; font-size: 11px; }
.chart .hit:hover + .tip, .chart .hit:hover ~ .tip { opacity: 1; }

.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: var(--brand); transition: stroke-dashoffset .8s var(--ease); }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }

.heat { display: grid; gap: 5px; }
.heat-row { display: grid; grid-template-columns: 76px repeat(var(--cols, 3), minmax(0, 1fr)); gap: 5px; align-items: center; }
.heat-row > .heat-label { font-size: 12.5px; color: var(--text-2); font-weight: 520; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-head > span { font-size: 11.5px; color: var(--faint); text-align: center; font-weight: 550; }
.heat-cell {
  position: relative;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--surface-3);
  transition: transform .12s;
}
.heat-cell:hover { transform: scale(1.06); z-index: 2; box-shadow: var(--shadow-sm); }
/* calm when things are fine, warm when they need a look */
.heat-cell.lv-5 { background: var(--brand-100); color: var(--brand-800); }
.heat-cell.lv-4 { background: color-mix(in srgb, var(--brand-100) 55%, var(--surface-2)); color: var(--brand-800); }
.heat-cell.lv-3 { background: var(--surface-3); color: var(--text-2); }
.heat-cell.lv-2 { background: var(--accent-soft); color: var(--accent-ink); }
.heat-cell.lv-1 { background: var(--bad-soft); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-line); }
.heat-cell.lv-0 { background: var(--surface-3); color: var(--faint); }
.heat-cell.is-pending { background: repeating-linear-gradient(-45deg, var(--surface-2), var(--surface-2) 4px, var(--surface-3) 4px, var(--surface-3) 8px); color: var(--faint); }

/* ==========================================================================
   Dashboard pieces (also reusable elsewhere)
   ========================================================================== */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; vertical-align: 1px; }
.dot-ok { background: #22A15A; }
.dot-warn { background: #E8950C; }
.dot-bad { background: #E0414F; }
.dot-info { background: #3483E6; }
.dot-brand { background: var(--brand-500); }

.key-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.key-list li { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.key-list li b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }

.att-grid { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 26px; align-items: start; margin-top: 6px; }
.att-summary { display: flex; flex-direction: column; align-items: stretch; }
.att-summary .ring { align-self: center; }
.heat-cell { height: 36px; flex-direction: column; gap: 0; line-height: 1.05; }
.heat-cell .hc-label { font-size: 10px; font-weight: 600; opacity: .72; letter-spacing: .01em; }
.heat-cell .hc-value { font-size: 12.5px; font-weight: 650; }
.heat .heat-row { grid-template-columns: var(--label-w, 86px) repeat(var(--cols, 3), minmax(0, 1fr)); }
.cover-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.callout > .text-sm, .callout > .grow { min-width: 0; }

.mini-stats { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.mini-stats > div { padding: 10px 12px; }
.mini-stats > div + div { border-left: 1px solid var(--line-soft); }

.now-box { padding: 14px; border-radius: 13px; background: var(--brand-soft); border: 1px solid var(--brand-100); }
[data-mode="dark"] .now-box { border-color: var(--line); }
.now-title { font-size: 17px; font-weight: 640; letter-spacing: -.02em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-500); box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-500) 50%, transparent); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-500) 45%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.period-track { display: flex; gap: 4px; }
.period-track .pt { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-3); }
.period-track .pt.is-break { flex: .45; background: repeating-linear-gradient(-45deg, var(--surface-3), var(--surface-3) 3px, transparent 3px, transparent 6px); }
.period-track .pt.is-done { background: var(--brand-300); }
.period-track .pt.is-now { background: var(--brand-600); box-shadow: 0 0 0 2px var(--brand-100); }

.hbars { display: grid; gap: 12px; }
.hbar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.hbar-label { font-size: 13px; font-weight: 520; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-value small { font-size: 12px; font-weight: 500; color: var(--muted); }
.hbar + .hbar { margin-top: 10px; }
.hbars .hbar + .hbar { margin-top: 0; }
.meter > .tone-ok { background: #22A15A; }
.meter > .tone-warn { background: #E8950C; }
.meter > .tone-bad { background: #E0414F; }
.meter > .tone-info { background: #3483E6; }
.meter > .tone-brand { background: var(--brand-500); }
.meter > .tone-accent { background: var(--accent); }
.meter > .tone- { background: var(--faint); }

.results-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: center; }
.results-side { display: grid; gap: 18px; padding-left: 22px; border-left: 1px solid var(--line-soft); min-width: 0; }
.topper { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-soft); min-width: 0; overflow: hidden; }
.topper .icon-xs { display: inline; vertical-align: -2px; color: var(--accent); }

.notice-pin { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-soft); flex: none; }
.notice-pin.is-pinned { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

@media (max-width: 720px) {
  .att-grid { grid-template-columns: minmax(0, 1fr); }
  .results-grid { grid-template-columns: minmax(0, 1fr); }
  .results-side { border-left: 0; padding-left: 0; grid-template-columns: 1fr 1fr; }
  .results-side .topper { grid-column: span 2; }
}

/* ==========================================================================
   Profiles (students, staff)
   ========================================================================== */
.profile { overflow: hidden; }
.profile-main { display: flex; align-items: center; gap: 20px; padding: 22px 22px 20px; flex-wrap: wrap; }
.profile-main .avatar-xl { box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line); }
.profile-meta { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.profile-meta > span + span::before { content: "·"; margin: 0 8px; color: var(--faint); }
.profile-stats { border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; background: var(--surface-2); }

.mini-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.mc-head { font-size: 10.5px; font-weight: 600; color: var(--faint); padding-bottom: 2px; }
.mc-day { height: 28px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 520; color: var(--faint); background: transparent; }
.mc-day.mc-P { background: var(--brand-100); color: var(--brand-800); }
.mc-day.mc-L { background: var(--warn-soft); color: var(--warn); }
.mc-day.mc-A { background: var(--bad); color: #fff; }
.mc-day.mc-E { background: var(--info-soft); color: var(--info); }
.mc-day.mc-future { color: var(--line-strong); }
.mc-day.mc-today { box-shadow: 0 0 0 2px var(--text); }

.juz-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 5px; }
.juz-grid span { height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--faint); }
.juz-grid span.is-done { background: var(--brand-600); color: #fff; }
.juz-grid span.is-now { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }

@media (max-width: 1280px) { .att-months { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bento { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.bento > * { grid-column: span 12; }
.bento > .s-3 { grid-column: span 3; }
.bento > .s-4 { grid-column: span 4; }
.bento > .s-5 { grid-column: span 5; }
.bento > .s-6 { grid-column: span 6; }
.bento > .s-7 { grid-column: span 7; }
.bento > .s-8 { grid-column: span 8; }
.bento > .s-9 { grid-column: span 9; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.split-left { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.grow { flex: 1; min-width: 0; }
.none { flex: none; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.p-0 { padding: 0; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-xs { font-size: 12px; } .text-sm { font-size: 13px; } .text-md { font-size: 15px; } .text-lg { font-size: 17px; } .text-xl { font-size: 20px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); } .text-brand { color: var(--brand); } .text-accent { color: var(--accent-ink); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nowrap { white-space: nowrap; }
.upper { text-transform: uppercase; letter-spacing: .06em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.show-mobile { display: none; }

/* ==========================================================================
   Auth screens
   ========================================================================== */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
  background: var(--canvas);
}
.auth-art {
  position: relative;
  margin: 10px 0 10px 10px;
  border-radius: 24px;
  overflow: hidden;
  background: var(--brand-800);
  color: #fff;
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
}
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(400px, 100%); }
.auth-title { font-family: var(--font-display); font-size: 28px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .bento > .s-3 { grid-column: span 6; }
  .bento > .s-4 { grid-column: span 6; }
  .bento > .s-5, .bento > .s-7 { grid-column: span 12; }
  .split { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 1080px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    z-index: 70;
    left: 0;
    top: 0;
    bottom: 0;
    width: 284px;
    background: var(--canvas);
    transform: translateX(-102%);
    transition: transform .25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-scrim { display: block; }
  .nav-scrim { position: fixed; inset: 0; z-index: 65; background: var(--scrim); display: none; }
  .sheet { margin: 0; border-radius: 0; border: 0; height: auto; min-height: 100vh; overflow: visible; box-shadow: none; }
  .topbar .topbar-toggle { display: inline-grid; }
  .split, .split-left { grid-template-columns: minmax(0, 1fr); }
  .bento > .s-6, .bento > .s-8, .bento > .s-9 { grid-column: span 12; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-section { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .page { padding: 12px 16px 48px; }
  .topbar { padding: 0 12px; }
  .page-title { font-size: 23px; }
  .page-head { margin-bottom: 16px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-row > .stat:nth-child(odd) { border-left: 0; }
  .stat-row > .stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .stat-value { font-size: 24px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .bento > [class*="s-"] { grid-column: span 12; }
  .form-grid > [class*="c-"] { grid-column: span 12; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial; }
  .crumbs .crumb-parent, .crumbs .sep { display: none; }
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 88vh; }
  .modal { width: calc(100vw - 16px); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}

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