
:root {
  color-scheme: light;

  --bg: #eef2f7; --bg-sunken: #e4eaf2; --panel: #ffffff; --panel-2: #f4f7fb;
  --ink: #0c1622; --muted: #48607a; --faint: #5f748c;
  --line: #d4dde8; --line-strong: #b9c7d8;

  --accent: #0e7490; --accent-hover: #155e75; --accent-ink: #ffffff; --accent-soft: #e0f2f7;
  --brand-gradient: linear-gradient(135deg, #0e7490 0%, #155e75 55%, #22d3ee 100%);
  --brand-lavender: #e0f2f7; --brand-pink: #f7e8f5;
  --braze-tint-1: #f4f7fb; --braze-tint-2: #f7fafc; --braze-tint-3: #eef2f7;

  --ok: #047857; --ok-soft: #e7f8f0;
  --warn: #b45309; --warn-soft: #fdf3e0;
  --danger: #b42318; --danger-soft: #fdecea;
  --info: #175cd3; --info-soft: #e9f2fd;
  --ai: #a21caf; --ai-soft: #f7e8f5;

  --prov-observado: #1d4ed8; --prov-informado: #7c3aed; --prov-confirmado: #047857;
  --prov-calculado: #0f766e; --prov-referencia: #b45309; --prov-estimado: #c2410c;
  --prov-indisponivel: #667085;

  --stage-intake: var(--info); --stage-classified: var(--prov-informado);
  --stage-blocked: var(--danger); --stage-stale: var(--warn); --stage-decided: var(--ok);

  --font-ui: ui-sans-serif, system-ui, "Segoe UI", -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-sans-serif, system-ui, "Segoe UI", -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --r-control: 8px; --r-card: 12px; --r-sheet: 14px; --r-pill: 999px;

  --row: 40px; --touch: 44px; --rail: 62px; --inspector: 342px; --content-max: 1440px;
  --tape-h: 30px; --tele-w: 304px;

  --focus: #0e7490; --overlay: rgba(12, 22, 34, 0.42);
  --shadow-overlay: 0 24px 70px rgba(12, 22, 34, 0.22);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1); --t-fast: 150ms; --t-enter: 200ms; --t-tape: 46s;

  /* deprecated aliases — deleted with their last old consumer, never used by new CSS */
  --font: var(--font-ui); --mono: var(--font-mono);
  --radius: var(--r-card); --gap: var(--s4);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #070b12; --bg-sunken: #05080e; --panel: #0d141f; --panel-2: #121b29;
  --ink: #e6edf7; --muted: #93a5bd; --faint: #8296b0;
  --line: #1c2939; --line-strong: #27394f;

  --accent: #22d3ee; --accent-hover: #67e8f9; --accent-ink: #04222b; --accent-soft: #0e2a33;
  --brand-gradient: linear-gradient(135deg, #22d3ee 0%, #0e7490 55%, #e879f9 100%);
  --brand-lavender: #0e2a33; --brand-pink: #2a1a33;
  --braze-tint-1: #0d141f; --braze-tint-2: #121b29; --braze-tint-3: #05080e;

  --ok: #34d399; --ok-soft: #0d2a22;
  --warn: #fbbf24; --warn-soft: #2b2210;
  --danger: #fb7185; --danger-soft: #2d1218;
  --info: #60a5fa; --info-soft: #0b2530;
  --ai: #e879f9; --ai-soft: #2a1a33;

  --prov-observado: #93c5fd; --prov-informado: #c4b5fd; --prov-confirmado: #6ee7b7;
  --prov-calculado: #5eead4; --prov-referencia: #fcd34d; --prov-estimado: #fdba74;
  --prov-indisponivel: #94a3b8;

  --focus: #22d3ee; --overlay: rgba(0, 0, 0, 0.62);
  --shadow-overlay: 0 24px 80px rgba(0, 0, 0, 0.55);
}

/* Obsidiana — the landing film's scoped palette (founder-selected X skin, 2026-11-24).
   Graphite + champagne, a fixed dark language independent of the app theme. Every pair below
   clears WCAG AA (tokens.test.ts measures them); the film reads these, never a raw hex. */
.landing-film {
  --obs-bg: #0b0b0e; --obs-bg-2: #101014; --obs-panel: #15151a; --obs-panel-2: #1b1b21;
  --obs-ink: #f2eee6; --obs-muted: #a8a296; --obs-faint: #8a8578; --obs-line: #2a2620;
  --obs-gold: #c8a96a; --obs-gold-ink: #1a1408;
  --obs-ok: #9db89a; --obs-rose: #c98a7a; --obs-blue: #9aa7c0;
  --obs-font-display: "Marcellus", Georgia, serif;
  --obs-font-body: "Outfit", ui-sans-serif, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-color: var(--muted); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
svg { width: 1em; height: 1em; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* The insets are not cosmetic: an absolutely positioned ".sr-only" with "inset: auto" is placed at its
   static position, and inside a wide scroll region (the board) that position can land past the viewport,
   which makes the whole page scroll sideways for a 1px invisible span. Pinning it to the containing
   block's origin keeps it out of the scrollable overflow without changing what a screen reader reads. */
.sr-only {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink); font-weight: 650; text-decoration: none;
}
.skip:focus { left: 8px; top: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
}

@media print {
  :root {
    --bg: #ffffff; --panel: #ffffff; --panel-2: #ffffff; --ink: #111111;
    --muted: #444444; --line: #cccccc;
  }
  .rail, .mobilebar, .topbar__actions, .toolbar, .skeleton { display: none !important; }
}


.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: var(--s4);
}
.panel h2 { margin: 0 0 var(--s2); font-size: 15px; letter-spacing: -0.01em; }
.panel h3 {
  margin: 0 0 var(--s2); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 7px 13px; border: 1px solid var(--accent);
  border-radius: var(--r-control); background: var(--accent); color: var(--accent-ink);
  font: 600 12.5px/1 var(--font-ui); text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button--ghost:hover { background: var(--bg-sunken); border-color: var(--line-strong); }
.button--sm { min-height: 28px; padding: 5px 9px; font-size: 11.5px; }
.button--icon { min-height: 32px; width: 32px; padding: 0; }
.button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.button[aria-busy="true"], .button[disabled] { opacity: 0.55; cursor: not-allowed; }

.field { display: grid; gap: var(--s1); }
.field > label, .field label { color: var(--muted); font-size: 11.5px; }
.check-label { display: inline-flex; align-items: center; gap: var(--s2); font-size: 12.5px; }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea,
.input, .select {
  min-height: 34px; width: 100%; padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  background: var(--bg); color: var(--ink); font-size: 13px; min-width: 0;
}
input[type="search"], .input--mono { font-family: var(--font-mono); font-size: 12px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0;
}

.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 2px 7px; border-radius: var(--r-pill);
  border: 1px solid color-mix(in srgb, var(--chip-colour, var(--muted)) 38%, transparent);
  background: color-mix(in srgb, var(--chip-colour, var(--muted)) 9%, transparent);
  color: var(--chip-colour, var(--muted));
  font: 600 10.5px/1.5 var(--font-ui); white-space: nowrap; letter-spacing: 0.01em;
}
.chip svg { width: 11px; height: 11px; flex: none; }
.chip--observado { --chip-colour: var(--prov-observado); }
.chip--user_provided { --chip-colour: var(--prov-informado); }
.chip--confirmed { --chip-colour: var(--prov-confirmado); }
.chip--calculated { --chip-colour: var(--prov-calculado); }
.chip--referencia { --chip-colour: var(--prov-referencia); }
.chip--estimado { --chip-colour: var(--prov-estimado); }
.chip--unavailable { --chip-colour: var(--prov-indisponivel); }

.stage-pill { --chip-colour: var(--muted); font-weight: 600; }
.stage-pill[data-stage="intake"] { --chip-colour: var(--stage-intake); }
.stage-pill[data-stage="classified"] { --chip-colour: var(--stage-classified); }
.stage-pill[data-stage="blocked"] { --chip-colour: var(--stage-blocked); }
.stage-pill[data-stage="stale"] { --chip-colour: var(--stage-stale); }
.stage-pill[data-stage="decided"] { --chip-colour: var(--stage-decided); }

.verdict { font-weight: 700; letter-spacing: 0.02em; }
.verdict[data-verdict="BUY_BULK"] { --chip-colour: var(--ok); color: var(--ok); }
.verdict[data-verdict="BUY_SAMPLE"] { --chip-colour: var(--prov-calculado); color: var(--prov-calculado); }
.verdict[data-verdict="NEGOCIAR"] { --chip-colour: var(--warn); color: var(--warn); }
.verdict[data-verdict="NAO_COMPRAR"] { --chip-colour: var(--danger); color: var(--danger); }
.verdict[data-verdict="AGUARDANDO_DADOS"] { --chip-colour: var(--muted); color: var(--muted); }

.figure { display: inline-flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; }
.figure--missing { color: var(--faint); }
.money, .num {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
  letter-spacing: -0.01em; white-space: nowrap;
}
.money--hero { font-size: 30px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; }
.money--lg { font-size: 17px; font-weight: 600; }
.money--missing { color: var(--faint); font-weight: 500; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11px; }
.meta { color: var(--muted); font-size: 11.5px; }
.src { color: var(--faint); font-size: 10.5px; }

dl.rows { display: grid; gap: var(--s2); margin: 0; }
dl.rows .row {
  display: grid; grid-template-columns: minmax(140px, 34%) 1fr; gap: var(--s3);
  align-items: baseline; padding-bottom: var(--s2); border-bottom: 1px dashed var(--line);
}
dl.rows dt { color: var(--muted); font-size: 12.5px; }
dl.rows dd { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }

.state {
  border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--r-card);
  padding: var(--s4); background: var(--panel); display: grid; gap: var(--s2);
}
.state-title { margin: 0; font: 700 13px/1.4 var(--font-ui); letter-spacing: 0.01em; }
.state-body { margin: 0; color: var(--muted); }
.state-meta { margin: 0; font: 500 11px/1.5 var(--font-mono); color: var(--muted); }
.state-fields { margin: 0; padding-left: var(--s5); color: var(--muted); font-size: 13px; }
.request-id { font-family: var(--font-mono); font-size: 11px; }
.state--failure { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); border-left-color: var(--danger); }
.state--failure .state-title { color: var(--danger); }
.state--blocked { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); border-left-color: var(--warn); }
.state--stale { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); border-left-color: var(--warn); }
.state--empty { background: var(--panel-2); border-left-color: var(--accent); }
.state--loading { border-left-color: var(--accent); }
.state--expired { border-left-color: var(--faint); }
.skeleton {
  height: 64px; border-radius: var(--s2);
  background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--accent) 12%, var(--line)), var(--line));
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.blocker-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.blocker {
  display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline;
  padding: var(--s2) 10px; border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--bg);
}
.blocker-condition { font-size: 12.5px; }
.blocker-fix { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.blockers { display: grid; gap: var(--s2); }

.audit { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin: var(--s2) 0 0; }
.kbd {
  font: 600 10px/1 var(--font-mono); color: var(--faint);
  border: 1px solid var(--line); border-radius: var(--s1); padding: 3px 5px; background: var(--panel);
}
.dialog {
  border: 1px solid var(--line); border-radius: var(--r-sheet);
  padding: var(--s5); background: var(--panel); color: var(--ink);
  max-width: 520px; box-shadow: var(--shadow-overlay);
}
.dialog::backdrop { background: var(--overlay); }
/* A closed dialog never paints. The palette sets display:flex by class, which overrides the UA's
 * dialog:not([open]) rule; without this guard the command palette sits over every /app page after it is
 * closed (found in the 2026-11-27 browser pass). Specificity (0,2,1) beats any single-class rule below. */
dialog.dialog:not([open]) { display: none; }


.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.shell--public { grid-template-columns: minmax(0, 1fr); }
.rail {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column; gap: var(--s3);
  border-right: 1px solid var(--line); background: var(--panel); padding: var(--s3) 0;
}
.rail__brand, .rail__link, .rail__tail .button, .rail__tail form { position: relative; }
.rail__brand {
  display: flex; align-items: center; justify-content: center;
  padding: var(--s1) 0 var(--s2); text-decoration: none;
}
.rail__brand .rail__mark { background: var(--accent); color: var(--accent-ink); }
.rail__mark {
  display: grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: var(--r-control); background: var(--bg-sunken); color: var(--ink);
  font: 600 12px/1 var(--font-mono);
}
.rail__nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail__link {
  display: flex; align-items: center; justify-content: center;
  margin: 0 var(--s2); padding: 6px 0; border-radius: var(--r-control);
  color: var(--muted); text-decoration: none;
}
.rail__link:hover, .rail__link:focus-visible { background: var(--bg-sunken); color: var(--ink); }
.rail__link[aria-current="page"] { color: var(--ink); }
.rail__link[aria-current="page"] .rail__mark { background: var(--accent); color: var(--accent-ink); }
.rail__label {
  position: absolute; left: calc(var(--rail) - 6px); top: 50%; transform: translateY(-50%);
  padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--panel); color: var(--ink); font-size: 12px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity var(--t-fast) var(--ease); z-index: 60;
}
.rail__brand:hover .rail__label, .rail__brand:focus-visible .rail__label,
.rail__link:hover .rail__label, .rail__link:focus-visible .rail__label,
.rail__tail .button:hover .rail__label, .rail__tail .button:focus-visible .rail__label { opacity: 1; }
.rail__tail {
  margin-top: auto; display: grid; gap: var(--s2); justify-items: center;
  padding-top: var(--s3); border-top: 1px solid var(--line); margin-left: var(--s2); margin-right: var(--s2);
}
.rail__meta { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); background: var(--panel);
}
.topbar__title { min-width: 0; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.topbar__sub { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.topbar__intake { flex: 1 1 320px; max-width: 560px; min-width: 0; }
.topbar__actions { display: flex; align-items: center; gap: var(--s2); }
/* One line, no decoration: the field, Analisar, and the paid re-read (D-073 §3). */
.intakebar { display: flex; align-items: center; gap: var(--s2); }
.intakebar input[type="url"] { flex: 1 1 auto; min-width: 0; }
.intakebar .button { flex: none; }
.intakebar__refresh { color: var(--muted); }
.topbar__actions [data-rec-toggle] { display: none; }
.content {
  width: 100%; max-width: var(--content-max); padding: var(--s5);
  display: grid; gap: var(--s4); align-content: start;
}
/* A grid item's "min-width: auto" lets a wide child (a table, the board) widen the whole page. The
   scroll region belongs to the child, never to the document. */
.content > * { min-width: 0; }
footer.site {
  margin-top: auto; padding: var(--s4) var(--s5); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px;
}
.brand { display: block; font-weight: 650; letter-spacing: -0.01em; text-decoration: none; }
.topnav { display: flex; gap: var(--s3); align-items: center; }
.topnav a { text-decoration: none; color: var(--muted); }
.topnav a:hover { color: var(--ink); }
.mobilebar { display: none; }

@media (min-width: 1280px) {
  .topbar__actions [data-rec-toggle] { display: inline-flex; }
  /* D-073a: the desk frame is exactly the viewport; the table scrolls inside it and the page never
     scrolls. height: 100vh on the frame (not min-height) is what makes scrollH == clientH true. */
  .shell--app { height: 100vh; overflow: hidden; }
  .shell--app .main { height: 100vh; min-height: 0; overflow: hidden; }
  .shell--app .topbar { position: static; flex: none; padding: var(--s2) var(--s5); }
  .shell--app .content {
    flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 0; max-width: none;
    grid-template-rows: minmax(0, 1fr); align-content: stretch;
  }
}
@media (min-width: 1024px) {
  /* The app frame has the rail for navigation; the legal footer belongs to the public pages (D-073 §5). */
  .shell--app footer.site { display: none; }
}
@media (max-width: 1023px) {
  .shell, .shell--public { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { flex-wrap: wrap; padding: var(--s2) var(--s3); }
  .topbar__intake { order: 3; flex-basis: 100%; max-width: none; }
  .topbar__actions .meta { display: none; }
  .content { padding: var(--s3); padding-bottom: calc(var(--touch) + var(--s4)); }
  footer.site { display: none; }
  .mobilebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    background: var(--panel); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobilebar__link {
    display: grid; justify-items: center; align-content: center; gap: 2px;
    min-height: var(--touch); padding: 4px 2px; border: 0; background: none;
    color: var(--muted); font-size: 10px; text-decoration: none;
  }
  .mobilebar__link[aria-current="page"] { color: var(--accent); font-weight: 600; }
  .mobilebar__mark { font: 600 12px/1 var(--font-mono); }
}
@media (max-width: 390px) {
  .content { padding: var(--s2); }
}


.desk {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--inspector);
  gap: var(--s4); align-items: start; min-width: 0;
}
.desk__main { display: grid; gap: var(--s3); align-content: start; min-width: 0; }

/* the only allowed horizontal region; the page itself never scrolls sideways */
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data.desk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data.desk-table caption { text-align: left; }
table.data.desk-table th {
  position: sticky; top: 0; z-index: 2; background: var(--panel-2); color: var(--faint);
  font: 650 10px/1.4 var(--font-ui); text-transform: uppercase; letter-spacing: 0.06em;
  text-align: left; padding: var(--s2) var(--s3); white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data.desk-table td {
  height: var(--row); padding: var(--s1) var(--s3);
  border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap;
}
table.data.desk-table tbody tr:hover { background: var(--bg-sunken); }
table.data.desk-table tbody tr:focus-within { background: var(--accent-soft); }
table.data.desk-table tbody tr[data-current="1"] { background: var(--accent-soft); }

.cell-product { min-width: 220px; white-space: normal; }
.cell-product__name {
  display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis;
  font-weight: 600; color: var(--ink); text-decoration: none;
}
.cell-product__name:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.cell-product__meta { display: block; color: var(--faint); font-size: 10.5px; white-space: nowrap; }
.cell-stage { white-space: nowrap; }
.cell-money, .cell-margin { text-align: right; white-space: nowrap; }
.cell-money .chip { margin-left: var(--s1); }
.cell-margin .figure { justify-content: flex-end; }
.cell-margin__ref { display: block; color: var(--faint); font-size: 10.5px; text-align: right; }
.cell-verdict { white-space: nowrap; }
.cell-blockers { max-width: 260px; white-space: normal; }
.cell-blockers a { text-decoration: none; }
.cell-blockers a:hover .blocker-summary { color: var(--accent); }
.cell-updated { color: var(--muted); white-space: nowrap; }
.cell-action { text-align: right; white-space: nowrap; }
.blocker-summary { color: var(--warn); font-size: 12px; }
.blocker-summary--more .count { color: var(--faint); }

/* --- the toolbar (D-073 §4) ------------------------------------------------------------------ */
.toolbar {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; flex: none;
  padding: var(--s2) var(--s5); border-bottom: 1px solid var(--line); background: var(--panel);
}
.segmented {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-control);
  overflow: hidden; background: var(--bg-sunken);
}
.segmented__link {
  display: inline-flex; align-items: center; padding: 5px 12px;
  font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.segmented__link:hover { color: var(--ink); }
.segmented__link[aria-current="page"] { background: var(--panel); color: var(--ink); }
.toolbar .search { flex: 0 1 auto; }
.toolbar .search input[type="search"] { width: min(240px, 100%); }
.toolbar__filter { display: inline-flex; align-items: center; gap: var(--s1); }
.toolbar__filter select { max-width: 190px; }
.toolbar__spacer { flex: 1 1 auto; }
.toolbar__meta { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* --- the discoveries shelf: a strip, expanded on demand (D-073 §5) --------------------------- */
.shelf { flex: none; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.shelf > summary {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2);
  padding: var(--s2) var(--s5); cursor: pointer; list-style: none;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.shelf > summary::-webkit-details-marker { display: none; }
.shelf > summary:hover { color: var(--ink); }
.shelf__count {
  padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r-pill);
  color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums;
  text-transform: none; letter-spacing: 0; font-weight: 600;
}
.shelf__body { display: grid; gap: var(--s2); padding: 0 var(--s5) var(--s3); }
.shelf .discoveries { display: flex; flex-wrap: wrap; gap: var(--s3); border: 0; background: none; padding: 0; }
.shelf .discoveries-group h3 { display: flex; align-items: center; gap: var(--s1); font-size: 10px; }
.shelf .discoveries-group h3 .count {
  padding: 0 5px; border: 1px solid var(--line); border-radius: var(--r-pill);
  color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums;
}
.shelf .discoveries-group ul { display: flex; flex-wrap: wrap; gap: var(--s2); }
.shelf .discovery { font-size: 12px; gap: var(--s2); }
.shelf .discovery .title { font-weight: 600; font-size: 12px; }
.shelf .discovery .button { min-height: 24px; padding: 2px 7px; font-size: 11px; }

/* --- the table foot -------------------------------------------------------------------------- */
.table-foot {
  display: flex; align-items: center; gap: var(--s2); flex: none;
  padding: var(--s2) var(--s3); border-top: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); font-size: 12px;
}
.table-foot__spacer { flex: 1 1 auto; }

/* The first-run/empty state keeps the big dock panel and nothing else (D-073 §3). */
.first-run { display: grid; gap: var(--s4); align-content: start; padding: var(--s4) var(--s5); }
/* the discoveries strip below 1280: the same short list, still not a feed */
.discoveries { display: grid; gap: var(--s3); }
.discoveries-group h3 { display: flex; align-items: center; gap: var(--s2); }
.discoveries-group h3 .count {
  padding: 1px 6px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums;
  text-transform: none; letter-spacing: 0;
}
.discoveries-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.discovery { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.discovery .title { font-weight: 600; font-size: 12.5px; }

.search { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.search input[type="search"] { width: min(320px, 100%); }
.inspector {
  display: grid; align-content: start; gap: var(--s4);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: var(--s4); min-width: 0;
  position: sticky; top: var(--s4);
  max-height: calc(100vh - var(--s6)); overflow: auto;
}
.inspector h2 { margin: 0; font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.inspector h3 {
  margin: 0; color: var(--faint); font: 650 10px/1.3 var(--font-ui);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.inspector__head, .inspector__identity { display: grid; gap: var(--s2); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.inspector__head .state-meta { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.inspector__body { display: grid; gap: var(--s4); align-content: start; }
.inspector__body section { display: grid; gap: var(--s2); }
.inspector__hero { margin: 0; }
.inspector__hero .num { font-size: 24px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.inspector__open { margin: 0; }
.inspector--no-card, .inspector--failure { border-color: var(--line-strong); }
.inspector .field { margin-bottom: var(--s2); }
.inspector form.rows { display: grid; gap: var(--s2); }

@media (min-width: 1280px) {
  /* D-073a: the single frame. The desk is the content area; only the table pane and the inspector
     scroll. Without min-height: 0 on every level the grid refuses to shrink and the page scrolls. */
  .shell--app .desk { height: 100%; gap: 0; grid-template-rows: minmax(0, 1fr); }
  .shell--app .desk__main {
    height: 100%; min-height: 0; display: flex; flex-direction: column;
    gap: 0; align-items: stretch;
  }
  /* Toolbar and shelf are the desk's header strip, not a shell band: the inspector has to start at the
     topbar and be as tall as the frame, so they belong inside the table pane's column. */
  .shell--app .desk__main > .toolbar,
  .shell--app .desk__main > .shelf,
  .shell--app .desk__main > .table-foot { flex: none; }
  .shell--app .table-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
  .shell--app .inspector {
    position: static; max-height: none; height: 100%; overflow: auto;
    border-radius: 0; border-top: 0; border-right: 0; border-bottom: 0;
  }
  .shell--app .inspector { padding: var(--s5); }
  /* The desk scrolls inside the table pane and the inspector; the board, the first-run dock and the
     manual form are their own scroll regions, so the page still never scrolls. */
  .shell--app .content:has(.first-run),
  .shell--app .content:has(.manual),
  .shell--app .content:has(.board) { overflow: auto; }
  .shell--app .first-run { overflow: auto; }
  table.data.desk-table td { height: 50px; }
}
@media (max-width: 1279px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .inspector { order: -1; position: static; max-height: none; }
}
@media (max-width: 1023px) {
  .toolbar { padding: var(--s2) var(--s3); }
  .shelf > summary { padding: var(--s2) var(--s3); }
  .shelf__body { padding: 0 var(--s3) var(--s3); }
  .first-run { padding: var(--s3); }
  table.data.desk-table td { height: auto; padding: var(--s2) var(--s2); }
  .desk-table .col-stage, .desk-table .col-margin, .desk-table .col-updated, .desk-table .col-action { display: none; }
  .cell-product__name { max-width: 100%; }
}
@media (max-width: 767px) {
  .desk-table .col-verdict { display: none; }
  .cell-product { min-width: 150px; }
  .inspector { border-radius: 0; padding: var(--s3); }
  .search input[type="search"] { width: 100%; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar .search input[type="search"] { width: 100%; }
}


/* --- the desk actions row (bulk intake + the one primary action) -------------------------------- */
.desk-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s2); }
.bulk { flex: 1 1 340px; min-width: 0; }
.bulk > summary { list-style: none; cursor: pointer; }
.bulk > summary::-webkit-details-marker { display: none; }
.bulk > summary::before { content: "+"; margin-right: 6px; font-weight: 700; }
.bulk[open] > summary::before { content: "–"; }
.bulk[open] > summary { border-color: var(--accent); color: var(--accent); }
.bulk__form {
  display: grid; gap: var(--s2); margin-top: var(--s2); padding: var(--s3);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card);
}
.bulk__input { min-height: 84px; resize: vertical; font: 12px/1.5 var(--font-mono); }
.bulk__progress { width: 100%; height: 4px; }
.bulk__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; max-height: 140px; overflow: auto; }
.bulk__list li {
  display: flex; justify-content: space-between; gap: var(--s2);
  padding: 4px 8px; border-radius: var(--r-control); background: var(--bg-sunken);
  font: 11px/1.5 var(--font-mono); color: var(--muted);
}
.bulk__list li > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk__list li > b { white-space: nowrap; color: var(--faint); font-weight: 600; }
.desk-update { flex: 0 0 auto; }
.desk-update__button { min-height: 34px; }
.desk-banner {
  margin: 0; padding: var(--s2) var(--s3); border-radius: var(--r-control);
  background: var(--ok-soft); color: var(--ink); border: 1px solid var(--line);
  font: 600 12px/1.4 var(--font-ui);
}

/* --- the six staged columns ------------------------------------------------------------------- */
table.desk-v2 { table-layout: auto; }
table.desk-v2 th { white-space: nowrap; }
table.desk-v2 td.cell { vertical-align: top; height: auto; min-height: 48px; padding: var(--s2) var(--s3); }
table.desk-v2 .cell-product { vertical-align: top; }
.cell-ready { display: grid; gap: 2px; min-width: 96px; }
.cell-main { display: flex; align-items: baseline; gap: 6px; }
.cell-value { font: 650 13px/1.25 var(--font-ui); color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-score { font: 500 10px/1.3 var(--font-mono); color: var(--faint); }
.cell-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.cell-date { font: 500 10px/1.4 var(--font-mono); color: var(--faint); white-space: nowrap; }
.cell-hist { display: flex; gap: 8px; margin: 2px 0 0; padding: 0; }
.cell-hist > div { display: grid; gap: 0; }
.cell-hist dt { font: 600 8.5px/1.3 var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.cell-hist dd { margin: 0; font: 600 10px/1.3 var(--font-mono); color: var(--ink); }
.cell-hist__value { font-variant-numeric: tabular-nums; }
.cell--missing .cell-gen { display: inline-flex; }
.cell--missing .button[data-locked="1"] { opacity: 0.45; cursor: not-allowed; }
.cell-add {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-left: 6px;
  border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--accent);
  font: 700 14px/1 var(--font-ui); text-decoration: none; vertical-align: middle;
}
.cell-add:hover { border-color: var(--accent); background: var(--accent-soft); }
.cell--sale .cell-add { margin-left: 8px; }

/* --- the +link attachment form ---------------------------------------------------------------- */
.link-form { display: grid; gap: var(--s2); padding: var(--s3); }
.link-form__title { margin: 0; font: 650 15px/1.25 var(--font-display); }
.link-form .actions { display: flex; gap: var(--s2); }
.field-label { font: 600 11px/1.4 var(--font-ui); color: var(--muted); }

/* --- Braze surfaces around the data ----------------------------------------------------------- */
.shell--app .topbar {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border-bottom: 1px solid var(--line);
}
.mini-btn, .button { border-radius: var(--r-pill); }
.button--sm { border-radius: var(--r-pill); }
.shell--app .content { padding-top: var(--s3); }
.data.desk-table { border: 1px solid var(--line); border-radius: var(--r-sheet); overflow: hidden; }
.data.desk-table th:first-child { border-top-left-radius: var(--r-sheet); }


/* --- the inspector gets the Braze surface, not a second style system ------------------------- */
.shell--app .inspector {
  border: 1px solid var(--line); border-radius: var(--r-sheet); background: var(--panel);
  box-shadow: 0 24px 60px -46px rgba(20, 18, 14, 0.5);
}
.inspector__head {
  background: var(--brand-lavender); border-bottom: 1px solid var(--line);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
}
.inspector__money .num { font-family: var(--font-display); font-weight: 700; }
.shell--app .topbar h1 { font-family: var(--font-display); letter-spacing: -0.03em; }
.shell--app .toolbar { border-bottom: 1px solid var(--line); padding-bottom: var(--s2); }
@media (prefers-reduced-motion: reduce) {
  .bulk__list li > b { animation: none !important; }
}

/* --- the insertion row: one field, inside the table (D-087 review) ---------------------------- */
.desk--solo { grid-template-columns: minmax(0, 1fr); }
.shell--app .desk--solo .desk__main { max-width: none; }
.intake-row td.intake-cell { padding: 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.intake-inline { display: grid; gap: 6px; white-space: normal; }
.intake-cell, .intake-inline__help, .intake-inline__manual { white-space: normal; overflow-wrap: anywhere; }
.intake-inline__main { display: flex; align-items: flex-start; gap: 8px; }
.intake-inline__field {
  flex: 1 1 auto; min-height: 42px; height: 42px; resize: vertical; border-radius: 10px;
  padding: 10px 12px; font: 500 12.5px/1.4 var(--font-ui);
}
.intake-inline .button { min-height: 42px; flex: none; }
.intake-inline__help, .intake-inline__manual { margin: 0; font-size: 11px; color: var(--faint); }
.intake-inline__manual a { color: var(--accent); }
.desk-empty { padding: 14px 2px; display: grid; gap: 4px; }
.desk-empty .state-title { margin: 0; font: 800 14px/1.3 var(--font-ui); }
.desk-empty .state-body { margin: 0; max-width: 62ch; color: var(--muted); font-size: 12.5px; }
@media (max-width: 1023px) {
  .intake-cell { position: sticky; left: 0; z-index: 2; }
  .intake-inline { width: calc(100vw - 24px); max-width: 100%; }
  .intake-inline__main { flex-wrap: wrap; }
  .intake-inline__field { flex-basis: 100%; }
  .intake-inline .button { width: 100%; }
}


@media (min-width: 1280px) {
  /* Fixed layout is what makes percentages binding: no cell can widen its column on its own. */
  table.data.desk-table { table-layout: fixed; }
  table.data.desk-table col.col-product { width: 23%; }
  table.data.desk-table col.col-stage { width: 8%; }
  table.data.desk-table col.col-money { width: 12%; }
  table.data.desk-table col.col-margin { width: 8%; }
  table.data.desk-table col.col-verdict { width: 15%; }
  table.data.desk-table col.col-blockers { width: 13%; }
  table.data.desk-table col.col-updated { width: 12%; }
  table.data.desk-table col.col-action { width: 9%; }
  /* 8px of side padding instead of 12: the header labels and the money figures keep their own line. */
  table.data.desk-table th, table.data.desk-table td { padding-left: var(--s2); padding-right: var(--s2); }
  table.data.desk-table th, table.data.desk-table td { overflow: hidden; text-overflow: ellipsis; }
  /* The product cell is the one that wraps to two lines; it must not claim a min-width in fixed layout. */
  .desk-table .cell-product { min-width: 0; }
  .desk-table .cell-product__name { max-width: 100%; }
  /* Blockers become one truncated line, with the summary as its title; the row height stays 50px. */
  /* The money cell stacks its provenance chip under the number, so the figure itself is never the
     thing that gets ellipsized. */
  .desk-table .cell-money .chip { display: block; margin-left: 0; margin-top: 1px; }
  .desk-table .cell-blockers { max-width: none; white-space: nowrap; }
  .desk-table .cell-blockers a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}


.record { display: grid; gap: var(--s4); width: 100%; max-width: 920px; min-width: 0; margin-inline: auto; }
.record__head { display: grid; gap: var(--s2); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
.record__meta {
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  color: var(--muted); font-size: 12px;
}
.record__blockers { color: var(--warn); font-size: 12px; font-weight: 600; text-decoration: none; }
.record__blockers:hover { text-decoration: underline; }
.record__moneyrow {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap;
}
.record__money { display: grid; gap: var(--s1); }
.record__label {
  color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
}
.record__money .num { font: 700 24px/1 var(--font-mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.record__actions { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-left: auto; }
.record__body { display: grid; gap: var(--s3); min-width: 0; }

.gate-stepper { min-width: 0; }
.gate-stepper ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
.gate-stepper li { flex: 1 1 auto; min-width: 0; }
.gate-stepper a {
  display: flex; align-items: center; gap: var(--s1); min-height: var(--row);
  padding: var(--s1) var(--s2); border-radius: var(--r-control);
  color: var(--muted); font: 600 11px/1.2 var(--font-ui); text-decoration: none;
}
.gate-stepper a:hover { background: var(--bg-sunken); color: var(--ink); }
.gate-stepper a[aria-current="step"] { background: var(--accent-soft); color: var(--ink); }
.gate-stepper__n {
  display: grid; place-items: center; width: 19px; height: 19px; flex: none;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  font: 600 9.5px/1 var(--font-mono);
}
.gate-stepper a[data-status="done"] .gate-stepper__n {
  background: var(--ok-soft); border-color: var(--ok); color: var(--ok);
}
.gate-stepper a[data-status="open"]:not([aria-current="step"]) .gate-stepper__n {
  border-color: var(--warn); color: var(--warn);
}
.gate-stepper a[aria-current="step"] .gate-stepper__n {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
.gate-stepper__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel.section { display: grid; gap: var(--s3); min-width: 0; scroll-margin-top: var(--s8); }
.panel.section > h2 { margin: 0; }
.panel.section dl.rows .row:last-child { border-bottom: 0; padding-bottom: 0; }
.panel.section .state-meta code, .panel.section .state-body code { font-family: var(--font-mono); }
/* evidence blocks: hashes, audit lines and long codes wrap at 390 instead of widening the page */
.panel.section dd code, .panel.section .audit { overflow-wrap: anywhere; }

.scenario { width: 100%; border-collapse: collapse; font-size: 12px; }
.scenario th {
  text-align: left; color: var(--faint); font: 700 9.5px/1.4 var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: var(--s1) var(--s2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.scenario tbody th {
  color: var(--ink); font: 600 12px/1.4 var(--font-ui);
  text-transform: none; letter-spacing: 0;
}
.scenario td { padding: var(--s2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.scenario td.num, .scenario th.num { text-align: right; }
.scenario tr[data-primary="true"] { background: var(--ok-soft); }
.scenario tr[data-primary="true"] th { color: var(--ink); }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.timeline__item { display: flex; align-items: baseline; gap: var(--s2); font-size: 12px; flex-wrap: wrap; }
.timeline__dot {
  width: 6px; height: 6px; border-radius: var(--r-pill);
  background: var(--line-strong); flex: none; align-self: center;
}
.timeline__item time { color: var(--faint); font: 10.5px var(--font-mono); }

.blockers { display: grid; gap: var(--s2); }
#pendencias, #refazer, #auditoria { scroll-margin-top: var(--s8); }
.blockers h3 { margin: 0; }

/* §9 the assistant (P3, D-090). Tokens only — no raw colour, no literal font. */
.assistant { display: grid; gap: var(--s3); }
.assistant__consent {
  display: grid; gap: var(--s2); padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--bg-sunken);
}
.assistant__accept { display: flex; align-items: center; gap: var(--s2); font-size: 12px; cursor: pointer; }
.assistant__log {
  list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3);
  max-height: 420px; overflow-y: auto;
}
.assistant__turn { display: grid; gap: var(--s1); }
.assistant__turn[data-role="user"] .assistant__body { color: var(--muted); }
.assistant__who { font: 700 10px/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ai); }
.assistant__body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.assistant__form { display: flex; gap: var(--s2); align-items: center; }
.assistant__input { flex: 1 1 auto; min-width: 0; }
.assistant__proposal {
  display: grid; gap: var(--s2); padding: var(--s3);
  border: 1px solid color-mix(in srgb, var(--ai) 40%, var(--line-strong)); border-radius: var(--r-control);
  background: var(--ai-soft);
}
#assistente { scroll-margin-top: var(--s8); }

@media (max-width: 1023px) {
  .gate-stepper a { min-height: var(--touch); }
}
@media (max-width: 640px) {
  .gate-stepper li { flex: 1 1 calc(50% - 2px); }
  .gate-stepper__label { white-space: normal; }
  .record__actions { margin-left: 0; }
  .record__money .num { font-size: 20px; }
  /* tables fit and wrap at 390 — no horizontal region on the card (long tokens break, never widen the page) */
  .panel.section { padding: var(--s3); }
  .record table { table-layout: fixed; width: 100%; font-size: 11px; }
  .record th, .record td { white-space: normal; overflow-wrap: anywhere; padding: var(--s1); }
}


.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--s3);
  align-items: start;
  min-width: 0;
  max-width: 100%;
}
.column {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  min-width: 0;
  padding: var(--s3);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.column > header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s2);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.column > header h2 {
  margin: 0;
  font: 700 10px/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.column > header .count {
  margin-left: auto;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--faint);
  font: 600 10.5px/1 var(--font-mono);
}
.column > header .hint {
  flex-basis: 100%;
  margin: 0;
  color: var(--faint);
  font-size: 10.5px;
}
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.column__empty {
  padding: var(--s3);
  border: 1px dashed var(--line);
  border-radius: var(--r-control);
  color: var(--faint);
  font-size: 11.5px;
  text-align: center;
}
.pcard {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  transition: border-color var(--t-fast) var(--ease);
}
.pcard:hover { border-color: var(--line-strong); }
.pcard:focus-within { border-color: var(--accent); }
.pcard__link {
  display: grid;
  gap: var(--s2);
  min-height: var(--touch);
  padding: var(--s2) 10px;
  border-radius: inherit;
  text-decoration: none;
}
.pcard__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}
.pcard__link:hover .pcard__title { text-decoration: underline; }
.pcard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s2);
  min-width: 0;
  color: var(--faint);
  font-size: 10.5px;
}
.pcard__meta .figure .num { color: var(--ink); font: 650 13px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
.pcard__blockers .num { color: var(--warn); }
.pcard__stale { color: var(--warn); font-weight: 600; }

@media (max-width: 1023px) {
  .board {
    width: 100%;
    grid-template-columns: repeat(5, min(86vw, 320px));
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
  }
  .column { scroll-snap-align: start; }
}


/* ---------- intake dock ---------- */
.dock {
  display: grid; gap: var(--s3); padding: var(--s5);
  border-color: var(--line-strong); background: var(--panel);
}
.dock h2 { margin: 0; font: 650 20px/1.2 var(--font-display); letter-spacing: -0.015em; }
.dock .state-body { margin: 0; max-width: 60ch; }
.dock-form { display: grid; gap: var(--s3); }
.dock-entry { display: flex; align-items: stretch; gap: var(--s2); }
.dock-entry input {
  flex: 1 1 auto; min-width: 0; min-height: var(--row);
  font-family: var(--font-mono); font-size: 12.5px;
}
.dock .button { min-height: var(--row); }
.dock-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.dock [data-cost-warning], .dock [data-testid="extraction-blocked"] {
  border-left: 2px solid var(--warn); padding-left: var(--s2);
}

/* notices: informational by default; the confirmed one is the only green note */
.notice {
  margin: 0; padding: var(--s2) var(--s3); border-radius: var(--r-control);
  border: 1px solid color-mix(in srgb, var(--info) 38%, var(--line));
  background: var(--info-soft); color: var(--ink);
}
.notice[data-wizard-confirmed] {
  display: grid; gap: var(--s1);
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  background: var(--ok-soft);
}

/* ---------- manual intake ---------- */
.manual { display: grid; gap: var(--s3); }
.manual h2 { margin: 0; font: 650 20px/1.2 var(--font-display); letter-spacing: -0.015em; }
.manual-form { display: grid; gap: var(--s3); max-width: 720px; }
.manual-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.manual-fields .field:first-child { grid-column: 1 / -1; }
.manual-form input { min-height: var(--row); }
.manual-form .button { min-height: var(--row); justify-self: start; }
.manual-form .state-meta { max-width: 60ch; }

/* ---------- NCM wizard ---------- */
.wizard { display: grid; gap: var(--s4); }
.steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.steps li { flex: 1 1 0; min-width: 9rem; }
.steps a {
  display: flex; align-items: center; gap: var(--s2); min-height: var(--row);
  padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--panel); color: var(--muted); font: 600 12.5px/1.2 var(--font-ui); text-decoration: none;
}
.steps a:hover { border-color: var(--accent); color: var(--ink); }
.steps a[aria-current="step"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.steps .step__n {
  display: grid; place-items: center; width: var(--s5); height: var(--s5); flex: none;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  font: 600 10.5px/1 var(--font-mono); color: var(--faint);
}
.steps a[aria-current="step"] .step__n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps .step__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

[data-wizard-step] { display: grid; gap: var(--s3); padding: var(--s5); }
[data-wizard-step] > h2 { margin: 0; font: 650 18px/1.2 var(--font-display); letter-spacing: -0.01em; }
[data-wizard-step] form { display: grid; gap: var(--s3); max-width: 680px; }
[data-wizard-step] form > .button { justify-self: start; }
[data-wizard-step] input:not([type="hidden"]), [data-wizard-step] button { min-height: var(--row); }
[data-wizard-step] textarea { min-height: 7rem; resize: vertical; }

.result {
  display: grid; gap: var(--s2); padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel-2);
}
.result .state-title { font: 650 14px/1.3 var(--font-display); }
.ladder { display: grid; gap: var(--s1); }
.ladder > p { margin: 0; }
.ladder ol, ol.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1); }
.ladder li { display: inline-flex; align-items: center; gap: var(--s1); }
.ladder code, .candidate code, .rung code {
  font-family: var(--font-mono); font-size: 11.5px;
  padding: 1px var(--s1); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--bg);
}

.candidates { display: grid; gap: var(--s2); }
.candidate-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.candidate {
  display: grid; gap: var(--s2); padding: var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel);
}
.candidate[data-quotable="0"] { background: var(--panel-2); }
.candidate .state-title { margin: 0; font-size: 13px; }
.rates { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); margin: 0; font-size: 12.5px; }
.rate-label { font: 600 10px/1 var(--font-mono); color: var(--faint); letter-spacing: 0.04em; }

.browse { display: grid; gap: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }
.breadcrumb {
  list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1);
  align-items: center; font-size: 12px;
}
.breadcrumb li + li::before { content: "›"; margin-right: var(--s1); color: var(--faint); }
.tree { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.rung {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--bg);
}
.rung .state-title { flex: 1 1 12rem; margin: 0; font-size: 12.5px; }
.rung[data-quotable="0"] .state-title { color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.checks li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2);
  padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-control); background: var(--bg);
}
.checks li[data-ok="1"] .chip { --chip-colour: var(--ok); }
.checks li[data-ok="0"] .chip { --chip-colour: var(--warn); }
.requirements {
  display: grid; gap: var(--s2); padding: var(--s3);
  border: 1px solid color-mix(in srgb, var(--warn) 42%, var(--line));
  border-radius: var(--r-card); background: var(--panel-2);
}
.requirements ul { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s1); font-size: 12.5px; }
.rate { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); margin: 0; }
.rate--missing {
  padding: var(--s2) var(--s3); border: 1px solid color-mix(in srgb, var(--warn) 42%, var(--line));
  border-radius: var(--r-control); background: var(--panel-2);
}
table.data--compact { width: auto; font-size: 12.5px; }
table.data--compact th, table.data--compact td { padding: var(--s1) var(--s3) var(--s1) 0; border-bottom: 1px solid var(--line); }
table.data--compact tr:last-child th, table.data--compact tr:last-child td { border-bottom: 0; }

