/* JaniX design system: tokens → base → layout → components → pages. */

/* ------------------------------------------------------------------ tokens */
:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", "Nirmala UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;

  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #f1f0f9;
  --surface-3: #e9e8f5;
  --ink: #15142b;
  --ink-2: #3d3c58;
  --muted: #676682;
  --line: #e5e4f0;
  --line-strong: #d3d1e4;

  --brand: #5b45e0;
  --brand-strong: #4834c4;
  --brand-ink: #ffffff;
  --brand-soft: #eeebff;
  --brand-text: #4a36cc;
  --accent: #0c8f69;
  --accent-bright: #12b886;
  --accent-soft: #dcf6ec;
  --warm: #f59f00;
  --warm-soft: #fff3d6;
  --warm-text: #8a5a00;
  --danger: #d93d42;
  --danger-soft: #fde8e8;
  --danger-text: #b4262b;
  --info: #1c7ed6;
  --info-soft: #e3f0fc;
  --info-text: #175ea3;

  --chart: #5b45e0;
  --grid: #ecebf4;

  --shadow-sm: 0 1px 2px rgba(20, 20, 43, 0.06);
  --shadow: 0 1px 3px rgba(20, 20, 43, 0.06), 0 10px 28px -14px rgba(20, 20, 43, 0.16);
  --shadow-lg: 0 24px 60px -24px rgba(52, 36, 150, 0.35);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --header-h: 66px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e18; --surface: #161726; --surface-2: #1d1e31; --surface-3: #25263c;
    --ink: #ececf6; --ink-2: #c9c9dc; --muted: #9a9ab5; --line: #2a2b42; --line-strong: #3a3b57;
    --brand: #6f5df7; --brand-strong: #8373ff; --brand-soft: #25224a; --brand-text: #aea4ff;
    --accent: #34d39e; --accent-bright: #34d39e; --accent-soft: #10362b;
    --warm-soft: #3a2e12; --warm-text: #ffcf70; --danger-soft: #3d1a1d; --danger-text: #ff9a9d;
    --info-soft: #11283f; --info-text: #8cc4ff; --chart: #8373ff; --grid: #25263a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0e18; --surface: #161726; --surface-2: #1d1e31; --surface-3: #25263c;
  --ink: #ececf6; --ink-2: #c9c9dc; --muted: #9a9ab5; --line: #2a2b42; --line-strong: #3a3b57;
  --brand: #6f5df7; --brand-strong: #8373ff; --brand-soft: #25224a; --brand-text: #aea4ff;
  --accent: #34d39e; --accent-bright: #34d39e; --accent-soft: #10362b;
  --warm-soft: #3a2e12; --warm-text: #ffcf70; --danger-soft: #3d1a1d; --danger-text: #ff9a9d;
  --info-soft: #11283f; --info-text: #8cc4ff; --chart: #8373ff; --grid: #25263a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1 0 auto; }
img, svg, video { max-width: 100%; }
img { height: auto; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; color: var(--ink); }
h1 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 2.4vw, 1.95rem); font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
code, kbd, pre { font-family: var(--mono); font-size: 0.9em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 10px; }
.skip-link:focus { top: 12px; }

