/* FastFarm Data Studio. One light theme, in the FastFarm app's own colours: white first, dark grey text,
   FastFarm green for the one thing to do and the thing that is chosen, blue only where a second colour means something.
   Spacing steps by 8px. Type is Inter, kept with the page (inter.woff2), so nothing is loaded from elsewhere. */

@font-face {
  font-family: "Inter";
  src: url("/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --green: #0a6e4f;
  --green-strong: #085a41;
  --green-tint: rgba(10, 110, 79, 0.08);
  --green-tint-2: rgba(10, 110, 79, 0.16);
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1f1f1f;
  --text-2: #4f4f4f;
  --heading: #333333;
  --muted: #6b6b6b;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.18);
  --grey: #ededed;
  --blue: #0288d1;
  --blue-text: #01639a;
  --blue-fill: #e6eef1;
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --warning: #ed6c02;
  --warning-text: #a84a00;
  --warning-bg: #fff3e0;
  --error: #d32f2f;
  --error-text: #b3261e;
  --error-bg: #fdecea;
  --r-control: 10px;
  --r-card: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.08);
  --mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { color: var(--heading); font-weight: 600; margin: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.025em; font-weight: 650; }
h2 { font-size: 1.125rem; line-height: 1.35; letter-spacing: -0.012em; }
h3 { font-size: 0.875rem; line-height: 1.4; }
p { margin: 0; }
strong { font-weight: 600; }

a { color: inherit; text-decoration: underline; text-decoration-color: rgba(0, 0, 0, 0.22); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green); text-decoration-color: currentColor; }

.muted { color: var(--muted); }
.mono { color: var(--text-2); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.nums, time, .num { font-variant-numeric: tabular-nums; }
.hint { margin-top: 6px; color: var(--muted); font-size: 0.8125rem; line-height: 1.5; }
.hint.warn { color: var(--warning-text); }
.meta { color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.lede { color: var(--text-2); max-width: 44rem; }
.eyebrow { color: var(--green); font-size: 0.8125rem; font-weight: 600; }
.person[title] { cursor: default; }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- controls */

button, input, select, textarea { font: inherit; color: inherit; }

button, a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
button:hover:not(:disabled), a.button:hover { border-color: rgba(0, 0, 0, 0.34); background: #f6f6f6; color: var(--text); }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, a.button:focus-visible { border-radius: var(--r-control); }
button.primary, a.button.primary { background: var(--green); border-color: var(--green); color: #ffffff; }
button.primary:hover:not(:disabled), a.button.primary:hover { background: var(--green-strong); border-color: var(--green-strong); color: #ffffff; }
button.primary.danger { background: var(--error); border-color: var(--error); }
button.primary.danger:hover:not(:disabled) { background: var(--error-text); border-color: var(--error-text); }
button.small { min-height: 32px; padding: 0 12px; font-size: 0.8125rem; }
button.quiet { border-color: transparent; background: none; color: var(--text-2); }
button.quiet:hover:not(:disabled) { border-color: transparent; background: var(--error-bg); color: var(--error-text); }
button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text-2);
  font-size: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.22);
  text-underline-offset: 3px;
}
button.link:hover:not(:disabled) { background: none; color: var(--green); text-decoration-color: currentColor; }
.icon-button { width: 40px; padding: 0; color: var(--text-2); }

input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  font-size: 0.9375rem;
  line-height: 1.4;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { display: block; resize: vertical; line-height: 1.5; }
select { padding-right: 28px; text-overflow: ellipsis; }
input::placeholder, textarea::placeholder { color: #9a9a9a; }
input:hover, select:hover, textarea:hover { border-color: rgba(0, 0, 0, 0.34); }
input:focus, select:focus, textarea:focus, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-tint);
  border-radius: var(--r-control);
}
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 0; padding: 0; flex: none; accent-color: var(--green); box-shadow: none; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
input[type="file"] { padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 0.875rem; cursor: pointer; }
input[type="file"]:focus, input[type="file"]:focus-visible { box-shadow: none; outline: 2px solid var(--green); outline-offset: 4px; }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font: 500 0.6875rem/16px var(--mono);
  text-align: center;
}
button.primary kbd { border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.14); color: #ffffff; }

.field { display: block; }
.field-label { display: block; margin-bottom: 4px; color: var(--text-2); font-size: 0.8125rem; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 16px; }
.actions a:not(.button) { font-size: 0.9375rem; color: var(--text-2); }
.stack { max-width: 36rem; }
.stack-wide { max-width: 48rem; }
.stack > * + *, .stack-wide > * + * { margin-top: 16px; }
.problem { color: var(--error-text); font-size: 0.875rem; }
.problem:empty, .saved:empty { display: none; }
.check { display: flex; gap: 8px; align-items: center; padding: 4px 0; font-size: 0.9375rem; cursor: pointer; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--grey);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  vertical-align: 1px;
}
td .chip { min-height: 20px; }
.chip-green { background: var(--green-tint); color: var(--green); }
.chip-info { background: var(--blue-fill); color: var(--blue-text); }
.chip-warn { background: var(--warning-bg); color: var(--warning-text); }
.chip-error { background: var(--error-bg); color: var(--error-text); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------------------------------------------------------------- frame */

.top { position: relative; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: 32px; max-width: 74rem; min-height: 56px; margin: 0 auto; padding: 0 24px; }
a.brand { color: var(--heading); font-weight: 650; letter-spacing: -0.015em; text-decoration: none; white-space: nowrap; }
a.brand:hover { color: var(--heading); }
.brand-mark { color: var(--green); }
.top nav { display: flex; gap: 24px; align-self: stretch; }
.top nav a {
  display: flex;
  align-items: center;
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: inset 0 -2px 0 transparent;
}
.top nav a:hover { color: var(--text); }
.top nav a[aria-current="page"] { color: var(--heading); font-weight: 600; box-shadow: inset 0 -2px 0 var(--green); }
.top nav a:focus-visible { outline-offset: -2px; }
.who { margin-left: auto; display: flex; gap: 12px; align-items: center; font-size: 0.875rem; }
.identity { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14rem; }
.who button.link { font-size: 0.875rem; }

main { max-width: 74rem; margin: 0 auto; padding: 32px 24px 96px; }

.view:empty::before, .loading::before, .waking::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 10px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--green);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}
.view:empty::after { content: "Loading…"; }
.view:empty, .loading { padding: 24px 0; color: var(--muted); font-size: 0.9375rem; }
.plain-note { padding: 32px 24px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Both stay in view while the page scrolls: an error must be seen from wherever it was caused. */
.banner, .waking { position: sticky; top: 0; z-index: 3; }
.banner {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 24px;
  background: var(--error-bg);
  border-bottom: 1px solid rgba(211, 47, 47, 0.3);
  color: var(--error-text);
  font-size: 0.9375rem;
}
.banner span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--error); }
.banner button.link { color: var(--error-text); flex: none; }
/* A new version of the page is out: one quiet line, never in the way. */
.reload-bar { position: sticky; top: 0; z-index: 4; display: flex; gap: 12px; justify-content: center; align-items: baseline;
  padding: 8px 24px; background: var(--green-tint); border-bottom: 1px solid var(--line); color: var(--text); font-size: 0.875rem; }
