/* CSS Buddy web portal — the phone app's own world on a bigger screen:
   blue canvas, navy top bar and drawer, gold accents, the hero banner,
   illustrated menu cards, navy stat/progress bands over light sheets of
   white cards. Cards and elements are refreshed (hairline rings + soft
   ambient shadow, never one-sided stripes); the layout is the app's. */

:root {
  color-scheme: light;
  /* The phone app's palette (src/screens, src/theme/colors.js). */
  --blue:      #1565C0;
  --navy:      #0D47A1;
  --navy-2:    #0B3D8C;
  --sky:       #1AA3E8;
  --gold:      #FFB300;
  --gold-ink:  #6B4A00;
  --sheet:     #F5F7FA;
  --card:      #FFFFFF;
  --ink:       #0D1F3C;
  --ink-2:     #3F5268;
  --ink-3:     #5F7184;
  --faint:     #90A4AE;
  --tint:      #E3F2FD;
  --line:      rgba(13, 31, 60, 0.08);
  --line-2:    rgba(13, 31, 60, 0.14);
  --on-dark:   #FFFFFF;
  --on-dark-2: rgba(255, 255, 255, 0.74);
  --on-dark-3: rgba(255, 255, 255, 0.75);
  --glass:     rgba(255, 255, 255, 0.08);
  --glass-2:   rgba(255, 255, 255, 0.14);

  --green: #43A047;  --green-ink: #1E7B34; --green-soft: #E7F5E8;
  --purple: #7E57C2; --purple-soft: #EFE9F8;
  --teal: #00ACC1;   --teal-ink: #00798A; --teal-soft: #E0F6F9;
  --orange: #FB8C00; --orange-ink: #A35600; --orange-soft: #FFF1DD;
  --red: #E53935;    --red-ink: #B42318; --red-soft: #FDECEA;

  /* Status aliases used inline by the views. */
  --ok: var(--green-ink); --bad: var(--red-ink); --warn: var(--orange-ink);
  --brand: var(--blue); --brand-soft: var(--tint);

  --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 22px;
  --shadow-card: 0 0 0 1px var(--line), 0 1px 2px rgba(13, 31, 60, 0.04), 0 10px 24px -14px rgba(13, 31, 60, 0.28);
  --shadow-lift: 0 0 0 1px var(--line), 0 18px 40px -18px rgba(13, 31, 60, 0.4);
  --shadow-dark: 0 12px 30px -16px rgba(4, 18, 52, 0.6);
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --drawer-w: 268px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--blue); color: var(--ink);
  /* The phone app renders in the platform's own UI font; so does the web. */
  font: 400 15px/1.55 system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.teacher-world, body.admin-world { background: var(--navy); }
