/* app.css · ONE in the Mass Acceleration brand (2026-10-29, unified app): every colour is a brand token from
   shared/brand.css (black by default, light optional); status colours keep their meaning (ok teal, warn peach, bad orange).
   Outfit is self-hosted (shared/fonts); no CDN. The retired Warm Bone / Iron Black / Seal Red / Eucalyptus palette is gone. */
:root {
  --background: var(--ma-bg); --foreground: var(--ma-text); --muted: var(--ma-text-muted); --border: var(--ma-border);
  --accent: var(--ma-accent); --danger: var(--ma-bad); --warn: var(--ma-warn); --ok: var(--ma-ok);
  --surface: var(--ma-surface);
  --radius: var(--ma-radius); --gap: 16px;
  --font: var(--ma-font);
  --mono: var(--ma-font-mono);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--background); color: var(--foreground); }
body { font: 16px/1.5 var(--font); -webkit-text-size-adjust: 100%; overflow-x: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.05rem; } h3 { font-size: 1rem; }
a { color: var(--ma-link); text-underline-offset: 3px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 0.85rem; } .big { font-size: 1.25rem; font-weight: 700; }
.mono { font-family: var(--mono); font-size: 0.85rem; } .wrap { overflow-wrap: anywhere; } .select { user-select: all; }
.hash { padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--background); padding: 8px; }
:focus-visible { outline: 3px solid var(--ma-focus); outline-offset: 2px; }

.center-screen { min-height: 100dvh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 12px; padding: 24px 16px; }

.btn { min-height: 44px; min-width: 44px; padding: 10px 20px; border-radius: var(--ma-radius-sm); border: 1px solid var(--ma-border-strong);
  background: transparent; color: var(--foreground); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--ma-accent); color: var(--ma-accent-text); border-color: var(--ma-accent); }
.btn-danger { border-width: 2px; border-style: dashed; }
.btn-ghost { border-color: transparent; font-weight: 500; }
.btn-small { min-height: 36px; padding: 4px 12px; font-size: 0.85rem; }
.btn-wide { min-width: 260px; }
.input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--ma-border-strong); border-radius: var(--ma-radius-sm);
  background: var(--ma-surface); color: var(--foreground); font: inherit; }
textarea.input { resize: vertical; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--background); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; min-height: 44px; }
.topbar-tools { display: flex; align-items: center; gap: 4px; }
.select-company { width: auto; max-width: 42vw; }
.demo-banner { margin: 0; padding: 8px 16px; border-bottom: 1px dashed var(--foreground); font-size: 0.85rem; }
.main { max-width: 1200px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); outline: none; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--background); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tab { min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; font-size: 0.85rem; }
.tab[aria-current] { font-weight: 800; text-decoration: underline; text-decoration-thickness: 3px; }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--ma-accent); color: var(--ma-accent-text);
  font-size: 0.75rem; display: inline-grid; place-items: center; }
.count[hidden] { display: none; }

