:root, [data-theme="light"] {
  --bg: #f5f7fb;
  --elev: #ffffff;
  --card: #ffffff;
  --line: rgba(16, 32, 68, 0.08);
  --text: #0c1733;
  --muted: #667085;
  --accent: #1e3a8a;
  --accent-ink: #f8faff;
  --ok: #0e7a45;
  --bad: #b42318;
  --soft: rgba(30, 58, 138, 0.08);
  --track: rgba(16, 32, 68, 0.08);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px rgba(16, 24, 40, 0.04);
  --nav: 86px;
  --radius: 20px;
  --font: "Shurjo", "Noto Sans Bengali", "Roboto", sans-serif;
}

[data-theme="dark"] {
  --bg: #070d1a;
  --elev: #10192d;
  --card: #10192d;
  --line: rgba(198, 214, 255, 0.12);
  --text: #eef3ff;
  --muted: #9aabc4;
  --accent: #9db7ff;
  --accent-ink: #07101f;
  --ok: #8dceab;
  --bad: #f0a398;
  --soft: rgba(157, 183, 255, 0.14);
  --track: rgba(198, 214, 255, 0.12);
  --shadow: none;
}

@font-face {
  font-family: "Shurjo";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://assets.prothomalo.com/prothomalo/assets/ShurjoWeb_400_v5_1.woff2") format("woff2");
}
@font-face {
  font-family: "Shurjo";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("https://assets.prothomalo.com/prothomalo/assets/ShurjoWeb_700_v5_1.woff2") format("woff2");
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 8% -8%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 50%),
    linear-gradient(180deg, color-mix(in srgb, var(--soft) 55%, var(--bg)), var(--bg) 42%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app {
  width: min(720px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 20px calc(var(--nav) + 92px);
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -20px;
  padding: 14px 20px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.brand strong { display: block; font-size: 1.12rem; line-height: 1.25; font-weight: 700; }
.brand span, .muted, .meta { color: var(--muted); }
.brand span { display: block; margin-top: 2px; font-size: 0.82rem; line-height: 1.4; }
.mark, .back, .icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  flex: none;
}
.mark { background: var(--accent); color: var(--accent-ink); font-weight: 700; border-color: transparent; box-shadow: none; }
.back, .icon { padding: 0; color: var(--text); }
.back svg, .icon svg { width: 18px; height: 18px; display: block; }
.icon { margin-left: auto; }

.stack { display: grid; gap: 14px; }
.card, .hero, .row-card, .q-card, .list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card, .hero, .q-card { padding: 22px; }
.hero h2, .card h2, .q-card h2 { margin: 0 0 8px; font-size: 1.45rem; line-height: 1.3; font-weight: 700; }
.card > strong { display: block; font-size: 1.05rem; line-height: 1.45; }
.section-title {
  margin: 10px 4px 0;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--muted);
}
.row-card, .subject-row, .leaf-row, .list-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
}
.list { overflow: hidden; }
.list .subject-row, .list .leaf-row, .list .list-row {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--line);
}
.list > :first-child { border-top: 0; }
.subject-row strong, .leaf-row strong, .list-row strong { display: block; line-height: 1.45; }
.subject-row > button { flex: none; }
.copy { min-width: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.copy strong { font-weight: 700; }
.copy p, .meta, .muted { margin: 0; font-size: 0.92rem; line-height: 1.55; }
.stat {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
  flex: none;
}
.stat:empty { display: none; }
.chev {
  width: 8px;
  height: 8px;
  border-right: 1.8px solid var(--muted);
  border-top: 1.8px solid var(--muted);
  transform: rotate(45deg);
  flex: none;
  margin-right: 4px;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px 14px;
  display: grid;
  gap: 2px;
  align-content: start;
}
.tile b { font-size: 1.55rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); font-size: 0.82rem; line-height: 1.4; }

.bar, .track {
  height: 6px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
  display: flex;
  margin-top: 8px;
}
.bar { flex: 1; margin-top: 0; }
.ok { background: var(--ok); height: 100%; }
.bad { background: var(--bad); height: 100%; }
.track > span { display: block; height: 100%; background: var(--accent); }
.track > span.ok { background: var(--ok); }
.track > span.bad { background: var(--bad); }

.actions, .confirm-actions, .dock { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions, .dock { margin-top: 16px; }
.card .chips { margin-top: 14px; }
button, a.chip { scroll-margin-bottom: calc(var(--nav) + 20px); }
button.primary, button.ghost, .chip, .option, .mini {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--elev);
  padding: 0 14px;
  min-height: 40px;
  line-height: 1.3;
}
button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 700;
  padding: 0 18px;
}
button.ghost { background: transparent; }
button:disabled:not(.option) { opacity: 0.45; cursor: default; }
.option:disabled { cursor: default; }
.chips, .exam-rail, .desk-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.exam-rail { margin: 0 0 10px; }
.desk-tabs { margin: 0 0 12px; }
.exam-rail .chip, .desk-tabs .chip { flex: 1 1 auto; justify-content: center; }
.desk-tabs .chip { border-radius: 999px; }
.chip { display: inline-flex; align-items: center; }
.chip.on, .mini.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 0.78rem;
  line-height: 1.6;
  vertical-align: 1px;
}