/* ---------- intake receipt ---------- */
.receipt {
  display: grid; gap: var(--s3); padding: var(--s4);
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel);
}
.receipt > h2 { margin: 0; font: 650 18px/1.2 var(--font-display); letter-spacing: -0.01em; }
.receipt ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.receipt-step {
  display: grid; grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr); gap: var(--s1) var(--s3);
  align-items: baseline; padding: var(--s2) var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--bg);
}
.receipt-step .step-name { font-size: 12.5px; font-weight: 600; }
.receipt-step .status { font-size: 11.5px; color: var(--muted); }
.receipt-step[data-status="ok"] .status { color: var(--ok); }
.receipt-step[data-status="blocked"] .status { color: var(--danger); }
.receipt-step p.state-meta { grid-column: 1 / -1; font-family: var(--font-mono); font-size: 11.5px; }
.receipt-warnings {
  list-style: none; margin: 0; padding: var(--s2) var(--s3); display: grid; gap: var(--s1);
  border-left: 2px solid var(--warn); background: var(--panel-2);
}
.receipt-warnings li { color: var(--warn); font-size: 12px; }
.receipt [data-deduped] {
  padding: var(--s2) var(--s3); border-radius: var(--r-control);
  border: 1px solid color-mix(in srgb, var(--info) 38%, var(--line));
  background: var(--info-soft); color: var(--ink);
}
.receipt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }

