/* ===========================================================================
   Solex - student area, admin panel and login, v3 design
   Loaded after app.css on every page whose chrome is app, admin or bare (the
   login). Public pages never load it. All the behaviour-carrying rules in
   app.css (player, watermark, reader, toolbar) are left alone; this file
   changes surfaces, layout and type.

   1. tokens        4. dashboard and classroom   7. admin components
   2. shell         5. player and lesson rail     8. login
   3. components    6. quiz, progress, account    9. responsive
   =========================================================================== */

/* ---------- 1. tokens ------------------------------------------------------ */
html:is([data-chrome="app"], [data-chrome="admin"], [data-chrome="bare"]) {
  --bg: #070c17; --bg-2: #0b1322; --panel: #0f192c; --panel-2: #142139;
  --line: #1e2d48; --line-soft: #16233a;
  --ink: #e9f0f8; --ink-2: #aebdd1; --dim: #7f92ab;
  --head-bg: rgba(7, 12, 23, .85);
  --card-hover: #2c4772; --row-hover: rgba(255,255,255,.025);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow: 0 16px 36px -14px rgba(0,0,0,.6);
  --ok: #3ac07a;
  --side-bg: #050b18; --side-ink: rgba(226,236,250,.72); --side-line: rgba(255,255,255,.07);
  --btn: color-mix(in srgb, var(--brand-2) 86%, #000); --btn-hover: var(--brand-2);
  --focus: color-mix(in srgb, var(--brand) 35%, transparent);
  --radius: 14px; --radius-sm: 10px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Plus Jakarta Sans", "Inter", -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  html:is([data-chrome="app"], [data-chrome="admin"], [data-chrome="bare"]):not([data-theme="dark"]) {
    --bg: #f4f6fa; --bg-2: #eef2f7; --panel: #ffffff; --panel-2: #f5f7fb;
    --line: #e2e8f0; --line-soft: #edf1f6;
    --ink: #0b1526; --ink-2: #46566c; --dim: #6b7b91;
    --head-bg: rgba(255,255,255,.9);
    --card-hover: #c5d3e5; --row-hover: rgba(11,21,38,.025);
    --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.07);
    --shadow: 0 14px 32px -14px rgba(15,35,70,.22);
    --ok: #158a4f;
    color-scheme: light;
  }
  html:is([data-chrome="app"], [data-chrome="admin"]):not([data-theme="dark"]) .theme-btn .sun { display: none; }
  html:is([data-chrome="app"], [data-chrome="admin"]):not([data-theme="dark"]) .theme-btn .moon { display: block; }
}
html:is([data-chrome="app"], [data-chrome="admin"], [data-chrome="bare"])[data-theme="light"] {
  --bg: #f4f6fa; --bg-2: #eef2f7; --panel: #ffffff; --panel-2: #f5f7fb;
  --line: #e2e8f0; --line-soft: #edf1f6;
  --ink: #0b1526; --ink-2: #46566c; --dim: #6b7b91;
  --head-bg: rgba(255,255,255,.9);
  --card-hover: #c5d3e5; --row-hover: rgba(11,21,38,.025);
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.07);
  --shadow: 0 14px 32px -14px rgba(15,35,70,.22);
  --ok: #158a4f;
  color-scheme: light;
}

