/* =====================================================================
   Bloom Accounts · بلوم للحسابات المدرسية — Design System
   Identity: Bloom brand book (Phase 2) — Primary #2B1B7D · Secondary #F26B21 · Black · White
   Layout: RTL app shell — deep Bloom-indigo sidebar on the right carrying the
           Bloom logo, sticky topbar, fluid content grid of cards.
   Type:   Poppins (display & figures, echoes the bloom wordmark) · Open Sans (Latin)
           + Noto Sans Arabic (Arabic) · Cascadia Mono (codes, per the identity)
   ===================================================================== */

:root {
  /* surfaces & ink — neutrals biased toward Bloom indigo */
  --bg: #F4F3F9;
  --surface: #FFFFFF;
  --surface-2: #F9F8FC;
  --sunken: #ECEAF4;
  --ink: #16122B;
  --ink-2: #4D4868;
  --ink-3: #8A85A3;
  --line: #E1DEEC;
  --line-2: #EDEBF4;

  /* Bloom brand */
  --bloom-indigo: #2B1B7D;
  --bloom-orange: #F26B21;
  --brand: #2B1B7D;
  --brand-2: #3B2A9C;
  --brand-soft: #ECEAF8;
  --on-brand: #FFFFFF;
  --accent: #F26B21;
  --accent-2: #F5843F;
  --accent-soft: #FEECE1;
  --accent-ink: #B4480E;

  /* sidebar (Bloom indigo in both themes) */
  --side-bg: #1D1160;
  --side-bg-2: #2B1B7D;
  --side-ink: #DCD8F3;
  --side-ink-2: #A29CD0;
  --side-line: rgba(255, 255, 255, .09);
  --side-hover: rgba(255, 255, 255, .07);

  /* semantic (kept apart from the brand orange) */
  --good: #18804F;   --good-soft: #E0F2E8;
  --warn: #A36A00;   --warn-soft: #FBF1D6;
  --bad: #C8302B;    --bad-soft: #FBE4E3;
  --info: #2B66A6;   --info-soft: #E2ECF7;

  /* curricula (validated categorical order: NAT · IG · AM · IB) */
  --c-nat: #0F8A73;
  --c-ig: #A87400;
  --c-am: #2F6FD0;
  --c-ib: #C2366A;

  --shadow-sm: 0 1px 2px rgba(29, 17, 96, .06);
  --shadow: 0 1px 2px rgba(29, 17, 96, .05), 0 6px 20px -6px rgba(29, 17, 96, .10);
  --shadow-lg: 0 24px 60px -12px rgba(29, 17, 96, .32);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);

  --r-xs: 6px; --r-sm: 9px; --r: 13px; --r-lg: 18px;

  --f-display: 'Poppins', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --f-body: 'Open Sans', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --f-mono: 'Cascadia Mono', Consolas, 'Courier New', monospace;

  --side-w: 276px;
  --top-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0B1C; --surface: #16122A; --surface-2: #1B1633; --sunken: #120E24;
    --ink: #EDEBF7; --ink-2: #ADA8C8; --ink-3: #767194; --line: #2B2547; --line-2: #221D3A;
    --brand: #9488EC; --brand-2: #A99FF2; --brand-soft: #241D4C; --on-brand: #0E0B1C;
    --accent: #FF8A4C; --accent-2: #FFA06C; --accent-soft: #3A2114; --accent-ink: #FFAE80;
    --side-bg: #0A0716; --side-bg-2: #170F3E;
    --good: #3DBA7F; --good-soft: #10291D; --warn: #E3AE3A; --warn-soft: #2B2410;
    --bad: #F0706A; --bad-soft: #2E1618; --info: #6FA3E0; --info-soft: #11223A;
    --c-nat: #25A58C; --c-ig: #B88A1E; --c-am: #5E92EA; --c-ib: #E0628E;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -8px rgba(0,0,0,.55);
    --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.75);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0B1C; --surface: #16122A; --surface-2: #1B1633; --sunken: #120E24;
  --ink: #EDEBF7; --ink-2: #ADA8C8; --ink-3: #767194; --line: #2B2547; --line-2: #221D3A;
  --brand: #9488EC; --brand-2: #A99FF2; --brand-soft: #241D4C; --on-brand: #0E0B1C;
  --accent: #FF8A4C; --accent-2: #FFA06C; --accent-soft: #3A2114; --accent-ink: #FFAE80;
  --side-bg: #0A0716; --side-bg-2: #170F3E;
  --good: #3DBA7F; --good-soft: #10291D; --warn: #E3AE3A; --warn-soft: #2B2410;
  --bad: #F0706A; --bad-soft: #2E1618; --info: #6FA3E0; --info-soft: #11223A;
  --c-nat: #25A58C; --c-ig: #B88A1E; --c-am: #5E92EA; --c-ib: #E0628E;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px -8px rgba(0,0,0,.55);
  --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.75);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 600; margin: 0; line-height: 1.3; text-wrap: balance; letter-spacing: -.005em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.num, .tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--f-mono); font-size: .92em; letter-spacing: .01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.hide, [hidden] { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 22px; height: 22px; }

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .25s var(--ease);
}
.app.collapsed { --side-w: 78px; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  background:
    radial-gradient(120% 50% at 100% 0%, rgba(242,107,33,.16), transparent 60%),
    linear-gradient(180deg, var(--side-bg-2), var(--side-bg) 45%);
  color: var(--side-ink);
  display: flex; flex-direction: column;
  border-inline-end: 1px solid var(--side-line);
  z-index: 40;
  overflow: hidden;
}
.side-brand {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 18px 14px;
  text-decoration: none !important;
  position: relative;
}
.side-brand .lockup { display: flex; align-items: center; justify-content: center; gap: 10px; }
.side-brand .lockup .mark { width: 62px; height: auto; flex: none; filter: drop-shadow(0 6px 10px rgba(0,0,0,.25)); }
.side-brand .lockup .word { height: 46px; width: auto; }
.side-brand .product {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: #fff;
  padding: 3px 12px; border-radius: 99px;
  background: var(--bloom-orange);
  box-shadow: 0 6px 14px -6px rgba(242,107,33,.7);
}
.side-brand .product span { font-family: var(--f-display); font-size: 10.5px; letter-spacing: .14em; opacity: .9; }
.sidebar::after {
  content: ""; position: absolute; inset-inline-end: -46px; bottom: 54px; width: 210px; height: 150px;
  background: url("../img/bloom-mark-white.svg") no-repeat center / contain;
  opacity: .045; pointer-events: none; transform: rotate(-12deg);
}
.app.collapsed .side-brand .lockup .word, .app.collapsed .side-brand .product { display: none; }
.app.collapsed .side-brand .lockup .mark { width: 44px; }
.app.collapsed .sidebar::after { display: none; }