.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); min-width: 0; }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-foot { margin-top: 12px; }
.source { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.75rem; color: var(--muted); }
.badge { border: 1px solid var(--foreground); color: var(--foreground); border-radius: 6px; padding: 0 6px; font-weight: 700; }
.skeleton .sk-line { height: 14px; margin: 10px 0; border-radius: 6px; background: var(--border); }
.skeleton .sk-line:nth-child(2) { width: 80%; } .skeleton .sk-line:nth-child(3) { width: 60%; }
.kvs { display: grid; gap: 2px 16px; grid-template-columns: 1fr; margin: 8px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.kv .k { color: var(--muted); } .kv .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.notyet summary { cursor: pointer; font-style: italic; list-style: none; } .notyet summary::after { content: " ⓘ"; }
.notyet[open] { max-width: 60%; } .unavail { margin-top: 8px; font-size: 0.85rem; }
.unavail .row { display: flex; justify-content: space-between; gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--foreground); border-radius: 999px; padding: 0 8px;
  font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.chip-attention, .chip-warn, .chip-paused { border-style: dashed; } .chip-fail, .chip-failed { border-width: 2px; }
.companies, .plain, .cards { list-style: none; margin: 0; padding: 0; }
.company { padding: 12px 0; border-top: 1px solid var(--border); }
.company-link { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; }
.company-nums { display: grid; grid-template-columns: 1fr; gap: 0 16px; font-size: 0.9rem; }
.companies.test { opacity: 0.85; }
.divider { margin: 16px 0 4px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  border-top: 2px dashed var(--foreground); padding-top: 8px; }
.plain > li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.empty { color: var(--muted); font-style: italic; }
.error { border: 2px solid var(--danger); border-radius: 10px; padding: 12px; }
.ref { font-size: 0.85rem; }
.warn { font-weight: 600; border-left: 4px solid var(--foreground); padding-left: 10px; }
.meter { height: 12px; border: 1px solid var(--foreground); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.meter-fill { height: 100%; background: var(--ma-accent); }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.view-title { margin-bottom: 12px; }
.inline { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.inline .input { width: auto; } .inline input[type=checkbox] { width: 22px; height: 22px; }
.sub { margin-top: 16px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; background: var(--background); }
.card-kicker { font-size: 0.85rem; } .card-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }

.sheet { width: min(560px, calc(100vw - 16px)); max-height: calc(100dvh - 32px); border: 1px solid var(--foreground);
  border-radius: var(--radius); padding: 0; background: var(--background); color: var(--foreground); }
.sheet::backdrop { background: rgb(0 0 0 / 0.6); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sheet-body { padding: 16px; } .sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.field { margin: 12px 0; } .field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.field-error { margin: 4px 0 0; font-weight: 700; } .field-error:empty { display: none; }
.result { padding: 12px; border: 1px solid var(--foreground); border-radius: 10px; font-weight: 600; }
.result-warn { border-style: dashed; border-width: 2px; }

.inline-field { display: flex; align-items: center; gap: 8px; } .inline-field label { margin: 0; } .inline-field .input { width: auto; }

.board { display: grid; gap: 12px; grid-template-columns: 1fr; }
.col { border: 1px solid var(--border); border-radius: 10px; padding: 10px; min-width: 0; }
.col-waiting_for_eric { border: 2px solid var(--foreground); }
.dev-card { display: grid; gap: 4px; } .dev-title { font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; display: block; overflow-x: auto; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; }

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile.wide { grid-column: 1 / -1; }
  .kvs { grid-template-columns: repeat(2, minmax(0, 1fr)); } .company-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1040px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .company-nums { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tabbar { position: sticky; top: 61px; bottom: auto; border-top: 0; border-bottom: 1px solid var(--border); }
  .main { padding-bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.demo-picker { position: fixed; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 20; max-width: 70vw; }
@media (min-width: 1040px) { .demo-picker { bottom: 8px; } }
.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-system path { fill: currentColor; stroke: none; }
/* narrow screens: nothing may push the page wider than the phone */
.main, .sheet, .tile, .card { overflow-wrap: anywhere; }
.topbar { flex-wrap: wrap; }
.topbar-tools { flex: 1 1 auto; justify-content: flex-end; min-width: 0; }
.select-company { flex: 1 1 auto; min-width: 0; max-width: 260px; }
.tabbar { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.tab { min-width: 0; padding: 0 2px; overflow: hidden; }
.demo-picker .input { max-width: 70vw; }
@media (max-width: 400px) { .tab { font-size: 0.78rem; gap: 3px; } .count { min-width: 18px; height: 18px; padding: 0 4px; } }
/* P&L tile (views/pnl.js, Rev 2026-10-12): scrolls inside the tile on phones, never the page. */
.tile-body:has(> table.pnl), .tile-body:has(> div > table.pnl) { overflow-x: auto; }
table.pnl { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
table.pnl th, table.pnl td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.pnl th[scope="row"], table.pnl thead th:first-child { text-align: left; }
table.pnl tr.total th, table.pnl tr.total td { font-weight: 600; border-top: 2px solid currentColor; }
/* Products tile (views/products.js, Rev 2026-10-15, V0100): the P&L table look; stale rows say so in words and in weight. */
table.pnl.products th[scope="row"] { white-space: normal; min-width: 14rem; }
table.pnl.products tr.stale td:last-child { font-weight: 600; }
/* JVS-16 diff view: the bad colour = what goes, the ok colour = what comes; every cell also says Before / After with − / + and the
   Change column says it in a word, so nothing rests on colour alone. Tints stay light enough for AA text contrast. */
.diff-scroll { overflow-x: auto; max-width: 100%; }
.diff-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.diff-table th, .diff-table td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.diff-table thead th { font-size: 0.8rem; color: var(--muted); }
.diff-changed .diff-before, .diff-removed .diff-before { background: color-mix(in srgb, var(--danger) 12%, transparent); border-left: 3px solid var(--danger); }
.diff-changed .diff-after, .diff-added .diff-after { background: color-mix(in srgb, var(--ok) 14%, transparent); border-left: 3px solid var(--ok); }
.diff-unchanged .diff-sign { visibility: hidden; }
.diff-badge { display: inline-block; min-width: 1.4em; text-align: center; font-weight: 700; }
.hide-same .diff-unchanged { display: none; }
/* JVS-19 bulk review */
.bulk-pick { display: flex; gap: 8px; align-items: baseline; }
.bulk-pick input { width: 20px; height: 20px; }
.bulk-basis { border: 1px solid var(--border); border-radius: 8px; margin: 8px 0; padding: 8px 12px; }