/* utilities */
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.xsmall { font-size: 0.78rem; }
.strong { font-weight: 700; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.split { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hidden { display: none !important; }
.honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------------ layout */
.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 20px; }
.container-narrow { max-width: 780px; }
.section { padding-block: clamp(48px, 7vw, 88px); }
.section-tight { padding-block: 40px; }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: 32px; }
.section-head.center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brand-text); margin-bottom: 12px;
}
.lead { font-size: 1.13rem; color: var(--ink-2); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.layout-aside { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
@media (max-width: 960px) { .layout-aside { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ header */
.announcement { background: var(--brand); color: #fff; text-align: center; font-size: 0.9rem; padding: 8px 16px; }
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { height: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 1.28rem; letter-spacing: -0.03em; }
.brand:hover { text-decoration: none; }
.brand .logo-mark { width: 36px; height: 36px; }
.brand b { color: var(--brand-text); }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-links a { color: var(--ink-2); font-weight: 600; font-size: 0.95rem; padding: 8px 12px; border-radius: 10px; white-space: nowrap; }
.nav-links a:hover, .nav-links a.is-active { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn .count {
  position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 0.7rem; font-weight: 700; display: grid; place-items: center;
}
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: inline; }
}
.nav-toggle { display: none; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; z-index: 60;
}
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; color: var(--ink-2);
  font: inherit; font-size: 0.93rem; font-weight: 600; background: none; border: 0; cursor: pointer; text-align: left;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.user-chip:hover { border-color: var(--line-strong); }
.user-chip .chip-name { font-weight: 600; font-size: 0.9rem; max-width: 140px; }

@media (max-width: 1060px) {
  .nav-toggle { display: inline-grid; }
  .nav-links {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 16px 20px; margin: 0; box-shadow: var(--shadow);
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 12px 14px; }
  .user-chip .chip-name { display: none; }
  .hide-mobile { display: none !important; }
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 18px;
  font: inherit; font-weight: 700; font-size: 0.95rem; line-height: 1.2; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 70%, transparent); }
.btn-primary:hover { background: var(--brand-strong); color: var(--brand-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand-text); }
.btn-soft { background: var(--brand-soft); color: var(--brand-text); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 70%, var(--brand) 12%); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-success { background: var(--accent-bright); color: #06281c; }
.btn-success:hover { filter: brightness(0.95); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.93); }
.btn-danger-ghost { background: transparent; color: var(--danger-text); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 13px 26px; font-size: 1.02rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: 0.55; pointer-events: none; }
.btn-icon { min-height: 34px; width: 34px; padding: 0; border-radius: 10px; }
.inline-form { display: inline; margin: 0; }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem;
  font-weight: 700; line-height: 1.5; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-success, .badge-published, .badge-valid, .badge-completed, .badge-graded, .badge-passed, .badge-sent { background: var(--accent-soft); color: var(--accent); }
.badge-warning, .badge-pending, .badge-submitted, .badge-in_progress { background: var(--warm-soft); color: var(--warm-text); }
.badge-danger, .badge-revoked, .badge-failed, .badge-expired, .badge-returned { background: var(--danger-soft); color: var(--danger-text); }
.badge-info, .badge-active { background: var(--info-soft); color: var(--info-text); }
.badge-muted, .badge-draft, .badge-archived, .badge-not_sent, .badge-skipped { background: var(--surface-2); color: var(--muted); }
.badge-outline { background: transparent; border: 1px solid var(--line-strong); }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 22px; }
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.05rem; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-link { display: block; color: inherit; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card-flush { overflow: hidden; }
.card-tint { background: linear-gradient(135deg, var(--brand-soft), var(--surface) 70%); }

/* ------------------------------------------------------------------ alerts & messages */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 0.95rem; }
.alert .icon { margin-top: 2px; }
.alert p:last-child { margin-bottom: 0; }
.alert-info { background: var(--info-soft); color: var(--info-text); }
.alert-success { background: var(--accent-soft); color: var(--accent); }
.alert-warning { background: var(--warm-soft); color: var(--warm-text); }
.alert-error, .alert-danger { background: var(--danger-soft); color: var(--danger-text); }
.alert a { color: inherit; text-decoration: underline; }
.messages { display: flex; flex-direction: column; gap: 10px; margin-block: 16px; }
.message-close { margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; opacity: 0.7; padding: 2px; }
.message-close:hover { opacity: 1; }

/* ------------------------------------------------------------------ forms */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > legend { font-weight: 650; font-size: 0.92rem; color: var(--ink); }
fieldset.field { border: 0; padding: 0; margin: 0; }
.req { color: var(--danger-text); margin-left: 2px; }
.help { font-size: 0.83rem; color: var(--muted); margin: 0; }
.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger-text); font-size: 0.85rem; font-weight: 600; }
.errorlist.nonfield { padding: 12px 14px; background: var(--danger-soft); border-radius: var(--radius-sm); }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="search"],
input[type="tel"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%; font: inherit; font-size: 0.96rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 11px; padding: 10px 13px; min-height: 44px; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
textarea.mono { font-family: var(--mono); font-size: 0.88rem; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23676682' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
select[multiple] { background-image: none; padding-right: 13px; min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
input[type="file"] { font: inherit; font-size: 0.9rem; color: var(--ink-2); max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; margin-right: 12px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink); cursor: pointer;
}
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; font-size: 0.95rem; cursor: pointer; }
.check input { margin-top: 3px; }
.check-field .help { margin-left: 28px; }
.radio-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 20px; }
.radio-list label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }
.file-current { margin: 0 0 6px; font-size: 0.88rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.file-current label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--danger-text); }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 40px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters > * { flex: 0 1 auto; }
.filters input[type="search"], .filters .search-box { flex: 1 1 240px; }
.filters select { width: auto; min-width: 150px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .cell-title { font-weight: 650; color: var(--ink); }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 22px; }
.card > .table-wrap:first-child .table th { border-radius: var(--radius) var(--radius) 0 0; }

/* ------------------------------------------------------------------ progress, stats, avatars */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent-bright)); border-radius: 999px; min-width: 4px; transition: width 0.4s; }
.progress.is-complete > span { background: var(--accent-bright); }
.progress-lg { height: 12px; }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row .progress { flex: 1; }
.progress-row .pct { font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 600; color: var(--muted); }
.stat-label .icon { color: var(--brand-text); }
.stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 0.82rem; color: var(--muted); }

