/* ==========================================================================
   IraqEdu — National Education Platform
   Design system: sage-grey registry canvas, ink rail, ministry-green accent,
   sans headlines at 8px radii, tabular figures for every ledger. English-first
   with full RTL support.
   Zero dependencies. System font stacks only — works fully offline.
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */

:root {
  /* surfaces — warm-neutral paper, a step lighter than the old sage */
  --canvas: #F5F7F3;
  --surface: #FFFFFF;
  --surface-2: #F7F9F5;
  --surface-3: #E9EEE5;
  --sunken: #E9EEE5;

  /* ink */
  --ink: #14201A;
  --ink-2: #45524B;
  --ink-3: #667169;
  --on-dark: #F2F7F2;

  /* lines */
  --line: #DFE5DA;
  --line-2: #E9EDE5;

  /* brand — bright fill colour, never set as text on white */
  --brand: #68E246;
  --brand-ink: #0C4A26;

  /* accent — accessible green for links, buttons and figures */
  --accent: #0F7A46;
  --accent-deep: #0A6440;
  --accent-soft: #E4F7D9;
  --accent-ghost: rgba(18, 134, 79, .08);

  /* hue ramps — 01 is a band/background tint, 03 a chip or cover, ink the text on it */
  --green-01: #EAFADE;
  --green-03: #C4F0A4;
  --green-ink: #0B5B33;
  --blue-01: #E4F0FF;
  --blue-03: #BFD9FF;
  --blue-ink: #1A4FA8;
  --orange-01: #FFF1DE;
  --orange-03: #FFD8A6;
  --orange-ink: #904A0E;
  --pink-01: #FDE8F2;
  --pink-03: #F9C5DE;
  --pink-ink: #96305F;
  --indigo-01: #ECEBFF;
  --indigo-03: #CFCDFB;
  --indigo-ink: #3A38A0;

  /* highlight — clay, reserved for flags that need a second read */
  --highlight: #A9521C;
  --highlight-soft: #F9EBDD;

  /* status */
  --ok: #12864F;
  --ok-soft: #E4F7D9;
  --warn: #8A5A12;
  --warn-soft: #F8F0DD;
  --bad: #A63A2E;
  --bad-soft: #FBE9E6;

  /* module — overridden per role on body[data-role] */
  --module: var(--accent);
  --module-ink: var(--accent-deep);
  --module-tint: var(--green-01);
  --module-tint-2: var(--green-03);

  /* rail */
  --rail: #101A15;
  --rail-2: #17271F;
  --rail-text: #D3DED6;
  --rail-muted: #96A79C;
  --rail-line: rgba(255, 255, 255, .09);

  /* legacy aliases used by inline SVG / older markup */
  --gold: #8A5A12;
  --gold-soft: #F8F0DD;
  --info: #1A4FA8;
  --info-soft: #E4F0FF;
  --muted: #667169;
  --muted-soft: #E9EEE5;

  /* radii — rounder cards, ledger rows still read as records */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  /* elevation — cards now lift off the canvas */
  --shadow-xs: 0 1px 2px rgba(16, 32, 24, .05);
  --shadow-sm: 0 1px 2px rgba(16, 32, 24, .05), 0 8px 20px -16px rgba(16, 32, 24, .30);
  --shadow-md: 0 2px 6px -3px rgba(16, 32, 24, .08), 0 16px 34px -22px rgba(16, 32, 24, .34);
  --shadow-lg: 0 2px 8px -4px rgba(16, 32, 24, .08), 0 28px 52px -30px rgba(16, 32, 24, .38);

  /* spacing */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 40px;
  --s9: 56px;
  --s10: 72px;

  /* type */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, "Noto Sans Arabic", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, "Noto Sans Arabic", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --fs-display: clamp(28px, 2.6vw, 40px);
  --fs-h1: 28px;
  --fs-h2: 20px;
  --fs-h3: 16px;
  --fs-body: 14.5px;
  --fs-small: 12.5px;
  --fs-micro: 11px;
  --lh-tight: 1.15;
  --lh-body: 1.55;

  /* layout */
  --rail-w: 264px;
  --sidebar: 264px;
  --main-max: 1440px;
  --tap: 44px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: 180ms;
}

/* ------------------------------------------------------------------- reset */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-small); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }
img, svg, video { max-width: 100%; }
button { font: inherit; color: inherit; }
button, input, select, textarea { font: inherit; }
input, select, textarea { color: var(--ink); }
strong, b { font-weight: 650; }
small { font-size: var(--fs-small); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
code, kbd, pre, samp { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: fixed;
  inset-block-start: -100px;
  inset-inline-start: var(--s4);
  z-index: 200;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 600;
}
.skip:focus { inset-block-start: var(--s4); color: var(--on-dark); }

.nowrap { white-space: nowrap; }
.with-icon { padding-inline-start: var(--s4); }
.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.text-end { text-align: end; }
.accent { color: var(--accent); }
.danger { color: var(--bad); }
.gold { color: var(--warn); }
.muted { color: var(--ink-3); }
.block { display: block; }
.full { width: 100%; }
.meta { color: var(--ink-2); font-size: var(--fs-small); }
.w40 { width: 40%; }
.w60 { width: 60%; }
.w80 { width: 80%; }
.pad { padding: var(--s5); }
.tight { padding: var(--s3); }
.flush { padding: 0; }
.sep { color: var(--ink-3); flex: none; }
.no-dot { padding-inline-start: 9px; }

/* ------------------------------------------------------------------ layout */

.app,
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--canvas);
}

.stage {
  grid-column: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.main {
  flex: 1;
  width: 100%;
  max-width: calc(var(--main-max) + 64px);
  margin-inline: auto;
  padding: var(--s7) var(--s7) var(--s9);
}

.main-inner {
  display: flex;
  flex-direction: column;
  gap: var(--s6);
  min-width: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  min-width: 0;
}

/* full-height two-column split: content + right rail */
.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--s6);
  align-items: start;
  min-width: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: var(--s6);
  align-items: start;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s5);
  min-width: 0;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s5);
  min-width: 0;
}

/* -------------------------------------------------------------------- rail */

.sidebar,
.rail {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 60;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s5) var(--s4) var(--s4);
  background: var(--rail);
  color: var(--rail-text);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}

