/* Valus design system.
   Soft Gen X club: porcelain + graphite neutrals, one signal red, frosted materials,
   transit-signage labels, hairline structure, generous negative space. */

:root {
  --font-display: 'Geist', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Geist', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-button: var(--font-mono);
  --font-tech: var(--font-display);

  --bg: #f3f3f1;
  --bg-deep: #e9eae9;
  --surface: #ffffff;
  --surface-2: #f7f7f6;
  --surface-3: #eeefee;
  --ink: #111214;
  --ink-2: #393b40;
  --muted: #73767c;
  --line: rgba(17, 18, 20, .09);
  --line-strong: rgba(17, 18, 20, .18);
  --red: #c81d3a;
  --red-hover: #b01530;
  --red-edge: #8a0f25;
  --red-soft: #f8e7ea;
  --red-ink: #b3122f;
  --on-red: #fff;
  --ok: #2c7a56;
  --ok-soft: #e3f1e9;
  --warn: #93560b;
  --warn-soft: #f8eedc;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .8);
  --glass-line: rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(17, 18, 20, .04), 0 18px 40px -24px rgba(17, 18, 20, .22);
  --ease: cubic-bezier(.2, .7, .1, 1);
  --radius: 18px;
  --radius-sm: 10px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d0e10;
  --bg-deep: #08090a;
  --surface: #15171a;
  --surface-2: #1b1d21;
  --surface-3: #25282d;
  --ink: #f2f2f0;
  --ink-2: #c8cacd;
  --muted: #8a8e95;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --red: #e8344f;
  --red-hover: #f04a63;
  --red-edge: #8c1630;
  --red-soft: rgba(232, 52, 79, .13);
  --red-ink: #ff6f86;
  --on-red: #fff;
  --ok: #6fcf9e;
  --ok-soft: rgba(111, 207, 158, .12);
  --warn: #f0b765;
  --warn-soft: rgba(240, 183, 101, .12);
  --glass: rgba(21, 23, 26, .6);
  --glass-strong: rgba(21, 23, 26, .8);
  --glass-line: rgba(255, 255, 255, .1);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -24px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--font-body);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 500; letter-spacing: -.035em; line-height: 1.05; }
p { margin: 0; }
em { font-style: normal; color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--red); color: #fff; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; }
.skip:focus { top: 12px; }

.icon { width: 18px; height: 18px; flex: none; }

/* ---------- Type helpers ---------- */
.eyebrow, .micro {
  font: 500 11px/1.4 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow i { display: none; }
.micro { font-size: 10.5px; }
.subtle { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.subtle .icon { width: 15px; height: 15px; }
.badge {
  display: inline-flex; align-items: center;
  font: 500 10px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 99px;
  background: var(--red-soft); color: var(--red-ink);
}
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--ink); color: var(--bg);
  font: 500 12px/1 var(--font-mono); letter-spacing: .02em;
}

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.brand-mark { width: 18px; height: 27px; }
.wordmark { width: 84px; height: 24px; color: var(--ink); }

/* ---------- Buttons ----------
   Pill-shaped, solid, set in Geist Mono like transit signage. A thin inner highlight gives
   the soft frosted-plastic edge; the arrow cell slides on hover. */