.avatar {
  --size: 36px; width: var(--size); height: var(--size); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  font-weight: 700; font-size: calc(var(--size) * 0.38); color: #fff; overflow: hidden;
  background: linear-gradient(135deg, hsl(var(--hue, 250) 70% 58%), hsl(calc(var(--hue, 250) + 40) 70% 45%));
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --size: 28px; }
.avatar-lg { --size: 64px; }
.avatar-xl { --size: 96px; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person-name { font-weight: 650; color: var(--ink); line-height: 1.3; }
.person-meta { font-size: 0.83rem; color: var(--muted); }

/* ------------------------------------------------------------------ misc components */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--line-strong); margin-bottom: 8px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs a { color: var(--muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--brand-text); }
.breadcrumbs .icon { width: 14px; height: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 650; font-size: 0.93rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--brand-text); border-bottom-color: var(--brand); }
.tabs .count { background: var(--surface-2); border-radius: 999px; padding: 0 8px; font-size: 0.75rem; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 38px; height: 38px; padding: 0 12px; border-radius: 10px; display: inline-grid; place-items: center; font-weight: 600; font-size: 0.9rem; }
.pagination a { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.pagination a:hover { border-color: var(--brand); color: var(--brand-text); text-decoration: none; }
.pagination .current { background: var(--brand); color: #fff; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 0.9rem; }
.pill:hover, .pill.is-active { border-color: var(--brand); color: var(--brand-text); background: var(--brand-soft); text-decoration: none; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist .icon { color: var(--accent); margin-top: 3px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.87rem; color: var(--muted); }
.meta span { display: inline-flex; align-items: center; gap: 6px; }
.kbd { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 0.85em; }
.divider-label { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; }
.divider-label::before, .divider-label::after { content: ""; height: 1px; background: var(--line); flex: 1; }
details.disclosure > summary { cursor: pointer; font-weight: 650; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.dl dt { color: var(--muted); font-size: 0.9rem; }
.dl dd { margin: 0; font-weight: 600; }

/* prose (rendered Markdown) */
.prose { color: var(--ink-2); font-size: 1.02rem; line-height: 1.75; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.45rem; margin-top: 1.6em; }
.prose h3 { font-size: 1.2rem; margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 0.3em 0; }
.prose a { text-decoration: underline; }
.prose blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 10px 10px 0; color: var(--ink); }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
.prose pre { background: #14132a; color: #e7e6ff; padding: 16px 18px; border-radius: 12px; overflow-x: auto; line-height: 1.55; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose img { border-radius: 12px; }

/* ------------------------------------------------------------------ course cards */
.course-card { display: flex; flex-direction: column; overflow: hidden; height: 100%; }
.thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-art {
  position: absolute; inset: 0; display: grid; place-items: center;
  background:
    radial-gradient(circle at 18% 22%, hsl(var(--hue) 90% 78% / 0.9), transparent 45%),
    radial-gradient(circle at 85% 80%, hsl(calc(var(--hue) + 60) 85% 65% / 0.85), transparent 50%),
    linear-gradient(135deg, hsl(var(--hue) 70% 52%), hsl(calc(var(--hue) + 35) 72% 40%));
}
.thumb-art .art-icon { font-size: 3rem; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.25)); }
.thumb-art .art-title { position: absolute; left: 16px; right: 16px; bottom: 12px; color: rgba(255, 255, 255, 0.95); font-weight: 800; font-size: 0.95rem; letter-spacing: -0.01em; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.25); }
.thumb .badge { position: absolute; top: 12px; left: 12px; background: rgba(255, 255, 255, 0.92); color: #2d2c48; }
.course-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-cat { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand-text); }
.course-title { font-size: 1.1rem; font-weight: 750; margin: 0; color: var(--ink); line-height: 1.3; }
.course-sub { font-size: 0.9rem; color: var(--muted); margin: 0; }
.course-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px dashed var(--line); font-size: 0.85rem; color: var(--muted); }
.course-foot .price { font-weight: 800; color: var(--accent); font-size: 0.95rem; }

