/* Board Processing — station UI in the Andean brand style.
   Every color comes from the shared tokens in vendor/andean/andean.css
   (dark canonical, light = strict inversion via [data-theme="light"]).
   Monochrome, square corners, hairline dividers, light type. The only
   accent is the orange→yellow gradient, used as thin indicator bars.

   The few semantic colors a bench tool cannot do without (voice on/off,
   a failed step, a hand-edited value) are kept tiny: a dot, a word, a
   1–2 px underline — never a filled area. Canvas overlay colors (tray
   quad, IC boxes, gold mask) are functional and set in app.js. */

* { box-sizing: border-box; }

:root {
  --bp-fail:      #E5484D;   /* failed step / error text (both grounds) */
  --bp-ok:        #3DD68C;   /* the voice "listening" dot only */
  --bp-canvas:    #000000;   /* live-view letterbox */
  --accent-solid: #FB923C;   /* single-color fallback for the gradient */
}

html, body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-weight: 300;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 200ms ease, color 200ms ease;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); font-size: 0.85em; }
small { font-weight: 300; }
strong, b { font-weight: 400; color: var(--color-text-primary); }
.hidden { display: none !important; }

/* ------------------------------------------------------------- header */
header {
  border-bottom: 1px solid var(--color-border-subtle);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}
header .brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--color-foreground);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
  white-space: nowrap;
}
header h1 { margin: 0; font-size: 13px; font-weight: 400; letter-spacing: 0.1em; }
.subtitle { font-size: 11px; color: var(--color-text-faint); letter-spacing: 0.12em; }

/* Screen tabs: Setup · Capture · Data. The active tab carries the brand's
   one accent — a 2 px gradient bar. */
.nav { display: flex; align-items: stretch; height: 100%; margin-left: 8px; }
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 200ms ease;
}
.nav a:hover { color: var(--color-foreground); }
.nav a.active { color: var(--color-text-primary); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 2px;
  background: var(--accent-gradient);
}
.nav a[aria-disabled="true"] { color: var(--color-text-faint); cursor: default; }
.nav a[aria-disabled="true"]:hover { color: var(--color-text-faint); }

.voice-status {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 6px 12px;
  border: 1px solid var(--color-border-subtle);
  white-space: nowrap;
}
.voice-status { cursor: pointer; user-select: none; transition: border-color 200ms ease, color 200ms ease; }
.voice-status:hover { border-color: var(--color-border-strong); color: var(--color-foreground); }
.voice-status:focus-visible { outline: 1px solid var(--color-border-strong); outline-offset: 2px; }
.voice-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-text-faint); }
.voice-status.on .dot { background: var(--bp-ok); animation: pulse 1.6s infinite; }
.voice-status.off .dot { background: var(--bp-fail); }
@keyframes pulse { 50% { opacity: 0.35; } }

header andean-settings { margin-left: 4px; }

/* -------------------------------------------------------------- layout */
main.screen {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px 40px;
}

/* Sections are separated by hairlines, not boxed. */
.card {
  padding: 28px 0;
  border-bottom: 1px solid var(--color-border-subtle);
}
.card:last-child { border-bottom: 0; }
.card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
}
.hint { color: var(--color-text-muted); font-size: 13px; margin: 4px 0 12px; }
.hint.warn { color: var(--accent-solid); }
.hint code { word-break: break-all; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }

.view-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-top: 12px;
}
.controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; align-items: center; }

/* ------------------------------------------------------------- buttons */
button {
  font-family: var(--font);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.3;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 9px 16px;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease;
  display: inline-flex; align-items: center; gap: 8px;
}
button:hover:not(:disabled) { background: var(--color-hover-surface); border-color: var(--color-border-strong); }
button:focus-visible { outline: 1px solid var(--color-border-strong); outline-offset: 2px; }
button:disabled { color: var(--color-text-faint); border-color: var(--color-border-subtle); cursor: not-allowed; }
button small { color: var(--color-text-faint); font-size: 12px; }

button.primary { color: var(--color-text-primary); border-color: var(--color-border-strong); }
button.primary.big { font-size: 16px; padding: 14px 24px; }
button.ghost { color: var(--color-text-secondary); }

/* -------------------------------------------------------- option grid */
.option-grid { display: flex; flex-wrap: wrap; gap: 0; border-left: 1px solid var(--color-border-subtle); }
.option-grid button {
  border: 1px solid var(--color-border-subtle);
  border-left: 0;
  padding: 14px 18px;
  font-size: 15px;
}
.option-grid button.selected {
  color: var(--color-text-primary);
  position: relative;
}
.option-grid button.selected::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent-gradient);
}
.option-grid .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--color-text-faint);
  min-width: 1.4em;
}