.button {
  --b-bg: var(--red); --b-ink: var(--on-red); --b-line: transparent; --b-hover: var(--red-hover);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 14px;
  min-height: 46px; padding: 0 22px;
  border-radius: 999px;
  background: var(--b-bg);
  color: var(--b-ink);
  border: 1px solid var(--b-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(17, 18, 20, .08);
  font: 500 11.5px/1 var(--font-button);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease);
}
.button:has(.button-tail) { padding: 0 6px 0 22px; }
.button-tail {
  display: grid; place-items: center; overflow: hidden;
  width: 34px; height: 34px; border-radius: 50%;
  background: color-mix(in srgb, var(--b-ink) 14%, transparent);
}
.button-tail .icon { width: 15px; height: 15px; transition: transform .45s var(--ease); }
.button:hover { background: var(--b-hover); }
.button:hover .button-tail .icon { animation: arrow-pass .55s var(--ease); }
@keyframes arrow-pass { 0% { transform: none; } 49% { transform: translateX(140%); } 50% { transform: translateX(-140%); } 100% { transform: none; } }
.button:active { transform: scale(.98); }
.button.secondary { --b-bg: transparent; --b-ink: var(--ink); --b-line: var(--line-strong); --b-hover: var(--surface); box-shadow: none; }
.button.secondary .button-tail { background: var(--surface-3); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.icon-button {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid var(--line-strong); color: var(--ink);
  transition: background-color .3s var(--ease);
}
.icon-button .icon { width: 16px; height: 16px; }
.icon-button:hover { background: var(--surface); }
.text-button { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.text-button:hover { color: var(--red); }
.editorial-link {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 11.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 8px;
  background: linear-gradient(var(--red), var(--red)) left bottom / 100% 1px no-repeat;
  transition: background-size .5s var(--ease), color .3s;
}
.editorial-link:hover { color: var(--red); }
.editorial-link .icon { width: 14px; height: 14px; transition: transform .4s var(--ease); }
.editorial-link:hover .icon { transform: translateX(4px); }

/* ---------- Catalog & start pages ---------- */
.catalog, .start-page { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 150px 0 80px; }
.catalog-toolbar { display: flex; gap: 14px; flex-wrap: wrap; margin: 36px 0 24px; }
.search-field {
  flex: 1 1 280px; display: flex; align-items: center; gap: 10px;
  min-height: 46px; padding: 0 14px;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 12px;
  color: var(--muted);
}
.search-field:focus-within { border-color: var(--red); }
.search-field input { border: 0; outline: 0; background: none; width: 100%; color: var(--ink); }
.select-label { display: flex; align-items: center; gap: 10px; font: 500 11px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.select-label select, .field select, .field input, .field textarea {
  min-height: 46px; padding: 10px 14px;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 12px;
  font: 400 15px/1.4 var(--font-body); letter-spacing: 0; text-transform: none; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 110px; }
.select-label select:focus, .field select:focus, .field input:focus, .field textarea:focus { outline: 0; border-color: var(--red); }
.event-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.event-card {
  display: grid; align-content: start; gap: 12px;
  padding: 22px; min-height: 196px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s ease, transform .2s ease;
}
.event-card:hover { border-color: var(--red); transform: translateY(-2px); }
.event-card h3 { font-size: 1.15rem; letter-spacing: -.02em; line-height: 1.2; }
.event-card .badge { justify-self: start; }
.event-card > div { align-self: end; margin-top: auto; }
.event-card .text-button { color: var(--red-ink); font-weight: 600; }
.catalog-note { margin-top: 32px; color: var(--muted); font-size: 13px; max-width: 760px; }
.catalog-note a { color: var(--red-ink); text-decoration: underline; }

.start-page { display: grid; justify-items: center; text-align: center; gap: 20px; min-height: 100vh; align-content: center; }
.start-page h1 { font-size: clamp(2.6rem, 6vw, 5rem); letter-spacing: -.05em; }
.start-page > p { color: var(--ink-2); }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: min(820px, 100%); margin-top: 20px; text-align: left; }
.role-cards a {
  display: grid; gap: 14px; padding: 32px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 24px;
  box-shadow: 0 4px 0 0 var(--line);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.role-cards a:hover { border-color: var(--red); box-shadow: 0 4px 0 0 var(--red-edge); }
.role-cards a:active { transform: translateY(4px); box-shadow: none; }
.role-cards .icon { width: 30px; height: 30px; color: var(--red); }
.role-cards h2 { font-size: 1.6rem; }
.role-cards p { color: var(--muted); }
.role-cards span { display: inline-flex; gap: 8px; align-items: center; font: 600 12px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--red-ink); margin-top: 8px; }
.start-page small { color: var(--muted); }

/* ---------- Workspace (solid blocks, no imagery) ---------- */
body.in-workspace { background: var(--bg-deep); }
.workspace { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; gap: 10px; padding: 10px; }
.sidebar {
  position: sticky; top: 10px; height: calc(100vh - 20px);
  display: flex; flex-direction: column; gap: 22px;
  padding: 24px 16px 16px;
  background: var(--surface); border-radius: 22px;
  overflow-y: auto;
}
.sidebar > .brand { padding: 0 8px; }
.chapter-label { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.chapter-label div { display: grid; line-height: 1.25; }
.chapter-label strong { font-size: 14px; }
.chapter-label small { color: var(--muted); font-size: 12px; }
.chapter-avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--red); color: #fff; font-family: var(--font-display); font-weight: 600; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a {
  display: flex; gap: 12px; align-items: center;
  padding: 11px 12px; border-radius: 12px;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.sidebar nav a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar nav a.active { background: var(--red); color: #fff; box-shadow: 0 3px 0 0 var(--red-edge); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; }
.hal-card { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--red-soft); }
.hal-card p { font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.role-switch, .back-home { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; font-size: 13px; color: var(--muted); }
.role-switch { border: 1.5px solid var(--line-strong); color: var(--ink); font-weight: 600; }
.role-switch:hover, .back-home:hover { color: var(--red); }

.workspace-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.workspace-top {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 10px 10px 22px; border-radius: 18px;
  background: var(--surface);
}
.mobile-menu { display: none; }
.crumb { font: 500 11px/1 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.crumb span { color: var(--red); margin: 0 6px; }
.workspace-top .header-actions { margin-left: auto; }
.demo-tag { font: 600 10px/1 var(--font-mono); letter-spacing: .18em; padding: 7px 9px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.workspace-main { flex: 1; display: grid; align-content: start; gap: 10px; }
.workspace-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 22px; border-radius: 18px; background: var(--surface);
  font-size: 13px; color: var(--muted);
}
.workspace-footer > span { display: inline-flex; gap: 8px; align-items: center; }
.workspace-footer .icon { width: 15px; height: 15px; }

.page-heading {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  padding: 36px 36px 32px; border-radius: 22px;
  background: var(--surface);
}
.page-heading > div { display: grid; gap: 12px; }
.page-heading h1 { font-size: clamp(2rem, 4.2vw, 3.4rem); letter-spacing: -.05em; }
.page-heading p { color: var(--muted); }

.panel {
  background: var(--surface);
  border-radius: 22px;
  padding: 26px;
  min-width: 0;
}
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-title h2 { font-size: 1.15rem; letter-spacing: -.02em; }
.panel-title > a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--red-ink); }
.panel-title > a .icon { width: 15px; height: 15px; }
.panel-footnote { margin-top: 14px; font-size: 12px; color: var(--muted); }
.full-width { grid-column: 1 / -1; }

.progress-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--red); transition: width .5s ease; }
.ring {
  --size: 132px;
  width: var(--size); height: var(--size); flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--red) calc(var(--progress) * 1%), var(--surface-3) 0);
}
.ring > div { width: calc(var(--size) - 22px); height: calc(var(--size) - 22px); border-radius: 50%; background: var(--surface); display: grid; place-content: center; text-align: center; gap: 4px; }
.ring strong { font: 500 2rem/1 var(--font-display); letter-spacing: -.05em; }
.ring small { font-size: .55em; color: var(--muted); }
.ring span { font: 500 9px/1 var(--font-mono); letter-spacing: .2em; color: var(--muted); }

