/* ============================================================
   砺网 · 网络系统管理竞赛训练平台
   Design system / app styles
   ============================================================ */

:root {
  --bg: #f3f6fb;
  --bg-2: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --surface-4: #e5ebf3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --brand: #0891b2;
  --brand-2: #06b6d4;
  --brand-3: #22d3ee;
  --brand-deep: #0e7490;
  --accent: #6366f1;
  --navy: #0b1220;
  --navy-2: #111b2e;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --tier1: #f59e0b;
  --tier2: #6366f1;
  --tier3: #64748b;
  --ring-track: #e8eef6;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 8px 26px -14px rgba(15, 23, 42, 0.16);
  --shadow-lg: 0 30px 70px -30px rgba(15, 23, 42, 0.3);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --sidebar: 252px;
  --font: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #070b14;
  --bg-2: #0a101c;
  --surface: #0e1626;
  --surface-2: #121c2e;
  --surface-3: #172337;
  --surface-4: #1e2c43;
  --text: #e8eef8;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: #1e293b;
  --line-strong: #334155;
  --brand: #22d3ee;
  --brand-2: #06b6d4;
  --brand-3: #67e8f9;
  --brand-deep: #0e7490;
  --ring-track: #1e293b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: none; }
button { font-family: inherit; }
::selection { background: rgba(6, 182, 212, 0.22); }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { flex: none; display: block; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 20px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- boot ---------- */
.boot-screen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #10203a 0%, #070c15 65%);
  color: #e2f8ff; gap: 16px;
  transition: opacity .4s ease, visibility .4s;
}
.boot-screen.hide { opacity: 0; visibility: hidden; }
.boot-mark { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 20px; background: rgba(34, 211, 238, .06); border: 1px solid rgba(34, 211, 238, .18); color: #22d3ee; box-shadow: 0 0 60px rgba(34, 211, 238, .18); }
.boot-text { font-size: 18px; letter-spacing: .32em; font-weight: 700; }
.boot-text span { font-size: 10px; letter-spacing: .24em; color: #67e8f9; opacity: .7; margin-left: 6px; }
.boot-bar { width: 132px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.boot-bar i { display: block; width: 40%; height: 100%; background: linear-gradient(90deg, #0891b2, #67e8f9); animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-110%); } 100% { transform: translateX(330%); } }

/* ---------- shell ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 60;
  background:
    radial-gradient(120% 55% at 0% 0%, rgba(6, 182, 212, .13), transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(99, 102, 241, .12), transparent 60%),
    linear-gradient(180deg, #0b1220 0%, #0b1322 60%, #0a101d 100%);
  color: #cbd5e1; display: flex; flex-direction: column;
  border-right: 1px solid rgba(148, 163, 184, .1);
  transition: transform .25s ease;
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .4;
  background-image: linear-gradient(rgba(148,163,184,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,.045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}
.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; padding: 22px 20px 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(34,211,238,.18), rgba(99,102,241,.14));
  border: 1px solid rgba(103, 232, 249, .22); color: #67e8f9;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 4px 18px rgba(6,182,212,.15);
}
.brand-copy b { display: block; font-size: 17px; color: #f1f5f9; letter-spacing: .14em; line-height: 1.3; }
.brand-copy small { display: block; font-size: 9px; color: #64748b; letter-spacing: .18em; text-transform: uppercase; }
.brand-tag { margin-left: auto; font-size: 9px; color: #67e8f9; border: 1px solid rgba(103,232,249,.22); background: rgba(34,211,238,.08); padding: 2px 6px; border-radius: 20px; letter-spacing: .08em; }

.nav-scroll { position: relative; z-index: 1; flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-group { margin-top: 18px; }
.nav-group-label { padding: 0 10px 8px; font-size: 10px; letter-spacing: .14em; color: #526179; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; margin-bottom: 2px;
  border-radius: 9px; color: #94a3b8; font-size: 13.5px; font-weight: 500;
  transition: background .16s ease, color .16s ease, transform .16s ease; position: relative;
}
.nav-link:hover { background: rgba(148, 163, 184, .07); color: #e2e8f0; text-decoration: none; }
.nav-link.active { background: linear-gradient(90deg, rgba(6, 182, 212, .16), rgba(6, 182, 212, .05)); color: #a5f3fc; box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .1); }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #22d3ee; box-shadow: 0 0 12px rgba(34,211,238,.7); }
.nav-link .nav-badge { margin-left: auto; font-size: 10px; background: rgba(34, 211, 238, .14); color: #67e8f9; border-radius: 20px; padding: 1px 6px; }
.nav-link .ic { opacity: .85; }
.nav-link.active .ic { opacity: 1; }

.sidebar-card { position: relative; z-index: 1; margin: 0 14px 14px; padding: 14px; border-radius: 12px; background: linear-gradient(145deg, rgba(34,211,238,.09), rgba(99,102,241,.07)); border: 1px solid rgba(103,232,249,.14); }
.sidebar-card .sc-top { display: flex; align-items: center; gap: 7px; font-size: 11px; color: #67e8f9; font-weight: 600; letter-spacing: .04em; }
.sidebar-card p { margin: 7px 0 10px; font-size: 11.5px; color: #94a3b8; line-height: 1.55; }
.sidebar-card .sc-bar { height: 5px; border-radius: 10px; background: rgba(255,255,255,.08); overflow: hidden; }
.sidebar-card .sc-bar i { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, #0891b2, #67e8f9); }
.sidebar-card .sc-meta { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: #64748b; }

.sidebar-user { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: 0 10px 12px; border-radius: 11px; border: 1px solid rgba(148,163,184,.1); background: rgba(15,23,42,.55); cursor: pointer; }
.sidebar-user:hover { background: rgba(30,41,59,.6); }
.sidebar-user .su-meta { min-width: 0; flex: 1; }
.sidebar-user b { display: block; color: #e2e8f0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { display: block; color: #64748b; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .su-more { color: #64748b; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; }
.crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.crumb b { color: var(--text); font-weight: 600; }
.crumb .sep { color: var(--faint); }
.topbar-search { margin-left: auto; width: min(320px, 32vw); position: relative; }
.topbar-search input { width: 100%; height: 37px; padding: 0 12px 0 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 12.5px; }
.topbar-search input:focus { border-color: var(--brand-2); outline: none; box-shadow: 0 0 0 3px rgba(6,182,212,.1); }
.topbar-search .ic { position: absolute; left: 11px; top: 10px; color: var(--faint); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; transition: all .16s ease; }
.icon-btn:hover { color: var(--brand); border-color: var(--brand-2); background: var(--surface-2); }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.notif-btn { position: relative; }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; border: 1.5px solid var(--surface); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 30px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.user-chip b { font-size: 12.5px; font-weight: 600; }
.user-chip small { display: block; font-size: 10px; color: var(--muted); line-height: 1.2; }

.page { padding: 26px 28px 48px; width: 100%; max-width: 1400px; margin: 0 auto; animation: pageIn .35s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- typography ---------- */
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.grid-main { grid-template-columns: minmax(0, 1fr) 320px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--brand); text-transform: uppercase; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.page-head h1 { font-size: 24px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 5px; max-width: 720px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-hover { transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand-2) 35%, var(--line)); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.card-head h3 { font-size: 15px; }
.card-head p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.card-body { padding: 16px 20px 20px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h3 { font-size: 15px; }
.section-head p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.section-link { font-size: 12px; color: var(--brand); display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease, box-shadow .16s ease;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, #0891b2, #0e7490); color: #fff; box-shadow: 0 4px 14px -4px rgba(8,145,178,.55); }
.btn-primary:hover { background: linear-gradient(135deg, #06b6d4, #0891b2); box-shadow: 0 7px 20px -6px rgba(8,145,178,.6); }
.btn-accent { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; box-shadow: 0 4px 14px -4px rgba(99,102,241,.5); }
.btn-accent:hover { background: linear-gradient(135deg, #818cf8, #6366f1); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--brand-2); color: var(--brand); background: var(--surface-2); }
.btn-soft { background: rgba(6,182,212,.09); color: var(--brand); border-color: rgba(6,182,212,.18); }
.btn-soft:hover { background: rgba(6,182,212,.15); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-danger-soft { background: rgba(239,68,68,.08); color: var(--danger); border-color: rgba(239,68,68,.18); }
.btn-sm { height: 31px; padding: 0 10px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn-link { height: auto; padding: 0; background: none; border: none; color: var(--brand); font-weight: 600; font-size: 12.5px; }
.btn .ic { width: 16px; height: 16px; }
.btn-lg .ic { width: 18px; height: 18px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(16,185,129,.1); color: #059669; }
.badge-info { background: rgba(59,130,246,.1); color: #2563eb; }
.badge-warning { background: rgba(245,158,11,.12); color: #b45309; }
.badge-danger { background: rgba(239,68,68,.1); color: #dc2626; }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge-purple { background: rgba(99,102,241,.1); color: #4f46e5; }
[data-theme="dark"] .badge-success { color: #34d399; }
[data-theme="dark"] .badge-info { color: #93c5fd; }
[data-theme="dark"] .badge-warning { color: #fbbf24; }
[data-theme="dark"] .badge-danger { color: #f87171; }
[data-theme="dark"] .badge-purple { color: #a5b4fc; }
.tier-badge.tier-1 { background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.18); }
.tier-badge.tier-2 { background: rgba(99,102,241,.1); color: #4f46e5; border: 1px solid rgba(99,102,241,.16); }
.tier-badge.tier-3 { background: rgba(100,116,139,.1); color: #475569; border: 1px solid rgba(100,116,139,.16); }
[data-theme="dark"] .tier-badge.tier-1 { color: #fcd34d; }
[data-theme="dark"] .tier-badge.tier-2 { color: #a5b4fc; }
[data-theme="dark"] .tier-badge.tier-3 { color: #cbd5e1; }

/* ---------- avatar ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; letter-spacing: -.02em; background: linear-gradient(145deg, color-mix(in srgb, var(--avatar) 88%, #fff), color-mix(in srgb, var(--avatar) 72%, #000)); flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); user-select: none; }
.avatar.square { border-radius: 10px; }

/* ---------- progress / ring ---------- */
.progress { display: block; width: 100%; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 20px; transition: width .5s ease; }
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring-label { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ring-label b { font-size: 18px; font-weight: 800; color: var(--text); }
.ring-label small { font-size: 9px; color: var(--muted); }
.ring-label em { font-style: normal; font-size: 8.5px; color: var(--faint); margin-top: 2px; }

/* ---------- forms ---------- */
.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 11px; color: var(--faint); margin-top: 5px; }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 9px; font-family: inherit; font-size: 13px; transition: border-color .16s, box-shadow .16s;
}
.input, .select { height: 40px; padding: 0 11px; }
.textarea { padding: 10px 11px; min-height: 96px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(6,182,212,.1); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
textarea.textarea { font-family: inherit; }
.input-sm { height: 33px; font-size: 12px; border-radius: 7px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.check-pill { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 12.5px; transition: all .15s; background: var(--surface); }
.check-pill:hover { border-color: var(--brand-2); background: var(--surface-2); }
.check-pill.checked { border-color: var(--brand-2); background: rgba(6,182,212,.06); }
.check-pill input { margin-top: 2px; accent-color: var(--brand); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--line-strong); cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand-2); }
.switch input:checked + span::before { transform: translateX(16px); }

.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search-box { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.toolbar .search-box input { padding-left: 33px; }
.toolbar .search-box .ic { position: absolute; left: 10px; top: 11px; color: var(--faint); }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; }
.segmented button { border: none; background: transparent; color: var(--muted); padding: 6px 11px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.data-table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th:first-child { border-top-left-radius: 8px; }
.data-table th:last-child { border-top-right-radius: 8px; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table .cell-main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.data-table .cell-main b { color: var(--text); font-size: 13px; font-weight: 600; display: block; }
.data-table .cell-main small { color: var(--faint); font-size: 10.5px; display: block; }
.data-table .num { font-variant-numeric: tabular-nums; font-weight: 700; }
.table-actions { display: flex; align-items: center; gap: 3px; justify-content: flex-end; }
.table-empty { padding: 46px 10px; }

/* ---------- bars / charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart-axis { font-size: 9.5px; fill: var(--faint); font-family: var(--font); }
.chart-label { font-size: 11.5px; fill: var(--text-2); font-family: var(--font); }
.chart-value { font-size: 11.5px; fill: var(--text); font-weight: 700; font-family: var(--font); }
.radar-label { font-size: 10.5px; fill: var(--muted); font-family: var(--font); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut-total { font-size: 26px; font-weight: 800; fill: var(--text); font-family: var(--font); }
.donut-label { font-size: 9px; fill: var(--muted); font-family: var(--font); letter-spacing: .08em; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 11.5px; color: var(--muted); }
.donut-legend span { display: flex; align-items: center; gap: 7px; }
.donut-legend i { width: 8px; height: 8px; border-radius: 2px; }
.donut-legend b { margin-left: auto; color: var(--text); font-weight: 700; padding-left: 10px; }

/* ---------- kpi ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.kpi { padding: 17px 18px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; width: 90px; height: 90px; right: -38px; top: -38px; border-radius: 50%; background: var(--kpi-glow, rgba(6,182,212,.07)); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.kpi-icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; background: var(--kpi-soft, rgba(6,182,212,.1)); color: var(--kpi-color, var(--brand)); }
.kpi-value { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.kpi-foot { margin-top: 7px; font-size: 10.5px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.kpi-foot .up { color: var(--success); font-weight: 700; }
.kpi-foot .down { color: var(--danger); font-weight: 700; }

/* ---------- empty / loading ---------- */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 15px; display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--faint); }
.empty-state h4 { font-size: 14px; margin-bottom: 5px; }
.empty-state p { font-size: 12px; color: var(--muted); max-width: 320px; margin: 0 auto 14px; line-height: 1.65; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 20px; color: var(--muted); font-size: 12.5px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brand-2); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(8, 15, 28, .52); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px; opacity: 0; transition: opacity .16s; }
.modal-backdrop.open { opacity: 1; }
.modal { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow-lg); transform: translateY(10px) scale(.985); transition: transform .2s ease; max-height: min(88vh, 900px); display: flex; flex-direction: column; overflow: hidden; }
.modal-backdrop.open .modal { transform: none; }
.modal-backdrop.closing { opacity: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 14px; }
.modal-head h3 { font-size: 16px; }
.modal-head p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
.confirm-message { font-size: 13px; color: var(--text-2); line-height: 1.7; padding: 4px 0 10px; }

/* ---------- toast ---------- */
.toast-root { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; min-width: 220px; max-width: 380px; padding: 11px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); color: var(--text-2); font-size: 12.5px; transform: translateX(14px); opacity: 0; transition: all .24s ease; pointer-events: auto; }
.toast.show { transform: none; opacity: 1; }
.toast-success .ic { color: var(--success); }
.toast-error .ic { color: var(--danger); }
.toast-info .ic { color: var(--info); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(430px, .9fr); background: var(--bg); }
.auth-visual { position: relative; overflow: hidden; padding: 46px 52px; color: #e2e8f0; background: radial-gradient(90% 80% at 15% 10%, #12314a 0%, #0b1220 55%, #070c15 100%); display: flex; flex-direction: column; justify-content: space-between; }
.auth-visual::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(103,232,249,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(103,232,249,.06) 1px, transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(circle at 50% 45%, black, transparent 75%); }
.auth-visual::after { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -200px; bottom: -220px; background: radial-gradient(circle, rgba(6,182,212,.18), transparent 65%); }
.auth-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; }
.auth-brand .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
.auth-brand b { font-size: 21px; letter-spacing: .18em; color: #f8fafc; }
.auth-brand small { display: block; font-size: 9px; letter-spacing: .2em; color: #64748b; margin-top: 2px; }
.auth-hero { position: relative; z-index: 2; margin: 32px 0; max-width: 560px; }
.auth-kicker { display: inline-flex; align-items: center; gap: 7px; color: #67e8f9; font-size: 11px; letter-spacing: .14em; border: 1px solid rgba(103,232,249,.22); background: rgba(34,211,238,.06); padding: 5px 9px; border-radius: 20px; margin-bottom: 20px; }
.auth-hero h1 { font-size: clamp(30px, 3.5vw, 46px); line-height: 1.22; color: #f8fafc; letter-spacing: -.02em; }
.auth-hero h1 em { font-style: normal; background: linear-gradient(100deg, #67e8f9, #818cf8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { margin-top: 16px; color: #94a3b8; font-size: 14px; line-height: 1.9; max-width: 480px; }
.auth-stats { display: flex; gap: 30px; margin-top: 34px; }
.auth-stats b { font-size: 25px; color: #e2f8ff; display: block; line-height: 1.2; font-variant-numeric: tabular-nums; }
.auth-stats span { font-size: 10.5px; color: #64748b; letter-spacing: .06em; }
.auth-visual-foot { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; color: #526179; border-top: 1px solid rgba(148,163,184,.12); padding-top: 18px; }
.auth-topology { position: absolute; inset: 0; z-index: 1; opacity: .65; pointer-events: none; }
.auth-topology .node { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #67e8f9; box-shadow: 0 0 18px rgba(103,232,249,.8); animation: pulse 3s ease-in-out infinite; }
.auth-topology .node::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 1px solid rgba(103,232,249,.25); }
.auth-topology .ring-line { position: absolute; border: 1px solid rgba(103,232,249,.1); border-radius: 50%; }
@keyframes pulse { 0%, 100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.15); } }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--surface); }
.auth-card { width: 100%; max-width: 386px; }
.auth-card .welcome { font-size: 11px; letter-spacing: .16em; color: var(--brand); font-weight: 700; text-transform: uppercase; }
.auth-card h2 { font-size: 27px; margin: 7px 0 6px; letter-spacing: -.02em; }
.auth-card .lead { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.auth-input { position: relative; }
.auth-input .ic { position: absolute; left: 13px; top: 12px; color: var(--faint); }
.auth-input input { height: 45px; padding-left: 40px; border-radius: 10px; background: var(--surface-2); }
.auth-input .pwd-toggle { position: absolute; right: 6px; top: 5px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.auth-submit { height: 45px; border-radius: 10px; font-size: 14px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--faint); font-size: 10.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.demo-btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; text-align: left; cursor: pointer; transition: all .16s; }
.demo-btn:hover { border-color: var(--brand-2); background: var(--surface); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.demo-btn b { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); }
.demo-btn span { display: block; font-size: 10px; color: var(--faint); margin-top: 3px; }
.auth-legal { margin-top: 24px; font-size: 10.5px; color: var(--faint); text-align: center; line-height: 1.7; }
.auth-theme { position: absolute; right: 18px; top: 18px; }

/* ---------- student dashboard ---------- */
.greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.greeting h1 { font-size: 26px; }
.greeting .sub { color: var(--muted); font-size: 13px; margin-top: 5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.greeting-date { text-align: right; font-size: 11px; color: var(--faint); }
.greeting-date b { display: block; font-size: 23px; color: var(--text); letter-spacing: -.03em; line-height: 1.2; }

.hero-card { position: relative; overflow: hidden; border-radius: var(--radius-xl); padding: 24px 26px; color: #ecfeff; background: radial-gradient(100% 160% at 100% 0%, #0e7490 0%, #0b3a4a 38%, #0b1220 100%); border: 1px solid rgba(103,232,249,.18); box-shadow: 0 22px 50px -28px rgba(8,145,178,.55); min-height: 0; }
.hero-card::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle at 80% 20%, rgba(103,232,249,.16), transparent 35%), linear-gradient(rgba(103,232,249,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(103,232,249,.045) 1px, transparent 1px); background-size: auto, 30px 30px, 30px 30px; mask-image: linear-gradient(90deg, transparent, black); }
.hero-card > * { position: relative; z-index: 1; }
.hero-label { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: #67e8f9; letter-spacing: .12em; border: 1px solid rgba(103,232,249,.22); padding: 3px 8px; border-radius: 20px; background: rgba(34,211,238,.08); }
.hero-card h2 { color: #f0fdff; font-size: 21px; margin: 14px 0 7px; line-height: 1.4; }
.hero-card p { color: #a5d8e4; font-size: 12px; line-height: 1.7; }
.hero-meta { display: flex; gap: 16px; margin: 16px 0 18px; font-size: 10.5px; color: #7fb6c4; }
.hero-meta span { display: flex; align-items: center; gap: 5px; }
.hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn-primary { background: #22d3ee; color: #062c35; box-shadow: 0 8px 22px -8px rgba(34,211,238,.7); }
.hero-actions .btn-primary:hover { background: #67e8f9; }
.hero-ghost { color: #a5f3fc; border: 1px solid rgba(103,232,249,.22); background: rgba(103,232,249,.06); }
.hero-ghost:hover { background: rgba(103,232,249,.12); color: #ecfeff; }
.hero-progress { margin-top: 18px; }
.hero-progress .progress { background: rgba(255,255,255,.1); }
.hero-progress .bar-label { display: flex; justify-content: space-between; font-size: 10px; color: #7fb6c4; margin-bottom: 5px; }

.exam-alert { display: flex; align-items: center; gap: 14px; padding: 15px 18px; border-radius: 14px; border: 1px solid rgba(245,158,11,.22); background: linear-gradient(100deg, rgba(245,158,11,.09), transparent 70%); }
.exam-alert .ea-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: rgba(245,158,11,.14); color: #b45309; flex: none; }
.exam-alert .ea-main { flex: 1; min-width: 0; }
.exam-alert b { display: block; font-size: 13px; }
.exam-alert small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.exam-alert .ea-count { font-family: var(--mono); font-size: 13px; font-weight: 700; color: #b45309; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.module-card { position: relative; padding: 18px; overflow: hidden; }
.module-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--module-color); opacity: .8; }
.module-card .mc-top { display: flex; align-items: center; gap: 10px; }
.module-card .mc-icon { width: 37px; height: 37px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--module-color) 12%, transparent); color: var(--module-color); }
.module-card .mc-title b { display: block; font-size: 13.5px; color: var(--text); }
.module-card .mc-title small { display: block; font-size: 10px; color: var(--faint); margin-top: 1px; }
.module-card .mc-pct { margin-left: auto; font-size: 17px; font-weight: 800; color: var(--module-color); }
.module-card .mc-bar { margin: 14px 0 10px; }
.module-card .mc-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }

.todo-list { display: flex; flex-direction: column; }
.todo-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.todo-item:last-child { border-bottom: none; padding-bottom: 0; }
.todo-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-2); margin-top: 7px; flex: none; }
.todo-item b { display: block; font-size: 12.5px; font-weight: 600; }
.todo-item small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.todo-item .todo-time { margin-left: auto; font-size: 10px; color: var(--faint); white-space: nowrap; }

.result-mini { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.result-mini:last-child { border-bottom: none; }
.result-mini .rm-score { margin-left: auto; text-align: right; }
.result-mini .rm-score b { font-size: 16px; font-weight: 800; }
.result-mini .rm-score small { display: block; font-size: 9.5px; color: var(--faint); }
.result-mini small { display: block; }
button.result-mini { width: 100%; border: none; background: transparent; text-align: left; cursor: pointer; padding: 9px 0; }

/* ---------- learning ---------- */
.learn-hero { position: relative; overflow: hidden; padding: 26px; border-radius: var(--radius-xl); background: linear-gradient(115deg, var(--surface) 0%, var(--surface-2) 100%); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; }
.learn-hero::after { content: ""; position: absolute; right: -80px; top: -110px; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(6,182,212,.1), transparent 65%); }
.learn-hero h2 { font-size: 21px; margin: 8px 0 7px; }
.learn-hero p { font-size: 12.5px; color: var(--muted); max-width: 640px; line-height: 1.7; }
.learn-hero .lh-actions { display: flex; gap: 9px; margin-top: 15px; flex-wrap: wrap; }
.module-tabs { display: flex; gap: 8px; margin: 20px 0 16px; flex-wrap: wrap; }
.module-tab { display: flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .16s; }
.module-tab.active { border-color: var(--tab-color, var(--brand-2)); background: color-mix(in srgb, var(--tab-color, var(--brand-2)) 8%, transparent); color: var(--tab-color, var(--brand)); }
.module-tab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tab-color); }
.kp-list { display: flex; flex-direction: column; gap: 8px; }
.kp-item { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer; transition: all .16s; }
.kp-item:hover { border-color: var(--brand-2); box-shadow: var(--shadow-sm); transform: translateX(2px); }
.kp-index { width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: var(--brand); background: rgba(6,182,212,.08); flex: none; }
.kp-main { flex: 1; min-width: 0; }
.kp-main b { display: block; font-size: 13px; font-weight: 600; }
.kp-main small { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kp-meta { display: flex; align-items: center; gap: 10px; font-size: 10px; color: var(--faint); flex: none; }
.diff-dots { display: inline-flex; gap: 3px; }
.diff-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.diff-dots i.on { background: var(--warning); }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.lesson-main { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.lesson-cover { padding: 28px 32px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, rgba(6,182,212,.06), transparent 65%); }
.lesson-cover .lc-meta { display: flex; gap: 10px; align-items: center; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.lesson-cover h1 { font-size: 25px; margin: 12px 0 8px; }
.lesson-cover p { font-size: 13px; color: var(--muted); max-width: 720px; line-height: 1.75; }
.lesson-body { padding: 28px 34px 34px; }
.lesson-aside { position: sticky; top: 86px; display: flex; flex-direction: column; gap: 14px; }
.lesson-toc { padding: 16px; }
.lesson-toc h4 { font-size: 11px; letter-spacing: .08em; color: var(--faint); margin-bottom: 9px; text-transform: uppercase; }
.lesson-toc a { display: block; font-size: 11.5px; color: var(--muted); padding: 5px 0 5px 9px; border-left: 2px solid transparent; }
.lesson-toc a:hover { color: var(--brand); border-left-color: var(--brand-2); }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; padding: 18px 34px; border-top: 1px solid var(--line); background: var(--surface-2); }
.lesson-complete { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 11px; border: 1px solid rgba(16,185,129,.2); background: rgba(16,185,129,.06); font-size: 11.5px; color: #047857; }

/* markdown */
.md-h { scroll-margin-top: 84px; }
.lesson-body h2.md-h { font-size: 19px; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.lesson-body h2.md-h:first-child { margin-top: 0; }
.lesson-body h3.md-h { font-size: 15px; margin: 24px 0 9px; color: var(--text); }
.lesson-body h4.md-h { font-size: 13.5px; margin: 18px 0 8px; }
.lesson-body p { font-size: 13.5px; line-height: 1.95; color: var(--text-2); margin: 0 0 12px; }
.lesson-body strong { color: var(--text); }
.lesson-body code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); color: #be185d; padding: 1.5px 5px; border-radius: 4px; }
[data-theme="dark"] .lesson-body code { color: #f9a8d4; }
.lesson-body .md-list { margin: 0 0 14px; padding-left: 20px; }
.lesson-body .md-list li { font-size: 13.5px; line-height: 1.9; color: var(--text-2); margin: 4px 0; }
.lesson-body mark { background: rgba(250,204,21,.28); color: inherit; padding: 0 2px; border-radius: 2px; }
.lesson-body hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }
.md-callout { border-left: 3px solid var(--brand-2); background: rgba(6,182,212,.055); border-radius: 0 9px 9px 0; padding: 11px 14px; margin: 14px 0; font-size: 12.5px; color: var(--text-2); line-height: 1.8; }
.md-callout strong { color: var(--brand-deep); }
[data-theme="dark"] .md-callout strong { color: var(--brand-3); }
.code-block { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 14px 0; background: #0d1524; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; background: #111c30; border-bottom: 1px solid rgba(148,163,184,.12); font-size: 10px; color: #64748b; letter-spacing: .08em; text-transform: uppercase; }
.code-copy { border: none; background: transparent; color: #67e8f9; font-size: 10px; cursor: pointer; }
.code-copy:hover { text-decoration: underline; }
.code-block pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
.code-block code { background: none; color: #d7e4f5; padding: 0; font-size: 12px; line-height: 1.8; font-family: var(--mono); }
.md-table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 9px; }
.md-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.md-table th { text-align: left; background: var(--surface-2); color: var(--text-2); padding: 9px 12px; font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
.md-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--text-2); }
.md-table tr:last-child td { border-bottom: none; }

/* ---------- exam cards / list ---------- */
.exam-list { display: flex; flex-direction: column; gap: 11px; }
.exam-card { display: flex; align-items: center; gap: 16px; padding: 17px 19px; }
.exam-card .ec-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(6,182,212,.08); color: var(--brand); flex: none; }
.exam-card .ec-main { flex: 1; min-width: 0; }
.exam-card .ec-main b { display: block; font-size: 14px; font-weight: 700; }
.exam-card .ec-main small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.exam-card .ec-side { display: flex; align-items: center; gap: 12px; flex: none; }
.exam-card .ec-progress { width: 100%; max-width: 320px; }

/* ---------- exam taking ---------- */
.exam-shell { min-height: 100vh; background: var(--bg); }
.exam-top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; }
.exam-top .et-title { min-width: 0; flex: 1 1 auto; overflow: hidden; }
.exam-top .et-title b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-top .et-title small { display: block; font-size: 10.5px; color: var(--muted); }
.exam-timer { margin-left: auto; display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: .04em; padding: 5px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); flex: none; }
.exam-top #exam-submit-top { flex: none; }
.exam-top #save-state { flex: none; }
.exam-timer.danger { color: var(--danger); border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.06); animation: timerPulse 1.4s infinite; }
@keyframes timerPulse { 50% { box-shadow: 0 0 0 4px rgba(239,68,68,.08); } }
.exam-layout { display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 20px; max-width: 1180px; margin: 0 auto; padding: 20px 24px 60px; align-items: start; }
.exam-main { display: flex; flex-direction: column; gap: 14px; }
.exam-aside { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 12px; }
.question-card { padding: 22px 24px; }
.q-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.q-no { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--brand); background: rgba(6,182,212,.08); padding: 3px 7px; border-radius: 5px; flex: none; margin-top: 1px; }
.q-type { font-size: 10px; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 20px; flex: none; margin-top: 2px; }
.q-points { margin-left: auto; font-size: 11px; color: var(--faint); white-space: nowrap; }
.q-stem { font-size: 14px; line-height: 1.8; color: var(--text); font-weight: 500; }
.q-scenario { margin-top: 12px; padding: 12px 14px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.75; }
.q-options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.option { display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; transition: all .15s; background: var(--surface); }
.option:hover { border-color: var(--brand-2); background: var(--surface-2); }
.option.selected { border-color: var(--brand-2); background: rgba(6,182,212,.06); box-shadow: 0 0 0 1px var(--brand-2) inset; }
.option input { margin-top: 3px; accent-color: var(--brand); }
.option .opt-key { font-weight: 800; font-size: 12px; color: var(--muted); width: 16px; flex: none; }
.option .opt-text { font-size: 13px; line-height: 1.65; color: var(--text-2); }
.option.selected .opt-key { color: var(--brand); }
.q-input { margin-top: 14px; }
.q-requirements { margin: 13px 0 0; padding-left: 18px; }
.q-requirements li { font-size: 12.5px; line-height: 1.85; color: var(--text-2); margin: 3px 0; }
.q-evidence { margin-top: 4px; }
.q-evidence textarea { min-height: 150px; font-family: var(--mono); font-size: 11.5px; line-height: 1.7; }
.q-tools { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 8px; font-size: 10.5px; color: var(--faint); }
.q-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.q-nav a { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line); font-size: 10px; color: var(--muted); font-family: var(--mono); }
.q-nav a.answered { background: rgba(6,182,212,.1); border-color: rgba(6,182,212,.25); color: var(--brand); }
.q-nav a.flag { outline: 2px solid rgba(245,158,11,.5); }
.exam-side-card { padding: 15px; }
.exam-side-card h4 { font-size: 11.5px; margin-bottom: 9px; }
.exam-side-card .side-row { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 4px 0; }
.exam-side-card .side-row b { color: var(--text); }

/* ---------- result ---------- */
.result-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 28px 30px; border-radius: var(--radius-xl); color: #f0fdfa; background: radial-gradient(120% 150% at 0% 0%, #0f766e, #0b3b45 48%, #0b1220); border: 1px solid rgba(45,212,191,.2); }
.result-hero.fail { background: radial-gradient(120% 150% at 0% 0%, #7f1d1d, #3f1d2b 48%, #150b12); border-color: rgba(248,113,113,.2); }
.result-hero::after { content: ""; position: absolute; right: -40px; bottom: -120px; width: 340px; height: 340px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 0 0 50px rgba(255,255,255,.025), 0 0 0 100px rgba(255,255,255,.018); }
.result-hero > * { position: relative; z-index: 1; }
.result-kicker { font-size: 10.5px; letter-spacing: .16em; color: #99f6e4; }
.result-hero h1 { color: #f0fdfa; font-size: 24px; margin: 8px 0 4px; }
.result-hero p { color: #99c9c4; font-size: 12px; }
.result-score { text-align: right; }
.result-score b { display: block; font-size: 52px; line-height: 1; font-weight: 800; letter-spacing: -.05em; }
.result-score b small { font-size: 18px; color: #99f6e4; font-weight: 600; letter-spacing: 0; }
.result-score span { display: block; font-size: 11px; color: #99c9c4; margin-top: 6px; }
.result-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 20px; background: rgba(255,255,255,.1); font-size: 10.5px; margin-top: 10px; }
.result-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.result-stat { padding: 14px 16px; }
.result-stat span { font-size: 10.5px; color: var(--muted); }
.result-stat b { display: block; font-size: 20px; margin-top: 4px; font-weight: 800; }
.review-q { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin-bottom: 9px; background: var(--surface); }
.review-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; cursor: pointer; }
.review-head .rq-no { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.review-head .rq-stem { flex: 1; font-size: 12.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-head .rq-score { font-size: 12px; font-weight: 800; font-family: var(--mono); }
.review-body { padding: 0 15px 15px; border-top: 1px dashed var(--line); margin-top: 0; }
.review-answer { padding: 12px 0 0; font-size: 12px; color: var(--text-2); line-height: 1.75; }
.review-answer .lbl { font-size: 10.5px; color: var(--faint); display: block; margin-bottom: 2px; }
.review-check { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 11.5px; }
.review-check:last-child { border-bottom: none; }
.review-check .rc-ic { margin-top: 2px; }
.review-check .rc-ic.ok { color: var(--success); }
.review-check .rc-ic.no { color: var(--danger); }
.review-check .rc-label { flex: 1; color: var(--text-2); }
.review-check .rc-score { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.review-check .rc-hint { display: block; color: var(--faint); font-size: 10px; margin-top: 2px; }
.score-excellent { color: #059669; } .score-good { color: #0891b2; } .score-pass { color: #d97706; } .score-fail { color: #dc2626; }

/* ---------- teacher ---------- */
.teacher-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px; border-radius: var(--radius-xl); background: linear-gradient(110deg, #0b1220, #0e2a3d 58%, #0b3a4a); color: #e2e8f0; border: 1px solid rgba(103,232,249,.14); position: relative; overflow: hidden; }
.teacher-hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(103,232,249,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(103,232,249,.04) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, black); }
.teacher-hero > * { position: relative; z-index: 1; }
.teacher-hero h1 { color: #f8fafc; font-size: 23px; }
.teacher-hero p { color: #94a3b8; font-size: 12.5px; margin-top: 6px; }
.teacher-hero .th-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.teacher-hero .btn-ghost { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #e2e8f0; }
.teacher-hero .btn-ghost:hover { background: rgba(255,255,255,.1); border-color: rgba(103,232,249,.4); color: #fff; }
.teacher-hero .btn-primary { background: #22d3ee; color: #062c35; }
.teacher-hero .btn-primary:hover { background: #67e8f9; }

.tier-strip { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.tier-cell { padding: 13px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); position: relative; overflow: hidden; }
.tier-cell::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tier-color); }
.tier-cell .tc-top { display: flex; align-items: center; justify-content: space-between; }
.tier-cell span { font-size: 11px; color: var(--muted); }
.tier-cell b { font-size: 21px; font-weight: 800; }
.tier-cell small { font-size: 9.5px; color: var(--faint); }
.tier-cell .tc-bar { margin-top: 8px; }

.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: none; }
.activity-item .ai-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex: none; }
.activity-item .ai-main { flex: 1; min-width: 0; }
.activity-item b { display: block; font-size: 11.5px; font-weight: 600; }
.activity-item small { font-size: 10px; color: var(--faint); display: block; margin-top: 1px; }
.activity-item .ai-time { font-size: 9.5px; color: var(--faint); white-space: nowrap; }

.heatmap { display: grid; gap: 3px; }
.heat-row { display: grid; grid-template-columns: 82px repeat(3, 1fr); gap: 3px; align-items: center; }
.heat-cell { height: 26px; border-radius: 4px; display: grid; place-items: center; font-size: 9.5px; color: #fff; font-weight: 700; }
.heat-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-head { font-size: 9.5px; color: var(--faint); text-align: center; padding-bottom: 2px; }

/* ---------- builder ---------- */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 22px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow-x: auto; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); white-space: nowrap; }
.step .s-no { width: 23px; height: 23px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.step.active { color: var(--text); font-weight: 600; }
.step.active .s-no { background: var(--brand); color: #fff; }
.step.done .s-no { background: rgba(16,185,129,.12); color: var(--success); }
.step.done { color: var(--text-2); }
.step-line { flex: 1; height: 1px; background: var(--line); margin: 0 12px; min-width: 20px; }
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.builder-aside { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 12px; }
.blueprint-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 11.5px; }
.blueprint-row:last-child { border-bottom: none; }
.bp-dot { width: 7px; height: 7px; border-radius: 2px; }
.bp-name { flex: 1; color: var(--text-2); }
.bp-count { font-family: var(--mono); font-weight: 700; color: var(--text); }
.selected-q { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.selected-q:last-child { border-bottom: none; }
.selected-q .sq-no { font-family: var(--mono); font-size: 10px; color: var(--faint); width: 20px; flex: none; margin-top: 2px; }
.selected-q .sq-main { flex: 1; min-width: 0; }
.selected-q .sq-main b { font-size: 11.5px; font-weight: 500; line-height: 1.55; display: block; }
.selected-q .sq-main small { font-size: 9.5px; color: var(--faint); }
.sticky-summary { position: sticky; bottom: 20px; }

/* ---------- misc ---------- */
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.info-row:last-child { border-bottom: none; }
.info-row .ir-label { color: var(--muted); flex: none; }
.info-row .ir-val { color: var(--text-2); text-align: right; font-weight: 500; }
.info-row .ir-val b { color: var(--text); }
.tag-list { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 4px; background: var(--surface-3); color: var(--muted); font-size: 10px; }
.tag-brand { background: rgba(6,182,212,.08); color: var(--brand); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.kbd { font-family: var(--mono); font-size: 10px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--muted); background: var(--surface-2); }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 9px; font-size: 12px; line-height: 1.7; }
.notice-info { background: rgba(59,130,246,.06); border: 1px solid rgba(59,130,246,.14); color: #1d4ed8; }
.notice-warn { background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.16); color: #92400e; }
.notice-danger { background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.16); color: #991b1b; }
.notice-success { background: rgba(16,185,129,.06); border: 1px solid rgba(16,185,129,.16); color: #047857; }
[data-theme="dark"] .notice-info { color: #93c5fd; }
[data-theme="dark"] .notice-warn { color: #fcd34d; }
[data-theme="dark"] .notice-danger { color: #fca5a5; }
[data-theme="dark"] .notice-success { color: #6ee7b7; }

/* drawers */
.drawer-backdrop { position: fixed; inset: 0; z-index: 180; background: rgba(8,15,28,.4); opacity: 0; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 181; width: min(520px, 94vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .24s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 30px; }
.drawer-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }

/* responsive */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .module-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .lesson-layout { grid-template-columns: minmax(0,1fr) 240px; }
  .builder-grid { grid-template-columns: minmax(0,1fr) 290px; }
}
@media (max-width: 1020px) {
  :root { --sidebar: 224px; }
  .page { padding: 22px 20px 40px; }
  .grid-sidebar, .grid-main { grid-template-columns: minmax(0,1fr); }
  .exam-layout { grid-template-columns: minmax(0,1fr); }
  .exam-aside { position: static; order: -1; }
  .exam-side-card { display: none; }
  .exam-aside .q-nav-card { display: block; }
  .lesson-layout { grid-template-columns: minmax(0,1fr); }
  .lesson-aside { position: static; flex-direction: row; flex-wrap: wrap; }
  .lesson-toc { flex: 1; min-width: 220px; }
  .builder-grid { grid-template-columns: minmax(0,1fr); }
  .builder-aside { position: static; }
}
@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .sidebar { transform: translateX(-100%); width: 252px; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8,15,28,.45); z-index: 55; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-search { display: none; }
  .crumb { font-size: 11.5px; }
  .user-chip b, .user-chip small { display: none; }
  .page { padding: 18px 14px 40px; }
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px 22px; }
  .auth-theme { top: 12px; right: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .tier-strip { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .result-hero { grid-template-columns: 1fr; }
  .result-score { text-align: left; }
  .result-score b { font-size: 42px; }
  .lesson-cover { padding: 22px; }
  .lesson-body { padding: 22px; }
  .lesson-nav { padding: 14px 22px; }
  .exam-top { padding: 10px 12px; gap: 8px; }
  .exam-layout { padding: 14px 12px 50px; }
  .question-card { padding: 16px; }
  .teacher-hero { flex-direction: column; align-items: flex-start; }
  .greeting-date { display: none; }
  .exam-card { align-items: flex-start; }
  .exam-card .ec-side { flex-direction: column; align-items: flex-end; gap: 6px; }
  .steps { padding: 12px; }
  .step span:not(.s-no) { display: none; }
  .step.active span:not(.s-no) { display: inline; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 23px; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .demo-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr 1fr; }
  .row.wrap-mobile { flex-direction: column; align-items: stretch; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}
@media print {
  .sidebar, .topbar, .page-actions, .btn, .toast-root { display: none !important; }
  .main { margin-left: 0; }
  .page { padding: 0; max-width: none; }
  .card, .result-hero { break-inside: avoid; box-shadow: none; }
}