.q-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.q-card {
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, transform 180ms ease;
}
.stem { font-size: 1.28rem; line-height: 1.72; font-weight: 600; letter-spacing: -0.01em; }
.stem p, .explain p { margin: 0 0 0.7em; }
.stem p:last-child, .explain p:last-child { margin-bottom: 0; }
.stem img, .explain img { max-width: 100%; height: auto; border-radius: 14px; margin: 14px 0; display: block; }
.options { display: grid; gap: 10px; margin-top: 18px; }
.option {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  line-height: 1.55;
  padding: 14px 14px;
  min-height: 56px;
  background: color-mix(in srgb, var(--elev) 70%, var(--card));
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.option:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  transform: translateY(-1px);
}
.option .letter {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  flex: none;
  font-weight: 700;
  margin-top: 1px;
}
.option-copy { flex: 1; padding-top: 4px; }
.option.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.option.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--card)); box-shadow: none; }
.option.correct .letter { background: var(--ok); color: #f7fffb; }
.option.wrong {
  border-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, var(--card));
  animation: wrong-shake 420ms ease;
}
.option.wrong .letter { background: var(--bad); color: #fff8f7; }
.q-card.is-wrong { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.q-card[hidden] { display: none !important; }
.exam-verdict {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  background: var(--elev);
  border: 1px solid var(--line);
}
.exam-verdict.ok { background: color-mix(in srgb, var(--ok) 12%, var(--card)); color: var(--ok); border-color: transparent; }
.exam-verdict.bad { background: color-mix(in srgb, var(--bad) 12%, var(--card)); color: var(--bad); border-color: transparent; }
.exam-toolbar-card .exam-progress { margin: 8px 0 0; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.exam-tools { margin-top: 10px; }
.chip.on, .chips .chip.on {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.chip:disabled, .chips .chip:disabled { opacity: 0.4; pointer-events: none; }
.answer-panel { display: none !important; }
.exam-more { text-align: center; color: var(--muted); font-size: 0.86rem; padding: 12px 4px; }
.exam-sentinel { height: 1px; }
.exam-list { display: grid; gap: 14px; }
.card.compact { padding: 14px 16px; }
.mini.pending { opacity: 0.35; }
@keyframes wrong-shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}
.explain {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--soft) 55%, var(--card));
  border: 1px solid var(--line);
  line-height: 1.75;
}
.explain-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 148px;
  overflow: auto;
  margin-top: 4px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.mini {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
}
.mini.filled { box-shadow: inset 0 0 0 1.5px var(--accent); }
.mini.correct { background: var(--ok); color: #f7fffb; border-color: transparent; }
.mini.wrong { background: var(--bad); color: #fff8f7; border-color: transparent; }
.dock {
  position: sticky;
  bottom: calc(var(--nav) + 8px);
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.dock .ghost, .dock .primary { width: 100%; justify-content: center; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }

.nav {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(688px, calc(100% - 16px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 68px;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--elev) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 6;
}
.nav a {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  font-size: 0.72rem;
  line-height: 1.15;
  color: var(--muted);
  border-radius: 14px;
  margin: 6px 2px;
  min-height: 52px;
}
.nav .ico { width: 22px; height: 22px; }
.nav a.on { color: var(--accent); font-weight: 700; background: var(--soft); position: relative; }
.nav a.on::after {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.group-label { margin: 8px 4px 0; color: var(--muted); font-size: 0.86rem; font-weight: 700; }
.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 4px 0;
}
.group-head .group-label { margin: 0; }
.leaf-row .chip { flex: none; }
.empty { color: var(--muted); padding: 8px 4px; }
.auth-stage {
  position: relative;
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 12px 0 40px;
}
.auth-glow {
  position: absolute;
  inset: 8% 4% auto;
  height: 58%;
  border-radius: 40px;
  background:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    radial-gradient(circle at 80% 20%, color-mix(in srgb, var(--ok) 14%, transparent), transparent 50%),
    linear-gradient(145deg, color-mix(in srgb, var(--card) 70%, transparent), transparent);
  filter: blur(2px);
  pointer-events: none;
}
.auth-panel {
  position: relative;
  width: min(440px, 100%);
  padding: 28px 24px 26px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card) 92%, white), var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  box-shadow:
    0 1px 0 color-mix(in srgb, white 55%, transparent) inset,
    0 24px 60px rgba(12, 23, 51, 0.08);
}
.auth-kicker {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.gate {
  display: grid;
  justify-items: stretch;
  gap: 14px;
  width: 100%;
}
.gate h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.gate input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--elev) 80%, var(--bg));
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.gate input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}
.gate .primary {
  min-height: 48px;
  border-radius: 14px;
  margin-top: 4px;
}
.gate.tight { gap: 12px; max-width: none; }
.gate textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--elev) 80%, var(--bg));
  resize: vertical;
}
.admin-tabs { margin: 0 0 4px; }
.resource-card { display: grid; gap: 10px; }
.resource-card .chips { margin-top: 0; }
.file-chip { cursor: pointer; }
.file-chip input { display: none; }
.chip .mini {
  margin-left: 6px;
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 8px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav) + 18px);
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 8;
  max-width: min(90vw, 420px);
  line-height: 1.45;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  padding: 22px;
  width: min(420px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
dialog p { margin: 0 0 16px; line-height: 1.6; }
dialog::backdrop { background: rgba(7, 14, 28, 0.46); }
.bands { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bands div { background: var(--bg); border-radius: 14px; padding: 14px 12px; }
.bands b { display: block; font-size: 1.35rem; line-height: 1.2; }
.miss { padding: 14px 0; border-top: 1px solid var(--line); }
.miss:first-child { border-top: 0; padding-top: 0; }
.miss summary { cursor: pointer; line-height: 1.5; }
.path { color: var(--muted); font-size: 0.9rem; line-height: 1.6; margin: 0 0 14px; }
.path a { color: var(--muted); }
.path a:hover { color: var(--text); }
.sep { margin: 0 8px; color: color-mix(in srgb, var(--muted) 70%, transparent); }
.q-card .meta { margin-bottom: 14px; }

.hello { padding: 6px 2px 0; }
.hello h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.hello .muted { margin: 8px 0 0; max-width: 36rem; }

/* ── Dashboard Hero ── */
.dash-hero {
  position: relative;
  overflow: hidden;
  padding: 28px 24px 22px;
  border-radius: 28px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--accent) 12%, var(--card)),
      color-mix(in srgb, var(--ok) 6%, var(--card)) 50%,
      var(--card) 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  box-shadow:
    0 1px 0 color-mix(in srgb, white 25%, transparent) inset,
    0 20px 50px -12px rgba(12, 23, 51, 0.08);
}
.dash-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 300px at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent),
    radial-gradient(ellipse 400px 300px at 100% 100%, color-mix(in srgb, var(--ok) 10%, transparent), transparent);
  pointer-events: none;
}
.dash-hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(1px);
}
.dash-hero-orb-1 {
  right: -30px; top: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  animation: orb-float 8s ease-in-out infinite;
}
.dash-hero-orb-2 {
  left: 20%; bottom: -30px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, color-mix(in srgb, var(--ok) 18%, transparent), transparent 70%);
  animation: orb-float 10s ease-in-out infinite reverse;
}
@keyframes orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8px, -6px) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) {
  .dash-hero-orb-1, .dash-hero-orb-2 { animation: none; }
}
.dash-hero-content {
  position: relative;
}
.dash-greeting {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.dash-headline {
  margin: 6px 0 0;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.dash-sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 32rem;
}
.dash-hero-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}
.dash-stat {
  padding: 14px 12px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 75%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.dash-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(12, 23, 51, 0.06);
}
.dash-stat strong {
  display: block;
  font-size: 1.3rem;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.dash-stat-prime strong {
  color: var(--accent);
  font-size: 1.45rem;
}
.dash-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-quota {
  position: relative;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-quota-bar {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}
.dash-quota-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  transition: width 600ms ease;
}
.dash-quota-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 560px) {
  .dash-hero { padding: 22px 18px 18px; }
  .dash-hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-stat strong { font-size: 1.15rem; }
  .dash-stat-prime strong { font-size: 1.25rem; }
  .dash-headline { font-size: 1.55rem; }
}

