/**
 * Dirección A · identidad azul petróleo sobre datos en tinta.
 *
 * La regla que gobierna todo este fichero sigue siendo la misma: EL COLOR ES
 * INFORMACIÓN. Lo único que lleva verde / ámbar / rojo es cuánto fiarse de una
 * respuesta, más los estados que piden atención.
 *
 * Lo que cambió respecto a la versión gris: hay un color de marca, y tiene su
 * propio territorio — el cromo (cabecera, lateral, botones, foco, la fila
 * seleccionada). No entra nunca en un dato. Por eso es petróleo y no un azul
 * vivo: convive con las tres bandas de confianza sin pelearse con ellas.
 *
 * Si algún día un porcentaje, un recuento o un tiempo acaba pintado de
 * --brand, la regla se ha roto.
 *
 * Corolario que sobrevive intacto: "verificado" NO lleva color. Que algo esté
 * bien no necesita gritar; solo las excepciones (el juez discrepa, decidió el
 * árbitro) se colorean.
 */
:root {
  --bg: #ffffff;
  /* El lienzo sobre el que flota la tarjeta de detalle. Sin él la tarjeta
     blanca sobre fondo blanco solo se distingue por su borde. */
  --canvas: #f7f8f8;
  --surface: #eaf1f3;
  /* Tres pesos de línea, y cada uno significa algo: la fuerte separa regiones,
     la media enmarca, la fina divide filas dentro de una región. */
  --rule-strong: #17242a;
  --rule: #cfdde1;
  --rule-soft: #dbe7ea;
  /* Neutros con sesgo hacia el azul de marca, no grises puros. */
  --ink: #17242a;
  --ink-mid: #3d5560;
  --muted: #57737e;
  --faint: #86a4ad;
  /* Marca: cromo, nunca dato. --brand-dim es el único texto legible que se
     apoya sobre --brand. */
  --brand: #0f4c5c;
  --brand-dark: #0a343f;
  --brand-dim: #9fc4ce;
  --on-brand: #ffffff;
  /* Los únicos colores del sistema. */
  --ok: #15803d;
  --warn: #a16207;
  --bad: #b91c1c;
  --arb: #6d28d9;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --display: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* Un foco petróleo sobre la cabecera petróleo sería invisible. */
.site-header :focus-visible { outline-color: var(--on-brand); }

/* ---------- header ---------- */
.site-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 6px 18px;
  background: var(--brand);
  flex-wrap: wrap;
}
h1 { color: var(--on-brand); }
.site-header .tagline { color: var(--brand-dim); }
.brand { display: flex; align-items: baseline; gap: 10px; }
h1 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.014em;
}
.tagline { margin: 0; color: var(--muted); font-size: 11px; letter-spacing: -0.004em; }

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-left: auto;
}
/* Each control is one bordered unit: the uppercase label sits in the left
   padding and the field's own left border draws the divider, so the pair reads
   as a single object rather than two. The label text is a bare text node — it
   cannot be styled directly, hence padding on the label rather than a cell. */
.controls label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 0 0 10px;
  border: 1px solid var(--rule);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}
.controls label > span,
.controls label > select { text-transform: none; letter-spacing: -0.008em; }
select {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink);
  padding: 0 22px 0 10px;
  height: 30px;
  border: none;
  border-left: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 13px, calc(100% - 8px) 13px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
/* Los controles viven sobre la cabecera de marca, así que se dibujan en
   negativo: el mismo objeto, invertido. */
.site-header .controls label {
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--brand-dim);
}
.site-header select {
  color: var(--on-brand);
  background-color: rgba(255, 255, 255, 0.13);
  border-left-color: rgba(255, 255, 255, 0.22);
  background-image: linear-gradient(45deg, transparent 50%, var(--brand-dim) 50%),
    linear-gradient(135deg, var(--brand-dim) 50%, transparent 50%);
}
/* El desplegable lo pinta el sistema con los colores del select: sin esto,
   texto blanco sobre fondo blanco en Windows. */
