:root {
  --primary: #06BBCC; --primary-ink: #0A8F9C; --dark: #181d38; --light: #F0FBFC;
  --surface: #fcfcfb; --hair: #e7eaee; --muted: #6b7280;
  --good: #1a7f37; --warn: #9a6700; --bad: #c62828;
  --sidebar-w: 248px;
}
body { background: #f6f8fa; font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: #1f2937; }
h1, h2, h3, h4, h5, .brand { font-family: 'Nunito', system-ui, sans-serif; font-weight: 800; color: var(--dark); }
a { color: var(--primary-ink); }
.boot { min-height: 100vh; display: grid; place-items: center; }
.btn-primary { color: #fff; }
.btn-primary:hover { color: #fff; }
.text-ink { color: var(--primary-ink) !important; }
.small-muted { color: var(--muted); font-size: .875rem; }

/* ---------- layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--dark); color: #cfd3e6; position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1030; transition: transform .2s; }
.sidebar .brand { color: #fff; font-size: 1.35rem; padding: 1.1rem 1.25rem; display: block; text-decoration: none; }
.sidebar .brand i { color: var(--primary); }
.sidebar .nav-section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #8189b0; padding: 1rem 1.25rem .35rem; }
.sidebar a.nav-link { color: #cfd3e6; padding: .55rem 1.25rem; display: flex; gap: .75rem; align-items: center; border-left: 3px solid transparent; }
.sidebar a.nav-link i { width: 18px; text-align: center; }
.sidebar a.nav-link:hover { color: #fff; background: rgba(255,255,255,.04); }
.sidebar a.nav-link.active { color: #fff; border-left-color: var(--primary); background: rgba(6,187,204,.12); }
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--hair); padding: .6rem 1.25rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 1020; }
.topbar .chip { background: var(--light); color: var(--dark); border-radius: 999px; padding: .2rem .7rem; font-size: .85rem; font-weight: 600; white-space: nowrap; }
.content { padding: 1.5rem; max-width: 1200px; }
.menu-toggle { display: none; }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-block; }
  .content { padding: 1rem; }
  .topbar .chip.hide-sm { display: none; }
}

/* ---------- cards & tiles */
.card { border: 1px solid var(--hair); border-radius: 10px; box-shadow: none; }
.card-header { background: #fff; border-bottom: 1px solid var(--hair); font-weight: 700; font-family: 'Nunito', sans-serif; }
.stat-tile { background: #fff; border: 1px solid var(--hair); border-radius: 10px; padding: 1rem 1.1rem; height: 100%; }
.stat-tile .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.stat-tile .value { font-family: 'Nunito', sans-serif; font-size: 1.85rem; font-weight: 800; color: var(--dark); line-height: 1.15; }
.stat-tile .sub { color: var(--muted); font-size: .8rem; }
.course-card { transition: border-color .15s; height: 100%; text-decoration: none; color: inherit; display: block; }
.course-card:hover { border-color: var(--primary); }
.badge-tier { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.tier-free { background: #eef2f6; color: #374151; }
.tier-standard { background: #e0f2fe; color: #075985; }
.tier-premium { background: #fef3c7; color: #92400e; }
.progress { height: 6px; background: #eef2f6; }
.progress-bar { background: var(--primary-ink); }
.status { display: inline-flex; gap: .35rem; align-items: center; font-weight: 600; font-size: .85rem; }
.status.good { color: var(--good); } .status.warn { color: var(--warn); } .status.bad { color: var(--bad); }

/* ---------- charts (single-series; mark colour #0A8F9C validated >= 3:1 on surface) */
.hbar { display: grid; grid-template-columns: minmax(90px, 32%) 1fr 48px; gap: .4rem .6rem; align-items: center; font-size: .875rem; }
.hbar .track { height: 14px; position: relative; border-left: 1px solid var(--hair); }
.hbar .bar { height: 14px; max-width: 100%; background: var(--primary-ink); border-radius: 0 4px 4px 0; }
.hbar .bar:hover { filter: brightness(1.15); }
.hbar .val { color: #374151; font-variant-numeric: tabular-nums; text-align: right; }
.hbar .name { color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trend svg { width: 100%; height: 140px; overflow: visible; }
.trend .grid line { stroke: var(--hair); stroke-width: 1; }
.trend .line { fill: none; stroke: var(--primary-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .area { fill: var(--primary-ink); opacity: .1; }
.trend .dot { fill: var(--primary-ink); stroke: var(--surface); stroke-width: 2; }
.trend text { font-size: 11px; fill: #6b7280; }
.trend .hit { fill: transparent; cursor: default; }

/* ---------- lesson body */
.lesson-body { font-size: 1.05rem; line-height: 1.7; }
.lesson-body pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 8px; }
.lab-frame { width: 100%; aspect-ratio: 16/10; border: 1px solid var(--hair); border-radius: 8px; }
.step { border-left: 3px solid var(--primary); padding: .5rem 0 .5rem 1rem; margin-bottom: .75rem; }
.step.done { border-left-color: var(--good); opacity: .75; }

/* ---------- CBT (exam-hall look: high contrast, large targets) */
.cbt { position: fixed; inset: 0; background: #eef1f5; z-index: 2000; display: flex; flex-direction: column; }
.cbt-top { background: var(--dark); color: #fff; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.cbt-top .timer { font-family: ui-monospace, Menlo, monospace; font-size: 1.4rem; font-weight: 700; background: rgba(255,255,255,.1); padding: .1rem .7rem; border-radius: 6px; }
.cbt-top .timer.low { background: var(--bad); }
.cbt-body { flex: 1; display: grid; grid-template-columns: 1fr 300px; gap: 1rem; padding: 1rem; overflow: hidden; }
.cbt-q { background: #fff; border-radius: 10px; padding: 1.5rem; overflow-y: auto; }
.cbt-q .stem { font-size: 1.15rem; line-height: 1.6; margin-bottom: 1.25rem; }
.cbt-opt { display: flex; gap: .85rem; align-items: flex-start; width: 100%; text-align: left; background: #fff; border: 2px solid var(--hair); border-radius: 8px; padding: .8rem 1rem; margin-bottom: .6rem; font-size: 1.05rem; }
.cbt-opt:hover { border-color: #9bdde4; }
.cbt-opt.sel { border-color: var(--primary-ink); background: var(--light); }
.cbt-opt .letter { font-weight: 800; min-width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #eef2f6; display: grid; place-items: center; font-size: .9rem; }
.cbt-opt.sel .letter { background: var(--primary-ink); color: #fff; }
.cbt-side { background: #fff; border-radius: 10px; padding: 1rem; overflow-y: auto; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.palette button { height: 38px; border: 1px solid #cbd5e1; background: #fff; border-radius: 6px; font-weight: 600; font-size: .85rem; position: relative; }
.palette button.ans { background: var(--primary-ink); color: #fff; border-color: var(--primary-ink); }
.palette button.cur { outline: 3px solid var(--dark); outline-offset: 1px; }
.palette button.flag::after { content: ''; position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 2px #fff; }
.subject-tabs .btn { font-size: .8rem; }
.calc { background: #1f2937; border-radius: 10px; padding: .6rem; width: 240px; position: fixed; right: 320px; bottom: 20px; z-index: 2100; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.calc input { width: 100%; text-align: right; font-family: ui-monospace, monospace; font-size: 1.3rem; margin-bottom: .5rem; border: 0; border-radius: 6px; padding: .3rem .5rem; }
.calc .keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.calc .keys button { padding: .55rem 0; border: 0; border-radius: 6px; background: #374151; color: #fff; font-weight: 600; }
.calc .keys button.op { background: var(--primary-ink); }
.proctor-warn { background: #fff3cd; color: #664d03; padding: .5rem 1rem; text-align: center; font-weight: 600; }
@media (max-width: 860px) { .cbt-body { grid-template-columns: 1fr; overflow-y: auto; } .calc { right: 10px; } }

/* ---------- misc */
.offline-banner { background: #374151; color: #fff; text-align: center; padding: .4rem; font-size: .9rem; position: sticky; top: 0; z-index: 3000; }
.toast-msg { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: .7rem 1.2rem; border-radius: 8px; z-index: 3000; max-width: 90vw; }
.toast-msg.error { background: var(--bad); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, rgba(24,29,56,.92), rgba(24,29,56,.75)), url('/img/grad-girl.jpg') center/cover; padding: 1rem; }
.auth-card { max-width: 440px; width: 100%; }
.cert { border: 8px double var(--primary-ink); padding: 2rem; text-align: center; background: #fff; }
.table > :not(caption) > * > * { padding: .55rem .6rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; border-bottom-width: 1px; }
.me-row { background: var(--light) !important; font-weight: 700; }
.notif-dot { position: absolute; top: -4px; right: -6px; background: var(--bad); color: #fff; border-radius: 999px; font-size: .65rem; padding: 0 .35rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.post { border-bottom: 1px solid var(--hair); padding: 1rem 0; }
.post:last-child { border-bottom: 0; }
.pill-filter .btn { border-radius: 999px; }
@media print { .sidebar, .topbar, .no-print { display: none !important; } .main { margin: 0; } }
.auth-wrap { position: relative; }
.auth-home { position: absolute; top: 1rem; left: 1rem; display: inline-flex; align-items: center; padding: .45rem .95rem; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); color: #fff; font-weight: 600; font-size: .9rem; text-decoration: none; }
.auth-home:hover, .auth-home:focus-visible { background: #fff; color: var(--dark); }
.auth-home:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
@media (max-width: 575px) { .auth-wrap { padding-top: 4rem; } }

/* ---- sign-in: brand, Google button, divider, one-click demo accounts */
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.auth-brand img { border-radius: 8px; }
.auth-brand b { color: var(--primary-ink); font-weight: inherit; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 10px; height: 46px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: #1f2937; font-weight: 600; }
.btn-google:hover { background: #f8fafb; border-color: #9aa3ae; color: #1f2937; }
.btn-google:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: .85rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--hair); }
.demo-box { border: 1px dashed #b9c3cc; border-radius: 10px; padding: 14px; background: #fbfcfc; }
.demo-box__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; font-size: .9rem; }
.demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.demo-role { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; min-height: 64px; border: 1px solid var(--hair); border-radius: 8px; background: #fff; color: #1f2937; font-size: .85rem; font-weight: 600; cursor: pointer; transition: border-color .14s, transform .14s; }
.demo-role i { color: var(--primary-ink); font-size: 1.1rem; }
.demo-role:hover { border-color: var(--primary-ink); transform: translateY(-1px); }
.demo-role:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }
@media (max-width: 400px) { .demo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* brand teal buttons carry the dark label (white on #06BBCC is 2.4:1; dark is 7.6:1) */
.btn-primary, .btn-primary:hover, .btn-primary:focus, .btn-primary:active { color: var(--dark) !important; }
.btn-primary:hover { filter: brightness(.95); }