/* ---------- tool pages ---------- */
.tool { display: grid; gap: var(--s3); }
.tool h2 { margin: 0; font: 650 18px/1.2 var(--font-display); letter-spacing: -0.01em; }
.tool-form { display: grid; gap: var(--s3); max-width: 26rem; }
.tool-form input { min-height: var(--row); }
.tool-form .button { min-height: var(--row); justify-self: start; }

@media (max-width: 640px) {
  .dock, [data-wizard-step] { padding: var(--s4); }
  .dock-entry { flex-direction: column; }
  .manual-fields { grid-template-columns: minmax(0, 1fr); }
  .steps li { flex-basis: 100%; }
  .receipt-step { grid-template-columns: minmax(0, 1fr); }
}


:root[data-rec="1"] { --inspector: 400px; }
[data-rec="1"] .rail,
[data-rec="1"] .mobilebar,
[data-rec="1"] footer.site,
[data-rec="1"] .discoveries { display: none !important; }
[data-rec="1"] .shell { grid-template-columns: minmax(0, 1fr); }
[data-rec="1"] .topbar__actions > :not([data-rec-toggle]) { display: none; }
[data-rec="1"] .topbar { border-bottom-color: var(--line-strong); }
[data-rec="1"] .content { padding: var(--s6) var(--s7); align-content: start; }
[data-rec="1"] .desk-table th,
[data-rec="1"] .desk-table td { height: 56px; }
[data-rec="1"] .cell-money .money { font-size: 16px; }
[data-rec="1"] .inspector .money--hero { font-size: 34px; }
[data-rec="1"] .inspector { position: sticky; top: calc(var(--s6) + var(--s6)); }
@media print {
  [data-rec="1"] .content { padding: 0; }
}


