:root {
  --bg: #1E222E;
  --surface: #2C3143;
  --surface-2: #353B50;
  --line: #3A4057;
  --muted: #575F7C;
  --text: #EAEDF1;
  --text-2: #A3AAC2;
  --accent: #3F73C0;
  --accent-bright: #72AAFF;
  --alt: #F0CB48;
  --ok: #5DBE8A;
  --bad: #EC6F76;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--mono); font-size: 12.5px; }

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

.muted { color: var(--text-2); }

/* Shell */

.shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 52px;
  padding: 0 24px;
  background: rgba(30, 34, 46, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.wordmark:hover { text-decoration: none; }
.wordmark-sub {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
}

.topbar nav { display: flex; gap: 4px; height: 100%; }

.tab {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent-bright); }

main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}

/* States */

.state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  justify-content: center;
  color: var(--text-2);
  background: var(--surface);
  border-radius: 10px;
}
.state-error { color: var(--text); border-left: 3px solid var(--bad); justify-content: flex-start; }
.state-error strong { color: var(--bad); }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--muted);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.boot { display: flex; justify-content: center; align-items: center; height: 100vh; }
.boot .spinner { width: 28px; height: 28px; }

.denied {
  max-width: 440px;
  margin: 18vh auto 0;
  padding: 0 24px;
  text-align: center;
}
.denied .wordmark { display: block; font-size: 28px; margin-bottom: 28px; }
.denied h1 { font-size: 20px; margin-bottom: 10px; }
.denied p { color: var(--text-2); margin: 0 0 28px; }

/* Controls */

.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.button:hover { background: #4A82D4; text-decoration: none; }
.button:disabled { opacity: 0.6; cursor: default; }
.button.small { padding: 4px 10px; font-size: 12.5px; }
.button.ghost { background: transparent; color: var(--text-2); border: 1px solid var(--line); }
.button.ghost:hover { color: var(--text); border-color: var(--muted); background: var(--surface-2); }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-bright); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.75); }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: 10px;
}

.filters { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.filters-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.search { flex: 1 1 320px; }
.search input { width: 100%; padding: 8px 12px; }
.search.active input { border-color: var(--accent); background: rgba(63, 115, 192, 0.14); }

.filter { display: flex; flex-direction: column; gap: 3px; }
.filter span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.filter select, .filter input { height: 32px; }
.filter select { min-width: 110px; max-width: 200px; }
.filter.active select, .filter.active input { border-color: var(--accent); background: rgba(63, 115, 192, 0.14); }

.filters .clear { align-self: center; padding: 0 4px; font-size: 13px; }

/* Tables */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: 10px;
}

table { width: 100%; border-collapse: collapse; }

th {
  position: sticky;
  top: 0;
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--text-2);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(87, 95, 124, 0.28);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }

.num { text-align: right; font-variant-numeric: tabular-nums; }

table.calls { font-size: 13px; }
.call-row { cursor: pointer; }
.call-row:hover td { background: var(--surface-2); }
.call-row .time { font-family: var(--mono); font-size: 12.5px; }
.call-row .row-link { color: var(--text); }
.call-row .user { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.call-row .model { color: var(--text-2); }
.call-row .usage { color: var(--text-2); }
.call-row .cost { font-weight: 500; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 11px;
  line-height: 18px;
  color: var(--alt);
  border: 1px solid rgba(240, 203, 72, 0.4);
  border-radius: 4px;
}

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-kind { font-weight: 400; color: var(--text-2); }
.status-Ok .status-dot { background: var(--ok); }
.status-Failed { color: var(--bad); }
.status-Failed .status-dot { background: var(--bad); }
.status-Pending { color: var(--alt); }
.status-Pending .status-dot { background: var(--alt); }
.status-Uploading, .status-Incomplete { color: var(--alt); }
.status-Uploading .status-dot, .status-Incomplete .status-dot { background: var(--alt); }
.status-Untriaged { color: var(--alt); }
.status-Untriaged .status-dot { background: var(--alt); }
.status-Request { color: var(--ok); }
.status-Request .status-dot { background: var(--ok); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px;
  font-size: 13px;
}

/* Panels */

.panel {
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: 10px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
}
.panel-head h2 {
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
}
.panel-body { padding: 10px 16px 16px; overflow-x: auto; }
.panel .table-wrap { background: transparent; border-radius: 0; }
.panel table th { background: var(--surface); padding-left: 0; }
.panel table td { padding-left: 0; }
.panel table.calls th, .panel table.calls td { padding-left: 12px; }

/* Call detail */

.detail-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0 16px;
}
.detail-head h1 { font-size: 22px; }
.detail-head .status { font-size: 15px; }
.back { font-size: 13px; color: var(--text-2); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px 24px;
  margin: 0 0 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: 10px;
}
.panel .facts { padding: 0; margin: 0; background: transparent; }
.fact { min-width: 0; }
.facts dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.error-box {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(236, 111, 118, 0.1);
  border: 1px solid rgba(236, 111, 118, 0.35);
  border-radius: 10px;
}
.error-box strong { color: var(--bad); }
.error-box div { margin-top: 4px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; }