/* --------------------------------------------------------------- inputs */
input[type="text"], input[type="number"], input[type="password"], input[type="search"], input:not([type]), textarea, select {
  font-family: var(--font);
  font-weight: 300;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0;
  padding: 8px 10px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--color-text-secondary); }
input::placeholder, textarea::placeholder { color: var(--color-text-faint); }

.custom-class { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.custom-class label {
  display: block; width: 100%;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-text-muted);
}
.custom-class input { flex: 1 1 320px; max-width: 520px; }

/* ------------------------------------------------------ setup previews */
canvas#setup-canvas {
  display: block;
  width: min(880px, 100%);
  height: auto;
  background: var(--bp-canvas);
  border: 1px solid var(--color-border-subtle);
  cursor: crosshair;
  touch-action: none;
}
#setup-cal-wrap { margin-top: 12px; }
#camera-list { margin-top: 8px; }

/* Cloud status (setup §3) */
.cloud-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; font-size: 13px; }
.cloud-status .k { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-faint); margin-right: 6px; }
.cloud-status .v { color: var(--color-text); font-family: var(--mono); font-size: 12px; }
.cloud-status .v.bad { color: var(--bp-fail); }
.cloud-status .v.warn { color: var(--accent-solid); }

.start-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.start-row .hint { margin: 0; }

/* ------------------------------------------------------------- capture */
.capture-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 0 40px;
  align-items: start;
}
@media (max-width: 960px) { .capture-layout { grid-template-columns: 1fr; } }
.capture-layout .card { border-bottom: 0; }

/* Hidden source video: the canvas shows the processed frame. Kept
   rendered (not display:none) so frames keep flowing. */
.offscreen { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

canvas#full-canvas { cursor: crosshair; touch-action: none; }
canvas#live-canvas, canvas#full-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bp-canvas);
  border: 1px solid var(--color-border-subtle);
  margin: 4px 0 10px;
}

/* Guided-flow banner: the single next instruction. A 2 px accent bar on
   the left is the one place the gradient appears on this screen. */
.guide {
  position: relative;
  border: 1px solid var(--color-border);
  padding: 12px 16px 12px 20px;
  margin: 10px 0;
  font-size: 16px;
  color: var(--color-text-primary);
}
.guide::before {
  content: "";
  position: absolute; left: -1px; top: -1px; bottom: -1px;
  width: 2px;
  background: var(--accent-gradient);
}
.guide .code {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.15em;
  padding: 0 6px;
  margin: 0 4px;
  border-bottom: 1px solid var(--color-border-strong);
}
.guide.warn { color: var(--accent-solid); }
.guide.warn::before { background: var(--accent-solid); }

/* Per-call progress chips */
.ram-progress { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.rp-item {
  position: relative;
  flex: 1 1 auto;
  text-align: center;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-faint);
}
.rp-item.analyzing { color: var(--color-text); border-color: var(--color-border); }
.rp-item.analyzing::after {
  content: "";
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
  background: var(--accent-gradient);
  animation: rp-sweep 1.2s ease-in-out infinite;
}
@keyframes rp-sweep { 0% { transform: scaleX(0.2); opacity: 0.5; } 50% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(0.2); opacity: 0.5; } }
.rp-item.done { color: var(--color-text-primary); border-color: var(--color-border); }
.rp-item.failed { color: var(--bp-fail); border-color: var(--bp-fail); }

/* Thumbnails of captured photos */
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 96px; height: 72px; object-fit: cover; border: 1px solid var(--color-border); }

/* ------------------------------------------------------ record panel */
.record-panel label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-text-muted);
}
.measure-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--color-border-subtle);
  padding: 12px 0 6px;
  margin: 8px 0 0;
}
#measure-display, #weight-display, #ic-display { font-size: 15px; color: var(--color-text-primary); }
#measure-display.no-measure, #ic-display.no-measure { color: var(--color-text-faint); }
.measure-row .hint { margin: 0; }

/* Editable overrides: every auto-read value can be corrected by hand */
.edit-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.edit-row label { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.edit-row input {
  width: 6.2rem;
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 13px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
}
.edit-row input:focus { border-bottom-color: var(--color-text-secondary); }
/* A hand-entered value reads differently from an auto-filled one:
   an accent underline, no fill. */
.edit-row input.edited { border-bottom: 2px solid var(--accent-solid); color: var(--color-text-primary); }
.edited-hint { margin: 0; font-style: italic; color: var(--color-text-faint); }

/* RAM extraction fields */
.ram-fields { margin: 12px 0; }
.rf-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 14px; }
.rf-grid label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.rf-grid label.wide { grid-column: 1 / -1; }
.rf-grid input, .rf-grid textarea { font-size: 14px; padding: 6px 8px; }
.rf-grid .lowconf { border-bottom: 2px solid var(--accent-solid); }
.rf-reasoning { max-height: 6em; overflow-y: auto; font-size: 12px; }