h1, h2, h3, h4 { margin: 0; font-weight: 750; letter-spacing: -0.01em; text-wrap: balance; color: inherit; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 17px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; }
p { margin: 0; }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(255, 179, 0, 0.35); color: var(--ink); }
input, textarea { caret-color: var(--blue); }
.tabular, .num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
* { scrollbar-width: thin; scrollbar-color: rgba(13, 31, 60, 0.22) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(13, 31, 60, 0.2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Icons ─────────────────────────────────────────────── */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 22px; height: 22px; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 14px; white-space: nowrap; text-decoration: none;
  background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line-2);
  transition: background .25s var(--ease), box-shadow .25s var(--ease), transform .18s var(--ease), color .2s;
}
.btn:hover { background: #F2F6FB; }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 2px rgba(13,31,60,.18), inset 0 1px 0 rgba(255,255,255,.14); }
.btn-primary:hover { background: var(--navy); }
.btn-gold { background: var(--gold); color: var(--gold-ink); box-shadow: 0 1px 2px rgba(13,31,60,.18), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-gold:hover { background: #F2A600; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: #EEF2F7; color: var(--ink); }
.btn-danger { color: var(--red-ink); }
.btn-danger:hover { background: var(--red-soft); }
.btn-danger-solid { background: var(--red); color: #fff; box-shadow: none; }
.btn-danger-solid:hover { background: #C62828; }
.btn-sm { height: 32px; padding: 0 13px; font-size: 13px; gap: 6px; }
.btn-block { width: 100%; }
.btn-island { padding: 0 6px 0 20px; height: 44px; }
.btn-island .knob { width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center; background: rgba(255,255,255,.2); transition: transform .35s var(--ease); }
.btn-island:hover .knob { transform: translateX(2px) scale(1.05); }
.on-dark .btn { background: var(--glass-2); color: #fff; box-shadow: none; }
.on-dark .btn:hover { background: rgba(255,255,255,.22); }
.on-dark .btn-gold { background: var(--gold); color: var(--gold-ink); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 0; background: transparent; cursor: pointer;
  display: inline-grid; place-items: center; color: var(--ink-3); text-decoration: none;
  transition: background .2s var(--ease), color .2s;
}
.icon-btn:hover { background: #EEF2F7; color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red-ink); }

/* ── Fields ────────────────────────────────────────────── */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.field small, .hint { font-size: 12.5px; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; border: 0; border-radius: var(--r-md); background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-2); padding: 10px 13px; font-size: 14.5px; line-height: 1.45;
  transition: box-shadow .2s var(--ease);
}
.input, .select { height: 44px; }
.textarea { min-height: 110px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: #6E7F8F; }
.input:hover, .select:hover, .textarea:hover { box-shadow: inset 0 0 0 1px rgba(13,31,60,.26); }
.input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--blue), 0 0 0 4px rgba(21,101,192,.14); }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235F7184' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
.form-error { color: var(--red-ink); font-size: 13.5px; margin: -4px 0 12px; }

/* ── Pills ─────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 750; background: #EEF2F7; color: var(--ink-2); white-space: nowrap; }
.pill-brand { background: var(--tint); color: var(--blue); }
.pill-ok { background: var(--green-soft); color: var(--green-ink); }
.pill-warn { background: var(--orange-soft); color: var(--orange-ink); }
.pill-bad { background: var(--red-soft); color: var(--red-ink); }
.pill-gold { background: rgba(255,179,0,.18); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(255,179,0,.35); }

/* ── Shell: drawer + top bar ───────────────────────────── */
.shell { min-height: 100dvh; display: grid; grid-template-columns: var(--drawer-w) minmax(0, 1fr); }
.drawer {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto; z-index: 30;
  background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 18px 12px 16px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.08);
}
.drawer-me { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; }
.ring-avatar { width: 48px; height: 48px; border-radius: 999px; display: grid; place-items: center; flex: none;
  background: var(--glass-2); box-shadow: inset 0 0 0 2px var(--gold); color: #fff; font-weight: 800; font-size: 15px; }
.drawer-name { font-weight: 800; font-size: 15px; line-height: 1.25; }
.drawer-role { margin-top: 5px; }
.drawer-close { display: none; margin-left: auto; color: #fff; }
.drawer-close:hover { background: var(--glass-2); color: #fff; }
.drawer-divider { height: 1px; background: rgba(255,255,255,.12); margin: 0 8px 8px; }
.nav { display: grid; gap: 2px; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: .02em; color: var(--on-dark-3); padding: 12px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: var(--on-dark-2);
  text-decoration: none; font-weight: 550; font-size: 14.5px; transition: background .2s var(--ease), color .2s; }
.nav a .tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--glass); transition: background .25s var(--ease), color .25s; }
.nav a:hover { background: var(--glass); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.12); color: #fff; font-weight: 750; }
.nav a[aria-current="page"] .tile { background: var(--gold); color: var(--navy); }
.nav a .count { margin-left: auto; font-size: 11.5px; font-weight: 800; color: var(--navy); background: var(--gold); border-radius: 99px; padding: 1px 8px; }
.drawer-foot { margin-top: auto; padding: 14px 6px 0; }
.signout { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 14px; border: 0; cursor: pointer;
  border-radius: 12px; background: rgba(239, 83, 80, .14); color: #FFB4B2; font-weight: 700; font-size: 14px; transition: background .2s var(--ease); }
.signout:hover { background: rgba(239, 83, 80, .24); }
.drawer-foot small { display: block; text-align: center; margin-top: 12px; color: var(--on-dark-3); font-size: 11.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  min-height: 60px; padding: 8px 18px; background: var(--navy); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.1);
}
.topbar-center { text-align: center; min-width: 0; }
.topbar-title { font-size: 17px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 11.5px; color: var(--on-dark-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ring-avatar { width: 38px; height: 38px; font-size: 13px; text-decoration: none; justify-self: end; }
.menu-btn { color: #fff; visibility: hidden; }
.menu-btn:hover { background: var(--glass-2); color: #fff; }
.burger { position: relative; width: 20px; height: 14px; }
.burger span { position: absolute; left: 0; width: 20px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .4s var(--ease), opacity .2s; }
.burger span:nth-child(1) { top: 0; } .burger span:nth-child(2) { top: 6px; } .burger span:nth-child(3) { top: 12px; }
.nav-open .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-open .burger span:nth-child(2) { opacity: 0; }
.nav-open .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.scrim { display: none; }

.view { width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 24px 48px; }

/* ── Navy band (stats + progress) over a light sheet ───── */
.band { background: var(--navy); color: #fff; border-radius: var(--r-xl); padding: 14px; box-shadow: var(--shadow-dark); }
.teacher-world .band, .admin-world .band { background: var(--blue); }
.stat-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: rgba(0,0,0,.14); border-radius: 16px; padding: 12px 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.stat { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-width: 0; }
.stat + .stat { box-shadow: inset 1px 0 0 rgba(255,255,255,.14); }
.stat .tile { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat b { display: block; font-size: 18px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: 11.5px; color: var(--on-dark-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-blue { background: rgba(30,136,229,.28); color: #9CD0FF; }
.tile-green { background: rgba(67,160,71,.28); color: #A5E3A8; }
.tile-gold { background: rgba(255,179,0,.24); color: var(--gold); }
.tile-red { background: rgba(229,57,53,.26); color: #FFB4B2; }
.tile-purple { background: rgba(126,87,194,.32); color: #D4C2F5; }
.tile-teal { background: rgba(0,172,193,.28); color: #9EEAF4; }
.band-progress { padding: 12px 6px 2px; }
.band-progress .row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 7px; }
.band-progress .lbl { font-size: 12.5px; font-weight: 750; }
.band-progress .frac { font-size: 12px; color: var(--on-dark-2); font-variant-numeric: tabular-nums; }
.band .bar { background: rgba(255,255,255,.14); height: 7px; }
.band .bar > i { background: var(--gold); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 9px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--on-dark-2); }
.legend i { width: 8px; height: 8px; border-radius: 99px; }
.band-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding: 12px 4px 2px; }
.sheet { background: var(--sheet); border-radius: var(--r-xl); padding: 18px; margin-top: 16px; box-shadow: var(--shadow-dark); }
.sheet-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 12px; }
.sheet-title h2 { font-size: 16px; }
.sheet-title .link { font-size: 13px; font-weight: 750; text-decoration: none; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* ── Cards ─────────────────────────────────────────────── */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card + .card { margin-top: 14px; }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-head h2 { font-size: 15.5px; }
.card-head .link { font-size: 13px; font-weight: 750; text-decoration: none; }
.card-body { padding: 12px 18px 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.grid-main > *, .split > *, .stack > * { min-width: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.stack > .card + .card { margin-top: 0; }
.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.section-label { color: #fff; font-size: 15px; font-weight: 800; margin: 20px 2px 10px; display: flex; justify-content: space-between; align-items: center; }
.section-label a { color: var(--gold); font-size: 12.5px; text-decoration: none; }

/* ── Lists & tables ────────────────────────────────────── */
.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 18px; text-decoration: none; color: inherit; }
.list-item + .list-item { box-shadow: inset 0 1px 0 #EEF2F6; }
a.list-item, button.list-item { transition: background .2s var(--ease); }
a.list-item:hover, button.list-item:hover { background: #F7FAFD; }
button.list-item { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.li-icon { width: 40px; height: 40px; border-radius: 12px; background: #EEF2F7; color: var(--ink-2); display: grid; place-items: center; flex: none; }
.li-icon.brand { background: var(--tint); color: var(--blue); }
.li-icon.ok { background: var(--green-soft); color: var(--green-ink); }
.li-icon.warn { background: var(--orange-soft); color: var(--orange-ink); }
.li-icon.bad { background: var(--red-soft); color: var(--red-ink); }
.li-icon.purple { background: var(--purple-soft); color: var(--purple); }
.li-icon.teal { background: var(--teal-soft); color: var(--teal-ink); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-end { display: flex; align-items: center; gap: 8px; flex: none; color: var(--faint); }
.avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--tint); color: var(--blue); display: grid; place-items: center; font-weight: 800; font-size: 12.5px; flex: none; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 750; color: var(--ink-3); padding: 12px 14px; white-space: nowrap; background: #F7F9FC; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table td { padding: 12px 14px; box-shadow: inset 0 1px 0 #EEF2F6; vertical-align: middle; }
.table tr:hover td { background: #FAFCFE; }
.table .actions { display: flex; justify-content: flex-end; gap: 2px; }
.cell-strong { font-weight: 700; }
.cell-sub { font-size: 12.5px; color: var(--ink-3); }

/* ── Progress bits ─────────────────────────────────────── */
.bar { height: 6px; border-radius: 99px; background: #E0E7EF; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--blue); transform-origin: left; transform: scaleX(var(--v, 0)); transition: transform 1s var(--ease); }
.bar.ok > i { background: var(--green); }
.bar.gold > i { background: var(--gold); }
.steps { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.step .dot { width: 16px; height: 16px; border-radius: 99px; display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px #CFD8DC; color: currentColor; }
.step .dot .i { width: 10px; height: 10px; stroke-width: 2.6; }
.step.done .dot { box-shadow: none; color: #fff; }
.step.read.done { color: var(--green-ink); } .step.read.done .dot { background: var(--green); }
.step.act.done { color: var(--purple); } .step.act.done .dot { background: var(--purple); }
.step.quiz.done { color: var(--teal-ink); } .step.quiz.done .dot { background: var(--teal); }

/* ── Tabs & chips ──────────────────────────────────────── */
.tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.16); max-width: 100%; overflow-x: auto; }
.tabs button { height: 34px; padding: 0 15px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--on-dark-2); white-space: nowrap; transition: background .25s var(--ease), color .2s; }
.tabs button:hover { color: #fff; }
.tabs button[aria-selected="true"] { background: var(--gold); color: var(--navy); }
.sheet .tabs { background: #E6ECF3; }
.sheet .tabs button { color: var(--ink-2); }
.sheet .tabs button:hover { color: var(--ink); }
.sheet .tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(13,31,60,.12); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 13px; border-radius: 999px; border: 0; cursor: pointer; font-size: 12.5px; font-weight: 650; background: var(--tint); color: var(--blue); transition: background .2s var(--ease); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { background: #D3E8FC; }

/* ── Empty & loading ───────────────────────────────────── */
.empty { text-align: center; padding: 40px 22px; color: var(--ink-3); }
.empty .li-icon { margin: 0 auto 12px; width: 48px; height: 48px; border-radius: 16px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.empty p { max-width: 42ch; margin: 0 auto; font-size: 13.5px; }
.empty .btn { margin-top: 14px; }
.skeleton { border-radius: var(--r-xl); background: linear-gradient(90deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.16) 50%, rgba(255,255,255,.08) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Student home: hero, progress, menu cards ──────────── */
.hero { position: relative; height: 196px; border-radius: var(--r-xl); background: var(--sky); overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: 100%; align-items: end; box-shadow: var(--shadow-dark); }
.hero-deco { position: absolute; inset: 0; pointer-events: none; }
.hero-deco .dot-t { position: absolute; border-radius: 99px; background: #fff; }
.hero-deco svg { position: absolute; color: var(--gold); }
/* Fixed heights keep the single grid row at the banner height, so both
   pictures sit on its bottom edge the way the app crops them. */
.hero-model { position: relative; height: 176px; width: auto; margin: 0 0 -22px 24px; filter: drop-shadow(0 6px 10px rgba(4,18,52,.22)); }
.hero-text { position: relative; align-self: center; transform: rotate(-6deg); padding: 0 6px; min-width: 0; }
.hero-text span { display: block; color: #fff; font-weight: 800; font-size: clamp(18px, 2.4vw, 30px); line-height: 1.05; }
.hero-text b { display: block; color: var(--gold); font-weight: 900; font-size: clamp(20px, 2.8vw, 36px); line-height: 1.2; }
.hero-unit { position: relative; height: 236px; width: auto; margin: 0 22px -74px 0; }
.home-progress { margin-top: 14px; background: rgba(0,0,0,.15); border-radius: var(--r-md); padding: 13px 16px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); color: #fff; }
.home-progress .row-between { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 12.5px; }
.home-progress .row-between span { color: var(--on-dark-2); }
.home-progress .row-between b { color: var(--gold); font-variant-numeric: tabular-nums; }
.home-progress .bar { background: rgba(255,255,255,.2); }
.home-progress .bar > i { background: var(--gold); }
.home-progress .next { display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; color: #fff; font-size: 13px; font-weight: 700; text-decoration: none; }
.home-progress .next:hover { color: var(--gold); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; margin-top: 16px; align-items: start; }
.menu-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; }
.menu-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-lg); background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-card); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.menu-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.menu-card .art { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; flex: none; background: var(--art-bg, #F1F5F9); }
.menu-card .art img { width: 48px; height: 48px; object-fit: contain; }
.menu-card .txt { flex: 1; min-width: 0; }
.menu-card .txt b { display: block; font-size: 16px; font-weight: 800; }
.menu-card .txt span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); margin-top: 1px; }
.menu-card .go { width: 34px; height: 34px; border-radius: 99px; display: grid; place-items: center; color: #fff; background: var(--go, var(--blue)); flex: none; transition: transform .35s var(--ease); }
.menu-card:hover .go { transform: translateX(3px); }
.home-due { margin-top: 12px; }

/* ── Teacher home ──────────────────────────────────────── */
.welcome { position: relative; overflow: hidden; border-radius: var(--r-xl); background: var(--blue); color: #fff; padding: 22px; box-shadow: var(--shadow-dark), inset 0 0 0 1px rgba(255,255,255,.12); }
.welcome h1 { font-size: 27px; font-weight: 900; margin: 2px 0 6px; position: relative; display: flex; gap: 8px; align-items: center; }
.welcome h1 .i { color: var(--gold); width: 20px; height: 20px; }
.welcome p { color: var(--on-dark-2); font-size: 13px; position: relative; }
.welcome-stats { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin-top: 18px; padding-top: 16px; box-shadow: inset 0 1px 0 rgba(255,255,255,.14); }
.welcome-stats div { text-align: center; }
.welcome-stats div + div { box-shadow: inset 1px 0 0 rgba(255,255,255,.14); }
.welcome-stats b { display: block; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.welcome-stats span { font-size: 11.5px; font-weight: 600; color: var(--on-dark-2); }
.actions-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.action { display: grid; justify-items: center; gap: 8px; padding: 14px 8px; border-radius: var(--r-md); background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow-card); font-size: 12px; font-weight: 750; text-align: center; transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.action:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.action .art { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: var(--art-bg); }
.action .art img { width: 32px; height: 32px; object-fit: contain; }

/* ── Lesson timeline ───────────────────────────────────── */
.timeline { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.tl-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 10px; position: relative; }
.tl-row::before { content: ''; position: absolute; left: 22px; top: 44px; bottom: -14px; width: 3px; border-radius: 2px; background: var(--c, #D6DEE8); opacity: .55; }
.tl-row:last-child::before { display: none; }
.tl-badge { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 800; font-size: 13px; box-shadow: 0 0 0 3px #fff, 0 4px 10px -4px rgba(13,31,60,.4); position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.tl-row.locked .tl-badge { background: var(--faint); }
.tl-card { display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; border-radius: var(--r-lg); background: #fff; box-shadow: var(--shadow-card); text-decoration: none; color: var(--ink); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
a.tl-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tl-row.locked .tl-card { background: #FAFBFD; }
.tl-body { flex: 1; min-width: 0; }
.tl-body .t { font-weight: 750; font-size: 14.5px; line-height: 1.3; }
.tl-body .m { font-size: 11.5px; color: var(--ink-3); margin: 2px 0 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-body .bar { height: 5px; max-width: 360px; }
.tl-body .bar > i { background: var(--c); }
.tl-body .meta-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.tl-body .frac { font-size: 11px; font-weight: 750; color: var(--ink-3); }
.status-tile { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; align-content: center; gap: 1px; color: #fff; flex: none; font-size: 11px; font-weight: 800; background: var(--s, var(--green)); }
.status-tile .i { width: 18px; height: 18px; stroke-width: 2.2; }

/* ── Ask Buddy chat ────────────────────────────────────── */
/* Sized to its content (capped), so the chips and input sit right under
   the last message instead of below a blank stretch. */
.chat { display: flex; flex-direction: column; max-height: min(620px, calc(100dvh - 120px)); }
.chat-thread { min-height: 120px; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; }
.chat-head .li-icon { border-radius: 999px; }
.chat-head h2 { font-size: 16px; font-weight: 800; }
.chat-head p { font-size: 12px; color: var(--ink-3); }
.chat-topics { padding: 0 18px 10px; }
.chat-topics .select { height: 38px; font-size: 13.5px; border-radius: 999px; }
.chat-thread { flex: 1; overflow-y: auto; padding: 4px 18px 12px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-bot { align-self: flex-start; background: #F1F4F8; color: #263238; border-bottom-left-radius: 5px; }
.msg-me { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 5px; }
.msg .msg-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 750; text-decoration: none; }
.msg .msg-options { display: grid; gap: 6px; margin-top: 10px; }
.msg .msg-options button { text-align: left; border: 0; cursor: pointer; padding: 8px 11px; border-radius: 10px; background: #fff; color: var(--blue); font-size: 13px; font-weight: 650; box-shadow: 0 0 0 1px var(--line); }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing i { width: 6px; height: 6px; border-radius: 99px; background: var(--faint); animation: blink 1s infinite var(--ease); }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .35; transform: translateY(-2px); } }
.chat-suggest { padding: 0 18px 10px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.chat-suggest::-webkit-scrollbar { display: none; }
.chat-suggest .chip { flex: none; max-width: 260px; }
.chat-input { display: flex; gap: 8px; align-items: center; margin: 0 14px 14px; padding: 4px 4px 4px 16px; border-radius: 999px; background: #F1F4F8; }
.chat-input:focus-within { box-shadow: inset 0 0 0 1.5px var(--blue); background: #fff; }
.chat-input input { flex: 1; border: 0; background: transparent; outline: none; font-size: 14.5px; min-width: 0; height: 38px; }
.chat-input input::placeholder { color: #6E7F8F; }
.chat-input .btn { width: 40px; height: 40px; padding: 0; }

/* ── Lesson reader ─────────────────────────────────────── */
.reader h2 { font-size: 19px; margin: 26px 0 10px; color: var(--ink); }
.reader h2:first-child { margin-top: 0; }
.reader h3 { font-size: 16px; margin: 20px 0 8px; color: var(--blue); }
.reader p { margin: 0 0 14px; color: #33475B; font-size: 15.5px; line-height: 1.7; max-width: 72ch; }
.reader ul { margin: 0 0 16px; padding-left: 20px; color: #33475B; line-height: 1.7; max-width: 72ch; }
.reader img { max-width: 100%; border-radius: var(--r-md); margin: 6px 0 4px; }
.reader figcaption { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); background: #FFF6E0; color: #5A4300; margin: 0 0 16px; font-size: 14.5px; line-height: 1.6; max-width: 72ch; }
.callout .i { color: #C98A00; margin-top: 2px; }
.objectives { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.objectives li { display: flex; gap: 10px; font-size: 14.5px; color: #33475B; }
.objectives .i { color: var(--green); margin-top: 3px; }
.lesson-steps { display: grid; }
.lesson-step { display: flex; gap: 12px; padding: 13px 0; align-items: flex-start; }
.lesson-step + .lesson-step { box-shadow: inset 0 1px 0 #EEF2F6; }
.lesson-step .n { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: #EEF2F7; color: var(--ink-2); flex: none; }
.lesson-step.done .n { background: var(--green); color: #fff; }
.lesson-step.current .n { background: var(--gold); color: var(--navy); }

/* ── Quiz runner ───────────────────────────────────────── */
.quiz-q { font-size: 18px; font-weight: 700; margin: 8px 0 18px; line-height: 1.45; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); border: 0; cursor: pointer; text-align: left; background: #fff; box-shadow: inset 0 0 0 1.5px #E0E7EF; font-size: 15px; transition: box-shadow .2s var(--ease), background .2s; }
.choice:hover { box-shadow: inset 0 0 0 1.5px #B9C7D6; }
.choice .key { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: #EEF2F7; color: var(--ink-2); flex: none; }
.choice[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--blue); background: var(--tint); }
.choice[aria-pressed="true"] .key { background: var(--blue); color: #fff; }
.choice.right { box-shadow: inset 0 0 0 2px var(--green); background: var(--green-soft); }
.choice.wrong { box-shadow: inset 0 0 0 2px var(--red); background: var(--red-soft); }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; font-weight: 600; }
.feedback.ok { background: var(--green-soft); color: var(--green-ink); }
.feedback.bad { background: var(--red-soft); color: var(--red-ink); }
.score-ring { font-size: 56px; font-weight: 900; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }

/* ── Dialog / toast ────────────────────────────────────── */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-xl); background: #fff; color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); box-shadow: 0 30px 70px -20px rgba(4,18,52,.55); overflow: hidden; }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(6, 24, 64, 0.5); backdrop-filter: blur(3px); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; background: var(--navy); color: #fff; }
.modal-head h2 { font-size: 17px; font-weight: 800; }
.modal-head .icon-btn { color: #fff; }
.modal-head .icon-btn:hover { background: var(--glass-2); color: #fff; }
.modal-body { padding: 18px 20px 8px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.toasts { position: fixed; z-index: 100; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 18px 11px 13px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 16px 36px -14px rgba(4,18,52,.7); pointer-events: auto; max-width: calc(100vw - 32px); }
.toast.ok .i { color: var(--gold); } .toast.bad .i { color: #FFB4B2; }

/* ── Block editor ──────────────────────────────────────── */
.blocks { display: grid; gap: 10px; }
.block { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px; align-items: start; padding: 10px; border-radius: var(--r-md); background: var(--sheet); }
.block .textarea { min-height: 70px; }
.block .select, .block .input { height: 40px; }
.block-tools { display: flex; flex-direction: column; gap: 2px; }

/* ── Login (the app's circuit backdrop) ────────────────── */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 32px 18px;
  /* A navy tint keeps the white identity text readable on the pale centre. */
  background: linear-gradient(rgba(13,71,161,.84), rgba(13,71,161,.74)), #7DB8E0 url('../assets/img/tech-bg.jpg') center / cover no-repeat; }
.identity { text-align: center; color: #fff; margin-bottom: 24px; text-shadow: 0 1px 3px rgba(4,18,52,.35); }
.identity h1 { font-size: 28px; font-weight: 850; letter-spacing: -0.01em; }
.identity .grade { font-size: 13px; color: rgba(255,255,255,.92); margin-top: 4px; }
.login-card { width: min(420px, 100%); background: #fff; border-radius: var(--r-xl); padding: 26px 24px 22px; box-shadow: 0 30px 60px -24px rgba(4,30,80,.55), 0 0 0 1px rgba(255,255,255,.6); }
.login-card .field > span { letter-spacing: .06em; font-size: 11.5px; }
.with-icon { position: relative; }
.with-icon > .i { position: absolute; left: 13px; top: 13px; color: var(--faint); }
.with-icon .input { padding-left: 40px; }
.with-icon .icon-btn { position: absolute; right: 4px; top: 4px; }
.forgot { display: flex; justify-content: flex-end; margin: -4px 0 16px; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 700; font-size: 13px; cursor: pointer; }
.login-btn { height: 48px; font-size: 15px; letter-spacing: .06em; }
.login-foot { text-align: center; color: #fff; font-size: 12px; margin-top: 18px; text-shadow: 0 1px 2px rgba(4,18,52,.35); }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1180px) {
  .grid-main, .home-grid { grid-template-columns: minmax(0, 1fr); }
  .actions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .drawer { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-104%); transition: transform .45s var(--ease); box-shadow: 14px 0 40px -12px rgba(4,18,52,.45); }
  .nav-open .drawer { transform: none; }
  .drawer-close { display: inline-grid; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(4,18,52,.45); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { visibility: visible; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .view { padding: 12px 12px 40px; }
  .topbar { padding: 6px 10px; }
  .sheet { padding: 12px; border-radius: 20px; }
  .band { padding: 10px; border-radius: 20px; }
  .stat { flex-direction: column; text-align: center; gap: 4px; padding: 0 4px; }
  .stat .tile { width: 30px; height: 30px; }
  .stat b { font-size: 16px; }
  .stat span { font-size: 10.5px; }
  .hero { height: 175px; border-radius: 18px; }
  .hero-model { height: 150px; margin: 0 0 -18px 8px; }
  .hero-text span, .hero-text b { font-size: 16px; }
  .hero-text b { line-height: 1.6; }
  .hero-unit { height: 160px; margin: 0 -70px -54px 0; }
  .menu-cards { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .list-item .li-sub { white-space: normal; }
  .menu-card .art { width: 58px; height: 58px; }
  .actions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .block { grid-template-columns: 1fr; }
  .block-tools { flex-direction: row; }
  .list-item { padding: 12px 14px; }
  .card-head { padding: 14px 14px 0; } .card-body { padding: 10px 14px 14px; } .card-pad { padding: 16px; }
  .table th:first-child, .table td:first-child { padding-left: 14px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .tl-row { grid-template-columns: 42px minmax(0, 1fr); }
  .tl-badge { width: 40px; height: 40px; border-radius: 13px; }
  .tl-row::before { left: 19px; top: 40px; }
  .status-tile { width: 46px; height: 46px; }
  .identity h1 { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
