:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --brand: #2563eb;
  --brand-strong: #1d4ed8;
  --brand-soft: #eff6ff;
  --brand-ring: rgba(37, 99, 235, 0.18);
  --success: #047857;
  --success-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --gold: #b7791f;
  --gold-soft: #fdf6e7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 6px 22px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.16);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --sidebar-w: 264px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #131c2e;
  --surface-2: #172135;
  --surface-3: #1e2a41;
  --border: #243149;
  --border-strong: #33415c;
  --text: #eef2f8;
  --text-soft: #c7d2e3;
  --muted: #8fa0ba;
  --brand: #5b9bff;
  --brand-strong: #7cb0ff;
  --brand-soft: #16233b;
  --brand-ring: rgba(91, 155, 255, 0.22);
  --success: #34d399;
  --success-soft: #10281f;
  --warn: #fbbf24;
  --warn-soft: #2a2210;
  --danger: #f87171;
  --danger-soft: #2b1618;
  --gold: #e0b155;
  --gold-soft: #2a2313;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 22px 54px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app-root, .auth-root { width: 100%; min-height: 100vh; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* ---------- boot ---------- */
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.boot-card { text-align: center; color: var(--muted); }
.boot-mark {
  width: 58px; height: 58px; margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  animation: pulse 1.4s ease-in-out infinite;
}
.boot-mark::before, .boot-mark::after {
  content: ""; position: absolute; top: 16px; width: 12px; height: 22px;
  border: 3px solid var(--brand); border-right: none; border-radius: 4px 0 0 4px;
}
.boot-mark::before { left: 14px; }
.boot-mark::after { left: 32px; border: 3px solid var(--text); border-left: none; border-radius: 0 4px 4px 0; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.94); opacity: 0.75; } }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: linear-gradient(140deg, #1e293b, #334155);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 24px; height: 24px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 800; font-size: 15px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.1px; font-weight: 600; }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--bg);
}
.auth-aside {
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(37, 99, 235, 0.32), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #16233b 55%, #1e293b 100%);
  color: #e2e8f0;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.auth-aside .brand-title { color: #fff; }
.auth-aside .brand-sub { color: #93a4c0; }
.auth-aside .brand-mark { background: rgba(255, 255, 255, 0.1); box-shadow: none; }
.auth-headline { font-size: clamp(28px, 3.2vw, 42px); font-weight: 800; line-height: 1.12; color: #fff; letter-spacing: -0.5px; }
.auth-headline span { color: #93c5fd; }
.auth-copy { margin-top: 16px; color: #b6c4d9; max-width: 46ch; font-size: 15px; }
.auth-stats { display: flex; gap: 34px; flex-wrap: wrap; margin-top: 30px; }
.auth-stat strong { display: block; font-size: 26px; color: #fff; font-weight: 800; }
.auth-stat span { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #8fa3c0; }
.auth-points { list-style: none; display: grid; gap: 12px; margin-top: 34px; }
.auth-points li { display: flex; gap: 11px; align-items: flex-start; color: #cbd5e1; font-size: 14px; }
.auth-points svg { width: 19px; height: 19px; flex: none; margin-top: 2px; color: #60a5fa; }
.auth-footer { font-size: 12px; color: #7f8ea6; }

.auth-panel {
  display: grid; place-items: center; padding: 40px 28px;
  background: var(--surface);
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.3px; }
.auth-form .lead { color: var(--muted); margin-top: 8px; margin-bottom: 26px; font-size: 14px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); margin-bottom: 7px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 84px; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); background: var(--surface);
}
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 650; font-size: 14.5px;
  transition: background .15s, transform .08s, box-shadow .15s, border-color .15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--brand-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 17px; height: 17px; }
.btn-block { width: 100%; padding: 13px 18px; font-size: 15px; }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: var(--border); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft { background: var(--brand-soft); color: var(--brand); box-shadow: none; border-color: transparent; }
.btn-soft:hover { background: var(--brand-soft); color: var(--brand-strong); }
.btn-danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: rgba(185, 28, 28, 0.2); }
.alert-info { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-ring); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(180, 83, 9, 0.2); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; width: 100%; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { padding: 4px 6px; }
.nav { display: grid; gap: 4px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); font-weight: 700; padding: 0 10px; margin-bottom: 4px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-soft); font-weight: 600; font-size: 14px; text-decoration: none;
  transition: background .14s, color .14s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav a.active svg { opacity: 1; }
.nav .nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--muted); padding: 2px 7px; border-radius: 999px; }
.nav a.active .nav-badge { background: var(--brand); color: #fff; }

.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; display: grid; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 14px;
}
.user-chip .who { min-width: 0; }
.user-chip .who strong { display: block; font-size: 13.5px; }
.user-chip .who span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }

.tier-mini { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; }
.tier-mini .row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.tier-mini .row b { color: var(--text); font-size: 12.5px; }
.mini-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.mini-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #60a5fa); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.topbar .brand-mark svg { width: 19px; height: 19px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--text-soft);
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 19px; height: 19px; }
.page { padding: 30px 34px 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.4px; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 5px; }
.eyebrow { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.3px; color: var(--brand); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; font-weight: 750; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat .stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 700; }
.stat .stat-value { font-size: 27px; font-weight: 800; letter-spacing: -0.6px; margin-top: 6px; }
.stat .stat-note { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.stat.accent .stat-value { color: var(--brand); }
.stat.success .stat-value { color: var(--success); }
.stat.warn .stat-value { color: var(--warn); }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.stack > *, .grid-2 > *, .grid-2-even > * { min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- category cards ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 16px; }
.cat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; position: relative; overflow: hidden;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.cat-card.locked { background: var(--surface-2); }
.cat-card.locked:hover { transform: none; }
.cat-top { display: flex; gap: 13px; align-items: flex-start; }
.cat-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.cat-icon svg { width: 22px; height: 22px; }
.cat-card.locked .cat-icon { background: var(--surface-3); color: var(--muted); }
.cat-title { font-size: 15.5px; font-weight: 750; line-height: 1.28; }
.cat-tagline { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.cat-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.chip {
  font-size: 11.5px; font-weight: 650; padding: 4px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-soft); display: inline-flex; align-items: center; gap: 5px;
}
.chip svg { width: 13px; height: 13px; }
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-gold { background: var(--gold-soft); color: var(--gold); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.lock-ribbon {
  position: absolute; top: 0; right: 0; background: var(--gold-soft); color: var(--gold);
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase;
  padding: 5px 12px; border-radius: 0 var(--radius) 0 12px; display: flex; align-items: center; gap: 5px;
}
.lock-ribbon svg { width: 13px; height: 13px; }

/* ---------- lesson list ---------- */
.week-list { display: grid; gap: 10px; }
.week-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.week-item.open { border-color: var(--brand-ring); }
.week-head { display: flex; gap: 12px; align-items: center; padding: 13px 15px; cursor: pointer; user-select: none; }
.week-head:hover { background: var(--surface-2); }
.week-num {
  width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-soft); font-weight: 800; font-size: 13px;
}
.week-item.done .week-num { background: var(--success-soft); color: var(--success); }
.week-info { min-width: 0; flex: 1; }
.week-info strong { display: block; font-size: 14.5px; font-weight: 700; }
.week-info span { font-size: 12.5px; color: var(--muted); }
.week-caret { color: var(--muted); transition: transform .18s; }
.week-item.open .week-caret { transform: rotate(180deg); }
.week-body { padding: 0 15px 16px; border-top: 1px solid var(--border); padding-top: 15px; }
.lesson-summary { font-size: 14.5px; color: var(--text-soft); margin-bottom: 14px; }
.lesson-points { display: grid; gap: 8px; margin: 14px 0; }
.lesson-points li { list-style: none; display: flex; gap: 9px; font-size: 14px; color: var(--text-soft); }
.lesson-points li::before { content: "▸"; color: var(--brand); font-weight: 700; flex: none; }
.lesson-sub { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); margin: 16px 0 8px; }
.code-block { background: #0f172a; color: #e2e8f0; border-radius: var(--radius-sm); overflow: hidden; margin: 10px 0; border: 1px solid #1e293b; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 13px; background: #1e293b; font-size: 11.5px; color: #94a3b8; font-family: var(--mono); }
.code-block pre { padding: 13px; overflow-x: auto; font-family: var(--mono); font-size: 12.8px; line-height: 1.65; white-space: pre; }
.term-list { display: grid; gap: 7px; }
.term { display: flex; gap: 8px; font-size: 13.5px; color: var(--text-soft); }
.term b { color: var(--text); flex: none; }
.pitfall-list { display: grid; gap: 7px; }
.pitfall { display: flex; gap: 9px; font-size: 13.5px; color: var(--text-soft); }
.pitfall::before { content: "⚠"; color: var(--warn); flex: none; }
.check-list { display: grid; gap: 7px; }
.check { display: flex; gap: 9px; font-size: 13.5px; color: var(--text-soft); }
.check::before { content: "✓"; color: var(--success); font-weight: 800; flex: none; }
.lab-box { background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 14px; font-size: 13.5px; color: var(--text-soft); margin: 12px 0; }
.lab-box b { color: var(--brand); }

/* ---------- admin console ---------- */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px; box-shadow: var(--shadow-sm);
}
.tab {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 650; padding: 9px 15px;
  border-radius: 9px; cursor: pointer; transition: background .16s, color .16s;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.active { background: var(--brand-soft); color: var(--brand-strong); }
.check-row {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13.5px; color: var(--text-soft); cursor: pointer;
}
.check-row input { margin-top: 2px; flex: none; accent-color: var(--brand); }
.check-row strong { display: block; color: var(--text); font-weight: 650; line-height: 1.4; }
.bank-row.is-picked { border-color: var(--brand-ring); background: var(--brand-soft); }
.nowrap { white-space: nowrap; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 11px 14px; background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.9px; font-weight: 800; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid var(--border); color: var(--text-soft); }
td strong { color: var(--text); }
tbody tr:hover { background: var(--surface-2); }

/* ---------- exam ---------- */
.exam-shell { max-width: 880px; margin: 0 auto; }
.exam-bar {
  position: sticky; top: 0; z-index: 15; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap; box-shadow: var(--shadow); margin-bottom: 18px;
}
.timer { font-family: var(--mono); font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.timer.warning { color: var(--danger); }
.q-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.q-head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 12px; }
.q-num { font-size: 12px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: 1px; flex: none; }
.q-text { font-size: 15.5px; font-weight: 650; line-height: 1.45; }
.q-options { display: grid; gap: 9px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 14.5px; color: var(--text-soft);
  transition: border-color .14s, background .14s;
}
.opt:hover { border-color: var(--brand-ring); background: var(--brand-soft); }
.opt input { margin: 3px 0 0; accent-color: var(--brand); }
.opt.selected { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.opt-key {
  width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 800; color: var(--muted);
}
.opt.selected .opt-key { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- results ---------- */
.result-hero { text-align: center; padding: 30px 20px 26px; }
.score-ring { width: 148px; height: 148px; margin: 0 auto 16px; position: relative; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 12; }
.score-ring .ring-fg { fill: none; stroke: var(--brand); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.score-ring.pass .ring-fg { stroke: var(--success); }
.score-ring.fail .ring-fg { stroke: var(--danger); }
.score-ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.score-ring .ring-value { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.score-ring .ring-sub { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.verdict { display: inline-flex; align-items: center; gap: 7px; padding: 6px 15px; border-radius: 999px; font-size: 13px; font-weight: 750; }
.verdict.pass { background: var(--success-soft); color: var(--success); }
.verdict.fail { background: var(--danger-soft); color: var(--danger); }
.review-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.review-head { display: flex; gap: 12px; align-items: flex-start; padding: 15px 17px; }
.review-icon { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; }
.review-icon.ok { background: var(--success-soft); color: var(--success); }
.review-icon.no { background: var(--danger-soft); color: var(--danger); }
.review-icon svg { width: 15px; height: 15px; }
.review-body { padding: 0 17px 16px; }
.answer-line { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.answer-box { padding: 9px 13px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid transparent; }
.answer-box b { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 3px; opacity: .8; }
.answer-wrong { background: var(--danger-soft); color: var(--danger); border-color: rgba(185, 28, 28, .18); }
.answer-right { background: var(--success-soft); color: var(--success); border-color: rgba(4, 120, 87, .18); }
.answer-muted { background: var(--surface-3); color: var(--muted); }
.explanation { background: var(--surface-2); border-left: 3px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 14px; font-size: 13.8px; color: var(--text-soft); margin-top: 10px; }
.explanation b { color: var(--brand); }

/* ---------- ledger ---------- */
.ledger { display: grid; gap: 12px; }
.ledger-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ledger-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); }
.ledger-dot.done { background: var(--success-soft); color: var(--success); }
.ledger-dot.next { background: var(--warn-soft); color: var(--warn); }
.ledger-dot svg { width: 17px; height: 17px; }
.ledger-main { flex: 1; min-width: 0; }
.ledger-main strong { display: block; font-size: 14.5px; }
.ledger-main span { font-size: 12.5px; color: var(--muted); }
.ledger-amt { font-weight: 800; font-size: 15px; white-space: nowrap; }

.big-bar { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.big-bar i { display: block; height: 100%; }
.big-bar .seg-core { background: linear-gradient(90deg, var(--brand), #60a5fa); }
.big-bar .seg-paid { background: linear-gradient(90deg, var(--success), #34d399); }

/* ---------- chat ---------- */
.chat-shell { display: grid; grid-template-columns: 330px 1fr; gap: 18px; height: calc(100vh - 235px); min-height: 470px; }
.chat-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.chat-list-head { padding: 16px 18px; border-bottom: 1px solid var(--border); display: grid; gap: 12px; }
.chat-list-head h3 { font-size: 15.5px; font-weight: 750; }
.chat-search {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 14px;
}
.chat-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); background: var(--surface); }
.chat-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  appearance: none; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 650; padding: 7px 13px; border-radius: 999px;
  cursor: pointer; transition: background .15s, color .15s;
}
.pill:hover { background: var(--surface-3); color: var(--text); }
.pill.on { background: var(--brand-soft); color: var(--brand-strong); border-color: transparent; }
.chat-list-body { overflow-y: auto; padding: 10px; display: grid; gap: 6px; align-content: start; }
.chat-list-body > * { min-width: 0; }
.thread-row {
  display: flex; gap: 11px; align-items: center; width: 100%; min-width: 0; text-align: left; padding: 11px 12px;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; cursor: pointer;
  font: inherit; color: inherit;
}
.thread-row:hover { background: var(--surface-2); }
.thread-row.active { background: var(--brand-soft); border-color: var(--brand-ring); }
.thread-avatar {
  width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 13px;
}
.thread-avatar.sm { width: 28px; height: 28px; border-radius: 9px; font-size: 11px; }
.thread-info { min-width: 0; flex: 1; overflow: hidden; }
.thread-top { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; min-width: 0; }
.thread-top strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.thread-bottom { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: 3px; min-width: 0; }
.thread-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.unread-badge {
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 800; min-width: 20px; height: 20px;
  padding: 0 6px; border-radius: 999px; display: grid; place-items: center; flex: none;
}
.chat-room { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.chat-bar { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.chat-bar-info { flex: 1; min-width: 0; }
.chat-bar-info strong { display: block; font-size: 14.5px; }
.chat-bar-info span { font-size: 12px; color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.chat-row { display: flex; gap: 9px; align-items: flex-end; max-width: 78%; }
.chat-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 14px 14px 14px 4px; padding: 10px 13px; }
.chat-row.mine .chat-bubble { background: var(--brand); color: #fff; border-color: transparent; border-radius: 14px 14px 4px 14px; }
.chat-bubble p { font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.chat-time { display: block; font-size: 11px; opacity: .65; margin-top: 4px; }
.chat-composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-composer textarea {
  flex: 1; resize: none; max-height: 140px; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit;
  font-size: 14.5px; line-height: 1.45;
}
.chat-composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); background: var(--surface); }
.empty-room { display: grid; place-items: center; }
.only-mobile { display: none; }

/* ---------- calls ---------- */
.call-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.call-row + .call-row { margin-top: 12px; }
.call-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.call-icon svg { width: 20px; height: 20px; }
.call-main { flex: 1; min-width: 0; }
.call-main strong { display: block; font-size: 14.5px; }
.call-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 7px; }
.call-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- profile ---------- */
.profile-hero { display: flex; gap: 20px; align-items: center; padding: 22px 24px; margin-bottom: 18px; flex-wrap: wrap; }
.profile-avatar { width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 28px; font-weight: 800; flex: none; }
.profile-hero-main { flex: 1; min-width: 210px; }
.profile-name { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; margin-top: 4px; }
.profile-role { color: var(--text-soft); font-size: 14px; margin-top: 4px; }
.profile-layout { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.profile-subnav { display: grid; gap: 6px; position: sticky; top: 20px; }
.profile-subnav .pill { text-align: left; border-radius: var(--radius-sm); padding: 10px 14px; }
.profile-sections { display: grid; gap: 18px; min-width: 0; }
.profile-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.profile-stat { padding: 18px 14px; text-align: center; border-right: 1px solid var(--border); }
.profile-stat:last-child { border-right: 0; }
.profile-stat strong { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.profile-stat span { font-size: 12px; color: var(--muted); }
.profile-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.completion-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.completion-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #60a5fa); }

/* ---------- mobile bottom nav ---------- */
.bottom-nav {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(15, 23, 42, .06);
}
.bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 4px; padding: 9px 4px 10px; font-size: 11px; font-weight: 650; color: var(--muted); text-decoration: none; }
.bottom-nav a svg { width: 20px; height: 20px; }
.bottom-nav a.active { color: var(--brand); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 100; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow-lg); font-size: 13.5px;
  max-width: 340px; color: var(--text-soft); animation: slide-in .2s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.locked-hero { text-align: center; padding: 48px 24px; }
.locked-hero .lock-icon { width: 62px; height: 62px; border-radius: 18px; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; margin: 0 auto 16px; }
.locked-hero .lock-icon svg { width: 30px; height: 30px; }
.locked-hero h2 { font-size: 21px; font-weight: 800; }
.locked-hero p { color: var(--muted); max-width: 52ch; margin: 9px auto 18px; font-size: 14.5px; }
.badge-lg { display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge-lg svg { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

@media (max-width: 1000px) {
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
  .auth-wrap {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .auth-aside {
    padding: 22px 26px;
    gap: 0;
    justify-content: flex-start;
  }
  .auth-headline, .auth-copy, .auth-points, .auth-stats, .auth-footer { display: none; }
  .auth-panel { place-items: start center; padding: 36px 26px 56px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .topbar { display: flex; }
  .page { padding: 20px 16px 80px; }
  .scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 55; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .cat-grid { grid-template-columns: 1fr; }

  .chat-shell { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .chat-shell.show-room .chat-list { display: none; }
  .chat-shell:not(.show-room) .chat-room { display: none; }
  .chat-page { display: flex; flex-direction: column; height: calc(100vh - 58px); }
  .chat-page .chat-shell { flex: 1; min-height: 0; }
  .chat-page .chat-room { height: 100%; min-height: 0; }
  .only-mobile { display: grid; }

  .profile-layout { grid-template-columns: 1fr; }
  .profile-subnav { position: static; display: flex; flex-wrap: wrap; }
  .profile-subnav .pill { border-radius: 999px; }
}

@media (max-width: 700px) {
  .q-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .q-card { padding: 16px; }
  .opt { padding: 12px 14px; }
  .bottom-nav { display: flex; }
  .page { padding-bottom: 98px; }
  .chat-body { padding: 14px; }
  .chat-row { max-width: 88%; }
  .profile-hero { padding: 18px; }
  .profile-avatar { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
  .call-row { flex-wrap: wrap; }
  .call-actions { width: 100%; justify-content: flex-start; }
}