.sidebar::-webkit-scrollbar,
.rail::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb,
.rail::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 999px; }

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s1) var(--s2) var(--s3);
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent) 0%, #2E8A72 55%, var(--highlight) 160%);
  color: #fff;
  box-shadow: 0 6px 18px -8px rgba(31, 111, 92, .35);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-name {
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  margin-top: 1px;
  color: var(--rail-muted);
  font-size: var(--fs-micro);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.org-switch {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: var(--tap);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rail-line);
  border-radius: var(--r-sm);
  background: var(--rail-2);
  color: var(--rail-text);
  text-align: start;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.org-switch:hover { background: #14332B; border-color: rgba(255, 255, 255, .12); }
.org-switch > svg { width: 15px; height: 15px; color: var(--rail-muted); flex: none; }

.org-badge {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(31, 111, 92, .24);
  color: #9AD4C1;
}
.org-badge svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.org-text { min-width: 0; flex: 1; }
.org-text strong {
  display: block;
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-text span {
  display: block;
  margin-top: 1px;
  color: var(--rail-muted);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-block: var(--s2);
}

.nav-label {
  margin: var(--s3) var(--s3) var(--s2);
  color: var(--rail-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-block-end: var(--s3);
}

.rail-group > .rail-group-label,
.rail-group-label {
  margin: var(--s2) var(--s3) var(--s2);
  color: var(--rail-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--tap);
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--rail-text);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.nav-item:hover { background: rgba(255, 255, 255, .05); color: #fff; }

.nav-item.is-active {
  background: color-mix(in srgb, var(--brand) 20%, transparent);
  color: #fff;
  font-weight: 600;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  inset-block: 9px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

[dir="rtl"] .nav-item.is-active::before { border-radius: 3px 0 0 3px; }

.nav-icon,
.nav-item > svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .9;
}

.nav-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .08);
  color: var(--rail-text);
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.nav-item.is-active .nav-count { background: rgba(255, 255, 255, .18); color: #fff; }

.pilot {
  margin-block-start: auto;
  padding: var(--s4);
  border: 1px solid var(--rail-line);
  border-radius: var(--r);
  background: linear-gradient(160deg, #132F27 0%, #0C1F19 100%);
}

.pilot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-block-end: var(--s2);
}

.pilot-label {
  color: var(--rail-muted);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: .02em;
}

.pilot-pct {
  color: #fff;
  font-size: var(--fs-h3);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pilot h3 {
  color: var(--rail-text);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.35;
}

.pilot p {
  margin-block: var(--s1) var(--s3);
  color: var(--rail-muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.pilot .meter { background: rgba(255, 255, 255, .1); height: 5px; }
.pilot .meter > span { background: linear-gradient(90deg, #1F6F5C, #4FB393); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--rail-2);
  border: 1px solid var(--rail-line);
  min-width: 0;
}

.user-meta { flex: 1; min-width: 0; }
.user-meta strong {
  display: block;
  color: #fff;
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-meta span {
  display: block;
  margin-top: 1px;
  color: var(--rail-muted);
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--rail-muted);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.logout-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.logout-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: var(--s4);
  min-height: 68px;
  padding: var(--s3) var(--s7);
  background: rgba(242, 244, 240, .86);
  border-block-end: 1px solid var(--line);
  backdrop-filter: saturate(1.15) blur(14px);
  -webkit-backdrop-filter: saturate(1.15) blur(14px);
}

.crumb {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  color: var(--ink-3);
  font-size: var(--fs-small);
  font-weight: 500;
  white-space: nowrap;
}

.crumb > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.crumb strong {
  color: var(--ink);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb .sep { width: 14px; height: 14px; }
.crumb .term { color: var(--ink-3); }

.topbar-tools {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-inline-start: auto;
  min-width: 0;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: var(--tap);
  min-width: 260px;
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-3);
  font-size: var(--fs-small);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-trigger:hover { border-color: #C8D1C6; color: var(--ink-2); }
.search-trigger svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-text { flex: 1; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger kbd {
  flex: none;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
}

.icon-btn {
  position: relative;
  width: var(--tap);
  height: var(--tap);
  min-height: var(--tap);
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .dot {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--highlight);
  box-shadow: 0 0 0 2px var(--canvas);
}

.avatar-btn {
  display: flex;
  align-items: center;
  gap: var(--s2);
  height: var(--tap);
  padding: 0 var(--s2) 0 var(--s1);
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.avatar-btn:hover { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.avatar-btn svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.avatar-btn[aria-expanded="true"] { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
html[dir="rtl"] .avatar-btn { padding: 0 var(--s1) 0 var(--s2); }

.nav-toggle { display: none; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.lang-opt {
  min-height: 34px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-micro);
  font-weight: 650;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.lang-opt:hover { color: var(--ink); background: var(--surface-2); }
.lang-opt.is-on { background: var(--ink); color: var(--on-dark); }

/* mobile bottom navigation */
.tabbar {
  display: none;
  position: sticky;
  inset-block-end: 0;
  z-index: 35;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: var(--s1) var(--s2) calc(var(--s1) + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .95);
  border-block-start: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tap);
  padding: 6px 2px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
}
.tabbar a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.is-active { color: var(--accent); background: var(--accent-soft); }

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(12, 31, 25, .55);
  backdrop-filter: blur(2px);
}

/* ------------------------------------------------------------- page header */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s5);
  flex-wrap: wrap;
  padding-block: var(--s1);
}

.page-head > div:first-child { min-width: 0; }

.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 620;
  letter-spacing: -.02em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

[dir="rtl"] .page-head h1 { letter-spacing: 0; line-height: 1.25; }

.page-sub {
  max-width: 72ch;
  margin-block-start: var(--s2);
  color: var(--ink-2);
  font-size: var(--fs-body);
  line-height: 1.5;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-block-end: var(--s2);
  color: var(--ink-3);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.eyebrow .accent { color: var(--accent); }
.eyebrow.on-dark { color: var(--rail-muted); }

.dot-sep {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  vertical-align: middle;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  min-width: 0;
}

.detail-ico {
  width: 52px;
  height: 52px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}
.detail-ico svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.detail-head > div { min-width: 0; }
.detail-head h1 {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  font-weight: 620;
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-block-start: var(--s2);
}

/* ------------------------------------------------------------------ cards */

.card {
  position: relative;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-xs);
}

.card.pad { padding: var(--s5); }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  padding: var(--s5) var(--s5) 0;
}

.card-head > div { min-width: 0; }
.card-head h2 { font-size: var(--fs-h3); font-weight: 650; letter-spacing: -.01em; }
.card-sub {
  margin-block-start: 3px;
  color: var(--ink-2);
  font-size: var(--fs-small);
  line-height: 1.45;
}

.card-tools {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  flex: none;
}

.card-body {
  padding: var(--s4) var(--s5) var(--s5);
  min-width: 0;
}
.card-body.tight { padding: var(--s3) var(--s2); }
.card-body.flush { padding: 0; }
.card-head + .card-body.flush { padding-block-start: var(--s3); }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s3) var(--s5);
  border-block-start: 1px solid var(--line-2);
  background: var(--surface-2);
  border-end-start-radius: var(--r);
  border-end-end-radius: var(--r);
  color: var(--ink-2);
  font-size: var(--fs-small);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: var(--fs-small);
  font-weight: 650;
  cursor: pointer;
}
.card-link:hover { color: var(--accent-deep); }
.card-link svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(240px, .6fr);
  gap: var(--s7);
  align-items: center;
  padding: var(--s7);
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(31, 111, 92, .38) 0%, rgba(31, 111, 92, 0) 52%),
    radial-gradient(90% 120% at 0% 110%, rgba(240, 103, 43, .22) 0%, rgba(240, 103, 43, 0) 55%),
    var(--rail);
  color: var(--rail-text);
  box-shadow: var(--shadow-md);
}

.hero::after {
  content: "";
  position: absolute;
  inset-block-start: -60%;
  inset-inline-end: -10%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .07);
  pointer-events: none;
}

.hero > div { position: relative; z-index: 1; min-width: 0; }
.hero .eyebrow { color: var(--rail-muted); }
.hero .eyebrow .accent { color: #8FD2BB; }

.hero h2 {
  max-width: 22ch;
  margin-block: var(--s2) var(--s3);
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.3vw, 34px);
  font-weight: 620;
  letter-spacing: -.02em;
  line-height: 1.14;
}

[dir="rtl"] .hero h2 { letter-spacing: 0; line-height: 1.35; }

.hero p {
  max-width: 56ch;
  color: var(--rail-text);
  font-size: var(--fs-body);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-block-start: var(--s5);
}

.hero-panel {
  position: relative;
  z-index: 1;
  padding: var(--s5);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .05);
  backdrop-filter: blur(4px);
}

.hero-panel-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-block-end: var(--s3);
}

.hero-panel-label {
  color: var(--rail-muted);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: .02em;
}

.hero-panel-value {
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(30px, 2.8vw, 40px);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-panel .spark { height: 54px; opacity: .95; }

.hero-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-block-start: var(--s3);
  color: var(--rail-text);
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
}

.hero-legend {
  margin-block-start: var(--s3);
  padding-block-start: var(--s3);
  border-block-start: 1px solid rgba(255, 255, 255, .07);
  color: var(--rail-muted);
  font-size: 10.5px;
}
.hero-legend span { display: inline-flex; align-items: center; gap: 7px; }
.hero-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #D9C79A;
  flex: none;
}

/* greeting banner — light warm hero used on role homes */
.greeting {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s6);
  flex-wrap: wrap;
  padding: var(--s7);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background:
    radial-gradient(100% 160% at 100% 0%, var(--accent-ghost) 0%, rgba(31, 111, 92, 0) 55%),
    radial-gradient(90% 140% at 0% 100%, var(--highlight-soft) 0%, rgba(247, 234, 223, 0) 60%),
    var(--surface);
  box-shadow: var(--shadow-xs);
}

.greeting::after {
  content: "";
  position: absolute;
  inset-block-start: -40%;
  inset-inline-end: -6%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: var(--accent-ghost);
  pointer-events: none;
}

.greeting > div { position: relative; z-index: 1; min-width: 0; }
.greeting h1 {
  max-width: 24ch;
  margin-block: var(--s1) var(--s2);
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 620;
  letter-spacing: -.025em;
  line-height: 1.08;
  overflow-wrap: anywhere;
}
[dir="rtl"] .greeting h1 { letter-spacing: 0; line-height: 1.3; }
.greeting p { max-width: 62ch; color: var(--ink-2); font-size: var(--fs-body); }

.greeting-stats {
  display: flex;
  align-items: stretch;
  gap: var(--s5);
  flex-wrap: wrap;
  margin-block-start: var(--s5);
}
.greeting-stat { min-width: 92px; }
.greeting-stat strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.greeting-stat span {
  display: block;
  margin-block-start: 4px;
  color: var(--ink-3);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.greeting-actions { display: flex; gap: var(--s2); flex-wrap: wrap; position: relative; z-index: 1; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.btn:hover { background: var(--surface-2); border-color: #C8D1C6; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px -10px rgba(31, 111, 92, .8);
}
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }

.btn.soft {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-deep);
  box-shadow: none;
}
.btn.soft:hover { background: #D3E6DD; border-color: transparent; color: var(--accent-deep); }

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
  box-shadow: none;
}
.btn.ghost:hover { background: var(--sunken); color: var(--ink); border-color: transparent; }

.btn.danger {
  border-color: var(--bad-soft);
  background: var(--bad-soft);
  color: var(--bad);
  box-shadow: none;
}
.btn.danger:hover { background: #F7DCD8; border-color: #F7DCD8; color: var(--bad); }

.btn.sm {
  position: relative;
  min-height: 36px;
  padding: 0 var(--s3);
  font-size: var(--fs-small);
  border-radius: 9px;
}
.btn.sm::after { content: ""; position: absolute; inset: -4px; }
.btn.sm svg { width: 14px; height: 14px; }

.btn.lg { min-height: 52px; padding: 0 var(--s6); font-size: var(--fs-body); border-radius: 12px; }
.btn.block { width: 100%; }

.btn-on-dark {
  border-color: #fff;
  background: #fff;
  color: var(--rail);
  box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .6);
}
.btn-on-dark:hover { background: var(--on-dark); border-color: var(--on-dark); color: var(--rail); }

.btn-on-dark-ghost {
  border-color: rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .04);
  color: #fff;
  box-shadow: none;
}
.btn-on-dark-ghost:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .34); color: #fff; }

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 650;
  font-size: var(--fs-small);
  cursor: pointer;
}
.link-btn:hover { color: var(--accent-deep); text-decoration: underline; }

/* ------------------------------------------------- pills, tags, chips, seg */

.pill,
.badge,
.tag,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: var(--fs-micro);
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
  opacity: .9;
}
.pill.no-dot::before { display: none; }