/* Student overview */
.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.event-hero { grid-column: span 8; display: grid; gap: 26px; background: var(--ink); color: var(--bg); }
.event-hero .eyebrow, .event-hero .subtle, .event-hero .micro { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.event-hero .progress-track { background: color-mix(in srgb, var(--bg) 16%, transparent); }
.event-hero .ring { background: conic-gradient(var(--red) calc(var(--progress) * 1%), color-mix(in srgb, var(--bg) 16%, transparent) 0); }
.event-hero .ring > div { background: var(--ink); }
.event-heading { display: flex; justify-content: space-between; gap: 20px; }
.event-heading > div { display: grid; gap: 10px; }
.event-heading h2 { font-size: clamp(1.8rem, 3.6vw, 3rem); letter-spacing: -.05em; }
.round-link {
  width: 52px; height: 52px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--red); color: #fff;
  box-shadow: 0 3px 0 0 var(--red-edge);
  transition: transform .12s ease, box-shadow .12s ease;
}
.round-link:active { transform: translateY(3px); box-shadow: none; }
.event-progress { display: flex; justify-content: space-between; align-items: center; gap: 28px; }
.event-progress > div:first-child { flex: 1; display: grid; gap: 10px; }
.event-progress p { font-size: 15px; }
.continue-strip {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 14px 14px 18px; border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 8%, transparent);
}
.continue-strip > div { display: flex; align-items: center; gap: 14px; }
.continue-strip > div > .icon { color: var(--red); width: 22px; height: 22px; }
.continue-strip span { display: grid; gap: 4px; }
.continue-strip small { font: 500 10px/1 var(--font-mono); letter-spacing: .2em; color: color-mix(in srgb, var(--bg) 55%, transparent); }