/* ---------- the reading strip (fita de leituras) ------------------------------------------------ */
.tape {
  display: flex; align-items: stretch; min-width: 0; flex: none;
  background: var(--bg-sunken); border-bottom: 1px solid var(--line);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
}
.tape::-webkit-scrollbar { display: none; }
.tape__track {
  display: flex; align-items: center; min-width: 0; margin: 0; padding: 0;
  height: var(--tape-h); white-space: nowrap;
}
.tape__item {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: 100%; padding: 0 var(--s4);
  border-right: 1px solid var(--line);
  font: 500 11px/1 var(--font-mono); color: var(--muted);
}
.tape__label {
  color: var(--faint); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 9.5px;
}
.tape__item b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.tape__unit { color: var(--muted); font-size: 10px; }
.tape__ref { color: var(--faint); font-size: 9.5px; }
.tape__ref-only { color: var(--faint); font-size: 9.5px; letter-spacing: 0.04em; border-right: 0; }
/* a live dot on the first item: the strip is a reading, not decoration */
.tape__track > .tape__item:first-child::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}

/* ---------- the dense ledger (Need 4) ----------------------------------------------------------- */
.ledger-wrap {
  border: 1px solid var(--line); border-radius: var(--r-card) var(--r-card) 0 0;
  background: var(--panel); overflow-x: auto; overflow-y: hidden;
}
table.ledger { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.ledger th {
  position: sticky; top: 0; z-index: 2; text-align: left; white-space: nowrap;
  padding: 8px var(--s3); background: var(--bg-sunken); color: var(--faint);
  font: 700 9px/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}
table.ledger th.ledger__num, table.ledger td.ledger__num { text-align: right; }
table.ledger td {
  height: 42px; padding: 0 var(--s3); border-bottom: 1px solid var(--line);
  vertical-align: middle; white-space: nowrap;
}
table.ledger tbody tr { transition: background var(--t-fast) var(--ease); }
table.ledger tbody tr:hover { background: var(--accent-soft); }
table.ledger tbody tr.is-selected { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
table.ledger tbody tr.is-stale td { opacity: 0.8; }
table.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger__prod { min-width: 210px; max-width: 340px; }
.ledger__title {
  display: block; color: var(--ink); font: 650 11.5px/1.3 var(--font-ui); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis;
}
.ledger__title:hover { color: var(--accent); }
.ledger__sub {
  display: block; color: var(--faint); font: 500 9px/1.4 var(--font-mono);
  overflow: hidden; text-overflow: ellipsis;
}
.ledger__ncm { font: 550 11px/1.3 var(--font-mono); color: var(--muted); }
.ledger__val {
  display: block; color: var(--ink); font: 650 12px/1.3 var(--font-mono); font-variant-numeric: tabular-nums;
}
.ledger__num small { display: block; color: var(--faint); font: 500 8.5px/1.4 var(--font-mono); }
.ledger__none { color: var(--faint); }
/* margin: a sparkbar, the cockpit's one piece of at-a-glance encoding */
.ledger__margin { display: flex; align-items: center; gap: 8px; min-width: 118px; }
.ledger__bar {
  flex: 1; height: 5px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; min-width: 40px;
}
.ledger__fill { display: block; height: 100%; border-radius: 3px; background: var(--faint); }
.ledger__margin[data-tone="ok"] .ledger__fill { background: var(--ok); }
.ledger__margin[data-tone="warn"] .ledger__fill { background: var(--warn); }
.ledger__margin[data-tone="danger"] .ledger__fill { background: var(--danger); }
.ledger__margin-val { font: 650 11.5px/1 var(--font-mono); min-width: 52px; text-align: right; }
.ledger__margin[data-tone="ok"] .ledger__margin-val { color: var(--ok); }
.ledger__margin[data-tone="warn"] .ledger__margin-val { color: var(--warn); }
.ledger__margin[data-tone="danger"] .ledger__margin-val { color: var(--danger); }
.ledger__verdict { display: inline-flex; align-items: center; gap: 5px; font: 650 10.5px/1.3 var(--font-ui); }
.ledger__verdict::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none;
}
.ledger__verdict[data-verdict="BUY_BULK"] { color: var(--ok); }
.ledger__verdict[data-verdict="BUY_SAMPLE"] { color: var(--prov-calculado); }
.ledger__verdict[data-verdict="NEGOCIAR"] { color: var(--warn); }
.ledger__verdict[data-verdict="NAO_COMPRAR"] { color: var(--danger); }
.ledger__verdict[data-verdict="AGUARDANDO_DADOS"] { color: var(--muted); }
.ledger__score { color: var(--faint); font: 600 9.5px/1 var(--font-mono); }
.ledger__stage {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid var(--line-strong);
  border-radius: 6px; color: var(--muted); font: 650 9.5px/1.5 var(--font-mono); white-space: nowrap;
}
.ledger__stage::before { content: ""; width: 5px; height: 5px; border-radius: 1px; background: currentColor; }
.ledger__stage[data-stage="blocked"] {
  color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}
.ledger__stage[data-stage="stale"] {
  color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent);
}
.ledger__stage[data-stage="decided"] {
  color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent);
}
.ledger__stage[data-stage="classified"] {
  color: var(--prov-informado); border-color: color-mix(in srgb, var(--prov-informado) 40%, transparent);
}
.ledger__stage[data-stage="intake"] {
  color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent);
}
.ledger__age { font: 500 10px/1.3 var(--font-mono); color: var(--faint); }
.ledger__age.is-stale { color: var(--warn); font-weight: 650; }
.ledger__act { white-space: nowrap; }
.ledger__act-link {
  display: inline-block; margin-left: 6px; color: var(--accent);
  font: 650 10.5px/1.4 var(--font-mono); text-decoration: none;
}
.ledger__act-link:first-child { margin-left: 0; }
.ledger__act-link:hover { text-decoration: underline; }
.segmented[data-desk-view] { flex: none; }