.side-tenant {
  margin: 0 14px 10px; padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.04);
  border: 1px solid var(--side-line);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; text-align: start; width: calc(100% - 28px); color: inherit;
}
.side-tenant:hover { background: rgba(255,255,255,.07); }
.side-tenant .crest { width: 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--bloom-indigo); display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; font-size: 12px; flex: none; }
.side-tenant .t { min-width: 0; flex: 1; }
.side-tenant .t b { display: block; font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-tenant .t small { font-size: 11px; color: var(--side-ink-2); }

.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 10px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-group { margin-top: 14px; }
.nav-group > .nav-label {
  font-size: 10.5px; letter-spacing: .12em; color: var(--side-ink-2);
  padding: 0 12px 6px; font-weight: 600; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: 10px;
  color: var(--side-ink); text-decoration: none !important;
  font-size: 13.5px; font-weight: 500;
  position: relative; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item .ico { color: var(--side-ink-2); transition: color .15s; }
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item:hover .ico { color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(242,107,33,0), rgba(242,107,33,.22));
  color: #fff;
}
.nav-item.active .ico { color: #FF9A5C; }
.nav-item.active::before {
  content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--bloom-orange);
}
.nav-item .nav-badge {
  margin-inline-start: auto; font-size: 11px; font-weight: 600;
  padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.12); color: #fff;
  font-variant-numeric: tabular-nums;
}
.nav-item .nav-badge.hot { background: var(--bloom-orange); color: #fff; }

.side-foot {
  border-top: 1px solid var(--side-line);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.side-foot .who { min-width: 0; flex: 1; line-height: 1.3; }
.side-foot .who b { display: block; font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who small { font-size: 11px; color: var(--side-ink-2); }
.side-foot .icon-btn { color: var(--side-ink-2); }
.side-foot .icon-btn:hover { color: #fff; background: var(--side-hover); }

.app.collapsed .side-tenant .t,
.app.collapsed .nav-label,
.app.collapsed .nav-item span,
.app.collapsed .nav-badge,
.app.collapsed .side-foot .who,
.app.collapsed .side-foot .icon-btn { display: none; }
.app.collapsed .side-tenant { justify-content: center; padding: 8px; }
.app.collapsed .nav-item { justify-content: center; padding: 11px; }
.app.collapsed .nav-group { margin-top: 8px; border-top: 1px solid var(--side-line); padding-top: 8px; }
.app.collapsed .side-brand { padding-inline: 0; }

/* ---------- topbar ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 10px;
  padding-block: 0;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 50; background: var(--bg); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  position: relative; flex: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }

.search-trigger {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px; min-width: 0; flex: 0 1 380px;
  border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-3); cursor: pointer;
  text-align: start;
}
.search-trigger:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.search-trigger span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kbd { font-family: var(--f-mono); font-size: 11px; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); direction: ltr; white-space: nowrap; }

.top-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13px; color: var(--ink);
}
.top-chip:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.top-chip .lbl { color: var(--ink-3); font-weight: 400; font-size: 12px; }
.top-spacer { flex: 1; }

.dropdown { position: relative; }
.menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
  opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none;
  transition: opacity .15s, transform .15s var(--ease);
}
.menu.start { inset-inline-end: auto; inset-inline-start: 0; }
.dropdown.open .menu { opacity: 1; transform: none; pointer-events: auto; }
.menu-head { padding: 8px 10px 6px; font-size: 11px; color: var(--ink-3); letter-spacing: .08em; font-weight: 600; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 9px; border: 0; background: none; cursor: pointer; text-align: start; color: var(--ink);
  text-decoration: none !important; font-size: 13.5px;
}
.menu-item:hover { background: var(--sunken); }
.menu-item .ico { color: var(--ink-3); }
.menu-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.menu-item.on .ico { color: var(--brand); }
.menu-item small { margin-inline-start: auto; color: var(--ink-3); font-size: 12px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- page ---------- */
.content {
  padding-block: 24px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  width: 100%;
  max-width: 1560px;
  margin-inline: auto;
}
@media (min-width: 900px) {
  .content { padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; flex-wrap: wrap; }
.page-head .crumbs a { color: var(--ink-2); }
.page-head h1 { font-size: 26px; font-weight: 600; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 1fr) 360px; }
.g-side-main { grid-template-columns: 340px minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt { margin-top: 18px; }

@media (max-width: 1280px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main-side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 980px) { .g-3, .g-side-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); } .span-2 { grid-column: auto; } }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px 0;
}
.card-head h2, .card-head h3 { font-size: 15.5px; font-weight: 600; }
.card-head .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; font-family: var(--f-body); font-weight: 400; }
.card-body { padding: 16px 20px 20px; }
.card-body.flush { padding: 8px 0 0; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }

/* KPI */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi .k-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.kpi .k-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi .k-icon.accent { background: var(--accent-soft); color: var(--accent-ink); }
.kpi .k-icon.bad { background: var(--bad-soft); color: var(--bad); }
.kpi .k-icon.info { background: var(--info-soft); color: var(--info); }
.kpi .k-value { font-family: var(--f-display); font-size: 27px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .k-value small { font-size: 13px; color: var(--ink-3); font-weight: 500; font-family: var(--f-body); margin-inline-start: 4px; }
.kpi .k-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.kpi .spark { height: 34px; width: 110px; }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; padding: 2px 7px; border-radius: 99px; font-variant-numeric: tabular-nums; direction: ltr; }
.delta.up { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--ink) 18%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunken); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn.block { width: 100%; }
.btn .ico { width: 17px; height: 17px; }