/* Gold panel — per-strip table, mask previews */
.gold-fields { margin: 12px 0; }
.gold-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; font-family: var(--mono); }
.gold-table th, .gold-table td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--color-border-subtle); }
.gold-table th:first-child, .gold-table td:first-child,
.gold-table th:nth-child(2), .gold-table td:nth-child(2),
.gold-table th:nth-child(3), .gold-table td:nth-child(3) { text-align: left; }
.gold-table thead th {
  font-family: var(--font); font-weight: 300;
  color: var(--color-text-faint); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
}
.gold-table tfoot th { border-top: 1px solid var(--color-border-strong); border-bottom: 0; color: var(--color-text-primary); font-weight: 400; }
.gold-grand { margin: 8px 0 4px; color: var(--color-text-primary); }
.gold-mask { width: 100%; display: block; border: 1px solid var(--color-border-subtle); margin: 8px 0 4px; }

/* Scale readout debug */
.scale-debug { margin-top: 12px; padding: 12px 0 0; border-top: 1px solid var(--color-border-subtle); }
.scale-debug .label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-text-faint); }
.scale-debug .imgs { display: flex; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.scale-debug img { max-height: 80px; max-width: 45%; border: 1px solid var(--color-border-subtle); background: var(--bp-canvas); }
.scale-debug .hint { margin: 0; }

.notes-mode { color: var(--accent-solid); text-transform: none; letter-spacing: 0; font-size: 12px; margin-left: 8px; }
textarea#notes { width: 100%; resize: vertical; }
textarea#notes.dictating { border-color: var(--accent-solid); }

#btn-save, #btn-done { width: 100%; margin-top: 12px; justify-content: center; }
.label-callout { margin: 16px 0 0; }
.label-callout .code { font-size: 28px; }
#btn-done { margin-top: 10px; }

.save-status { margin-top: 10px; font-size: 14px; min-height: 1.4em; }
.save-status.ok { color: var(--color-text-primary); }
.save-status.err { color: var(--bp-fail); }

/* ---------------------------------------------------------------- modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;            /* dialogs are the one rounded surface */
  padding: 24px 28px;
  max-width: 560px; width: 92%;
}
.modal-box h3 { margin: 0 0 10px; font-size: 20px; font-weight: 300; color: var(--color-text-primary); }
.modal-box ul { margin: 4px 0 10px; padding-left: 18px; }
.modal-box li { margin: 4px 0; }

/* --------------------------------------------------------------- footer */
footer {
  border-top: 1px solid var(--color-border-subtle);
  padding: 10px 24px 14px;
}
.transcript {
  color: var(--color-text-faint);
  font-family: var(--mono);
  font-size: 13px;
  min-height: 1.4em;
}
.transcript.heard { color: var(--color-text-primary); }
.commands { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.commands span {
  border: 1px solid var(--color-border-subtle);
  color: var(--color-text-faint);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 2px 8px;
}

@media (max-width: 720px) {
  header { padding: 0 16px; gap: 12px; }
  .subtitle { display: none; }
  main.screen { padding: 4px 16px 32px; }
  .card h2 { font-size: 19px; }
  .rf-grid { grid-template-columns: 1fr 1fr; }
}

/* ------------------------------------------------ cloud / data-tab chrome */
.unsent-badge {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-solid);
  border: 1px solid var(--accent-solid);
  padding: 5px 10px;
  white-space: nowrap;
  cursor: pointer;
}
.unsent-badge.bad { color: var(--bp-fail); border-color: var(--bp-fail); }
.version-banner {
  border-bottom: 1px solid var(--color-border);
  padding: 8px 24px;
  font-size: 13px;
  color: var(--color-text-secondary);
}
.version-banner a { border-bottom: 1px solid var(--color-border-strong); }
.cloud-classes { margin: 12px 0 4px; border-top: 1px solid var(--color-border-subtle); }
.cc-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 24px;
  padding: 8px 0; border-bottom: 1px solid var(--color-border-subtle);
  font-size: 14px;
}
.cc-class { color: var(--color-text-primary); }
.cc-count, .cc-last { font-size: 12px; color: var(--color-text-muted); }
.record-id { font-size: 13px; color: var(--color-text-muted); letter-spacing: 0.08em; }
.cloud-where {
  margin-left: auto;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-text-faint);
}
main.data-screen { max-width: none; padding: 0; }
footer span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-faint); }

/* --------------------------------------------------------------- gate */
/* The sign-in gate itself is the shared .andean-gate (vendor/andean). While
   it is up the header stays out of the way; the gate has its own gear. */
body.gated header, body.gated footer { display: none; }