body { font-family: var(--font); background: var(--bg); color: var(--ink); }
:where(h1, h2, h3, h4) { font-family: var(--display); letter-spacing: -.015em; word-spacing: .05em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.ic { flex: 0 0 auto; vertical-align: -.2em; }
.kicker { font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin: 0 0 .4rem; }
.narrow { max-width: 860px; }

/* ---------- 2. shell ------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--side-bg); color: var(--side-ink); border-right: 1px solid var(--side-line); z-index: 80;
}
.side-head { padding: 1.15rem 1.2rem 1rem; border-bottom: 1px solid var(--side-line); }
.side .brand span, .side .brand strong { color: #fff; }
.side .brand em { color: #7fd6ff; font-style: normal; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  margin-left: .25rem; padding: .1rem .4rem; border-radius: 5px; background: rgba(127,214,255,.12); }
.side .brand img { width: 34px; height: 34px; }
.side-nav { flex: 1; overflow-y: auto; padding: .6rem .75rem 1rem; scrollbar-width: thin; }
.side-label { font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(226,236,250,.38);
  margin: 1.1rem .65rem .4rem; }
.side-nav a {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; margin: .1rem 0; border-radius: 10px;
  color: var(--side-ink); font-size: .92rem; font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.side-nav a .ic { opacity: .8; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.on { background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 26%, transparent), color-mix(in srgb, var(--brand) 6%, transparent)); color: #fff; font-weight: 600; }
.side-nav a.on::before { content: ""; position: absolute; left: -.75rem; top: 20%; bottom: 20%; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.side-nav a.on .ic { opacity: 1; color: #7fd6ff; }
.side-badge { margin-left: auto; min-width: 22px; padding: .05rem .45rem; border-radius: 999px; text-align: center;
  font-size: .72rem; font-weight: 700; color: #fff; background: #e0566f; }
.side-foot { padding: .9rem; border-top: 1px solid var(--side-line); display: grid; gap: .7rem; }
.side-meter, .side-site { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: 10px;
  background: rgba(255,255,255,.04); color: var(--side-ink); font-size: .86rem; }
.side-meter b { color: #fff; }
.side-meter .ic { color: var(--accent); }
.side-site:hover { color: #fff; background: rgba(255,255,255,.08); }
.side-user { display: flex; align-items: center; gap: .7rem; color: #fff; padding: .2rem .25rem; border-radius: 10px; min-width: 0; }
.side-user:hover { color: #fff; background: rgba(255,255,255,.04); }
.side-user > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-user b { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user em { font-style: normal; font-size: .76rem; color: rgba(226,236,250,.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-actions { display: flex; gap: .5rem; align-items: center; }
.side-actions form { flex: 1; }
.side-actions .btn { width: 100%; justify-content: center; background: rgba(255,255,255,.05); color: #fff; border-color: rgba(255,255,255,.12); }
.side-actions .btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.side .theme-btn { width: 36px; height: 36px; border-radius: 10px; color: #fff; border-color: rgba(255,255,255,.14); background: rgba(255,255,255,.05); }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px;
  font-weight: 800; font-family: var(--display); color: #fff; background: linear-gradient(135deg, var(--brand), var(--accent)); }
.avatar.big { width: 64px; height: 64px; border-radius: 18px; font-size: 1.6rem; }

.shell-main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 1rem; height: 64px; padding: 0 2rem;
  background: var(--head-bg); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line-soft);
}
.topbar .burger { margin: 0 0 0 -.4rem; }
.tb-title { font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--ink); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.portal-main { flex: 1; width: 100%; max-width: 1320px; padding: 2rem 2rem 3rem; }
.portal-main > .flash { margin: 0 0 1.4rem; }
.portal-main .wrap { max-width: none; padding: 0; }
.portal-main .page { padding: 0; }
.portal-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.2rem 2rem; font-size: .8rem;
  color: var(--dim); border-top: 1px solid var(--line-soft); }
.portal-foot a { color: var(--dim); }
.shell-scrim { display: none; }

/* ---------- 3. components -------------------------------------------------- */
.btn { background: var(--btn); color: #fff; border-radius: 10px; font-weight: 600; padding: .66rem 1.15rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.1); word-spacing: .03em; }
.btn:hover { background: var(--btn-hover); color: #fff; filter: none; }
.btn.small { padding: .45rem .85rem; font-size: .84rem; }
.btn.big { padding: .85rem 1.4rem; font-size: 1rem; }
.btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); border-color: var(--card-hover); }
.btn.danger { background: linear-gradient(180deg, #e0566f, #b8394f); }
.btn .ic { width: 1em; height: 1em; }

.page-head { align-items: flex-end; margin-bottom: 1.6rem; }
.page-head h1 { font-size: clamp(1.5rem, 2.6vw, 1.95rem); font-weight: 800; }
.page-head .lede { font-size: 1rem; color: var(--ink-2); margin: .35rem 0 0; }
.page-head.center { flex-direction: column; align-items: center; text-align: center; }
.crumbs { font-size: .82rem; margin-bottom: .5rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.5rem; }
.panel h3 { font-size: 1.02rem; }
.panel + .panel { margin-top: 1.1rem; }
.panel.danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-head h2 { font-size: 1.1rem; margin: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush .panel-head { padding: 1.2rem 1.4rem 0; }
.panel.flush .table-wrap { border: 0; border-radius: 0; box-shadow: none; border-top: 1px solid var(--line-soft); }
h2.sec-h { font-size: 1.15rem; margin: 2rem 0 .9rem; }

.stat-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.8rem; }
.stat-cards.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat { position: relative; display: block; border-radius: var(--radius); padding: 1.15rem 1.2rem; box-shadow: var(--shadow-sm);
  color: var(--ink); transition: transform .15s, border-color .15s, box-shadow .15s; }
a.stat:hover { transform: translateY(-2px); border-color: var(--card-hover); box-shadow: var(--shadow); color: var(--ink); }
.stat-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; margin-bottom: .8rem;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 13%, transparent); }
.stat.accent .stat-ico { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.stat.warn .stat-ico { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.stat strong { font-family: var(--display); font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; }
.stat span:not(.stat-ico) { display: block; font-size: .74rem; letter-spacing: .07em; margin-top: .15rem; }

.table-wrap { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
thead th { background: var(--panel-2); font-size: .72rem; padding: .8rem 1rem; color: var(--dim); }
tbody td { padding: .85rem 1rem; }
td.right, th.right { text-align: right; }
.table a:not(.btn) { font-weight: 600; }
.chip { font-size: .76rem; font-weight: 600; padding: .22rem .65rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); }
.chip.on { color: var(--brand); border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel)); }
.chip.ok, .chip.paid { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 11%, transparent); }
.chip.warn, .chip.pending { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.chip.rejected { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.chip.muted { opacity: .8; }
.chips { margin-bottom: 1.2rem; }

:is(input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
  input[type=url], input[type=tel], input[type=search], select, textarea) {
  background: var(--panel); border-radius: 10px; padding: .66rem .85rem; transition: border-color .15s, box-shadow .15s;
}
:is(input, select, textarea):focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus); }
.field > span { display: block; font-size: .83rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.field > span i { color: var(--danger); font-style: normal; }
form.panel > h3, .panel > h3 { margin-top: 1.4rem; padding-top: 1.2rem; border-top: 1px solid var(--line-soft); }
form.panel > h3:first-of-type, .panel > h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.sticky-save { background: linear-gradient(180deg, transparent, var(--panel) 34%); }

.flash { border-radius: 12px; font-weight: 500; color: var(--ink); }
.flash.ok { background: color-mix(in srgb, var(--ok) 12%, var(--panel)); border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ink); }
.flash.err, .flash.error { background: color-mix(in srgb, var(--danger) 10%, var(--panel)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); color: var(--ink); }
.admin-hint { border-radius: 12px; margin: 0 0 1rem; }
.empty-state { border-radius: 18px; padding: 3rem 1.5rem; }
.es-ico { display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; margin-bottom: 1rem;
  color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, transparent); }