/* ------------------------------------------------------------------ hero & marketing */
.hero { position: relative; overflow: hidden; padding-block: clamp(48px, 8vw, 96px) clamp(56px, 8vw, 104px); }
.hero::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 70vw; height: 70vw; max-width: 900px; max-height: 900px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 22%, transparent), transparent 62%); pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; left: -15%; bottom: -45%; width: 60vw; height: 60vw; max-width: 760px; max-height: 760px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent-bright) 16%, transparent), transparent 60%); pointer-events: none;
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.9rem); line-height: 1.06; letter-spacing: -0.035em; margin-bottom: 20px; }
.gradient-text { background: linear-gradient(100deg, var(--brand) 10%, #b14bf4 55%, var(--accent-bright)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: clamp(1.05rem, 1.6vw, 1.22rem); max-width: 560px; margin-bottom: 28px; }
.hero-search { display: flex; gap: 8px; max-width: 540px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 26px; }
.hero-search input { border: 0; box-shadow: none; background: transparent; min-height: 46px; }
.hero-search input:focus { box-shadow: none; }
.hero-proof { display: flex; flex-wrap: wrap; gap: 22px; color: var(--muted); font-size: 0.92rem; }
.hero-proof strong { display: block; font-size: 1.45rem; color: var(--ink); letter-spacing: -0.02em; }
.hero-visual { position: relative; min-height: 560px; }
.float-card { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 18px; }
.float-main { left: 0; right: 12%; top: 56px; padding: 0; overflow: hidden; }
.float-main .thumb { aspect-ratio: 16 / 8; }
.float-main .fm-body { padding: 16px 18px 18px; }
.float-quiz { right: 0; bottom: 0; width: 240px; }
.float-cert { right: 0; top: 0; width: 250px; display: flex; gap: 12px; align-items: center; }
.float-cert .seal { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.float-quiz .opt { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); font-size: 0.85rem; margin-top: 7px; }
.float-quiz .opt.correct { border-color: var(--accent-bright); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
@media (max-width: 560px) { .hero-visual { min-height: 470px; } .float-quiz { width: 210px; } .float-cert { width: 230px; } }
@media (prefers-reduced-motion: no-preference) {
  .float-quiz { animation: bob 6s ease-in-out infinite; }
  .float-cert { animation: bob 7s ease-in-out -2s infinite; }
}
@keyframes bob { 50% { transform: translateY(-8px); } }

.feature { padding: 24px; }
.feature-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); margin-bottom: 14px; }
.feature-icon .icon { width: 22px; height: 22px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.category-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.category-card .emoji { font-size: 1.7rem; width: 52px; height: 52px; display: grid; place-items: center; background: var(--surface-2); border-radius: 14px; }
.category-card strong { display: block; color: var(--ink); }
.steps { counter-reset: step; display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.step { position: relative; padding: 24px; }
.step::before { counter-increment: step; content: counter(step); width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; margin-bottom: 14px; }
.step p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.cta-band { border-radius: var(--radius-lg); padding: clamp(28px, 5vw, 56px); background: linear-gradient(120deg, #4131c2, #6d4bf0 55%, #0fa678); color: #fff; display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; box-shadow: var(--shadow-lg); }
.cta-band h2 { color: #fff; margin-bottom: 6px; }
.cta-band p { color: rgba(255, 255, 255, 0.85); margin: 0; max-width: 560px; }
.cta-band .btn-primary { background: #fff; color: #3b2bb4; box-shadow: none; }
.cta-band .btn-primary:hover { background: #f1efff; }
.cta-band .btn-secondary { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.page-hero { padding-block: clamp(40px, 6vw, 72px) 32px; }
.page-hero .lead { max-width: 680px; }
.faq-list { display: flex; flex-direction: column; gap: 12px; }
.faq-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.faq-item > summary { list-style: none; cursor: pointer; padding: 18px 22px; font-weight: 700; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary .icon { transition: transform 0.2s; color: var(--muted); }
.faq-item[open] > summary .icon { transform: rotate(180deg); }
.faq-item .prose { padding: 0 22px 20px; font-size: 0.97rem; }
.legal h2 { font-size: 1.3rem; margin-top: 2em; }

/* ------------------------------------------------------------------ footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding-block: 48px 28px; margin-top: 40px; font-size: 0.93rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
.footer-grid h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 12px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--ink-2); }
.footer-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 0.86rem; }
.portal-page .site-footer { margin-top: 0; padding-block: 18px; }

/* ------------------------------------------------------------------ auth pages */
.auth-wrap { display: grid; place-items: center; padding: clamp(32px, 6vw, 72px) 16px; }
.auth-card { width: 100%; max-width: 460px; }
.auth-card .card-body { padding: clamp(24px, 4vw, 36px); }
.auth-card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--muted); font-size: 0.93rem; }
.demo-note { margin-top: 18px; }

/* ------------------------------------------------------------------ portal (dashboards) */
.portal { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.portal-sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px 32px; position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; }
.portal-main { padding: clamp(20px, 3vw, 36px); min-width: 0; }
.portal-main > .messages:first-child { margin-top: 0; }
.side-section { margin-bottom: 20px; }
.side-title { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 0 12px; margin-bottom: 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; color: var(--ink-2); font-weight: 600; font-size: 0.93rem; }
.side-link .icon { width: 18px; height: 18px; color: var(--muted); }
.side-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side-link.is-active { background: var(--brand-soft); color: var(--brand-text); }
.side-link.is-active .icon { color: var(--brand-text); }
.side-link .count { margin-left: auto; background: var(--warm-soft); color: var(--warm-text); border-radius: 999px; font-size: 0.72rem; font-weight: 800; padding: 1px 8px; }
.sidebar-toggle { display: none; }
@media (max-width: 1000px) {
  .portal { grid-template-columns: 1fr; }
  .portal-sidebar { position: fixed; z-index: 70; left: 0; top: 0; height: 100vh; width: 280px; transform: translateX(-105%); transition: transform 0.22s; box-shadow: var(--shadow-lg); padding-top: 24px; }
  .portal-sidebar.is-open { transform: none; }
  .sidebar-toggle { display: inline-flex; margin-bottom: 16px; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(10, 10, 25, 0.45); z-index: 65; }
}
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; }
.page-head .lead, .page-head p { margin: 6px 0 0; color: var(--muted); font-size: 1rem; }
.panel-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .panel-grid { grid-template-columns: 1fr; } }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.list > li:last-child { border-bottom: 0; }
.continue-card { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; overflow: hidden; }
.continue-card .thumb { aspect-ratio: auto; min-height: 150px; }
.continue-card .card-body { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
@media (max-width: 640px) { .continue-card { grid-template-columns: 1fr; } .continue-card .thumb { min-height: 120px; } }
.enroll-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.enroll-row:last-child { border-bottom: 0; }
.enroll-row .thumb { border-radius: 10px; aspect-ratio: 16 / 10; }
.enroll-row .thumb-art .art-icon { font-size: 1.4rem; }
@media (max-width: 640px) { .enroll-row { grid-template-columns: 64px minmax(0, 1fr); } .enroll-row .row-action { grid-column: 1 / -1; } }

/* charts */
.bar-chart { display: grid; grid-template-rows: 1fr auto; gap: 8px; }
.bars { position: relative; height: 180px; display: flex; align-items: flex-end; gap: 2px; padding-top: 12px;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px); background-size: 100% 25%; background-position: 0 12px; }
.bar { position: relative; flex: 1; min-width: 4px; height: 100%; display: flex; align-items: flex-end; outline: none; }
.bar > span { display: block; width: 100%; background: var(--chart); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar.is-zero > span { background: var(--line-strong); }
.bar:hover > span, .bar:focus-visible > span { filter: brightness(1.15); }
.bar::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--ink); color: var(--surface); font-size: 0.75rem; font-weight: 600; padding: 5px 9px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity 0.12s; z-index: 5;
}
.bar:hover::after, .bar:focus-visible::after { opacity: 1; }
.bar-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); }
.hbar-list { display: grid; gap: 14px; list-style: none; margin: 0; padding: 0; }
.hbar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; margin-bottom: 6px; }
.hbar-label span:first-child { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-label span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.hbar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hbar > span { display: block; height: 100%; background: var(--chart); border-radius: 999px; min-width: 4px; }

/* ------------------------------------------------------------------ course detail */
.course-hero { background: linear-gradient(160deg, #1b1740, #2c2170 55%, #3a2a8f); color: #eceaff; padding-block: clamp(36px, 5vw, 64px); }
.course-hero h1 { color: #fff; }
.course-hero .lead { color: rgba(236, 234, 255, 0.85); }
.course-hero .meta { color: rgba(236, 234, 255, 0.8); }
.course-hero .breadcrumbs, .course-hero .breadcrumbs a { color: rgba(236, 234, 255, 0.75); }
.course-hero .badge { background: rgba(255, 255, 255, 0.12); color: #fff; }
.enroll-card { position: sticky; top: calc(var(--header-h) + 20px); overflow: hidden; }
.enroll-card .thumb { aspect-ratio: 16 / 9; }
.enroll-card .price-tag { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; }
.course-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 36px; align-items: start; }
.course-detail-grid .enroll-card { margin-top: -180px; }
@media (max-width: 960px) {
  .course-detail-grid { grid-template-columns: 1fr; }
  .course-detail-grid .enroll-card { margin-top: 0; position: static; order: -1; }
}
.curriculum { display: flex; flex-direction: column; gap: 10px; }
.module { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.module > summary { list-style: none; cursor: pointer; padding: 16px 20px; display: flex; align-items: center; gap: 12px; }
.module > summary::-webkit-details-marker { display: none; }
.module > summary .chev { transition: transform 0.2s; color: var(--muted); }
.module[open] > summary .chev { transform: rotate(90deg); }
.module-title { font-weight: 700; flex: 1; min-width: 0; }
.module-meta { font-size: 0.83rem; color: var(--muted); white-space: nowrap; }
.item-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.item-list li { border-bottom: 1px solid var(--line); }
.item-list li:last-child { border-bottom: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; color: var(--ink-2); font-size: 0.94rem; }
a.item:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.item .kind { color: var(--muted); }
.item .item-title { flex: 1; min-width: 0; }
.item .state { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.item.is-done .kind { color: var(--accent); }
.item.is-locked { opacity: 0.6; }
.item.is-current { background: var(--brand-soft); color: var(--brand-text); font-weight: 650; }
.status-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-grid; place-items: center; flex: none; }
.status-dot.done { background: var(--accent-bright); border-color: var(--accent-bright); color: #fff; }
.status-dot .icon { width: 13px; height: 13px; stroke-width: 3; }

/* ------------------------------------------------------------------ lesson player */
.player-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.player-sidebar { background: var(--surface); border-right: 1px solid var(--line); position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto; }
.player-sidebar .ps-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.player-sidebar .ps-head a { color: var(--ink); font-weight: 750; }
.player-sidebar .module { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.player-sidebar .module > summary { padding: 13px 18px; }
.player-sidebar .item { padding: 10px 18px; font-size: 0.9rem; }
.player-main { padding: clamp(16px, 3vw, 36px); min-width: 0; }
.player-inner { max-width: 960px; margin-inline: auto; }
@media (max-width: 1000px) {
  .player-layout { grid-template-columns: 1fr; }
  .player-sidebar { position: static; height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .player-sidebar .curriculum-wrap { display: none; }
  .player-sidebar.is-open .curriculum-wrap { display: block; }
}
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #0b0a17; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lesson-head { margin-block: 22px 18px; }
.lesson-head h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin-bottom: 8px; }
.lesson-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.complete-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); margin-top: 24px; }
.resource-list { display: grid; gap: 10px; }
.resource { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.resource .icon-wrap { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; flex: none; }

/* PDF viewer */
.pdf-viewer { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.pdf-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pdf-toolbar .pdf-page { font-size: 0.88rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: auto; }
.pdf-pages { max-height: 78vh; overflow: auto; scrollbar-gutter: stable; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; user-select: none; -webkit-user-select: none; }
.pdf-pages canvas { background: #fff; box-shadow: var(--shadow); border-radius: 4px; max-width: none; }
.pdf-pages .pdf-placeholder { background: #fff; box-shadow: var(--shadow); border-radius: 4px; }
.pdf-fallback { width: 100%; height: 78vh; border: 0; display: block; background: #fff; }
.pdf-status { padding: 40px; text-align: center; color: var(--muted); }
.protected-note { font-size: 0.82rem; color: var(--muted); display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; }
.protected-note > svg { flex: none; margin-top: 2px; }

/* ------------------------------------------------------------------ quiz */
.quiz-shell { max-width: 820px; margin-inline: auto; }
.quiz-top { position: sticky; top: var(--header-h); z-index: 20; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.quiz-timer { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.05rem; padding: 6px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); }
.quiz-timer.is-low { background: var(--danger-soft); color: var(--danger-text); }
.question { padding: 22px 24px; }
.question + .question { margin-top: 16px; }
.question-num { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--brand-text); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 10px; }
.question-text { font-size: 1.08rem; font-weight: 650; color: var(--ink); margin-bottom: 14px; white-space: pre-line; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1.5px solid var(--line-strong); border-radius: 12px; cursor: pointer; background: var(--surface); transition: border-color 0.12s, background 0.12s; }
.choice:hover { border-color: var(--brand); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice.is-correct { border-color: var(--accent-bright); background: var(--accent-soft); }
.choice.is-wrong { border-color: var(--danger); background: var(--danger-soft); }
.choice .choice-state { margin-left: auto; font-size: 0.8rem; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.choice.is-correct .choice-state { color: var(--accent); }
.choice.is-wrong .choice-state { color: var(--danger-text); }
.explanation { margin-top: 14px; padding: 12px 16px; border-radius: 10px; background: var(--info-soft); color: var(--info-text); font-size: 0.93rem; }
.result-hero { text-align: center; padding: 36px 24px; }
.score-ring { --pct: 0; --ring: var(--brand); width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--surface-3) 0); }
.score-ring > div { width: 118px; height: 118px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.score-ring.passed { --ring: var(--accent-bright); }
.score-ring.failed { --ring: var(--danger); }

/* ------------------------------------------------------------------ certificate */
.certificate-preview { position: relative; background: #fff; color: #15142b; border-radius: 16px; padding: clamp(24px, 5vw, 56px); box-shadow: var(--shadow-lg); border: 10px solid #f3f1ff; outline: 2px solid #5b45e0; outline-offset: -18px; text-align: center; overflow: hidden; }
.certificate-preview .cert-kicker { letter-spacing: 0.3em; font-size: 0.78rem; font-weight: 800; color: #5b45e0; text-transform: uppercase; }
.certificate-preview .cert-name { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; margin: 10px 0 4px; letter-spacing: -0.02em; color: #15142b; }
.certificate-preview .cert-course { font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 750; color: #4a36cc; }
.certificate-preview .cert-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 32px; text-align: left; flex-wrap: wrap; font-size: 0.9rem; color: #5b5b76; }
.certificate-preview .cert-meta strong { color: #15142b; display: block; }
.certificate-preview .cert-qr { width: 104px; height: 104px; image-rendering: pixelated; }
.certificate-preview.is-revoked::after { content: "REVOKED"; position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); font-size: clamp(3rem, 10vw, 6rem); font-weight: 900; color: rgba(217, 61, 66, 0.2); letter-spacing: 0.1em; }
.verify-result { display: flex; gap: 16px; align-items: flex-start; padding: 22px; border-radius: var(--radius); }
.verify-result.valid { background: var(--accent-soft); color: var(--accent); }
.verify-result.invalid { background: var(--danger-soft); color: var(--danger-text); }
.verify-result .icon { width: 32px; height: 32px; }
.verify-result h2 { color: inherit; margin-bottom: 4px; font-size: 1.3rem; }

/* ------------------------------------------------------------------ builder */
.builder-module { margin-bottom: 16px; }
.builder-module .card-head { background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.builder-item { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.builder-item:last-child { border-bottom: 0; }
.builder-item .kind { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.builder-item .kind.quiz { background: var(--warm-soft); color: var(--warm-text); }
.builder-item .kind.assignment { background: var(--info-soft); color: var(--info-text); }
.builder-item .item-main { flex: 1; min-width: 0; }
.builder-item .item-main a { font-weight: 650; color: var(--ink); }
.tool-row { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.choice-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.choice-row .check { white-space: nowrap; font-size: 0.88rem; }
.choice-row.is-removed { display: none; }
.question-card { padding: 16px 20px; display: flex; gap: 14px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.question-card:last-child { border-bottom: 0; }
.question-card .qnum { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-text); display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; flex: none; }
.answer-key { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.answer-key li { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.answer-key li.correct { color: var(--accent); font-weight: 650; }
.kind-panel { display: none; }
.kind-panel.is-visible { display: flex; }

/* ------------------------------------------------------------------ roles matrix */
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.yes { color: var(--accent); }
.no { color: var(--line-strong); }

/* ------------------------------------------------------------------ error pages */
.error-page { text-align: center; padding: clamp(60px, 10vw, 120px) 20px; }
.error-code { font-size: clamp(4rem, 12vw, 7rem); font-weight: 900; letter-spacing: -0.05em; line-height: 1; margin-bottom: 12px; }

@media print {
  .site-header, .site-footer, .portal-sidebar, .no-print, .messages { display: none !important; }
  body { background: #fff; }
  .portal { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Django radio/checkbox groups */
fieldset.field > div { display: flex; flex-wrap: wrap; gap: 10px 22px; }
fieldset.field > div > div { display: flex; }
fieldset.field > div label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.hidden-desktop { display: none; }
@media (max-width: 1000px) { .hidden-desktop { display: inline-flex; } }
.show-mobile { display: none !important; }
@media (max-width: 1060px) { .nav-links a.show-mobile { display: block !important; } }
@media (max-width: 1280px) { .portal-main .layout-aside { grid-template-columns: 1fr; } }
.hbar-list > li { min-width: 0; }
.hbar-label span:first-child { flex: 1 1 auto; min-width: 0; }
.alert .btn { text-decoration: none; }
.alert .btn-secondary { color: var(--ink); }
.panel-grid > *, .layout-aside > *, .grid > *, .course-detail-grid > *, .form-grid > * { min-width: 0; }

/* ------------------------------------------------------------------ pricing & checkout */
.price { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.price-now { font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.price-was { color: var(--muted); text-decoration: line-through; font-weight: 600; font-size: 0.9em; }
.price-lg .price-now { font-size: 2rem; }
.price-md .price-now { font-size: 1.35rem; }
.price-hint { font-size: 0.8rem; color: var(--muted); }
.save-badge { background: var(--danger-soft); color: var(--danger-text); }
.course-foot .price-now { color: var(--ink); font-size: 1rem; }
.pay-brand { width: 44px; height: 28px; flex: none; border-radius: 5px; display: inline-block; vertical-align: middle; }
.pay-brands { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.pay-group { margin-bottom: 14px; }
.pay-group-title { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.pay-method { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface); cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.pay-method:hover { border-color: var(--brand); }
.pay-method:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: var(--focus); }
.pay-method input { margin-top: 6px; }
.pay-method .pm-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pay-method .pm-label { font-weight: 700; color: var(--ink); }
.pay-method .pm-help { font-size: 0.82rem; color: var(--muted); line-height: 1.45; }
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.checkout-grid > * { min-width: 0; }
@media (max-width: 1000px) { .checkout-grid { grid-template-columns: 1fr; } .checkout-grid .summary-card { order: -1; } }
.summary-card { position: sticky; top: calc(var(--header-h) + 16px); }
.summary-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 0.95rem; }
.summary-rows li { display: flex; justify-content: space-between; gap: 12px; }
.summary-rows .discount { color: var(--accent); font-weight: 600; }
.summary-rows .total { border-top: 1px solid var(--line); padding-top: 12px; font-weight: 800; font-size: 1.15rem; color: var(--ink); }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input { text-transform: uppercase; }
.secure-note { display: flex; gap: 8px; align-items: flex-start; font-size: 0.82rem; color: var(--muted); }
.secure-note .icon { color: var(--accent); margin-top: 2px; }
.status-banner { display: flex; gap: 14px; align-items: center; padding: 18px 22px; border-radius: var(--radius); margin-bottom: 20px; }
.status-banner .icon { width: 28px; height: 28px; }
.status-banner h2 { margin: 0; font-size: 1.15rem; color: inherit; }
.status-banner p { margin: 2px 0 0; }
.status-paid { background: var(--accent-soft); color: var(--accent); }
.status-waiting { background: var(--warm-soft); color: var(--warm-text); }
.status-problem { background: var(--danger-soft); color: var(--danger-text); }
.status-neutral { background: var(--surface-2); color: var(--ink-2); }
.badge-paid, .badge-processing, .badge-printed, .badge-shipped, .badge-delivered, .badge-success { background: var(--accent-soft); color: var(--accent); }
.badge-verifying, .badge-pending_review, .badge-awaiting_payment, .badge-initiated { background: var(--warm-soft); color: var(--warm-text); }
.badge-refunded, .badge-rejected, .badge-cancelled { background: var(--surface-2); color: var(--muted); }
.wallet-steps { counter-reset: ws; list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.wallet-steps li { counter-increment: ws; display: flex; gap: 12px; align-items: flex-start; }
.wallet-steps li::before { content: counter(ws); width: 28px; height: 28px; border-radius: 9px; background: var(--brand); color: #fff; font-weight: 800; display: grid; place-items: center; flex: none; font-size: 0.85rem; }
.copy-value { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 2px 10px; }
.gateway-mock { max-width: 460px; margin: 40px auto; }
.gateway-mock .test-ribbon { background: repeating-linear-gradient(45deg, #ffe08a, #ffe08a 10px, #fff3c4 10px, #fff3c4 20px); color: #6b4d00; font-weight: 800; text-align: center; padding: 8px; border-radius: var(--radius) var(--radius) 0 0; letter-spacing: 0.08em; font-size: 0.8rem; }
.pricing-table .price-now { font-size: 1.15rem; }
.cert-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.cert-option { padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.cert-option.featured { border: 2px solid var(--brand); box-shadow: var(--shadow); }
.receipt-table { width: 100%; border-collapse: collapse; }
.receipt-table td { padding: 8px 0; border-bottom: 1px solid var(--line); }
.receipt-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.receipt-table tr.total td { font-weight: 800; font-size: 1.1rem; border-bottom: 0; }
@media print { .receipt-actions, .pay-again { display: none !important; } }
.thumb .thumb-sale { left: auto; right: 12px; background: #e5484d; color: #fff; }
@media (max-width: 1000px) { .checkout-grid .summary-card > .thumb { display: none; } }

/* ------------------------------------------------------------------ viewer watermark */
.wm-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.wm-tag {
  position: absolute; left: 0; top: 0; transform: translate(16px, 14px); display: inline-block; padding: 3px 9px; border-radius: 6px;
  font: 600 clamp(11px, 1.45vw, 15px)/1.35 var(--font); letter-spacing: 0.01em; color: #fff; white-space: nowrap;
  background: rgba(0, 0, 0, 0.28); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85); opacity: var(--wm-opacity, 55%);
  user-select: none; -webkit-user-select: none; transition: transform 1.4s ease-in-out;
}
.wm-fs {
  position: absolute; top: 10px; right: 10px; z-index: 4; display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 9px; border: 0; cursor: pointer; font: 600 0.78rem var(--font);
  color: #fff; background: rgba(10, 10, 25, 0.55); opacity: 0; transition: opacity 0.2s;
}
.wm-fs .icon { width: 15px; height: 15px; }
.video-frame:hover .wm-fs, .wm-fs:focus-visible, .video-frame:fullscreen .wm-fs { opacity: 1; }
.video-frame:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; border-radius: 0; }
.video-frame:fullscreen video { object-fit: contain; }
.video-frame:fullscreen .wm-tag { font-size: clamp(14px, 1.5vw, 22px); }
.wm-notice { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 24px; text-align: center; background: rgba(10, 10, 25, 0.92); color: #fff; }
.wm-notice strong { display: block; font-size: 1.1rem; margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .wm-tag { transition: none; } }
.wm-fs[hidden] { display: none; }

/* Bulk video upload */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 40px 20px; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.upload-list > li.upload-row { align-items: flex-start; }
.upload-row .badge { margin-top: 6px; white-space: nowrap; }
.upload-title { width: 100%; font: inherit; font-weight: 600; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); margin-bottom: 4px; }
.upload-title:focus { outline: none; border-color: var(--brand); }
