/* Wrong Number — administrative / telephone-company-report aesthetic.
   Slightly off-white (not cream), ink, one stamp color. Ruled like a form.
   Public Sans for labels, IBM Plex Mono for figures (tabular). No shadows/gradients. */

:root {
  --paper:    #f0efe9;   /* slightly off-white, warmth knocked back */
  --panel:    #e9e7df;
  --panel-2:  #f6f5f0;
  --ink:      #1a1714;
  --ink-soft: #5d574c;
  --rule:     #c9c4b6;
  --rule-2:   #ddd9cd;
  --stamp:    #9e3b2e;   /* directory red — used like a rubber stamp, sparingly */
  --measured: #2f5c46;   /* porcelain green, for "measured" provenance */
  --field-bg: #fff;      /* input/select surface */
  color-scheme: light;   /* native controls (dropdown popup, spinners, scrollbars) */
}

/* Dark mode — invert the warm paper, NOT pure black. Background tuned near the dark
   logo's near-black so the header keycap blends; the cream becomes the ink. */
[data-theme="dark"] {
  --paper:    #100f0d;   /* matches the logo (which you tuned to #100f0d) */
  --panel:    #181818;   /* NEUTRAL grey — zero warm tint, so no brown anywhere */
  --panel-2:  #1e1e1e;
  --ink:      #ece7d8;    /* warmth lives only in the cream text */
  --ink-soft: #9a948b;
  --rule:     #343434;
  --rule-2:   #242424;
  --stamp:    #c4604f;
  --measured: #4f8c6c;
  --field-bg: #1c1c1c;
  color-scheme: dark;    /* native dropdown popups / spinners / scrollbars go dark */
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.booting { padding: 40px; font-family: "IBM Plex Mono", monospace; color: var(--ink-soft); }

.num { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }

/* ---- unified form controls (custom, themed both modes, away from OS defaults) ---- */
input[type=number], input[type=text], input[type=search], input:not([type]), select, textarea {
  font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 12px;
  color: var(--ink); background: var(--field-bg);
  border: 1px solid var(--rule); border-radius: 0; padding: 2px 5px;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--stamp); }
input::placeholder { color: var(--ink-soft); }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select {
  padding-right: 20px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 3.5l3 3 3-3' fill='none' stroke='%23888' stroke-width='1.4'/></svg>");
  background-repeat: no-repeat; background-position: right 5px center;
}

/* ---- frame ---- */
.app { height: 100vh; display: flex; flex-direction: column; }
header.bar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 20px; border-bottom: 2px solid var(--ink); background: var(--paper);
}
header.bar img { height: 128px; width: auto; display: block; }
.wordmark { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 18px; }
.tagline { font-family: "IBM Plex Mono", monospace; color: var(--ink-soft); font-size: 12px; letter-spacing: .04em; }
.bar .spacer { flex: 1; }

.scenarios { display: flex; align-items: center; gap: 8px; }
.scenarios input, .scenarios select, .scenarios button { font-family: inherit; font-size: 12px; }
.scenarios input { width: 130px; }   /* keep the scenario-name box from sprawling across the cluster */

/* ---- layout ---- */
main { display: grid; grid-template-columns: 360px 1fr; gap: 0; flex: 1; min-height: 0; }
.controls { border-right: 2px solid var(--ink); overflow-y: auto; max-height: calc(100vh - 76px); background: var(--panel-2); }
.results { overflow-y: auto; max-height: calc(100vh - 76px); padding: 18px 20px 60px; }

/* ---- control groups (form fields) ---- */
.group { border-bottom: 1px solid var(--rule); }
.group > h3 {
  margin: 0; padding: 9px 14px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); background: var(--panel); border-bottom: 1px solid var(--rule);
}
.field { padding: 8px 14px; border-bottom: 1px solid var(--rule-2); }
.field:last-child { border-bottom: 0; }
.field .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field label { font-size: 12px; letter-spacing: .03em; }
.field .val { display: flex; align-items: baseline; gap: 5px; }
.field .val input[type=number] {
  width: 84px; text-align: right; font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums; border: 1px solid var(--rule); background: var(--field-bg); padding: 2px 5px;
}
.field .units { color: var(--ink-soft); font-size: 11px; font-family: "IBM Plex Mono", monospace; min-width: 64px; }
.field input[type=range] { width: 100%; margin: 7px 0 1px; accent-color: var(--stamp); }
.field .note { color: var(--ink-soft); font-size: 11px; margin-top: 2px; padding: 0; border-left: 0; }
.field input[type=checkbox] { accent-color: var(--stamp); transform: scale(1.2); }