/* ---------- responsive ------------------------------------------------------------------------- */
/* The rail placement and its breakpoint live in styles/telemetry.ts — that module owns the telemetry slot,
   so the desk column template is written in exactly one place. Nothing here may re-declare the desk columns. */
@media (max-width: 1023px) {
  .tape__item { padding: 0 var(--s3); }
}
@media (max-width: 640px) {
  /*
   * The ledger keeps nine columns at 390: a dense table that silently drops columns would be a different
   * product. The page never scrolls sideways; the table is its own bounded region, the same posture the
   * staged desk takes on mobile.
   */
  .ledger-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.ledger { min-width: 760px; }
  .ledger__prod { min-width: 170px; }
}


/* ---------- the panel -------------------------------------------------------------------------- */
/*
 * At >=1280 the desk pane is a flex column and the table-scroll region is flex: 1 1 auto with min-height: 0,
 * so it absorbs every spare pixel and a sibling pushes it to zero — the staged table rendered empty while the
 * telemetry took the space. The fix is ordering, not sizing: the telemetry is order: 1 and flex: none, so the
 * table keeps its flex-grow slot and the telemetry scrolls into view after it inside the same region. On a
 * short viewport the operator scrolls the pane to reach it — exactly like the table foot.
 */
.telemetry {
  display: grid; gap: var(--s3); min-width: 0; flex: none;
  padding: var(--s3) 0 0; border-top: 1px solid var(--line);
  order: 1;
}
.telemetry > h2 {
  margin: 0; font: 700 10px/1.3 var(--font-mono); letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint);
}
/* three blocks side by side on a wide pane, stacked when there is no room */
.telemetry__block {
  display: grid; gap: var(--s2); padding: var(--s3);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0;
}
.telemetry__block > h3 {
  margin: 0; font: 700 10px/1.3 var(--font-mono); letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.telemetry__bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.telemetry__bar {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) 52px; gap: 8px; align-items: center; font-size: 10.5px;
}
.telemetry__bar-label { color: var(--muted); font-weight: 650; }
.telemetry__track { height: 6px; background: var(--bg-sunken); border-radius: 3px; overflow: hidden; }
.telemetry__fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.telemetry__bar[data-component="margin"] .telemetry__fill { background: var(--ok); }
.telemetry__bar[data-component="cost"] .telemetry__fill { background: var(--danger); }
.telemetry__bar[data-component="regulatory"] .telemetry__fill { background: var(--info); }
.telemetry__bar[data-component="freight"] .telemetry__fill { background: var(--warn); }
.telemetry__bar[data-component="uncertainty"] .telemetry__fill { background: var(--prov-estimado); }
.telemetry__bar-val {
  font: 650 10px/1.3 var(--font-mono); text-align: right; color: var(--muted); font-variant-numeric: tabular-nums;
}
.telemetry__bar-val small { color: var(--faint); font-weight: 500; }
.telemetry__reason {
  grid-column: 1 / -1; font: 500 9.5px/1.45 var(--font-mono); color: var(--faint); margin-top: -3px;
}