.hours-pill { gap: .4rem; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

/* ---------- 4. dashboard and classroom ------------------------------------- */
.dash-head { margin-bottom: 1.5rem; }
.dash-head h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 800; }
.dash-head .lede { color: var(--ink-2); }
.resume-card {
  position: relative; overflow: hidden; gap: 1.3rem; padding: 1.5rem 1.7rem; border: 0; border-radius: 20px; color: #fff;
  background:
    radial-gradient(70% 140% at 100% 0%, color-mix(in srgb, var(--accent) 40%, transparent), transparent 60%),
    linear-gradient(120deg, color-mix(in srgb, var(--brand-2) 92%, #000), #0b1a36);
  box-shadow: 0 24px 50px -24px color-mix(in srgb, var(--brand-2) 80%, #000);
}
.resume-card:hover { color: #fff; transform: translateY(-2px); }
.resume-play { width: 60px; height: 60px; background: #fff; color: var(--brand-2); box-shadow: 0 0 0 8px rgba(255,255,255,.12); }
.resume-kicker { color: #9fe7d6; }
.resume-body strong { font-family: var(--display); font-size: 1.3rem; }
.resume-course, .resume-card .muted { color: rgba(255,255,255,.75); }
.resume-card .bar { background: rgba(255,255,255,.2); }
.resume-go { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 1.2rem; border-radius: 10px; background: #fff; color: #0b1a36; }
.dash-section { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2.2rem 0 1rem; }
.dash-section h2 { font-size: 1.2rem; }
.course-row { gap: 1.2rem; padding: 1rem 1.2rem; border-radius: 16px; box-shadow: var(--shadow-sm); }
.course-row:hover { box-shadow: var(--shadow); }
.cr-thumb { display: grid; place-items: center; width: 54px; height: 54px; flex: 0 0 auto; border-radius: 14px; color: rgba(255,255,255,.85);
  background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.25), transparent 55%), linear-gradient(135deg, var(--cover), color-mix(in srgb, var(--cover) 45%, #020814)); }
.cr-title { font-family: var(--display); }
.cr-note { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; margin-top: .15rem; }
.cr-go { display: inline-flex; align-items: center; gap: .35rem; }
.bar { height: 8px; background: var(--line-soft); }
.bar.thin { height: 5px; }
.dash-links { gap: 1rem; }
.dash-link { padding: 1.2rem; border-radius: 16px; box-shadow: var(--shadow-sm); }
.dash-link .ic { display: block; color: var(--brand); margin-bottom: .6rem; }
.zone-card { border-radius: 16px; box-shadow: var(--shadow-sm); }
.doc-row { border-radius: 12px; box-shadow: var(--shadow-sm); }

.lesson-list { border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-sm); margin: 0 0 1rem; padding: 0; list-style: none; }
.lesson-row { padding: .85rem 1.1rem; }
.lesson-icon { width: 34px; height: 34px; border-radius: 10px; color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel)); border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); }
.lesson-icon.done { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--panel)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.lesson-icon.lock { color: var(--dim); background: var(--panel-2); border-color: var(--line); }
.lesson-pct { display: block; text-align: left; color: var(--accent); font-size: .78rem; }
.lesson-side { color: var(--dim); font-size: .84rem; font-variant-numeric: tabular-nums; }

.class-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: center; margin-bottom: 1.6rem;
  padding: 1.8rem 2rem; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  background-image: radial-gradient(60% 140% at 100% 0%, color-mix(in srgb, var(--cover) 26%, transparent), transparent 70%);
}
.class-hero h1 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 800; margin-bottom: .4rem; }
.class-hero .bar { max-width: 520px; margin: .4rem 0 0; }
.ch-next { margin: 1.2rem 0 0; }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line-soft) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--panel); }
.ring span { position: relative; text-align: center; font-size: .74rem; color: var(--dim); line-height: 1.2; }
.ring b { display: block; font-family: var(--display); font-size: 1.7rem; color: var(--ink); }
.week-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); margin-bottom: 1rem; overflow: hidden; }
.week-card .week-head { display: flex; align-items: center; gap: .8rem; padding: .9rem 1.2rem; background: var(--panel-2); text-transform: none; letter-spacing: 0; }
.week-card .week-head h3 { margin: 0; font-size: 1rem; color: var(--ink); }
.wk-count { margin-left: auto; font-size: .8rem; color: var(--dim); font-weight: 500; }
.week-card .lesson-list { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
.week-card.is-locked .week-head h3 { color: var(--dim); }

/* ---------- 5. player and lesson rail -------------------------------------- */
.theatre-shell { grid-template-columns: minmax(0, 1fr) 340px; gap: 1.6rem; min-height: 0; align-items: start; }
.theatre-main { background: none; }
.theatre-main > .crumbs { margin-bottom: .8rem; }
.player { border-radius: 16px; box-shadow: var(--shadow); max-height: calc(100vh - 200px); }
.theatre-bar { background: none; border: 0; padding: 1.1rem 0 .6rem; }
.theatre-bar h1 { font-family: var(--display); font-size: clamp(1.15rem, 2vw, 1.45rem); color: var(--ink); }
.theatre-main .row-actions { margin: .4rem 0 1.2rem; gap: .6rem; }
.theatre-below { padding: 1.3rem 1.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; max-width: none; }
.theatre-side { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.theatre-side .sh { position: sticky; top: 0; z-index: 2; background: var(--panel); display: grid; grid-template-columns: 1fr auto; gap: .5rem;
  text-transform: none; letter-spacing: 0; padding: 1rem 1.1rem .9rem; }
.theatre-side .sh b { font-family: var(--display); color: var(--ink); font-size: .98rem; }
.theatre-side .sh span { font-size: .8rem; color: var(--dim); font-weight: 500; }
.theatre-side .sh .bar { grid-column: 1 / -1; }
.rail-week { margin: 0; padding: .7rem 1.1rem .35rem; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.theatre-side .lesson-list { box-shadow: none; border: 0; border-radius: 0; margin: 0; background: none; }
.theatre-side .lesson-row { padding: .6rem 1.1rem; border-bottom: 0; }
.theatre-side .lesson-row a { gap: .7rem; align-items: flex-start; }
.theatre-side .lesson-icon { width: 28px; height: 28px; border-radius: 8px; }
.theatre-side .lesson-main b, .theatre-side .lesson-main strong { font-size: .86rem; font-weight: 500; line-height: 1.4; }
.theatre-side .lesson-row.current { background: color-mix(in srgb, var(--brand) 10%, transparent); border-left: 3px solid var(--brand); padding-left: calc(1.1rem - 3px); }
.theatre-side .lesson-row.current strong { font-weight: 700; color: var(--ink); }
.theatre-side .lesson-side { font-size: .76rem; }

/* ---------- 6. quiz, progress, account ------------------------------------- */
.quiz-q { border-radius: 16px; padding: 1.4rem 1.5rem; box-shadow: var(--shadow-sm); }
.quiz-q .qn { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin: 0 0 .35rem; }
.quiz-q h3 { font-size: 1.06rem; margin-bottom: 1rem; }
.opt { border-radius: 12px; padding: .8rem 1rem; }
.opt:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, var(--panel)); }
.opt.right, .opt.correct { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); color: var(--ink); }
.opt.wrong { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: color-mix(in srgb, var(--danger) 9%, var(--panel)); }
.opt .mine { font-style: normal; font-size: .76rem; color: var(--dim); margin-left: .4rem; }
.quiz-submit { display: flex; justify-content: flex-end; padding: .5rem 0 0; }
.quiz-result { text-align: center; padding: 2.2rem 1.5rem; margin-bottom: 1.6rem; border-radius: 20px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.quiz-result.pass { background-image: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--ok) 16%, transparent), transparent 70%); }
.quiz-result.fail { background-image: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--warn) 14%, transparent), transparent 70%); }
.quiz-result h1 { font-size: 1.8rem; margin-top: .4rem; }
.score-ring::before { background: var(--panel); }
.score-ring.fail { background: conic-gradient(var(--warn) calc(var(--p) * 1%), var(--line-soft) 0); }
.center-flex { justify-content: center; }
.review-head { font-size: 1.15rem; margin: 0 0 1rem; }
.t-course { display: inline-flex; align-items: center; gap: .6rem; }
.t-course i { width: 12px; height: 12px; border-radius: 4px; background: var(--cover); }
.t-bar { min-width: 200px; }
.t-bar .bar { display: inline-block; width: 120px; vertical-align: middle; margin-right: .6rem; }
.t-bar b { font-variant-numeric: tabular-nums; }
.profile { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.profile h2 { font-size: 1.3rem; margin: 0; }
.profile p { margin: .1rem 0 0; }
.profile-stat { margin-left: auto; display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border-radius: 12px; background: var(--panel-2); color: var(--ink-2); }
.profile-stat .ic { color: var(--accent); }

/* ---------- 7. admin components -------------------------------------------- */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; margin-bottom: 1.4rem; }
.admin-grid > .panel + .panel { margin-top: 0; }
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: .2rem; }
.people li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.people li:last-child { border-bottom: 0; }
.people li > span:last-child { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.people b { font-size: .9rem; }
.people em { font-style: normal; font-size: .78rem; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.quick a { display: flex; align-items: center; gap: .5rem; padding: .7rem .8rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font-size: .86rem; font-weight: 500; }
.quick a:hover { border-color: var(--brand); color: var(--brand); }
.quick .ic { color: var(--brand); }
.tabs { border-bottom-color: var(--line); }
.tabs .tab, .tabs a { border-radius: 8px 8px 0 0; }
.md-toolbar { border-radius: 10px 10px 0 0; }
.media-grid img { border-radius: 10px; }

/* ---------- 8. login ------------------------------------------------------- */
html[data-chrome="bare"] main > .flash { display: none; }
.auth-wrap { background: var(--bg); }
@media (min-width: 861px) { .auth-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); } }
.auth-main { padding: 2.5rem; }
.auth-box { max-width: 420px; }
.auth-box .brand { margin-bottom: 2.4rem; }
.auth-box .brand span, .auth-box .brand strong { color: var(--ink); font-family: var(--display); }
.auth-box h1 { font-size: 2rem; font-weight: 800; margin-bottom: .4rem; }
.auth-form { margin-top: 1.6rem; }
.auth-form .btn.big { margin-top: .6rem; }
.auth-side {
  position: relative; overflow: hidden; border: 0; padding: 3.5rem; color: #fff;
  background:
    radial-gradient(70% 60% at 100% 0%, color-mix(in srgb, var(--brand) 40%, transparent), transparent 60%),
    radial-gradient(60% 60% at 0% 100%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 60%),
    linear-gradient(160deg, #071327, #0b1a36);
}
.auth-side::before { content: ""; position: absolute; inset: 0; background: url("/assets/img/hero-5g.svg") center / cover no-repeat; opacity: .18; }
.auth-side-in { position: relative; max-width: 460px; }
.auth-side .kicker { color: #7fd6ff; }
.auth-side h2 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 800; line-height: 1.15; margin-bottom: 1rem; }
.auth-side p { color: rgba(226,236,250,.75); }
.auth-points { list-style: none; padding: 0; margin: 1.8rem 0 0; display: grid; gap: .8rem; }
.auth-points li { display: flex; align-items: center; gap: .7rem; color: #fff; font-weight: 500; }
.auth-points .ic { width: 28px; height: 28px; padding: 6px; border-radius: 8px; background: rgba(255,255,255,.1); color: var(--accent); }

/* ---------- 9. responsive -------------------------------------------------- */
@media (max-width: 1300px) {
  .stat-cards.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .theatre-shell { grid-template-columns: 1fr; }
  .theatre-side { position: static; max-height: none; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1040px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; height: auto; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: 0 0 60px rgba(0,0,0,.5); }
  body.nav-open .side { transform: none; }
  .shell-scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(2,6,14,.55); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .shell-scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 0 1rem; }
  .topbar .burger { display: block; }
  .portal-main { padding: 1.4rem 1rem 2.5rem; }
  .portal-foot { padding: 1rem; }
}
@media (max-width: 900px) {
  .stat-cards, .stat-cards.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tb-right .btn { display: none; }
  .resume-card { padding: 1.2rem; }
  .resume-go { width: 100%; justify-content: center; }
  .class-hero { grid-template-columns: 1fr; padding: 1.3rem; }
  .ring { width: 104px; height: 104px; }
  .quick { grid-template-columns: 1fr; }
  .profile-stat { margin-left: 0; }
  .auth-main { padding: 1.5rem 1.2rem; }
  .lesson-row, .lesson-row a { flex-wrap: wrap; row-gap: .3rem; }
}

/* sidebar details: full-height column colour, header lockup, sign-out button */
@media (min-width: 1041px) { .shell { background: linear-gradient(90deg, var(--side-bg) 268px, transparent 268px); } }
.side .brand > span { font-size: .98rem; line-height: 1.25; }
.side .brand em { display: table; margin: .3rem 0 0; }
.side-actions .btn.ghost { background: rgba(255,255,255,.05); color: #fff; border-color: rgba(255,255,255,.14); box-shadow: none; }
.side-actions .btn.ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-nav a { padding: .52rem .75rem; margin: .05rem 0; }
.side-label { margin: .85rem .65rem .3rem; }
.side-head { padding: .95rem 1.2rem .85rem; }
.side-foot { gap: .55rem; padding: .75rem .9rem; }

/* the public menu's "Light mode / Dark mode" label has no room in the sidebar */
.side .theme-btn { width: 36px !important; height: 36px !important; padding: 0 !important; flex: 0 0 36px; }
.side .theme-btn .sun::after, .side .theme-btn .moon::after { content: none !important; }

/* ===========================================================================
   v3.2 - profile photo, resume, notices, phone tab bar
   =========================================================================== */
.avatar.has-photo { padding: 0; overflow: hidden; background: var(--panel-2); }
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.notice-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1rem; border-radius: 16px; color: var(--ink);
  background: color-mix(in srgb, var(--brand) 8%, var(--panel)); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); }
