/* Scaling the House — functional styling. Visual taste is the UAT bead
   (workinator-ng89.6); this aims for legible + spreadsheet-like, not final. */

:root {
  --ink: #1b1f24;
  --muted: #6b7480;
  --line: #d7dce2;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --accent: #2b6cb0;
  --prior: #b0851f;
  --soft: #c0392b;
  --p10: #7a8899;
  --p50: #2b6cb0;
  --p90: #7a8899;
  --spreadsheet: #b0851f;
  --target: #c0392b;
  --bin: #9fc0e0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

.app { max-width: 1200px; margin: 0 auto; padding: 1rem 1.25rem 4rem; }
.app-head h1 { margin: 0.2rem 0 0; font-size: 1.6rem; }
.app-head .sub { margin: 0.15rem 0 0.8rem; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--line); }
.tab {
  border: none; background: transparent; padding: 0.6rem 1rem; cursor: pointer;
  font-size: 0.95rem; color: var(--muted); border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* Body layout */
.body { display: grid; grid-template-columns: 320px 1fr; gap: 1.25rem; margin-top: 1rem; }
.sidebar { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; height: fit-content; }
.tab-panel { min-width: 0; }

/* Tables */
.sheet { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.sheet th, .sheet td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.sheet th.num, .sheet td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: "SF Mono", Menlo, Consolas, monospace; }
.sheet thead th { background: #eef1f5; font-weight: 600; font-size: 0.8rem; }
.sheet .rowlabel { font-weight: 500; }
.sheet .subtotal { font-weight: 600; }
.sheet tfoot .totals td { border-top: 2px solid var(--line); font-weight: 700; background: #f2f5f8; }
.sheet .area-note td { color: var(--muted); font-size: 0.8rem; }
td.prior { color: var(--ink); }
td.soft { color: var(--soft); }
.prior-dot { color: var(--prior); font-size: 0.75rem; }

/* SVG charts */
svg.tornado, svg.histogram { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; margin: 0.4rem 0 1rem; }
.tornado .bar rect { fill: var(--accent); opacity: 0.85; }
.tornado .bar-label { font-size: 11px; fill: var(--ink); }
.tornado .swing { font-size: 10px; fill: var(--muted); }
.tornado .baseline { stroke: var(--ink); stroke-dasharray: 3 3; stroke-width: 1; }
.tornado .baseline-label { font-size: 10px; fill: var(--muted); }

.histogram .bin { fill: var(--bin); }
.histogram .axis { stroke: var(--line); stroke-width: 1; }
.histogram .axis-tick { stroke: var(--line); stroke-width: 1; }
.histogram .axis-tick-label { font-size: 9px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.histogram .marker { stroke-width: 1.5; }
.histogram .marker.p10, .histogram .marker.p90 { stroke: var(--p10); stroke-dasharray: 2 2; }
.histogram .marker.p50 { stroke: var(--p50); }
.histogram .marker.spreadsheet { stroke: var(--spreadsheet); stroke-width: 2; }
.histogram .marker.target { stroke: var(--target); stroke-dasharray: 4 2; }
.histogram .marker-label { font-size: 9px; }
.histogram .marker-val { font-size: 9px; fill: var(--muted); }
.histogram .marker-label.p50 { fill: var(--p50); }
.histogram .marker-label.spreadsheet { fill: var(--spreadsheet); }
.histogram .marker-label.target { fill: var(--target); }
.histogram .marker-label.p10, .histogram .marker-label.p90 { fill: var(--p10); }

/* Sim summary */
.sim-summary { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.5rem 0; }
.sim-summary .stat { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.7rem; min-width: 90px; }
.sim-summary .stat .k { display: block; font-size: 0.72rem; color: var(--muted); }
.sim-summary .stat .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-summary .stat.risk .v { color: var(--soft); }

/* Risk bars */
.sheet.risk .riskbar-wrap { display: inline-block; width: 90px; height: 8px; background: #e6ebf0; border-radius: 4px; vertical-align: middle; margin-right: 6px; overflow: hidden; }
.sheet.risk .riskbar { display: block; height: 100%; background: var(--accent); }
.sheet.risk .riskval { font-variant-numeric: tabular-nums; }

/* Controls */
.controls-group { margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); }
.controls-group:last-child { border-bottom: none; }
.controls-group h3 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.controls-group h4 { margin: 0.6rem 0 0.2rem; font-size: 0.85rem; color: var(--muted); }
.hint, .controls-group .hint { color: var(--muted); font-size: 0.8rem; margin: 0.1rem 0 0.5rem; }
.slider { display: block; margin: 0.35rem 0; }
.slider-head { display: flex; justify-content: space-between; font-size: 0.82rem; }
.slider-value { font-variant-numeric: tabular-nums; font-weight: 600; }
.slider input[type=range] { width: 100%; }
.slider.soft .slider-value { color: var(--soft); }
.caption { display: block; font-size: 0.72rem; color: var(--muted); }
.caption .range { margin-right: 4px; }
.caption .prior-dot { color: var(--prior); }
.caption .soft-flag { color: var(--soft); }
.caption .derived { color: var(--accent); }
/* Mix budget-allocation bar: flex segments (width = share) + absolute handles */
.share-bar { position: relative; display: flex; width: 100%; height: 40px;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: var(--bg); user-select: none; touch-action: none; margin: 0.2rem 0 0.6rem; }
.share-seg { position: relative; height: 100%; display: flex; align-items: center;
  justify-content: center; overflow: hidden; transition: width 0.08s linear;
  min-width: 0; }
.share-seg .seg-name { font-size: 0.66rem; font-weight: 600; color: #fff;
  white-space: nowrap; padding: 0 2px; text-shadow: 0 1px 1px rgba(0,0,0,0.25); }
.share-seg.unallocated { background-image: repeating-linear-gradient(45deg,
    transparent, transparent 5px, rgba(0,0,0,0.05) 5px, rgba(0,0,0,0.05) 10px); }
.share-seg.unallocated .seg-name { color: var(--muted); text-shadow: none; }
.bar-handle { position: absolute; top: 0; bottom: 0; width: 22px;
  transform: translateX(-50%); cursor: ew-resize; z-index: 2;
  display: flex; align-items: center; justify-content: center; touch-action: none; }
.bar-handle-grip { width: 3px; height: 60%; background: var(--panel);
  border: 1px solid var(--muted); border-radius: 2px; box-shadow: 0 0 2px rgba(0,0,0,0.3); }
.bar-handle:hover .bar-handle-grip,
.bar-handle:focus .bar-handle-grip { background: var(--accent); border-color: var(--accent); }
.bar-handle:focus { outline: none; }
.seg-legend { list-style: none; margin: 0; padding: 0; font-size: 0.75rem; }
.seg-legend-row { display: flex; align-items: baseline; gap: 0.4rem; margin: 0.15rem 0; }
.seg-legend .dot { width: 10px; height: 10px; border-radius: 2px; flex: none; align-self: center; }
.seg-legend .k { flex: none; }
.seg-legend .v.derived { color: var(--accent); font-variant-numeric: tabular-nums; }
/* Mix as the primary interface: full-width strip atop the chart cell */
.mix-strip { margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 2px solid var(--line); }
.mix-strip .controls-group.mix { margin: 0; padding: 0; border: none; }
.mix-strip .share-bar { height: 52px; }
.mix-strip .seg-legend { display: flex; flex-wrap: wrap; gap: 0.1rem 1.1rem; }
.mix-strip .seg-legend-row { margin: 0.1rem 0; }
.field { display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; margin: 0.3rem 0; gap: 0.5rem; }
.field input { width: 100px; padding: 0.2rem 0.3rem; border: 1px solid var(--line); border-radius: 4px; text-align: right; }
.book { margin-top: 0.6rem; width: 100%; padding: 0.55rem; background: var(--accent); color: #fff; border: none; border-radius: 6px; font-size: 0.95rem; cursor: pointer; }
.book:disabled { opacity: 0.6; cursor: default; }
.progress { margin-top: 0.4rem; height: 6px; background: #e6ebf0; border-radius: 3px; overflow: hidden; }
.progress .bar { height: 100%; background: var(--accent); transition: width 0.1s linear; }

/* Ending-beat footer */
.beat { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1.25rem; padding: 0.9rem 1rem; background: #eef1f5; border-left: 4px solid var(--accent); border-radius: 6px; }
.beat-tag { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.beat p, .beat ul { margin: 0.2rem 0 0; }
.beat .next { white-space: nowrap; background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 0.5rem 0.9rem; cursor: pointer; }

/* Disclaimer */
.disclaimer { margin-top: 1.5rem; padding: 0.75rem 1rem; font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--line); }
.disc-why { display: block; margin-top: 0.2rem; }

.prompt { color: var(--muted); font-style: italic; padding: 1rem 0; }

@media (max-width: 820px) {
  .body { grid-template-columns: 1fr; }
}

/* ==========================================================================
   One-pager toy (DECISIONS.md 'Pivot 2026-07-08'). Functional layout — visual
   taste is the UAT bead; this aims for legible + single-column, not final.
   ========================================================================== */
.onepager { max-width: 780px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.op-head h1 { margin: 0 0 0.25rem; font-size: 1.9rem; }
.onepager .rule { border: none; border-top: 1px solid var(--line); margin: 1.4rem 0; }

.section-head { font-size: 1.25rem; margin: 0 0 0.6rem; }
.section-head .fixed-tag, .section-head .only-decision,
.zone-head .zone-sub, .zone-head .fixed-tag {
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-left: 0.5rem; }
.section-head .only-decision, .fixed-tag {
  background: #eef1f5; border-radius: 4px; padding: 0.1rem 0.4rem; }

/* ⓘ provenance affordance */
.info { display: inline-block; width: 1.05em; height: 1.05em; line-height: 1.05em;
  text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 50%; cursor: help;
  vertical-align: middle; }

/* Preamble */
.preamble-body.placeholder { border: 1px dashed var(--line); border-radius: 6px;
  padding: 0.9rem 1rem; background: repeating-linear-gradient(45deg,
    transparent, transparent 8px, rgba(0,0,0,0.02) 8px, rgba(0,0,0,0.02) 16px); }
.placeholder-note { margin: 0; color: var(--muted); font-style: italic; }
.how-it-works { margin-top: 0.7rem; }
.how-it-works summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.how-body { padding: 0.4rem 0 0.2rem; font-size: 0.92rem; }
.how-body p { margin: 0.5rem 0; }
/* How-this-works definition list — provisional briefs (dashed, muted, italic
   statements) so it's obvious the copy is not final. */
.how-dl.placeholder { margin: 0.3rem 0 0; padding: 0.6rem 0.9rem;
  border: 1px dashed var(--line); border-radius: 6px; }
.how-dl dt { font-weight: 700; color: var(--ink); margin-top: 0.5rem; }
.how-dl dt:first-child { margin-top: 0; }
.how-dl dd { margin: 0.1rem 0 0; color: var(--muted); font-style: italic; }

/* Per-zone one-line descriptions — provisional briefs, styled like placeholders */
.zone-desc.placeholder { margin: 0 0 0.4rem; font-size: 0.85rem; color: var(--muted);
  font-style: italic; border-left: 2px dashed var(--line); padding-left: 0.5rem; }

/* The hall */
.hall-line { margin: 0 0 0.5rem; font-size: 1.05rem; }
.hall-facts { list-style: none; margin: 0; padding: 0; display: flex;
  flex-wrap: wrap; gap: 0.4rem 2rem; font-size: 0.95rem; }
.hall-facts .k { color: var(--muted); }
.hall-facts .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.derived-tag { font-size: 0.72rem; color: var(--prior); font-style: italic; }

/* Zones */
.zone-head { font-size: 1.02rem; margin: 1rem 0 0.3rem; }
.zone-mix { margin-bottom: 0.4rem; }
.share-bar.zone-bar { height: 54px; }
.seg-remove { margin-left: 0.35rem; background: rgba(255,255,255,0.25);
  color: #fff; border: none; border-radius: 3px; cursor: pointer;
  font-size: 0.8rem; line-height: 1; padding: 0.05rem 0.3rem; }
.seg-remove:hover { background: rgba(0,0,0,0.25); }
.add-classes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
/* Add pills read as an unplaced bar segment: the class's saturated hue, a big
   white +, a white label, no thin outline (inline background set per class). */
.add-class { display: inline-flex; align-items: center; gap: 0.3rem;
  border: none; border-radius: 5px; padding: 0.3rem 0.6rem 0.3rem 0.5rem;
  font-size: 0.82rem; font-weight: 600; color: #fff; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
.add-class:hover { filter: brightness(1.08); }
.add-class .add-plus { font-size: 1.15rem; font-weight: 800; line-height: 1;
  color: #fff; }
.add-class .add-label { color: #fff; }

/* Floor hero — the live density lever */
.hero-seats { margin: 0.5rem 0 0.2rem; font-size: 1.15rem; }
.hero-seats .seat-count { font-size: 1.6rem; color: var(--accent);
  font-variant-numeric: tabular-nums; }
.hero-ref { color: var(--muted); font-size: 0.92rem; }

/* Prices */
.price-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem;
  margin-top: 0.3rem; }
.mult-fields { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; }
.price-field { display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.9rem; }
.price-field input { width: 68px; padding: 0.2rem 0.35rem; border: 1px solid var(--line);
  border-radius: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.price-field.base input { width: 84px; font-weight: 600; }
.price-field .dollar { color: var(--muted); }

/* Simulate */
.sim-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: 1.02rem; }
.sim-line .events { width: 58px; padding: 0.2rem 0.3rem; border: 1px solid var(--line);
  border-radius: 4px; text-align: right; }
.simulate-btn { margin-left: auto; background: var(--accent); color: #fff;
  border: none; border-radius: 6px; padding: 0.5rem 1.1rem; font-size: 0.98rem;
  cursor: pointer; }
.simulate-btn:disabled { opacity: 0.6; cursor: default; }

/* Results */
.results { text-align: center; }
.earns-label { margin: 0; text-transform: uppercase; letter-spacing: 0.05em;
  font-size: 0.8rem; color: var(--muted); }
.earns-hero { margin: 0.1rem 0 0.4rem; font-size: 3rem; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums; }
.earns-triple { margin: 0.2rem 0; font-size: 1rem; }
.earns-triple .bad { color: var(--p10); }
.earns-triple .great { color: var(--p90); }
.triple-caption { margin: 0 0 0.8rem; font-size: 0.78rem; color: var(--muted); }
.results .histogram { margin: 0.5rem 0; }
.spreadsheet-note { text-align: left; font-size: 0.85rem; color: var(--prior);
  border-left: 3px solid var(--prior); padding: 0.4rem 0.7rem; background: #fbf6ec; }

/* Fine print */
.fine-print { font-size: 0.82rem; color: var(--muted); }

/* ==========================================================================
   Pass 3 (ride ng89.14): Assumptions → Model → Simulation. Visual grammar —
   INPUT BOXES = assumptions you set; DRAGGABLE BARS = the simulation you play.
   Layout aims to fit both mixers + the distribution in one viewport; final
   visual/teaching taste is the deferred UAT.
   ========================================================================== */

/* Header intro */
.op-head .why-sim { margin: 0.3rem 0 0; font-size: 0.98rem; color: var(--ink); }

/* Assumptions — read-only definition list, the fixed context */
.assumptions-dl { margin: 0.4rem 0 0; display: grid;
  grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; font-size: 0.9rem; }
.assumptions-dl dt { font-weight: 700; color: var(--ink); }
.assumptions-dl dd { margin: 0; color: var(--muted); }

/* The Model — input boxes (assumptions), compact so the mixers stay above fold */
.model-inputs { display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 0.5rem 1.6rem; margin: 0.2rem 0 1rem; }
.model-field { display: flex; flex-direction: column; gap: 0.2rem; }
.model-field .field-label { font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.model-field input { padding: 0.2rem 0.35rem; border: 1px solid var(--line);
  border-radius: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.events-field { flex-direction: row; align-items: center; gap: 0.4rem; }
.events-field .field-label { text-transform: none; }
.events-field input { width: 58px; }

/* Density boxes */
.density-boxes { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; }
.density-box { display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.85rem; }
.density-box input { width: 62px; }
.density-box .unit { color: var(--muted); font-size: 0.78rem; }
.density-basis { margin: 0.15rem 0 0; font-size: 0.72rem; }

/* Prices */
.price-field-group .price-fields { display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.5rem 1rem; margin-top: 0.1rem; }
.price-field { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }
.price-field input { width: 64px; padding: 0.2rem 0.35rem; border: 1px solid var(--line);
  border-radius: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.price-field.base input { width: 80px; font-weight: 600; }
.price-field.base .dollar { color: var(--muted); }
.price-field.base .anchor-note { font-size: 0.72rem; color: var(--muted); font-style: italic; }
.mult-fields { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; }

/* Core loop — the two mixers + the distribution, kept together in one viewport */
.core-loop { display: flex; flex-direction: column; gap: 0.6rem; }
.mixer { margin: 0; }
.mixer-head { font-size: 1.0rem; margin: 0.2rem 0 0.25rem; }
.mixer-head .mixer-sub { font-size: 0.72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-left: 0.5rem; }
.mixer-desc { margin: 0 0 0.3rem; font-size: 0.85rem; color: var(--muted); }
.mixer .zone-mix { margin-bottom: 0.2rem; }
.mixer .hero-seats { margin: 0.25rem 0 0; font-size: 1.05rem; }

/* Priced segment sub-label inside a mixer segment */
.share-seg .seg-price { display: block; font-size: 0.6rem; font-weight: 500;
  color: rgba(255,255,255,0.92); white-space: nowrap; }

/* Simulation */
.simulation .section-head { margin-top: 0.4rem; }
.reroll-line { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.reroll-line .reroll { margin: 0; }
.reroll-line .progress { flex: 1; margin: 0; }
.simulation .results { text-align: center; }
.simulation .earns-hero { font-size: 2.3rem; margin: 0.05rem 0 0.3rem; }