.site-header select option { color: var(--ink); background: var(--bg); }

kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 0 3px;
}

/* ---------- layout: sidebar + content ---------- */
main {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  align-items: stretch;
}

.sidebar {
  flex: none;
  width: 328px;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dz-wrap { flex: none; padding: 11px; border-bottom: 1px solid var(--rule-soft); }

.content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--canvas);
}

/* ---------- dropzone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 13px 10px;
  border: 1px dashed var(--faint);
  border-radius: 0;
  background: var(--bg);
  cursor: pointer;
  font-family: var(--sans);
  text-align: center;
  transition: background 0.12s, border-color 0.12s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: var(--surface); }
.dz-title { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: -0.011em; }
.dz-sub { font-size: 11px; color: var(--muted); }

/* ---------- queue ---------- */
.queue-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 13px;
  border-bottom: 1px solid var(--rule-strong);
}
h2 {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.count { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.queue {
  flex: 1 1 auto;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}
/* Full-bleed rows separated by a hairline: a list, not a stack of cards.
   The selected row is lifted by turning white against the grey panel and
   taking an inset rail — no fill, no shadow. */
.item {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-soft);
  border-radius: 0;
  padding: 8px 13px;
  cursor: pointer;
  transition: background 0.12s;
}
.item:hover { background: #dfeaed; }
.item[aria-current="true"] {
  background: var(--bg);
  box-shadow: inset 3px 0 0 var(--brand);
}
.thumb {
  width: 34px;
  height: 34px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  object-fit: cover;
  display: block;
}
.item .label {
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.011em;
}
.item[aria-current="true"] .label { font-weight: 600; }
.item .sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item .right { display: flex; align-items: center; gap: 7px; }

/* The answer in the list carries the confidence colour, so the column can be
   scanned for trustworthiness without reading a single number. */
.mini-badge {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  padding: 3px 7px;
  border: 1.5px solid var(--faint);
  color: var(--muted);
  border-radius: 0;
  display: inline-block;
  letter-spacing: -0.01em;
}
.mini-badge.alta { border-color: var(--ok); color: var(--ok); }
.mini-badge.media { border-color: var(--warn); color: var(--warn); }
.mini-badge.baja { border-color: var(--bad); color: var(--bad); }

.mini-conf {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mini-conf.alta { color: var(--ok); }
.mini-conf.media { color: var(--warn); }
.mini-conf.baja { color: var(--bad); }

.state {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: 0;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.state.queued { border-color: var(--rule); color: var(--muted); }
.state.running { border-color: var(--warn); color: var(--warn); }
.state.error, .state.budget_stopped { border-color: var(--bad); color: var(--bad); }
.state.lost { border-color: var(--arb); color: var(--arb); }

.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .pulse { animation: throb 1.4s ease-in-out infinite; }
  @keyframes throb { 50% { opacity: 0.25; } }
}

/* ---------- session strip ---------- */
/* Bordered cells, no fills and no coloured dots: a counter is not a status. */
.session {
  flex: none;
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.stat {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 9px 16px;
  border-right: 1px solid var(--rule-soft);
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.stat b {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: -0.01em;
}
.stat.warn b { color: var(--bad); }
.session .spacer { flex: 1 1 auto; }

.clock {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 9px 16px;
  border-left: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--brand);
}
.clock small {
  font-family: var(--sans);
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.cost {
  display: flex;
  align-items: center;
  padding: 9px 16px;
  border-left: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.ghost-btn {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-left: 1px solid var(--rule-soft);
  border-radius: 0;
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.ghost-btn:hover { background: var(--surface); }

/* ---------- banner ---------- */
.banner {
  flex: none;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 16px;
  border-bottom: 1px solid var(--bad);
  background: var(--bg);
  box-shadow: inset 3px 0 0 var(--bad);
  color: var(--bad);
  font-size: 12.5px;
}
.banner[hidden] { display: none; }
.banner strong { display: block; font-size: 13px; }
.banner p { margin: 3px 0 0; color: var(--ink-mid); max-width: 74ch; }

/* ---------- detail ---------- */
.detail {
  flex: 1 1 auto;
  margin: 18px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  padding: 22px;
  box-shadow: none;
  min-height: 0;
  overflow-y: auto;
}
.detail-head { display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-start; }
.detail-head img {
  width: min(268px, 100%);
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--surface);
  display: block;
  margin: 0;
  float: none;
  padding: 0;
}
.verdict-col { flex: 1 1 15rem; min-width: 13rem; }

.answer-row { display: flex; align-items: center; gap: 18px; }
.answer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 44px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 2px solid var(--faint);
  padding: 7px 18px;
  border-radius: 0;
  letter-spacing: -0.025em;
}
.answer-badge.alta { border-color: var(--ok); color: var(--ok); }
.answer-badge.media { border-color: var(--warn); color: var(--warn); }
.answer-badge.baja { border-color: var(--bad); color: var(--bad); }

.meta-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 17px; align-items: center; }
.meta {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 0;
  font-weight: 400;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.meta.conf { font-weight: 600; font-size: 12px; }
.conf.alta { border-color: var(--ok); color: var(--ok); }
.conf.media { border-color: var(--warn); color: var(--warn); }
.conf.baja { border-color: var(--bad); color: var(--bad); }
.meta.verif { font-family: var(--sans); }
/* Deliberately colourless: a verified answer is the expected case. */
.verif.ok { border-color: var(--rule); color: var(--muted); }
.verif.warn { border-color: var(--bad); color: var(--bad); }
.verif.arb { border-color: var(--arb); color: var(--arb); }
.meta.vote { border-color: var(--rule); color: var(--muted); }
.meta.tag { border-color: var(--rule); color: var(--muted); font-family: var(--sans); }

.timings {
  display: flex;
  gap: 0;
  margin: 18px 0 0;
  border: 1px solid var(--rule);
  width: fit-content;
  flex-wrap: wrap;
}
.timing {
  border: none;
  border-right: 1px solid var(--rule-soft);
  border-radius: 0;
  padding: 8px 15px;
  background: var(--surface);
  min-width: 118px;
}
.timing:last-child { border-right: none; }
.timing dt {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  font-weight: 600;
}
.timing dd {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.012em;
}

.reasoning {
  white-space: pre-wrap;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  clear: both;
  font-size: 14.5px;
  color: var(--ink-mid);
  max-width: 74ch;
  line-height: 1.62;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}
.judge-note {
  margin-top: 14px;
  padding-left: 13px;
  border-left: 2px solid var(--rule);
  font-size: 12.5px;
  color: var(--muted);
  clear: both;
  max-width: 74ch;
  line-height: 1.55;
}
.judge-note.arb { color: var(--arb); border-left-color: var(--arb); font-weight: 400; }

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
}
.action {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--brand);
  background: var(--bg);
  border: 1px solid var(--brand);
  border-radius: 0;
  padding: 8px 14px;
  cursor: pointer;
  letter-spacing: -0.008em;
  transition: background 0.12s, color 0.12s;
}
.action:hover { background: var(--surface); }
/* One primary action per panel: re-solving is the thing you came here to do. */
.action.primary { background: var(--brand); color: var(--on-brand); }
.action.primary:hover { background: var(--brand-dark); }

.empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 20px 13px; }

/* The preset's measured accuracy rides in its own control, since the panel
   that used to carry it is gone. One of the presets is measured at 1 of 9. */
.measured { color: var(--ok); }
.unmeasured { color: var(--warn); }
.bad { color: var(--bad); }

@media (max-width: 900px) {
  main { flex-direction: column; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--rule); }
  .content { order: -1; }
  .queue { max-height: 40vh; }
}
@media (max-width: 560px) {
  .site-header { align-items: flex-start; }
  .controls { margin-left: 0; }
}
