/* Booth Math - kraft paper, price tags and a chalkboard tablecloth. */
:root {
  --bg: #f1e7d4; --paper: #fffaf0; --ink: #2a2420; --muted: #6c6158; --line: #dccdb2; --tint: #f7efe1;
  --accent: #b8790c; --accent-ink: #fffaf0; --chalk: #2e3a39; --chalk-ink: #f3efe6; --wood: #a77a4c; --wood-dark: #7d5734;
  --healthy: #23756f; --healthy-bg: #dff0ec; --thin: #b06a00; --thin-bg: #fbecd2; --under: #bf3b31; --under-bg: #f8dfdb;
  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --slab: Rockwell, "Roboto Slab", "Courier New", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1916; --paper: #26221e; --ink: #f0e8da; --muted: #b3a797; --line: #40392f; --tint: #2e2924;
    --accent: #e3a43a; --accent-ink: #1b1916; --chalk: #121817; --chalk-ink: #e9e4d8; --wood: #8a643e; --wood-dark: #5f4429;
    --healthy: #5cc2b5; --healthy-bg: #173431; --thin: #f0ad4a; --thin-bg: #3a2c14; --under: #f07a6e; --under-bg: #41201c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1916; --paper: #26221e; --ink: #f0e8da; --muted: #b3a797; --line: #40392f; --tint: #2e2924;
  --accent: #e3a43a; --accent-ink: #1b1916; --chalk: #121817; --chalk-ink: #e9e4d8; --wood: #8a643e; --wood-dark: #5f4429;
  --healthy: #5cc2b5; --healthy-bg: #173431; --thin: #f0ad4a; --thin-bg: #3a2c14; --under: #f07a6e; --under-bg: #41201c;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); overflow-x: hidden; }
a { color: var(--accent); }
code { font: .85em var(--mono); background: var(--tint); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; word-break: break-word; }
h1, h2, h3 { font-family: var(--slab); font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.25rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1rem; margin: 16px 0 6px; }
.hidden { display: none !important; }
.small { font-size: .86rem; } .muted { color: var(--muted); } .mono { font-family: var(--mono); }
.warn { color: var(--thin); }

/* header */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--chalk); color: var(--chalk-ink); flex-wrap: wrap; }
.bar .back { color: var(--chalk-ink); opacity: .8; text-decoration: none; font-size: .9rem; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--slab); font-size: 1.1rem; }
.logo { width: 28px; height: 28px; }
.lg-tag { fill: var(--accent); } .lg-hole { fill: var(--chalk); } .lg-ln { stroke: var(--chalk); stroke-width: 2; stroke-linecap: round; fill: none; }
.session { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { font: inherit; font-size: .88rem; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px; padding: 5px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.bar .pill { border-color: rgba(255,255,255,.25); }
.pill:hover:not(:disabled) { border-color: var(--accent); }
.pill.solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.pill.ghost { background: transparent; color: inherit; cursor: default; }
.pill.tiny { font-size: .76rem; padding: 1px 8px; }
.pill.big { font-size: 1rem; padding: 9px 20px; }
.pill:disabled { opacity: .5; cursor: not-allowed; }

/* layout */
.wrap { max-width: 1160px; margin: 0 auto; padding: 16px; }
.hero { padding: 18px 0 8px; }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: var(--accent); font-weight: 700; margin: 0; }
.hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: 6px 0 10px; }
.hl { background: linear-gradient(transparent 62%, var(--thin-bg) 62%); }
.lede { max-width: 760px; color: var(--muted); margin: 0 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips-label { font-size: .86rem; color: var(--muted); }
.chip { font: inherit; font-size: .86rem; border: 1px dashed var(--accent); background: transparent; color: var(--ink); padding: 4px 12px; border-radius: 4px 12px 12px 4px; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-style: solid; }
.two { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin-top: 14px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-top: 16px; min-width: 0; box-shadow: 0 1px 0 var(--line); }
.two .card { margin-top: 0; }
.stepno { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--chalk); color: var(--chalk-ink); font: 700 .85rem var(--sans); flex: none; }
textarea, input[type="text"] { width: 100%; font: .92rem/1.45 var(--mono); color: var(--ink); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
textarea { resize: vertical; }
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.f { display: block; font-size: .86rem; font-weight: 600; margin: 0 0 10px; }
.f input, .f textarea { margin-top: 4px; font-weight: 400; }
.opt { font-weight: 400; color: var(--muted); font-size: .8rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid2 .wide { grid-column: 1 / -1; }
.drop { border: 2px dashed transparent; border-radius: 8px; }
.drop.over { border-color: var(--accent); }
.drop-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.filebtn { font-size: .86rem; color: var(--accent); cursor: pointer; text-decoration: underline; }
.filebtn input { display: none; }
.countdown { display: flex; align-items: baseline; gap: 6px; background: var(--tint); border-radius: 6px; padding: 6px 10px; font-size: .9rem; }
.countdown b { font-size: 1.4rem; }
.countdown.soon b { color: var(--thin); } .countdown.past b { color: var(--muted); }
.notes { list-style: none; padding: 0; margin: 10px 0 0; }
.notes li { padding: 6px 10px; border-left: 3px solid var(--line); margin-bottom: 4px; background: var(--tint); border-radius: 0 6px 6px 0; font-size: .9rem; }
.notes li.warn, .notes li.bad { border-left-color: var(--under); color: var(--ink); }
.notes li.info { border-left-color: var(--thin); }
.notes li.ok { border-left-color: var(--healthy); }

/* the table display */
.disp-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.verdict-tag { font: 700 .82rem var(--sans); padding: 4px 10px; border-radius: 4px; background: var(--tint); }
.v-ready { background: var(--healthy-bg); color: var(--healthy); }
.v-reprice { background: var(--thin-bg); color: var(--thin); }
.v-rethink { background: var(--under-bg); color: var(--under); }
.display-empty { color: var(--muted); padding: 20px 0; }
.cluster { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.gauge { background: var(--chalk); color: var(--chalk-ink); border-radius: 12px; padding: 10px 12px 12px; text-align: center; min-width: 0; }
.gauge svg { width: 100%; max-width: 220px; display: block; margin: 0 auto; }
.band { fill: none; stroke-width: 14; }
.b-easy { stroke: #3f9d8f; } .b-stretch { stroke: #d9952b; } .b-long { stroke: #d0574b; }
.tick { stroke: rgba(255,255,255,.55); stroke-width: 2; }
.tlab { fill: rgba(255,255,255,.6); font: 11px var(--sans); }
.needle { stroke: #fff6e0; stroke-width: 4; stroke-linecap: round; }
.needle.over { stroke: #ffb1a8; }
.hub { fill: #fff6e0; }
.g-val { font-size: 1.7rem; font-weight: 700; margin-top: -4px; }
.g-easy .g-val { color: #7fd1c4; } .g-stretch .g-val { color: #f2bd62; } .g-long .g-val, .g-never .g-val { color: #ff9b8f; }
.g-name { font: 700 .92rem var(--slab); }
.g-sub { opacity: .78; margin-top: 2px; }
.legend { margin: 8px 0 14px; }
.booth { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(var(--tint), var(--paper)); }
.shelf { padding: 10px 12px 0; position: relative; }
.sh-anchor { margin: 0 14%; } .sh-core { margin: 0 7%; }
.sh-lab { display: flex; gap: 8px; align-items: baseline; font-size: .82rem; margin-bottom: 4px; flex-wrap: wrap; }
.sh-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; min-height: 60px; }
.plank { height: 10px; background: var(--wood); border-bottom: 4px solid var(--wood-dark); border-radius: 2px; margin: 0 -6px; }
.tag { flex: 1 1 120px; min-width: 110px; max-width: 260px; background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--healthy); border-radius: 4px 14px 14px 4px; padding: 6px 10px 6px 18px; position: relative; display: flex; flex-direction: column; gap: 1px; box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.tag .hole { position: absolute; left: 6px; top: 50%; width: 7px; height: 7px; margin-top: -3px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.tag.s-thin { border-left-color: var(--thin); } .tag.s-underwater { border-left-color: var(--under); background: var(--under-bg); }
.tag.ghost { border: 1px dashed var(--line); border-left-width: 1px; background: transparent; color: var(--muted); font-size: .84rem; justify-content: center; padding: 10px; }
.t-name { font-size: .88rem; line-height: 1.25; overflow-wrap: anywhere; }
.t-price { font-size: 1.05rem; font-weight: 700; }
.t-price s { color: var(--muted); font-weight: 400; font-size: .85rem; }
.t-qty { color: var(--muted); }
.t-st { font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
.s-healthy .t-st { color: var(--healthy); } .s-thin .t-st { color: var(--thin); } .s-underwater .t-st { color: var(--under); }
.tag.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 6px var(--accent); } 100% { box-shadow: 0 2px 0 rgba(0,0,0,.08); } }
.cloth { background: var(--chalk); color: var(--chalk-ink); padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 2px; text-align: center; border-top: 6px solid var(--wood-dark); }
.cloth b { font-family: var(--slab); font-size: 1.1rem; }
.cloth span { font-size: .84rem; opacity: .85; }
.ledger-wrap { overflow-x: auto; margin-top: 14px; }
.ledger { border-collapse: collapse; width: 100%; font-size: .86rem; min-width: 640px; }
.ledger th { text-align: left; font-weight: 700; border-bottom: 2px solid var(--line); padding: 6px 8px; white-space: nowrap; }
.ledger td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.ledger tr.s-underwater td:last-child { color: var(--under); font-weight: 700; }
.ledger tr.s-thin td:last-child { color: var(--thin); font-weight: 700; }
.ledger tr.s-healthy td:last-child { color: var(--healthy); font-weight: 700; }
.sugg { color: var(--accent); font-weight: 700; }
.flags h3 { margin-top: 18px; }
.readflags { list-style: none; padding: 0; margin: 0; }
.readflags li { padding: 5px 0; border-bottom: 1px dotted var(--line); font-size: .9rem; }
.readflags li.ok { color: var(--healthy); } .readflags li.none { color: var(--muted); }
.lv { display: inline-block; font: 700 .7rem var(--sans); text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: 3px; margin-right: 6px; }
.lv-fix .lv { background: var(--under-bg); color: var(--under); } .lv-info .lv { background: var(--tint); color: var(--muted); border: 1px solid var(--line); }
.rules { margin-top: 12px; font-size: .88rem; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules ul { padding-left: 18px; }

/* ask + progress */
.gate { background: var(--thin-bg); padding: 8px 10px; border-radius: 6px; font-size: .9rem; }
.runrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.ptitle { font-weight: 700; margin: 0 0 6px; }
.steps { list-style: none; padding: 0; margin: 0; }
.step { padding: 3px 0; color: var(--muted); } .step.done { color: var(--healthy); } .step.active { color: var(--ink); font-weight: 600; }
.step-ic { font-family: var(--mono); display: inline-block; width: 1em; }
.raw { white-space: pre-wrap; overflow-x: auto; max-height: 380px; font-size: .8rem; background: var(--tint); padding: 10px; border-radius: 6px; }

/* result */
.rhead { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rhead h2 { margin: 0; }
.stamp { font: 700 .82rem var(--sans); text-transform: uppercase; letter-spacing: .08em; padding: 5px 10px; border: 2px solid currentColor; border-radius: 4px; transform: rotate(-2deg); }
.stamp.v-ready { color: var(--healthy); background: none; } .stamp.v-reprice { color: var(--thin); background: none; } .stamp.v-rethink { color: var(--under); background: none; }
.summary { font-size: 1.02rem; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.chk { border: 1px solid var(--line); border-left: 5px solid var(--healthy); border-radius: 6px; padding: 8px 12px; background: var(--paper); }
.chk.s-thin { border-left-color: var(--thin); } .chk.s-underwater { border-left-color: var(--under); }
.chk p { margin: 4px 0; font-size: .92rem; }
.chk-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cite { font: 700 .95rem var(--slab); background: none; border: none; color: var(--ink); padding: 0; cursor: pointer; text-decoration: underline dotted; text-align: left; }
.pstamp { font: 700 .7rem var(--sans); text-transform: uppercase; letter-spacing: .06em; padding: 1px 7px; border-radius: 3px; }
.pstamp.s-healthy { background: var(--healthy-bg); color: var(--healthy); } .pstamp.s-thin { background: var(--thin-bg); color: var(--thin); } .pstamp.s-underwater { background: var(--under-bg); color: var(--under); }
.newprice { font-weight: 700; } .newprice s { color: var(--muted); font-weight: 400; }
.said { font-family: var(--mono); font-size: .82rem !important; color: var(--muted); }
.said.unq { text-decoration: underline wavy var(--under); }
.try b { color: var(--accent); }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bundles, .signs, .lines-plain { list-style: none; padding: 0; margin: 0; }
.bundle { border: 1px dashed var(--accent); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.bundle p { margin: 4px 0 0; }
.b-h { display: flex; justify-content: space-between; gap: 8px; }
.b-price { font-weight: 700; color: var(--accent); }
.sign { background: var(--chalk); color: var(--chalk-ink); font: 1rem var(--slab); padding: 8px 12px; border-radius: 6px; margin-bottom: 6px; }
.checklist { padding-left: 20px; margin: 0; } .checklist li { margin-bottom: 4px; }
.lines-plain li { padding: 4px 0; border-bottom: 1px dotted var(--line); font-size: .9rem; }
li.none { color: var(--muted); background: none !important; border: none !important; font-family: var(--sans); font-size: .9rem; }
.recon h3 { margin-top: 18px; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.hist { list-style: none; padding: 0; margin: 10px 0 0; }
.hrow { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hinfo { flex: 1 1 220px; display: flex; flex-direction: column; min-width: 0; }

.foot { max-width: 1160px; margin: 0 auto; padding: 10px 16px 40px; font-size: .84rem; color: var(--muted); }
.toasts { position: fixed; bottom: 16px; right: 16px; left: 16px; display: grid; gap: 6px; justify-items: end; z-index: 20; pointer-events: none; }
.toast { pointer-events: auto; background: var(--chalk); color: var(--chalk-ink); padding: 8px 12px; border-radius: 8px; font-size: .9rem; max-width: 420px; transition: opacity .5s; }
.toast.err { background: var(--under); color: #fff; } .toast a { color: inherit; } .toast.gone { opacity: 0; }

/* docs pages */
.doc { max-width: 900px; margin: 0 auto; padding: 24px 16px 48px; }
.doc h1 { font-size: 2rem; }
.doc h2 { font-size: 1.35rem; margin-top: 32px; display: block; }
.doc h3 { font-size: 1.05rem; margin-top: 22px; display: block; }
.doc pre { background: var(--tint); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font: .8rem/1.45 var(--mono); max-width: 100%; }
.doc pre code { background: none; border: none; padding: 0; white-space: pre; }
.doc table { border-collapse: collapse; width: 100%; font-size: .9rem; display: block; overflow-x: auto; }
.doc th, .doc td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc td code { white-space: normal; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 0; }
.tab { font: inherit; font-size: .8rem; padding: 4px 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px 6px 0 0; cursor: pointer; }
.tab.active { background: var(--chalk); color: var(--chalk-ink); border-color: var(--chalk); }
.codegroup pre { margin-top: 0; border-top-left-radius: 0; }
.statebox { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--paper); }
.statebox p { margin: 4px 0 0; }
.tokenrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.tokenbox { font: .85rem var(--mono); background: var(--tint); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; word-break: break-all; width: 100%; }

@media (max-width: 860px) {
  .two, .twocol { grid-template-columns: 1fr; }
  .cluster { grid-template-columns: 1fr; }
  .gauge { display: grid; grid-template-columns: 120px 1fr; text-align: left; align-items: center; gap: 0 12px; }
  .gauge svg { grid-row: 1 / span 3; max-width: 120px; }
  .g-val { margin-top: 0; font-size: 1.4rem; }
  .sh-anchor, .sh-core { margin: 0; }
}
@media (max-width: 480px) {
  .grid2 { grid-template-columns: 1fr; }
  .tag { min-width: 0; flex-basis: 130px; max-width: none; }
  .bar { padding: 8px 12px; }
}

/* "Print" on the signs: only the signs, one large card each. */
@media print {
  body.print-signs * { visibility: hidden; }
  body.print-signs #rSigns, body.print-signs #rSigns * { visibility: visible; }
  body.print-signs { background: #fff !important; }
  body.print-signs #rSigns { position: fixed; left: 0; top: 0; width: 100%; margin: 0; }
  body.print-signs .sign { background: #fff; color: #000; border: 2px solid #000; border-radius: 8px; font-size: 28pt; line-height: 1.25; padding: 28pt 20pt; margin: 0 0 14pt; text-align: center; break-inside: avoid; page-break-inside: avoid; }
}
