/* ==========================================================================
   House Of Hackers design system: "terminal"
   Phosphor green on near-black by default, with a daylight variant.
   Anonymous Pro (monospace) for headings and interface labels,
   Fira Sans for reading text, Bitter only on printed certificates.
   ========================================================================== */

@font-face { font-family: 'Anonymous Pro'; src: url('/assets/fonts/anonpro-regular.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Anonymous Pro'; src: url('/assets/fonts/anonpro-bold.woff') format('woff'); font-weight: 600 800; font-display: swap; }
@font-face { font-family: 'Bitter'; src: url('/assets/fonts/bitter-var.woff') format('woff'); font-weight: 300 800; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('/assets/fonts/fira-400.woff') format('woff'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('/assets/fonts/fira-400i.woff') format('woff'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('/assets/fonts/fira-500.woff') format('woff'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Fira Sans'; src: url('/assets/fonts/fira-600.woff') format('woff'); font-weight: 600 700; font-display: swap; }

/* Terminal (default) */
:root {
  color-scheme: dark;
  --paper: #050906;
  --surface: #0a120e;
  --surface-2: #0f1a15;
  --surface-3: #15241d;
  --line: #1a2b23;
  --line-strong: #2a4236;
  --ink: #d5f5e3;
  --ink-2: #9cc4ae;
  --ink-3: #6f9583;
  --prussian: #030604;
  --prussian-2: #0a140f;
  --prussian-ink: #d5f5e3;
  --link: #5cf5a5;
  --cursor: #39ff88;
  --cursor-ink: #02140a;
  --cursor-glow: rgba(57, 255, 136, 0.35);
  --primary-bg: #39ff88;
  --primary-bg-hover: #79ffb0;
  --primary-ink: #02140a;
  --ok: #4be38f; --ok-bg: #0b2416; --ok-mark: #2fd174;
  --warn: #ffc85a; --warn-bg: #261d08; --warn-mark: #f5b316;
  --serious: #ff9f66; --serious-bg: #2a170c; --serious-mark: #f0813e;
  --bad: #ff6b7a; --bad-bg: #2c0f14; --bad-mark: #f0475a;
  --info: #5ccfff; --info-bg: #08202c;
  --neutral-bg: #14201a; --neutral: #9cc4ae; --neutral-mark: #4f6d5f;
  --series-1: #43c9ff;
  --series-1-wash: rgba(67, 201, 255, 0.12);
  --grid: #14211b;
  --focus: 0 0 0 2px var(--paper), 0 0 0 4px var(--cursor);
  --radius-panel: 6px;
  --radius-control: 4px;
  --radius-small: 3px;
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --font-ui: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Anonymous Pro', ui-monospace, 'Cascadia Code', Consolas, 'DejaVu Sans Mono', monospace;
  --font-code: 'Anonymous Pro', ui-monospace, 'Cascadia Code', Consolas, 'DejaVu Sans Mono', monospace;
  --font-cert: 'Bitter', Georgia, 'Times New Roman', serif;
  --shadow-overlay: 0 0 0 1px rgba(57, 255, 136, 0.08), 0 18px 44px rgba(0, 0, 0, 0.65);
  --scanlines: repeating-linear-gradient(0deg, rgba(57, 255, 136, 0.022) 0 1px, transparent 1px 3px);
  --term-grid: linear-gradient(rgba(57, 255, 136, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(57, 255, 136, 0.05) 1px, transparent 1px);
}

/* Daylight: same system, for bright rooms and printing. The sidebar stays a terminal. */
:root[data-theme='light'] {
  color-scheme: light;
  --paper: #eef4f0;
  --surface: #ffffff;
  --surface-2: #e9f1ec;
  --surface-3: #dbe8e0;
  --line: #cfdfd5;
  --line-strong: #a9c3b4;
  --ink: #0b1d13;
  --ink-2: #355446;
  --ink-3: #4f6d5f;
  --link: #08703a;
  --primary-bg: #0a7d41;
  --primary-bg-hover: #086535;
  --primary-ink: #ffffff;
  --ok: #0b6b37; --ok-bg: #def3e6; --ok-mark: #13a454;
  --warn: #7f5200; --warn-bg: #fff1cf; --warn-mark: #e7a400;
  --serious: #94370f; --serious-bg: #fde6d9; --serious-mark: #e2723a;
  --bad: #b01c2c; --bad-bg: #fde8ea; --bad-mark: #d63649;
  --info: #0b5d86; --info-bg: #e1f2fb;
  --neutral-bg: #e6eee9; --neutral: #355446; --neutral-mark: #8aa597;
  --series-1: #0b78b8;
  --series-1-wash: rgba(11, 120, 184, 0.1);
  --grid: #e1ebe5;
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px #0a7d41;
  --shadow-overlay: 0 14px 36px rgba(6, 30, 18, 0.18), 0 2px 6px rgba(6, 30, 18, 0.08);
  --scanlines: none;
}

/* ───────────── Base ───────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image: var(--scanlines);
  background-attachment: fixed;
  font-feature-settings: 'kern', 'liga';
  overflow-wrap: anywhere;
}
::selection { background: var(--cursor); color: var(--cursor-ink); }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 30px; letter-spacing: -0.02em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; font-family: var(--font-ui); font-weight: 600; }
p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }
a { color: var(--link); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, kbd, pre { font-family: var(--font-code); font-size: 0.92em; }
code { background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 14px 16px; overflow-x: auto; white-space: pre; line-height: 1.5; }
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img, video, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
h1[tabindex='-1']:focus, h1[tabindex='-1']:focus-visible { box-shadow: none; outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.subtle { color: var(--ink-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--top { align-items: flex-start; }
.grow { flex: 1 1 auto; min-width: 0; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon--sm { width: 15px; height: 15px; }
.icon--lg { width: 22px; height: 22px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; } }

.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--cursor); color: var(--cursor-ink); padding: 10px 14px; border-radius: var(--radius-control); font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ───────────── App shell ───────────── */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background-color: #030604;
  background-image: var(--term-grid);
  background-size: 24px 24px;
  background-position: -1px -1px;
  border-right: 1px solid #1a2b23;
  color: #c3e8d3;
  display: flex; flex-direction: column;
  padding: 18px 14px 16px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #e9fff2; text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand__name { font-family: var(--font-head); font-weight: 700; font-size: 17px; line-height: 1.1; letter-spacing: 0.005em; }
.brand__name span { display: block; font-family: var(--font-code); font-weight: 400; font-size: 12.5px; color: #39ff88; letter-spacing: 0; }
.nav-group { margin-top: 14px; }
.nav-group__label { font-family: var(--font-code); font-size: 12.5px; color: #5f8a73; padding: 0 12px 6px; }
.nav-group__label::before { content: '// '; color: #39784f; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; border-radius: var(--radius-control);
  color: #b9dcc8; text-decoration: none; font-family: var(--font-code); font-weight: 400; font-size: 15px;
}
.nav-link:hover { background: rgba(57, 255, 136, 0.07); color: #e9fff2; }
.nav-link[aria-current='page'] { background: rgba(57, 255, 136, 0.11); color: #e9fff2; font-weight: 700; }
.nav-link[aria-current='page']::before { content: ''; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 4px; border-radius: 0 2px 2px 0; background: #39ff88; box-shadow: 0 0 10px rgba(57, 255, 136, 0.6); }
.nav-link .icon { color: #5f8a73; }
.nav-link[aria-current='page'] .icon { color: #39ff88; }
.nav-count { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; background: #39ff88; color: #02140a; font-size: 12px; font-weight: 600; text-align: center; line-height: 20px; }
.sidebar__foot { margin-top: auto; padding: 16px 10px 0; font-family: var(--font-code); font-size: 12.5px; color: #5f8a73; }
.sidebar__foot::before { content: '$ '; color: #39ff88; }
.sidebar .nav-link:focus-visible { box-shadow: 0 0 0 2px #030604, 0 0 0 4px #39ff88; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px; padding: 0 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__menu { display: none; }
.topbar__spacer { flex: 1; }
.topbar__role { font-size: 13px; color: var(--ink-3); margin-right: 6px; }
main { padding: 28px 32px 64px; width: 100%; max-width: 1280px; }
main:focus { box-shadow: none; }

@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-105%); transition: transform 0.2s ease; box-shadow: var(--shadow-overlay); }
  .app.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 55; }
  .topbar { padding: 0 12px; }
  .topbar__menu { display: inline-flex; }
  main { padding: 20px 16px 56px; }
  .topbar__role { display: none; }
}

/* ───────────── Buttons ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 14px; border-radius: var(--radius-control);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-family: var(--font-code); font-weight: 700; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; }
.btn--primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-ink); }
.btn--primary:hover { background: var(--primary-bg-hover); border-color: var(--primary-bg-hover); box-shadow: 0 0 18px var(--cursor-glow); }
:root[data-theme='light'] .btn--primary:hover { box-shadow: none; }
.btn--accent { background: var(--cursor); border-color: var(--cursor); color: var(--cursor-ink); font-weight: 700; }
.btn--accent:hover { background: #79ffb0; border-color: #79ffb0; box-shadow: 0 0 18px var(--cursor-glow); }
.btn--danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn--danger:hover { background: var(--bad-bg); }
.btn--danger-solid { background: #c4182c; border-color: #c4182c; color: #fff; }
.btn--danger-solid:hover { background: #a3101f; }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { min-height: 32px; padding: 4px 10px; font-size: 14px; }
.btn--icon { padding: 0; width: 38px; }
.btn--icon.btn--sm { width: 32px; }
.btn .spinner { width: 14px; height: 14px; }
.icon-btn { position: relative; }
.badge-dot { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e0283c; color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--paper); }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font: inherit; }

/* ───────────── Page header ───────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head__text { min-width: 0; max-width: 760px; }
.page-head h1 { margin-top: 2px; }
.page-head__sub { color: var(--ink-2); margin-top: 6px; font-size: 15.5px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: var(--ink-3); margin: 0; padding: 0; list-style: none; }
.crumbs li + li::before { content: '/'; margin-right: 6px; color: var(--line-strong); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.title-cursor { display: inline-block; width: 0.5em; height: 0.12em; background: var(--cursor); margin-left: 0.12em; vertical-align: 0.05em; border-radius: 1px; }

/* ───────────── Panels & layout ───────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 20px; min-width: 0; }
.panel--flush { padding: 0; overflow: hidden; }
.panel--quiet { background: transparent; border-style: dashed; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.panel--flush .panel__head { padding: 16px 20px 0; }
.panel__head h2 { font-size: 18px; }
.panel__head .muted { font-size: 13.5px; }
.panel__foot { border-top: 1px solid var(--line); padding: 12px 20px; font-size: 14px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.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; } .span-3 { grid-column: span 3; }
@media (max-width: 1100px) { .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; } .span-3 { grid-column: span 6; } }
@media (max-width: 560px) { .span-3 { grid-column: span 12; } }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }
.section-title { font-size: 18px; margin: 28px 0 12px; }

/* Lists with dividers */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list > li:last-child { padding-bottom: 0; }
.list-item { display: flex; gap: 12px; align-items: flex-start; }
.list-item__main { flex: 1; min-width: 0; }
.list-item__title { font-weight: 600; color: var(--ink); text-decoration: none; }
a.list-item__title:hover { text-decoration: underline; }
.list-item__meta { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.when { flex: none; width: 54px; text-align: center; border: 1px solid var(--line); border-radius: var(--radius-control); padding: 4px 0 5px; line-height: 1.15; background: var(--surface); }
.when__m { font-size: 11.5px; color: var(--ink-3); }
.when__d { font-family: var(--font-head); font-size: 20px; font-weight: 650; }
.when--today { border-color: var(--cursor); box-shadow: inset 0 3px 0 var(--cursor); }

/* ───────────── Stats ───────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; }
.stat { padding: 16px 20px; min-width: 0; box-shadow: -1px 0 0 var(--line), 0 -1px 0 var(--line); }
.stat__label { font-family: var(--font-code); font-size: 14px; color: var(--ink-2); }
.stat__value { font-family: var(--font-code); font-size: 30px; font-weight: 700; line-height: 1.15; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat__hint { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.stat__hint--bad { color: var(--bad); }
.stat__hint--ok { color: var(--ok); }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ───────────── Pills & badges ───────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 3px; font-family: var(--font-code); font-size: 13px; font-weight: 700; line-height: 20px; background: var(--neutral-bg); color: var(--neutral); white-space: nowrap; border: 1px solid transparent; }
.pill .icon { width: 13px; height: 13px; }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--serious { background: var(--serious-bg); color: var(--serious); }
.pill--bad { background: var(--bad-bg); color: var(--bad); }
.pill--info { background: var(--info-bg); color: var(--info); }
.pill--accent { background: var(--cursor); color: var(--cursor-ink); }
.pill--outline { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; color: #fff; background: var(--av, #4b5b78); letter-spacing: 0.02em; }
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }
.avatar--lg { width: 52px; height: 52px; font-size: 18px; }
.person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.person__text { min-width: 0; }
.person__name { font-weight: 500; color: var(--ink); text-decoration: none; display: block; }
a.person__name:hover { text-decoration: underline; }
.person__sub { font-size: 13px; color: var(--ink-3); display: block; }

/* ───────────── Progress ───────────── */
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter__fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--series-1); }
.meter__fill--ok { background: var(--ok-mark); }
.meter__fill--warn { background: var(--warn-mark); }
.meter__fill--bad { background: var(--bad-mark); }
.meter__fill--accent { background: var(--cursor); }
.meter__target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; opacity: 0.55; }
.meter-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.meter-row .meter { grid-column: 1 / -1; }
.meter-row__value { font-weight: 600; font-variant-numeric: tabular-nums; }

.req { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.req:first-child { border-top: 0; }
.req__mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; margin-top: 1px; }
.req__mark--met { background: var(--ok-bg); color: var(--ok); }
.req__mark--unmet { background: var(--surface-2); color: var(--ink-3); border: 1px dashed var(--line-strong); }
.req__mark .icon { width: 14px; height: 14px; stroke-width: 2.4; }

/* ───────────── Forms ───────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid, .form-grid--3 { grid-template-columns: minmax(0, 1fr); } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-family: var(--font-code); font-weight: 700; font-size: 14.5px; color: var(--ink); }
.field__label .opt { font-weight: 400; color: var(--ink-3); }
.field__hint { font-size: 13px; color: var(--ink-3); }
.field__error { font-size: 13px; color: var(--bad); display: flex; gap: 6px; align-items: flex-start; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.4; caret-color: var(--cursor);
}
:root[data-theme='light'] .input, :root[data-theme='light'] .select, :root[data-theme='light'] .textarea { background: var(--surface); caret-color: auto; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 0.85; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.textarea--code { font-family: var(--font-code); font-size: 13.5px; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: var(--focus); border-color: var(--cursor); border-radius: var(--radius-control); }
:root[data-theme='light'] .input:focus-visible, :root[data-theme='light'] .select:focus-visible, :root[data-theme='light'] .textarea:focus-visible { border-color: var(--primary-bg); }
.input[aria-invalid='true'], .select[aria-invalid='true'], .textarea[aria-invalid='true'] { border-color: var(--bad); }
.input--sm, .select--sm { min-height: 34px; padding: 5px 9px; font-size: 14px; }
.select--sm { padding-right: 30px; }
.input-group { display: flex; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--cursor); flex: none; }
:root[data-theme='light'] .check input { accent-color: var(--primary-bg); }
.check__text small { display: block; color: var(--ink-3); font-size: 13px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-panel); padding: 16px 18px 18px; margin: 0; min-width: 0; }
legend { font-family: var(--font-head); font-weight: 700; font-size: 16px; padding: 0 6px; margin-left: -6px; color: var(--ink); }
legend::before { content: '# '; color: var(--cursor); }
:root[data-theme='light'] legend::before { color: var(--primary-bg); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: var(--radius-control); padding: 10px 12px; font-size: 14px; display: flex; gap: 8px; }
.search { position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 36px; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-control); overflow: hidden; background: var(--surface); }
.segmented button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-size: 14px; color: var(--ink-2); border-left: 1px solid var(--line); min-height: 34px; }
.segmented button:first-child { border-left: 0; }
.segmented button[aria-pressed='true'] { background: var(--primary-bg); color: var(--primary-ink); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.filters .field { min-width: 140px; flex: 0 1 200px; }
.filters .field input[type='date'] { min-width: 0; }
.filters .field--grow { flex: 1 1 240px; }
.filters .field__label { font-size: 13px; color: var(--ink-2); }

/* ───────────── Tables ───────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-panel); }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table caption { text-align: left; padding: 0 0 10px; color: var(--ink-3); font-size: 13.5px; }
.table th { text-align: left; font-family: var(--font-code); font-weight: 700; font-size: 13.5px; color: var(--ink-2); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table td > .row { flex-wrap: nowrap; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { text-align: right; }
.table .sort-btn { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.table .sort-btn:focus-visible { box-shadow: var(--focus); border-radius: 4px; }
.panel--flush .table th:first-child, .panel--flush .table td:first-child { padding-left: 20px; }
.panel--flush .table th:last-child, .panel--flush .table td:last-child { padding-right: 20px; }
@media (max-width: 720px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table--cards td { border: 0; padding: 3px 0 !important; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table--cards td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: left; flex: none; max-width: 45%; }
  .table--cards td[data-primary] { display: block; text-align: left; font-weight: 500; padding-bottom: 6px !important; }
  .table--cards td[data-primary]::before { display: none; }
  .table--cards .num { text-align: right; }
}

/* ───────────── Tabs ───────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 10px 14px 12px; color: var(--ink-2); text-decoration: none; font-family: var(--font-code); font-weight: 400; white-space: nowrap; border: 0; background: none; cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--ink); }
.tab[aria-current='page'], .tab[aria-selected='true'] { color: var(--ink); }
.tab[aria-current='page'], .tab[aria-selected='true'] { font-weight: 700; }
.tab[aria-current='page']::after, .tab[aria-selected='true']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 2px 2px 0 0; background: var(--cursor); box-shadow: 0 0 10px var(--cursor-glow); }
.tab .count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ───────────── Feedback states ───────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty__icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--surface-2); color: var(--ink-3); }
.empty__title { font-family: var(--font-head); font-size: 17px; color: var(--ink); margin-bottom: 4px; }
.empty__body { max-width: 440px; margin: 0 auto 14px; font-size: 14.5px; }
.empty--compact { padding: 18px 8px; }
.empty--compact .empty__icon { display: none; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-control); background: var(--info-bg); color: var(--ink); font-size: 14.5px; border-left: 4px solid var(--info); }
.notice > .icon { color: var(--info); margin-top: 2px; }
.notice--warn { background: var(--warn-bg); border-left-color: var(--warn-mark); }
.notice--warn > .icon { color: var(--warn); }
.notice--bad { background: var(--bad-bg); border-left-color: var(--bad); }
.notice--bad > .icon { color: var(--bad); }
.notice--ok { background: var(--ok-bg); border-left-color: var(--ok); }
.notice--ok > .icon { color: var(--ok); }
.notice__body { flex: 1; min-width: 0; }
.notice__title { font-weight: 600; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton--title { height: 30px; width: 40%; margin-bottom: 24px; }
.skeleton--block { height: 120px; border-radius: var(--radius-panel); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── Toasts ───────────── */
.toasts { position: fixed; z-index: 120; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-control); background: #030604; color: #d5f5e3; border: 1px solid #2a4236; border-left: 3px solid #39ff88; box-shadow: var(--shadow-overlay); font-size: 14.5px; font-family: var(--font-code); animation: toast-in 0.18s ease-out; }
.toast .icon { margin-top: 2px; }
.toast--ok .icon { color: #4be38f; }
.toast--bad { border-left-color: #ff6b7a; }
.toast--bad .icon { color: #ff6b7a; }
.toast button { margin-left: auto; color: inherit; opacity: 0.7; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ───────────── Dialog ───────────── */
dialog.modal { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-overlay); }
dialog.modal--wide { width: min(820px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.7); }
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal__head h2 { font-size: 19px; }
.modal__body { padding: 14px 20px 4px; overflow-y: auto; max-height: calc(100vh - 200px); }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px 18px; flex-wrap: wrap; }

/* ───────────── Popover menus ───────────── */
.popover { position: absolute; z-index: 40; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-overlay); padding: 6px; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink); text-decoration: none; font-size: 14.5px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); box-shadow: none; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.notif-pop { width: min(380px, calc(100vw - 24px)); padding: 0; right: 0; top: calc(100% + 6px); }
.notif-pop__head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 420px; overflow-y: auto; list-style: none; margin: 0; padding: 0; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.notif:hover { background: var(--surface-2); }
.notif--unread { background: color-mix(in srgb, var(--cursor) 9%, var(--surface)); }
.notif__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: transparent; }
.notif--unread .notif__dot { background: var(--cursor); box-shadow: 0 0 6px var(--cursor-glow); }
.notif__title { font-weight: 500; font-size: 14.5px; }
.notif__body { font-size: 13.5px; color: var(--ink-2); }
.notif__time { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ───────────── Domain pieces ───────────── */
.class-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; }
.class-card:hover { border-color: var(--line-strong); }
.class-card:hover .class-card__title { text-decoration: underline; }
.class-card__course { font-size: 13.5px; color: var(--ink-3); }
.class-card__title { font-family: var(--font-head); font-size: 18px; font-weight: 650; color: var(--ink); }
.class-card__next { background: var(--surface-2); border-radius: var(--radius-control); padding: 10px 12px; font-size: 14px; }
.class-card__foot { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); margin-top: auto; }

.status-pill--present { background: var(--ok-bg); color: var(--ok); }
.status-pill--late { background: var(--warn-bg); color: var(--warn); }
.status-pill--partial { background: var(--serious-bg); color: var(--serious); }
.status-pill--absent { background: var(--bad-bg); color: var(--bad); }
.status-pill--excused { background: var(--neutral-bg); color: var(--neutral); }
.status-pill--none { background: transparent; color: var(--ink-3); border: 1px dashed var(--line-strong); }

.att-picker { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-control); overflow: hidden; background: var(--surface); }
.att-picker button { border: 0; border-left: 1px solid var(--line); background: transparent; min-width: 64px; min-height: 36px; padding: 4px 10px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.att-picker button:first-child { border-left: 0; }
.att-picker button[aria-pressed='true'][data-status='present'] { background: var(--ok-bg); color: var(--ok); font-weight: 600; box-shadow: inset 0 -3px 0 var(--ok-mark); }
.att-picker button[aria-pressed='true'][data-status='late'] { background: var(--warn-bg); color: var(--warn); font-weight: 600; box-shadow: inset 0 -3px 0 var(--warn-mark); }
.att-picker button[aria-pressed='true'][data-status='partial'] { background: var(--serious-bg); color: var(--serious); font-weight: 600; box-shadow: inset 0 -3px 0 var(--serious-mark); }
.att-picker button[aria-pressed='true'][data-status='absent'] { background: var(--bad-bg); color: var(--bad); font-weight: 600; box-shadow: inset 0 -3px 0 var(--bad-mark); }
.att-picker button[aria-pressed='true'][data-status='excused'] { background: var(--neutral-bg); color: var(--neutral); font-weight: 600; box-shadow: inset 0 -3px 0 var(--neutral-mark); }
.att-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 10px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.att-row:first-child { border-top: 0; }
.att-row__extra { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 760px) { .att-row { grid-template-columns: minmax(0, 1fr); } .att-picker { width: 100%; } .att-picker button { flex: 1; min-width: 0; padding: 4px 4px; } }

.matrix { border-collapse: separate; border-spacing: 3px; font-size: 13px; }
.matrix th { font-weight: 500; color: var(--ink-2); text-align: left; padding: 2px 8px 2px 0; white-space: nowrap; }
.matrix thead th { writing-mode: vertical-rl; transform: rotate(180deg); padding: 6px 0; height: 120px; vertical-align: bottom; font-size: 12.5px; text-align: left; }
.matrix td { width: 30px; height: 30px; text-align: center; border-radius: 6px; font-weight: 600; font-size: 12px; }
.cell--present { background: var(--ok-bg); color: var(--ok); }
.cell--late { background: var(--warn-bg); color: var(--warn); }
.cell--partial { background: var(--serious-bg); color: var(--serious); }
.cell--absent { background: var(--bad-bg); color: var(--bad); }
.cell--excused { background: var(--neutral-bg); color: var(--neutral); }
.cell--none { background: transparent; color: var(--ink-3); border: 1px dashed var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 18px; border-radius: 4px; display: inline-grid; place-items: center; font-style: normal; font-weight: 600; font-size: 11px; }

.code-display { font-family: var(--font-code); font-size: 40px; letter-spacing: 0.18em; font-weight: 700; padding: 14px 18px; border-radius: var(--radius-panel); background: #030604; color: #39ff88; text-align: center; border: 1px solid #2a4236; text-shadow: 0 0 12px rgba(57, 255, 136, 0.55); }

/* Quiz */
.rules { list-style: none; padding: 0; margin: 0; }
.rules li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.rules li:first-child { border-top: 0; }
.rules .icon { color: var(--ink-3); margin-top: 3px; }
.rules li[data-key='negative'] .icon, .rules li[data-key='floor'] .icon { color: var(--serious); }
.question { border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); padding: 18px 20px; }
.question__head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; flex-wrap: wrap; }
.question__num { font-family: var(--font-head); font-weight: 650; }
.question__meta { font-size: 13px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.question__prompt { font-size: 16px; white-space: pre-wrap; margin-bottom: 14px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); cursor: pointer; margin-bottom: 8px; background: var(--surface); }
.option:hover { border-color: var(--ink-3); }
.option input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--cursor); flex: none; }
:root[data-theme='light'] .option input { accent-color: var(--primary-bg); }
.option:has(input:checked) { border-color: var(--primary-bg); box-shadow: inset 0 0 0 1px var(--primary-bg); background: color-mix(in srgb, var(--primary-bg) 7%, var(--surface)); }
.option:has(input:focus-visible) { box-shadow: var(--focus); }
.option--correct { border-color: var(--ok) !important; background: var(--ok-bg) !important; }
.option--wrong { border-color: var(--bad) !important; background: var(--bad-bg) !important; }
.option__tag { margin-left: auto; font-size: 12.5px; font-weight: 600; }
.match-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.match-row:first-child { border-top: 0; }
@media (max-width: 600px) { .match-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } }
.hint-box { background: var(--warn-bg); border-radius: var(--radius-control); padding: 10px 12px; font-size: 14.5px; margin-top: 10px; }
.result-line { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.explanation { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-control); font-size: 14.5px; }
.quiz-bar { position: sticky; top: var(--topbar-h); z-index: 15; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; margin: -8px 0 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-panel); }
.timer { font-family: var(--font-code); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; padding: 2px 10px; border-radius: 6px; background: var(--surface-2); }
.timer--low { background: var(--bad-bg); color: var(--bad); }
.qnav { display: flex; flex-wrap: wrap; gap: 6px; }
.qnav a { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.qnav a[data-answered='true'] { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-ink); }
.score-hero { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.score-hero__num { font-family: var(--font-head); font-size: 52px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.score-hero__num small { font-size: 22px; color: var(--ink-3); font-weight: 500; }
.editor-q { border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.editor-q__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-panel) var(--radius-panel) 0 0; flex-wrap: wrap; }
.editor-q__head .select { width: auto; min-width: 190px; }
.editor-q__body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.opt-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }

/* Media */
.player { background: #000; border-radius: var(--radius-panel); overflow: hidden; }
.player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.player-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-panel) var(--radius-panel); }
.chapters { list-style: none; margin: 0; padding: 0; }
.chapters button { all: unset; box-sizing: border-box; display: flex; gap: 12px; width: 100%; padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: 14.5px; }
.chapters button:hover { background: var(--surface-2); }
.chapters button:focus-visible { box-shadow: var(--focus); }
.chapters button[aria-current='true'] { background: color-mix(in srgb, var(--cursor) 18%, var(--surface)); font-weight: 600; }
.chapters time { font-family: var(--font-code); font-size: 13px; color: var(--ink-3); min-width: 44px; }
.transcript { max-height: 360px; overflow-y: auto; font-size: 14.5px; line-height: 1.65; color: var(--ink-2); padding-right: 6px; }
.transcript p { margin-bottom: 8px; }
.transcript mark { background: color-mix(in srgb, var(--cursor) 40%, transparent); color: inherit; border-radius: 3px; }
.preview-frame { width: 100%; height: 72vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface-2); }
.preview-img { max-height: 72vh; border-radius: var(--radius-panel); border: 1px solid var(--line); }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); text-decoration: none; color: var(--ink); font-size: 14px; max-width: 100%; }
.file-chip:hover { border-color: var(--line-strong); text-decoration: none; }
.kind-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.kind-icon--slides { background: #261d08; color: #ffc85a; }
.kind-icon--notes { background: #08202c; color: #5ccfff; }
.kind-icon--link { background: #0b2416; color: #4be38f; }
.kind-icon--reading { background: #1d1530; color: #c6b4ff; }
.kind-icon--file { background: #14201a; color: #9cc4ae; }
.kind-icon--video { background: #030604; color: #39ff88; box-shadow: inset 0 0 0 1px #2a4236; }
:root[data-theme='light'] .kind-icon--slides { background: #fff1cf; color: #7f5200; }
:root[data-theme='light'] .kind-icon--notes { background: #e1f2fb; color: #0b5d86; }
:root[data-theme='light'] .kind-icon--link { background: #def3e6; color: #0b6b37; }
:root[data-theme='light'] .kind-icon--reading { background: #efe9fd; color: #5b3fc4; }
:root[data-theme='light'] .kind-icon--file { background: #e6eee9; color: #355446; }

/* Markdown content */
.prose { font-size: 15.5px; line-height: 1.65; max-width: 72ch; }
.prose h2 { font-size: 19px; margin: 1.4em 0 0.5em; }
.prose h3 { font-size: 16.5px; margin: 1.2em 0 0.4em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 0.9em; }
.prose li { margin-bottom: 0.3em; }
.prose pre { margin: 0 0 1em; }

/* Badges */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.badge-card { text-align: center; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.badge-card--locked { opacity: 0.6; border-style: dashed; }
.badge-card--locked .medal { filter: grayscale(1); }
.badge-card__name { font-weight: 600; margin-top: 8px; }
.badge-card__rule { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.medal { width: 56px; height: 56px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--medal-bg); color: var(--medal-ink); box-shadow: inset 0 0 0 3px var(--medal-ring); }
.medal .icon { width: 26px; height: 26px; stroke-width: 2; }
.medal--sm { width: 36px; height: 36px; box-shadow: inset 0 0 0 2px var(--medal-ring); }
.medal--sm .icon { width: 17px; height: 17px; }
.medal--gold { --medal-bg: #241b05; --medal-ink: #ffcf5c; --medal-ring: #d9a520; }
.medal--teal { --medal-bg: #062420; --medal-ink: #4fe0bd; --medal-ring: #23a687; }
.medal--violet { --medal-bg: #1b1430; --medal-ink: #c3b1ff; --medal-ring: #8d74f0; }
.medal--coral { --medal-bg: #2a130b; --medal-ink: #ffa47c; --medal-ring: #e27448; }
.medal--sky { --medal-bg: #071d2a; --medal-ink: #7fd6ff; --medal-ring: #3aa6dc; }
.medal--lime { --medal-bg: #0b2410; --medal-ink: #7dff9f; --medal-ring: #39d36a; }
:root[data-theme='light'] .medal--gold { --medal-bg: #fff3d0; --medal-ink: #7a4d00; --medal-ring: #e7a400; }
:root[data-theme='light'] .medal--teal { --medal-bg: #dff5ef; --medal-ink: #0d6b52; --medal-ring: #4fc3a1; }
:root[data-theme='light'] .medal--violet { --medal-bg: #eee9fd; --medal-ink: #4e35b8; --medal-ring: #9d8af0; }
:root[data-theme='light'] .medal--coral { --medal-bg: #fde7df; --medal-ink: #9a3a12; --medal-ring: #f0936b; }
:root[data-theme='light'] .medal--sky { --medal-bg: #e3effd; --medal-ink: #1f56b8; --medal-ring: #6da7ec; }
:root[data-theme='light'] .medal--lime { --medal-bg: #e2f6e4; --medal-ink: #20662f; --medal-ring: #4fbf63; }

.cert-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: linear-gradient(135deg, color-mix(in srgb, var(--cursor) 10%, var(--surface)), var(--surface) 60%); }
.cert-card__seal { width: 44px; height: 44px; border-radius: 50%; background: #030604; color: #39ff88; display: grid; place-items: center; flex: none; box-shadow: inset 0 0 0 1px #2a4236; }

/* Threads */
.post { display: flex; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.post:first-child { border-top: 0; }
.post__body { white-space: pre-wrap; margin-top: 4px; }
.post--answer { background: var(--ok-bg); border-radius: var(--radius-panel); padding: 14px; border: 0; margin: 8px 0; }
.post--pending, .post--hidden { opacity: 0.85; }
.post--hidden .post__body { color: var(--ink-3); font-style: italic; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; background: var(--surface); }
.cal__dow { padding: 8px 10px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal__day { min-height: 112px; padding: 6px 6px 8px; border-left: 1px solid var(--line); border-top: 1px solid var(--line); min-width: 0; }
.cal__day:nth-child(7n + 1) { border-left: 0; }
.cal__day--out { background: color-mix(in srgb, var(--surface-2) 50%, var(--surface)); }
.cal__day--out .cal__num { color: var(--ink-3); }
.cal__num { font-size: 13px; font-weight: 600; padding: 2px 6px; display: inline-block; border-radius: 6px; font-variant-numeric: tabular-nums; }
.cal__day--today .cal__num { background: var(--cursor); color: var(--cursor-ink); }
.cal__ev { display: block; font-size: 12.5px; line-height: 1.3; padding: 3px 6px; margin-top: 3px; border-radius: 5px; text-decoration: none; color: var(--ink); background: var(--info-bg); border-left: 3px solid var(--series-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal__ev--quiz { background: var(--warn-bg); border-left-color: var(--warn-mark); }
.cal__ev--task { background: var(--neutral-bg); border-left-color: var(--neutral-mark); }
.cal__ev--cancelled { text-decoration: line-through; opacity: 0.7; }
.cal__ev:hover { filter: brightness(0.97); }
@media (max-width: 760px) { .cal-month { display: none; } }
@media (min-width: 761px) { .cal-agenda--mobile { display: none; } }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-size: 12px; font-family: var(--font-ui); }
.chart .bar { fill: var(--series-1); }
.chart .bar:hover, .chart .bar.is-active { fill: color-mix(in srgb, var(--series-1) 80%, white); }
.chart .line { stroke: var(--series-1); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-1-wash); }
.chart .marker { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .value-label { fill: var(--ink-2); font-size: 12px; font-weight: 600; font-family: var(--font-ui); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus-visible { outline: none; stroke: var(--ink); stroke-width: 1.5; }
.chart .threshold { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: none; opacity: 0.8; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-overlay); border-radius: 8px; padding: 7px 10px; font-size: 13px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.chart-tip strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.chart-tip span { color: var(--ink-3); }
.chart-table { margin-top: 8px; font-size: 13.5px; }
.chart-table summary { cursor: pointer; color: var(--link); }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); }
.auth__art {
  background-color: #030604;
  background-image: var(--scanlines), var(--term-grid);
  background-size: auto, 32px 32px, 32px 32px; color: #c3e8d3; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid #1a2b23;
}
.auth__art h1 { color: #e9fff2; font-size: 46px; max-width: 15ch; line-height: 1.05; }
.auth__art p { color: #9cc4ae; font-size: 17px; max-width: 46ch; }
.auth__art .auth__prompt { font-family: var(--font-code); color: #39ff88; font-size: 16px; text-shadow: 0 0 10px rgba(57, 255, 136, 0.45); }
.auth__art .auth__foot { color: #6f9583; font-family: var(--font-code); }
.auth__panel { background: var(--surface); padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.auth__panel h2 { font-size: 26px; margin-bottom: 6px; }
/* The team door wears amber so it never gets mistaken for the student portal. */
.auth--staff .auth__art .auth__prompt { color: #ffc85a; text-shadow: 0 0 10px rgba(255, 200, 90, 0.4); }
.auth__badge { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 14px; padding: 3px 9px; border: 1px solid var(--warn-mark); border-radius: var(--radius-small); color: var(--warn); background: var(--warn-bg); font-family: var(--font-head); font-size: 13px; font-weight: 700; }
.auth__switch { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px; color: var(--ink-2); }
/* Honeypot: off-screen for people, still in the form for bots. */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.demo-box { margin-top: 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius-panel); padding: 14px 16px; font-size: 14px; }
.demo-box button { all: unset; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; width: 100%; box-sizing: border-box; padding: 7px 8px; border-radius: 6px; }
.demo-box button:hover { background: var(--surface-2); }
.demo-box button:focus-visible { box-shadow: var(--focus); }
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth__art { padding: 28px 24px; } .auth__art h1 { font-size: 30px; } .auth__art .auth__foot { display: none; } .auth__panel { padding: 28px 22px 48px; } }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13.5px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 2px; display: grid; place-items: center; border-radius: 50%; }
.chip button:hover { background: var(--surface-3); color: var(--ink); }
.picker-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-control); }
.picker-list label { display: flex; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; align-items: center; }
.picker-list label:first-child { border-top: 0; }
.picker-list label:hover { background: var(--surface-2); }
.flag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.audit-details { font-family: var(--font-code); font-size: 12.5px; white-space: pre-wrap; background: var(--surface-2); border-radius: 6px; padding: 8px 10px; margin-top: 6px; max-height: 220px; overflow: auto; }

@media print {
  .sidebar, .topbar, .page-head__actions, .tabs, .toasts, .no-print { display: none !important; }
  .app { display: block; }
  main { padding: 0; }
  .panel { break-inside: avoid; }
}

/* ───────────── Community links (sign-in page, sidebar) ───────────── */
.auth__home { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; margin: 0 0 28px -6px; padding: 4px 6px; border-radius: var(--radius-small); color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; }
.auth__home:hover { color: var(--ink); background: var(--surface-2); }
.community-box { margin-top: 24px; padding: 16px 18px; border-radius: var(--radius-panel); background: var(--surface-2); }
.community-box h3 { font-size: 16px; margin-bottom: 4px; }
.community-box p { font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.community-box__links { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.community-box__links a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.community-box__links a:hover { color: var(--ink); }
.nav-group--community { margin-top: 18px; padding-top: 12px; border-top: 1px solid #1a2b23; }
.community-nav { list-style: none; margin: 0; padding: 0; }
.community-nav .nav-link { font-size: 14px; padding-block: 6px; }
.nav-link .nav-link__ext { margin-left: auto; width: 14px; height: 14px; opacity: 0.55; }

/* ───────────── Terminal details ───────────── */
* { scrollbar-color: var(--line-strong) transparent; }
code { color: var(--link); }
.prose a, .notice a { text-decoration-thickness: 1px; }
.topbar__role { font-family: var(--font-code); }
.topbar__role::before { content: '['; color: var(--ink-3); }
.topbar__role::after { content: ']'; color: var(--ink-3); }

/* Page titles read like a prompt: "> Dashboard█" */
.page-head h1::before { content: '>'; content: '>' / ''; color: var(--cursor); margin-right: 0.4em; text-shadow: 0 0 14px var(--cursor-glow); }
.page-head h1::after { content: ''; display: inline-block; width: 0.5em; height: 0.92em; margin-left: 0.2em; vertical-align: -0.1em; background: var(--cursor); animation: caret-blink 1.1s steps(1) infinite; }
:root[data-theme='light'] .page-head h1::before { color: var(--primary-bg); text-shadow: none; }
:root[data-theme='light'] .page-head h1::after { background: var(--primary-bg); }
@keyframes caret-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .page-head h1::after { animation: none; } }

.panel { box-shadow: inset 0 1px 0 rgba(57, 255, 136, 0.05); }
.panel__head h2::before { content: '#'; content: '#' / ''; color: var(--ink-3); margin-right: 0.45em; font-weight: 400; }
.crumbs { font-family: var(--font-code); }
.class-card:hover { border-color: color-mix(in srgb, var(--cursor) 45%, var(--line)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--cursor) 25%, transparent); }
:root[data-theme='light'] .class-card:hover { border-color: var(--line-strong); box-shadow: none; }
.menu-item, .notif__title, .modal__head h2 { font-family: var(--font-code); }
.modal__head h2 { font-weight: 700; }
.empty__icon { color: var(--cursor); background: var(--surface-2); border: 1px dashed var(--line-strong); }
:root[data-theme='light'] .empty__icon { color: var(--primary-bg); }
.timer { color: var(--cursor); }
:root[data-theme='light'] .timer { color: var(--primary-bg); }
.timer--low { color: var(--bad); }
@media (max-width: 640px) {
  h1 { font-size: 25px; }
  .page-head h1::after { display: none; }
}
/* appended responsive polish */
@media (max-width: 720px) {
  .topbar__spacer { display: none; }
  .topbar input[type= search] { width: 120px !important; }
  .table-wrap, .matrix-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.matrix { font-size: 12px; }
  .grid { grid-template-columns: 1fr !important; }
  .span-4, .span-5, .span-6, .span-7, .span-8, .span-12 { grid-column: 1 / -1 !important; }
  .form-grid { grid-template-columns: 1fr !important; }
  .cards { grid-template-columns: 1fr !important; }
}
@media (max-width: 480px) {
  .topbar__role { display: none; }
  .vbtn { min-height: 36px; padding: 6px 12px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
/* Deep mobile UX: quiz taking, attendance matrix, grading */
@media (max-width: 720px) {
  .attempt__grid, .split { grid-template-columns: 1fr !important; }
  .question { padding: 12px !important; }
  .matrix { display: block; overflow-x: auto; }
  .matrix thead th:first-child, .matrix tbody th { position: sticky; left: 0; background: var(--t-surface); z-index: 2; }
  .grading-card .row { flex-wrap: wrap; }
  .grading-card input, .grading-card select { width: 100% !important; max-width: none !important; }
  .cal-month { font-size: 12px; }
  .topbar__role { display: none; }
}
@media (max-width: 480px) {
  .certificate { padding: 10px; }
  .verify-main { padding: 16px 12px 32px; }
  .vbtn { width: 100%; justify-content: center; }
}
/* Accessibility: visible focus rings */
:focus-visible { outline: 2px solid var(--brand, #3b82f6); outline-offset: 2px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: 0 0 0 2px var(--t-bg, #020617), 0 0 0 4px var(--brand, #3b82f6); }
.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; }
/* Touch-first mobile UX */
@media (max-width: 720px) {
  .btn, .vbtn { min-height: 44px; padding: 10px 14px; font-size: 15px; }
  .input, .select, textarea { font-size: 16px; min-height: 44px; }
  .matrix th, .matrix td { padding: 6px 4px; }
  .quiz__question { padding: 14px; }
  .attempt__nav { position: sticky; bottom: 0; background: var(--t-surface); padding: 8px; }
  .grading-card { padding: 12px; }
}
@media (max-width: 480px) {
  .topbar { padding: 8px 10px; }
  .sidebar { width: 85vw; }
  .modal { width: 96vw; }
}
