/* The console ("Your automations", /app) and the admin (/admin) in the front page's design (stage 2,
   2026-11-05). Loaded LAST, after home.css (the body.front tokens) and front.css (the shared components
   re-skinned on paper). This layer covers what only the console has: the masthead and its Build · Run ·
   Prove tab groups, the rules-at-a-glance sheet, the lifecycle line, spend, the per-automation tests and
   who did each step of a run. Paper and ink, one accent, hairlines, square corners; no glow, no glass, no
   gradient fills, no entrance animations. Status text colours are each >= 4.5:1 on #f4f1ea and #fbfaf6. */

body.console, body.front[data-surface="admin"] {
  --muted: var(--ink-3);
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
}
body.console *, body.front[data-surface="admin"] * { text-shadow: none; }
body.console .aurora, body.front[data-surface="admin"] .aurora { display: none !important; }
body.console .stagger > *, body.front[data-surface="admin"] .stagger > * { animation: none !important; opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  body.console *, body.console *::before, body.console *::after,
  body.front[data-surface="admin"] *, body.front[data-surface="admin"] *::before, body.front[data-surface="admin"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- masthead: brand row + Build · Run · Prove */
body.console .masthead { background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid var(--rule); }
body.console .masthead-inner { max-width: 1360px; padding: 10px 28px 0; }
body.console .brand { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink); }
body.console .brand .product { border: 1px solid var(--rule-2); border-radius: 3px; color: var(--ink-2); }
body.console .tabs { gap: 0; margin-top: 6px; align-items: stretch; }
body.console .tab { min-height: 44px; padding: 0 8px; font-size: 13.5px; color: var(--ink-2); border-radius: 0; }
body.console .tab:hover:not(:disabled) { color: var(--ink); background: rgb(22 21 19 / .04); }
body.console .tab[aria-selected="true"] { color: var(--ink); }
body.console .tab[aria-selected="true"] .ic { color: var(--acc); }
body.console .tab[aria-selected="true"]::after { left: 8px; right: 8px; height: 2px; border-radius: 0; background: var(--acc); }
body.console .tab:disabled { opacity: 1; color: rgb(22 21 19 / .62); }   /* still >= 4.5:1, unlike a faded label */
body.console .tab .badge { border-radius: 2px; background: var(--acc-ink); color: #fff; }
body.console .tab:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
body.console.visitor .tab[data-ws] { opacity: 1; }
.tab-group { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; margin-left: 4px; border-left: 1px solid var(--rule);
  font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.tab-group:first-child { margin-left: 0; padding-left: 0; border-left: 0; }
.tab-group b { color: var(--acc-ink); font-weight: 500; }
body.console .systems .sys { border-radius: 3px; background: var(--card-bg); border-color: var(--rule); color: var(--ink-2); }
body.console .keybtn, body.console .systems button { min-height: 44px; border-radius: 3px; }
body.console .keybtn.set { color: #145a36; background: #fff; border-color: rgb(29 122 74 / .45); }

/* ---------------------------------------------------------------- page frame + type */
body.console > main { max-width: 1360px; }
body.console .section-head h2, body.console .ws-head h2 { font-family: var(--display); font-weight: 650; letter-spacing: -.03em; font-size: clamp(28px, 2.8vw, 40px); line-height: 1.06; color: var(--ink); }
body.console .section-head p:not(.stage-k):not(.eyebrow), body.console .ws-sub { color: var(--ink-2); }
body.console .stage-k { margin-bottom: 10px; }
body.console .sheet, body.front[data-surface="admin"] .sheet { background: var(--card-bg); border: 1px solid var(--rule); border-radius: 4px; box-shadow: none; }
body.console .label, body.front[data-surface="admin"] .label { color: var(--ink-2); }
body.console .why, body.front[data-surface="admin"] .why { color: var(--ink-3); }
body.console .mono, body.front[data-surface="admin"] .mono { color: inherit; }
body.console footer { border-top: 1px solid var(--rule); color: var(--ink-2); max-width: 1360px; }
body.console footer a { color: var(--ink); min-height: 44px; min-width: 44px; justify-content: center; display: inline-flex; align-items: center; padding: 0 6px; }

/* targets: everything a finger presses is at least 44 px */
body.console .btn, body.front[data-surface="admin"] .btn { min-height: 44px; border-radius: 4px; box-shadow: none; background-image: none; }
body.console .btn-sm, body.front[data-surface="admin"] .btn-sm { min-height: 44px; padding-inline: 14px; }
body.console .cx-chip { min-height: 44px; border-radius: 3px; }
body.console .ws-home-link { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink); }
body.console .seg button, body.front[data-surface="admin"] .seg button { min-height: 44px; }
body.console select, body.console input:not([type=checkbox]):not([type=radio]), body.console textarea,
body.front[data-surface="admin"] select, body.front[data-surface="admin"] input:not([type=checkbox]):not([type=radio]) { min-height: 44px; border-radius: 3px; }
body.console summary, body.front[data-surface="admin"] summary { min-height: 44px; display: flex; align-items: center; gap: 8px; }
body.console .ws-list button, body.console .auto-acts .btn { min-height: 44px; }

/* status pills: dark enough to read on paper */
body.console .pill, body.front[data-surface="admin"] .pill { border-radius: 3px; }
body.console .p-prepare, body.front[data-surface="admin"] .p-prepare { color: #8f2a0b; }
body.console .p-allow, body.front[data-surface="admin"] .p-allow { color: #145a36; }
body.console .p-deny, body.front[data-surface="admin"] .p-deny { color: #7d1b21; }
body.console .p-neutral, body.front[data-surface="admin"] .p-neutral { color: var(--ink-2); }
body.console .slip .mono, body.console .slip code, body.console .facts .mono { color: var(--ink-2); }

/* ---------------------------------------------------------------- Build: the rules on it */
.rules-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.rules-title { margin: 0; font: 650 clamp(26px, 2.4vw, 34px)/1.08 var(--display); letter-spacing: -.03em; color: var(--ink); }
.rules-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.life { margin-top: 22px; padding: 14px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.life-steps { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 0; counter-reset: life; }
.life-steps li { counter-increment: life; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 0; margin-right: 12px; font: 500 13px/1.2 var(--sans); color: var(--ink-2); }
.life-steps li::before { content: counter(life, decimal-leading-zero); font: 500 11px/1 var(--mono); color: var(--ink-3); }
.life-steps li.done { color: var(--ink); }
.life-steps li.done::before { content: "✓"; color: #145a36; }
.life-steps li.now { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--acc); }
.life-steps li.now::before { color: var(--acc-ink); }
.life-halt { margin: 0; color: #7d1b21; }
.life .why { margin: 0; }
.rule-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 18px; border: 1px solid var(--rule); }
.rule-col { padding: 16px 18px; min-width: 0; }
.rule-col + .rule-col { border-left: 1px solid var(--rule); }
.rule-h { margin: 0; display: flex; align-items: center; gap: 8px; font: 600 15px/1.2 var(--sans); color: var(--ink); }
.rule-k { width: 10px; height: 10px; flex: none; }
.rc-alone .rule-k { background: #1d7a4a; }
.rc-waits .rule-k { background: var(--acc); }
.rc-never .rule-k { background: #a3242c; }
.rule-n { margin-left: auto; font-size: 12px; color: var(--ink-2); }
.rule-sub { margin: 6px 0 10px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.rule-col ul { list-style: none; margin: 0; padding: 0; }
.rule-col li { padding: 9px 0; border-top: 1px dashed var(--rule); font-size: 14px; color: var(--ink); }
.rule-col li .why { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.4; }
.rule-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border: 1px solid var(--rule-2); font: 500 11px/1.5 var(--mono); color: var(--ink-2); }
.rule-none { margin: 0; font-size: 13px; color: var(--ink-3); }

/* ---------------------------------------------------------------- Run: spend + lifecycle */
.spend-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.spend-num { margin: 8px 0 10px; color: var(--ink-2); }
.spend-num b { font-size: 22px; color: var(--ink); font-weight: 500; }
.spend-meter { height: 8px; background: var(--paper-2); border: 1px solid var(--rule); }
.spend-meter span { display: block; height: 100%; background: var(--ink); }
.spend-card .why { margin: 10px 0 0; }

/* ---------------------------------------------------------------- Prove: tests per automation + the run's steps */
.prove { margin-bottom: 20px; }
.prove-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 12px; }
.prove-head h3 { margin: 4px 0 0; font: 650 22px/1.15 var(--display); letter-spacing: -.02em; }
.prove-pick { min-width: min(100%, 340px); margin: 0; }
.prove-empty h3 { font: 650 22px/1.15 var(--display); letter-spacing: -.02em; }
body.console .fp-btn, body.front[data-surface="admin"] .fp-btn { min-height: 44px; }
body.console .fp-pv-g summary { min-height: 44px; }
.steps-log li { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.steps-log li small { display: block; margin-top: 2px; }
.who-tag { display: inline-block; padding: 2px 6px; font: 500 11px/1.4 var(--mono); letter-spacing: .04em; text-transform: uppercase; border: 1px solid; text-align: center; }
.who-tag.person { color: #8f2a0b; border-color: rgb(184 54 14 / .45); background: #fff; }
.who-tag.agent { color: #3f3290; border-color: rgb(91 72 176 / .45); background: #fff; }
.who-tag.code { color: var(--ink-2); border-color: var(--rule-2); background: #fff; }
body.console .seal-wrap .seal, body.front[data-surface="admin"] .seal-wrap .seal { filter: none; }

/* ---------------------------------------------------------------- phone */
@media (max-width: 860px) {
  body.console .masthead-inner { padding: 8px 16px 0; }
  body.console .masthead { position: static; }
  body.console .tabs { overflow-x: auto; }
  .rule-cols { grid-template-columns: 1fr; }
  .rule-col + .rule-col { border-left: 0; border-top: 1px solid var(--rule); }
  .steps-log li { grid-template-columns: 1fr; gap: 4px; }
  .steps-log li .k { justify-self: start; }
  body.console footer { flex-direction: column; gap: 8px; padding: 18px 16px; }
}
@media (max-width: 560px) {
  body.console > main { padding: 16px 16px 32px; }
  .life-steps li { margin-right: 6px; padding-right: 6px; }
}
/* a grid child never widens the page past the phone (long ids, tables and code scroll inside their sheet) */
body.console .stack, body.front[data-surface="admin"] .stack { grid-template-columns: minmax(0, 1fr); align-content: start; }
body.console .stack > *, body.console .cols > *, body.front[data-surface="admin"] .stack > * { min-width: 0; }
/* the same targets inside the admin, and the agents screen's own tabs and chips in both */
body.front[data-surface="admin"] .keybtn, body.front[data-surface="admin"] .cx-chip { min-height: 44px; border-radius: 3px; }
body.console .ag-tab, body.console .ag-chip, body.front[data-surface="admin"] .ag-tab, body.front[data-surface="admin"] .ag-chip { min-height: 44px; }
/* phone masthead: the brand on its own line, the system states and the key button below it */
@media (max-width: 560px) {
  body.console .brandrow { flex-wrap: wrap; gap: 6px 8px; }
  body.console .brandrow .systems { flex: 1 1 100%; display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  body.console .keybtn { max-width: 100%; white-space: normal; text-align: left; }
}
/* the owner-key form on the sign-in card: input and button share one row, the input keeps a usable width */
body.console .owner-key form, body.console form.owner-key { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
body.console .owner-key input { flex: 1 1 180px; width: auto; background: #fff; border-color: var(--rule-2); border-radius: 3px; }
body.console .owner-key button { margin-left: 0; }
