/* The dashboard wears the look of the Probato app (apps/web/DESIGN.md): paper and white,
   slate ink in three greys, thin rules instead of boxes, a serif for headings, one red
   that only ever marks one thing. No shadows, no cards. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f5f6f7;
  --white: #ffffff;
  --ink: #272d33;
  --ink-soft: #48515a;
  --ink-mute: #5f6872;
  --line: #dde0e4;
  --line-strong: #b9bec5;
  --red: #d7050d;
  --red-deep: #b3040a;
  --red-wash: #fdeceb;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 1.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-color: var(--line-strong) var(--paper); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font: 400 0.9375rem/1.55 var(--sans);
  font-feature-settings: "cv11", "ss03";
  caret-color: var(--red);
}
::selection { background: var(--red); color: var(--white); }
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { color: var(--ink); font-family: var(--serif); font-weight: 400; margin: 0; text-wrap: balance; }
h1 { font-size: 1.625rem; line-height: 1.2; letter-spacing: -0.012em; }
h2 { font-size: 1.375rem; line-height: 1.25; letter-spacing: -0.008em; margin-top: 3rem; }
h3 { font-size: 1.125rem; line-height: 1.3; margin-top: 2rem; }
p { margin: 0.5rem 0 0; max-width: 68ch; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; }
.mute { color: var(--ink-mute); }
.note { color: var(--ink-mute); font-size: 0.8125rem; }
.lede { margin-top: 0.375rem; max-width: 62ch; }

.wrap { max-width: 75rem; margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--white); padding: 0.5rem 0.75rem; z-index: 5; }

/* --- the bar at the top --------------------------------------------------------------- */
.top { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.top-in { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; }
.mark { font: 400 1.5rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.mark span { color: var(--red); }
.top nav { display: flex; gap: 1.25rem; margin-right: auto; }
.top nav a { color: var(--ink-soft); text-decoration: none; padding: 0.5rem 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
main.wrap { padding-top: 2.25rem; padding-bottom: 5rem; }

/* --- buttons: one shape, two fills, never red ------------------------------------------ */
.pill {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  min-height: 2.875rem; padding: 0.625rem 1.375rem; border-radius: 999px; border: 1px solid transparent;
  font: 500 0.9375rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.pill-ink { background: var(--ink); color: var(--white); }
.pill-ink:hover { background: #12161a; }
.pill-quiet { background: var(--white); color: var(--ink); border-color: var(--line-strong); }
.pill-quiet:hover { border-color: var(--ink); }
.pill-sm { min-height: 2.5rem; padding: 0.5rem 1.125rem; font-size: 0.875rem; }
.pill:disabled { opacity: 0.6; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: center; margin-top: 1.25rem; }
.inline-form { display: inline; }

/* --- page heads and the tabs of a batch ------------------------------------------------ */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; }
.crumb { font-size: 0.8125rem; margin: 0 0 0.5rem; }
.crumb a { color: var(--ink-mute); }
.tabs { display: flex; gap: 1.75rem; margin-top: 1.5rem; border-bottom: 1px solid var(--line-strong); overflow-x: auto; }
.tabs a { padding: 0.625rem 0; margin-bottom: -1px; color: var(--ink-mute); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

.tag { display: inline-block; padding: 0.1875rem 0.625rem; border-radius: 999px; background: var(--white);
  color: var(--ink-soft); font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
.tag-red { background: var(--red-wash); color: var(--red-deep); }
.tag-ink { background: var(--ink); color: var(--white); }

.said { margin-top: 1.25rem; padding: 0.75rem 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line);
  color: var(--ink); }
.said-problem { color: var(--red-deep); border-top-color: var(--red); }

/* --- figures between two rules --------------------------------------------------------- */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); margin: 1.5rem 0 0; padding: 0;
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.figures > div { padding: 1rem 1.25rem 1rem 0; }
.figures > div + div { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.figures dd { margin: 0; font: 400 1.375rem/1.25 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.figures dd small { font: 400 0.8125rem/1 var(--sans); color: var(--ink-mute); }
.figures dt { font-size: 0.8125rem; color: var(--ink-mute); margin-top: 0.125rem; }

/* --- ruled rows: every list and table --------------------------------------------------- */
.scroll { overflow-x: auto; margin-top: 1.25rem; }
table { border-collapse: collapse; width: 100%; }
.rows th { text-align: left; font-size: 0.8125rem; font-weight: 500; color: var(--ink-mute); padding: 0 1rem 0.5rem 0;
  border-bottom: 1px solid var(--line-strong); white-space: nowrap; vertical-align: bottom; }
.rows td { padding: 0.625rem 1rem 0.625rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rows th:last-child, .rows td:last-child { padding-right: 0; }
.rows td.n, .rows th.n { text-align: right; }
.rows tbody tr { transition: background-color 0.18s var(--ease); }
.rows tbody tr:hover { background: var(--white); }
.rows td.first, .rows th.first { padding-left: 0.5rem; }
.rows a { font-weight: 500; text-decoration: none; }
.rows a:hover { text-decoration: underline; }
.rows .sub { display: block; font-size: 0.8125rem; color: var(--ink-mute); }
.rows tr.closing td { background: var(--white); }
.code { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; font-weight: 500; color: var(--ink); white-space: nowrap; }
.thumb { width: 2.75rem; height: 2.75rem; object-fit: cover; border-radius: 0.375rem; background: var(--line); }

.record { margin: 1.25rem 0 0; border-top: 1px solid var(--line-strong); }
.record > div { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; padding: 0.625rem 0; border-bottom: 1px solid var(--line); }
.record dt { color: var(--ink-mute); }
.record dd { margin: 0; color: var(--ink); }

.empty { margin-top: 1.5rem; padding: 1.5rem 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.empty strong { display: block; font: 400 1.25rem/1.3 var(--serif); color: var(--ink); }

/* --- a measured value: a thin bar, with the target as the one red mark ------------------ */
.bar { width: 6rem; height: 0.375rem; display: inline-block; vertical-align: middle; margin-right: 0.5rem; }
.bar .track, .cell-bar .track { fill: var(--line); }
.bar .fill { fill: var(--ink); }
.cell-bar .fill { fill: var(--line-strong); }
.lead .cell-bar .fill { fill: var(--ink); }
.bar .tick { stroke: var(--red); stroke-width: 2; }
.cell-bar { display: block; width: 100%; height: 0.25rem; margin-top: 0.25rem; }
.lead { font-weight: 600; color: var(--ink); }

/* --- filters ---------------------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
.filters a { padding: 0.3125rem 0.875rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white);
  color: var(--ink-soft); text-decoration: none; font-size: 0.875rem; font-weight: 500;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease), color 0.18s var(--ease); }
.filters a:hover { border-color: var(--ink); }
.filters a[aria-current] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.filters a span { font-variant-numeric: tabular-nums; opacity: 0.75; margin-left: 0.25rem; }

/* --- forms ------------------------------------------------------------------------------ */
.split { display: grid; gap: 2rem; margin-top: 2rem; }
.form { display: grid; gap: 1.25rem; max-width: 40rem; }
.form h2, .form h3 { margin-top: 0.75rem; }
label.field-label, .field-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--ink); }
.hint { display: block; font-size: 0.8125rem; font-weight: 400; color: var(--ink-mute); margin-top: 0.125rem; }
.field {
  display: block; width: 100%; min-height: 2.875rem; margin-top: 0.375rem; padding: 0.625rem 0.875rem;
  background: var(--white); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 0.625rem;
  font: 400 1rem/1.4 var(--sans); font-feature-settings: inherit;
  transition: border-color 0.18s var(--ease);
}
.field:hover { border-color: var(--ink-mute); }
.field:focus-visible { border-color: var(--ink); outline: 2px solid var(--ink); outline-offset: 1px; border-radius: 0.625rem; }
.field::placeholder { color: var(--ink-mute); }
textarea.field { min-height: 7rem; resize: vertical; }
select.field { appearance: none; padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23272d33' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.875rem center; }
input[type="file"].field { padding: 0.5rem 0.625rem; }
input[type="file"]::file-selector-button { margin-right: 0.875rem; padding: 0.375rem 0.875rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--white); color: var(--ink); font: 500 0.875rem var(--sans); cursor: pointer; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1.25rem; }
.check { display: grid; grid-template-columns: 1.25rem 1fr; gap: 0.75rem; align-items: start; color: var(--ink); }
.check input { appearance: none; width: 1.25rem; height: 1.25rem; margin: 0.125rem 0 0; border: 1px solid var(--line-strong);
  border-radius: 0.3125rem; background: var(--white); cursor: pointer; transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease); }
.check input[type="radio"] { border-radius: 999px; }
.check input:hover { border-color: var(--ink-mute); }
.check input:checked { background-color: var(--ink); border-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 6.8' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.check input[type="radio"]:checked { background-image: radial-gradient(circle, var(--white) 0 32%, transparent 36%); }
.choices { border-top: 1px solid var(--line-strong); }
.choices .check { padding: 0.875rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.choices strong { font-weight: 500; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font: 400 1.125rem/1.3 var(--serif); color: var(--ink); }

/* --- the join block: what goes on the projector ----------------------------------------- */
/* It follows the tabs, whose rule is its upper edge. */
.join { display: grid; grid-template-columns: 1fr auto; gap: 1.5rem 2.5rem; align-items: center; padding: 1.75rem 0 1.5rem;
  border-bottom: 1px solid var(--line); }
.join-code { font: 400 clamp(2.25rem, 1.4rem + 3.6vw, 3.5rem)/1 var(--serif); color: var(--ink); letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums lining-nums; margin: 0.25rem 0 0.75rem; }
.join .qr { width: 8.5rem; height: 8.5rem; padding: 0.625rem; background: var(--white); border: 1px solid var(--line); border-radius: 0.625rem; }
.join .qr svg { width: 100%; height: 100%; }
.join a { word-break: break-all; }

/* --- one case: the one large panel ------------------------------------------------------ */
.panel { display: grid; margin-top: 1.5rem; background: var(--white); border: 1px solid var(--line); border-radius: 1.75rem; overflow: hidden; }
.panel > div { padding: 1.5rem; }
.panel .side { background: var(--paper); border-top: 1px solid var(--line); }
.panel img { width: 100%; max-width: 26rem; height: auto; border-radius: 0.625rem; margin-top: 0.75rem; }
.panel h2 { margin-top: 1rem; }
.verdict { font: 400 1.375rem/1.3 var(--serif); color: var(--ink); max-width: 30ch; margin: 0; }

/* --- charts ----------------------------------------------------------------------------- */
.chart { width: 100%; height: auto; margin-top: 1rem; overflow: visible; }
/* On a phone a chart keeps a readable size and scrolls sideways instead of shrinking its figures. */
.chart-box { overflow-x: auto; }
.chart-box .chart { min-width: 36rem; }
.chart-box-small .chart { min-width: 23rem; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.chart .axis { font: 400 12px var(--sans); fill: var(--ink-mute); font-variant-numeric: tabular-nums; }
.chart .axis-title { font: 400 12px var(--sans); fill: var(--ink-mute); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-majority { stroke: var(--ink-mute); stroke-dasharray: 6 6; }
.chart .line-threshold { stroke: var(--ink); }
.chart .line-voi { stroke: var(--ink-soft); stroke-dasharray: 1 5; }
.chart .line-mdp { stroke: var(--ink); stroke-width: 1.25; }
.chart .pt-halo { fill: var(--paper); }
.panel .chart .pt-halo { fill: var(--paper); }
.chart .pt-fill { fill: var(--ink); }
.chart .pt-ring { fill: var(--paper); stroke: var(--ink-mute); stroke-width: 2; }
.chart .pt-closing { fill: var(--red); }
.chart .hit { fill: transparent; }
.chart .mark:hover .pt-fill, .chart .mark:hover .pt-ring { stroke: var(--ink); stroke-width: 3; }
.chart .series { font: 500 13px var(--sans); fill: var(--ink); }
.chart .leader { stroke: var(--line-strong); stroke-width: 1; }
.chart .target { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 5 5; }
.chart .target-label { fill: var(--red-deep); }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0.75rem 0 0; padding: 0; list-style: none; font-size: 0.8125rem; color: var(--ink-soft); }
.legend li { display: flex; align-items: center; gap: 0.5rem; }
.legend svg { width: 2.25rem; height: 0.875rem; margin-top: 0; overflow: visible; flex: none; }

/* --- the live view ---------------------------------------------------------------------- */
.live-state { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; color: var(--ink-mute); }
.live-state::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--ink); }
.live-state[data-state="lost"]::before { background: var(--red); }
#events tr.new td { animation: arrive 0.9s var(--ease); }
@keyframes arrive { from { background: var(--white); opacity: 0; transform: translateY(-0.375rem); } to { opacity: 1; transform: none; } }

/* --- signing in ------------------------------------------------------------------------- */
.door { min-height: 100vh; display: grid; place-items: center; padding: 2rem var(--gutter); }
.door-in { width: 100%; max-width: 22rem; }
.door .mark { font-size: 2rem; }
.door h1 { margin-top: 2.5rem; }
.door form { display: grid; gap: 1.25rem; margin-top: 1.5rem; }
.error { color: var(--red-deep); font-size: 0.875rem; margin: 0; }
.field.bad { border-color: var(--red); }

@media (min-width: 640px) {
  :root { --gutter: 2rem; }
  h1 { font-size: 1.875rem; }
  .panel > div { padding: 2.25rem; }
}
@media (min-width: 900px) {
  .split { grid-template-columns: 5fr 7fr; gap: 4rem; }
  .panel { grid-template-columns: 6fr 7fr; }
  .panel .side { border-top: 0; border-left: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .wide { display: none; }
  .top-in { gap: 0.875rem; }
  .top nav { gap: 0.875rem; font-size: 0.875rem; }
  .mark { font-size: 1.3125rem; }
  .top .pill-sm { padding: 0.5rem 0.875rem; }
  .join { grid-template-columns: 1fr; }
  .record > div { grid-template-columns: 1fr; gap: 0.125rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