.rank-card { grid-column: span 4; display: grid; align-content: start; gap: 16px; background: var(--red); color: #fff; }
.rank-card .eyebrow { color: rgba(255, 255, 255, .78); }
.rank-glyph { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: rgba(255, 255, 255, .16); }
.rank-glyph .icon { width: 30px; height: 30px; }
.rank-card h2 { font-size: 1.7rem; }
.rank-card p { color: rgba(255, 255, 255, .85); }
.rank-card .editorial-link { color: #fff; justify-self: start; margin-top: auto; }

.assignments-panel { grid-column: span 7; }
.progress-panel { grid-column: span 5; }
.chapter-preview { grid-column: 1 / -1; }

.assignment-list { display: grid; gap: 6px; }
.assignment-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2);
  transition: background-color .15s ease;
}
.assignment-row:hover { background: var(--surface-3); }
.assignment-row > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.assignment-row strong { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-row small { color: var(--muted); font-size: 13px; }
.row-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--ink-2); }
.row-icon.done { background: var(--ok-soft); color: var(--ok); }
.row-end { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.due { font: 600 12px/1 var(--font-mono); letter-spacing: .06em; color: var(--red-ink); }
.status { display: inline-flex; font: 600 11px/1 var(--font-mono); letter-spacing: .06em; padding: 6px 9px; border-radius: 7px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.status.attention { background: var(--warn-soft); color: var(--warn); }

.chart-empty { display: grid; gap: 14px; justify-items: start; }
.chart-empty p { color: var(--muted); font-size: 14px; }
.ghost-bars { display: flex; align-items: flex-end; gap: 10px; height: 110px; width: 100%; }
.ghost-bars i { flex: 1; border-radius: 8px 8px 3px 3px; background: var(--surface-3); }
.ghost-bars i:nth-child(1) { height: 30%; } .ghost-bars i:nth-child(2) { height: 45%; } .ghost-bars i:nth-child(3) { height: 38%; }
.ghost-bars i:nth-child(4) { height: 60%; } .ghost-bars i:nth-child(5) { height: 52%; } .ghost-bars i:nth-child(6) { height: 74%; } .ghost-bars i:nth-child(7) { height: 66%; }
.history-bars { display: flex; align-items: flex-end; gap: 12px; height: 160px; }
.history-bars > div { flex: 1; display: grid; justify-items: center; align-content: end; gap: 6px; height: 100%; }
.history-bars span { font: 600 11px/1 var(--font-mono); color: var(--ink-2); }
.history-bars i { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: var(--red); }
.history-bars small { font-size: 11px; color: var(--muted); }

.notice { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 16px; background: var(--surface-2); }
.notice > div { display: grid; gap: 6px; }
.notice strong { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Teacher overview */
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.metric-row > div { background: var(--surface); border-radius: 22px; padding: 22px 26px; display: grid; gap: 10px; }
.metric-row > div:first-child { background: var(--red); color: #fff; }
.metric-row > div:first-child span, .metric-row > div:first-child small { color: rgba(255, 255, 255, .78); }
.metric-row span { font: 500 11px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.metric-row strong { font: 500 2.4rem/1 var(--font-display); letter-spacing: -.05em; }
.metric-row small { font: 400 14px/1 var(--font-body); letter-spacing: 0; color: var(--muted); }
.teacher-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.roster-panel { grid-column: span 8; }
.teacher-note { grid-column: span 4; display: grid; align-content: start; gap: 16px; background: var(--ink); color: var(--bg); }
.teacher-note .eyebrow { color: color-mix(in srgb, var(--bg) 60%, transparent); }
.teacher-note > .icon { width: 30px; height: 30px; color: var(--red); }
.teacher-note h2 { font-size: 1.6rem; }
.teacher-note p { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.teacher-note .button { justify-self: start; margin-top: 8px; }
.teacher-grid .assignments-panel { grid-column: span 8; }
.chapter-pulse { grid-column: span 4; display: grid; gap: 12px; align-content: center; justify-items: start; background: var(--red-soft); }
.chapter-pulse h2 { font-size: 1.4rem; }
.chapter-pulse p { color: var(--ink-2); }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 500 10px/1 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 0 12px 12px; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.student-name { display: flex; align-items: center; gap: 10px; }
.student-name .avatar { width: 32px; height: 32px; font-size: 11px; }
.table-progress { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.table-progress .progress-track { flex: 1; }
.table-progress span { font: 600 12px/1 var(--font-mono); color: var(--muted); min-width: 36px; }

/* Tabs */
.filter-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 14px; background: var(--surface-2); flex-wrap: wrap; }
.filter-tabs button { padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.filter-tabs button:hover { color: var(--ink); }
.filter-tabs button.selected { background: var(--surface); color: var(--ink); box-shadow: 0 2px 0 0 var(--line-strong); }
:root[data-theme="dark"] .filter-tabs button.selected { background: var(--surface-3); }

/* My event */
.event-page .filter-tabs { margin-bottom: 28px; }
.event-page-content { display: grid; gap: 20px; }
.section-intro { display: grid; gap: 8px; max-width: 640px; }
.section-intro h2 { font-size: 1.6rem; }
.section-intro p { color: var(--muted); }
.lesson-list { display: grid; gap: 8px; }
.lesson-row {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 18px; align-items: center;
  width: 100%; text-align: left; padding: 16px 20px; border-radius: 16px;
  background: var(--surface-2); border: 1.5px solid transparent;
  transition: border-color .15s ease;
}
.lesson-row:hover { border-color: var(--red); }
.lesson-row > span:nth-child(2) { display: grid; gap: 4px; }
.lesson-row small { font: 500 10px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--red-ink); }
.lesson-row strong { font-size: 16px; }
.lesson-row > .icon { color: var(--muted); }
.lesson-number { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); font: 600 13px/1 var(--font-mono); }
.lesson-time { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.lesson-time .icon { width: 15px; height: 15px; }
.checklist { display: grid; gap: 8px; max-width: 680px; }
.checklist label { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: 14px; background: var(--surface-2); cursor: pointer; }
.checklist input { width: 20px; height: 20px; accent-color: var(--red); }
.checklist input:checked + span { color: var(--muted); text-decoration: line-through; }
.practice-intro {
  display: grid; justify-items: center; text-align: center; gap: 16px;
  padding: 56px 24px; border-radius: 20px; background: var(--surface-2);
}
.practice-intro > .icon { width: 36px; height: 36px; color: var(--red); }
.practice-intro h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.practice-intro p { color: var(--muted); max-width: 460px; }
.practice-intro small { color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 8px; font-size: 14px; font-weight: 600; }

/* Analytics */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.analytics-number { display: flex; align-items: center; gap: 24px; }
.analytics-number h3 { font-size: 1.4rem; }
.analytics-number p { color: var(--muted); }
.activity-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.activity-row:last-child { border-bottom: 0; }
.activity-row .icon { color: var(--ok); }
.activity-row small { color: var(--muted); }
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 32px 16px; color: var(--muted); }
.empty h3 { font-size: 1.1rem; color: var(--ink); letter-spacing: -.02em; }
.empty > .icon { width: 28px; height: 28px; color: var(--ok); }

/* Community */
.community-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 10px; align-items: start; }
.community-grid > section { display: grid; gap: 10px; }
.composer { display: grid; gap: 12px; }
.composer label { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -.02em; }
.composer textarea { width: 100%; min-height: 96px; padding: 14px; resize: vertical; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; }
.composer textarea:focus { outline: 0; border-color: var(--red); }
.composer > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.composer small { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.composer small .icon { width: 14px; height: 14px; }
.posts { display: grid; gap: 10px; }
.post { display: grid; gap: 14px; }
.post-head { display: flex; gap: 12px; align-items: center; }
.post-head div { display: grid; line-height: 1.3; }
.post-head small { color: var(--muted); font-size: 13px; }
.post p { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.community-aside { position: sticky; top: 10px; display: grid; gap: 14px; }
.community-aside h2 { font-size: 1.4rem; }
.community-aside h3 { font-size: 1.1rem; letter-spacing: -.02em; }
.community-aside p { color: var(--muted); font-size: 14px; }
.divider { height: 1px; background: var(--line); }

/* Rankings */
.ranking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 10px; }
.rank-table td:first-child { font: 600 13px/1 var(--font-mono); color: var(--muted); }
.rank-table tbody tr:first-child td:first-child { color: var(--red); }
.rank-you { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: var(--red-soft); }
.rank-you span { font: 600 10px/1 var(--font-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--red-ink); }
.rank-you small { color: var(--muted); margin-left: auto; }
.rank-explainer { display: grid; align-content: start; gap: 14px; background: var(--ink); color: var(--bg); }
.rank-explainer > .icon { width: 30px; height: 30px; color: var(--red); }
.rank-explainer h2 { font-size: 1.6rem; }
.rank-explainer p { color: color-mix(in srgb, var(--bg) 70%, transparent); font-size: 14px; }
.rank-ladder { display: grid; grid-template-columns: repeat(9, minmax(90px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.rank-ladder > div { display: grid; justify-items: center; gap: 8px; padding: 18px 8px; border-radius: 16px; background: var(--surface-2); text-align: center; }
.rank-ladder strong { font-size: 14px; }
.rank-ladder small { font: 500 10px/1 var(--font-mono); letter-spacing: .1em; color: var(--muted); }
.rank-diamond {
  width: 46px; height: 46px; display: grid; place-items: center;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: hsl(calc(var(--rank-hue) + 20) 42% 52%);
  color: #fff;
}
.rank-ladder > div:last-child .rank-diamond { background: var(--red); }
.rank-diamond .icon { width: 18px; height: 18px; }

/* ---------- Modal ---------- */
dialog {
  width: min(560px, calc(100% - 32px)); max-height: calc(100vh - 48px);
  padding: 30px; border: 0; border-radius: 24px;
  background: var(--surface); color: var(--ink);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5);
}
dialog[open] { display: grid; gap: 18px; animation: pop .2s ease; }
dialog::backdrop { background: rgba(18, 16, 20, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.modal-head h2 { font-size: 1.6rem; letter-spacing: -.04em; }
dialog form { display: grid; gap: 16px; }
dialog form > .button { justify-self: start; }
dialog > p { color: var(--ink-2); }
dialog a { color: var(--red-ink); }
.lesson-body { color: var(--ink-2); font-size: 16px; line-height: 1.65; }
.resource-link { display: inline-flex; align-items: center; gap: 10px; justify-self: start; font-weight: 600; color: var(--red-ink); }
.callout { display: grid; gap: 6px; padding: 16px 18px; border-radius: 16px; background: var(--red-soft); }
.callout p { color: var(--ink-2); font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.quiz-question { font-size: 1.35rem; letter-spacing: -.03em; line-height: 1.25; }
.quiz-options { display: grid; gap: 8px; }
.quiz-options label { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; cursor: pointer; }
.quiz-options label:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.quiz-options input { accent-color: var(--red); width: 18px; height: 18px; }
.quiz-result, .quiz-feedback { display: grid; justify-items: center; text-align: center; gap: 14px; }
.quiz-feedback > .icon { width: 36px; height: 36px; color: var(--red); }
.quiz-result p, .quiz-feedback p { color: var(--ink-2); }

/* ---------- Toast ---------- */
#toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500;
  box-shadow: 0 3px 0 0 var(--red);
  transition: opacity .2s ease, transform .2s ease;
  max-width: calc(100% - 32px);
}
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .event-hero, .rank-card, .assignments-panel, .progress-panel,
  .roster-panel, .teacher-note, .teacher-grid .assignments-panel, .chapter-pulse { grid-column: 1 / -1; }
  .community-grid, .ranking-layout { grid-template-columns: 1fr; }
  .community-aside { position: static; }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 40; top: 10px; left: 10px; bottom: 10px; height: auto; width: min(290px, calc(100% - 20px));
    transform: translateX(calc(-100% - 20px)); transition: transform .25s ease;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .5);
  }
  .sidebar.open { transform: none; }
  .mobile-menu { display: inline-grid; }
  .workspace-top { padding-left: 10px; }
  .demo-tag { display: none; }
  .metric-row { grid-template-columns: 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
  .role-cards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .page-heading { padding: 26px 22px; }
  .panel { padding: 20px; }
  .event-progress { flex-direction: column; align-items: flex-start; }
  .lesson-row { grid-template-columns: auto 1fr auto; padding: 14px; gap: 12px; }
  .lesson-time { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .activity-row { grid-template-columns: auto 1fr; }
  .crumb { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.desktop-only { display: inline; }
@media (max-width: 860px) { .desktop-only { display: none; } }
@media (max-width: 560px) { .catalog, .start-page { width: calc(100% - 32px); } }