/* ---------- badges / pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--sunken); color: var(--ink-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.plain::before { display: none; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }

.cur {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  padding: 2px 8px 2px 9px; border-radius: 6px; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--cc) 35%, transparent);
  color: var(--cc); background: color-mix(in srgb, var(--cc) 10%, transparent);
  font-family: var(--f-mono);
}
.cur::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--cc); }
.cur.nat { --cc: var(--c-nat); }
.cur.ig { --cc: var(--c-ig); }
.cur.am { --cc: var(--c-am); }
.cur.ib { --cc: var(--c-ib); }

.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }

/* ---------- avatar ---------- */
.av {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 600; font-size: 13px;
  color: #fff; background: var(--avc, var(--brand));
}
.av.sm { width: 28px; height: 28px; font-size: 11px; }
.av.lg { width: 64px; height: 64px; font-size: 22px; }
.av.xl { width: 92px; height: 92px; font-size: 30px; }
.who-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who-cell b { font-weight: 600; display: block; white-space: nowrap; }
.who-cell small { color: var(--ink-3); font-size: 12px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th {
  text-align: start; font-weight: 600; font-size: 12px; color: var(--ink-3); letter-spacing: .02em;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0;
}
.tbl th:first-child { padding-inline-start: 20px; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl td:first-child { padding-inline-start: 20px; }
.tbl td:last-child, .tbl th:last-child { padding-inline-end: 20px; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .n { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .c { text-align: center; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; }
.tbl.compact td { padding: 9px 12px; }
.tbl tr.clickable { cursor: pointer; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-actions .icon-btn { width: 32px; height: 32px; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--line-2);
}
.toolbar .grow { flex: 1; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--ink-3); }
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:hover, .select:hover { border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
.input:focus, .select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input.sm, .select.sm { height: 34px; font-size: 13px; border-radius: 9px; }
.input-icon { position: relative; min-width: 0; }
.input-icon > .ico { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon .input { padding-inline-start: 38px; }
.select { appearance: none; -webkit-appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2382928D' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; }
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

.seg { display: inline-flex; padding: 3px; background: var(--sunken); border-radius: 11px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.switch { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(-16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

.check { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; cursor: pointer;
  padding: 12px 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 8px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabs button .count { font-size: 11px; padding: 0 7px; border-radius: 99px; background: var(--sunken); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tabs.in-card { padding: 0 14px; }
.tab-panel[hidden] { display: none !important; }

/* ---------- progress ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .8s var(--ease); }
.bar.accent > i { background: var(--accent); }
.bar.thin { height: 5px; }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow small { color: var(--ink-3); font-size: 12px; }
.sq-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--sunken); color: var(--ink-2); }
.sq-ico.good { background: var(--good-soft); color: var(--good); }
.sq-ico.warn { background: var(--warn-soft); color: var(--warn); }
.sq-ico.bad { background: var(--bad-soft); color: var(--bad); }
.sq-ico.info { background: var(--info-soft); color: var(--info); }
.sq-ico.brand { background: var(--brand-soft); color: var(--brand); }
.sq-ico.accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- modal & drawer ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(16, 9, 52, .5);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(680px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  transform: translateY(10px) scale(.98); transition: transform .25s var(--ease);
}
.modal.wide { width: min(980px, 100%); }
.overlay.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 20px 20px; flex-wrap: wrap; }

.drawer-overlay { place-items: stretch; justify-items: end; padding: 0; grid-template-rows: 100%; }
.drawer {
  width: min(420px, 100%); height: 100%; max-height: 100dvh; min-height: 0; background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; border-inline-start: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .3s var(--ease);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  justify-self: end;
}
.overlay.open .drawer { transform: none; }
.drawer-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }

/* ---------- command palette ---------- */
.cmdk { width: min(640px, 100%); align-self: start; margin-top: 10vh; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; transform: translateY(-8px); transition: transform .2s var(--ease); }
.overlay.open .cmdk { transform: none; }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cmdk-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; min-width: 0; }
.cmdk-list { max-height: 420px; overflow: auto; padding: 8px; }
.cmdk-group { font-size: 11px; color: var(--ink-3); padding: 10px 10px 4px; letter-spacing: .08em; font-weight: 600; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--ink); text-decoration: none !important; }
.cmdk-item .sq-ico { width: 30px; height: 30px; border-radius: 8px; }
.cmdk-item.sel { background: var(--brand-soft); }
.cmdk-item small { margin-inline-start: auto; color: var(--ink-3); font-size: 12px; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); background: var(--surface-2); flex-wrap: wrap; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: max(20px, env(safe-area-inset-bottom, 0px)); inset-inline-start: max(20px, env(safe-area-inset-left, 0px)); z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px;
  min-width: 280px; max-width: min(420px, calc(100vw - 40px));
  padding: 12px 16px; border-radius: 14px;
  background: #1D1160; color: #F1EFFB; box-shadow: var(--shadow-lg);
  font-size: 13.5px; pointer-events: auto;
  animation: toastIn .35s var(--ease);
}
.toast .sq-ico { width: 30px; height: 30px; border-radius: 9px; }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--ink-3); font-size: 11px; font-family: var(--f-body); }
.chart .grid line { stroke: var(--line-2); }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; min-width: 150px;
  opacity: 0; transition: opacity .12s; white-space: nowrap;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; margin-bottom: 4px; font-size: 12.5px; }
.chart-tip .tr { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.chart-tip .tr i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tip .tr span { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chart-tip .tr em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; border-radius: 2px; width: 16px; }
.legend i.dash { height: 0; width: 16px; border-top: 2px dashed currentColor; border-radius: 0; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 500; text-align: end; }
.note {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: 12px; font-size: 13px;
  background: var(--info-soft); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--info) 25%, transparent);
}
.note .ico { color: var(--info); margin-top: 2px; }
.note.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.note.warn .ico { color: var(--warn); }
.note.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 25%, transparent); }
.note.good .ico { color: var(--good); }

.dashed-box { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 24px; text-align: center; color: var(--ink-3); }

.stepper { display: flex; gap: 0; counter-reset: s; flex-wrap: wrap; }
.stepper .st { flex: 1; min-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.stepper .st::before {
  counter-increment: s; content: counter(s);
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--surface); border: 2px solid var(--line); color: var(--ink-3); position: relative; z-index: 1; font-family: var(--f-display);
}
.stepper .st::after { content: ""; position: absolute; top: 17px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); }
.stepper .st:last-child::after { display: none; }
.stepper .st.done::before { content: "✓"; background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.stepper .st.done::after { background: var(--brand); }
.stepper .st.cur::before { border-color: var(--brand); color: var(--brand); box-shadow: var(--ring); }
.stepper .st.cur { color: var(--ink); font-weight: 600; }
.stepper .st.cur:not(.x) { display: flex; font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: normal; padding: 0; border: 0; border-radius: 0; background: none; white-space: normal; gap: 8px; }  /* not the curriculum badge .cur */

/* tree */
.tree { font-size: 13.5px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul ul { padding-inline-start: 22px; border-inline-start: 1px dashed var(--line); margin-inline-start: 13px; }
.tree-node { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; cursor: pointer; min-width: 0; }
.tree-node:hover { background: var(--sunken); }
.tree-node.sel { background: var(--brand-soft); }
.tree-node .tw { width: 18px; height: 18px; display: grid; place-items: center; color: var(--ink-3); transition: transform .15s; flex: none; }
.tree-node.collapsed .tw { transform: rotate(90deg); }
.tree-node .code { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); min-width: 54px; }
.tree-node .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-node .bal { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.tree-node.lvl0 .nm { font-weight: 700; }
.tree-node.lvl1 .nm { font-weight: 600; }
.tree li.closed > ul { display: none; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 300px; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; font-weight: 600; font-size: 13.5px; }
.kcol-head .dotc { width: 9px; height: 9px; border-radius: 50%; }
.kcol-head .cnt { margin-inline-start: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.kcol-body { padding: 0 10px 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kcol.drop { outline: 2px dashed var(--brand); outline-offset: -4px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: var(--shadow-sm); cursor: grab; display: flex; flex-direction: column; gap: 8px; }
.kcard:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.kcard.dragging { opacity: .5; }
.kcard .kc-top { display: flex; align-items: center; gap: 8px; }
.kcard .kc-top b { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kcard .kc-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }

/* responsive shell */
.mobile-only { display: none; }
@media (max-width: 1100px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); --side-w: 0px; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: 290px;
    transform: translateX(100%); transition: transform .3s var(--ease);
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.collapsed .sidebar * { display: revert; }
  .mobile-only { display: inline-grid; }
  .desk-only { display: none !important; }
  .scrim { position: fixed; inset: 0; background: rgba(16,9,52,.45); z-index: 35; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
}
@media (max-width: 640px) {
  .search-trigger span, .search-trigger .kbd, .top-chip .lbl, .top-chip .hide-sm { display: none; }
  .search-trigger { flex: 0 0 auto; }
  .page-head h1 { font-size: 22px; }
  .kpi .k-value { font-size: 23px; }
  .toolbar { padding: 12px 14px; }
}

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

/* entrance */
.rise { animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: .001; transform: translateY(8px); } }

@media print {
  .sidebar, .topbar, .page-actions, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* table cells stay on one line; cells given a max-width wrap */
.tbl td { white-space: nowrap; }
.tbl td[style*="max-width"] { white-space: normal; min-width: 200px; }

@media (max-width: 640px) {
  .topbar { gap: 4px; }
  .top-chip { padding: 0 10px; gap: 6px; }
  .topbar .menu { position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--top-h) + 6px); left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
}


/* ---------- Bloom brand signature (footer on every page) ---------- */
.brand-foot {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3);
}
.brand-foot .bf-logo { display: flex; align-items: center; gap: 10px; }
.brand-foot .bf-logo img { height: 30px; width: auto; }
.brand-foot .bf-logo .w { height: 26px; }
.brand-foot b { color: var(--ink-2); font-weight: 600; }
.logo-light { display: inline-block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-light { display: none; } :root:not([data-theme="light"]) .logo-dark { display: inline-block; } }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline-block; }

/* brand ribbon under the topbar: thin indigo→orange line from the identity */
.topbar::after { content: ""; position: absolute; inset: auto 0 -1px 0; height: 2px; background: linear-gradient(90deg, var(--bloom-orange) 0 18%, var(--bloom-indigo) 18% 100%); opacity: .9; }