/* ── Dashboard Continue Paper ── */
.dash-continue {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 6%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
  text-decoration: none;
}
.dash-continue:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.dash-continue-badge {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  font-size: 0.72rem;
  flex: none;
}

/* ── Dashboard Quick Actions ── */
.dash-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dash-action {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  position: relative;
  overflow: hidden;
}
.dash-action::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}
.dash-action-exam::before { background: var(--accent); }
.dash-action-course::before { background: var(--ok); }
.dash-action-resource::before { background: #7c3aed; }
.dash-action:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -8px rgba(12, 23, 51, 0.1);
}
.dash-action-ico {
  width: 40px; height: 40px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex: none;
}
.dash-action-exam .dash-action-ico {
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  color: var(--accent);
}
.dash-action-course .dash-action-ico {
  background: color-mix(in srgb, var(--ok) 12%, var(--card));
  color: var(--ok);
}
.dash-action-resource .dash-action-ico {
  background: color-mix(in srgb, #7c3aed 12%, var(--card));
  color: #7c3aed;
}
.dash-action .ico { width: 22px; height: 22px; }
.dash-action strong { display: block; font-size: 1rem; line-height: 1.3; }
.dash-action p { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.dash-action .chev { position: absolute; top: 18px; right: 14px; }
@media (max-width: 560px) {
  .dash-actions { grid-template-columns: 1fr; }
  .dash-action { flex-direction: row; align-items: center; padding: 14px 16px; }
  .dash-action .chev { top: 50%; right: 14px; transform: translateY(-50%) rotate(45deg); }
}

/* ── Dashboard Scale Section ── */
.dash-scale {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 22px;
  overflow: hidden;
}
.dash-scale-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.dash-scale-emoji {
  font-size: 1.6rem;
  line-height: 1;
}
.dash-scale-head strong { display: block; font-size: 1.05rem; line-height: 1.3; }
.dash-scale-head .muted { margin: 2px 0 0; font-size: 0.82rem; }
.dash-scale-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.dash-scale-grid > div {
  padding: 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--soft) 40%, var(--card));
  transition: transform 160ms ease, background 160ms ease;
}
.dash-scale-grid > div:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--soft) 70%, var(--card));
}
.dash-scale-grid .scale-q { border-left: 3px solid var(--accent); }
.dash-scale-grid .scale-leaf { border-left: 3px solid var(--ok); }
.dash-scale-grid .scale-col { border-left: 3px solid #b45309; }
.dash-scale-grid .scale-sheet { border-left: 3px solid #7c3aed; }
.dash-scale-grid .scale-vid { border-left: 3px solid #0891b2; }
.dash-scale-grid .scale-desk { border-left: 3px solid #be123c; }
.dash-scale-grid strong {
  display: block;
  font-size: 1.2rem;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.dash-scale-grid span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.35;
}
@media (max-width: 560px) {
  .dash-scale { padding: 16px; }
  .dash-scale-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Dashboard Features Section ── */
.dash-features-section {
  margin-top: 4px;
}
.dash-features-title {
  margin: 0 4px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash-feats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.dash-feat {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
}
.dash-feat:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}
.dash-feat-ico {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}
.dash-feat .ico { width: 20px; height: 20px; }
.feat-exam .dash-feat-ico { background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); }
.feat-study .dash-feat-ico { background: color-mix(in srgb, var(--ok) 14%, var(--card)); color: var(--ok); }
.feat-track .dash-feat-ico { background: color-mix(in srgb, var(--bad) 12%, var(--card)); color: var(--bad); }
.feat-course .dash-feat-ico { background: color-mix(in srgb, #7c3aed 12%, var(--card)); color: #7c3aed; }
.dash-feat strong { display: block; font-size: 0.95rem; line-height: 1.35; }
.dash-feat p { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
@media (max-width: 560px) {
  .dash-feats { grid-template-columns: 1fr; }
  .dash-feat { padding: 14px; }
}

/* ── Doors (kept for other pages) ── */
.doors { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) {
  .doors { grid-template-columns: 1fr 1fr; }
}
.door {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--soft) 45%, var(--card)), var(--card));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
}
.door:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.door .ico { width: 22px; height: 22px; color: var(--accent); margin-top: 2px; flex: none; }
.door strong { display: block; font-size: 1.05rem; line-height: 1.35; }
@media (max-width: 560px) {
  .doors { grid-template-columns: 1fr; }
  .hello h1 { font-size: 1.7rem; }
}

/* ── Old desk-hello / desk-stats kept for exam home ── */
.desk-hello {
  position: relative;
  overflow: hidden;
  padding: 22px 20px 18px;
  border-radius: 28px;
  border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--soft) 80%, var(--card)), var(--card) 58%);
  box-shadow: var(--shadow);
}
.desk-aura {
  position: absolute;
  right: -40px; top: -50px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent), transparent 68%);
  pointer-events: none;
}
.desk-stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}
.desk-stats div {
  padding: 12px 10px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  border: 1px solid var(--line);
}
.desk-stats strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.desk-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
@media (max-width: 560px) {
  .desk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.course-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  padding: 22px;
  background:
    linear-gradient(180deg, var(--soft), transparent 72%),
    var(--card);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.course-hero .ico { width: 28px; height: 28px; color: var(--accent); flex: none; }
.course-hero h2 { margin: 0 0 4px; font-size: 1.45rem; line-height: 1.3; }
.course-hero .track { margin-top: 10px; }
.exam-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}
.exam-hero .ico { width: 28px; height: 28px; color: var(--accent); flex: none; }
.exam-hero h2 { margin-bottom: 4px; }
.tile .ico { width: 20px; height: 20px; color: var(--accent); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; line-height: 1.5; margin-bottom: 8px; }
.crumbs button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 6px 0;
  min-height: 44px;
  font-weight: 700;
}
.hier {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  min-height: 64px;
}
.list > .hier:first-child { border-top: 0; }
.hier .ico { width: 22px; height: 22px; color: var(--accent); flex: none; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.stepper b { font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; min-width: 7rem; text-align: center; }
.stepper button, .presets button {
  min-width: 48px;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-weight: 700;
}
.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.presets button { flex: 1; padding: 0 10px; }
.presets button.on, .stepper button:active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.wide { width: 100%; margin-top: 12px; min-height: 48px; }
.fine { margin-top: 12px; font-size: 0.86rem; }
.make {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 5;
  width: min(688px, calc(100% - 16px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.make b { display: block; font-size: 1.05rem; line-height: 1.2; }
.make span { color: var(--muted); font-size: 0.86rem; }
.make .primary { flex: 1; min-height: 48px; }
@media (max-width: 420px) {
  .app { padding-left: 14px; padding-right: 14px; }
  .top { margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; }
  .card, .hero, .q-card { padding: 18px 16px; }
  .tiles { gap: 8px; }
  .tile { padding: 14px 10px; }
  .tile b { font-size: 1.35rem; }
  .row-card, .subject-row, .leaf-row, .list-row { padding: 14px 14px; }
  .door { padding: 14px; }
  .nav { height: 62px; border-radius: 16px; }
  .nav a { font-size: 0.68rem; min-height: 48px; }
  .nav .ico { width: 20px; height: 20px; }
  .dock { grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; padding: 8px; border-radius: 16px; }
  .stepper b { font-size: 1.5rem; min-width: 5rem; }
}
.app.public, .app.admin {
  width: min(1080px, 100%);
  padding-bottom: 36px;
}
.app.admin { width: min(920px, 100%); }
.presence { font-size: 0.75rem; margin-right: 4px; }
.presence.on { color: var(--ok); }
.presence.off { color: var(--muted); opacity: 0.55; }
.chart-card h2 { margin-bottom: 4px; }
.chart-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 12px;
  padding-bottom: 4px;
}
.chart-svg { width: 100%; min-width: 320px; height: 160px; display: block; }
.chart-bar { fill: var(--accent); opacity: 0.88; cursor: pointer; }
.chart-bar:hover { opacity: 1; }
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 720px) {
  .chart-grid { grid-template-columns: 1fr; }
}
.donut-wrap { display: grid; gap: 10px; justify-items: center; }
.donut { width: 160px; height: 160px; }
.donut-total { font-size: 11px; font-weight: 700; fill: var(--text); }
.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 6px;
}
.donut-legend li {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 0.86rem;
}
.donut-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}
.stack-bar {
  display: flex;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--track);
  margin-top: 10px;
}
.stack-seg { display: block; height: 100%; }
.stack-seg.course { background: #0e7a45; }
.stack-seg.exam { background: #1e3a8a; }
.stack-seg.desk { background: #b45309; }
.stack-seg.resources { background: #7c3aed; }
.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}
.app.public .icon { margin-left: 0; }
.end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.land-enter {
  font-weight: 700;
  color: var(--accent);
  padding: 8px 4px;
}
.land { display: grid; gap: 28px; }
.land-hero {
  display: grid;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
}
.land-copy h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.15rem, 8vw, 3.6rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.lead { margin: 0; max-width: 38rem; font-size: 1.12rem; color: var(--muted); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.92rem;
}
.eyebrow .ico { width: 16px; height: 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.pills li {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
}
.land-stage { min-width: 0; }
.art-notes { justify-content: center; margin-top: 0; }
.desk-art { width: min(280px, 86%); margin: 0 auto; }
.desk-art, .bank-art { width: 100%; height: auto; display: block; overflow: visible; }
.desk-art .blob, .bank-art .blob { fill: var(--accent); opacity: 0.12; }
.desk-art .blob.soft { opacity: 0.07; }
.desk-art .phone > rect:first-child,
.desk-art .float rect,
.desk-art .panel,
.bank-art .d-stack rect,
.bank-art .seat rect {
  fill: var(--card);
  stroke: var(--line);
  stroke-width: 1.5;
}
.desk-art .notch, .desk-art .d-track { fill: var(--track); stroke: none; }
.desk-art .d-fill { fill: var(--accent); stroke: none; }
.desk-art .d-badge, .bank-art .seat circle, .bank-art .d-top { fill: var(--accent); stroke: none; }
.desk-art text, .bank-art text {
  font-family: var(--font);
  fill: var(--text);
  font-size: 13px;
}
.desk-art .title, .desk-art .strong, .bank-art .strong { font-weight: 700; font-size: 15px; }
.desk-art .dim, .bank-art .dim { fill: var(--muted); font-size: 12px; }
.desk-art .mark-letter, .bank-art .seat text:first-of-type { fill: var(--accent-ink); font-weight: 700; font-size: 14px; }
.desk-art .float.left text, .desk-art .float.right text { font-size: 13px; font-weight: 700; }
.desk-art .float.left .dim, .desk-art .float.right .dim { font-weight: 400; }
.desk-art .float.left { color: var(--ok); }
.desk-art .float.left circle { fill: var(--ok); }
.desk-art .float.left path { stroke: #fff; }
.desk-art .float { filter: drop-shadow(0 10px 18px rgba(16, 24, 40, 0.08)); }
.desk-art .float.left { transform: translate(6px, 168px); }
.desk-art .float.right { transform: translate(228px, 300px); color: var(--accent); }
.land-block h2, .bank h2, .land-close h2 {
  margin: 6px 0 0;
  font-size: clamp(1.6rem, 4vw, 2.15rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.steps { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.steps li, .feats article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.bank {
  display: grid;
  gap: 4px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 8px 16px 18px;
}
.steps span, .feat-ico {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--accent);
  font-weight: 700;
}
.feat-ico .ico { width: 22px; height: 22px; }
.steps h3, .feats h3 { margin: 0 0 4px; font-size: 1.08rem; }
.steps p, .feats p, .bank p { margin: 0; color: var(--muted); }
.feats { display: grid; gap: 12px; margin-top: 18px; }
.bank { margin: 0; align-items: center; }
.bank-art { max-width: 420px; }
.land-close {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 28px;
  padding: 28px 22px 24px;
}
.land-close p { margin: 8px 0 0; max-width: 36rem; opacity: 0.88; }
.land-close a.primary { background: var(--accent-ink); color: var(--accent); }
.land-close .ghost-link { color: var(--accent-ink); font-weight: 700; padding: 10px 4px; }
.land-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
  padding: 4px 2px 12px;
}
@media (min-width: 840px) {
  .land-hero { grid-template-columns: 1.05fr 0.95fr; gap: 12px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .steps li { grid-template-columns: 1fr; }
  .feats { grid-template-columns: 1fr 1fr; }
  .bank { grid-template-columns: 0.9fr 1.1fr; padding: 22px; }
}
.spam-note {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}
.spam-note strong { display: block; }
.spam-note p { margin: 4px 0 0; }
.gate label { display: grid; gap: 6px; width: 100%; }
a.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}
button.out { min-height: 36px; padding: 0 12px; }
.feature h2 { margin: 0 0 6px; font-size: 1.2rem; }
.feature p { margin: 0; }
.hero h2 { margin: 0 0 8px; font-size: 1.8rem; line-height: 1.25; }
.hero p { margin: 0; }

/* (dashboard styles moved above) */

/* ── Improved Touch Targets ── */
@media (pointer: coarse) {
  button.primary, button.ghost, .chip, .option, .mini {
    min-height: 44px;
  }
  .subject-row, .leaf-row, .list-row {
    min-height: 56px;
  }
  .nav a {
    min-height: 52px;
  }
  .crumbs button {
    min-height: 44px;
  }
}

/* ── Active / Pressed States ── */
@media (hover: none) {
  .door:active {
    transform: translateY(1px);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  }
  .option:active:not(:disabled) {
    transform: translateY(0);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  }
  .subject-row:active, .leaf-row:active, .list-row:active,
  .row-card:active, .course-hero:active {
    background: color-mix(in srgb, var(--soft) 55%, var(--card));
  }
  button.primary:active:not(:disabled) {
    transform: scale(0.98);
  }
  button.ghost:active:not(:disabled), .chip:active {
    background: var(--soft);
  }
}

/* ── Improved Transitions ── */
.door, .course-hero, .subject-row, .leaf-row, .row-card {
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
button.primary, button.ghost, .chip {
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

/* ── Better Toast Mobile ── */
@media (max-width: 420px) {
  .toast {
    max-width: calc(100vw - 28px);
    font-size: 0.88rem;
    padding: 10px 14px;
  }
}

/* ── Better Dialog Mobile ── */
@media (max-width: 420px) {
  dialog {
    width: calc(100% - 24px);
    padding: 18px;
    border-radius: 18px;
  }
}

/* ── Smooth Scrolling for Lists ── */
.chart-scroll, .palette {
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

/* ── Auth Panel Mobile ── */
@media (max-width: 480px) {
  .auth-panel { padding: 22px 18px 20px; border-radius: 22px; }
  .gate h1 { font-size: 1.7rem; }
  .gate input, .gate textarea { min-height: 48px; padding: 10px 12px; border-radius: 12px; }
  .gate .primary { min-height: 48px; }
}

/* ── Better Option Button Mobile ── */
@media (max-width: 380px) {
  .option { padding: 12px 12px; gap: 10px; min-height: 50px; }
  .option .letter { width: 30px; height: 30px; border-radius: 10px; font-size: 0.92rem; }
  .stem { font-size: 1.15rem; }
}

/* ── Exam Rail Scroll on Small Screens ── */
@media (max-width: 380px) {
  .exam-rail, .desk-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .exam-rail::-webkit-scrollbar, .desk-tabs::-webkit-scrollbar { display: none; }
  .exam-rail .chip, .desk-tabs .chip { flex: 0 0 auto; white-space: nowrap; }
}

/* ── Improved Bands Grid Mobile ── */
@media (max-width: 380px) {
  .bands { grid-template-columns: 1fr; gap: 8px; }
  .bands div { padding: 12px; }
}

/* ── Make fixed-bottom bar friendlier for iPhone ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .make {
    bottom: calc(78px + env(safe-area-inset-bottom));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* ── Improved Explain Block ── */
.explain img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

/* ── Smooth Card Entrance ── */
@media (prefers-reduced-motion: no-preference) {
  .q-card {
    animation: card-enter 220ms ease both;
  }
  @keyframes card-enter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ── Selection Color ── */
::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ── Better Focus for Keyboard Nav ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Print Friendliness ── */
@media print {
  .nav, .dock, .make, .toast, .as-root { display: none !important; }
  .app { padding-bottom: 20px !important; }
  body { background: white !important; }
}

/* ── Admin Dashboard & Analytics ── */
.admin-kpis-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.admin-kpis-head h2 { margin: 0 0 4px; font-size: 1.5rem; }
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
.admin-chart-card {
  margin-top: 14px;
}
.admin-chart-card .card-head {
  margin-bottom: 14px;
}
.admin-chart-card h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}
.chart-wrap {
  position: relative;
  width: 100%;
}
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.84rem;
  color: var(--muted);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 14px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.chart-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.chart-svg {
  min-width: 100%;
  height: auto;
  overflow: visible;
}
.chart-bar {
  transition: opacity 140ms ease, filter 140ms ease;
  cursor: pointer;
}
.chart-group:hover .chart-bar, .chart-group:focus .chart-bar {
  opacity: 1 !important;
  filter: brightness(1.2);
}

/* ── Admin Student Row Actions ── */
.admin-student-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.icon-btn-del {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
  background: color-mix(in srgb, var(--bad) 8%, var(--card));
  color: var(--bad);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
  touch-action: manipulation;
}
.icon-btn-del:hover {
  background: var(--bad);
  color: #fff;
  border-color: var(--bad);
}
.icon-btn-del:active {
  transform: scale(0.96);
}
.ico-del {
  width: 15px;
  height: 15px;
}

/* ── Broadcast Message Card & Drawer ── */
.admin-broadcast-card {
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 4%, var(--card));
}
.admin-broadcast-card h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}
.broadcast-templates {
  margin: 12px 0 16px;
}
.broadcast-templates .chips {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.broadcast-form {
  display: grid;
  gap: 12px;
}
.broadcast-form .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.broadcast-form input, .broadcast-form textarea, .broadcast-form select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  outline: none;
}
.broadcast-form input:focus, .broadcast-form textarea:focus, .broadcast-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.broadcast-form .field-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}
.broadcast-form .field-inline select {
  max-width: 280px;
}
.admin-ann-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
}
.admin-ann-row .copy { flex: 1; }
.admin-ann-row strong { font-size: 1.02rem; }
.admin-ann-row p { margin: 4px 0 6px; font-size: 0.92rem; line-height: 1.5; color: var(--text); }

/* ── Student Dashboard Notice Banner ── */
.dash-notice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.05);
  animation: notice-drop 280ms ease both;
  transition: opacity 200ms ease, transform 200ms ease;
}
@keyframes notice-drop {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.dash-notice-info {
  background: color-mix(in srgb, #1e3a8a 10%, var(--card));
  border-color: color-mix(in srgb, #1e3a8a 35%, transparent);
}
.dash-notice-success {
  background: color-mix(in srgb, #059669 10%, var(--card));
  border-color: color-mix(in srgb, #059669 35%, transparent);
}
.dash-notice-warning {
  background: color-mix(in srgb, #d97706 10%, var(--card));
  border-color: color-mix(in srgb, #d97706 35%, transparent);
}
.dash-notice-icon {
  font-size: 1.35rem;
  line-height: 1.2;
  flex-shrink: 0;
}
.dash-notice-content {
  flex: 1;
  min-width: 0;
}
.dash-notice-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.dash-notice-head strong {
  font-size: 1.02rem;
  font-weight: 700;
}
.dash-notice-time {
  font-size: 0.78rem;
  color: var(--muted);
}
.dash-notice p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
}
.dash-notice-dismiss {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  transition: background 140ms ease, color 140ms ease;
  touch-action: manipulation;
}
.dash-notice-dismiss:hover {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text);
}

/* ── Mobile-Optimized Active Exam Player ── */
.in-exam {
  padding-bottom: calc(84px + env(safe-area-inset-bottom)) !important;
}
.in-exam .dock {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(688px, calc(100% - 16px));
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16);
}
.in-exam .dock button {
  min-height: 48px;
  font-size: 0.95rem;
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.in-exam .dock button:active {
  transform: scale(0.97);
}

/* ── Mobile Compact Sticky Reveal Bar ── */
@media (max-width: 640px) {
  .reveal-bar.sticky-reveal {
    position: sticky;
    top: 56px;
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--card) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  }
  .reveal-tick {
    padding: 6px 2px;
    justify-content: center;
    font-size: 0.8rem;
    gap: 5px;
    border-radius: 10px;
    min-height: 36px;
  }
  .reveal-tick input {
    width: 14px;
    height: 14px;
  }
}

/* ── Mobile Palette Accordion & Grid ── */
.palette-accordion {
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.palette-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
  min-height: 46px;
  touch-action: manipulation;
}
.palette-summary::-webkit-details-marker { display: none; }
.palette-accordion[open] .palette-summary {
  border-bottom: 1px solid var(--line);
}
.palette-summary .meta {
  font-size: 0.82rem;
  font-weight: 600;
}

/* Palette grid */
.palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px;
}
.mini {
  width: 100%;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 10px;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mini:active {
  transform: scale(0.92);
}

/* ── Brutally Mobile Friendly Exam Card & Options ── */
@media (max-width: 640px) {
  .q-card {
    padding: 16px 14px;
    border-radius: 18px;
    margin-bottom: 12px;
  }
  .stem {
    font-size: 1.15rem;
    line-height: 1.65;
    font-weight: 600;
  }
  .options {
    gap: 8px;
    margin-top: 14px;
  }
  .option {
    padding: 12px 14px;
    min-height: 52px;
    gap: 12px;
    border-radius: 14px;
    font-size: 1rem;
    align-items: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .option .letter {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    flex: 0 0 32px;
    display: grid;
    place-items: center;
  }
  .option:active:not(:disabled) {
    transform: scale(0.985);
  }
}

/* ── Prevent horizontal viewport blowout completely ── */
html, body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}
.app {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}


/* ══════════════════════════════════════════════════════════
   LIVE RADAR & IMMERSIVE ADMIN DASHBOARD STYLES
   ══════════════════════════════════════════════════════════ */

.admin-radar-card {
  margin-top: 14px;
  border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line));
  background: color-mix(in srgb, var(--ok) 3%, var(--card));
  position: relative;
  overflow: hidden;
}

.admin-radar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.radar-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-radar-pulse {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  position: relative;
  flex-shrink: 0;
}

.live-radar-pulse.has-online {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(14, 122, 69, 0.7);
  animation: radar-ping 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes radar-ping {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 122, 69, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(14, 122, 69, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 122, 69, 0);
  }
}

.radar-title-wrap h3 {
  margin: 0 0 2px;
  font-size: 1.25rem;
}

.radar-refresh-btn {
  font-size: 0.82rem;
  cursor: pointer;
  background: var(--elev);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 99px;
  transition: background 140ms ease, transform 140ms ease;
}

.radar-refresh-btn:hover {
  background: var(--soft);
}

.radar-refresh-btn:active {
  transform: scale(0.96);
}

/* ── Radar Surface Breakdown Bar ── */
.radar-surface-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--elev) 60%, transparent);
  border: 1px solid var(--line);
}

.radar-surface-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
}

.radar-surface-pill b {
  color: var(--accent);
}

/* ── Radar Cards Grid ── */
.admin-radar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.radar-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--elev);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 140ms ease, border-color 140ms ease;
}