.prov { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; padding: 1px 4px; border: 1px solid var(--rule); color: var(--ink-soft); }
.prov.estimate { } .prov.assumption { color: var(--stamp); border-color: var(--stamp); }
.prov.sourced { color: var(--measured); border-color: var(--measured); }
.prov.measured { color: #fff; background: var(--measured); border-color: var(--measured); }

.method-row { padding: 8px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid var(--rule-2); }
.method-row select { font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); background: var(--field-bg); padding: 2px 5px; }

.advanced summary { padding: 8px 14px; cursor: pointer; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.vec { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 0 14px 12px; }
.vec label { font-size: 10px; color: var(--ink-soft); display: flex; flex-direction: column; }
.vec input { width: 100%; font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); padding: 1px 3px; text-align: right; }

/* ---- results ---- */
.kpi-group { margin-bottom: 16px; }
.kpi-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.kpi { padding: 12px 14px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.kpi .k { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.kpi .v { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; margin-top: 4px; }
.kpi .v.neg { color: var(--stamp); }
.kpi .sub { font-size: 11px; color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; margin-top: 2px; }

.section-title { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin: 22px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: center; }
.section-title select { font-family: "IBM Plex Mono", monospace; font-size: 11px; border: 1px solid var(--rule); background: var(--field-bg); }

.chart-host { width: 100%; }
svg.chart { display: block; background: var(--panel-2); border: 1px solid var(--rule); }
svg.chart text { font-family: "IBM Plex Mono", monospace; fill: var(--ink-soft); font-size: 11px; }
svg.chart .zero { stroke: var(--ink); stroke-width: 1.25; } svg.chart .grid { stroke: var(--rule-2); stroke-width: 1; }

table.ledger { width: 100%; border-collapse: collapse; font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 12px; }
table.ledger th, table.ledger td { padding: 4px 7px; text-align: right; border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
table.ledger th { font-family: "Public Sans", sans-serif; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); border-bottom: 1px solid var(--ink); position: sticky; top: 0; background: var(--paper); }
table.ledger td:first-child, table.ledger th:first-child { text-align: left; }
table.ledger tr:hover td { background: var(--panel); }
td.neg { color: var(--stamp); }

.recipe { border: 1px solid var(--rule); padding: 10px 12px; background: var(--panel-2); font-size: 12px; }
.recipe table { width: 100%; border-collapse: collapse; font-family: "IBM Plex Mono", monospace; }
.recipe td { padding: 2px 6px; border-bottom: 1px solid var(--rule-2); }
.recipe td:last-child { text-align: right; }

.err { color: var(--stamp); font-family: "IBM Plex Mono", monospace; padding: 10px 0; }
.warn { color: var(--stamp); font-family: "IBM Plex Mono", monospace; font-size: 12px; padding: 6px 10px; border: 1px solid var(--stamp); margin: 8px 0; }
.btn { font-family: inherit; color: var(--ink); border: 1px solid var(--ink); background: var(--paper); padding: 3px 10px; cursor: pointer; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; -webkit-appearance: none; appearance: none; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn.sm { padding: 1px 7px; font-size: 10px; }
.icon-btn { padding: 4px 8px; line-height: 0; }                         /* compact square theme toggle */
.ico { display: block; fill: none; stroke: currentColor; }             /* themes with the button — no color emoji */
.ico * { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hamburger { display: none; }   /* desktop shows the controls inline; ≤760px collapses them behind this */
.muted { color: var(--ink-soft); }
.regime { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.regime .rchip { font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: .04em; color: var(--ink-soft); border: 1px solid var(--rule); padding: 2px 7px; text-transform: uppercase; white-space: nowrap; }
.timeline { display: flex; flex-direction: column; gap: 6px; }
.timeline .tl-row { display: grid; grid-template-columns: 165px 1fr; align-items: center; gap: 10px; }
.timeline .tl-label { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .tl-track { position: relative; height: 26px; background: var(--panel-2); border: 1px solid var(--rule); }
.timeline .tl-seg { position: absolute; top: 0; height: 100%; box-sizing: border-box; border-right: 1px solid var(--paper); }
.sw { display: inline-block; width: 9px; height: 9px; border: 1px solid var(--rule); vertical-align: middle; margin-right: 5px; }
.ing-table tr.off { opacity: 0.42; }
.ing-table tr.pantry-seprow td { background: var(--panel); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); padding: 4px 6px; }
.ing-table .pantry-sep { font-family: "Public Sans", sans-serif; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); padding: 3px 7px; width: 220px; font-weight: 600; }
.ing-table .pantry-sep:focus { border-color: var(--stamp); outline: none; }
.ing-table .draghandle { cursor: grab; color: var(--ink-soft); user-select: none; text-align: center; font-size: 13px; width: 20px; line-height: 1; }
.ing-table .draghandle:active { cursor: grabbing; }
.ing-table tr.drag-over > td { border-top: 2px solid var(--stamp); }
.pen-derived { display: inline-block; font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; padding: 3px 8px; border: 1px dashed var(--rule); border-radius: 3px; color: var(--ink); background: var(--panel); }
.chart .sc-band { fill: var(--ink); opacity: .07; }
.chart .sc-up { fill: none; stroke: #4a4640; stroke-width: 1.4; stroke-dasharray: 4 3; }
.chart .sc-down { fill: none; stroke: var(--stamp); stroke-width: 1.4; stroke-dasharray: 4 3; }
.note { color: var(--ink-soft); font-size: 11px; line-height: 1.45; padding: 8px 12px; border-left: 2px solid var(--rule); margin: 4px 0; }

/* ---- tabs ---- */
nav.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--ink); background: var(--paper); padding: 0 12px; overflow-x: auto; }
nav.tabs .tab {
  font: inherit; font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  padding: 10px 16px; border: 0; background: none; cursor: pointer; color: var(--ink-soft);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
nav.tabs .tab:hover { color: var(--ink); }
nav.tabs .tab.active { color: var(--ink); border-bottom-color: var(--stamp); font-weight: 600; }
.tabbody { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px 70px; }

.panel { border: 1px solid var(--rule); background: var(--panel-2); padding: 14px 16px; margin-bottom: 16px; }
.panel > h4 { margin: 0 0 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-wrap { margin-bottom: 18px; }
.chart-wrap > .cap { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 5px; }

/* dashboard key dials */
.dash-keys { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; border: 1px solid var(--ink); padding: 12px 14px; margin-bottom: 16px; background: var(--panel-2); }
.dash-keys .dk { display: flex; flex-direction: column; gap: 3px; }
.dash-keys .dk label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.dash-keys .dk input[type=number] { width: 90px; font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); padding: 3px 6px; text-align: right; }
.dash-keys .dk input[type=range] { width: 150px; accent-color: var(--stamp); }

/* generic module controls (reused Field styling inside a panel) */
.modfields .field { border-bottom: 1px solid var(--rule-2); }

/* charts: axis text */
svg.chart text.ylab, svg.chart text.xlab { fill: var(--ink-soft); font-size: 10px; }
svg.chart .area-fill { fill: var(--ink); opacity: .06; stroke: none; }
svg.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; }
svg.chart .line.dem { stroke: #a39d92; stroke-dasharray: 4 3; stroke-width: 1.25; }
svg.chart .cap-line { stroke: var(--stamp); stroke-width: 1.25; stroke-dasharray: 5 3; }
svg.chart .dot { fill: var(--ink); } svg.chart .dot.neg { fill: var(--stamp); }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; font-family: "IBM Plex Mono", monospace; color: var(--ink-soft); }
.legend .item { display: flex; align-items: center; gap: 5px; }
.legend .sw { width: 11px; height: 11px; display: inline-block; border: 1px solid rgba(0,0,0,.2); }

/* food editor */
.ing-table, .mtx { width: 100%; border-collapse: collapse; font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.ing-table th, .mtx th { font-family: "Public Sans", sans-serif; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--ink); }
.ing-table td, .mtx td { padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--rule-2); }
.ing-table th:first-child, .ing-table td:first-child, .mtx th:first-child, .mtx td:first-child { text-align: left; }
.ing-table input, .mtx input { font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); background: var(--field-bg); padding: 2px 4px; text-align: right; }
.ing-table input.name, .mtx input { width: 64px; }
.ing-table input.name { width: 150px; text-align: left; }
.ing-table input.unitc { width: 80px; }
.cost-readout { font-family: "IBM Plex Mono", monospace; font-size: 13px; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--ink); display: inline-block; }
.cost-readout b { font-size: 16px; }
.seg-toggle { display: inline-flex; border: 1px solid var(--ink); margin-bottom: 12px; }
.seg-toggle button { font: inherit; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 12px; border: 0; color: var(--ink); background: var(--paper); cursor: pointer; -webkit-appearance: none; appearance: none; }
.seg-toggle button.on { background: var(--ink); color: var(--paper); }