/* the gauge: today's reading beside the card's frozen rate — two dated readings, never a computed delta */
.telemetry__gauge { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); align-items: start; }
.telemetry__gauge-side { display: grid; gap: 2px; min-width: 0; }
.telemetry__gauge-side .num {
  font: 700 20px/1.1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink);
}
.telemetry__gauge[data-gauge="incomplete"] .num { color: var(--faint); font-size: 14px; }

.telemetry__changed { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.telemetry__changed li {
  font: 500 10.5px/1.45 var(--font-mono); color: var(--muted);
  padding-left: var(--s3); border-left: 2px solid var(--warn);
}

/* a wide pane lays the three blocks in one row; a narrow one stacks them */
@media (min-width: 1280px) {
  /*
   * The desk pane is a flex column with height: 100%, and the ledger does NOT use the table-scroll region the
   * staged desk uses — it renders the ledger wrapper directly. Under flex that wrapper collapsed to 2px (its
   * table is 450px tall), which hid the whole ledger. Measured, not guessed: the wrapper's computed height was
   * 2px around a 450px table.
   *
   * Fix: in the ledger view, the pane scrolls as one document, and both the ledger wrapper and the telemetry
   * size naturally inside it. The staged desk is untouched — it keeps the flex pane and its own scroll region.
   */
  .shell--app:has(#conteudo .ledger-wrap) .desk__main { overflow-y: auto; }
  .shell--app:has(#conteudo .ledger-wrap) .desk__main > .ledger-wrap {
    flex: 0 0 auto; min-height: 0; overflow-y: visible;
  }
  .telemetry { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
  .telemetry > h2 { grid-column: 1 / -1; }
}
@media (max-width: 1279px) {
  .telemetry { gap: var(--s2); }
}


.dialog--palette {
  width: min(680px, calc(100vw - 2 * var(--s5))); max-width: none; max-height: min(76vh, 720px);
  padding: 0; overflow: hidden; display: flex; flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--ai) 38%, var(--line-strong)); border-radius: var(--r-sheet);
  background: var(--panel);
}
.dialog--palette::backdrop { background: var(--overlay); backdrop-filter: blur(4px); }
.dialog--palette > h2 {
  margin: 0; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line);
  font: 750 14px/1.3 var(--font-ui); display: flex; align-items: center; gap: var(--s2);
}
.dialog--palette > h2::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ai); box-shadow: 0 0 10px var(--ai); flex: none;
}
.dialog--palette #comandos-dica { margin: 0; padding: var(--s2) var(--s4) 0; }
.dialog--palette #comandos-busca {
  margin: var(--s2) var(--s4); width: calc(100% - 2 * var(--s4));
  background: var(--bg-sunken); border: 1px solid var(--line-strong); border-radius: var(--r-control);
  padding: 10px var(--s3); font-size: 13px;
}
.dialog--palette #comandos-busca:focus-visible {
  border-color: var(--ai); outline: 2px solid var(--ai-soft); outline-offset: 0;
}
.dialog--palette > nav,
.dialog--palette > section { padding: var(--s2) var(--s4); }
.dialog--palette h3 {
  margin: 0 0 var(--s2); font: 700 9px/1.3 var(--font-mono);
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint);
}
.dialog--palette ul.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.dialog--palette ul.rows .button { border-radius: var(--r-pill); font: 650 11.5px/1 var(--font-ui); }
.dialog--palette section.assistant { display: grid; gap: var(--s2); min-height: 0; }
.dialog--palette .assistant__consent {
  border: 1px solid color-mix(in srgb, var(--ai) 34%, var(--line)); background: var(--ai-soft);
  border-radius: var(--r-control); padding: var(--s3); display: grid; gap: var(--s2);
}
.dialog--palette .assistant__log {
  max-height: 34vh; overflow-y: auto; margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s3);
}
.dialog--palette .assistant__who {
  color: var(--ai); font: 700 9px/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.dialog--palette .assistant__body { font-size: 12.5px; line-height: 1.55; }
.dialog--palette .assistant__form {
  display: flex; gap: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--line);
}
.dialog--palette .assistant__input { flex: 1 1 auto; min-width: 0; }
.dialog--palette [data-starter] { white-space: normal; text-align: left; }