.radar-card.active {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  box-shadow: 0 2px 10px color-mix(in srgb, var(--ok) 8%, transparent);
}

.radar-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.radar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.radar-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.radar-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000));
  color: var(--accent-ink, #ffffff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
}

.radar-beacon {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--card);
}

.radar-beacon.live {
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}

.radar-beacon.idle {
  background: var(--muted);
}

.radar-user-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.radar-user-name {
  font-size: 0.96rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.radar-user-email {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radar-view-btn {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 99px;
  text-decoration: none;
  flex-shrink: 0;
}

.radar-activity-bubble {
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 60%, var(--card));
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.radar-act-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.radar-act-badge {
  font-weight: 600;
  color: var(--accent);
}

.radar-time-pill {
  font-size: 0.74rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.live-dot-mini {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  display: inline-block;
  box-shadow: 0 0 5px var(--ok);
}

.radar-act-desc {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text);
}

.radar-act-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}

.radar-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ── Admin Students Section & Search / Filter Controls ── */
.admin-students-section {
  margin-top: 16px;
}

.admin-students-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-students-header h2 {
  margin: 0 0 4px;
  font-size: 1.4rem;
}

.admin-search-wrap {
  flex: 1;
  min-width: 240px;
  max-width: 360px;
}

.admin-search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.admin-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.admin-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.admin-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-sort-wrap {
  flex-shrink: 0;
}

.admin-sort-select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.admin-sort-select:focus {
  border-color: var(--accent);
}

/* ── Detailed Student Item Cards ── */
.student-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-item-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  transition: border-color 140ms ease, box-shadow 140ms ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.student-item-card.is-online {
  border-color: color-mix(in srgb, var(--ok) 40%, var(--line));
  box-shadow: 0 2px 10px color-mix(in srgb, var(--ok) 8%, transparent);
}

.student-item-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.student-item-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 260px;
}

