/* Nuva teacher platform. One light theme. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #F7F7F8;
  --surface: #FFFFFF;
  --surface-2: #F4F4F6;
  --border: #E5E5EA;
  --border-strong: #D4D4DB;
  --ink: #18181B;
  --ink-2: #52525B;
  --ink-3: #8B8B94;
  --brand: #6D28D9;
  --brand-hover: #5B21B6;
  --brand-ink: #FFFFFF;
  --brand-soft: #F3EEFD;
  --ok: #047857;
  --ok-bg: #ECFDF3;
  --warn: #B45309;
  --warn-bg: #FFF7E8;
  --bad: #B91C1C;
  --bad-bg: #FEF2F2;
  --wait: #52525B;
  --wait-bg: #F4F4F6;
  --shadow-pop: 0 12px 32px rgba(24, 24, 27, 0.12), 0 2px 6px rgba(24, 24, 27, 0.06);
  --radius: 12px;
  /* Charts: one violet series; the running week one step lighter. Heat: violet ramp, light to dark = more minutes. */
  --mark: #6D28D9;
  --mark-partial: #C4B5FD;
  --grid-line: #EFEFF2;
  --heat-0: #F4F4F6;
  --heat-1: #DDD6FE;
  --heat-2: #A78BFA;
  --heat-3: #7C3AED;
  --heat-4: #4C1D95;
  --heat-ink-1: #3B0F7A;
  --heat-ink-2: #18181B;
  --heat-ink-3: #FFFFFF;
  --heat-ink-4: #FFFFFF;
  color-scheme: light;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; color: var(--ink); font-size: 15px; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .school { color: var(--ink-3); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.who { color: var(--ink-2); font-size: 13px; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page { max-width: 1120px; margin: 0 auto; padding: 36px 24px 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
.sub { color: var(--ink-2); font-size: 14px; }
.page-head .sub { margin-top: 6px; }
.back { display: inline-block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 14px; }
.back:hover { color: var(--ink); text-decoration: none; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.3; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-danger-solid { background: var(--bad); border-color: var(--bad); color: #FFFFFF; }
.btn-danger-solid:hover { background: #991B1B; border-color: #991B1B; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-link { background: none; border: none; color: var(--brand); padding: 0; font-weight: 500; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.lang { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang button { background: none; border: none; padding: 4px 9px; font-size: 12px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }

/* A small menu of less common class actions. */
.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 10; }
.menu-list button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 10px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list button.danger { color: var(--bad); }

label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
label.field > span.hint { font-size: 12px; font-weight: 400; color: var(--ink-3); margin: 6px 0 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="datetime-local"], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink); outline: none; font-size: 14px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
input[type="checkbox"] { accent-color: var(--brand); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 20px 22px; }
.class-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.class-card, .hw-card { display: block; color: inherit; transition: border-color 0.12s, box-shadow 0.12s; }
a.class-card:hover, a.hw-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: 0 2px 8px rgba(24, 24, 27, 0.05); }
.class-card { padding: 20px 22px; }
.class-card h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 4px; }
.class-card .count { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 18px; font-variant-numeric: tabular-nums; }
.class-card .count span { font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-left: 6px; }
.new-card { display: flex; align-items: center; justify-content: center; min-height: 128px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: transparent; color: var(--ink-2); font-weight: 600; cursor: pointer; }
.new-card:hover { border-color: var(--brand); color: var(--brand); background: var(--surface); }

/* School places strip */
.places { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 22px; }
.places-text { font-size: 14px; color: var(--ink-2); }
.places-text b { color: var(--ink); font-variant-numeric: tabular-nums; }
.meter { flex: 1 1 160px; max-width: 280px; height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.meter.near > i { background: #D97706; }
.meter.full > i { background: var(--bad); }

/* Sign in */
.signin-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.signin { width: 100%; max-width: 380px; padding: 32px 28px; box-shadow: 0 1px 2px rgba(24, 24, 27, 0.04); }
.signin .logo { width: 44px; height: 44px; border-radius: 11px; margin-bottom: 18px; }
.signin h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.signin p.sub { margin-bottom: 22px; }
.signin .btn-primary { width: 100%; margin-top: 4px; padding: 10px 16px; }
.signin .btn-block { width: 100%; margin-top: 4px; padding: 10px 16px; }
.signin .or { display: flex; align-items: center; gap: 10px; margin: 18px 0; font-size: 12px; color: var(--ink-3); }
.signin .or::before, .signin .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.signin-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 10px; }
.error { color: var(--bad); font-size: 13px; min-height: 18px; margin-bottom: 10px; }

/* Tabs */
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 10px 0; margin-bottom: -1px; font-weight: 500; font-size: 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand); }

/* Stats: one strip, divided */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.stats > .stat { border: none; border-left: 1px solid var(--border); border-radius: 0; background: none; }
.stats > .stat:first-child { border-left: none; }
.stat { padding: 16px 20px; }
.stat .num { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 13px; color: var(--ink-2); margin-top: 2px; }

/* Tables */
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type="search"] { max-width: 300px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-3); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th.num, td.num { text-align: right; }
th button { background: none; border: none; color: inherit; font: inherit; cursor: pointer; padding: 0; }
th button:hover { color: var(--ink-2); }
th button[aria-sort] { color: var(--ink); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.num { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td:not(.heat) { background: #FAFAFB; }
tr.gone td { color: var(--ink-3); }
.name { font-weight: 600; }
.small { font-size: 12px; color: var(--ink-3); }
.note { color: var(--ink-3); font-size: 12px; margin-top: 14px; max-width: 760px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-done { color: var(--ok); background: var(--ok-bg); }
.chip-late { color: var(--warn); background: var(--warn-bg); }
.chip-missing, .chip-idle { color: var(--bad); background: var(--bad-bg); }
.chip-pending, .chip-plain { color: var(--wait); background: var(--wait-bg); }
.chip-brand { color: var(--brand); background: var(--brand-soft); }

/* Homework */
.hw-list { display: grid; gap: 12px; }
.hw-card { padding: 18px 22px; }
.hw-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.hw-tasks { margin: 10px 0 12px; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 8px; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 999px; }
.task-cell .small { display: block; margin-top: 2px; }

/* Student timeline */
.profile { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.ranges { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.ranges a { padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--ink-2); border-radius: 6px; }
.ranges a:hover { text-decoration: none; color: var(--ink); }
.ranges a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08); }
.day { margin-top: 22px; }
.day h3 { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-bottom: 8px; }
.event { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.event:last-child { border-bottom: none; }
.event .time { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 13px; }
.event .what { min-width: 0; }
.event .kind { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.event .label { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event .meta { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; text-align: right; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Modal */
.overlay { position: fixed; inset: 0; background: rgba(24, 24, 27, 0.32); display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px; overflow-y: auto; z-index: 20; }
.modal { width: 100%; max-width: 600px; padding: 24px 26px; box-shadow: var(--shadow-pop); border-radius: 14px; }
.modal h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.adder-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.task-rows { display: grid; gap: 8px; margin-bottom: 10px; }
.task-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.task-row-fixed { grid-template-columns: minmax(0, 1fr) auto; align-items: center; font-size: 14px; }
.task-kind { font-size: 13px; font-weight: 600; color: var(--ink-2); padding-top: 10px; }
.task-fields { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px; align-items: end; }
.task-fields > select:last-child { grid-column: 1 / -1; }
.task-fields-practice { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.task-fields-practice > select { grid-column: 1 / -1; }
.inline-field span { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-remove { font-size: 18px; line-height: 1; padding: 6px 11px; }
.task-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-empty { padding: 2px; }
th.task-head { white-space: normal; min-width: 140px; font-size: 12px; }

/* Adding students: totals first, then only the lines that need the teacher. */
.add-results { display: grid; gap: 6px; margin-top: 14px; padding: 14px 16px; background: var(--surface-2); border-radius: 10px; font-size: 13px; }
.add-results .total { font-weight: 600; color: var(--ink); }
.add-results .problem { color: var(--ink-2); }
.add-results .problem b { color: var(--ink); font-weight: 600; }
.add-results .bad { color: var(--bad); }

/* Misc */
.center { text-align: center; padding: 56px 16px; color: var(--ink-2); }
.center .btn { margin-top: 16px; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--brand); border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #FFFFFF; padding: 11px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; z-index: 30; max-width: calc(100% - 32px); box-shadow: var(--shadow-pop); }

/* Student photos */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; overflow: hidden; color: #FFFFFF; font-weight: 600; line-height: 1; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--surface); }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-text { min-width: 0; }
.person-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Filters above the student table */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filter { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; }
.filter:hover { border-color: var(--border-strong); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.filter-count { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.filter[aria-pressed="true"] .filter-count { color: #D4D4DB; }

/* Student page */
.student-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.student-nav .back { margin-bottom: 0; }
.switcher { display: flex; align-items: center; gap: 6px; }
.switcher select { width: auto; max-width: 240px; padding: 6px 10px; }
.switcher .btn { min-width: 34px; font-size: 18px; line-height: 1; padding: 4px 10px; }
.student-head { display: flex; align-items: center; gap: 18px; min-width: 0; }
.head-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .card-title { margin-bottom: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
.mini-table th { padding: 6px 8px; }
.mini-table td { padding: 10px 8px; }
.mini-table .kind { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.mini-list { list-style: none; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.mini-list li:last-child { border-bottom: none; }
.mini-list a { color: inherit; min-width: 0; }
.mini-list a:hover { text-decoration: none; }
.mini-list a:hover .name { color: var(--brand); }

/* Charts */
.chart { position: relative; margin-top: 6px; outline: none; border-radius: 8px; }
.chart:focus-visible { box-shadow: 0 0 0 3px var(--brand-soft); }
.chart-plot { position: relative; height: 128px; margin-left: 30px; margin-top: 18px; }
.grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--grid-line); }
.grid span { position: absolute; right: calc(100% + 6px); top: -8px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart-cols { position: absolute; inset: 0; display: flex; }
.chart-col { position: relative; flex: 1 1 0; min-width: 0; height: 100%; cursor: default; }
.chart-col.active { background: var(--surface-2); border-radius: 6px 6px 0 0; }
.bar-mark { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 62%; max-width: 24px; min-height: 2px; background: var(--mark); border-radius: 4px 4px 0 0; }
.chart-col.partial .bar-mark { background: var(--mark-partial); }
.line-mark { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.line-mark path { fill: none; stroke: var(--mark); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.dot-mark { position: absolute; left: 50%; transform: translateX(-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--mark); border: 2px solid var(--surface); }
.chart-col.partial .dot-mark { background: var(--mark-partial); }
.value-label { position: absolute; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; pointer-events: none; }
.chart-x { display: flex; margin-left: 30px; margin-top: 6px; }
.chart-x span { flex: 1 1 0; min-width: 0; display: flex; justify-content: center; font-size: 11px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-x span:last-child { justify-content: flex-end; }
.tip { position: absolute; z-index: 4; transform: translate(-50%, calc(-100% - 8px)); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); border-radius: 8px; padding: 6px 10px; pointer-events: none; white-space: nowrap; }
.tip-value { font-weight: 700; font-size: 13px; color: var(--ink); }
.tip-label { font-size: 12px; color: var(--ink-2); }

/* Progress */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.metric-head { display: flex; align-items: baseline; gap: 8px; }
.metric-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.delta { font-size: 13px; color: var(--ink-2); min-height: 20px; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.heat-card { margin-bottom: 16px; position: relative; }
.legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.heat-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.heat-table { border-collapse: separate; border-spacing: 3px; }
.heat-table th, .heat-table td { border-bottom: none; }
.heat-table th { padding: 6px 4px; }
.heat-table .heat-head { text-align: center; font-variant-numeric: tabular-nums; }
.heat-table td { padding: 6px 8px; }
.heat-table tbody tr td:first-child, .heat-table thead tr th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.heat-table tr.clickable:hover td:first-child { background: #FAFAFB; }
.heat { position: relative; min-width: 40px; height: 32px; border-radius: 6px; text-align: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat-0 { background: var(--heat-0); color: var(--ink-3); }
.heat-1 { background: var(--heat-1); color: var(--heat-ink-1); }
.heat-2 { background: var(--heat-2); color: var(--heat-ink-2); }
.heat-3 { background: var(--heat-3); color: var(--heat-ink-3); }
.heat-4 { background: var(--heat-4); color: var(--heat-ink-4); }
.heat-table tr.clickable:hover td.heat { box-shadow: inset 0 0 0 2px rgba(24, 24, 27, 0.12); }
.week-table { margin-bottom: 4px; }
.week-table summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.week-table[open] summary { margin-bottom: 10px; }

@media (max-width: 640px) {
  /* Tables of students become one card per student: every number stays in view, labelled. */
  .stack-table thead { display: none; }
  .stack-table, .stack-table tbody { display: block; }
  .stack-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .stack-table tbody tr:last-child { border-bottom: none; }
  .stack-table td { display: block; padding: 0; border: none; font-size: 13px; text-align: left; }
  .stack-table td:first-child { flex: 1 0 100%; }
  .stack-table td:empty { display: none; }
  .stack-table td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-weight: 400; }
  .stack-table td.task-cell { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
  .stack-table td.task-cell .small { display: inline; margin: 0; }
  tr.clickable:hover td:not(.heat) { background: none; }
  .topbar { padding: 0 16px; }
  .brand .school { display: none; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats:has(> :nth-child(4)) > .stat:nth-child(odd) { border-left: none; }
  .stats:has(> :nth-child(4)) > .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .stat { padding: 12px 14px; }
  .stat .num { font-size: 20px; }
  .stat .lbl { font-size: 12px; line-height: 1.3; }
  .page { padding: 22px 16px 64px; }
  .avatar-lg { width: 52px; height: 52px; font-size: 18px; }
  .switcher select { max-width: 150px; }
  .page-head h1 { font-size: 22px; }
  .who { display: none; }
  .head-side { align-items: flex-start; }
  .task-row { grid-template-columns: minmax(0, 1fr) auto; }
  .task-row .task-remove { grid-column: 2; grid-row: 1; }
  .task-row .task-fields { grid-column: 1 / -1; }
  .event { grid-template-columns: 44px minmax(0, 1fr); }
  .event .meta { grid-column: 2; justify-content: flex-start; }
}