.pill.is-muted, .badge.is-muted { background: var(--sunken); color: var(--ink-2); }
.pill.is-info, .badge.is-info { background: var(--accent-soft); color: var(--accent-deep); }
.pill.is-ok, .badge.is-ok { background: var(--ok-soft); color: var(--ok); }
.pill.is-warn, .badge.is-warn { background: var(--warn-soft); color: var(--warn); }
.pill.is-bad, .badge.is-bad { background: var(--bad-soft); color: var(--bad); }
.pill.is-accent, .badge.is-accent { background: var(--accent-soft); color: var(--accent-deep); }
.pill.is-teal, .badge.is-teal { background: var(--ok-soft); color: var(--ok); }
.pill.is-gold, .badge.is-gold { background: var(--warn-soft); color: var(--warn); }
.pill.is-highlight, .badge.is-highlight { background: var(--highlight-soft); color: #8F4416; }

.tag {
  min-height: 23px;
  padding: 0 8px;
  border-color: var(--line-2);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .01em;
}
.tag.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-deep); }
.tag.warn,
.tag.gold { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.tag.teal { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.tag.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.tag.highlight { background: var(--highlight-soft); border-color: transparent; color: #8F4416; }

.chip {
  min-height: 34px;
  padding: 0 var(--s3);
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 550;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.chip:hover { border-color: #C8D1C6; color: var(--ink); }
.chip.is-on {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-dark);
  font-weight: 650;
}

.chips {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}

.chips-row { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* segmented control */
.segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-2);
}
.segmented > button,
.segmented > a {
  min-height: 34px;
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented > button:hover,
.segmented > a:hover { color: var(--ink); }
.segmented > .is-active,
.segmented > .is-on {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px -8px rgba(31, 111, 92, .9);
}

/* ------------------------------------------------------------------- kpi */

.kpi-grid,
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s5);
  min-width: 0;
}

.kpi-grid.three,
.stat-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.kpi,
.stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--s5);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.kpi:hover, .stat:hover {
  transform: translateY(-2px);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.kpi-top,
.stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  min-width: 0;
}

.kpi-label,
.stat-label {
  color: var(--ink-3);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.35;
}

.kpi-ico,
.tile,
.stat-ico {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.kpi-ico svg,
.tile svg,
.stat-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.kpi-ico.tone-accent, .tile.tone-accent { background: var(--accent-soft); color: var(--accent-deep); }
.kpi-ico.tone-teal, .tile.tone-teal,
.kpi-ico.tone-ok, .tile.tone-ok { background: var(--ok-soft); color: var(--ok); }
.kpi-ico.tone-gold, .tile.tone-gold { background: var(--warn-soft); color: var(--warn); }
.kpi-ico.tone-highlight, .tile.tone-highlight { background: var(--highlight-soft); color: var(--highlight); }
.kpi-ico.tone-bad, .tile.tone-bad { background: var(--bad-soft); color: var(--bad); }
.kpi-ico.tone-en { background: var(--accent-soft); color: var(--accent-deep); }
.kpi-ico.tone-ar { background: var(--highlight-soft); color: #8F4416; }
.kpi-ico.tone-sci { background: var(--ok-soft); color: var(--ok); }

.kpi-value,
.stat-value {
  margin-block-start: var(--s3);
  color: var(--ink);
  font-size: clamp(28px, 2.4vw, 34px);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  overflow-wrap: anywhere;
}
.kpi-value .unit { margin-inline-start: 6px; color: var(--ink-3); font-size: var(--fs-body); font-weight: 500; letter-spacing: 0; }

.kpi-foot,
.stat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-block-start: var(--s2);
  min-width: 0;
}

.kpi-note,
.stat-note {
  color: var(--ink-2);
  font-size: var(--fs-small);
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi .spark,
.stat .spark {
  width: 100%;
  height: 34px;
  margin-block-start: auto;
  padding-block-start: var(--s4);
  display: block;
  overflow: visible;
}

/* KPI cards that open the list behind the figure */
.kpi-link {
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.kpi-link:hover { border-color: #C8D1C6; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kpi-link:active { transform: none; }
.kpi-open {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink-3);
  transition: background-color .16s ease, color .16s ease;
}
.kpi-open svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.kpi-link:hover .kpi-open { background: var(--accent-soft); color: var(--accent-deep); }

/* Province health strip — one row per directorate, flags read before numbers */
.health-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 1px;
  background: var(--line);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.health-cell {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: var(--s4);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: background-color .16s ease;
}
.health-cell:hover { background: var(--surface-2); }
.health-name {
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 550;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.health-value {
  color: var(--ink);
  font-size: 26px;
  font-weight: 640;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.health-value small { font-size: .55em; font-weight: 550; color: var(--ink-3); margin-inline-start: 1px; }
.health-meter { display: block; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.health-meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.health-cell.is-watch .health-meter > i { background: var(--warn); }
.health-cell.is-risk .health-meter > i { background: var(--bad); }
.health-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  color: var(--ink-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.health-line {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.health-flag,
.health-ok {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  white-space: nowrap;
}
.health-flag { color: var(--bad); }
.health-ok { color: var(--ok); }
.health-flag svg,
.health-ok svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.health-cell.is-risk .health-value { color: var(--bad); }

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  min-height: 22px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.delta.is-down, .delta.down, .delta.is-bad { background: var(--bad-soft); color: var(--bad); }
.delta.is-flat, .delta.flat { background: var(--sunken); color: var(--ink-2); }
.delta.is-up, .delta.up { background: var(--ok-soft); color: var(--ok); }

/* ------------------------------------------------------------------ meter */

.meter {
  position: relative;
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--sunken);
  vertical-align: middle;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms var(--ease);
}
.meter > .is-ok { background: var(--ok); }
.meter > .is-soft { background: var(--accent); }
.meter > .is-warn { background: var(--warn); }
.meter > .is-bad { background: var(--bad); }
.meter > .is-accent { background: var(--accent); }
.meter > .is-gold { background: var(--warn); }

.cell-meter {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 110px;
}
.cell-meter .meter { flex: 1; min-width: 54px; }
.cell-meter small {
  flex: none;
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- charts */

.spark { display: block; width: 100%; }

.area-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.area-chart .grid-line { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 4; }
.area-chart .axis { stroke: var(--line); stroke-width: 1; }
.area-chart .series-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.area-chart .series-line.gold { stroke: var(--highlight); }
.area-chart .dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
}
.area-chart .series-area { fill: var(--accent); opacity: .12; }

.chart-x {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-block-start: var(--s2);
  color: var(--ink-3);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.chart-x span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chart-legend {
  display: flex;
  align-items: center;
  gap: var(--s4);
  flex-wrap: wrap;
  color: var(--ink-2);
  font-size: var(--fs-micro);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 3px; background: var(--accent); }

/* donut */
.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s6);
  flex-wrap: wrap;
}

.donut {
  position: relative;
  width: 148px;
  height: 148px;
  flex: none;
}
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 13px; }
.donut .track { stroke: var(--sunken); }
.donut .seg { stroke-linecap: butt; }

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center strong {
  display: block;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.donut-center span {
  display: block;
  margin-block-start: 4px;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.legend { display: flex; flex-direction: column; gap: var(--s2); min-width: 150px; }
.legend-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink-2);
  font-size: var(--fs-small);
}
.legend-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row b { margin-inline-start: auto; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

/* progress ring (svg set by JS) */
.ring {
  position: relative;
  width: 74px;
  height: 74px;
  flex: none;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track, .ring .ring-track { stroke: var(--sunken); }
.ring .val, .ring .ring-fill {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 240ms var(--ease);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* distribution bars */
.dist {
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
  height: 150px;
  padding-block-start: var(--s4);
}
.dist-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s2);
}
.dist-bar {
  width: 100%;
  max-width: 46px;
  min-height: 5px;
  border-radius: 6px 6px 2px 2px;
  background: var(--accent);
  opacity: .82;
  transition: height 240ms var(--ease);
}
.dist-bar.is-warn { background: var(--highlight); }
.dist-bar.is-top { background: var(--ok); }
.dist-count {
  color: var(--ink);
  font-size: var(--fs-micro);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dist-label {
  color: var(--ink-3);
  font-size: 10.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* horizontal subject bars */
.bars { display: flex; flex-direction: column; gap: var(--s3); }
.bar-row {
  display: grid;
  grid-template-columns: minmax(70px, 92px) minmax(0, 1fr) 42px;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}
.bar-label {
  color: var(--ink-2);
  font-size: var(--fs-small);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-value {
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 650;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ calendar strip */

.calendar-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--s2);
}

.day-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 76px;
  padding: var(--s2) 4px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.day-cell:hover { background: var(--surface); border-color: var(--line); }
.day-cell .weekday {
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.day-cell .date {
  font-size: var(--fs-h3);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.day-cell .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.day-cell.is-today {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}
.day-cell.is-today .weekday, .day-cell.is-today .date { color: #fff; }
.day-cell.is-today .dot { background: #fff; }
.day-cell.has-event { border-color: var(--accent-soft); }

/* ----------------------------------------------------------------- tables */

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.table,
.data-table {
  width: 100%;
  min-width: 560px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-small);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.table th,
.data-table th {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  padding: 10px var(--s4);
  border-block-end: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: start;
  white-space: nowrap;
}

.table td,
.data-table td {
  height: 44px;
  padding: 9px var(--s4);
  border-block-end: 1px solid var(--line-2);
  text-align: start;
  vertical-align: middle;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.table tbody tr:last-child td,
.data-table tbody tr:last-child td { border-block-end: 0; }

.table tbody tr,
.data-table tbody tr { transition: background 140ms var(--ease); }
.table tbody tr:hover,
.data-table tbody tr:hover { background: var(--surface-2); }

.table .num,
.data-table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }

.table .row-actions,
.data-table .row-actions { text-align: end; white-space: nowrap; }

.table th.row-actions { text-align: end; }

.cell-strong {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.cell-sub {
  display: block;
  margin-block-start: 2px;
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.35;
}

.table tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* --------------------------------------------------------- lists & feeds */

.list {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.list-row {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 56px;
  padding: var(--s3) var(--s5);
  border-block-end: 1px solid var(--line-2);
  min-width: 0;
  transition: background 140ms var(--ease);
}
.list-row:last-child { border-block-end: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row > svg { width: 17px; height: 17px; flex: none; color: var(--ink-3); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.list-main {
  flex: 1;
  min-width: 0;
}
.list-main strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-main span {
  display: block;
  margin-block-start: 1px;
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-right {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--ink-2);
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
}

.feed {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.feed-item {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s5);
  border-block-end: 1px solid var(--line-2);
  min-width: 0;
}
.feed-item:last-child { border-block-end: 0; }
.feed-item:hover { background: var(--surface-2); }

.feed-dot {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.feed-dot svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.feed-dot.is-ok { background: var(--ok-soft); color: var(--ok); }
.feed-dot.is-warn { background: var(--warn-soft); color: var(--warn); }
.feed-dot.is-bad { background: var(--bad-soft); color: var(--bad); }
.feed-dot.is-accent { background: var(--accent-soft); color: var(--accent-deep); }

.feed-body { flex: 1; min-width: 0; }
.feed-body strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.feed-body p {
  margin-block-start: 2px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.feed-time {
  flex: none;
  color: var(--ink-3);
  font-size: 10.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* who — avatar + two-line identity */
.who {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}
.who > .avatar, .who > .feed-dot { flex: none; }
.who-text { min-width: 0; }
.who-text strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.who-text span {
  display: block;
  margin-block-start: 1px;
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* compact action cards used on teaching homes */
.task {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s4);
  border-block-end: 1px solid var(--line-2);
  min-width: 0;
}
.task:last-child { border-block-end: 0; }
.task-ico {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--highlight-soft);
  color: var(--highlight);
}
.task-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.task-ico.is-done { background: var(--ok-soft); color: var(--ok); }
.task-ico.is-late { background: var(--bad-soft); color: var(--bad); }
.task-body { flex: 1; min-width: 0; }
.task-body h3 { font-size: var(--fs-small); font-weight: 600; overflow-wrap: anywhere; }
.task-body p { margin-block-start: 2px; color: var(--ink-2); font-size: 11.5px; line-height: 1.4; }
.task-meta { margin-block-start: var(--s2); display: flex; gap: var(--s2); flex-wrap: wrap; }
.task-right { flex: none; display: flex; align-items: center; gap: var(--s2); }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}
.quick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s2);
  padding: var(--s4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.quick:hover { background: var(--surface); border-color: var(--line); transform: translateY(-1px); }
.quick-ico {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.quick-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.quick strong { font-size: var(--fs-small); font-weight: 600; }
.quick span { color: var(--ink-2); font-size: 11.5px; line-height: 1.35; }

/* ---------------------------------------------------------------- avatars */

.avatar {
  --av-bg: var(--accent-soft);
  --av-fg: var(--accent-deep);
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--av-bg);
  color: var(--av-fg);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
  user-select: none;
  text-transform: uppercase;
}
.avatar.sm { width: 30px; height: 30px; font-size: 10.5px; }
.avatar.lg { width: 48px; height: 48px; font-size: var(--fs-body); }
.avatar.tone-gold { --av-bg: var(--warn-soft); --av-fg: var(--warn); }
.avatar.tone-ok { --av-bg: var(--ok-soft); --av-fg: var(--ok); }
.avatar.tone-bad { --av-bg: var(--bad-soft); --av-fg: var(--bad); }
.sidebar .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .12); }

/* ------------------------------------------------------------------ forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > label,
.field-label {
  color: var(--ink-2);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.input,
.field input,
.field select,
.field textarea,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-small);
  line-height: 1.4;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
textarea, .field textarea { min-height: 110px; padding: var(--s3); resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover, .input:hover { border-color: #C8D1C6; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ghost);
}
.input::placeholder, .field input::placeholder, textarea::placeholder { color: var(--ink-3); }

.field .hint,
.hint { color: var(--ink-2); font-size: var(--fs-micro); line-height: 1.4; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4);
  min-width: 0;
}
.form-grid .full { grid-column: 1 / -1; }

.form-note {
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: var(--fs-micro);
  line-height: 1.45;
}

.form-error {
  display: none;
  padding: var(--s3);
  border-radius: var(--r-sm);
  background: var(--bad-soft);
  border: 1px solid #F3D4D0;
  color: var(--bad);
  font-size: var(--fs-small);
  font-weight: 550;
}
.form-error.is-on { display: block; }

.search-field {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: var(--tap);
  padding: 0 var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-3);
  min-width: 220px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ghost); }
.search-field svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.search-field input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: var(--fs-small);
}
.search-field input:focus { outline: none; box-shadow: none; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-block-end: 1px solid var(--line-2);
  min-height: var(--tap);
}
.switch-row:last-child { border-block-end: 0; }
.switch-row strong { font-size: var(--fs-small); font-weight: 600; }
.switch-row p { color: var(--ink-2); font-size: 11.5px; }

.checkline {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s2) 0;
}
.checkline > div { min-width: 0; }
.checkline b { display: block; font-size: var(--fs-small); font-weight: 600; }
.checkline span:not(.check-ico) { display: block; color: var(--ink-2); font-size: 11.5px; line-height: 1.4; }
.check-ico {
  width: 24px;
  height: 24px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
}
.check-ico svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.checkline.is-todo .check-ico { background: var(--sunken); color: var(--ink-3); }

/* definition list */
.dl {
  display: grid;
  grid-template-columns: minmax(88px, .7fr) minmax(0, 1.3fr);
  gap: var(--s3) var(--s4);
  margin: 0;
  font-size: var(--fs-small);
}
.dl dt { color: var(--ink-3); font-weight: 550; }
.dl dd { margin: 0; color: var(--ink); font-weight: 550; overflow-wrap: anywhere; }

/* --------------------------------------------------------------- toolbar */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s3) var(--s5);
  border-block-end: 1px solid var(--line-2);
}
.toolbar-count {
  color: var(--ink-2);
  font-size: var(--fs-small);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--sunken);
}
.tab {
  min-height: 34px;
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

/* --------------------------------------------------------------- courses */

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s5);
  min-width: 0;
}

.course-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  min-width: 0;
  padding: var(--s5);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
a.course-card:hover, .course-card:hover {
  transform: translateY(-2px);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.course-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  min-width: 0;
}
.course-top .who { min-width: 0; }

.course-ico {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: 1;
}
.course-ico.tone-ar { background: var(--highlight-soft); color: #8F4416; }
.course-ico.tone-sci { background: var(--ok-soft); color: var(--ok); }
.course-ico.tone-en { background: var(--warn-soft); color: var(--warn); }

.course-card h3 {
  font-size: var(--fs-h3);
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.course-card p {
  margin-block-start: 3px;
  color: var(--ink-2);
  font-size: var(--fs-small);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.course-progress { margin-block-start: auto; }
.course-progress .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-block-end: 6px;
  color: var(--ink-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.course-progress .meta span:last-child { color: var(--ink); font-weight: 650; }

/* exam timetable */
.exam-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) var(--s5);
  border-block-end: 1px solid var(--line-2);
  border-inline-start: 3px solid transparent;
  min-width: 0;
  transition: background 140ms var(--ease);
}
.exam-row:last-child { border-block-end: 0; }
.exam-right {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}
.exam-row:hover { background: var(--surface-2); }
.exam-row.is-upcoming {
  border-inline-start-color: var(--highlight);
  background: linear-gradient(90deg, var(--highlight-soft), rgba(247, 234, 223, 0) 55%);
}
[dir="rtl"] .exam-row.is-upcoming {
  background: linear-gradient(270deg, var(--highlight-soft), rgba(247, 234, 223, 0) 55%);
}

.exam-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 48px;
  min-height: 52px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  line-height: 1;
}
.exam-date .day {
  font-size: var(--fs-h3);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.exam-date .month {
  color: var(--ink-3);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.exam-main { min-width: 0; }
.exam-main strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exam-main span {
  display: block;
  margin-block-start: 2px;
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exam-score {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 92px;
  justify-content: flex-end;
  color: var(--ink-2);
  font-size: var(--fs-micro);
  font-variant-numeric: tabular-nums;
}
.exam-score .meter { width: 62px; }

/* ------------------------------------------------------------ video thumb */

.video-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r);
  background:
    radial-gradient(120% 130% at 12% 10%, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 46%),
    linear-gradient(135deg, #1F6F5C 0%, #14503F 52%, #0A2620 100%);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  isolation: isolate;
}
.video-thumb.is-sci { background: radial-gradient(120% 130% at 12% 10%, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 46%), linear-gradient(135deg, #0E8A70 0%, #0A6352 55%, #0B2C27 100%); }
.video-thumb.is-ar { background: radial-gradient(120% 130% at 12% 10%, rgba(255, 255, 255, .26), rgba(255, 255, 255, 0) 46%), linear-gradient(135deg, #A9521C 0%, #7F3C13 55%, #33160A 100%); }
.video-thumb.is-en { background: radial-gradient(120% 130% at 12% 10%, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 46%), linear-gradient(135deg, #8A5A12 0%, #5F3D0C 55%, #221605 100%); }

.video-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .18) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .45;
  z-index: 0;
}
.video-thumb::after {
  content: "";
  position: absolute;
  inset-block-end: -40%;
  inset-inline-end: -18%;
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  z-index: 0;
}

.video-thumb .play {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--rail);
  box-shadow: 0 8px 24px -10px rgba(0, 0, 0, .45);
  z-index: 2;
}
[dir="rtl"] .video-thumb .play { transform: translate(50%, -50%) rotate(180deg); }
.video-thumb .play svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }

.video-thumb .duration {
  position: absolute;
  inset-block-end: var(--s3);
  inset-inline-end: var(--s3);
  z-index: 2;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(10, 12, 20, .68);
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(4px);
}

.video-thumb .video-label {
  position: absolute;
  inset-block-end: var(--s3);
  inset-inline-start: var(--s3);
  z-index: 2;
  color: rgba(255, 255, 255, .92);
  font-size: var(--fs-micro);
  font-weight: 600;
}

/* legacy lesson player */
.player {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  background:
    radial-gradient(110% 130% at 15% 0%, rgba(31, 111, 92, .5) 0%, rgba(31, 111, 92, 0) 55%),
    var(--rail);
  color: var(--rail-text);
  text-align: center;
}
.player::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .14) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: .4;
}
.player > div { position: relative; z-index: 1; }
.player .play {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--rail);
  margin-inline: auto;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
}
.player .play svg { width: 22px; height: 22px; fill: currentColor; stroke: none; margin-inline-start: 2px; }
.player-label {
  margin-block-start: var(--s3);
  color: var(--rail-text);
  font-size: var(--fs-small);
  font-weight: 600;
  max-width: 46ch;
  margin-inline: auto;
  padding-inline: var(--s4);
}

/* ------------------------------------------------------------- code lab list */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s4);
}
.task-card {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.task-card:hover { border-color: #C8D1C6; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.task-card-top,
.task-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}
.task-lang {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: var(--r-sm);
  padding: 2px 6px;
}
.task-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -.01em;
  color: var(--ink);
}
.task-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-small);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-card-foot { color: var(--ink-3); font-size: 12px; margin-block-start: auto; }
.task-card-foot .card-link { color: var(--accent); }

.criteria-list {
  list-style: none;
  margin: 0;
  padding: var(--s2) var(--s5) var(--s4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.criterion {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: 10px 0;
  border-block-end: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: var(--fs-small);
  line-height: 1.5;
}
.criterion:last-child { border-block-end: 0; }
.criterion-n {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.muted-body {
  margin: 0 0 var(--s4);
  color: var(--ink-2);
  font-size: var(--fs-small);
  line-height: 1.6;
  max-width: 62ch;
}

/* ------------------------------------------------------------- code lab */

.code-lab {
  overflow: hidden;
  border-radius: var(--r);
  background: #0B1F19;
  border: 1px solid #17352C;
  color: #DCE7E1;
}
.code-lab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-block-end: 1px solid rgba(255, 255, 255, .08);
  background: #0F2822;
  color: #A9BBB2;
  font-size: var(--fs-micro);
  font-weight: 650;
}
.code-lab-head .dots { display: inline-flex; gap: 5px; }
.code-lab-head .dots i { width: 8px; height: 8px; border-radius: 50%; background: #2D463D; }
.code-lab-head .dots i:first-child { background: var(--highlight); }
.code-lab-head .dots i:nth-child(2) { background: #D9C79A; }
.code-lab-head .dots i:nth-child(3) { background: #4FB393; }

.code-block {
  margin: 0;
  padding: var(--s4);
  overflow-x: auto;
  background: transparent;
  color: #DCE7E1;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
}
.code-block code { font-family: inherit; }
.code-block .ln {
  display: inline-block;
  width: 2ch;
  margin-inline-end: var(--s4);
  color: #5C7268;
  text-align: end;
  user-select: none;
}
.tok-kw { color: #8FD6BE; }
.tok-str { color: #D9C79A; }
.tok-num { color: #E0A98A; }
.tok-com { color: #6E857A; font-style: italic; }

.code-output {
  padding: var(--s3) var(--s4);
  border-block-start: 1px solid rgba(255, 255, 255, .08);
  background: #122C24;
  color: #A9BBB2;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
}
.code-output strong { color: #7FD1B5; }

.code {
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--accent-deep);
  font-family: var(--font-mono);
  font-size: .9em;
}

.kbd,
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  box-shadow: 0 1px 0 var(--line);
}
.code-lab kbd, .hero kbd {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .06);
  color: #DDE2F0;
  box-shadow: none;
}

/* ------------------------------------------------------------------ prose */

.prose { color: var(--ink-2); font-size: var(--fs-body); line-height: 1.65; max-width: 72ch; }
.prose p + p { margin-block-start: var(--s3); }
.prose strong { color: var(--ink); }
.prose ul, .prose ol { margin-block: var(--s3); padding-inline-start: var(--s5); list-style: disc; }
.prose li + li { margin-block-start: 4px; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }

.callout {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s4);
  border-radius: var(--r-sm);
  border: 1px solid var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: var(--fs-small);
  line-height: 1.5;
}
.callout > svg { width: 18px; height: 18px; flex: none; margin-block-start: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.callout > div { min-width: 0; }
.callout.is-warn { background: var(--warn-soft); border-color: #E7D9BC; color: #7A5113; }
.callout.is-bad { background: var(--bad-soft); border-color: #F3D4D0; color: var(--bad); }

/* ------------------------------------------------------------------ quiz */

.quiz { display: flex; flex-direction: column; gap: var(--s5); }
.quiz-q { color: var(--ink); font-size: var(--fs-small); font-weight: 600; line-height: 1.5; }
.quiz-opts { display: flex; flex-direction: column; gap: var(--s2); margin-block-start: var(--s2); }

.quiz-opt {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--tap);
  width: 100%;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-small);
  text-align: start;
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.quiz-opt:hover { background: var(--surface-2); border-color: #C8D1C6; }
.quiz-opt .opt-letter {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 700;
}
.quiz-opt.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.quiz-opt.is-picked .opt-letter { background: var(--accent); color: #fff; }
.quiz-opt.is-right { border-color: var(--ok); background: var(--ok-soft); }
.quiz-opt.is-right .opt-letter { background: var(--ok); color: #fff; }
.quiz-opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.quiz-opt.is-wrong .opt-letter { background: var(--bad); color: #fff; }

.quiz-result {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4);
  border-radius: var(--r-sm);
  background: var(--ok-soft);
  border: 1px solid #CFE3D9;
}
.quiz-result .score {
  flex: none;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}
.quiz-result strong { display: block; color: var(--ink); font-size: var(--fs-small); }
.quiz-result p { margin-block-start: 2px; }

/* --------------------------------------------------------------- content */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s8) var(--s5);
  text-align: center;
  min-width: 0;
}
.empty-art {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-block-end: var(--s2);
  border-radius: 20px;
  background:
    radial-gradient(120% 120% at 20% 10%, var(--accent-soft), transparent 70%),
    var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--accent);
}
.empty-art svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.empty h3, .empty strong { font-size: var(--fs-h3); font-weight: 650; color: var(--ink); }
.empty p { max-width: 46ch; color: var(--ink-2); font-size: var(--fs-small); line-height: 1.5; }
.empty .btn { margin-block-start: var(--s3); }

/* skeleton */
.sk, .skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--sunken);
}
.sk::after, .skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: shimmer 1.5s infinite;
}
.sk-line { height: 12px; margin-block-end: var(--s2); }
.sk-block { height: 84px; }
.sk-hero { height: 180px; border-radius: var(--r); }
.skeleton-line { height: 12px; margin-block-end: var(--s2); }
.skeleton-block { height: 84px; }
.skeleton-hero { height: 180px; border-radius: var(--r); }

@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ------------------------------------------------------------------ toast */

.toasts {
  position: fixed;
  z-index: 150;
  inset-inline-end: var(--s5);
  inset-block-end: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, .1);
  background: var(--rail);
  color: var(--on-dark);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-small);
  line-height: 1.45;
  pointer-events: auto;
  animation: toast-in 200ms var(--ease) both;
}
.toast svg { width: 16px; height: 16px; flex: none; margin-block-start: 1px; color: #8FE0C9; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast.is-bad { border-color: rgba(194, 56, 47, .5); }
.toast.is-bad svg { color: #FF9F92; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ modal */

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(12, 31, 25, .55);
  backdrop-filter: blur(2px);
}
.overlay.is-open { display: block; }

.modal {
  position: fixed;
  z-index: 140;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s5);
}
.modal.is-open { display: flex; }

.modal-card {
  position: relative;
  z-index: 131;
  width: min(560px, 100%);
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: modal-in 200ms var(--ease) both;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5) var(--s5) 0;
}
.modal-head h2 { font-size: var(--fs-h2); font-weight: 650; letter-spacing: -.02em; }
.modal-head p { margin-block-start: 3px; color: var(--ink-2); font-size: var(--fs-small); }

.modal-close {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  overflow-y: auto;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s2);
  padding: var(--s3) var(--s5);
  border-block-start: 1px solid var(--line-2);
  background: var(--surface-2);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- command K */

.command {
  position: fixed;
  z-index: 145;
  inset-inline: 0;
  inset-block-start: 10vh;
  width: min(620px, calc(100vw - 28px));
  margin-inline: auto;
  display: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(21, 23, 30, .02);
}
.command.is-open { display: block; }

.command-input {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-block-end: 1px solid var(--line);
}
.command-input svg { width: 17px; height: 17px; flex: none; color: var(--ink-3); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.command-input input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: var(--fs-body);
  box-shadow: none;
}
.command-input input:focus { outline: none; box-shadow: none; }

.command-results {
  max-height: min(54vh, 420px);
  overflow-y: auto;
  padding: var(--s2);
}
.command-group-label {
  padding: var(--s2) var(--s2) var(--s1);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.command-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 44px;
  padding: var(--s2) var(--s3);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-small);
  text-align: start;
  cursor: pointer;
}
.command-item:hover, .command-item:focus-visible { background: var(--accent-soft); }
.command-item .avatar { width: 28px; height: 28px; font-size: 10px; }
.command-item .cmd-main { flex: 1; min-width: 0; }
.command-item strong { display: block; font-size: var(--fs-small); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-item span { display: block; color: var(--ink-2); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-item .tag { flex: none; }
.command-empty { padding: var(--s7) var(--s4); text-align: center; color: var(--ink-2); font-size: var(--fs-small); }
.command-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s4);
  padding: var(--s2) var(--s4);
  border-block-start: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 10.5px;
}
.command-foot kbd { font-family: var(--font-ui); font-size: 10px; }

/* ------------------------------------------------------------------- gate */

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  background: var(--canvas);
}

.gate-panel {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s8);
  padding: var(--s9) var(--s8);
  background:
    radial-gradient(110% 120% at 100% 0%, rgba(31, 111, 92, .4) 0%, rgba(31, 111, 92, 0) 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(240, 103, 43, .24) 0%, rgba(240, 103, 43, 0) 55%),
    var(--rail);
  color: var(--rail-text);
}

.gate-brand { display: flex; align-items: center; gap: var(--s3); }
.gate-brand .brand-name { color: #fff; font-size: var(--fs-h3); }
.gate-brand .brand-sub { color: var(--rail-muted); }

.gate-body { position: relative; z-index: 1; max-width: 36ch; }
.gate-body h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 620;
  letter-spacing: -.03em;
  line-height: 1.08;
  color: #fff;
}
[dir="rtl"] .gate-body h1 { letter-spacing: 0; line-height: 1.3; }
.gate-sub { margin-block-start: var(--s4); color: var(--rail-text); font-size: var(--fs-body); line-height: 1.6; }

.gate-stats {
  display: flex;
  gap: var(--s7);
  flex-wrap: wrap;
  margin-block-start: var(--s7);
}
.gate-stat strong {
  display: block;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(26px, 2.6vw, 36px);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.gate-stat span { display: block; margin-block-start: 4px; color: var(--rail-muted); font-size: var(--fs-micro); }

.gate-foot { color: var(--rail-muted); font-size: var(--fs-micro); position: relative; z-index: 1; }
.gate-footnote { color: var(--rail-muted); font-size: var(--fs-micro); margin-block-start: var(--s4); }

.gate-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s8);
}

.gate-form {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.gate-form h2 { font-family: var(--font-display); font-size: var(--fs-h1); font-weight: 620; letter-spacing: -.02em; }
.gate-form > p { color: var(--ink-2); font-size: var(--fs-small); line-height: 1.5; }
.gate-form form { display: flex; flex-direction: column; gap: var(--s4); }
.demo-accounts > p { color: var(--ink-2); font-size: var(--fs-small); font-weight: 600; }
.demo-accounts { margin-block-start: var(--s2); }

.demo-btn {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 52px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  text-align: start;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.demo-btn:hover { border-color: var(--accent); background: var(--surface); transform: translateY(-1px); }
.demo-btn.is-on { border-color: var(--accent); background: var(--accent-soft); }
.demo-btn svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.demo-btn span {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: var(--fs-small);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-btn strong { display: block; font-size: var(--fs-small); font-weight: 600; }
.demo-btn small { display: block; color: var(--ink-2); font-size: 11px; }

.demo-list { display: flex; flex-direction: column; gap: var(--s2); }
.demo-accounts { display: flex; flex-direction: column; gap: var(--s2); }

.gate-accounts-note { color: var(--ink-3); font-size: 10px; }

/* flex helpers used by auth */
.gate-form .btn.block { margin-block-start: var(--s1); }

/* ---------------------------------------------------------------- scrollbar */

* { scrollbar-width: thin; scrollbar-color: #C8D1C6 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #C8D1C6; border-radius: 999px; border: 3px solid var(--canvas); }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------- motion */

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

/* ------------------------------------------------------------- responsive */

@media (max-width: 1240px) {
  :root { --rail-w: 244px; --sidebar: 244px; }
  .main { padding: var(--s6) var(--s6) var(--s8); }
  .grid-main { grid-template-columns: minmax(0, 1fr) 320px; }
  .kpi-grid, .stat-grid { gap: var(--s4); }
}

@media (max-width: 1024px) {
  .app, .shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar, .rail {
    inset-block: 0;
    width: min(300px, 84vw);
    transform: translateX(-104%);
    transition: transform 220ms var(--ease);
    box-shadow: var(--shadow-md);
  }
  [dir="rtl"] .sidebar, [dir="rtl"] .rail { transform: translateX(104%); }

  .sidebar.is-open, .rail.is-open { transform: translateX(0); }
  [dir="rtl"] .sidebar.is-open, [dir="rtl"] .rail.is-open { transform: translateX(0); }

  .scrim.is-open { display: block; }

  .stage { grid-column: 1; }
  .main { padding: var(--s5) var(--s5) var(--s8); }

  .nav-toggle { display: grid; }

  .tabbar { display: grid; }
  .tabbar {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 45;
  }
  .main { padding-block-end: 88px; }
  .toasts { inset-block-end: 84px; }

  .topbar { min-height: 62px; padding: var(--s2) var(--s5); }

  .grid-main,
  .split { grid-template-columns: minmax(0, 1fr); }

  .kpi-grid, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid.three, .stat-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .main-inner { gap: var(--s5); }
  .search-trigger { min-width: 0; width: var(--tap); padding: 0; justify-content: center; }
  .search-trigger .search-text, .search-trigger kbd { display: none; }
  .sidebar .lang-switch { display: none; }
  .signin-top .lang-switch { margin-inline-start: auto; }

  .gate { grid-template-columns: minmax(0, 1fr); }
  .gate-panel { display: none; }
  .gate-form-wrap { min-height: 100vh; min-height: 100dvh; padding: var(--s6); }
}

@media (max-width: 720px) {
  .kpi-grid, .stat-grid,
  .kpi-grid.three, .stat-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }

  .hero { grid-template-columns: minmax(0, 1fr); padding: var(--s5); gap: var(--s5); }
  .hero h2 { max-width: none; }
  .hero-panel { max-width: none; }

  .greeting { padding: var(--s5); }
  .greeting h1 { max-width: none; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }

  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }

  .main-inner { gap: var(--s4); }
}

@media (max-width: 640px) {
  .topbar { gap: var(--s2); padding-inline: var(--s4); }
  .crumb .term, .crumb .sep { display: none; }
  .crumb > span:first-child { display: none; }
  .topbar-tools { gap: 2px; }

  .main { padding: var(--s4) var(--s4) 88px; }

  .kpi-grid, .stat-grid,
  .kpi-grid.three, .stat-grid.three { grid-template-columns: minmax(0, 1fr); }

  .card-head { padding: var(--s4) var(--s4) 0; }
  .card-body { padding: var(--s3) var(--s4) var(--s4); }
  .card-foot { padding: var(--s3) var(--s4); }
  .toolbar { padding: var(--s3) var(--s4); }
  .list-row, .feed-item { padding-inline: var(--s4); }

  .exam-row { grid-template-columns: 44px minmax(0, 1fr); padding-inline: var(--s4); row-gap: 6px; }
  .exam-right { grid-column: 2; justify-content: flex-start; flex-wrap: wrap; gap: var(--s2); }
  .exam-row .exam-meta { font-size: 11.5px; }

  .calendar-strip { gap: 4px; }
  .day-cell { min-height: 64px; border-radius: 10px; }
  .day-cell .weekday { font-size: 9px; letter-spacing: 0; }
  .day-cell .date { font-size: var(--fs-small); }

  .modal { align-items: flex-end; padding: 0; }
  .modal-card {
    width: 100%;
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-block-end: 0;
  }

  .modal-foot {
    padding-block-end: max(var(--s3), env(safe-area-inset-bottom));
  }

  .command { inset-block-start: 6vh; }

  .toasts { inset-inline: var(--s3); inset-block-end: 84px; max-width: none; }
  .toast { width: 100%; }

  .dl { grid-template-columns: minmax(72px, auto) minmax(0, 1fr); gap: var(--s2) var(--s3); }
  .dl dt { font-size: var(--fs-micro); letter-spacing: .02em; }

  .bar-row { grid-template-columns: minmax(64px, 84px) minmax(0, 1fr) 34px; gap: var(--s2); }
}

@media (max-width: 400px) {
  .main { padding-inline: var(--s3); }
  .page-head h1 { font-size: 24px; }
  .greeting, .hero { padding: var(--s4); }
  .greeting h1 { font-size: 28px; }
  .search-trigger { display: none; }
  .course-grid { grid-template-columns: minmax(0, 1fr); }
  .tabbar > a { font-size: 10px; padding-inline: 2px; }
  .tabbar > a svg { width: 18px; height: 18px; }
  .health-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-cell { padding: var(--s3); }
  .health-value { font-size: 22px; }
  .task-grid { grid-template-columns: minmax(0, 1fr); }
  .task-card { padding: var(--s4); }
}

/* ------------------------------------------------------------------- RTL */

[dir="rtl"] .sep,
[dir="rtl"] .flip { transform: scaleX(-1); }

/* Icons that imply reading direction should mirror in Arabic. */
[dir="rtl"] .btn svg,
[dir="rtl"] .card-link svg,
[dir="rtl"] .nav-item svg {
  transform: none;
}

[dir="rtl"] .crumb { flex-direction: row; }
[dir="rtl"] input[type="tel"],
[dir="rtl"] input[data-ltr] { direction: ltr; }

html[lang="ar"] .eyebrow { letter-spacing: 0; }
html[lang="ar"] .kpi-value,
html[lang="ar"] .stat-value,
html[lang="ar"] .bar-value { letter-spacing: 0; }
html[lang="ar"] .brand-name { letter-spacing: 0; }
html[lang="ar"] .hero h2,
html[lang="ar"] .page-head h1,
html[lang="ar"] .greeting h1,
html[lang="ar"] .gate-body h1 { letter-spacing: 0; }

/* --------------------------------------------------------------- projector */

@media print {
  html, body { background: #fff; }
  .sidebar, .rail, .topbar, .tabbar, .scrim, .toasts, .command, .modal, .overlay { display: none !important; }
  .app, .shell { display: block; }
  .main { max-width: none; padding: 0; }
  .card, .kpi, .stat, .course-card { box-shadow: none; break-inside: avoid; }
  .hero { break-inside: avoid; }
}

/* ==========================================================================
   Courses, syllabus and guardian progress report
   Extends the registry desk: one subject-tinted cover per course, rows that
   read as records, and a report sheet a guardian can scan in two minutes.
   ========================================================================== */

.section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  margin: var(--s6) 0 var(--s3);
}
.section-label h2 { font-size: var(--fs-h2); letter-spacing: -.01em; }
.section-label .cell-sub { color: var(--ink-3); font-size: var(--fs-small); }

.stack-sm { display: flex; flex-direction: column; gap: var(--s3); }

.course-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s6);
}

/* ---- course hero ------------------------------------------------------- */

.course-hero {
  --cover-a: #1F6F5C;
  --cover-b: #0C1F19;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s5);
  align-items: center;
  padding: var(--s6) var(--s6) var(--s5);
  border-radius: var(--r-xl);
  overflow: hidden;
  color: var(--on-dark);
  background:
    radial-gradient(120% 140% at 88% 8%, rgba(255, 255, 255, .16), transparent 58%),
    linear-gradient(146deg, var(--cover-a), var(--cover-b));
  box-shadow: var(--shadow-md);
}
.course-hero[data-tone="sci"] { --cover-a: #2C6A82; --cover-b: #0E2B36; }
.course-hero[data-tone="ar"] { --cover-a: #A75A24; --cover-b: #4A2410; }
.course-hero[data-tone="en"] { --cover-a: #4F5F94; --cover-b: #1B2247; }
.course-hero[data-tone="isl"] { --cover-a: #5F6B3A; --cover-b: #232A12; }
.course-hero[data-tone="cs"] { --cover-a: #35608C; --cover-b: #11203A; }
.course-hero[data-tone="soc"] { --cover-a: #7C4A6C; --cover-b: #33172B; }

.course-hero-art {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.course-hero-glyph {
  position: absolute;
  inset-inline-end: 18%;
  top: 50%;
  transform: translateY(-50%);
  font-size: 240px;
  line-height: 1;
  font-weight: 640;
  color: rgba(255, 255, 255, .07);
  letter-spacing: -.04em;
}
.course-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(100deg, transparent 30%, #000 85%);
}
.course-hero-body { position: relative; z-index: 1; min-width: 0; }
.course-hero-body h2 {
  margin: var(--s2) 0 var(--s2);
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.16;
  letter-spacing: -.02em;
  color: #FFFFFF;
}
.eyebrow.light { color: rgba(237, 242, 238, .72); }
.course-hero-sub { margin: 0 0 var(--s4); color: rgba(237, 242, 238, .78); font-size: var(--fs-small); }
.course-hero-sub .dot-sep { background: rgba(255, 255, 255, .3); }
.course-hero-lesson {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin: 0 0 var(--s5);
  padding: 8px 14px 8px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .12);
  font-size: var(--fs-small);
  color: #FFFFFF;
  max-width: 100%;
}
.course-hero-lesson span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-hero-lesson svg { width: 15px; height: 15px; flex: none; }
.course-hero-foot { display: flex; flex-wrap: wrap; gap: var(--s2); }
.course-hero .btn.primary { background: #FFFFFF; color: #0C1F19; border-color: #FFFFFF; }
.course-hero .btn.primary:hover { background: #EAF0EB; }
.course-hero .btn.ghost { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #FFFFFF; }
.course-hero .btn.ghost:hover { background: rgba(255, 255, 255, .18); }

.course-hero-ring { position: relative; z-index: 1; display: grid; justify-items: center; gap: var(--s2); }
.hero-ring { position: relative; width: 104px; height: 104px; }
.hero-ring svg { width: 104px; height: 104px; display: block; }
.hero-ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.hero-ring-center strong { font-size: 24px; font-weight: 640; letter-spacing: -.02em; color: #fff; font-variant-numeric: tabular-nums; }
.hero-ring-center span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .7); }
.course-hero-count { margin: 0; font-size: var(--fs-micro); color: rgba(237, 242, 238, .72); }

/* ---- course tiles ------------------------------------------------------ */

.course-tile {
  --cover-a: #1F6F5C;
  --cover-b: #14352B;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-width: 0;
  transition: transform 160ms ease-out, box-shadow 160ms ease-out, border-color 160ms ease-out;
}
.course-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #C8D1C6; }
.course-tile[data-tone="sci"] { --cover-a: #2C6A82; --cover-b: #12303B; }
.course-tile[data-tone="ar"] { --cover-a: #A75A24; --cover-b: #4A2410; }
.course-tile[data-tone="en"] { --cover-a: #4F5F94; --cover-b: #1B2247; }
.course-tile[data-tone="isl"] { --cover-a: #5F6B3A; --cover-b: #232A12; }
.course-tile[data-tone="cs"] { --cover-a: #35608C; --cover-b: #11203A; }
.course-tile[data-tone="soc"] { --cover-a: #7C4A6C; --cover-b: #33172B; }

.course-tile-cover {
  position: relative;
  height: 82px;
  padding: var(--s4);
  display: flex;
  align-items: center;
  background:
    radial-gradient(90% 160% at 82% -10%, rgba(255, 255, 255, .2), transparent 60%),
    linear-gradient(140deg, var(--cover-a), var(--cover-b));
  overflow: hidden;
}
.course-tile-glyph {
  font-size: 46px;
  font-weight: 640;
  line-height: 1;
  color: rgba(255, 255, 255, .92);
  letter-spacing: -.03em;
}
.course-tile-subject {
  position: absolute;
  inset-inline-start: 78px;
  bottom: var(--s4);
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255, 255, 255, .78);
}
.course-tile-done {
  position: absolute;
  inset-inline-end: var(--s3);
  top: var(--s3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .92);
  color: #14503F;
  font-size: var(--fs-micro);
  font-weight: 600;
}
.course-tile-done svg { width: 12px; height: 12px; }
.course-tile-body { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); flex: 1; }
.course-tile-body h3 { margin: 0; font-size: 15.5px; line-height: 1.3; letter-spacing: -.01em; }
.course-tile-meta { margin: 0; font-size: var(--fs-micro); color: var(--ink-3); line-height: 1.5; }
.course-tile-progress { margin-top: auto; }
.course-tile-progress .meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-micro);
  color: var(--ink-3);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.course-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding-top: var(--s2);
  border-top: 1px solid var(--line-2);
  margin-top: var(--s1);
}
.course-tile-quiz { font-size: var(--fs-micro); color: var(--ink-3); }
.course-tile-quiz b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- syllabus ---------------------------------------------------------- */

.units { display: flex; flex-direction: column; gap: var(--s2); }
.unit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.unit + .unit { margin-top: 0; }
.unit-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4);
  cursor: pointer;
  list-style: none;
  transition: background 140ms ease-out;
}
.unit-head::-webkit-details-marker { display: none; }
.unit-head:hover { background: var(--surface-2); }
.unit-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-lg); }
.unit-no {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: var(--fs-small);
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}
.unit-title h3 { margin: 0; font-size: var(--fs-body); letter-spacing: -.005em; }
.unit-title p { margin: 3px 0 0; font-size: var(--fs-micro); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.unit-bar .meter { height: 5px; }
.unit-chev { color: var(--ink-3); display: grid; place-items: center; transition: transform 180ms ease-out; }
.unit[open] .unit-chev { transform: rotate(180deg); }
.unit-body { padding: 0 var(--s4) var(--s4); border-top: 1px solid var(--line-2); }
.unit-outcomes {
  list-style: none;
  margin: var(--s3) 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.unit-outcomes li {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  font-size: var(--fs-small);
  color: var(--ink-2);
  line-height: 1.5;
}
.unit-outcomes svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--accent); }

.lesson-list { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s2); }
.lesson-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  padding: 10px var(--s2);
  border: 0;
  border-radius: var(--r);
  background: transparent;
  text-align: start;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 120ms ease-out;
}
.lesson-row:hover { background: var(--surface-2); }
.lesson-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lesson-state {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: var(--fs-micro);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.lesson-row.is-done .lesson-state { background: var(--accent); border-color: var(--accent); color: #fff; }
.lesson-state svg { width: 14px; height: 14px; }
.lesson-main { display: grid; gap: 2px; min-width: 0; }
.lesson-main strong {
  font-size: var(--fs-small);
  font-weight: 560;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lesson-main > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-micro);
  color: var(--ink-3);
  min-width: 0;
}
.lesson-main > span svg { width: 12px; height: 12px; }
.lesson-go { color: #A9B4AC; display: grid; place-items: center; }
.lesson-go svg { width: 14px; height: 14px; }

.quiz-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-micro);
  font-weight: 580;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.quiz-chip svg { width: 11px; height: 11px; }
.quiz-chip.is-good { background: var(--ok-soft); color: var(--accent-deep); }
.quiz-chip.is-mid { background: var(--warn-soft); color: var(--warn); }
.quiz-chip.is-low { background: var(--bad-soft); color: var(--bad); }
.quiz-chip.is-empty { background: var(--surface-3); color: var(--ink-3); font-weight: 500; }

/* ---- guardian report --------------------------------------------------- */

.child-switch { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s5); }

.report-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto auto;
  align-items: center;
  gap: var(--s6);
  padding: var(--s5) var(--s6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s5);
}
.report-who { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.report-who h2 { margin: 0 0 4px; font-size: var(--fs-h2); letter-spacing: -.015em; }
.report-who p { margin: 0; font-size: var(--fs-small); color: var(--ink-2); }
.report-who .cell-sub { color: var(--ink-3); font-size: var(--fs-micro); margin-top: 3px; }
.report-score {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding-inline: var(--s5);
  border-inline: 1px solid var(--line-2);
}
.report-score strong {
  font-size: 42px;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.report-score > div { display: grid; gap: 4px; justify-items: start; }
.report-score > div > span { font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.report-stats { display: grid; grid-template-columns: repeat(2, minmax(110px, 1fr)); gap: var(--s3) var(--s5); }
.report-stat { display: grid; gap: 2px; }
.report-stat span { font-size: var(--fs-micro); color: var(--ink-3); }
.report-stat b { font-size: 18px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }

.mini-meter { display: flex; align-items: center; gap: var(--s2); min-width: 120px; }
.mini-meter .meter { flex: 1; height: 5px; }
.mini-meter span { font-size: var(--fs-micro); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.att-bars {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  align-items: end;
  gap: var(--s2);
  height: 132px;
  padding-top: var(--s3);
  border-bottom: 1px solid var(--line);
}
.wk { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.wk-bar {
  width: 100%;
  max-width: 26px;
  border-radius: 4px 4px 2px 2px;
  background: var(--accent);
  opacity: .9;
  transition: height 300ms ease-out;
}
.wk-bar.is-good { background: #2C7A65; }
.wk-bar.is-mid { background: #B98A3E; }
.wk-bar.is-low { background: #B5564A; }
.wk-lbl { font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.att-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin-top: var(--s3);
  font-size: var(--fs-micro);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.remark {
  padding: var(--s3) var(--s4);
  background: var(--surface-2);
  border-radius: var(--r);
  border-inline-start: 2px solid var(--accent-soft);
}
.remark-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: 6px; }
.remark-dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  flex: none;
}
.remark-dot svg { width: 13px; height: 13px; }
.remark-head strong { display: block; font-size: var(--fs-small); }
.remark-head span { display: block; font-size: var(--fs-micro); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.remark p { margin: 0; font-size: var(--fs-small); color: var(--ink-2); line-height: 1.55; }

.checkline { display: flex; gap: var(--s3); align-items: flex-start; }
.check-ico {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--accent-ghost);
  color: var(--accent-deep);
  flex: none;
}
.check-ico svg { width: 14px; height: 14px; }
.checkline b { display: block; font-size: var(--fs-small); margin-bottom: 2px; }
.checkline span:not(.check-ico) { display: block; font-size: var(--fs-mini, 12px); color: var(--ink-3); line-height: 1.5; }

@media (max-width: 1100px) {
  .course-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-hero { grid-template-columns: minmax(0, 1fr) auto; }
  .report-stats { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .course-hero { grid-template-columns: minmax(0, 1fr); padding: var(--s5); }
  .course-hero-ring { display: none; }
  .course-hero-glyph { font-size: 180px; inset-inline-end: -6%; }
  .course-hero-foot .btn { flex: 1 1 auto; justify-content: center; }
  .unit-head { grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); }
  .unit-bar { display: none; }
  .lesson-row { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .lesson-go { display: none; }
  .lesson-main strong { white-space: normal; }
  .report-hero { grid-template-columns: minmax(0, 1fr); padding: var(--s4); gap: var(--s4); }
  .report-score { border-inline: 0; border-block: 1px solid var(--line-2); padding: var(--s3) 0; }
  .report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .att-bars { grid-template-columns: repeat(9, minmax(0, 1fr)); height: 108px; }
  .section-label { margin-top: var(--s5); }
}
@media (max-width: 400px) {
  .course-stats { grid-template-columns: minmax(0, 1fr); }
  .quiz-chip { font-size: 10px; padding: 2px 6px; }
}

/* ==========================================================================
   Module layer — every role gets its own hue so the five logins read as
   five surfaces of one platform, not five copies of the same page.
   ========================================================================== */

body[data-role="ministry"] {
  --module: var(--accent);
  --module-ink: var(--green-ink);
  --module-tint: var(--green-01);
  --module-tint-2: var(--green-03);
}
body[data-role="school"] {
  --module: var(--blue-ink);
  --module-ink: var(--blue-ink);
  --module-tint: var(--blue-01);
  --module-tint-2: var(--blue-03);
}
body[data-role="teacher"] {
  --module: var(--orange-ink);
  --module-ink: var(--orange-ink);
  --module-tint: var(--orange-01);
  --module-tint-2: var(--orange-03);
}
body[data-role="parent"] {
  --module: var(--pink-ink);
  --module-ink: var(--pink-ink);
  --module-tint: var(--pink-01);
  --module-tint-2: var(--pink-03);
}
body[data-role="student"] {
  --module: var(--indigo-ink);
  --module-ink: var(--indigo-ink);
  --module-tint: var(--indigo-01);
  --module-tint-2: var(--indigo-03);
}

/* ------------------------------------------------------------------- hero */

.page-head {
  position: relative;
  align-items: flex-end;
  padding: var(--s6) var(--s7);
  border: 1px solid color-mix(in srgb, var(--module-tint-2) 55%, transparent);
  border-radius: var(--r-xl);
  background:
    radial-gradient(110% 160% at 100% 0%, var(--module-tint-2) 0%, transparent 62%),
    var(--module-tint);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.page-head::after {
  content: "";
  position: absolute;
  inset-block-end: -96px;
  inset-inline-end: -56px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--module-tint-2) 0%, transparent 68%);
  opacity: .5;
  pointer-events: none;
}

.page-head > * {
  position: relative;
  z-index: 1;
  align-self: flex-end;
}

.page-head .eyebrow { color: var(--module-ink); }
.page-head .eyebrow .accent {
  color: inherit;
  font-weight: 700;
}
.page-head .eyebrow .dot-sep { background: color-mix(in srgb, var(--module-ink) 40%, transparent); }
.page-head .page-sub { color: var(--ink-2); }
.page-head .card-link,
.page-head .link-more { color: var(--module-ink); }

.page-head .btn:not(.primary) {
  background: rgba(255, 255, 255, .78);
  border-color: color-mix(in srgb, var(--module-ink) 18%, transparent);
}
.page-head .btn:not(.primary):hover {
  background: #fff;
  border-color: color-mix(in srgb, var(--module-ink) 32%, transparent);
}
.page-head .btn.primary,
.page-head .btn.primary:hover {
  background: var(--module-ink);
  border-color: var(--module-ink);
  color: #fff;
}

/* rail active state picks up the module hue */
[data-role="teacher"] .rail,
[data-role="parent"] .rail,
[data-role="student"] .rail,
[data-role="school"] .rail { background: var(--rail); }

/* ----------------------------------------------------------- nav subtext */

.nav-desc {
  display: none;
  margin-block-start: 2px;
  color: var(--rail-muted);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  text-wrap: pretty;
}

.nav-item.is-active {
  flex-wrap: wrap;
}

.nav-item.is-active .nav-desc { display: block; }
.nav-item.is-active .nav-desc { flex-basis: 100%; }

/* --------------------------------------------------- header action pair */

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: none;
}

.topbar-actions .btn {
  min-height: 34px;
  padding: 0 var(--s3);
  font-size: 12.5px;
  font-weight: 600;
  gap: 6px;
}

.topbar-actions .btn svg { width: 14px; height: 14px; }

.topbar-actions .btn.primary {
  background: var(--module-ink);
  border-color: var(--module-ink);
  color: #fff;
}
.topbar-actions .btn.primary:hover {
  background: color-mix(in srgb, var(--module-ink) 86%, #000);
  border-color: color-mix(in srgb, var(--module-ink) 86%, #000);
}

/* ------------------------------------------- palette corrections in place */

.topbar { background: rgba(245, 247, 243, .88); }

.brand-mark {
  background: linear-gradient(150deg, var(--brand) 0%, #2FB86A 64%, var(--accent) 165%);
  color: var(--brand-ink);
  box-shadow: 0 8px 20px -10px rgba(18, 134, 79, .45);
}

.search-trigger:hover { border-color: color-mix(in srgb, var(--module-tint-2) 70%, var(--line)); }
.btn.soft:hover { background: #D2F0BC; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

@media (max-width: 1180px) {
  .topbar-actions .btn.secondary-action { display: none; }
}

@media (max-width: 900px) {
  .topbar-actions { display: none; }
}

@media (max-width: 760px) {
  .page-head {
    padding: var(--s5);
    border-radius: var(--r-lg);
  }
  .page-head::after { display: none; }
  .page-head h1 { font-size: clamp(22px, 6vw, 28px); }
}

/* ------------------------------------- palette cleanup: teal hard-codes */

.org-badge {
  background: color-mix(in srgb, var(--brand) 22%, transparent);
  color: #B9F0A0;
}

.pilot .meter > span { background: linear-gradient(90deg, var(--accent), var(--brand)); }

.video-thumb {
  background:
    radial-gradient(120% 130% at 12% 10%, rgba(255, 255, 255, .28) 0%, rgba(255, 255, 255, 0) 46%),
    linear-gradient(135deg, #17724A 0%, var(--accent-deep) 52%, #06231A 100%);
}

.player {
  background:
    radial-gradient(110% 130% at 15% 0%, color-mix(in srgb, var(--accent) 50%, transparent) 0%, transparent 55%),
    var(--rail);
}

.gate-panel {
  background:
    radial-gradient(110% 120% at 100% 0%, color-mix(in srgb, var(--brand) 26%, transparent) 0%, transparent 55%),
    radial-gradient(90% 120% at 0% 100%, rgba(240, 103, 43, .24) 0%, rgba(240, 103, 43, 0) 55%),
    var(--rail);
}

.course-hero { --cover-a: #17724A; --cover-b: #06231A; }
.course-tile { --cover-a: #17724A; --cover-b: #10352A; }
.course-tile-done { color: var(--green-ink); }

@media (max-width: 900px) {
  .page-head { align-items: flex-start; }
}

/* ------------------------------------------- headline figure inside a hero */

.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: none;
  align-self: flex-end;
  padding-inline-start: var(--s5);
  border-inline-start: 2px solid color-mix(in srgb, var(--module-ink) 24%, transparent);
}

.hero-figure {
  color: var(--module-ink);
  font-size: clamp(38px, 5vw, 56px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.hero-label {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.hero-note {
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
  .hero-stat {
    align-self: stretch;
    padding-inline-start: 0;
    padding-block-start: var(--s3);
    border-inline-start: 0;
    border-block-start: 1px solid color-mix(in srgb, var(--module-ink) 20%, transparent);
  }
  .hero-figure { font-size: 34px; }
}

/* ==========================================================================
   Sign-in — split stage with a photo, a role-tinted demo switcher.
   Replaces the old centred gate; keeps #form-login and the demo hooks.
   ========================================================================== */

.signin {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--canvas);
}

/* ---- stage */
.signin-stage {
  position: relative;
  isolation: isolate;
  display: flex;
  overflow: hidden;
  background: #0B1A12;
}
.signin-stage-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.signin-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 26, 16, .86) 0%, rgba(8, 26, 16, .62) 38%, rgba(8, 26, 16, .92) 100%),
    linear-gradient(90deg, rgba(8, 26, 16, .55), transparent 70%);
}
.signin-stage-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  width: 100%;
  padding: clamp(24px, 3.4vw, 48px);
  color: #EAF3E7;
}

.signin-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  align-self: flex-start;
}
.signin-brand:hover { color: #fff; }
.signin-brand .brand-mark { background: rgba(255, 255, 255, .12); color: var(--brand); border-color: rgba(255, 255, 255, .22); }
.signin-brand span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.signin-brand strong { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.signin-brand small { font-size: 11.5px; color: #9FB79B; }

.signin-story { margin-top: auto; max-width: 34ch; }
.signin-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 560;
  letter-spacing: .02em;
  color: #C6DCC2;
  padding: 6px 12px 6px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
}
.signin-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(104, 226, 70, .18);
}
.signin-story h1 {
  margin: 18px 0 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.1vw, 44px);
  font-weight: 690;
  letter-spacing: -.035em;
  line-height: 1.05;
  color: #fff;
  text-wrap: balance;
}
.signin-lead {
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.6;
  color: #B9CDB5;
  max-width: 44ch;
}
.signin-facts {
  display: flex;
  gap: 32px;
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, .16);
}
.signin-facts div { display: flex; flex-direction: column; }
.signin-facts dd {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 28px);
  font-weight: 700;
  letter-spacing: -.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.signin-facts dd span { font-size: .62em; color: var(--brand); }
.signin-facts dt { font-size: 11.5px; color: #9FB79B; letter-spacing: .01em; }

.signin-stage-note { font-size: 11.5px; color: #8CA489; }

/* ---- panel */
.signin-panel {
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 56px) clamp(20px, 4vw, 48px);
  background: var(--surface);
}
.signin-card { width: 100%; max-width: 430px; }

.signin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 26px;
}
.signin-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 560;
  color: var(--ink-3);
  padding: 6px 10px 6px 6px;
  border-radius: var(--r-sm);
  margin-inline-start: -6px;
}
.signin-back svg { width: 16px; height: 16px; }
.signin-back:hover { color: var(--ink); background: var(--surface-2); }

.signin-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 690;
  letter-spacing: -.03em;
  line-height: 1.12;
  color: var(--heading, var(--ink));
}
.signin-sub { margin: 8px 0 26px; font-size: 13.5px; color: var(--ink-3); line-height: 1.55; max-width: 40ch; }

.signin-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.signin-reveal {
  background: none;
  border: 0;
  padding: 2px 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-deep);
  cursor: pointer;
  border-radius: 6px;
}
.signin-reveal:hover { color: var(--accent); text-decoration: underline; }
.signin-reveal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.signin-input { position: relative; display: flex; align-items: center; }
.signin-input > svg {
  position: absolute;
  inset-inline-start: 12px;
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  pointer-events: none;
}
.signin-input .input {
  width: 100%;
  padding-inline-start: 38px;
  height: 46px;
  font-size: 14.5px;
}
.signin-input .input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.signin .form-error { margin: 2px 0 0; }
.signin-submit { margin-top: 16px; height: 48px; font-size: 15px; }
.signin-submit[aria-busy="true"] { opacity: .82; cursor: progress; }

.signin-demo { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line-2); }
.signin-demo-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 620;
  color: var(--ink-2);
}
.signin-demo-head small { font-size: 11.5px; font-weight: 500; color: var(--ink-3); font-family: var(--font-mono); }

.signin-demo-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.signin .demo-btn {
  --tint: var(--green-01);
  --tint-ink: var(--green-ink);
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 9px 11px;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color 140ms var(--ease), background 140ms var(--ease), box-shadow 140ms var(--ease);
}
.signin .demo-btn:last-child { grid-column: 1 / -1; }
.signin .demo-btn:hover { border-color: color-mix(in srgb, var(--tint-ink) 35%, var(--line)); background: color-mix(in srgb, var(--tint) 55%, #fff); }
.signin .demo-btn.is-on { border-color: var(--tint-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tint) 65%, transparent); background: color-mix(in srgb, var(--tint) 60%, #fff); }
.signin .demo-btn:focus-visible { outline: 2px solid var(--tint-ink); outline-offset: 2px; }

.signin .demo-icon {
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--tint);
  color: var(--tint-ink);
}
.signin .demo-icon svg { width: 17px; height: 17px; }
.signin .demo-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.signin .demo-name { font-size: 12.5px; font-weight: 640; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signin .demo-sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.signin .demo-ministry { --tint: var(--green-01); --tint-ink: var(--green-ink); }
.signin .demo-school { --tint: var(--blue-01); --tint-ink: var(--blue-ink); }
.signin .demo-teacher { --tint: var(--orange-01); --tint-ink: var(--orange-ink); }
.signin .demo-student { --tint: var(--indigo-01); --tint-ink: var(--indigo-ink); }
.signin .demo-parent { --tint: var(--pink-01); --tint-ink: var(--pink-ink); }

.signin-foot {
  margin: 24px 0 0;
  font-size: 11.5px;
  color: var(--ink-3);
  text-align: center;
}

@media (max-width: 960px) {
  .signin { grid-template-columns: 1fr; min-height: 0; }
  .signin-stage { min-height: 0; }
  .signin-stage::after { background: linear-gradient(180deg, rgba(8, 26, 16, .84), rgba(8, 26, 16, .9)); }
  .signin-stage-inner { flex-direction: column; gap: 18px; padding: 20px; }
  .signin-story { max-width: none; margin-top: 4px; }
  .signin-story h1 { font-size: 23px; margin-top: 14px; max-width: 22ch; }
  .signin-lead, .signin-facts, .signin-stage-note { display: none; }
  .signin-eyebrow { font-size: 11px; }
  .signin-panel { padding: 28px 20px 40px; place-items: start center; }
  .signin-card { max-width: 460px; }
  .signin-top { margin-bottom: 18px; }
}

@media (max-width: 420px) {
  .signin-demo-list { grid-template-columns: 1fr; }
  .signin .demo-btn:last-child { grid-column: auto; }
  .signin .demo-btn { min-height: 52px; }
}