.student-name-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.student-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.student-link {
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
}

.student-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.status-badge {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
}

.badge-approved {
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  color: var(--ok);
}

.badge-pending {
  background: color-mix(in srgb, var(--bad) 12%, transparent);
  color: var(--bad);
}

.badge-disabled {
  background: var(--elev);
  color: var(--muted);
  border: 1px solid var(--line);
}

.student-email-row {
  font-size: 0.82rem;
  color: var(--muted);
}

.student-live-doing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--ok);
  font-weight: 600;
  margin-top: 2px;
}

.live-dot-inline {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
  display: inline-block;
  flex-shrink: 0;
}

.student-last-doing {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.student-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.student-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 58px;
}

.student-stat-pill b {
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.2;
}

.student-stat-pill span {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

.student-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  flex-wrap: wrap;
}

.student-progress-bar {
  flex: 1;
  min-width: 140px;
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}

.student-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  border-radius: 99px;
}

.student-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-btn {
  padding: 4px 10px !important;
  font-size: 0.8rem !important;
  min-height: 32px !important;
  border-radius: 8px !important;
}

.mini-chip {
  font-size: 0.8rem !important;
  padding: 4px 10px !important;
  min-height: 32px !important;
  display: inline-flex !important;
  align-items: center !important;
}

@media (max-width: 640px) {
  .student-item-main {
    flex-direction: column;
    align-items: flex-start;
  }
  .student-stats-row {
    width: 100%;
    justify-content: space-between;
  }
  .student-stat-pill {
    flex: 1;
    min-width: 48px;
    padding: 4px 6px;
  }
  .student-item-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .student-item-actions {
    justify-content: flex-end;
  }
}