/* persistent impact bar */
.impactbar { position: sticky; top: 0; z-index: 5; display: flex; border: 1px solid var(--ink); background: var(--paper); margin-bottom: 18px; }
.impactbar .imp { flex: 1; padding: 9px 14px; border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: 3px; }
.impactbar .imp:last-child { border-right: 0; }
.impactbar .il { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.impactbar .iv { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 600; display: flex; align-items: baseline; gap: 7px; }
.impactbar .iv.neg { color: var(--stamp); }
.delta { font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 500; }
.delta.up { color: var(--measured); } .delta.down { color: var(--stamp); } .delta.flat { color: var(--ink-soft); }
.btn.on { background: var(--ink); color: var(--paper); }

/* food module misc */
.cost-readout span { margin-right: 10px; }
.sides-row { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.sides-row label { font-size: 12px; }
.sides-row input { width: 72px; font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); padding: 3px 6px; text-align: right; }

/* capital / runway summary */
.runway-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.runway-summary > div { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; }
.runway-summary .il { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.runway-summary .iv { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
.runway-summary .iv.neg { color: var(--stamp); }

/* menu item builder */
.menu-item { border: 1px solid var(--ink); background: var(--panel-2); padding: 12px 14px; margin-bottom: 12px; }
.mi-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mi-name { font-family: "Public Sans", sans-serif; font-weight: 600; font-size: 15px; border: 1px solid var(--rule); padding: 4px 8px; width: 210px; }
.mi-head select { font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); padding: 3px 5px; background: var(--field-bg); }
.mi-field { font-size: 11px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; }
.mi-field input { width: 70px; font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); padding: 2px 5px; text-align: right; }
.mi-price { font-family: "IBM Plex Mono", monospace; font-size: 16px; font-weight: 600; }
.mi-econ { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; font-size: 13px; margin: 9px 0; }
.mi-econ .neg { color: var(--stamp); }
.mi-toppings { width: auto; min-width: 300px; margin-bottom: 8px; }
.mi-toppings td { border-bottom: 1px solid var(--rule-2); }
.mi-toppings input { width: 64px; font-family: "IBM Plex Mono", monospace; border: 1px solid var(--rule); padding: 2px 4px; text-align: right; }
.mi-add { font-family: "IBM Plex Mono", monospace; font-size: 12px; border: 1px solid var(--ink); background: var(--paper); padding: 4px 8px; }

/* calculations / audit table */
table.calc { width: 100%; border-collapse: collapse; table-layout: fixed; }   /* fixed → the middle column lines up across every section */
table.calc td { padding: 4px 8px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
table.calc .cl { font-family: "Public Sans", sans-serif; font-size: 13px; width: 30%; }
table.calc .cd { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft); width: 48%; white-space: pre-line; }   /* pre-line → newline-joined lists (dough) break one per line */
table.calc .cv { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; font-weight: 600; width: 22%; }
table.calc .cv.neg { color: var(--stamp); }
table.calc tr.pl-sub td { border-top: 1px solid var(--rule); background: rgba(0,0,0,0.015); }

a.src { color: var(--stamp); text-decoration: none; font-size: 11px; margin-left: 4px; }

/* ---- identity badge (header) ---- */
.whoami { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; }
.whoami .role { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; padding: 1px 5px; border: 1px solid var(--rule); color: var(--ink-soft); }
.whoami .role.owner { color: var(--measured); border-color: var(--measured); }

/* ---- login page (two-stage card; no copy by design) ---- */
body.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--paper); }
/* display:block — this is a <main>, so it must NOT inherit the dashboard's `main { display:grid }` (that put the form beside the splash). */
.login-card { display: block; width: 100%; max-width: 380px; background: var(--panel-2); border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,0.35); }
.login-brand { background: #0f0e0d; line-height: 0; }   /* matches the splash's field for a seamless edge */
.login-splash { display: block; width: 100%; height: auto; }
.login-stage { display: none; padding: 22px 24px 26px; }
.login-stage.active { display: block; }
.login-form input { width: 100%; box-sizing: border-box; background: var(--field-bg); border: 1px solid var(--rule); border-radius: 3px; color: var(--ink); font-size: 15px; padding: 12px 13px; font-family: "IBM Plex Mono", monospace; }
.login-form input:focus { outline: none; border-color: var(--stamp); }
#codeInput { font-size: 22px; letter-spacing: .35em; text-align: center; }
.login-form button { width: 100%; margin-top: 12px; background: var(--ink); color: var(--paper); border: 0; border-radius: 3px; font-size: 14px; font-weight: 600; letter-spacing: .02em; padding: 12px 14px; cursor: pointer; font-family: "Public Sans", system-ui, sans-serif; }
.login-form button:hover { opacity: .9; }
.login-form button:disabled { opacity: .5; cursor: not-allowed; }
.login-form button.ghost { background: transparent; color: var(--ink-soft); margin-top: 8px; font-weight: 500; font-size: 12px; }
.login-form button.ghost:hover { color: var(--ink); opacity: 1; }
.login-msg { min-height: 16px; font-size: 12px; margin-top: 10px; color: var(--stamp); font-family: "IBM Plex Mono", monospace; }

/* ===================== mobile / narrow screens ===================== */
/* Scoped to ≤760px so desktop is untouched. The app is already a single tabbed column
   (.tabbody); these just shrink the oversized header, stack side-by-side pairs, loosen dense
   input grids, and let wide tables scroll instead of blowing out the viewport. */
@media (max-width: 760px) {
  .app { height: 100dvh; }                       /* dvh so mobile browser chrome can't clip the bottom */

  header.bar { gap: 10px; padding: 8px 12px; position: relative; }
  header.bar img { height: 48px; }               /* the 128px brand logo is far too big on a phone */
  .hamburger { display: inline-flex; }
  nav.tabs { padding: 0 8px; }

  /* the busy control cluster collapses into a tap-to-open dropdown */
  .scenarios { display: none; }
  .scenarios.open {
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    position: absolute; top: 100%; left: 0; right: 0; z-index: 30; padding: 12px 14px;
    background: var(--panel-2); border-top: 1px solid var(--rule); border-bottom: 2px solid var(--ink);
    box-shadow: 0 14px 30px rgba(0,0,0,0.3);
  }
  .scenarios.open > * { width: 100%; box-sizing: border-box; text-align: center; }
  .scenarios.open .icon-btn { width: auto; align-self: flex-start; }   /* keep the theme toggle compact */
  .scenarios.open .whoami { justify-content: center; }

  .tabbody { padding: 14px 13px 60px; }
  /* make multi-input rows wrap so they FIT the width (no clip, no side-scroll) */
  .sides-row, .method-row, .dash-keys, .regime { flex-wrap: wrap; }
  .sides-row input, .sides-row select { flex: 0 1 auto; }

  .two-col { grid-template-columns: 1fr; }        /* stack the side-by-side chart pairs */
  .vec { grid-template-columns: repeat(3, 1fr); } /* 6-wide month grids are unusable narrow */
  .timeline .tl-row { grid-template-columns: 110px 1fr; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

  /* pinned-metrics bar: wrap instead of forcing every cell into one overflowing row */
  .impactbar { flex-wrap: wrap; position: static; }
  .impactbar .imp { flex: 1 1 45%; border-bottom: 1px solid var(--rule); }
  .impactbar .iv { font-size: 17px; }

  /* dashboard input row: sliders fill their cell, items wrap cleanly */
  .dash-keys .dk { flex: 1 1 140px; }
  .dash-keys .dk input[type=range] { width: 100%; }

  /* EVERY wide table (.mtx / .ing-table / .calc / .ledger) scrolls in its own box
     instead of overflowing the page — this is what was breaking nearly every tab. */
  .tabbody table { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .mi-toppings { min-width: 0; }   /* its 300px min-width was overriding the scroll cap → page side-scroll */
  .mi-name { width: 100%; }        /* menu-item name input fits instead of spanning past the edge */
}
