/* =====================================================================
   NIU BB.A.LL.B Digital Classroom — visual system
   Deep navy shell, light reading surfaces, premium blue + subtle gold.
   ===================================================================== */
:root {
  --navy-950: #0a1222;
  --navy-900: #0f1b33;
  --navy-800: #172a4d;
  --navy-700: #22396a;
  --blue: #2f5bea;
  --blue-600: #2449c7;
  --blue-50: #eef3ff;
  --gold: #c9a24a;
  --gold-600: #b08a33;
  --gold-50: #faf4e4;
  --bg: #f2f4f8;
  --surface: #ffffff;
  --ink: #17213a;
  --ink-2: #3a4560;
  --muted: #6b7489;
  --line: #e4e8f0;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 6px 24px rgba(15, 27, 51, .06);
  --shadow-lg: 0 10px 40px rgba(10, 18, 34, .18);
  --sidebar-w: 272px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-display: "Fraunces", "Noto Sans Devanagari", Georgia, "Times New Roman", serif;
  --font-hi: "Noto Sans Devanagari", "Inter", system-ui, sans-serif;
  --bs-primary: var(--blue);
  --bs-primary-rgb: 47, 91, 234;
  --bs-body-font-family: var(--font);
  --bs-body-color: var(--ink);
  --bs-link-color: var(--blue-600);
  --bs-link-color-rgb: 36, 73, 199;
  --bs-border-color: var(--line);
}