/* ── Per-User Direct Message & Personalized Dashboard Notice ── */
.dash-notice.is-personal-notice {
  border: 1px solid color-mix(in srgb, #f59e0b 55%, var(--line));
  background: color-mix(in srgb, #f59e0b 8%, var(--card));
  box-shadow: 0 4px 16px color-mix(in srgb, #f59e0b 12%, transparent);
}

.personal-notice-pill {
  background: #f59e0b;
  color: #1a1200;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  flex-shrink: 0;
}

.ann-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.ann-personal-badge {
  background: color-mix(in srgb, #f59e0b 16%, transparent);
  color: #d97706;
  border: 1px solid color-mix(in srgb, #f59e0b 35%, transparent);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
}

.ann-broadcast-badge {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
}

.ann-target-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  outline: none;
  cursor: pointer;
}

.ann-target-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn-personal-msg {
  background: color-mix(in srgb, var(--accent) 12%, var(--card)) !important;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)) !important;
  color: var(--accent) !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.btn-personal-msg:hover {
  background: var(--accent) !important;
  color: var(--accent-ink, #ffffff) !important;
}

.btn-personal-msg:active {
  transform: scale(0.96);
}

/* ── Dashboard Loading Skeleton ── */
.dash-loading-wrap {
  animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Security & Login Audit ── */
.security-alert-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, #ef4444 10%, var(--card));
  border: 1px solid color-mix(in srgb, #ef4444 35%, transparent);
  color: #b91c1c;
}
[data-theme="dark"] .security-alert-box {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.security-alert-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.security-alert-text strong {
  display: block;
  font-size: 0.96rem;
  margin-bottom: 4px;
}
.security-alert-text p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: inherit;
}

.student-ip-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.student-ip-chip.alert {
  background: color-mix(in srgb, #ef4444 14%, var(--card));
  color: #dc2626;
  border-color: color-mix(in srgb, #ef4444 35%, transparent);
}
[data-theme="dark"] .student-ip-chip.alert {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.audit-card {
  margin-top: 14px;
}
.audit-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.audit-card-head h2 {
  margin: 0;
}
.chip-alert {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid #fca5a5;
}
[data-theme="dark"] .chip-alert {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
}
.chip-safe {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid #86efac;
}
[data-theme="dark"] .chip-safe {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

.audit-ip-chips-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--elev);
  border: 1px solid var(--line);
}
.audit-ip-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.audit-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.audit-ip-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: monospace;
  font-weight: 600;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
}

.audit-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}
.audit-table th {
  padding: 10px 12px;
  background: var(--elev);
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.audit-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}
.audit-tr:last-child td {
  border-bottom: none;
}
.audit-tr.tr-suspended td {
  background: color-mix(in srgb, #ef4444 8%, var(--card));
}
.audit-td-time {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.8rem;
}
.audit-td-ip code {
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--elev);
  border: 1px solid var(--line);
}
.audit-td-device {
  font-size: 0.82rem;
}
.audit-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
}
.audit-status.ok {
  background: #dcfce7;
  color: #15803d;
}
.audit-status.failed {
  background: #fee2e2;
  color: #b91c1c;
}
.audit-status.suspended {
  background: #fef3c7;
  color: #b45309;
}
[data-theme="dark"] .audit-status.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}
[data-theme="dark"] .audit-status.failed {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
[data-theme="dark"] .audit-status.suspended {
  background: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

/* ── Support & Chat System ── */
.support-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.support-hero-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.support-hero-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.support-hero-icon {
  font-size: 2rem;
  line-height: 1;
}
.support-hero-content h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}
.support-hero-content p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
}
.support-email-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--elev);
  border: 1px solid var(--line);
  font-size: 0.86rem;
}
.support-mail-link {
  color: var(--accent);
  text-decoration: underline;
  font-size: 0.92rem;
}

.chat-card {
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  min-height: 480px;
}
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--elev);
}
.chat-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-title-group h3 {
  margin: 0;
  font-size: 1rem;
}
.online-pill {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ok);
}

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  background: color-mix(in srgb, var(--bg) 60%, var(--card));
}
.chat-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}
.chat-empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 10px;
}