.reload-bar[hidden] { display: none; }
.reload-bar button.link { color: var(--green); font-weight: 600; }
.waking { margin: 0; padding: 10px 24px; background: var(--blue-fill); color: var(--blue-text); font-size: 0.875rem; font-weight: 500; text-align: center; }
.waking::before { border-color: rgba(2, 136, 209, 0.25); border-top-color: var(--blue); }

.dialog {
  width: min(32rem, calc(100vw - 32px));
  padding: 24px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dialog h2 { margin-bottom: 12px; }
.dialog p { margin-top: 8px; color: var(--text-2); font-size: 0.9375rem; overflow-wrap: anywhere; }
.dialog .actions { justify-content: flex-end; margin-top: 24px; }
.dialog::backdrop { background: rgba(31, 31, 31, 0.4); }

/* ---------------------------------------------------------------- page pieces */

.page-head { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.crumb { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; color: var(--muted); font-size: 0.8125rem; }
.crumb a { text-decoration: none; color: var(--muted); }
.crumb a:hover { color: var(--green); }
.crumb-sep { color: var(--line-strong); }
.dataset-head h1 { overflow-wrap: anywhere; }
.dataset-head .lede { margin-top: 8px; }
.tabs { display: flex; gap: 24px; margin: 24px 0 32px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 10px 0;
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
}
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--heading); font-weight: 600; box-shadow: inset 0 -2px 0 var(--green); }
.tabs a:focus-visible { outline-offset: -2px; }
.shelf-tabs { margin-top: 0; }
.tab-count { margin-left: 8px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.shelf-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 8px 0; }
.shelf-empty p { margin: 0; }
.total.busy { color: var(--muted); }
.total.busy::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border: 2px solid var(--line-strong);
  border-top-color: var(--green); border-radius: 50%; vertical-align: -1px; animation: spin 0.8s linear infinite; }

.section { margin-top: 48px; }
.section-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head + .hint { margin: -6px 0 12px; }
.title-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 16px; }
.title-row .row-actions { margin-left: auto; font-size: 0.875rem; }
.title-row h2 { font-size: 1.375rem; letter-spacing: -0.02em; }

.stats { display: flex; flex-wrap: wrap; gap: 24px 48px; margin: 0; }
.stat { display: flex; flex-direction: column; min-width: 0; }
.stat dt { order: 2; color: var(--text-2); font-size: 0.8125rem; }
.stat dd { margin: 0; }
.stat-figure { order: 1; color: var(--heading); font-size: 1.75rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.stat-sub { order: 3; color: var(--muted); font-size: 0.75rem; }
.overview-top { display: flex; flex-wrap: wrap; gap: 24px 48px; align-items: center; justify-content: space-between; }
.overview-top + div .meta { margin-top: 16px; }

.card { padding: 24px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); min-width: 0; }
.card > h2 { margin-bottom: 4px; }

/* ---------------------------------------------------------------- tables */

/* Rows are divided by hairlines that stop at the text; the hover tint reaches 12px further out on both sides. */
.table-wrap { margin: 0 -12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; line-height: 1.5; }
th, td { padding: 12px; text-align: left; vertical-align: top; }
tr { background: linear-gradient(var(--line), var(--line)) 12px 100% / calc(100% - 24px) 1px no-repeat; }
thead th { padding-top: 8px; padding-bottom: 8px; color: var(--muted); font-size: 0.75rem; font-weight: 500; white-space: nowrap; }
tbody tr:last-child { background-image: none; }
tbody tr { transition: background-color 0.1s; }
tbody tr:hover { background-color: rgba(0, 0, 0, 0.03); }
tr.opens { cursor: pointer; }
tr.opens:hover { background-color: var(--green-tint); }
td:first-child, th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
td:last-child, th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.num { text-align: right; white-space: nowrap; }
.row-main { min-width: 10rem; }
.row-title { color: var(--heading); font-weight: 600; text-decoration: none; }
a.row-title:hover { color: var(--green); text-decoration: underline; }
.row-sub { color: var(--muted); font-size: 0.8125rem; }
.row-sub.needs { color: var(--warning-text); }
.row-sub.ready { color: var(--success); font-weight: 500; }
.row-actions { display: flex; gap: 4px 16px; justify-content: flex-end; font-size: 0.8125rem; white-space: nowrap; }
.nums { white-space: nowrap; }
.row-actions a, .row-actions button.link { color: var(--text-2); font-weight: 500; text-decoration-color: transparent; }
.row-actions a:hover, .row-actions button.link:hover:not(:disabled) { color: var(--green); text-decoration-color: currentColor; }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-width: 28rem; }
.source-path { overflow-wrap: anywhere; }
.none, .section > .muted { padding: 4px 0; font-size: 0.9375rem; }
.total { margin: 0 0 8px; color: var(--text-2); font-size: 0.875rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.pager { display: flex; gap: 16px; align-items: center; margin-top: 16px; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.pager button { min-height: 32px; padding: 0 12px; font-size: 0.8125rem; }

.progress-cell { display: inline-flex; gap: 10px; align-items: center; white-space: nowrap; color: var(--text-2); }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--grey); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--grey); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--green); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--green); border-radius: 999px; }
progress.meter { width: 56px; height: 4px; }

.tally { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--text-2); }
.tally-part { white-space: nowrap; }
.tally-part::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #b9b9b9; vertical-align: 1px; }
.tally-part.from-person::before { background: var(--green); }
.tally-part.from-data::before, .tally-part.from-labeler::before { background: var(--blue); }
.tally-part.from-labeler::before { opacity: 0.55; }
.tally-part.from-conflict::before { background: var(--warning); }