@media (max-width: 640px) {
  /* the palette takes the screen on a phone — the conversation is the task there */
  .dialog--palette { width: 100vw; max-width: none; max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
  .dialog--palette .assistant__log { max-height: 40vh; }
}


body { font: 13.5px/1.45 var(--font-ui); }

/* ---- rail: the cockpit nav -------------------------------------------------------------------- */
.rail { gap: 6px; padding: 10px 0; background: var(--bg-sunken); }
.rail__brand { padding: 0 0 8px; }
.rail__brand .rail__mark {
  width: 18px; height: 18px; border-radius: 4px; font-size: 0; color: transparent;
  background: var(--accent); box-shadow: 0 0 12px rgba(34, 211, 238, 0.55);
}
.rail__nav { gap: 6px; }
.rail__link { margin: 0 auto; padding: 0; border-radius: var(--r-control); }
.rail__mark {
  width: 38px; height: 38px; border-radius: var(--r-control); background: transparent;
  color: var(--faint); font: 700 14px/1 var(--font-mono);
}
.rail__link:hover .rail__mark, .rail__link:focus-visible .rail__mark { background: var(--accent-soft); color: var(--accent); }
.rail__link[aria-current="page"] .rail__mark {
  background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 16px -4px rgba(34, 211, 238, 0.5);
}
.rail__tail { gap: 6px; padding-top: 10px; }
.rail__tail .button--icon { width: 38px; height: 38px; border-radius: var(--r-control); min-height: 38px; font-size: 14px; }

/* ---- topbar + the reading strip --------------------------------------------------------------- */
.topbar { padding: 10px 14px; gap: 12px; background: var(--panel); }
.topbar > .brand {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  font: 800 16px/1 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); text-decoration: none;
}
.topbar > .brand::before {
  content: ""; width: 14px; height: 14px; border-radius: 3px;
  background: var(--accent); box-shadow: 0 0 12px rgba(34, 211, 238, 0.6);
}
.topbar h1 { font: 800 19px/1.1 var(--font-ui); letter-spacing: -0.01em; }
/* the fita de leituras: the pipeline readings the server already renders, set as a cockpit strip */
.topbar__sub {
  margin: 4px 0 0; color: var(--muted); font: 600 10.5px/1.5 var(--font-mono);
  letter-spacing: 0.04em; display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.topbar__sub::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); flex: none; }
.topbar__intake { max-width: 520px; }
.topbar__actions { gap: 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: var(--r-control); flex: none;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--line-strong);
  display: grid; place-items: center; font: 700 11px/1 var(--font-mono);
}