.messages { display: flex; flex-direction: column; gap: 10px; }
.message {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--muted);
}
.message.role-user { border-left-color: var(--accent-bright); }
.message.role-assistant { border-left-color: var(--ok); }
.message.role-system { border-left-color: var(--alt); }
.message-role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  padding-top: 2px;
}
.message-body { min-width: 0; }
.text-block { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow-y: auto; }

.transcript { display: flex; flex-direction: column; gap: 2px; }
.turn {
  display: grid;
  grid-template-columns: 48px 84px 1fr;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
}
.turn:nth-child(odd) { background: rgba(30, 34, 46, 0.5); }
.turn-time { font-family: var(--mono); font-size: 12px; color: var(--text-2); padding-top: 1px; }
.turn-role { font-size: 12px; font-weight: 600; }
.turn.role-user .turn-role { color: var(--accent-bright); }
.turn.role-assistant .turn-role { color: var(--ok); }
.turn-text { overflow-wrap: anywhere; }

/* JSON */

.json {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  overflow-x: auto;
  max-height: 720px;
  overflow-y: auto;
}
.message .json { padding: 6px 8px; max-height: 480px; }
.json details > summary { list-style: none; cursor: pointer; }
.json details > summary::-webkit-details-marker { display: none; }
.json details > summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  margin-left: -14px;
  color: var(--muted);
  transition: transform 0.1s;
}
.json details[open] > summary::before { transform: rotate(90deg); }
.json details > summary:hover::before { color: var(--accent-bright); }
.json details[open] > summary .json-folded { display: none; }
.json details:not([open]) > .json-close { display: none; }
.json-folded { color: var(--muted); }
.json-children { padding-left: 18px; border-left: 1px solid rgba(87, 95, 124, 0.35); margin-left: 2px; }
.json-line { white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 0; }
.json > details, .json > .json-line { margin-left: 14px; }
.json-key { color: var(--accent-bright); }
.json-string { color: #B9D98A; }
.json-number { color: var(--alt); }
.json-bool, .json-null { color: #D59BEA; }
.json-punct { color: var(--text-2); }

/* Metrics */

.range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.range-label { font-size: 18px; font-weight: 600; }
.range-controls { display: flex; align-items: flex-end; gap: 10px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.tile { padding: 14px 16px; background: var(--surface); border-radius: 10px; }
.tile-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-2);
}
.tile-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12.5px; color: var(--text-2); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0 16px; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: rgba(87, 95, 124, 0.35); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .tick { fill: var(--text-2); font-size: 11px; font-family: var(--sans); }
.chart .bar { fill: var(--accent); transition: fill 0.1s; }
.chart .bar.hover { fill: var(--accent-bright); }
.chart .hit { fill: transparent; }

.tooltip {
  position: absolute;
  top: 8px;
  transform: translateX(12px);
  min-width: 170px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  font-size: 12.5px;
}
.tooltip.flip { transform: translateX(calc(-100% - 12px)); }
.tooltip-title { font-weight: 600; margin-bottom: 4px; }
.tooltip-row { display: flex; justify-content: space-between; gap: 16px; }
.tooltip-row span { color: var(--text-2); }
.tooltip-sub { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }

table.data { font-size: 13px; }
table.data td:first-child { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

.share { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.share-bar, .meter {
  display: inline-block;
  width: 64px;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.share-fill, .meter-fill { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.share { min-width: 110px; }
.meter-col { width: 150px; }
.meter { width: 90px; vertical-align: middle; }
.meter.near .meter-fill { background: var(--alt); }
.meter.over .meter-fill { background: var(--bad); }
.meter-label { margin-left: 8px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Login */

.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, #262B3B 0%, var(--bg) 65%);
}
.login-card {
  width: 100%;
  max-width: 340px;
  padding: 44px 32px 32px;
  text-align: center;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.login-wordmark { font-size: 32px; }
.login-sub {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.login-action {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 44px;
  margin-top: 36px;
}
.login-button { width: 100%; justify-content: center; padding: 11px 16px; font-size: 15px; }
.login-action .spinner { width: 24px; height: 24px; }
.login[data-state="loading"] .login-button { display: none; }
.login[data-state="ready"] .login-action .spinner { display: none; }
.login-error { min-height: 20px; margin: 14px 0 0; font-size: 13px; color: var(--bad); }

/* Evaluation */

main.wide { max-width: none; padding: 0; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 0 20px;
}
.page-head h1 { font-size: 22px; margin-bottom: 4px; }
.page-head p { margin: 0; max-width: 640px; }

.empty-line { padding: 6px 0 4px; }

.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.v-Good { --v: var(--ok); }
.v-Okay { --v: var(--alt); }
.v-Bad { --v: var(--bad); }
.swatch, .stack-seg { background: var(--v); }

table.eval-queues td, table.eval-prompts td { padding-top: 9px; padding-bottom: 9px; }
table.eval-queues .queue-name a { color: var(--text); font-weight: 500; }
table.eval-queues .meter { width: 120px; }

table.eval-prompts tr.main td { border-top: 1px solid var(--line); }
table.eval-prompts tbody tr:first-child td { border-top: 0; }
table.eval-prompts tr.sub td { border-bottom: 0; padding-top: 5px; padding-bottom: 5px; font-size: 12.5px; }
table.eval-prompts tr.sub .prompt-cell { padding-left: 18px; }
.verdict-cell { min-height: 20px; }
.prompt-cell { display: flex; align-items: baseline; gap: 10px; }
.prompt-name { font-weight: 500; }
.variant {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  white-space: nowrap;
}
tr.sub .variant { border: 0; padding: 0; }
.num-link { color: var(--text); border-bottom: 1px dotted var(--muted); }
.num-link:hover { color: var(--accent-bright); text-decoration: none; border-bottom-color: var(--accent-bright); }

.verdict-cell { display: flex; align-items: center; gap: 10px; }
.stack { display: inline-flex; gap: 2px; width: 120px; height: 8px; }
.stack-seg { display: block; height: 100%; min-width: 3px; }
.stack-seg:first-child { border-radius: 4px 0 0 4px; }
.stack-seg:last-child { border-radius: 0 4px 4px 0; }
.stack-seg:only-child { border-radius: 4px; }
.stack-nums { font-variant-numeric: tabular-nums; font-size: 12.5px; }

.tags-cell { white-space: normal; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 2px 4px 2px 0;
  padding: 3px 10px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--muted); text-decoration: none; }
.chip.on { color: var(--text); background: rgba(236, 111, 118, 0.16); border-color: rgba(236, 111, 118, 0.55); }
.chip.small { padding: 1px 8px; font-size: 11.5px; }
.chip.more { border-style: dashed; }
.chip-count { color: var(--muted); font-variant-numeric: tabular-nums; }
a.chip { color: var(--text-2); }

kbd {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  font: 600 10.5px/16px var(--mono);
  text-align: center;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* New queue */

.new-queue { max-width: 760px; margin: 0 auto; }
.form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--surface);
  border-radius: 12px;
}
.form-row { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.form-row .field { flex: 1 1 150px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.field select, .field input { height: 34px; width: 100%; }
.checks { gap: 8px 24px; }
.check, .radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input, .radio input[type="radio"] { accent-color: var(--accent-bright); width: 15px; height: 15px; margin: 0; }
.form-take { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.form-take .field-label { width: 100%; }
.sample-size { width: 72px; height: 30px; text-align: right; }
.form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 4px;
}
.match-count strong { font-size: 16px; }
.warn { color: var(--alt); }
.form-error { color: var(--bad); font-size: 13px; }

/* Grading */

.grade { display: flex; flex-direction: column; min-height: calc(100vh - 53px); }

.grade-head {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
}
.grade-title { min-width: 0; flex: 0 1 auto; }
.grade-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.grade-progress { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.grade-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.strip { display: flex; gap: 2px; flex: 1 1 auto; max-width: 520px; min-width: 60px; }
.strip-cell {
  flex: 1 1 0;
  height: 8px;
  min-width: 2px;
  padding: 0;
  background: var(--surface-2);
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.strip-cell.v-Good, .strip-cell.v-Okay, .strip-cell.v-Bad { background: var(--v); opacity: 0.75; }
.strip-cell.current { outline: 2px solid var(--text); outline-offset: 1px; opacity: 1; }
.strip-cell:hover { opacity: 1; background-color: var(--muted); }
.save-state { min-width: 60px; font-size: 12px; color: var(--text-2); text-align: right; white-space: nowrap; }
.save-saved { color: var(--text-2); }
.save-failed { color: var(--bad); }

.grade-panes {
  display: grid;
  grid-template-columns: minmax(300px, 5fr) minmax(360px, 7fr);
  gap: 20px;
  flex: 1 1 auto;
  padding: 20px 24px 120px;
  align-items: start;
}
.grade-panes.raw { grid-template-columns: 1fr 1fr; }
.pane { min-width: 0; padding: 20px 24px 24px; background: var(--surface); border-radius: 12px; }
.pane-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.pane-head h2 { font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2); }
.pane-meta { display: flex; align-items: baseline; gap: 10px; font-size: 12px; color: var(--text-2); }
.pane .json { max-height: none; }

.learner-input { display: flex; flex-direction: column; gap: 6px; }
.input-langs { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.input-langs:empty { display: none; }
.lang-pill {
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-bright);
  background: rgba(63, 115, 192, 0.16);
  border-radius: 999px;
}
.lang-native { font-size: 12px; color: var(--text-2); }
.input-label {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.input-primary { font-size: 24px; line-height: 1.3; font-weight: 500; overflow-wrap: anywhere; white-space: pre-wrap; }
.input-detail-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; color: var(--text); }
.input-detail-text.long { max-height: 220px; overflow-y: auto; font-size: 13px; color: var(--text-2); }

.bubbles { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 12px; background: var(--bg); }
.bubble.mine { align-self: flex-end; background: rgba(63, 115, 192, 0.22); border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble-role { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.item:hover { border-color: var(--line); }
.item.focused { border-color: var(--accent-bright); box-shadow: 0 0 0 1px var(--accent-bright); }
.item.bad { background: rgba(236, 111, 118, 0.08); border-color: rgba(236, 111, 118, 0.45); }
.item.bad.focused { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.item-body { min-width: 0; }
.item-side { display: flex; align-items: flex-start; }
.item-tags { grid-column: 1 / -1; }
.item-flag {
  padding: 1px 8px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
}
.item:hover .item-flag, .item.focused .item-flag, .item-flag.on { opacity: 1; }
.item-flag:hover { color: var(--bad); border-color: rgba(236, 111, 118, 0.45); }
.item-flag.on { color: #fff; background: var(--bad); }

.flashcard { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.face-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.face-text { font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.blank {
  padding: 0 6px;
  color: var(--alt);
  background: rgba(240, 203, 72, 0.12);
  border-radius: 4px;
  white-space: nowrap;
}
.answer { color: var(--ok); font-weight: 600; }
.hint { color: var(--text-2); }
.ipa { margin-top: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.definition { margin-top: 4px; font-size: 13.5px; }
.explanation { margin-top: 4px; font-size: 13px; color: var(--text-2); }
.meaning { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 16px; align-items: baseline; }
.meaning-word { font-weight: 600; font-size: 16px; }
.output-note { font-size: 12.5px; color: var(--text-2); margin-bottom: 2px; }
.output-note.warn { color: var(--alt); }
.output-none { padding: 18px 0; color: var(--text-2); }
.output-text { font-size: 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.output-text.mono { font-family: var(--mono); font-size: 13px; padding: 10px 12px; background: var(--bg); border-radius: 8px; }
.word-list { display: flex; flex-wrap: wrap; gap: 8px; }
.word-list .item { grid-template-columns: auto auto; padding: 8px 10px 8px 14px; }
.word { font-size: 16px; font-weight: 500; }
.covered-ids { display: flex; flex-direction: column; gap: 4px; }

.rating { display: flex; flex-direction: column; gap: 10px; }
.rating-score { font-size: 32px; font-weight: 600; }
.rating-of { font-size: 16px; color: var(--text-2); font-weight: 400; }
.rating-dots { display: flex; gap: 6px; }
.rating-dots .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); }
.rating-dots .dot.on { background: var(--accent-bright); }

.review { display: flex; flex-direction: column; gap: 8px; }
.review-title { font-size: 18px; font-weight: 600; }
.review-comments { color: var(--text); line-height: 1.55; margin-bottom: 6px; }
.review-section { display: flex; flex-direction: column; gap: 8px; }
.correction { font-size: 15px; }
.struck { text-decoration: line-through; text-decoration-color: rgba(236, 111, 118, 0.8); color: var(--text-2); }
.small { font-size: 12.5px; }

.others { display: flex; flex-direction: column; gap: 6px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; }
.other { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.other-who { color: var(--text-2); }
.other-note { color: var(--text-2); font-style: italic; }
.verdict-badge { padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--bg); background: var(--v, var(--muted)); }
.judge-none { color: var(--muted); }

.grade-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  padding: 10px 24px;
  background: rgba(30, 34, 46, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.verdicts { display: flex; gap: 6px; }
.verdict {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.verdict:hover { border-color: var(--v); }
.verdict.on { background: var(--v); border-color: var(--v); color: var(--bg); }
.verdict.on kbd { color: var(--bg); background: rgba(255, 255, 255, 0.35); border-color: transparent; }
.verdict:focus-visible, .chip:focus-visible, .button:focus-visible, .strip-cell:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }
.bar-tags { display: flex; flex-wrap: wrap; align-items: center; flex: 1 1 280px; min-width: 0; }
.bar-tags .chip kbd { margin-left: 2px; }
.note {
  flex: 0 1 260px;
  min-width: 160px;
  height: 32px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: none;
  outline: none;
  transition: height 0.12s;
}
.note:focus { border-color: var(--accent-bright); height: 76px; }
.bar-nav { display: flex; gap: 6px; }
.bar-nav .button { gap: 6px; }
.bar-nav .button.active { color: var(--text); border-color: var(--accent-bright); }
.bar-meta { font-size: 12px; color: var(--text-2); white-space: nowrap; }

.picker-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(15, 17, 24, 0.45); }
.picker {
  position: fixed;
  z-index: 31;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.picker-scope { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: 8px; }
.picker input { width: 100%; height: 36px; margin-bottom: 8px; }
.picker-list { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; }
.picker-option {
  display: grid;
  grid-template-columns: 18px auto 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 7px 8px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.picker-option.highlight, .picker-option:hover { background: var(--surface-2); }
.picker-check { color: var(--bad); font-weight: 700; }
.picker-label { font-weight: 500; white-space: nowrap; }
.picker-question { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-option.highlight .picker-question { white-space: normal; }
.picker-empty { padding: 8px; }

.help-backdrop { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(15, 17, 24, 0.6); }
.help { width: min(520px, calc(100vw - 32px)); padding: 22px 24px; background: var(--surface); border-radius: 12px; }
.help h2 { font-size: 16px; margin-bottom: 14px; }
.help dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0; }
.help dt { font-family: var(--mono); font-size: 13px; color: var(--accent-bright); white-space: pre; }
.help dd { margin: 0; }
.help p { margin: 16px 0 0; }

.finished { max-width: 560px; margin: 12vh auto 0; padding: 0 24px; text-align: center; }
.finished h1 { font-size: 24px; margin-bottom: 8px; }
.finished-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }

@media (max-width: 900px) {
  .grade-panes { grid-template-columns: 1fr; padding: 16px 16px 200px; }
  .grade-head { flex-wrap: wrap; padding: 10px 16px; }
  .grade-bar { padding: 10px 16px; }
  .flashcard { grid-template-columns: 1fr; }
}

.call-row .snippet { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.detail audio { display: block; width: 100%; max-width: 480px; margin-bottom: 10px; }
.detail .button + .text-block, .detail .text-block + .button { margin-top: 10px; }
.screenshot { display: block; max-width: 360px; width: 100%; border-radius: 6px; border: 1px solid var(--line); }
table.context { font-size: 13px; }
table.context th { position: static; width: 220px; text-transform: none; letter-spacing: 0; font-family: var(--mono); font-size: 12.5px; font-weight: 400; }
table.context td { white-space: normal; overflow-wrap: anywhere; }
.detail summary { cursor: pointer; color: var(--accent-bright); }
pre.logs { margin: 10px 0 0; max-height: 480px; overflow: auto; font: 12px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.log-error { color: var(--bad); background: rgba(255, 90, 90, 0.08); }
ul.notes { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.note-meta { font-size: 12.5px; margin-top: 2px; }
.note-input { display: block; width: 100%; margin-bottom: 8px; resize: vertical; }
.user-calls { margin: 14px 0; }
.notes + .note-input, .muted + .note-input { margin-top: 10px; }

/* Feedback feed */

.feed { display: flex; align-items: flex-start; gap: 12px; }
.feed-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 1100px) {
  .feed { flex-direction: column; align-items: stretch; }
  .feed-col { display: contents; }
}
.feed-item { min-width: 0; background: var(--surface); border-radius: 10px; }
.feed-head, .feed-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 6px 16px; }
.feed-head { border-bottom: 1px solid rgba(87, 95, 124, 0.28); }
.feed-foot { gap: 8px 10px; padding: 10px 16px; border-top: 1px solid rgba(87, 95, 124, 0.28); }
.feed-time { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.feed-user { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-gap { flex: 1 1 0; }
.feed-open { padding: 8px 0; font-weight: 500; }
.feed-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px 24px; padding: 16px; }
.feed-words { flex: 999 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.feed-part, .feed-notes { display: flex; flex-direction: column; gap: 8px; }
.feed-item h2 { font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2); }
.feed-item p { margin: 0; }
.feed-text { max-width: 76ch; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-note { max-width: 76ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-part audio { width: 100%; max-width: 360px; height: 32px; }
.feed-note-new { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.feed-note-new textarea { flex: 1 1 200px; min-width: 0; min-height: 34px; resize: vertical; }
.feed-shot { flex: none; }
.feed-shot img { display: block; width: 156px; border-radius: 6px; border: 1px solid var(--line); }
.feed-item.handled .feed-part, .feed-item.handled .feed-shot { opacity: 0.45; }
.feed-waiting { flex: 1 1 180px; min-width: 0; font-size: 12.5px; }
.button.ghost.picked, .button.ghost.picked:hover { color: var(--ok); border-color: var(--ok); background: rgba(93, 190, 138, 0.12); }
.feed-foot .button.ghost { padding: 7px 13px; }