html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); }
h1, h2, h3, h4, h5, h6 { color: var(--ink); letter-spacing: -.01em; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 3px solid rgba(47, 91, 234, .45); outline-offset: 2px; }
.text-gold { color: var(--gold) !important; }
.bg-gold { background: var(--gold) !important; }
.font-mono-sm { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.btn-sm { min-height: 32px; border-radius: 8px; }
.btn-lg { min-height: 50px; border-radius: 12px; }
.btn-primary { --bs-btn-bg: var(--blue); --bs-btn-border-color: var(--blue); --bs-btn-hover-bg: var(--blue-600); --bs-btn-hover-border-color: var(--blue-600); --bs-btn-active-bg: var(--blue-600); }
.btn-outline-primary { --bs-btn-color: var(--blue-600); --bs-btn-border-color: #c6d3fb; --bs-btn-hover-bg: var(--blue-50); --bs-btn-hover-color: var(--blue-600); --bs-btn-hover-border-color: var(--blue); --bs-btn-active-bg: var(--blue-50); --bs-btn-active-color: var(--blue-600); }
.btn-gold { background: linear-gradient(135deg, #d9b763, var(--gold) 55%, var(--gold-600)); color: #1b1404; border: 0; box-shadow: 0 4px 14px rgba(201, 162, 74, .35); }
.btn-gold:hover, .btn-gold:focus { color: #1b1404; filter: brightness(1.05); }
.btn-icon { width: 42px; height: 42px; padding: 0; font-size: 1.4rem; color: var(--ink); }
.toggle-btn.active, .btn-outline-success.active { background: #198754; color: #fff; }
.btn-outline-warning.active { background: #ffc107; color: #1b1404; }
.btn-outline-secondary.active { background: var(--gold-50); color: var(--gold-600); border-color: var(--gold); }

/* ---------- Shell ---------- */
.app-body { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: radial-gradient(120% 60% at 0% 0%, var(--navy-800), var(--navy-950) 70%); color: #cfd7ea; flex-direction: column; z-index: 1030; border-right: 1px solid rgba(255, 255, 255, .04); }
.sidebar-mobile { background: var(--navy-950); color: #cfd7ea; width: 290px !important; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.25rem 1.25rem 1rem; text-decoration: none; color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--navy-950); background: linear-gradient(135deg, #e7c978, var(--gold)); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .02em; color: #fff; }
.brand-text small { color: #9fb0d4; font-size: .74rem; }
.brand-dark .brand-text strong { color: var(--ink); }
.brand-dark .brand-text small { color: var(--muted); }
.brand-lg .brand-mark { width: 52px; height: 52px; font-size: 1.8rem; }
.brand-lg .brand-text strong { font-size: 1.5rem; }
.side-nav { padding: .25rem .75rem 1rem; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.side-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #7f8fb3; padding: .75rem .75rem .35rem; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .58rem .75rem; border-radius: 10px; color: #cfd7ea; text-decoration: none; font-size: .92rem; transition: background .15s, color .15s; }
.side-link i { font-size: 1.05rem; width: 20px; text-align: center; color: #8ea1c9; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active { background: linear-gradient(90deg, rgba(201, 162, 74, .2), rgba(201, 162, 74, .05)); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side-link.active i { color: var(--gold); }
.side-foot { padding: 1rem 1.25rem 1.25rem; }
.countdown-chip { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; padding: .35rem .7rem; border-radius: 999px; background: rgba(201, 162, 74, .14); color: #e9cf8e; border: 1px solid rgba(201, 162, 74, .3); }
.topbar .countdown-chip { background: var(--gold-50); color: var(--gold-600); border-color: #ecdcb3; }

.main-wrap { min-height: 100vh; display: flex; flex-direction: column; }
@media (min-width: 992px) { .main-wrap { margin-left: var(--sidebar-w); } }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: rgba(242, 244, 248, .85); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); min-height: 60px; }
.topbar-title { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw; }
.btn-user { display: inline-flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem .2rem .25rem; min-height: 40px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--navy-700), var(--navy-900)); color: var(--gold); font-weight: 700; font-size: .9rem; }
.avatar-xl { width: 84px; height: 84px; font-size: 2rem; display: grid; }
.content { flex: 1; padding: 1.25rem 1rem 6rem; width: 100%; max-width: 1440px; margin: 0 auto; }
@media (min-width: 768px) { .content { padding: 1.75rem 1.75rem 3rem; } }
.app-foot { font-size: .75rem; color: var(--muted); padding: 1rem 1.75rem 5.5rem; text-align: center; }
@media (min-width: 992px) { .app-foot { padding-bottom: 1.25rem; } }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--navy-950); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(10, 18, 34, .25); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #8ea1c9; text-decoration: none; font-size: .68rem; padding: .35rem 0; border-radius: 10px; min-height: 48px; justify-content: center; }
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--gold); background: rgba(201, 162, 74, .1); }

/* ---------- Surfaces ---------- */
.surface, .card.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header-clean { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem .75rem; }
.card-header-clean h3 { font-size: .98rem; font-weight: 600; margin: 0; display: flex; gap: .5rem; align-items: center; }
.card-header-clean h3 i { color: var(--blue); }
.card-header-clean a { font-size: .85rem; text-decoration: none; }
.page-intro { margin-bottom: 1.25rem; }
.page-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 2.5vw, 2rem); margin-bottom: .25rem; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: .5rem 0 .75rem; }
.section-head h2 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.section-head a { font-size: .85rem; text-decoration: none; }
.back-link { display: inline-flex; gap: .35rem; align-items: center; font-size: .88rem; color: var(--muted); text-decoration: none; margin-bottom: .75rem; }
.back-link:hover { color: var(--blue); }
.eyebrow { font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); margin-bottom: .35rem; }

/* Hero */
.hero-card, .subject-hero { position: relative; overflow: hidden; border-radius: 20px; padding: 1.5rem; color: #e8edf8; background: radial-gradient(90% 120% at 100% 0%, rgba(47, 91, 234, .45), transparent 60%), radial-gradient(60% 80% at 0% 100%, rgba(201, 162, 74, .18), transparent 60%), linear-gradient(140deg, var(--navy-800), var(--navy-950)); box-shadow: var(--shadow-lg); }
@media (min-width: 768px) { .hero-card, .subject-hero { padding: 2rem 2.25rem; } }
.hero-card::after { content: "§"; position: absolute; right: -10px; bottom: -70px; font-family: var(--font-display); font-size: 16rem; color: rgba(255, 255, 255, .03); line-height: 1; pointer-events: none; }
.hero-title { font-family: var(--font-display); color: #fff; font-weight: 700; font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
.hero-sub { color: #b9c5e0; max-width: 62ch; }
.continue-hint { align-self: center; font-size: .85rem; color: #b9c5e0; }
.subject-hero { background: radial-gradient(90% 120% at 100% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%), linear-gradient(140deg, var(--navy-800), var(--navy-950)); }
.countdown { background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); border-radius: 16px; padding: 1rem 1.25rem; }
.countdown-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: #9fb0d4; }
.countdown-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .35rem; }
.countdown-grid div { text-align: center; background: rgba(10, 18, 34, .35); border-radius: 12px; padding: .6rem .25rem; }
.countdown-grid span { display: block; font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: #f1d998; line-height: 1.1; font-variant-numeric: tabular-nums; }
.countdown-grid small { color: #9fb0d4; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }

/* Stats */
.stat-card { display: flex; align-items: center; gap: .9rem; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.stat-compact { padding: .85rem 1rem; }
.stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .82rem; color: var(--ink-2); font-weight: 500; }
.stat-sub { font-size: .75rem; color: var(--muted); }
@media (max-width: 575px) { .stat-card { flex-direction: column; align-items: flex-start; gap: .55rem; padding: .85rem; } .stat-card .ring { width: 50px; height: 50px; } }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--gold-50); color: var(--gold-600); flex-shrink: 0; }
.stat-icon-blue { background: var(--blue-50); color: var(--blue); }
.ring { --p: 0; --c: var(--blue); width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), #e6ebf5 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-size: .8rem; font-weight: 700; }
.ring-gold { --c: var(--gold); }
.ring-light::before { background: var(--navy-900); }
.ring-light { background: conic-gradient(#f1d998 calc(var(--p) * 1%), rgba(255, 255, 255, .12) 0); }
.ring-light span { color: #fff; }
.ring-xl { width: 120px; height: 120px; }
.ring-xl::before { inset: 10px; }
.ring-xl span { font-size: 1.6rem; font-family: var(--font-display); }
.progress-thin { height: 6px; border-radius: 99px; background: #e9edf5; }
.progress-thin .progress-bar { border-radius: 99px; }

/* Subject cards */
.subject-card { --accent: var(--blue); display: block; height: 100%; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.1rem 1rem; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
.subject-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent); }
.subject-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15, 27, 51, .1); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); color: var(--ink); }
.subject-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, white); }
.credit-pill { font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 99px; background: var(--gold-50); color: var(--gold-600); border: 1px solid #efe1bb; }
.subject-code { font-size: .72rem; letter-spacing: .04em; color: var(--muted); margin-top: .8rem; font-family: ui-monospace, Menlo, monospace; }
.subject-name { font-weight: 600; font-size: 1rem; line-height: 1.3; margin-top: .15rem; }
.subject-card-lg .subject-name { font-family: var(--font-display); font-size: 1.15rem; }
.subject-table td, .subject-table th { padding: .8rem 1rem; }
.dot { --accent: var(--blue); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; flex-shrink: 0; }

/* Rows */
.mini-row { display: flex; align-items: center; gap: .7rem; padding: .62rem 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.mini-row:first-child { border-top: 0; }
a.mini-row:hover { color: var(--blue-600); }
.mini-row small { display: block; color: var(--muted); font-size: .76rem; }
.marks-pill { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 .4rem; border-radius: 7px; background: var(--navy-900); color: #f1d998; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.announce { border-left: 3px solid var(--line); padding: .5rem .75rem; margin-bottom: .6rem; background: #fafbfd; border-radius: 0 10px 10px 0; }
.announce-important { border-color: var(--gold); background: var(--gold-50); }
.announce-urgent { border-color: #dc3545; background: #fff3f4; }
.plan-list { list-style: none; padding: 0; margin: 0; }
.plan-list li { display: grid; grid-template-columns: 96px 78px 1fr; gap: .6rem; align-items: start; padding: .7rem 0; border-top: 1px solid var(--line); }
.plan-list li:first-child { border-top: 0; }
@media (max-width: 575px) { .plan-list li { grid-template-columns: 1fr auto; } .plan-list .plan-what { grid-column: 1 / -1; } }
.plan-time { font-size: .82rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plan-act { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .2rem .5rem; border-radius: 6px; text-align: center; background: color-mix(in srgb, var(--accent) 14%, white); color: color-mix(in srgb, var(--accent) 75%, black); }
.act-mock { background: #fff0e0 !important; color: #a3520b !important; }
.act-revision { background: var(--gold-50) !important; color: var(--gold-600) !important; }
.act-rest { background: #eef1f5 !important; color: var(--muted) !important; }
.plan-what { font-weight: 600; font-size: .92rem; }
.plan-what small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.pending-link { display: block; font-size: .8rem; font-weight: 500; text-decoration: none; margin-top: .2rem; }
.plan-week { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.plan-day { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: .6rem; background: #fbfcfe; }
.plan-day.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 91, 234, .12); }
.plan-day.today .pd-date strong { color: var(--blue); }
.pd-date { font-size: .74rem; color: var(--muted); display: flex; justify-content: space-between; }
.pd-date strong { color: var(--ink); }
.pd-slots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: .4rem; }
.pd-chip { --accent: var(--gold); font-size: .66rem; padding: .1rem .35rem; border-radius: 5px; background: color-mix(in srgb, var(--accent) 15%, white); color: color-mix(in srgb, var(--accent) 70%, black); }
.plan-edit-day { border-top: 1px dashed var(--line); padding: .75rem 0; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 1rem; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar-col .bar { width: 100%; max-width: 30px; background: linear-gradient(180deg, var(--blue), var(--navy-700)); border-radius: 6px 6px 2px 2px; }
.bar-col small { font-size: .68rem; color: var(--muted); margin-top: 4px; }
.bar-col em { position: absolute; top: 0; font-style: normal; font-size: .65rem; color: #198754; }

/* Topic page */
.topic-head { --accent: var(--blue); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); border-top: 4px solid var(--accent); }
.topic-title-lg { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.4rem, 3vw, 2rem); margin: .25rem 0 1rem; }
.topic-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.topic-tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.topic-tabs::-webkit-scrollbar { display: none; }
.topic-tabs a { flex-shrink: 0; display: inline-flex; gap: .4rem; align-items: center; padding: .55rem .9rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-size: .87rem; font-weight: 500; min-height: 40px; }
.topic-tabs a.active { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.topic-tabs a.active i { color: var(--gold); }
.topic-row { display: flex; gap: .75rem; align-items: center; padding: .75rem .25rem; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); min-height: 52px; }
.topic-row:first-child { border-top: 0; }
.topic-row:hover { background: #f8faff; }
.topic-row .topic-title { font-weight: 500; }
.topic-row small { display: block; color: var(--muted); font-size: .78rem; }
.admin-topic-row { display: flex; flex-wrap: wrap; gap: .5rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.reading { max-width: 860px; }
.prose { font-size: 1rem; line-height: 1.75; color: var(--ink); overflow-wrap: anywhere; }
.prose p { margin-bottom: .9rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin-bottom: .9rem; }
.prose li { margin-bottom: .3rem; }
.prose .md-h, .md-h { font-family: var(--font-display); font-weight: 600; margin: 1.4rem 0 .6rem; color: var(--navy-900); }
h3.md-h { font-size: 1.3rem; } h4.md-h { font-size: 1.1rem; } h5.md-h { font-size: 1rem; }
.prose-hi, [lang="hi"], .prose-hi .md-h, [lang="hi"] .md-h, [lang="hi"] h2, [lang="hi"] h3 { font-family: var(--font-hi); }
.prose-hi { font-size: 1.06rem; line-height: 1.95; }
.lang-tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-600); background: var(--gold-50); padding: .15rem .55rem; border-radius: 6px; margin-bottom: .6rem; }
.definition-box { border: 1px solid #d7e0fb; background: linear-gradient(180deg, #f6f8ff, #fff); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1.1rem; }
.definition-box p:last-child { margin: 0; }
.callout { border-left: 3px solid var(--gold); background: var(--gold-50); padding: .75rem 1rem; border-radius: 0 10px 10px 0; margin: .75rem 0; }
.callout-blue { border-color: var(--blue); background: var(--blue-50); }
.keypoints { padding-left: 0; list-style: none; margin: 0; }
.keypoints li { position: relative; padding: .45rem 0 .45rem 1.6rem; border-top: 1px dashed var(--line); }
.keypoints li:first-child { border-top: 0; }
.keypoints li::before { content: "§"; position: absolute; left: 0; top: .42rem; font-family: var(--font-display); color: var(--gold); font-weight: 700; }
.keypoints li p { margin: 0; }
.term-list { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .4rem 1rem; margin: 0; }
.term-list dt { font-weight: 600; color: var(--navy-800); }
.term-list dd { margin: 0; color: var(--ink-2); }
@media (max-width: 575px) { .term-list { grid-template-columns: 1fr; } .term-list dd { margin-bottom: .5rem; } }
.kw { display: inline-block; padding: .15rem .55rem; margin: 0 .3rem .35rem 0; font-size: .8rem; border-radius: 99px; background: var(--blue-50); color: var(--blue-600); }
.misconception { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .5rem; }
.misconception .wrong { color: #b02a37; }
.misconception .right { color: #146c43; margin-top: .25rem; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 62px; top: 4px; bottom: 4px; width: 2px; background: linear-gradient(var(--gold), var(--blue)); }
.timeline li { display: grid; grid-template-columns: 52px 1fr; gap: 22px; padding: .45rem 0; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 57px; top: .8rem; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--gold); }
.tl-year { font-weight: 700; font-family: var(--font-display); color: var(--navy-800); text-align: right; }
.tl-event p { margin: 0; }
.md-table { font-size: .92rem; margin-bottom: 0; }
.md-table th { background: var(--navy-900); color: #fff; font-weight: 600; }
.diagram { max-height: 420px; }
.formula { background: var(--navy-900); color: #f1d998; border-radius: 10px; padding: .7rem 1rem; margin: .75rem 0; font-family: ui-monospace, Menlo, monospace; }
.formula span { display: block; font-family: var(--font); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #9fb0d4; }
.formula p { margin: 0; }
.steps ol li { margin-bottom: .55rem; }
.practice-box { border: 1px dashed #c6d3fb; background: #fafbff; border-radius: 12px; padding: .85rem 1rem; }
.answer-reveal summary { cursor: pointer; font-weight: 600; color: var(--blue-600); padding: .35rem 0; list-style: none; display: inline-flex; gap: .4rem; align-items: center; }
.answer-reveal summary::before { content: "▸"; transition: transform .15s; }
.answer-reveal[open] summary::before { transform: rotate(90deg); }
.answer-reveal summary::-webkit-details-marker { display: none; }
.next-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.next-card { display: flex; gap: .6rem; align-items: center; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .9rem; }
.next-card i { color: var(--blue); font-size: 1.2rem; }
.next-card:hover { border-color: var(--blue); }
.next-topic { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.25rem; border-radius: 14px; background: linear-gradient(90deg, var(--blue-50), #fff); border: 1px solid #d7e0fb; }
.next-topic a { font-weight: 600; text-decoration: none; }
.src-tag { display: inline-flex; align-items: center; font-size: .72rem; font-weight: 600; padding: .2rem .55rem; border-radius: 6px; }
.src-official { background: #e7f6ec; color: #146c43; }
.src-statute { background: var(--blue-50); color: var(--blue-600); }
.src-explanatory { background: #f1efe8; color: #6b5a2c; }
.badge-verify { background: #fff4d6; color: #8a5a00; border: 1px solid #f3d98a; font-weight: 600; }
.status-badge { font-weight: 600; }

/* Legal */
.section-ref { display: inline-block; font-family: var(--font-display); font-weight: 700; background: var(--navy-900); color: #f1d998; padding: .1rem .5rem; border-radius: 6px; margin-right: .3rem; }
.provision { border-left: 4px solid var(--blue); }
.provision-mini { padding: .7rem 0; border-top: 1px solid var(--line); }
.amend { color: var(--ink-2); background: #f7f8fb; border-radius: 8px; padding: .5rem .7rem; }
.amend p { display: inline; margin: 0; }
.case-name { font-family: var(--font-display); font-weight: 600; font-style: italic; font-size: 1.05rem; color: var(--navy-900); text-decoration: none; }
.case-tile { --accent: var(--blue); display: block; height: 100%; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); }
.case-tile:hover { color: var(--ink); border-color: var(--accent); }
.ratio { border-left: 3px solid var(--gold); padding-left: .75rem; }
.ratio span { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-600); font-weight: 700; }
.ratio p { margin: 0; }
.case-head { border-radius: 18px; padding: 1.5rem; color: #e8edf8; background: linear-gradient(140deg, var(--navy-800), var(--navy-950)); margin-bottom: 1rem; }
.case-title { font-family: var(--font-display); font-style: italic; color: #fff; }
.case-meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: #b9c5e0; }
.verify-strip { border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; background: #fff4d6; color: #6e4800; border: 1px solid #f3d98a; font-size: .9rem; }
.verify-strip.ok { background: #e7f6ec; color: #0f5132; border-color: #b7e2c7; }
.ratio-card { border-left: 4px solid var(--gold); }

/* Practice / MCQ */
.mcq-options { display: grid; gap: .5rem; }
.mcq-opt { text-align: left; border: 1px solid var(--line); background: #fbfcfe; border-radius: 10px; padding: .7rem .9rem; min-height: 46px; color: var(--ink); transition: border-color .15s, background .15s; }
.mcq-opt:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-50); }
.mcq-opt.is-correct { border-color: #198754; background: #e7f6ec; color: #0f5132; font-weight: 600; }
.mcq-opt.is-wrong { border-color: #dc3545; background: #fdecee; color: #842029; }
.mcq-opt:disabled { cursor: default; }
.mcq-feedback { padding: .6rem .8rem; border-radius: 8px; background: #f6f8fc; }
.flash-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.flash-grid-sm { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.flashcard { position: relative; min-height: 140px; border: 0; padding: 0; background: none; perspective: 900px; text-align: center; }
.flashcard span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; border-radius: 14px; backface-visibility: hidden; transition: transform .45s ease; font-size: .95rem; }
.fc-front { background: linear-gradient(140deg, var(--navy-800), var(--navy-950)); color: #fff; font-weight: 600; }
.fc-front small { color: var(--gold); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .3rem; }
.fc-back { background: var(--gold-50); color: var(--ink); border: 1px solid #efe1bb; transform: rotateY(180deg); font-size: .88rem !important; }
.flashcard.flipped .fc-front { transform: rotateY(180deg); }
.flashcard.flipped .fc-back { transform: rotateY(360deg); }
.notes-area { font-size: 1rem; line-height: 1.6; }
.note-item { --accent: var(--blue); border-left: 3px solid var(--accent); padding: .6rem .8rem; margin-bottom: .75rem; background: #fbfcfe; border-radius: 0 10px 10px 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .38rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); text-decoration: none; font-size: .84rem; min-height: 36px; display: inline-flex; align-items: center; }
.chip.active { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.test-card { --accent: var(--blue); height: 100%; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.test-card-mock { border-top-color: var(--gold); background: linear-gradient(180deg, #fffdf7, #fff); }
.test-rules li { padding: .35rem 0; display: flex; gap: .6rem; }
.test-rules i { color: var(--blue); }

/* Exam interface */
.exam-bar { position: sticky; top: 60px; z-index: 1010; display: flex; align-items: center; gap: .75rem; background: var(--navy-900); color: #fff; border-radius: 14px; padding: .65rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow-lg); }
.exam-title { font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exam-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.1rem; color: #f1d998; background: rgba(255, 255, 255, .08); padding: .25rem .7rem; border-radius: 8px; }
.exam-timer.warn { color: #fff; background: #dc3545; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .75; } }
.exam-q-text { font-size: 1.05rem; font-weight: 500; margin-bottom: 1rem; }
.exam-opts { display: grid; gap: .55rem; }
.exam-opt { display: flex; gap: .75rem; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: .8rem .9rem; cursor: pointer; min-height: 50px; background: #fbfcfe; }
.exam-opt input { margin-top: .25rem; width: 1.15rem; height: 1.15rem; flex-shrink: 0; accent-color: var(--blue); }
.exam-opt:has(input:checked) { border-color: var(--blue); background: var(--blue-50); }
.exam-nav { display: flex; justify-content: space-between; gap: .5rem; margin-top: 1rem; }
.exam-palette { position: sticky; top: 130px; }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.palette-grid button { height: 40px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: .85rem; }
.palette-grid button.answered { background: #198754; border-color: #198754; color: #fff; }
.palette-grid button.marked { box-shadow: inset 0 -4px 0 #ffc107; }
.palette-grid button.current { outline: 2px solid var(--blue); outline-offset: 1px; }
.palette-legend .lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); vertical-align: -1px; margin-left: .5rem; }
.palette-legend .lg.answered { background: #198754; border-color: #198754; }
.palette-legend .lg.marked { box-shadow: inset 0 -4px 0 #ffc107; }
.review-q { border-left: 4px solid var(--line); }
.review-q.is-right { border-left-color: #198754; }
.review-q.is-wrong { border-left-color: #dc3545; }
.review-opts { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.review-opts li { padding: .5rem .75rem; border-radius: 8px; border: 1px solid var(--line); }
.review-opts li.correct { background: #e7f6ec; border-color: #b7e2c7; color: #0f5132; font-weight: 600; }
.review-opts li.chosen-wrong { background: #fdecee; border-color: #f5c2c7; color: #842029; }

/* Teach Me */
.teach-head { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent, var(--blue)); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.teach-steps { display: flex; gap: .35rem; list-style: none; padding: 0; margin: 0; overflow-x: auto; scrollbar-width: none; }
.teach-steps::-webkit-scrollbar { display: none; }
.teach-steps li { display: flex; flex-direction: column; align-items: center; gap: .25rem; min-width: 74px; text-align: center; }
.teach-steps button { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-weight: 700; color: var(--muted); }
.teach-steps span { font-size: .66rem; color: var(--muted); line-height: 1.2; }
.teach-steps li.done button { background: #198754; border-color: #198754; color: #fff; }
.teach-steps li.current button { border-color: var(--gold); background: var(--gold); color: #1b1404; }
.teach-steps li.current span { color: var(--ink); font-weight: 600; }
.teach-pane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); min-height: 260px; }
.teach-nav { position: sticky; bottom: 70px; display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: 1rem; background: rgba(242, 244, 248, .92); backdrop-filter: blur(8px); padding: .6rem 0; }
@media (min-width: 992px) { .teach-nav { bottom: 0; } }
.exam-answer { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; background: #fcfcfe; }

/* AI */
.ai-panel { width: min(480px, 100vw) !important; }
.ai-log { overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; }
.ai-msg { padding: .65rem .85rem; border-radius: 12px; font-size: .92rem; max-width: 92%; }
.ai-msg.user { align-self: flex-end; background: var(--blue); color: #fff; }
.ai-msg.bot { align-self: flex-start; background: #f2f4f9; }
.ai-msg.bot p:last-child { margin: 0; }
.ai-msg.err { background: #fdecee; color: #842029; }

/* Auth */
.auth-body { background: var(--navy-950); min-height: 100vh; }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: 1fr; }
@media (min-width: 768px) { .auth-shell { grid-template-columns: 1.1fr 1fr; } }
.auth-hero { flex-direction: column; justify-content: space-between; padding: 3rem; color: #d6deef; background: radial-gradient(80% 60% at 20% 10%, rgba(47, 91, 234, .35), transparent 60%), radial-gradient(70% 50% at 90% 90%, rgba(201, 162, 74, .22), transparent 60%), linear-gradient(160deg, var(--navy-800), var(--navy-950)); position: relative; overflow: hidden; }
.auth-hero::after { content: "§"; position: absolute; right: -40px; bottom: -120px; font-family: var(--font-display); font-size: 28rem; color: rgba(255, 255, 255, .03); line-height: 1; }
.auth-hero-title { font-family: var(--font-display); font-size: clamp(2rem, 3.5vw, 3rem); color: #fff; margin: 2.5rem 0 1rem; max-width: 16ch; }
.auth-hero-sub { max-width: 46ch; color: #b9c5e0; }
.auth-points { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.auth-points li { display: flex; gap: .6rem; padding: .35rem 0; }
.auth-points i { color: var(--gold); }
.auth-hero-foot { font-size: .8rem; color: #7f8fb3; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 2rem 1.5rem; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
@media (min-width: 576px) { .auth-card { padding: 2.5rem 2.25rem; } }
.auth-title { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; margin-bottom: .4rem; }

/* Admin bits */
.secret-box code { background: #fff; padding: .15rem .4rem; border-radius: 6px; }
.q-pick { max-height: 460px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.q-pick-row { display: flex; gap: .6rem; padding: .55rem .75rem; border-top: 1px solid var(--line); cursor: pointer; font-size: .86rem; }
.q-pick-row:first-child { border-top: 0; }
.q-pick-row small { display: block; color: var(--muted); }
.smtp-log { max-height: 280px; overflow: auto; background: #0f1b33; color: #cfe; padding: .75rem; border-radius: 8px; }
.list-group-item.active { background: var(--navy-900); border-color: var(--navy-900); }
.list-group-item.active .text-muted { color: #b9c5e0 !important; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty-state > i { font-size: 2.5rem; color: #c3cbe0; display: block; margin-bottom: .5rem; }
.empty-code { font-family: var(--font-display); font-size: 4rem; font-weight: 700; color: var(--gold); }

/* Tables */
.table { --bs-table-bg: transparent; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.form-control, .form-select { border-radius: 10px; border-color: #d8deea; min-height: 42px; }
.form-control-sm, .form-select-sm { min-height: 32px; border-radius: 8px; }
.form-control:focus, .form-select:focus { border-color: var(--blue); box-shadow: 0 0 0 .2rem rgba(47, 91, 234, .15); }
textarea.form-control { min-height: auto; }
.form-label { font-weight: 500; font-size: .88rem; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print {
  .sidebar, .topbar, .bottom-nav, .topic-actions, .topic-tabs, .app-foot, .teach-nav, .next-topic { display: none !important; }
  .main-wrap { margin: 0 !important; }
  .surface { box-shadow: none !important; }
}