.notice-card.warn { background: color-mix(in srgb, var(--warn) 10%, var(--panel)); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.notice-card > .ic { color: var(--brand); flex: 0 0 auto; }
.notice-card.warn > .ic { color: var(--warn); }
.notice-card > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.notice-card em { font-style: normal; font-size: .86rem; color: var(--dim); }
.notice-card:hover { color: var(--ink); border-color: var(--brand); }
.photo-panel { display: flex; gap: 1.2rem; align-items: flex-start; }
.photo-panel .pp-text { flex: 1; min-width: 0; }
.photo-panel h3 { display: flex; align-items: center; gap: .5rem; margin-top: 0 !important; padding-top: 0 !important; border: 0 !important; }
.upload-inline { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .6rem; }
.file-pick { position: relative; display: inline-flex; margin: 0; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-pick span { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .9rem; border-radius: 10px; font-size: .86rem; font-weight: 600;
  border: 1px dashed var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--panel)); }
.file-pick.chosen span { border-style: solid; }
.resume-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .8rem 1rem; margin-bottom: .6rem; border-radius: 12px; background: var(--panel-2); }
.resume-row > .ic { color: #d64545; }
.resume-row > span { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.resume-row em { font-style: normal; font-size: .8rem; color: var(--dim); }
.student-profile .sp-row { display: flex; align-items: center; gap: .9rem; margin-bottom: .9rem; }
.btn.wide { width: 100%; justify-content: center; }

/* phone tab bar - the student portal behaves like an app on Android and iOS */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -14px rgba(0,0,0,.35);
    padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: .18rem; padding: .55rem .2rem .5rem; font-size: .7rem; font-weight: 600; color: var(--dim); }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--brand); }
  .tabbar a.on .ic { filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--brand) 50%, transparent)); }
  body.portal:has(.tabbar) .portal-main { padding-bottom: 6rem; }
  body.portal:has(.tabbar) .portal-foot { display: none; }
  .photo-panel { flex-direction: column; }
  .notice-card .cr-go { display: none; }
  .dash-head h1 { font-size: 1.6rem; }
  .stat { padding: 1rem; }
  .stat strong { font-size: 1.35rem; }
  .stat-ico { width: 34px; height: 34px; margin-bottom: .5rem; }
}
.dash-head { display: flex; align-items: center; gap: 1.2rem; }
.dash-avatar { flex: 0 0 auto; border-radius: 20px; }
.dash-avatar .avatar.big { width: 72px; height: 72px; border-radius: 20px; font-size: 1.8rem; box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .dash-avatar .avatar.big { width: 56px; height: 56px; border-radius: 16px; font-size: 1.4rem; } }
.student-head { justify-content: flex-start; align-items: center; gap: 1.1rem; }
.student-head .avatar.big { width: 76px; height: 76px; border-radius: 20px; font-size: 1.9rem; }
.sh-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 0 !important; }
.meter { margin: .2rem 0 1rem; }
.meter-top { display: flex; align-items: baseline; gap: .45rem; margin-bottom: .45rem; }
.meter-top b { font-family: var(--display); font-size: 1.6rem; }
.meter-top span, .meter-foot { color: var(--dim); font-size: .84rem; }
.meter-foot { display: flex; justify-content: space-between; margin-top: .35rem; }
.meter.low .bar i { background: linear-gradient(90deg, var(--warn), #f97316); }
.meter.over .bar i { background: var(--danger); }
.watch-panel.expired { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.quick-hours { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.t-person { display: flex; align-items: center; gap: .7rem; } .t-person .avatar { width: 36px; height: 36px; font-size: .9rem; }

/* grid children must be allowed to shrink so wide tables scroll inside
   their own box on a phone instead of widening the whole page */
.split > *, .admin-grid > *, .two > *, .three > *, .field-row > * { min-width: 0; }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.portal-main { min-width: 0; overflow-wrap: anywhere; }
.portal-main table { overflow-wrap: normal; }
.page-head > * { min-width: 0; }
@media (max-width: 640px) {
  .page-head .flex { width: 100%; }
  .chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .3rem; }
  .chips .chip { flex: 0 0 auto; }
  .row-actions, .flex { flex-wrap: wrap; }
}
.scene-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; margin-top: .4rem; }
.scene-pick { position: relative; display: flex; flex-direction: column; gap: .4rem; padding: .6rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--ink-2); margin: 0; }
.scene-pick img { width: 100%; aspect-ratio: 16 / 8; object-fit: cover; object-position: 85% 50%; border-radius: 8px; background: #f4f8fc; }
.scene-pick input { position: absolute; top: .9rem; left: .9rem; width: 18px; height: 18px; accent-color: var(--brand); }
.scene-pick:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); color: var(--ink); }
.theatre-shell > *, .theatre-main > * { min-width: 0; }
.theatre-main .row-actions .btn { white-space: normal; max-width: 100%; text-align: left; line-height: 1.35; }
.tpl-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -.4rem 0 1rem; }
.tpl-bar .hint { margin: 0; }
.diagram-preview { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: #f8fbff; }
.diagram-preview svg { display: block; width: 100%; height: auto; min-width: 640px; }
.diagram-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.diagram-list li { padding: .6rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; gap: .5rem; }
.diagram-list img { width: 100%; height: 140px; object-fit: cover; object-position: top; border-radius: 8px; background: #f8fbff; }
.diagram-list code { font-size: .72rem; overflow-wrap: anywhere; }
.cmt-cell { max-width: 520px; }
textarea.code { font-family: var(--mono); font-size: .86rem; }