.facts { margin: 0; }
.facts div { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.facts div:last-child { border-bottom: 0; }
.facts dt { flex: 0 0 9rem; color: var(--muted); font-size: 0.8125rem; padding-top: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.facts dd div { display: block; padding: 0; border: 0; }
.plain-list { margin: 0; padding: 0; list-style: none; }

.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-text.guidelines { max-width: 48rem; padding: 16px 20px; border-left: 2px solid var(--green); border-radius: 0 var(--r-card) var(--r-card) 0; background: var(--surface); color: var(--text-2); font-size: 0.9375rem; }
.note-text.guidelines + .meta { margin-top: 8px; }
.code {
  margin: 8px 0 0;
  padding: 12px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--bg);
  font: 0.8125rem/1.55 var(--mono);
}
.quote { margin: 8px 0; padding: 8px 16px; border-left: 2px solid var(--green); color: var(--text); font-size: 0.9375rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.build { margin-top: 24px; max-width: 52rem; }
.state + .build:not(:has(.card)) { display: flex; flex-direction: column; align-items: center; max-width: none; margin-top: -24px; }
.build .stats { margin: 20px 0; }
.build h3 { margin: 24px 0 4px; }
.build .stack { margin-top: 24px; }

details > summary { cursor: pointer; color: var(--text-2); font-size: 0.875rem; font-weight: 500; }
details > summary:hover { color: var(--green); }
.explain { margin-top: 12px; }
.explain-body { max-width: 40rem; padding: 8px 0 0 16px; color: var(--text-2); font-size: 0.875rem; }

/* ---------------------------------------------------------------- states: empty, problem, saved */

.state { max-width: 30rem; margin: 48px auto; text-align: center; }
.state-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 50%; background: var(--green-tint); }
.state-icon::before {
  content: "";
  width: 18px;
  height: 14px;
  background:
    linear-gradient(var(--green), var(--green)) 0 0 / 18px 2px no-repeat,
    linear-gradient(var(--green), var(--green)) 0 6px / 18px 2px no-repeat,
    linear-gradient(var(--green), var(--green)) 0 12px / 10px 2px no-repeat;
}
.problem-state .state-icon { background: var(--error-bg); }
.problem-state .state-icon::before { content: "!"; width: auto; height: auto; background: none; color: var(--error); font-weight: 700; font-size: 1.25rem; line-height: 1; }
.state-title { color: var(--heading); font-size: 1.125rem; font-weight: 600; letter-spacing: -0.012em; }
.state-line { margin-top: 6px; color: var(--muted); font-size: 0.9375rem; }
.state p + p:has(.button), .state p + p:has(button) { margin-top: 20px; }
.state .actions { justify-content: center; margin-top: 20px; }
.plain-state { margin-top: 20vh; }

.problem-box { margin: 16px 0; padding: 12px 16px; border-radius: var(--r-control); background: var(--error-bg); color: var(--error-text); font-size: 0.9375rem; }
.problem-box.warn { background: var(--warning-bg); color: var(--warning-text); }
.problem-box ul { margin: 4px 0 0; padding-left: 20px; }
.problem-box .actions { margin-top: 12px; }
.problems { max-height: 22rem; margin: 8px 0; padding-left: 20px; overflow-y: auto; font-size: 0.875rem; color: var(--text-2); }
.problems li { margin: 4px 0; overflow-wrap: anywhere; }
.form-title { color: var(--heading); font-weight: 600; }
.problem-box .form-title { color: inherit; }
.saved { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin: 0 0 16px; padding: 10px 16px; border-radius: var(--r-control); background: var(--success-bg); color: #1e5a22; font-size: 0.875rem; }
.saved p { margin: 0; }
.saved button.link { color: inherit; }

/* ---------------------------------------------------------------- forms on a page */

.small-form { margin-top: 48px; padding: 24px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: 0 0 0 4px var(--green-tint); }
.small-form .form-title { font-size: 1.125rem; letter-spacing: -0.012em; }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 16px; }
.edit-row { display: grid; grid-template-columns: repeat(3, minmax(9rem, 1fr)) auto; gap: 12px; align-items: end; margin: 12px 0; max-width: 52rem; }
.edit-row > button { margin-bottom: 10px; }
.editor { padding: 24px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.editor > * + * { margin-top: 16px; }
.editor-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.editor-head h3 { font-size: 1rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 12px 16px; align-items: end; }
.filters.compact { display: flex; flex-wrap: wrap; gap: 12px; }
.filters.compact .field { display: flex; align-items: center; gap: 8px; }
.filters.compact .field-label { margin: 0; color: var(--muted); white-space: nowrap; }
.filters.compact select { width: auto; max-width: 15rem; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 0.875rem; }
.filter-form { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; margin: 0 0 32px; }
.filter-form > .filters { flex: 1 1 36rem; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.filter-form > .actions { margin: 0; }
.filter-form > div:not(.filters):not(.actions) { order: 3; flex-basis: 100%; }
.filter-form > div:empty, .filter-form > .problem:empty { display: none; }
.filter-form > .problem { order: 4; flex-basis: 100%; }
.condition { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 8px; max-width: 48rem; }
.condition select, .condition input { width: auto; flex: 1 1 9rem; min-width: 0; }
.condition + .field { max-width: 14rem; margin-top: 12px; }

/* ---------------------------------------------------------------- new dataset and ingest */

.steps { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; counter-reset: step; font-size: 0.875rem; }
.steps li { counter-increment: step; }
.steps a { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-weight: 500; text-decoration: none; }
.steps a::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--grey);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.steps a:hover { color: var(--text); }
.steps li.done a::before { background: var(--green-tint-2); color: var(--green); }
.steps li[aria-current="step"] a { color: var(--heading); font-weight: 600; }
.steps li[aria-current="step"] a::before { background: var(--green); color: #ffffff; }
.wizard > h2 { margin: 2px 0 20px; font-size: 1.375rem; letter-spacing: -0.02em; }
.wizard .lede { margin-bottom: 20px; font-size: 0.9375rem; }
.wizard h3 { margin: 32px 0 4px; font-size: 1rem; }
.wizard p:has(> button) { margin-top: 12px; }
.wizard-nav { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.wizard-nav button.link { margin-left: auto; }
.dropzone { max-width: 36rem; padding: 20px; border: 1px dashed var(--line-strong); border-radius: var(--r-card); background: var(--surface); transition: border-color 0.12s, box-shadow 0.12s; }
.dropzone.over { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-tint); }
.file-line { margin: 32px 0 8px; font-size: 0.9375rem; }
.file-line + .section { margin-top: 24px; }
table.columns th[scope="row"] { color: var(--heading); font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
table.columns td { vertical-align: middle; }
table.columns select, table.columns input { min-width: 9rem; }
table.columns .field-label { font-size: 0.75rem; }
.samples { color: var(--muted); font-size: 0.8125rem; max-width: 16rem; overflow-wrap: anywhere; }
.review-list { padding: 8px 24px; }
.ingest-run { max-width: 40rem; }
.ingest-run progress { margin: 16px 0 8px; }
.ingest-run .saved { margin-top: 16px; }

/* ---------------------------------------------------------------- a record and its answers */

.review-bar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; margin-bottom: 16px; }
.review-bar .filters { margin-left: auto; }
.review-bar .icon-button { min-height: 36px; width: 36px; }
.review-bar > a.back + .icon-button { margin-left: auto; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 0.875rem; font-weight: 500; text-decoration: none; }
.back::before { content: "←"; }
.position { color: var(--text-2); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.position-count { color: var(--heading); font-size: 1.375rem; font-weight: 600; letter-spacing: -0.02em; margin-right: 2px; }
.position-now strong { color: var(--heading); }
.session { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }
.slot[inert] { opacity: 0.55; transition: opacity 0.15s; }
.why { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 12px; color: var(--muted); font-size: 0.875rem; }

.shortcuts { margin: 0 0 16px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); font-size: 0.875rem; }
.shortcuts dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 6px 32px; margin: 0; }
.shortcuts dl div { display: flex; gap: 12px; align-items: baseline; }
.shortcuts dt { flex: 0 0 3.5rem; }
.shortcuts dd { margin: 0; color: var(--text-2); }
.shortcuts .hint { margin-top: 12px; }

.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(21rem, 27rem); gap: 24px; align-items: start; }
.record-key { margin-bottom: 8px; font-size: 1.125rem; letter-spacing: -0.012em; overflow-wrap: anywhere; }
.record-key .label { color: var(--muted); font-size: 0.8125rem; font-weight: 500; letter-spacing: 0; }
.record-key strong { color: var(--heading); }
.fields-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 20px 32px; margin-top: 20px; }
.fv { min-width: 0; }
.fv.wide { grid-column: 1 / -1; }
.fv h3 { margin-bottom: 2px; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.fv .hint { margin-top: 2px; font-size: 0.75rem; }
.field-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.fv.wide .field-text { max-width: 42rem; font-size: 1.0625rem; line-height: 1.6; }
.field-number { color: var(--heading); font-size: 1.375rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.field-empty { color: #a3a3a3; }
.field-image { display: block; max-width: 100%; max-height: 28rem; margin-top: 4px; border-radius: var(--r-control); }
.field-frame { width: 100%; height: 30rem; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--bg); }
.uri { overflow-wrap: anywhere; font: 0.8125rem var(--mono); }

/* The panel stays in view on a tall record; its own content scrolls, with the save row always in reach. */
.side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); min-width: 0; }
.fold { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.fold .note-text { padding: 8px 0 4px; color: var(--text-2); font-size: 0.875rem; }
.answers { min-width: 0; }
.answers:focus { outline: none; }
.flag { margin: 16px 20px 0; padding: 12px 16px; border-radius: var(--r-control); background: var(--warning-bg); color: var(--warning-text); font-size: 0.875rem; }
.flag strong { color: #7a3600; }
.flag-hint { margin-top: 2px; font-size: 0.8125rem; }
.flag button.link { color: inherit; font-weight: 600; }
.question { padding: 20px; border-bottom: 1px solid var(--line); box-shadow: inset 3px 0 0 transparent; transition: box-shadow 0.12s; }
.question.active { box-shadow: inset 3px 0 0 var(--green); }
.question h3 { color: var(--heading); font-size: 1rem; font-weight: 600; line-height: 1.4; }
.question > .hint { margin-top: 4px; }
.no-questions { padding: 20px; font-size: 0.9375rem; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; border-radius: var(--r-control); }
.choices:focus { outline: none; }
.choices:focus-visible { outline: 2px solid var(--green-tint-2); outline-offset: 5px; border-radius: var(--r-control); }
.choice, .choices .check {
  justify-content: flex-start;
  gap: 8px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: left;
  white-space: normal;
  overflow-wrap: break-word;
  flex: 1 1 auto;
  min-width: 0;
}
.choices .check { display: flex; align-items: center; }
.choices .check:hover { border-color: rgba(0, 0, 0, 0.34); background: #f6f6f6; }
.choice[aria-pressed="true"], .choices .check:has(input:checked) {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
  background: var(--green-tint);
  color: var(--green);
  font-weight: 600;
}
.choice[aria-pressed="true"]:hover:not(:disabled) { border-color: var(--green); background: var(--green-tint-2); color: var(--green); }
.choice[aria-pressed="true"] kbd { border-color: var(--green-tint-2); color: var(--green); }
.choices > .muted { flex-basis: 100%; font-size: 0.875rem; }
.question > input, .question > textarea { margin-top: 12px; }
.q-meta:empty { display: none; }
.q-meta { margin-top: 12px; }
.origin { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: 0.8125rem; white-space: pre-wrap; }
.origin + .origin { margin-top: 6px; }
.origin .person { color: var(--text-2); font-weight: 500; }
.confirm { padding: 0; font-size: 0.8125rem; color: var(--text-2); }
.confirm input[type="checkbox"] { width: 16px; height: 16px; }
.sources { margin: 12px 0 0; padding: 0; list-style: none; border-top: 1px dashed var(--line-strong); font-size: 0.875rem; }
.source { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; align-items: baseline; padding: 10px 0 0; overflow-wrap: anywhere; }
.source.marked { margin: 10px -8px 0; padding: 8px; border-radius: 8px; background: var(--blue-fill); }
.source-value { color: var(--heading); font-size: 0.9375rem; }
.source-by { grid-column: 1 / -1; color: var(--muted); font-size: 0.8125rem; }
.source-who { color: var(--text-2); font-weight: 500; }
.source .use { gap: 6px; display: inline-flex; align-items: center; font-size: 0.8125rem; font-weight: 600; color: var(--green); text-decoration: none; }
.source .use:hover:not(:disabled) { text-decoration: underline; }

/* The save row stays at the bottom of the panel (of the window on a phone), however long the record is. */
.answer-bar { position: sticky; bottom: 0; z-index: 1; padding: 16px 20px 20px; background: var(--surface); border-top: 1px solid var(--line); margin-top: -1px; }
.signing { font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.signing ul { margin: 6px 0 0; padding: 0; list-style: none; }
.signing li { padding: 3px 0; }
.signing li strong { color: var(--heading); }
.sign-q, .sign-a { display: block; }
.sign-a { color: var(--text-2); }
.sign-head .person { color: var(--text-2); font-weight: 500; }
.sign-left { margin-top: 4px; color: var(--warning-text); }
.signing + .problem, .answer-bar > .problem { margin-top: 8px; }
.note-input { margin-top: 12px; min-height: 36px; font-size: 0.875rem; }
.answer-bar .actions { margin-top: 12px; flex-wrap: nowrap; }
.answer-bar .save { flex: 1 1 auto; min-height: 44px; }
.answer-bar .actions button:not(.save) { min-height: 44px; padding: 0 12px; }
.discard-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.discard-form > * + * { margin-top: 12px; }
.discard-form .actions { flex-wrap: wrap; }

/* ---------------------------------------------------------------- charts */

.chart { width: 100%; margin-top: 4px; overflow: hidden; }
.chart svg { display: block; }
.chart text { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.ch-axis { stroke: rgba(0, 0, 0, 0.28); stroke-width: 1; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-line { fill: none; stroke: var(--green); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-point { fill: var(--surface); stroke: var(--green); stroke-width: 1.5; }
.ch-band { fill: var(--blue-fill); stroke: var(--blue); stroke-width: 1; }
.ch-median { stroke: var(--blue); stroke-width: 2; }
.ch-value-line { stroke: var(--text); stroke-width: 1.5; }
.ch-value { fill: var(--text); stroke: var(--surface); stroke-width: 2; }
.chart .ch-value-label { font-size: 13px; font-weight: 700; fill: var(--text); }
.ch-point.faint { fill: var(--surface); stroke: var(--blue); stroke-opacity: 0.55; }
.ch-peak { fill: none; stroke: var(--text); stroke-width: 1.5; }
.ch-mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }

/* ---------------------------------------------------------------- a version */

.decision { margin: -8px 0 20px; color: var(--text-2); font-size: 0.9375rem; }
.title-row + .problem { margin: -8px 0 20px; }
.title-row + .stats { margin-bottom: 20px; }
.section .stats { margin-bottom: 8px; }
.section h3 { margin: 24px 0 4px; }

/* ---------------------------------------------------------------- the sign-in page */

.landing {
  min-height: 100vh;
  max-width: 68rem;
  margin: 0 auto;
  padding: 32px clamp(24px, 6vw, 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  align-items: center;
  gap: clamp(32px, 8vw, 96px);
  background: var(--surface);
  box-shadow: 0 0 0 100vmax var(--surface);
  clip-path: inset(0 -100vmax);
}
.landing h1 { font-size: clamp(2.75rem, 6vw, 4.5rem); line-height: 1; letter-spacing: -0.045em; font-weight: 650; color: var(--heading); }
.landing-brand { display: block; margin-bottom: 16px; color: var(--green); font-size: 1.125rem; line-height: 1.2; letter-spacing: -0.01em; font-weight: 650; }
.landing-product { display: block; }
.landing .problem { margin-top: 24px; max-width: 26rem; font-size: 0.9375rem; }
.landing-button {
  margin-top: 40px;
  gap: 12px;
  min-height: 52px;
  padding: 0 24px 0 12px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--green);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
}
.landing-button:hover:not(:disabled) { background: var(--green-strong); color: #ffffff; }
.landing-button:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.g-mark { width: 32px; height: 32px; padding: 7px; border-radius: 7px; background: #ffffff; flex: none; }

.sheet { display: grid; gap: 12px; }
.sheet-row { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.sheet-thumb { width: 40px; height: 40px; border-radius: 8px; background: var(--grey); flex: none; }
.sheet-row.a .sheet-thumb { background: var(--green-tint-2); }
.sheet-row.b .sheet-thumb { background: var(--blue-fill); }
.sheet-row.c .sheet-thumb { background: var(--green); }
.sheet-lines { display: grid; gap: 8px; flex: 1; }
.sheet-line { height: 8px; width: 78%; border-radius: 999px; background: var(--grey); }
.sheet-line.short { width: 46%; background: #f3f3f3; }
.sheet-mark { width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 50%; flex: none; }
.sheet-row.done .sheet-mark { position: relative; border-color: var(--green); background: var(--green); }
.sheet-row.done .sheet-mark::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #ffffff; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.sheet-row.done .sheet-line { background: #e3e3e3; }
.sheet-row.now { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-tint); }
.sheet-row.now .sheet-mark { border-color: var(--green); }

/* ---------------------------------------------------------------- the steps of a dataset */

/* The header: title and description on the left, three numbers on the right; the steps are the tabs under it. */
.head-row { display: flex; flex-wrap: wrap; gap: 16px 40px; align-items: flex-start; justify-content: space-between; }
.head-main { flex: 1 1 28rem; min-width: 0; }
.head-main .head-title { gap: 4px 12px; align-items: baseline; }
.quiet-edit { color: var(--muted) !important; font-size: 0.8125rem !important; text-decoration-color: transparent !important; }
.quiet-edit:hover { color: var(--green) !important; }
.head-main .small-form { margin-top: 0; }
.head-numbers { display: flex; gap: 28px; margin: 6px 0 0; }
.head-numbers div { display: flex; flex-direction: column; align-items: flex-end; }
.head-numbers dd { margin: 0; color: var(--heading); font-size: 1.25rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.head-numbers dt { color: var(--muted); font-size: 0.75rem; }
.dataset-head .strip { margin-top: 12px; gap: 6px 24px; font-size: 0.75rem; }
.dataset-head .strip .chip { font-size: 0.75rem; }

/* Done is a small green tick before the name; the open step is underlined; a step that does not exist yet is grey. */
.step-tabs a::before, .tab-off::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  vertical-align: -2px;
  box-sizing: border-box;
}
.step-tabs a.done::before {
  content: "✓";
  width: 16px;
  height: 16px;
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
  vertical-align: -3px;
}
.tab-off { padding: 10px 0; color: #b0b0b0; font-size: 0.9375rem; font-weight: 500; white-space: nowrap; cursor: default; }
.tab-off::before { border-style: dashed; border-color: #cfcfcf; }

/* The bar above a step's content: what is there on the left, its one or two quiet ways elsewhere on the right. */
.bar-end { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.review-bar .filters + .bar-end { margin-left: 0; }
a.button.small { min-height: 32px; padding: 0 12px; font-size: 0.8125rem; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warning); color: #ffffff; font-size: 0.6875rem; font-weight: 700; }
/* Records: search, filter and sort over a table as wide as the dataset; only the table scrolls sideways. */
.records-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 16px; }
.records-bar .search { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
.records-bar button.on { border-color: var(--green); color: var(--green); }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: -4px 0 16px; }
.filter-chip { display: inline-flex; align-items: center; gap: 2px; min-height: 28px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--green-tint); color: var(--green-strong); font-size: 0.8125rem; font-weight: 500; }
button.chip-x { min-height: 24px; width: 24px; padding: 0; border: 0; border-radius: 999px; background: none; color: inherit; font-size: 1rem; font-weight: 500; }
button.chip-x:hover:not(:disabled) { background: rgba(10, 110, 79, 0.14); color: inherit; }
.filter-chips button.link { font-size: 0.8125rem; }
.filter-panel { margin: 0 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row select, .filter-row input { width: auto; flex: 1 1 10rem; min-width: 0; min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
.filter-row > .problem { flex-basis: 100%; }
.filter-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 12px 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.filter-more .field { min-width: 0; }
.filter-more select { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 0.875rem; }
.records-results[aria-busy="true"] { opacity: 0.5; transition: opacity 0.15s 0.1s; }
.records-table table { width: auto; min-width: 100%; }
.records-table th, .records-table td { white-space: nowrap; }
.records-table td.cell { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; }
.records-table thead th { vertical-align: middle; }
.records-table th.sortable { padding-top: 4px; padding-bottom: 4px; }
.records-table button.sort { gap: 4px; min-height: 0; margin: 0 -6px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.records-table button.sort:hover:not(:disabled) { background: rgba(0, 0, 0, 0.05); color: var(--text); }
.records-table th[aria-sort] button.sort { color: var(--text); font-weight: 600; }
.records-table .arrow { min-width: 0.6em; color: var(--green); }
.records-table th.num button.sort { flex-direction: row-reverse; }
.upload-finish { max-width: 36rem; margin-top: 32px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: -8px 0 24px; }
.fold-plain { margin-top: 48px; }
.fold-plain > summary { font-size: 0.9375rem; }
.fold-plain[open] > summary { margin-bottom: 12px; }
.fold-plain .section { margin-top: 32px; }
.fold-actions { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.source-meta { margin-top: 8px; }

/* ---------------------------------------------------------------- catalog, a source, shaping a query */

.search { width: 18rem; max-width: 100%; }
.catalog > .section:first-child { margin-top: 8px; }
.catalog table { table-layout: fixed; }
.catalog th:not(:first-child) { width: 9rem; }
.source-head { align-items: flex-start; }
.source-head > div { flex: 1 1 20rem; min-width: 0; }
.source-head .lede { margin-top: 8px; }
.rows table { width: auto; min-width: 100%; }
.rows th, .rows td { white-space: nowrap; }
.rows .table-wrap { max-height: 27rem; overflow: auto; }
.rows thead th { position: sticky; top: 0; z-index: 1; border-radius: 0; background: var(--bg); box-shadow: inset 0 -1px 0 var(--line); }

.shape { display: grid; grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); gap: 32px; align-items: start; }
.shape > * { min-width: 0; }
.shape-builder { padding: 20px; transition: opacity 0.15s; }
.shape-builder[inert] { opacity: 0.45; }
.shape-part + .shape-part { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.part-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 32px; margin-bottom: 8px; }
.part-actions { display: flex; gap: 16px; font-size: 0.8125rem; }
.checklist { max-height: 18.75rem; margin: 0 -8px; padding: 0 8px; overflow-y: auto; }
.checklist .check { gap: 10px; padding: 5px 0; font-size: 0.875rem; }
.check-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-type { margin-left: auto; color: var(--muted); font-size: 0.75rem; }
.check:has(input:disabled) { color: #a3a3a3; cursor: default; }
.shape-filter { display: grid; grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) 40px; gap: 8px; margin-bottom: 16px; }
.shape-filter > select:first-child { grid-column: 1 / 3; }
.shape-filter > input { grid-column: 2 / 4; }
.shape-filter .icon-button { font-size: 1.125rem; font-weight: 400; }
.shape-part > .problem { margin-top: 8px; }
.join-on { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; align-items: center; margin: 8px 0 12px; }
.join-on > select:first-child { grid-column: 1 / -1; }
.join-on > span { text-align: center; }
textarea.sql { font: 0.8125rem/1.6 var(--mono); white-space: pre; overflow-x: auto; tab-size: 2; }
.hand-note { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 10px; font-size: 0.875rem; }
.run-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; }
.run-row + .problem { margin-top: 12px; }
.query-result { margin-top: 20px; transition: opacity 0.15s; }
.query-result.stale { opacity: 0.45; }
.finish { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 16px; align-items: end; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.finish.short { grid-template-columns: minmax(0, 18rem) auto auto 1fr; }
.finish.short a { padding-bottom: 9px; color: var(--text-2); font-size: 0.9375rem; }
.finish input[readonly] { background: var(--bg); color: var(--text-2); }
.finish + .problem { margin-top: 12px; }

.head-actions { display: flex; gap: 12px; margin-left: auto; }
.source-facts { margin-top: 16px; max-width: 48rem; }
.run-error { min-width: 14rem; max-width: 30rem; margin-top: 4px; }

/* ---------------------------------------------------------------- external data: register, copies, join kinds */

.head-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.title-line { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.title-line > span:empty { display: none; }
.source-head + .problem { margin: -8px 0 20px; }
.section .source-facts { margin-top: 0; }
.source-head > .head-actions { flex: none; }
.register .choices .check { flex: 1 1 12rem; }
.register textarea { min-height: 5.5rem; }
.stack-tight > * + * { margin-top: 16px; }
.kind-pick { margin: 12px 0 4px; }
.kind-pick .check { gap: 10px; padding: 4px 0; font-size: 0.875rem; }
.join-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; margin: 12px 0; }
.join-grid select { padding-left: 10px; padding-right: 22px; font-size: 0.875rem; }
.grid-head { overflow: hidden; color: var(--muted); font-size: 0.75rem; text-overflow: ellipsis; white-space: nowrap; }
.grid-label { color: var(--text-2); font-size: 0.8125rem; }
.join-grid .km { display: flex; gap: 8px; align-items: center; grid-column: 2 / 4; }
.join-grid .km input { width: 6rem; }
.join-grid + .problem { margin: -4px 0 12px; }

/* ---------------------------------------------------------------- the map, the List / Map switch, the lineage strip */

/* Cards are white on the page grey, lines a thin neutral grey. Colour appears only on the chain of the card under the
   pointer or the keyboard: that card, its sources and what is made from it turn green, everything else fades. */
.head-title { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; min-width: 0; }
.switch { display: inline-flex; padding: 3px; border-radius: var(--r-control); background: var(--grey); }
.switch a { padding: 3px 14px; border-radius: 8px; color: var(--text-2); font-size: 0.875rem; font-weight: 500; line-height: 1.6; text-decoration: none; }
.switch a:hover { color: var(--text); }
.switch a[aria-current="page"] { background: var(--surface); color: var(--green); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.owner-pick { width: auto; max-width: 12rem; }

.map { min-width: 0; }
.map-canvas { display: block; overflow: visible; font-family: inherit; }
.map-canvas a { text-decoration: none; }
.map-head { fill: var(--muted); font-size: 12px; font-weight: 500; }
.map-count { fill: #a3a3a3; color: #a3a3a3; font-weight: 400; font-variant-numeric: tabular-nums; }
.map-rule { stroke: var(--line); stroke-width: 1; }
.map-none { fill: #a3a3a3; font-size: 13px; }
.map-line { fill: none; stroke: rgba(0, 0, 0, 0.16); stroke-width: 1; transition: opacity 0.12s, stroke 0.12s; }
.map-node { cursor: pointer; outline: none; transition: opacity 0.12s; }
.map-node:focus-visible { outline: none; }
.map-card { fill: var(--surface); stroke: rgba(0, 0, 0, 0.12); stroke-width: 1; transition: stroke 0.12s, fill 0.12s; }
.map-title { fill: var(--heading); font-size: 13px; font-weight: 600; }
.map-sub { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.map-sub.bad { fill: var(--error-text); }
.map-node:hover .map-card { stroke: rgba(0, 0, 0, 0.3); }
.map-fold .map-card { fill: none; stroke: var(--line-strong); stroke-dasharray: 3 3; }
.map-unused .map-card { fill: var(--surface); stroke-dasharray: none; }
.map-fold-text { fill: var(--text-2); font-size: 13px; font-weight: 500; }
.map-fold-side { fill: var(--muted); font-size: 12px; }
.map-fold:hover .map-fold-text, .map-fold:hover .map-fold-side { fill: var(--green); }
.map-hit { fill: transparent; }
.map-plain-text { fill: var(--text-2); font-size: 13px; font-weight: 400; }
.map-plain:hover .map-plain-text { fill: var(--green); }
.map-plain:hover .map-hit, .map-plain:focus-visible .map-hit { fill: var(--green-tint); }

.dim .map-node:not(.chain) { opacity: 0.3; }
.dim .map-line:not(.chain) { opacity: 0.3; }
.map-line.chain { stroke: var(--green); stroke-width: 1.5; }
.map-node.chain .map-card { stroke: var(--green); }
.map-node.on .map-card { fill: #f3f8f6; stroke: var(--green); stroke-width: 2; }
.map-node:focus-visible .map-card { stroke: var(--green); stroke-width: 2; }
.map-node.chain .map-plain-text { fill: var(--green); }

.map-part + .map-part { margin-top: 32px; }
.map-part h2 { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; font-size: 1rem; }
.map-part h2 .map-count { font-size: 0.875rem; }
.map-row { padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.map-row:last-child { border-bottom: 0; }
.map-row.plain { padding: 6px 0 6px 12px; border-bottom: 0; font-size: 0.875rem; }
.map-row.plain .row-title { font-weight: 400; color: var(--text-2); }
.map-row .row-sub.bad { color: var(--error-text); }
.map-to { color: var(--text-2); }

.strip { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: center; margin-top: 20px; font-size: 0.8125rem; }
.strip-part { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.strip-label { margin-right: 4px; color: var(--muted); }
.strip a.chip { text-decoration: none; }
.strip a.chip:hover { background: var(--green-tint); color: var(--green); }
.strip-map { color: var(--text-2); font-weight: 500; }
.title-row + p + .strip { margin: -4px 0 24px; }

/* ---------------------------------------------------------------- change layers: derived columns and corrections */

/* A derived column: a small green ƒ on its header and a faint green tint on its cells. A corrected value: a small blue
   dot; its detail shows in one dark box while the pointer or the keyboard is on it. */
.fx { color: var(--green); font-style: italic; font-weight: 600; }
.records-table th.derived, .records-table td.derived { background-color: rgba(10, 110, 79, 0.045); }
.records-table th.derived { border-radius: 8px 8px 0 0; }
.records-table td.derived { border-radius: 0; }
.records-table th.derived button.sort { color: var(--green-strong); }
td.corrected::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--blue); vertical-align: 2px; }
td.num.corrected { position: relative; }
td.num.corrected::after { position: absolute; top: 12px; right: 2px; margin: 0; }
td.corrected:focus-visible { outline-offset: -2px; border-radius: 6px; }
.cell-tip {
  position: fixed;
  z-index: 10;
  max-width: 22rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1f1f1f;
  color: #ffffff;
  font-size: 0.8125rem;
  line-height: 1.4;
  pointer-events: none;
  box-shadow: var(--shadow);
}

/* The Original / With changes switch and the Changes button share the bar's height. */
.records-bar .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--green-tint); color: var(--green); font-size: 0.75rem; font-weight: 600; }
.records-bar button.small { gap: 6px; }

.change-list { margin: 0; padding: 0; list-style: none; }
.change-line { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.section .change-line:last-child, .side-panel .change-line:last-child { border-bottom: 0; }
.change-main { min-width: 0; }
.change-what { color: var(--text); font-size: 0.9375rem; overflow-wrap: anywhere; }
.change-what strong { color: var(--heading); }
.change-what .gone { color: var(--muted); text-decoration: line-through; }
.change-line .row-sub { overflow-wrap: anywhere; }
.change-line > button { flex: none; }

/* An on/off switch: a pill with a knob, green when on. */
button.toggle { position: relative; width: 40px; min-height: 0; height: 22px; padding: 0; border: 0; border-radius: 999px; background: #c9c9c9; flex: none; }
button.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: left 0.12s; }
button.toggle:hover:not(:disabled) { background: #b5b5b5; }
button.toggle[aria-checked="true"], button.toggle[aria-checked="true"]:hover:not(:disabled) { background: var(--green); }
button.toggle[aria-checked="true"]::after { left: 21px; }
button.toggle:focus-visible { border-radius: 999px; }

/* "Original data": a quiet switch with its words, in the toolbar. */
button.quiet-switch { gap: 8px; min-height: 32px; padding: 0 6px; border-color: transparent; background: none; color: var(--muted); font-size: 0.8125rem; font-weight: 500; }
button.quiet-switch:hover:not(:disabled) { border-color: transparent; background: none; color: var(--text); }
button.quiet-switch .knob { position: relative; width: 28px; height: 16px; border-radius: 999px; background: #c9c9c9; flex: none; }
button.quiet-switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #ffffff; transition: left 0.12s; }
button.quiet-switch[aria-checked="true"] { color: var(--green); }
button.quiet-switch[aria-checked="true"] .knob { background: var(--green); }
button.quiet-switch[aria-checked="true"] .knob::after { left: 14px; }
.records-bar button.more { min-width: 32px; padding: 0 8px; font-size: 1rem; letter-spacing: 0.05em; }

/* The side panel beside the records table: Add column, Edit column, History. Under the toolbar on a phone. */
.records-split.open { display: grid; grid-template-columns: minmax(0, 1fr) 26rem; gap: 24px; align-items: start; }
.records-split.open > .records-results { grid-column: 1; grid-row: 1; }
.records-split.open > .side-panel { grid-column: 2; grid-row: 1; }
.side-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 16px 20px 20px;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow); }
.column-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 { font-size: 1rem; }
.column-panel input, .column-panel select { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 0.875rem; }
.saved-as { margin: 4px 0 0; font-size: 0.75rem; }
.column-panel .actions { margin-top: 4px; }
.column-panel .problem:empty { display: none; }

.segmented { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-control); background: var(--grey); }
.segmented button { flex: 1 1 auto; min-height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 0.8125rem; font-weight: 500; }
.segmented button:hover:not(:disabled) { background: none; color: var(--text); }
.segmented button[aria-pressed="true"], .segmented button[aria-pressed="true"]:hover:not(:disabled) { background: var(--surface); color: var(--green); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

.how-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.word, .arrow-word { color: var(--muted); font-size: 0.8125rem; white-space: nowrap; }
.col-name { font-size: 0.8125rem; font-weight: 600; color: var(--heading); white-space: nowrap; }
.pick-column { display: flex; align-items: center; gap: 8px; }
.pick-column select { flex: 1; width: auto; min-width: 0; }
.calc { display: grid; gap: 6px; min-width: 0; }
.calc-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.calc-line select { width: auto; max-width: 100%; }
.operand { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 100%; }
.step { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 100%; }
.column-panel select.op { width: 4rem; padding-left: 12px; padding-right: 24px; font-weight: 600; }
.column-panel .num-box { width: 6.5rem; }
.column-panel .word-box { width: 9rem; }
.calc-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 0.8125rem; }
.calc-foot select.round { width: auto; min-height: 30px; font-size: 0.8125rem; }
.cases { display: grid; grid-template-columns: minmax(0, 1fr); }
.case { display: grid; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.case-when, .case-then { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.case-when select { flex: 1 1 8rem; width: auto; min-width: 0; }
.case-then { align-items: flex-start; padding-left: 8px; }
.case-then .arrow-word { line-height: 36px; }
.case-then .calc { flex: 1 1 0; }
.case-add { padding: 8px 0; font-size: 0.8125rem; border-bottom: 1px solid var(--line); }
.case.otherwise { border-bottom: 0; }
.case.otherwise .word { line-height: 36px; }

.rule-sentence { margin: 4px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--green-tint); color: var(--text); font-size: 0.875rem; overflow-wrap: anywhere; }
.fills { margin: 0; font-size: 0.8125rem; }
.fills:empty { display: none; }

.examples { margin: 0; }
.examples table { font-size: 0.8125rem; }
.examples th, .examples td { padding: 6px 8px; white-space: nowrap; }
.examples td.cell { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.examples th.want { color: var(--green-strong); font-weight: 600; }
.examples td.want input { width: 6rem; min-height: 30px; padding: 4px 8px; font-size: 0.8125rem; }
.example-note { margin: 4px 0 0; color: var(--warning-text); font-size: 0.8125rem; }
.example-note:empty { display: none; }

/* A column being built: a stronger tint and a dashed line under its header. */
.records-table th.draft, .records-table td.draft { background-color: rgba(10, 110, 79, 0.1); }
.records-table th.draft { color: var(--green-strong); font-weight: 600; box-shadow: inset 0 -2px 0 var(--green); }

/* A calculated column's header: the words sort, the small ▾ opens Edit, Turn off, Delete. */
.head-cell { display: inline-flex; align-items: center; gap: 2px; }
.records-table button.col-menu { min-height: 0; padding: 2px 5px; border: 0; border-radius: 6px; background: none; color: var(--green-strong); font-size: 0.6875rem; }
.records-table button.col-menu:hover:not(:disabled), .records-table button.col-menu[aria-expanded="true"] { background: var(--green-tint-2); }
.column-menu { position: absolute; z-index: 40; display: grid; min-width: 10rem; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); box-shadow: var(--shadow); }
.column-menu button { justify-content: flex-start; min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-size: 0.875rem; font-weight: 500; }
.column-menu button:hover:not(:disabled), .column-menu button:focus-visible { background: var(--grey); }
.column-menu button.danger { color: var(--error-text); }

/* The record page: Edit beside a value; a corrected value says what it was. */
.fv-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 2px; }
.fv-head h3 { margin-bottom: 0; }
button.fv-edit { color: var(--muted); font-size: 0.75rem; text-decoration-color: transparent; opacity: 0; }
.fv:hover button.fv-edit, .fv:focus-within button.fv-edit { opacity: 1; }
@media (hover: none) { button.fv-edit { opacity: 1; } }
.fv-value.derived { display: inline-block; padding: 0 8px; margin-left: -8px; border-radius: 6px; background: rgba(10, 110, 79, 0.06); }
.fv-value.corrected { display: inline-flex; gap: 8px; align-items: center; }
.fv-value.corrected::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--blue); flex: none; }
.was { margin-top: 2px; color: var(--muted); font-size: 0.75rem; }
.was button.link { font-size: 0.75rem; }
.correct-form { display: grid; gap: 8px; margin-top: 4px; }
.correct-form .actions { margin-top: 0; }
.correct-form .hint { margin: 0; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 900px) {
  .shape { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .finish, .finish.short { grid-template-columns: minmax(0, 1fr); }
  .finish button { justify-self: start; }
  .review-grid { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; overflow: visible; }
  .answer-bar { border-radius: 0 0 var(--r-card) var(--r-card); }
  .review-bar .filters { margin-left: 0; }
}

@media (max-width: 760px) {
  .landing { grid-template-columns: 1fr; align-content: center; }
  .sheet { display: none; }
  .edit-row { grid-template-columns: 1fr; }
  .edit-row > button { justify-self: start; margin: 0; }
}

@media (max-width: 560px) {
  main { padding: 24px 16px 80px; }
  .top-inner { gap: 16px; padding: 0 16px; flex-wrap: wrap; min-height: 0; padding-top: 12px; }
  .top nav { order: 3; flex-basis: 100%; gap: 20px; }
  .top nav a { padding: 10px 0; }
  .identity { max-width: 8rem; }
  h1 { font-size: 1.5rem; }
  .tabs { gap: 20px; margin: 20px -16px 24px; padding: 0 16px; }
  .card { padding: 16px; }
  table:not(.columns) { min-width: 34rem; }
  table.columns { min-width: 44rem; }
  td a.row-title { white-space: nowrap; }
  .stats { gap: 16px 32px; }
  .stat-figure { font-size: 1.5rem; }
  .section { margin-top: 40px; }
  .banner, .waking { padding-left: 16px; padding-right: 16px; }
  .facts div { flex-direction: column; gap: 2px; }
  .facts dt { flex-basis: auto; }
  .filters.compact .field { flex: 1 1 100%; }
  .filters.compact select { flex: 1; max-width: none; }
  .field-frame { height: 22rem; }
  .question, .fold, .answer-bar { padding-left: 16px; padding-right: 16px; }
  .flag { margin-left: 16px; margin-right: 16px; }
  .choice kbd, .choices .check kbd, .confirm kbd, .answer-bar kbd, .use kbd { display: none; }
  .session { flex-basis: 100%; }
  .steps a { font-size: 0; gap: 0; }
  .steps li[aria-current="step"] a { font-size: 0.875rem; gap: 8px; }
  .step-off { font-size: 0; gap: 0; }
  .stage li + li::before { width: 10px; margin: 0 6px; }
  .search { width: 100%; }
  .head-tools { flex-basis: 100%; flex-wrap: nowrap; }
  .head-tools .search { flex: 1 1 auto; min-width: 0; }
  .head-actions { margin-left: 0; flex-basis: 100%; }
  .catalog th:not(:first-child) { width: 7rem; }
  .records-bar .bar-end { display: contents; }
  .records-bar .search { flex: 1 1 100%; }
  .records-bar .quiet-switch { margin-left: auto; }
}

@media (max-width: 900px) {
  .records-split.open { display: block; }
  .side-panel { position: static; max-height: none; margin-bottom: 16px; padding: 12px 16px 16px; box-shadow: none; }
  .segmented { flex-wrap: nowrap; }
  .segmented button { padding: 0 6px; font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .view:empty::before, .loading::before, .waking::before { animation: none; }
}

@media (max-width: 560px) {
  .dataset-head .strip { display: none !important; }
  .head-row { gap: 12px; }
  .head-numbers div { align-items: flex-start; }
}

/* Archive: a quiet link, red only on hover, under the title's Edit form and in a source's origin fold. */
.quiet-danger { color: var(--muted) !important; font-size: 0.8125rem !important; }
.quiet-danger:hover { color: var(--error) !important; }
.form-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.archive-control { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.fold-actions { gap: 16px; align-items: baseline; }
.about-file { margin-top: 24px; }
.about-file > summary { color: var(--muted); font-size: 0.8125rem; }
.preamble { margin: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-size: 0.8125rem; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
