/* IQ Academy — design tokens */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #0e2240;
  --ink-2: #2f4058;
  --muted: #637289;
  --line: #e2e7ee;
  --line-2: #d3dbe5;
  --brand: #0f6b5c;
  --brand-ink: #0a5247;
  --brand-soft: #e2f1ed;
  --gold: #f2a93b;
  --gold-ink: #8a5a0d;
  --gold-soft: #fdf1dc;
  --sky: #4d7fd6;
  --sky-soft: #e7eefb;
  --rose: #d2555f;
  --good: #12805c;
  --good-soft: #e1f3ec;
  --bad: #c2413a;
  --bad-soft: #fbe9e7;
  --warn: #a8660f;
  --warn-soft: #fbf0dd;
  --navy: #0e2240;
  --navy-2: #16305a;
  --shadow-sm: 0 1px 2px rgba(14, 34, 64, .06), 0 1px 1px rgba(14, 34, 64, .04);
  --shadow: 0 1px 2px rgba(14, 34, 64, .05), 0 8px 24px -12px rgba(14, 34, 64, .18);
  --shadow-lg: 0 30px 60px -30px rgba(14, 34, 64, .35);
  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --font: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0a1424;
  --surface: #0f1c30;
  --surface-2: #13233b;
  --ink: #e9eff7;
  --ink-2: #c3cedc;
  --muted: #8e9db2;
  --line: #1e3049;
  --line-2: #2a3f5c;
  --brand: #2fb29b;
  --brand-ink: #5dd0bb;
  --brand-soft: rgba(47, 178, 155, .13);
  --gold-soft: rgba(242, 169, 59, .14);
  --gold-ink: #f5c06e;
  --sky-soft: rgba(77, 127, 214, .16);
  --good: #3cc493;
  --good-soft: rgba(60, 196, 147, .13);
  --bad: #f07a72;
  --bad-soft: rgba(240, 122, 114, .13);
  --warn: #f0b45a;
  --warn-soft: rgba(240, 180, 90, .13);
  --navy: #071121;
  --navy-2: #0f1f38;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 60px -30px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6;
  background: var(--bg); color: var(--ink); min-height: 100vh;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "tnum" 0;
}
img, svg, canvas { display: block; max-width: 100%; }
.ic { display: inline-block; flex: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: clamp(2rem, 3.2vw + 1rem, 3.6rem); font-weight: 800; letter-spacing: -.035em; }
h2 { font-size: clamp(1.6rem, 1.8vw + 1rem, 2.5rem); letter-spacing: -.03em; }
h3 { font-size: 1.15rem; }
p { margin: 0; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
b, strong { font-weight: 700; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand); color: #fff; }
.wrap { width: min(1200px, calc(100% - 40px)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 12px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-weight: 600; font-size: .95rem; letter-spacing: -.005em;
  cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 6px 16px -8px rgba(15, 107, 92, .7);
  transition: transform .2s var(--ease), background-color .2s, box-shadow .2s, border-color .2s, color .2s;
}
.btn:hover { background: var(--brand-ink); transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 12px 22px -10px rgba(15, 107, 92, .8); }
html[data-theme="dark"] .btn:hover { color: #06231d; }
.btn:active { transform: translateY(0); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn.gold { background: var(--gold); color: #2b1a02; box-shadow: 0 8px 20px -10px rgba(242, 169, 59, .9); }
.btn.gold:hover { background: #f6b955; color: #2b1a02; }
.btn.light { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.24); box-shadow: none; }
.btn.light:hover { background: rgba(255,255,255,.16); color: #fff; }
.btn.danger { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.btn.danger:hover { background: var(--bad); color: #fff; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .875rem; border-radius: 10px; }
.btn.xs { min-height: 32px; padding: 0 11px; font-size: .8rem; border-radius: 9px; gap: 6px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; padding: 0 26px; font-size: 1rem; border-radius: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  transition: background-color .2s, border-color .2s, transform .2s var(--ease);
}
.icon-btn:hover { border-color: var(--line-2); transform: translateY(-1px); }
.icon-btn.on-dark { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.12); color: #dfe7f2; }
[data-theme-toggle] .moon { display: none; }
html[data-theme="dark"] [data-theme-toggle] .sun { display: none; }
html[data-theme="dark"] [data-theme-toggle] .moon { display: block; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; font-size: .82rem; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 11px; }
.logo .mark { width: 40px; height: 40px; color: var(--navy); flex: none; transition: transform .35s var(--ease); }
html[data-theme="dark"] .logo .mark { color: #1d3a66; }
.logo:hover .mark { transform: rotate(-6deg) scale(1.04); }
.logo-text strong { display: block; font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.logo-text small { display: block; font-size: .72rem; color: var(--muted); letter-spacing: .01em; }
.logo.light .logo-text strong { color: #fff; }
.logo.light .logo-text small { color: #9fb0c8; }
.logo.light .mark { color: #1d3a66; }

/* Banners */
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 12px; font-weight: 500; font-size: .93rem; margin-bottom: 18px; border: 1px solid transparent; animation: drop .45s var(--ease); }
.banner .ic { margin-top: 2px; }
.banner.good { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 22%, transparent); }
.banner.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Public site ---------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid transparent; transition: border-color .3s, box-shadow .3s, background-color .3s; }
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 8px 24px -20px rgba(14, 34, 64, .4); }
.nav { display: flex; align-items: center; gap: 20px; min-height: 76px; }
.desktop-nav { display: flex; gap: 4px; margin-left: 28px; }
.desktop-nav a { position: relative; padding: 8px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: .94rem; transition: color .2s, background-color .2s; }
.desktop-nav a:hover, .desktop-nav a.on { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.mobile-only { display: none !important; }
.mobile-drawer { display: none; }
@media (max-width: 960px) {
  .desktop-nav, .desktop-only { display: none !important; }
  .mobile-only { display: inline-grid !important; }
  .mobile-drawer { display: block; max-height: 0; overflow: hidden; transition: max-height .4s var(--ease); border-top: 1px solid transparent; }
  .mobile-drawer.open { max-height: 560px; border-top-color: var(--line); }
  .drawer-inner { padding: 10px 0 22px; display: grid; }
  .drawer-inner > a { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); font-weight: 600; }
  .drawer-inner > a .ic { color: var(--muted); }
  .drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
  .drawer-actions .btn:only-child { grid-column: 1 / -1; }
}

/* Hero */
.hero-shell { padding: 18px 0 0; }
.hero {
  position: relative; overflow: hidden; border-radius: 28px; color: #fff;
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(700px 400px at 85% 10%, rgba(47, 178, 155, .28), transparent 60%),
    linear-gradient(160deg, #10284c, #0b1b33 70%);
  padding: clamp(36px, 6vw, 80px) clamp(22px, 5vw, 64px);
  display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(28px, 4vw, 56px); align-items: center;
}
.hero h1 { color: #fff; max-width: 13ch; }
.hero .lead { color: #b9c6d8; font-size: clamp(1rem, .4vw + .95rem, 1.15rem); max-width: 48ch; margin-top: 20px; }
.hero-tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: #d9e3f0; font-size: .85rem; font-weight: 500; margin-bottom: 22px; }
.hero-tag i { width: 8px; height: 8px; border-radius: 50%; background: #3ee0a8; box-shadow: 0 0 0 4px rgba(62, 224, 168, .18); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(62, 224, 168, 0); } }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 34px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); }
.hero-meta span { display: inline-flex; align-items: center; gap: 8px; color: #c9d4e3; font-size: .9rem; }
.hero-meta .ic { color: var(--gold); }

/* OMR sheet illustration */
.sheet-stage { position: relative; padding: 10px 0 30px; }
.sheet {
  position: relative; background: #fbfcfd; color: #1a2b44; border-radius: 18px; padding: 22px 22px 18px;
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.6) inset;
  transform: rotate(-1.5deg); max-width: 400px; margin-left: auto;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1.5px dashed #cdd6e1; padding-bottom: 12px; margin-bottom: 12px; }
.sheet-head strong { font-size: .95rem; }
.sheet-head span { font-size: .75rem; color: #6a7a90; }
.sheet-timer { font-variant-numeric: tabular-nums; background: #0e2240; color: #fff; padding: 4px 10px; border-radius: 8px; font-size: .8rem; font-weight: 600; }
.omr-row { display: grid; grid-template-columns: 34px repeat(4, 1fr); align-items: center; gap: 8px; padding: 6px 0; }
.omr-row > b { font-size: .8rem; color: #6a7a90; font-weight: 600; }
.bubble { width: 28px; height: 28px; border-radius: 50%; border: 1.6px solid #b8c4d3; display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: #7c8ba0; justify-self: center; position: relative; }
.bubble.fill::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #0e2240; transform: scale(0); animation: ink .45s var(--ease) forwards; animation-delay: var(--t, 0s); }
.bubble.fill.right::after { background: #0f6b5c; }
@keyframes ink { to { transform: scale(1); } }
.sheet-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1.5px dashed #cdd6e1; font-size: .82rem; color: #4a5a70; }
.sheet-foot b { font-size: 1.25rem; color: #0f6b5c; }
.float-card {
  position: absolute; left: -24px; bottom: -6px; width: 250px; background: #fff; color: #1a2b44; border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 24px 50px -20px rgba(0,0,0,.55); animation: bob 6s ease-in-out infinite;
}
.float-card h4 { font-size: .82rem; color: #6a7a90; font-weight: 600; letter-spacing: 0; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.float-card h4 .ic { color: var(--gold); }
.float-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .86rem; }
.float-row + .float-row { border-top: 1px solid #edf1f5; }
.float-row em { font-style: normal; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: .75rem; background: #eef2f6; }
.float-row:first-of-type em { background: var(--gold); color: #3b2503; }
.float-row span { flex: 1; font-weight: 600; }
.float-row small { color: #0f6b5c; font-weight: 700; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* Sections */
.section { padding: clamp(64px, 8vw, 110px) 0; }
.section.tight { padding: clamp(48px, 6vw, 72px) 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: clamp(28px, 4vw, 48px); flex-wrap: wrap; }
.section-head > div { max-width: 640px; }
.section-head p { margin-top: 12px; font-size: 1.05rem; }
.label { display: inline-block; color: var(--brand); font-weight: 600; font-size: .92rem; margin-bottom: 10px; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); margin-top: -1px; }
.fact { padding: 26px 28px; }
.fact + .fact { border-left: 1px solid var(--line); }
.fact strong { display: block; font-size: clamp(1.7rem, 2.4vw, 2.3rem); font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.fact span { color: var(--muted); font-size: .92rem; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: step; }
.step { position: relative; padding: 26px 24px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); transition: transform .35s var(--ease), box-shadow .35s, border-color .35s; }
.step:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-2); }
.step-no { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 700; margin-bottom: 20px; }
html[data-theme="dark"] .step-no { background: var(--brand); color: #06231d; }
.step h3 { margin-bottom: 8px; }
.step p { font-size: .94rem; }
.step:not(:last-child)::after { content: ""; position: absolute; top: 44px; right: -18px; width: 18px; border-top: 2px dotted var(--line-2); }

.rhythms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.rhythm { position: relative; overflow: hidden; padding: 28px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); transition: transform .35s var(--ease), box-shadow .35s; }
.rhythm:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.rhythm .ic-wrap { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 22px; }
.rhythm.r-daily .ic-wrap { background: var(--brand-soft); color: var(--brand); }
.rhythm.r-weekly .ic-wrap { background: var(--sky-soft); color: var(--sky); }
.rhythm.r-monthly .ic-wrap { background: var(--gold-soft); color: var(--gold-ink); }
.rhythm h3 { font-size: 1.3rem; margin-bottom: 8px; }
.rhythm ul { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 9px; }
.rhythm li { display: flex; gap: 10px; color: var(--ink-2); font-size: .93rem; }
.rhythm li .ic { color: var(--brand); margin-top: 4px; }

.split-feature { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 70px); align-items: center; }
.feature-list { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; }
.feature-list li { display: flex; gap: 14px; align-items: flex-start; }
.feature-list li > span { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.feature-list li strong { display: block; font-size: 1rem; }
.feature-list li p { font-size: .93rem; }

/* Course tabs */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; transition: background-color .25s, color .25s; }
.tabs button.on { background: var(--navy); color: #fff; }
html[data-theme="dark"] .tabs button.on { background: var(--brand); color: #06231d; }
.course-panel { display: none; }
.course-panel.on { display: grid; animation: fadeUp .5s var(--ease); }
.course-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 26px; }
.course {
  display: flex; flex-direction: column; gap: 18px; padding: 20px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  transition: transform .3s var(--ease), border-color .3s, box-shadow .3s;
}
.course:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow); }
.course strong { font-size: 1.05rem; }
.course small { color: var(--muted); display: block; margin-top: 2px; }
.course-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.course-fee { font-size: 1.25rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.course-go { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); transition: transform .3s var(--ease), background-color .3s, color .3s; }
.course:hover .course-go { background: var(--brand); color: #fff; transform: translateX(3px); }

.board-preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; box-shadow: var(--shadow); }
.mini-board { list-style: none; margin: 0; padding: 0; }
.mini-board li { display: grid; grid-template-columns: 34px 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; transition: background-color .2s; }
.mini-board li:hover { background: var(--surface-2); }
.mini-board li + li { border-top: 1px solid var(--line); }
.mini-board strong { display: block; font-size: .96rem; }
.mini-board small { color: var(--muted); font-size: .8rem; }
.mini-board .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.mini-board .pts small { font-weight: 500; }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.duo-card { padding: clamp(26px, 4vw, 40px); border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 14px; transition: transform .35s var(--ease), box-shadow .35s; }
.duo-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.duo-card.dark { background: var(--navy); border-color: var(--navy); }
.duo-card.dark h3, .duo-card.dark strong { color: #fff; }
.duo-card.dark p { color: #aebcd0; }
.duo-card h3 { font-size: 1.5rem; }
.duo-card .btn { align-self: flex-start; margin-top: auto; }
.duo-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.duo-card.dark .duo-ic { background: rgba(242,169,59,.15); color: var(--gold); }

.faq { display: grid; gap: 10px; max-width: 860px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 22px; transition: border-color .25s, box-shadow .25s; }
.faq details[open] { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.faq summary { list-style: none; cursor: pointer; padding: 19px 0; font-weight: 600; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; font-weight: 400; color: var(--muted); transition: transform .3s var(--ease); line-height: 1; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 20px; max-width: 70ch; }

.cta-band { border-radius: 28px; padding: clamp(34px, 5vw, 60px); background: linear-gradient(120deg, #0f6b5c, #0b4f45); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 28px; flex-wrap: wrap; position: relative; overflow: hidden; }
.cta-band::before { content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; border: 40px solid rgba(255,255,255,.06); }
.cta-band h2 { color: #fff; max-width: 20ch; }
.cta-band p { color: #c8e6df; margin-top: 10px; }
.cta-band .hero-actions { margin-top: 0; position: relative; }

.site-footer { background: var(--navy); color: #aebcd0; padding: 70px 0 0; margin-top: clamp(64px, 8vw, 110px); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 40px; }
.footer-brand p { color: #93a4bb; margin-top: 18px; max-width: 36ch; font-size: .94rem; }
.site-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 14px; letter-spacing: 0; }
.site-footer a:not(.logo) { display: flex; align-items: center; gap: 8px; padding: 5px 0; color: #b6c3d5; font-size: .94rem; transition: color .2s, transform .2s; }
.site-footer a:not(.logo):hover { color: #fff; transform: translateX(3px); }
.site-footer p.small { color: #8395ad; margin-top: 10px; }
.footer-base { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 50px; padding: 22px 0 28px; border-top: 1px solid rgba(255,255,255,.08); font-size: .86rem; color: #7e90a9; }
.footer-base a { color: #b6c3d5; }

/* Inner public pages */
.page-hero { padding: clamp(44px, 6vw, 72px) 0 clamp(20px, 3vw, 32px); }
.page-hero p { max-width: 62ch; margin-top: 14px; font-size: 1.05rem; }
.form-layout { display: grid; grid-template-columns: 1.35fr .9fr; gap: 26px; align-items: start; }
.sticky-aside { position: sticky; top: 96px; }

/* Forms */
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card { padding: clamp(20px, 3vw, 30px); }
.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.panel-head h3 { font-size: 1.05rem; }
.panel-head p { font-size: .86rem; margin-top: 3px; }
.panel-head > .ic { color: var(--muted); }
.form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title { font-size: 1rem; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lbl { display: grid; gap: 7px; font-weight: 600; font-size: .88rem; color: var(--ink-2); }
.lbl .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.field {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); font-size: .95rem; font-weight: 400; color: var(--ink);
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.field::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line-2)); }
.field:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
textarea.field { min-height: 96px; resize: vertical; }
select.field { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23637289' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
input[type="file"].field { padding: 9px; }
input[type="file"].field::file-selector-button { border: 0; background: var(--brand-soft); color: var(--brand); padding: 8px 14px; border-radius: 8px; margin-right: 12px; font-weight: 600; cursor: pointer; }
.input-icon { position: relative; }
.input-icon .field { padding-right: 48px; }
.input-icon button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: transparent; color: var(--muted); border-radius: 9px; cursor: pointer; display: grid; place-items: center; }
.input-icon button:hover { background: var(--surface-2); color: var(--ink); }
.note { font-size: .88rem; color: var(--muted); }
.note a { color: var(--brand); font-weight: 600; }
.note a:hover { text-decoration: underline; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; font-size: .92rem; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 44px; height: 26px; border-radius: 99px; background: var(--line-2); position: relative; transition: background-color .25s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }

.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; border: 1px solid var(--line-2); cursor: pointer; transition: border-color .2s, background-color .2s, box-shadow .2s; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; margin-top: 1px; transition: border-color .2s, box-shadow .2s; }
.radio-card strong { display: block; font-size: .93rem; }
.radio-card small { color: var(--muted); font-size: .8rem; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card input:checked + .dot { border-color: var(--brand); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 10px var(--brand); }
.radio-card:has(input:disabled) { opacity: .5; cursor: not-allowed; }

.chip-groups { display: grid; gap: 18px; }
.chip-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; font-weight: 700; font-size: .88rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line-2); font-size: .86rem; font-weight: 500; cursor: pointer; transition: all .2s; user-select: none; background: var(--surface); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.6px solid var(--line-2); transition: all .2s; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.chip.on::before { background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat; border-color: var(--brand); }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: clamp(28px, 4vw, 56px); display: flex; flex-direction: column;
  background:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px) 0 0 / 34px 34px,
    radial-gradient(600px 400px at 20% 100%, rgba(47, 178, 155, .25), transparent 60%),
    linear-gradient(160deg, #10284c, #0b1b33);
}
.login-art .back { display: inline-flex; align-items: center; gap: 8px; color: #c4d0e0; font-size: .9rem; font-weight: 500; margin-left: auto; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); transition: background-color .2s; }
.login-art .back:hover { background: rgba(255,255,255,.08); color: #fff; }
.login-top { display: flex; align-items: center; gap: 16px; }
.login-copy { margin-top: auto; max-width: 460px; }
.login-copy h1 { color: #fff; font-size: clamp(2rem, 2.6vw + .8rem, 3.1rem); }
.login-copy p { color: #b3c1d4; margin-top: 16px; font-size: 1.04rem; }
.login-points { display: grid; gap: 12px; margin: 30px 0 0; padding: 0; list-style: none; }
.login-points li { display: flex; gap: 12px; align-items: center; color: #d5deea; font-size: .95rem; }
.login-points li span { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.07); color: var(--gold); flex: none; }
.login-form { display: grid; place-items: center; padding: clamp(24px, 5vw, 60px); position: relative; }
.login-card { width: min(440px, 100%); }
.login-card h2 { font-size: 1.9rem; }
.login-card > p { margin: 6px 0 26px; }
.role-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 22px; position: relative; }
.role-tabs label { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 6px; border-radius: 10px; font-weight: 600; font-size: .88rem; color: var(--muted); cursor: pointer; transition: color .25s; }
.role-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.role-tabs label:has(input:checked) { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.role-tabs label:has(input:focus-visible) { outline: 2px solid var(--brand); }
.login-theme { position: absolute; top: 20px; right: 20px; }
.login-foot { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 6px; }

/* ---------- Dashboard ---------- */
.dash { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: #c2cede;
  display: flex; flex-direction: column; padding: 22px 16px 16px; scrollbar-width: thin; scrollbar-color: #2a4064 transparent;
}
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-nav { display: grid; gap: 2px; padding: 14px 0; flex: 1; align-content: start; }
.side-group { font-size: .74rem; font-weight: 600; color: #6f82a0; padding: 14px 12px 6px; letter-spacing: .02em; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: .92rem; font-weight: 500; color: #b8c5d7; transition: background-color .2s, color .2s; }
.side-nav a .ic { color: #7f93b2; transition: color .2s, transform .25s var(--ease); }
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a:hover .ic { transform: translateX(2px); color: #d4ddea; }
.side-nav a.on { background: rgba(255,255,255,.09); color: #fff; font-weight: 600; }
.side-nav a.on .ic { color: var(--gold); }
.side-nav a.on::before { content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.side-foot { border-top: 1px solid rgba(255,255,255,.07); padding-top: 14px; display: grid; gap: 10px; }
.side-site { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: .9rem; font-weight: 600; color: #fff; background: rgba(242,169,59,.12); border: 1px solid rgba(242,169,59,.25); transition: background-color .2s; }
.side-site .ic { color: var(--gold); }
.side-site:hover { background: rgba(242,169,59,.2); }
.side-user { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.04); }
.side-user > div { flex: 1; min-width: 0; }
.side-user strong { display: block; color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: #8396b2; font-size: .78rem; }
.side-user .icon-btn { width: 36px; height: 36px; }

.avatar { width: 38px; height: 38px; border-radius: 11px; display: inline-grid; place-items: center; font-weight: 700; font-size: .82rem; background: linear-gradient(140deg, #2fb29b, #0f6b5c); color: #fff; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 32px; height: 32px; border-radius: 9px; font-size: .74rem; }
.avatar.xs { width: 22px; height: 22px; border-radius: 6px; font-size: .62rem; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.05rem; }

.dash-main { min-width: 0; display: flex; flex-direction: column; }
.dash-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 0 clamp(16px, 3vw, 34px); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.crumb { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); min-width: 0; }
.crumb strong { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.top-avatar { width: 40px; height: 40px; }
.dash-content { padding: clamp(18px, 3vw, 34px); width: 100%; max-width: 1360px; }
.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title h1 { font-size: clamp(1.6rem, 1.2vw + 1.1rem, 2.15rem); letter-spacing: -.03em; }
.page-title p { margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.scrim { display: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stats.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card { display: flex; gap: 16px; align-items: flex-start; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s; }
a.stat-card:hover, .stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.stat-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.tone-teal .stat-ic { background: var(--brand-soft); color: var(--brand); }
.tone-navy .stat-ic { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.tone-gold .stat-ic { background: var(--gold-soft); color: var(--gold-ink); }
.tone-sky .stat-ic { background: var(--sky-soft); color: var(--sky); }
.tone-rose .stat-ic { background: var(--bad-soft); color: var(--bad); }
.stat-label { font-size: .86rem; font-weight: 500; }
.stat-value { display: block; font-size: 1.85rem; font-weight: 800; letter-spacing: -.04em; line-height: 1.2; margin-top: 2px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat-hint { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.stat-hint b { color: var(--good); font-weight: 600; }
.stat-hint .warn { color: var(--warn); font-weight: 600; }

.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-top: 16px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.chart-box { position: relative; width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: .84rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend b { color: var(--ink); }
.donut-wrap { position: relative; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.donut-center strong { display: block; font-size: 1.9rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.donut-center span { font-size: .8rem; color: var(--muted); }

.list-rows { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row > div { flex: 1; min-width: 0; }
.list-row strong { display: block; font-size: .93rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row small { color: var(--muted); font-size: .8rem; }
.list-row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px var(--good-soft); flex: none; animation: pulse2 2s infinite; }
@keyframes pulse2 { 50% { box-shadow: 0 0 0 7px transparent; } }

/* Pills, segments */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.s-paid, .pill.s-active, .pill.s-live { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.s-pending, .pill.s-upcoming { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.s-disabled { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.s-closed, .pill.s-draft { background: var(--surface-2); color: var(--muted); }
.pill.plain::before { display: none; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.seg a, .seg button { padding: 8px 16px; border-radius: 10px; font-weight: 600; font-size: .88rem; color: var(--muted); transition: background-color .2s, color .2s; border: 0; background: transparent; cursor: pointer; }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg a.on, .seg button.on { background: var(--navy); color: #fff; }
html[data-theme="dark"] .seg a.on, html[data-theme="dark"] .seg button.on { background: var(--brand); color: #06231d; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.toolbar .field { min-height: 42px; }
.search { position: relative; min-width: 240px; flex: 1; max-width: 360px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .field { padding-left: 40px; }

/* Tables */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); padding: 13px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .sub { display: block; color: var(--muted); font-size: .8rem; }
.table .actions-cell { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 11px; }
.who strong { font-weight: 600; }
.code-tag { font-weight: 700; font-size: .84rem; padding: 4px 9px; border-radius: 7px; background: var(--brand-soft); color: var(--brand-ink); letter-spacing: .03em; }
@media (max-width: 760px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.stack tbody tr:last-child { border-bottom: 0; }
  .table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 7px 0; border: 0; text-align: right; }
  .table.stack td::before { content: attr(data-label); font-size: .78rem; font-weight: 600; color: var(--muted); text-align: left; flex: none; }
  .table.stack td[data-label=""]::before { display: none; }
  .table.stack .actions-cell { justify-content: flex-end; }
  .table.stack .who { justify-content: flex-end; }
}

/* Leaderboard */
.board { display: grid; gap: 18px; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; }
.podium-card { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 26px 16px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .35s var(--ease), box-shadow .35s; }
.podium-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.podium-card .avatar { margin-bottom: 8px; }
.podium-card strong { font-size: 1.02rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-card small { color: var(--muted); font-size: .82rem; }
.podium-score { margin: 10px 0 18px; }
.podium-score b { font-size: 1.6rem; font-weight: 800; letter-spacing: -.04em; }
.podium-score span { color: var(--muted); font-size: .85rem; }
.podium-base { width: calc(100% + 32px); height: 10px; }
.medal { position: absolute; top: 12px; left: 12px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.rank-1 { padding-top: 40px; border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); background: linear-gradient(180deg, var(--gold-soft), var(--surface) 60%); }
.rank-1 .medal { background: var(--gold); color: #3b2503; box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 25%, transparent); }
.rank-1 .podium-base { height: 16px; background: var(--gold); }
.rank-1 .avatar { background: linear-gradient(140deg, #f6c46d, #d68a14); width: 66px; height: 66px; border-radius: 18px; font-size: 1.2rem; }
.rank-2 .medal { background: #dfe5ec; color: #3b4a5f; }
.rank-2 .podium-base { background: #c3ccd8; }
.rank-3 .medal { background: #f0d6bf; color: #6b3f15; }
.rank-3 .podium-base { background: #d9a77c; }
.rank-badge { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-weight: 700; font-size: .85rem; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.rank-badge.r1 { background: var(--gold); color: #3b2503; border-color: transparent; }
.rank-badge.r2 { background: #dfe5ec; color: #3b4a5f; border-color: transparent; }
.rank-badge.r3 { background: #f0d6bf; color: #6b3f15; border-color: transparent; }
.table tr.top-1 { background: color-mix(in srgb, var(--gold-soft) 60%, transparent); }
.score-bar { display: inline-block; width: 80px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; vertical-align: middle; margin-right: 10px; }
.score-bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.score-num { font-variant-numeric: tabular-nums; }
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.period-note { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.period-note .ic { color: var(--brand); }
.first-list { list-style: none; padding: 0; margin: 0; display: grid; }
.first-list li { display: flex; gap: 14px; padding: 14px 0; }
.first-list li + li { border-top: 1px solid var(--line); }
.q-no { width: 38px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: var(--brand-soft); color: var(--brand-ink); flex: none; }
.q-text { min-width: 0; flex: 1; }
.q-text p { color: var(--ink); font-weight: 500; font-size: .93rem; }
.winner { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: .84rem; font-weight: 600; color: var(--ink-2); flex-wrap: wrap; }
.winner time { color: var(--muted); font-weight: 400; }
.winner.none { color: var(--muted); font-weight: 400; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface); display: grid; justify-items: center; gap: 8px; }
.empty-state .ic { color: var(--muted); margin-bottom: 6px; }
.empty-state p { max-width: 42ch; font-size: .93rem; }
.empty-state .btn { margin-top: 10px; }

/* Test editor */
.editor { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.editor-side { position: sticky; top: 90px; display: grid; gap: 16px; }
.q-list { display: grid; gap: 16px; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-sm); animation: fadeUp .4s var(--ease); transition: border-color .25s; }
.q-card:focus-within { border-color: var(--line-2); box-shadow: var(--shadow); }
.q-card.removing { animation: fadeOut .3s forwards; }
@keyframes fadeOut { to { opacity: 0; transform: scale(.97); } }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.q-head strong { font-size: .95rem; }
.q-head .spacer { flex: 1; }
.q-status { font-size: .78rem; font-weight: 600; color: var(--good); display: inline-flex; align-items: center; gap: 5px; }
.q-status.missing { color: var(--warn); }
.opt-list { display: grid; gap: 9px; margin-top: 14px; }
.opt-row { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 8px; align-items: center; padding: 6px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-2); transition: border-color .2s, background-color .2s; }
.opt-letter { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: .88rem; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); transition: all .2s; }
.opt-row .field { min-height: 40px; border-color: transparent; background: transparent; padding: 8px 6px; }
.opt-row .field:focus { background: var(--surface); border-color: var(--brand); }
.correct-toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); white-space: nowrap; transition: all .2s; user-select: none; }
.correct-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.correct-toggle .ic { opacity: .45; }
.correct-toggle:hover { border-color: var(--good); color: var(--good); }
.opt-row:has(.correct-toggle input:checked) { border-color: var(--good); background: var(--good-soft); }
.opt-row:has(.correct-toggle input:checked) .opt-letter { background: var(--good); border-color: var(--good); color: #fff; }
.correct-toggle:has(input:checked) { background: var(--good); border-color: var(--good); color: #fff; }
.correct-toggle:has(input:checked) .ic { opacity: 1; }
.correct-toggle:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.opt-del { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.opt-del:hover { background: var(--bad-soft); color: var(--bad); }
.opt-del:disabled { opacity: .3; cursor: not-allowed; background: transparent; color: var(--muted); }
.q-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.q-tools .note { display: inline-flex; align-items: center; gap: 6px; }
.save-bar { position: sticky; bottom: 14px; z-index: 15; display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-top: 20px; padding: 12px 14px 12px 20px; border-radius: 16px; background: var(--navy); color: #c8d4e4; box-shadow: var(--shadow-lg); }
.save-bar strong { color: #fff; }
.save-bar .btn.ghost { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.18); box-shadow: none; }
.save-bar .btn.ghost:hover { background: rgba(255,255,255,.12); }
.save-bar > div { display: flex; gap: 10px; flex-wrap: wrap; }
.dt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Exam */
.exam-bar { position: sticky; top: 68px; z-index: 10; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.exam-progress { flex: 1; min-width: 180px; }
.exam-progress small { color: var(--muted); font-size: .82rem; }
.exam-progress .track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 6px; }
.exam-progress .track span { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .4s var(--ease); }
.timer { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; padding: 8px 14px; border-radius: 12px; background: var(--navy); color: #fff; }
.timer .ic { color: var(--gold); }
.timer.late { background: var(--bad); animation: blink 1s infinite; }
.timer.late .ic { color: #fff; }
@keyframes blink { 50% { opacity: .75; } }
.question { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(18px, 3vw, 26px); margin-bottom: 14px; scroll-margin-top: 160px; }
.question-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.question-head p { color: var(--ink); font-size: 1.04rem; font-weight: 500; line-height: 1.5; }
.saved-tag { margin-left: auto; font-size: .76rem; font-weight: 600; color: var(--good); opacity: 0; transition: opacity .3s; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.saved-tag.show { opacity: 1; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer { position: relative; display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 13px; border: 1.5px solid var(--line); cursor: pointer; transition: border-color .2s, background-color .2s, transform .2s var(--ease); }
.answer:hover { border-color: var(--brand); transform: translateY(-1px); }
.answer input { position: absolute; opacity: 0; }
.answer .opt-letter { width: 32px; height: 32px; }
.answer:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.answer:has(input:checked) .opt-letter { background: var(--brand); color: #fff; border-color: var(--brand); }
.answer:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.answer.is-correct { border-color: var(--good); background: var(--good-soft); }
.answer.is-correct .opt-letter { background: var(--good); border-color: var(--good); color: #fff; }
.answer.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.answer.is-wrong .opt-letter { background: var(--bad); border-color: var(--bad); color: #fff; }
.answer .tag { margin-left: auto; font-size: .74rem; font-weight: 700; }
.answer.is-correct .tag { color: var(--good); }
.answer.is-wrong .tag { color: var(--bad); }
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 26px; align-items: center; }
.ring { --p: 0; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.ring strong { position: relative; font-size: 2rem; font-weight: 800; letter-spacing: -.04em; }

/* Test cards (student) */
.test-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.test-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); transition: transform .3s var(--ease), box-shadow .3s, border-color .3s; }
.test-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.test-card h3 { font-size: 1.05rem; }
.test-card .meta { display: grid; gap: 6px; font-size: .84rem; color: var(--muted); }
.test-card .meta span { display: flex; align-items: center; gap: 8px; }
.test-card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }

/* Welcome banner */
.welcome { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: clamp(22px, 3vw, 32px); background: linear-gradient(130deg, #10284c, #0e3a52 60%, #0f6b5c); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.welcome h1 { color: #fff; font-size: clamp(1.5rem, 1.2vw + 1.1rem, 2.1rem); }
.welcome p { color: #c4d3e3; margin-top: 6px; }
.welcome::after { content: ""; position: absolute; right: -40px; bottom: -90px; width: 240px; height: 240px; border-radius: 50%; border: 36px solid rgba(255,255,255,.06); }
.welcome > * { position: relative; z-index: 1; }

.share-box { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface-2); }
.share-box code { flex: 1; font-family: inherit; font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.book { display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: transform .3s var(--ease), box-shadow .3s; }
.book:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.book-cover { aspect-ratio: 4 / 3; display: grid; place-items: center; position: relative; background: linear-gradient(150deg, var(--navy-2), var(--navy)); color: #fff; }
.book-cover::before { content: ""; position: absolute; left: 18px; top: 0; bottom: 0; width: 3px; background: rgba(242,169,59,.6); }
.book-cover .ic { color: var(--gold); }
.book:nth-child(3n+2) .book-cover { background: linear-gradient(150deg, #138070, #0b5248); }
.book:nth-child(3n+3) .book-cover { background: linear-gradient(150deg, #3a5fa8, #253f78); }
.book-body { padding: 16px 18px 18px; display: grid; gap: 10px; flex: 1; }
.book-body h3 { font-size: 1rem; }
.book-body small { color: var(--muted); }
.book-body .btn { margin-top: auto; justify-self: start; }

/* Modal / viewer */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(8, 17, 32, .66); backdrop-filter: blur(6px); animation: fade .25s; }
.modal-card { width: min(920px, 100%); height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-lg); animation: pop .35s var(--ease); }
.modal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.viewer { position: relative; flex: 1; overflow: auto; padding: 16px; display: grid; justify-items: center; gap: 14px; background: var(--surface-2); user-select: none; -webkit-user-select: none; }
.viewer canvas { box-shadow: var(--shadow); border-radius: 6px; max-width: 100%; height: auto; }
.watermark { position: sticky; top: 40%; z-index: 2; pointer-events: none; font-size: clamp(1.5rem, 5vw, 3rem); font-weight: 800; color: rgba(14, 34, 64, .1); transform: rotate(-24deg); height: 0; white-space: nowrap; }
.hidden-preview { filter: blur(22px); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }

/* Pay page */
.pay-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.pay-card { width: min(460px, 100%); text-align: center; }
.pay-card .amount { font-size: 2.8rem; font-weight: 800; letter-spacing: -.04em; margin: 8px 0; }

/* Reveal animations */
.js [data-reveal] { opacity: 0; transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0ms); }
.js [data-reveal="up"] { transform: translateY(26px); }
.js [data-reveal="left"] { transform: translateX(-34px); }
.js [data-reveal="right"] { transform: translateX(34px); }
.js [data-reveal="zoom"] { transform: scale(.94); }
.js [data-reveal].in { opacity: 1; transform: none; }
.hero-in > * { animation: fadeLeft .9s var(--ease) both; }
.hero-in > *:nth-child(2) { animation-delay: .08s; }
.hero-in > *:nth-child(3) { animation-delay: .16s; }
.hero-in > *:nth-child(4) { animation-delay: .24s; }
.hero-in > *:nth-child(5) { animation-delay: .32s; }
.sheet-stage { animation: fadeRight 1s .2s var(--ease) both; }
@keyframes fadeLeft { from { opacity: 0; transform: translateX(-30px); } }
@keyframes fadeRight { from { opacity: 0; transform: translateX(40px); } }

/* Responsive */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .step::after { display: none; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { max-width: 16ch; }
  .sheet { margin: 0 auto; }
  .float-card { left: 0; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .fact:nth-child(3) { border-left: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid var(--line); }
  .rhythms, .duo, .split-feature, .form-layout { grid-template-columns: 1fr; }
  .sticky-aside { position: static; }
  .login-shell { grid-template-columns: 1fr; }
  .login-art { min-height: auto; }
  .login-copy { margin-top: 40px; }
  .login-points { display: none; }
  .dash { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 290px; max-width: 86vw; transform: translateX(-102%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(8, 17, 32, .5); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .scrim.open { opacity: 1; pointer-events: auto; }
  .side-nav a.on::before { left: -16px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { width: calc(100% - 28px); }
  .hero { border-radius: 22px; }
  .hero-actions .btn { flex: 1; }
  .float-card { position: relative; left: auto; bottom: auto; width: auto; margin: -18px 14px 0; }
  .sheet { transform: none; }
  .bubble { width: 25px; height: 25px; }
  .stats, .stats.cols-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { flex-direction: column; gap: 10px; padding: 16px; }
  .stat-value { font-size: 1.5rem; }
  .steps { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .form-grid, .dt-grid, .radio-cards, .answers { grid-template-columns: 1fr; }
  .podium { gap: 8px; }
  .podium-card { padding: 30px 6px 0; }
  .podium-card strong { font-size: .86rem; }
  .podium-card small { font-size: .72rem; }
  .podium-card .avatar { width: 42px; height: 42px; font-size: .85rem; }
  .rank-1 .avatar { width: 50px; height: 50px; }
  .podium-score b { font-size: 1.2rem; }
  .podium-score span { display: block; font-size: .72rem; }
  .medal { width: 24px; height: 24px; font-size: .72rem; top: 8px; left: 8px; }
  .hide-xs { display: none !important; }
  .crumb span, .crumb .ic { display: none; }
  .opt-row { grid-template-columns: 32px 1fr auto; }
  .opt-row .opt-del { grid-column: 3; }
  .opt-row .correct-toggle { grid-column: 2 / 4; justify-content: center; }
  .opt-letter { width: 32px; height: 32px; }
  .result-hero { grid-template-columns: 1fr; justify-items: start; }
  .save-bar { bottom: 8px; padding: 12px; }
  .save-bar > div { width: 100%; }
  .save-bar .btn { flex: 1; }
  .exam-bar { top: 68px; }
  .tabs { display: flex; overflow-x: auto; flex-wrap: nowrap; }
  .tabs button { flex: none; }
  .seg { display: flex; width: 100%; }
  .seg a, .seg button { flex: 1; text-align: center; padding: 8px 6px; }
  .welcome .btn { width: 100%; }
  .welcome-actions { width: 100%; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
.seg label { padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .88rem; color: var(--muted); transition: background-color .2s, color .2s; position: relative; }
.seg label.on { background: var(--navy); color: #fff; }
html[data-theme="dark"] .seg label.on { background: var(--brand); color: #06231d; }
@media (min-width: 961px) { .dash { background: linear-gradient(90deg, var(--navy) 268px, transparent 268px); } }
.editor > *, .dash-grid > *, .form-layout > *, .split-feature > *, .hero > * { min-width: 0; }
.table td[data-label="Score"], .table td[data-label="Time taken"], .table td[data-label="Joined"] { white-space: nowrap; }
.who strong { white-space: nowrap; }
.who > div { min-width: 0; }
.form, .editor-side, .q-list, .board, .chip-groups { grid-template-columns: minmax(0, 1fr); }
.field { min-width: 0; }
@media (min-width: 1101px) { .editor-side .dt-grid { grid-template-columns: 1fr; } }
html, body { overflow-x: clip; }
.list-row .btn, .list-row .pill, .list-row .val { flex: none; }
@media (max-width: 960px) {
  .js [data-reveal="left"], .js [data-reveal="right"] { transform: translateY(26px); }
  .sheet-stage { animation-name: fadeUpBig; }
}
@keyframes fadeUpBig { from { opacity: 0; transform: translateY(30px); } }
@media (max-width: 640px) {
  .list-row .val small { display: none; }
  .list-row { gap: 10px; }
}
@media (max-width: 1100px) { .editor-side { order: -1; } }
@media (max-width: 640px) {
  .opt-row { grid-template-columns: 32px minmax(0, 1fr) 34px; row-gap: 4px; }
  .opt-row .opt-letter { grid-row: 1; grid-column: 1; }
  .opt-row .field { grid-row: 1; grid-column: 2; }
  .opt-row .opt-del { grid-row: 1; grid-column: 3; }
  .opt-row .correct-toggle { grid-row: 2; grid-column: 2 / 4; justify-self: start; padding: 6px 12px; }
  .save-bar { gap: 8px; }
  .save-bar > div { flex-wrap: nowrap; }
  .save-bar .btn { min-height: 42px; padding: 0 12px; }
  .course-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .course { padding: 14px; gap: 12px; }
  .course strong { font-size: .95rem; }
  .course-fee { font-size: 1.05rem; }
  .course-go { width: 28px; height: 28px; }
}
.m-only { display: none !important; }
@media (max-width: 760px) {
  .table.stack td { justify-content: flex-end; gap: 4px; }
  .table.stack td::before { margin-right: auto; }
  .board .table.stack tr { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; }
  .board .table.stack td { padding: 0; }
  .board .table.stack td::before { display: none; }
  .board .table.stack td[data-label="Class"], .board .table.stack td[data-label="Score"], .board .table.stack td[data-label="Time taken"], .board .table.stack td[data-label="Tests"] { display: none; }
  .board .table.stack td[data-label="Student"] { justify-content: flex-start; text-align: left; }
  .board .table.stack .who { justify-content: flex-start; }
  .board .table.stack .who strong { white-space: normal; }
  .board .m-only { display: block !important; }
}
.credit { font-size: .82rem; color: var(--muted); text-align: center; margin: 0; }
.credit a { color: var(--brand); font-weight: 700; transition: color .2s; }
.credit a:hover { text-decoration: underline; }
.credit.on-dark { color: #7e90a9; text-align: left; }
.credit.on-dark a { color: var(--gold); }
.login-card .credit { margin-top: 4px; }
.pay-card .credit { margin-top: 18px; }
.dash-credit { padding: 6px clamp(18px, 3vw, 34px) 24px; text-align: left; margin-top: auto; }
.credit, .credit a { white-space: nowrap; }
.footer-base { align-items: center; }
@media (max-width: 640px) { .footer-base { flex-direction: column; align-items: flex-start; gap: 8px; } }

/* ===== v3: full-width layout, app-style mobile ===== */
:root { --gutter: clamp(16px, 4.5vw, 88px); --tabbar-h: 66px; }
html { -webkit-tap-highlight-color: transparent; }
.wrap { width: 100%; max-width: none; margin-inline: 0; padding-inline: var(--gutter); }
.hero-shell { padding: 0; }
.hero-shell > .wrap { padding-inline: 0; }
.hero { border-radius: 0; padding: clamp(40px, 7vw, 96px) var(--gutter); min-height: min(calc(100vh - 76px), 860px); grid-template-columns: 1.1fr .9fr; }
.hero h1 { max-width: 14ch; font-size: clamp(2.2rem, 3.6vw + 1rem, 4.4rem); }
.sheet { max-width: 440px; }
.cta-wrap { display: block; }
.cta-band { border-radius: 0; padding: clamp(40px, 6vw, 80px) var(--gutter); }
.site-footer { margin-top: 0; }
main#content { padding-bottom: clamp(56px, 7vw, 100px); }
main#content:has(> .cta-wrap:last-child) { padding-bottom: 0; }
.footer-grid { grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: clamp(28px, 4vw, 64px); }
.dash-content { max-width: none; }

/* Credit */
.site-footer .credit a, .credit a { display: inline; padding: 0; transform: none !important; }
.credit { display: inline-flex; align-items: baseline; gap: 5px; justify-content: center; }
.credit.on-dark { justify-content: flex-start; }
.credit.under-btn { display: flex; margin-top: -4px; }
.dash-credit { display: flex; justify-content: flex-start; }

/* Tab bar (mobile app navigation) */
.tabbar { display: none; }
@media (max-width: 960px) {
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 44;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(170%) blur(18px); -webkit-backdrop-filter: saturate(170%) blur(18px);
    border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -18px rgba(14, 34, 64, .35);
    user-select: none; -webkit-user-select: none;
  }
  .tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; padding: 4px 2px; border: 0; background: none; border-radius: 14px; cursor: pointer;
    color: var(--muted); font-size: .68rem; font-weight: 600; letter-spacing: .01em; transition: color .2s, transform .15s;
  }
  .tab .ic { transition: transform .25s var(--ease); }
  .tab:active { transform: scale(.92); }
  .tab.on { color: var(--brand); }
  .tab.on .ic { transform: translateY(-1px); }
  .tab.on::before { content: ""; position: absolute; inset: 2px 14%; border-radius: 12px; background: var(--brand-soft); z-index: -1; }
  body:has(.tabbar) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  body:has(.tabbar) .save-bar { bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom)); }
  .save-bar { bottom: calc(10px + env(safe-area-inset-bottom)); }

  /* App-style chrome */
  .site-header { padding-top: env(safe-area-inset-top); }
  .nav { min-height: 62px; gap: 12px; }
  .logo .mark { width: 36px; height: 36px; }
  .logo-text small { display: none; }
  .dash-top { padding-top: env(safe-area-inset-top); min-height: calc(60px + env(safe-area-inset-top)); }
  .exam-bar { top: calc(60px + env(safe-area-inset-top)); }
  .hero { min-height: 0; grid-template-columns: 1fr; }
  .site-footer { padding-top: 44px; }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 15px; }
  h1 { font-size: clamp(1.8rem, 7vw, 2.3rem); }
  h2 { font-size: clamp(1.45rem, 6vw, 1.8rem); }
  .wrap { width: 100%; }
  .hero { padding: 30px 18px 34px; }
  .hero h1 { font-size: clamp(2rem, 8.6vw, 2.6rem); }
  .hero .lead { font-size: .98rem; margin-top: 14px; }
  .hero-actions { gap: 10px; margin-top: 22px; }
  .hero-actions .btn { flex: 1 1 0; min-width: 0; }
  .hero-meta { gap: 8px 16px; margin-top: 24px; padding-top: 18px; }
  .hero-meta span { font-size: .84rem; }
  .sheet-stage { padding-bottom: 0; }
  .section { padding: 48px 0; }
  .section.tight { padding: 22px 0 6px; }
  .section-head { margin-bottom: 22px; }
  .section-head p { font-size: .96rem; }
  .facts { border-radius: 18px; }
  .fact { padding: 18px; }
  .fact strong { font-size: 1.6rem; }
  .fact span { font-size: .82rem; }
  .step, .rhythm, .duo-card { border-radius: 18px; padding: 20px; }
  .step-no { margin-bottom: 14px; }
  .rhythm .ic-wrap { margin-bottom: 14px; }
  .steps, .rhythms, .duo { gap: 12px; }
  .board-preview { border-radius: 18px; }
  .faq details { border-radius: 14px; padding: 0 16px; }
  .faq summary { padding: 16px 0; font-size: .95rem; }
  .cta-band { padding: 34px 18px; }
  .cta-band .hero-actions { width: 100%; }
  .page-hero { padding: 26px 0 14px; }
  .page-hero p { font-size: .96rem; }
  .card { padding: 18px; border-radius: 18px; }
  .panel { padding: 16px; border-radius: 18px; }
  .btn { min-height: 48px; }
  .btn.small { min-height: 40px; }
  .field { min-height: 50px; font-size: 16px; }
  .opt-row .field { font-size: 15px; }

  /* Footer: brand full, link columns side by side */
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 26px 18px; }
  .footer-brand, .footer-grid > div:last-child { grid-column: 1 / -1; }
  .site-footer h4 { margin-bottom: 8px; }
  .site-footer a:not(.logo) { padding: 6px 0; }
  .footer-base { flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 30px; padding-bottom: 24px; }
  .footer-base [data-top] { display: none; }

  /* Dashboard */
  .dash-content { padding: 16px; }
  .page-title { margin-bottom: 18px; gap: 12px; }
  .page-title h1 { font-size: 1.55rem; }
  .page-title p { font-size: .9rem; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 0; }
  .welcome { padding: 20px; border-radius: 18px; }
  .stats { gap: 10px; }
  .stat-card { border-radius: 16px; padding: 14px; gap: 10px; }
  .stat-ic { width: 38px; height: 38px; border-radius: 11px; }
  .stat-label { font-size: .8rem; }
  .stat-hint { font-size: .74rem; }
  .dash-grid { gap: 12px; margin-top: 12px; }
  .table-card { border-radius: 16px; }
  .toolbar { gap: 10px; }
  .search { min-width: 0; max-width: none; width: 100%; flex-basis: 100%; }
  .board-head > form, .board-head > form .field { width: 100%; min-width: 0 !important; }
  .test-cards { grid-template-columns: 1fr; gap: 12px; }
  .book-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .book-body { padding: 12px; }
  .book-body h3 { font-size: .92rem; }
  .question { border-radius: 16px; padding: 16px; }
  .exam-bar { border-radius: 14px; padding: 10px 12px; gap: 12px; }
  .timer { font-size: 1.05rem; padding: 7px 11px; }
  .dash-credit { padding: 4px 16px 18px; }
  .login-art { padding: calc(18px + env(safe-area-inset-top)) 18px 26px; }
  .login-copy { margin-top: 24px; }
  .login-copy p { font-size: .95rem; }
  .login-form { padding: 22px 16px 32px; place-items: start center; }
  .login-theme { top: 14px; right: 14px; }
  .login-card h2 { font-size: 1.6rem; }
  .role-tabs label { font-size: .82rem; padding: 10px 4px; }
}
@media (display-mode: standalone) {
  .site-footer .footer-grid > div:not(.footer-brand) { display: none; }
}
.faq-layout { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: clamp(24px, 5vw, 80px); align-items: start; }
.faq-layout .faq { max-width: none; }
.faq-layout .section-head { position: sticky; top: 100px; }
@media (max-width: 960px) { .faq-layout { grid-template-columns: 1fr; gap: 0; } .faq-layout .section-head { position: static; } }
.role-tabs { margin-bottom: 0; }
.login-foot { margin-top: 0; padding-top: 16px; gap: 4px; }
.credit.under-btn { margin-top: -6px; }
@media (max-width: 760px) {
  #students-table td[data-label="Agent"], #students-table td[data-label="Joined"], #agent-students td[data-label="Joined"] { display: none; }
  .table.stack tr { padding: 14px 16px; }
  .table.stack td[data-label="Student"], .table.stack td[data-label="Agent"]:first-child, .table.stack td[data-label="Test"] { justify-content: flex-start; text-align: left; padding-bottom: 10px; }
  .table.stack td[data-label="Student"]::before, .table.stack td[data-label="Test"]::before, #agents-table td[data-label="Agent"]::before { display: none; }
  #agents-table td[data-label="Agent"] { justify-content: flex-start; text-align: left; padding-bottom: 10px; }
  .table.stack td[data-label="Student"] .who, #agents-table .who { justify-content: flex-start; }
  .table.stack td[data-label="Test"] { flex-direction: column; align-items: flex-start; gap: 2px; }
  .table.stack .actions-cell { padding-top: 8px; }
  .table.stack .actions-cell form, .table.stack .actions-cell .btn { flex: 1 1 auto; }
  .table.stack .actions-cell .btn { width: 100%; }
}
@media (max-width: 760px) {
  .table.stack .actions-cell { flex-wrap: nowrap; width: 100%; }
  .table.stack .actions-cell > * { flex: 1 1 0; min-width: 0; }
  .table.stack .actions-cell form { display: flex; }
  .table.stack .actions-cell .btn { width: 100%; padding: 0 8px; }
  .table.stack td[data-label="Window"] { display: grid; grid-template-columns: auto 1fr; justify-items: end; column-gap: 14px; }
  .table.stack td[data-label="Window"]::before { grid-row: 1 / 3; justify-self: start; align-self: center; margin: 0; }
  .table.stack td[data-label="Window"] .sub { grid-column: 2; }
}
@media (max-width: 760px) {
  .table.stack .actions-cell > form:has(.btn.danger:only-of-type) { flex: 0 0 52px; }
  .table.stack .actions-cell form .btn { flex: 1; }
}
@media (max-width: 1100px) { .js [data-reveal="left"], .js [data-reveal="right"] { transform: translateY(26px); } }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.q-extra { display: grid; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.q-extra .switch { align-items: flex-start; }
.q-file-note { margin: 0; color: var(--muted); font-size: .82rem; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; }
.q-shot { display: block; max-width: min(100%, 520px); margin-top: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.q-pdf { margin-top: 12px; }
.question .answers { margin-top: 12px; }

