:root {
  --bg: #f6f1e7; --card: #fffdf8; --ink: #2b2118; --muted: #7a6a58; --line: #e6dccb;
  --accent: #b8741a; --accent-ink: #fff; --ok: #3b7d3b; --warn: #b3541e; --bad: #b3261e; --head: #2b1d10;
  --shadow: 0 1px 2px rgba(60, 40, 10, .08), 0 4px 14px rgba(60, 40, 10, .05);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17120d; --card: #211a13; --ink: #f2e8d8; --muted: #a8977f; --line: #3a2e21; --accent: #e0953a; --accent-ink: #1b1109; --ok: #7bc47b; --warn: #e89a63; --bad: #f08a82; --head: #0e0a06; --shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 1.1rem; margin-bottom: .6rem; }
h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.1rem 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .82rem; }
header.chrome { background: var(--head); color: #f6e9d3; padding: .7rem 1rem 0; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: .6rem; max-width: 1200px; margin: 0 auto; }
.brand h1 { font-size: 1.3rem; letter-spacing: .02em; }
.brand .tag { color: #bda98b; font-size: .85rem; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; box-shadow: inset 0 -8px 0 rgba(255, 255, 255, .55); }
nav { display: flex; gap: .25rem; max-width: 1200px; margin: .5rem auto 0; overflow-x: auto; }
.tab { background: none; border: 0; color: #d8c8ac; padding: .55rem .9rem; font: inherit; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab:hover { color: #fff; } .tab.active { color: #fff; border-bottom-color: var(--accent); font-weight: 600; }
main { max-width: 1200px; margin: 1.2rem auto; padding: 0 1rem 3rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.form { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
.two-col > .results { position: sticky; top: 7.2rem; max-height: calc(100vh - 8.5rem); overflow-y: auto; }
.two-col.batches { grid-template-columns: 300px minmax(0, 1fr); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.field { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; }
.field > span { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.field small { color: var(--muted); font-size: .75rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: .4rem .5rem; min-width: 0; max-width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-within, li:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input.num { width: 7rem; } .field input.num, .field select, .field input:not([type=checkbox]) { width: 100%; } input.num.w5 { width: 4.6rem; } input.num.w6 { width: 5.6rem; }
textarea { width: 100%; resize: vertical; }
.btn { font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 7px; padding: .45rem .85rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.file input { display: none; } .small-btn { padding: .2rem .6rem; font-size: .8rem; }
.align-end { align-self: end; }
.icon { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; padding: .2rem .5rem; border-radius: 4px; } .icon:hover { color: var(--bad); background: var(--bg); }
.row { display: flex; gap: .5rem; align-items: center; } .row.wrap { flex-wrap: wrap; } .split { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.title-input { font-size: 1.1rem; font-weight: 600; min-width: 16rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.ingredients td, .ingredients th { padding: .3rem .4rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
.ingredients th { font-size: .72rem; text-transform: uppercase; color: var(--muted); }
.num-cell { text-align: right !important; font-variant-numeric: tabular-nums; }
.adder { margin-top: .6rem; width: 100%; max-width: 22rem; }
table.kv th { text-align: left; font-weight: 500; color: var(--muted); padding: .2rem 0; } table.kv td { text-align: right; font-variant-numeric: tabular-nums; }
table.data { font-variant-numeric: tabular-nums; } table.data th, table.data td { padding: .35rem .5rem; border-bottom: 1px solid var(--line); text-align: right; } table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.swatch-row { display: flex; gap: .8rem; align-items: center; }
.swatch { width: 54px; height: 54px; border-radius: 50% 50% 12px 12px / 18% 18% 12px 12px; border: 3px solid rgba(0, 0, 0, .25); flex: none; box-shadow: inset 0 -8px 14px rgba(0, 0, 0, .12); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .8rem 0; }
.stat { background: var(--bg); border-radius: 8px; padding: .5rem .6rem; display: flex; flex-direction: column; }
.stat span { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); } .stat strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.gauge { margin-bottom: .7rem; } .gauge-head, .gauge-foot { display: flex; justify-content: space-between; font-size: .8rem; } .gauge-foot { color: var(--muted); font-size: .72rem; }
.track { position: relative; height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; margin: .3rem 0; }
.zone { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ok) 35%, transparent); border-radius: 5px; }
.marker { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; background: var(--ink); border-radius: 2px; }
.gauge.in .status { color: var(--ok); } .gauge.low .status, .gauge.high .status { color: var(--warn); } .gauge .status { font-weight: 600; }
.warn { color: var(--warn); font-size: .85rem; } .ok { color: var(--ok); } .error { color: var(--bad); }
.list { list-style: none; margin: 0; padding: 0; } .list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .6rem .3rem; border-bottom: 1px solid var(--line); }
.list.selectable li { cursor: pointer; border-radius: 6px; padding-inline: .6rem; } .list.selectable li.selected { background: var(--bg); box-shadow: inset 3px 0 var(--accent); }
.pill { background: var(--bg); border-radius: 99px; padding: .1rem .6rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; align-items: start; }
.tool-out { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-top: .9rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.big span { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; } .big strong { font-size: 1.3rem; }
.ions { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.step.done-step { opacity: .6; } .step-head { display: flex; gap: .6rem; align-items: center; cursor: pointer; margin-bottom: .3rem; }
.step-head input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); } .step-num { background: var(--head); color: #fff; border-radius: 99px; width: 1.5rem; height: 1.5rem; display: inline-grid; place-items: center; font-size: .8rem; }
.timer { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; padding: .5rem .7rem; margin: .4rem 0; background: var(--bg); border-radius: 8px; border-left: 4px solid var(--line); }
.timer.running { border-left-color: var(--accent); } .timer.done { border-left-color: var(--ok); } .timer.done .clock { color: var(--ok); }
.timer .row { grid-column: 1 / -1; } .clock { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.hero { max-width: 40rem; margin: 2rem auto; } .hero .btn { margin-top: .6rem; }
.spark { width: 100%; max-width: 360px; height: 90px; background: var(--bg); border-radius: 8px; } .spark polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.add-reading { margin: .8rem 0; align-items: end; }
#toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translate(-50%, 2rem); background: var(--head); color: #fff; padding: .6rem 1rem; border-radius: 8px; opacity: 0; pointer-events: none; transition: .25s; z-index: 20; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#print-root { display: none; }
@media (max-width: 900px) {
  .two-col, .two-col.batches, .cols-2 { grid-template-columns: 1fr; } .two-col > .results { position: static; max-height: none; }
  .brand .tag { display: none; } .tools { grid-template-columns: 1fr; }
}
@media print {
  .chrome, #toast { display: none !important; }
  #print-root { display: block; } body { background: #fff; color: #000; }
  .print-card { font: 12pt/1.4 Georgia, serif; } .print-card header { display: flex; gap: 1rem; align-items: center; }
  .print-card h1 { font-size: 22pt; } .print-card h2 { font-size: 12pt; text-transform: uppercase; border-bottom: 1px solid #999; margin: 1rem 0 .3rem; }
  .print-card .stat { border: 1px solid #bbb; background: none; } .print-card table.kv td, .print-card table.kv th { color: #000; border-bottom: 1px dotted #ccc; }
  .swatch { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