/* ---- controls: angular, cyan, mono labels ----------------------------------------------------- */
.button {
  border-radius: var(--r-control); min-height: 34px; padding: 8px 14px;
  font: 700 12px/1 var(--font-ui); box-shadow: 0 6px 16px -10px rgba(34, 211, 238, 0.7);
}
.button--ghost { background: var(--panel); border-color: var(--line-strong); box-shadow: none; }
.button--ghost:hover { background: var(--bg); border-color: var(--accent); }
.button--sm { min-height: 26px; padding: 4px 9px; font-size: 10.5px; box-shadow: none; }
.button--icon { border-radius: var(--r-control); }
input[type="text"], input[type="url"], input[type="number"], input[type="search"], select, textarea, .input, .select {
  min-height: 36px; padding: 9px 12px; border-radius: var(--r-control);
  background: var(--bg-sunken); border-color: var(--line-strong); font-size: 12px;
}
textarea { border-radius: var(--r-control); }
.intakebar { gap: 8px; }
.intakebar input[type="url"] { min-height: 36px; font-family: var(--font-mono); }
.select { border-radius: var(--r-control); }
.search { gap: 7px; }
.search input[type="search"] { width: min(280px, 100%); }
.search .button { min-height: 32px; }

/* ---- desk toolbar: segmented control, filters, count ----------------------------------------- */
.toolbar { gap: 7px; }
.segmented { display: flex; gap: 3px; padding: 3px; border-radius: var(--r-control); background: var(--bg-sunken); border: 1px solid var(--line); }
.segmented__link { padding: 6px 12px; border-radius: 6px; font: 700 11px/1 var(--font-ui); color: var(--faint); text-decoration: none; }
.segmented__link[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.toolbar__meta { color: var(--faint); font: 600 10.5px/1.4 var(--font-mono); }
.toolbar__filter { gap: 6px; }

/* ---- the ledger: mono figures, cockpit rows --------------------------------------------------- */
table.data.desk-table { font-size: 11.5px; }
table.data.desk-table th {
  padding: 8px 9px; background: var(--bg-sunken); color: var(--faint);
  font: 700 9px/1.4 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
}
table.data.desk-table td { padding: 4px 9px; font-size: 11.5px; }
table.data.desk-table tbody tr:hover { background: var(--accent-soft); }
table.data.desk-table tbody tr[data-current="1"] { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.cell-product { min-width: 210px; }
.cell-product__name { font: 700 11.5px/1.25 var(--font-ui); }
.cell-product__meta { font: 500 9.5px/1.4 var(--font-mono); color: var(--faint); }
.cell-value { font: 650 12px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
.cell-score { font: 500 9px/1.3 var(--font-mono); }
.cell-date { font: 500 9px/1.3 var(--font-mono); }
.cell-meta { gap: 4px; }
.cell-hist { gap: 9px; }
.cell-hist dt { font: 700 8.5px/1.3 var(--font-mono); letter-spacing: 0.04em; }
.cell-hist dd { font: 500 9px/1.3 var(--font-mono); }
.cell-hist__value { font: 650 9px/1.3 var(--font-mono); }
.cell--missing .button { min-height: 26px; padding: 3px 9px; font-size: 10.5px; }
.cell-add { width: 24px; height: 24px; font-size: 13px; border-color: var(--line-strong); }
td[data-cell="simulation"] { min-width: 156px; }
td[data-cell="simulation"] .cell-main { flex-wrap: wrap; row-gap: 2px; }
td[data-cell="simulation"] .cell-score { flex: 0 0 100%; }
td[data-cell="simulation"] .chip { white-space: nowrap; }
.table-foot { padding: 8px 10px; border-top: 1px solid var(--line); background: var(--panel); color: var(--faint); font: 500 10px/1.4 var(--font-mono); }

/* ---- chips / pills: small-caps stamps --------------------------------------------------------- */
.chip, .stage-pill { font: 700 9.5px/1.4 var(--font-mono); padding: 3px 8px; }
.chip--prov { font: 700 8.5px/1.5 var(--font-mono); border-color: var(--line); background: var(--panel); }
.state-meta { font: 500 11px/1.4 var(--font-mono); color: var(--faint); }

/* ---- inspector: the telemetry panel ----------------------------------------------------------- */
.shell--app .inspector {
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel);
  box-shadow: 0 24px 60px -46px rgba(3, 6, 12, 0.5);
}
.inspector__head {
  padding: 16px 16px 14px; background: var(--bg-sunken);
  border-bottom: 1px solid var(--line); border-radius: var(--r-card) var(--r-card) 0 0;
}
.inspector__head .state-meta {
  font: 700 9px/1.4 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
}
.inspector h2 { font: 800 16px/1.2 var(--font-ui); letter-spacing: -0.01em; }
.inspector h3 { font: 700 8.5px/1.4 var(--font-mono); letter-spacing: 0.12em; }
.inspector__body { padding: 12px 16px 14px; gap: 10px; }
.inspector__hero .num { font: 700 26px/1 var(--font-mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.inspector .row { padding: 3px 0; font-size: 11px; }
.inspector .row dd { font: 650 11.5px/1.2 var(--font-mono); }
.inspector__money { gap: 4px; }
.inspector__open .button, .inspector__foot .button { flex: 1 1 auto; }
.inspector__foot { display: flex; gap: 6px; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.inspector .chip--prov { font: 700 8.5px/1.5 var(--font-mono); }

/* ---- app frame: cockpit gutters and angular cards -------------------------------------------- */
.shell--app .desk { gap: 12px; padding: 12px; }
.shell--app .desk__main { gap: 10px; }
.shell--app .content { padding: 0; gap: 0; }
.shell--app .table-scroll {
  border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-card) var(--r-card) 0 0; background: var(--panel);
}
.shell--app .table-foot {
  border: 1px solid var(--line); border-radius: 0 0 var(--r-card) var(--r-card); background: var(--panel);
}
.shell--app .data.desk-table { border: 0; border-radius: 0; }
.shell--app .inspector { padding: 16px; }

/* ---- the discoveries shelf reads as cockpit telemetry ---------------------------------------- */
.shelf { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel); }
.shelf > summary { font: 700 10px/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.discoveries { font: 500 11px/1.5 var(--font-mono); }

/* ---- cockpit density: tighten the staged cells toward the prototype ledger rhythm -------------- */
table.desk-v2 td.cell { padding: 5px 10px; }
table.desk-v2 .cell-ready { gap: 1px; min-width: 84px; }
table.desk-v2 .cell-main { gap: 5px; }
table.desk-v2 .cell-meta { gap: 3px; }
table.desk-v2 .cell-hist { margin-top: 1px; gap: 6px; }
table.desk-v2 .cell-product__name { font-size: 11.5px; }

/* ---- small screens --------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  .topbar { padding: 8px 12px; }
  .topbar > .brand { display: none; }
  .topbar h1 { font-size: 18px; }
  .content { padding: 12px; }
}


.plans__title { margin: 0 0 var(--s2); font: 650 15px/1.3 var(--font-ui); }
.plans__intro { max-width: 64ch; }

.plans--products {
  list-style: none; margin: var(--s4) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); align-items: stretch;
}
.plan {
  position: relative; display: flex; flex-direction: column; gap: var(--s2);
  min-width: 0; padding: var(--s5);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card);
  transition: border-color var(--t-fast) var(--ease);
}
.plan:hover { border-color: var(--line-strong); }
.plan--recommended {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-overlay);
}
.plan__badge {
  align-self: flex-start; padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink);
  font: 650 9.5px/1.5 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase;
}
.plan .plan__name { margin: 0; font: 650 14px/1.2 var(--font-ui); letter-spacing: -0.01em; text-transform: none; }
.plan__price { display: flex; align-items: baseline; gap: 6px; margin: var(--s2) 0 0; flex-wrap: wrap; }
.plan__price .num { font: 650 30px/1 var(--font-mono); letter-spacing: -0.02em; color: var(--ink); }
.plan__per { font: 500 11px/1 var(--font-mono); color: var(--muted); }
.plan__note { margin: 0; font: 500 12.5px/1.5 var(--font-ui); color: var(--muted); }
.plan form { margin-top: auto; padding-top: var(--s3); }
.plan__cta { width: 100%; }

.value-anchor {
  display: grid; gap: var(--s2); margin: var(--s5) 0 0; padding: var(--s5);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--r-card); background: var(--panel-2);
}
.value-anchor .value-anchor__title { margin: 0; font: 650 15px/1.3 var(--font-ui); }
.value-anchor__body { margin: 0; max-width: 68ch; color: var(--muted); }

.plans__foot { display: grid; gap: var(--s1); margin: var(--s4) 0 0; }

.anchors { margin: var(--s6) 0 0; display: grid; gap: var(--s2); }
.anchors .anchors__title { margin: 0; font: 650 14px/1.3 var(--font-ui); }
.anchors__list { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: 0; }
.anchor {
  display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline;
  padding: var(--s2) 0; border-bottom: 1px dashed var(--line);
  font-size: 12.5px; color: var(--muted);
}
.anchor:last-child { border-bottom: 0; }
.anchor__price { font: 600 12px/1 var(--font-mono); color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .plans--products { grid-template-columns: 1fr; }
}