.chat-msg {
  display: flex;
  max-width: 82%;
}
.chat-msg.msg-user {
  margin-left: auto;
  justify-content: flex-end;
}
.chat-msg.msg-admin {
  margin-right: auto;
  justify-content: flex-start;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.msg-user .chat-bubble {
  background: var(--accent);
  color: var(--accent-ink, #ffffff);
  border-bottom-right-radius: 4px;
}
.msg-admin .chat-bubble {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 0.74rem;
  opacity: 0.88;
}
.chat-sender {
  font-weight: 700;
}
.chat-time {
  font-size: 0.7rem;
}
.chat-text {
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-img-wrap {
  margin-top: 8px;
}
.chat-img-thumb {
  max-width: 220px;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: block;
  cursor: pointer;
  transition: transform 120ms ease;
}
.chat-img-thumb:hover {
  transform: scale(1.02);
}

.chat-form {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--card);
}
.chat-img-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--elev);
  border: 1px solid var(--line);
  font-size: 0.8rem;
}
.preview-label {
  font-weight: 700;
  color: var(--muted);
}
.preview-filename {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: monospace;
}
.preview-clear-btn {
  background: transparent;
  border: none;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--muted);
}
.preview-clear-btn:hover {
  color: #ef4444;
}

.chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-attach-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--elev);
  border: 1px solid var(--line);
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease;
}
.chat-attach-btn:hover {
  background: color-mix(in srgb, var(--accent) 15%, var(--elev));
}
.chat-text-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  outline: none;
  resize: none;
}
.chat-text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.chat-send-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ── Admin Support Layout ── */
.admin-support-container {
  padding: 0 !important;
  overflow: hidden;
}
.admin-support-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 600px;
}
@media (max-width: 768px) {
  .admin-support-layout {
    grid-template-columns: 1fr;
  }
}
.admin-threads-sidebar {
  border-right: 1px solid var(--line);
  background: var(--elev);
  display: flex;
  flex-direction: column;
}
.threads-sidebar-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.threads-sidebar-head h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}
.threads-sidebar-head .muted {
  font-size: 0.78rem;
}
.threads-list {
  flex: 1;
  overflow-y: auto;
  max-height: 560px;
}
.admin-thread-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background 120ms ease;
}
.admin-thread-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--elev));
}
.admin-thread-item.selected {
  background: color-mix(in srgb, var(--accent) 15%, var(--card));
  border-left: 3px solid var(--accent);
}
.thread-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.thread-user-name {
  font-size: 0.88rem;
}
.thread-time {
  font-size: 0.74rem;
  color: var(--muted);
}
.thread-item-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.thread-last-msg {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}
.thread-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
}
.thread-email {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-status-badge {
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.thread-status-badge.open {
  background: #fef3c7;
  color: #b45309;
}
.thread-status-badge.resolved {
  background: #dcfce7;
  color: #15803d;
}

.admin-chat-pane {
  display: flex;
  flex-direction: column;
  background: var(--card);
}
.admin-chat-pane.empty-pane {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.empty-hint {
  text-align: center;
  max-width: 320px;
}
.admin-chat-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--elev);
}
.admin-chat-pane-head h3 {
  margin: 0 0 2px;
  font-size: 1rem;
}
.admin-chat-pane-head .muted {
  font-size: 0.8rem;
}
.chip-resolve {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
  font-weight: 700;
}
.chip-open {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
  font-weight: 700;
}

/* ── Announcement Channel Badges ── */
.ann-channel-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 6px;
}
.ann-channel-badge.dash {
  background: #e0f2fe;
  color: #0369a1;
}
.ann-channel-badge.mail {
  background: #fef3c7;
  color: #92400e;
}
.ann-channel-badge.both {
  background: #f3e8ff;
  color: #7e22ce;
}

/* ── Domain Alert Banner for Landing ── */
.domain-alert-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, var(--card)), color-mix(in srgb, var(--accent) 26%, var(--card)));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 24px;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}
