:root {
  --paper: #f5efe4; --card: #fffdf8; --ink: #23262b; --muted: #636770; --line: #e3d9c6;
  --accent: #2f5d50; --accent-dk: #234a3f; --clay: #b5562f; --late: #a8492a; --pencil: #4b4a46; --ok: #5f7d55; --tag: #f7e9a8;
  --radius: 14px; --shadow: 0 1px 0 rgba(35,38,43,.04), 0 6px 18px rgba(35,38,43,.06);
  --hand: "Caveat", "Segoe Print", "Bradley Hand", "Comic Neue", "Chalkboard SE", cursive;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink);
  background: var(--paper) radial-gradient(circle at 8% 4%, rgba(181,86,47,.07), transparent 40%), radial-gradient(circle at 94% 30%, rgba(47,93,80,.08), transparent 45%); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.opt { font-weight: 400; color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1000px; margin: 0 auto; padding: 18px 18px 6px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.01em; font-family: var(--serif); }
.sub { margin: 0; color: var(--muted); font-size: .92rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

main { max-width: 1000px; margin: 0 auto; padding: 6px 18px 24px; }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 10px; padding: 10px 14px; border-radius: 12px; background: #e2ebe6; color: var(--accent-dk); font-size: .93rem; }
.banner.bad { background: #f6e1d8; color: var(--late); }
.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-dk); text-decoration: underline; font-weight: 600; cursor: pointer; }

button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 9px 14px; min-height: 42px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(47,93,80,.35); outline-offset: 2px; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
.primary:hover { background: var(--accent-dk); }
.ghost { background: transparent; border-color: var(--line); }
.ghost:hover { background: #f1eadc; }
.ghost.sm { min-height: 34px; padding: 5px 10px; font-size: .9rem; }
.danger { color: var(--late); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* comparison tabs */
.lists { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.tab { background: rgba(255,253,248,.7); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; min-height: 38px; font-weight: 600; color: var(--pencil); }
.tab.on { background: var(--ink); color: #fffdf8; border-color: var(--ink); }
.tab-n { display: inline-block; margin-left: 7px; font-size: .78rem; font-weight: 700; opacity: .65; }
.tab.add { border-style: dashed; color: var(--accent-dk); font-weight: 600; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 14px 24px; align-items: start;
  background: linear-gradient(155deg, #fffdf8 0%, #f3ede1 60%, #ece8dc 100%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px 16px; margin-bottom: 16px; }
.hero-kicker { margin: 0 0 4px; font-family: var(--hand); font-size: 1.4rem; color: var(--clay); line-height: 1.1; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.base-pick { font-family: var(--hand); font-size: 1.4rem; color: var(--clay); }
.base-pick select { font-family: "Source Sans 3", system-ui, sans-serif; font-size: .95rem; padding: 2px 6px; border: 1px solid #e0c9b8; border-radius: 8px; background: #fffdf8; color: var(--ink); vertical-align: middle; }
.hero-title { margin: 0; font-family: var(--serif); font-size: 1.7rem; line-height: 1.2; letter-spacing: -.01em; }
.nw { white-space: nowrap; }
.hero-title .big { background: var(--tag); padding: 0 .22em; border-radius: 4px; box-shadow: 1px 1px 0 rgba(35,38,43,.12); white-space: nowrap; }
.hero-sub { margin: 8px 0 0; color: var(--muted); }
.deal-notes { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.deal-notes li { font-size: .92rem; padding: 7px 10px; border-radius: 10px; background: rgba(255,253,248,.85); border: 1px solid var(--line); border-left: 4px solid var(--clay); }
.deal-notes li.bad { border-left-color: var(--late); background: #fbefe9; }
.chart-wrap { margin: 0; }
.chart { background: #fbf8f1; border: 1px solid #ece3d2; border-radius: 10px; padding: 8px 10px 4px;
  background-image: linear-gradient(rgba(120,140,170,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(120,140,170,.07) 1px, transparent 1px); background-size: 18px 18px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .track { fill: #efe7d8; }
.chart .bar { fill: #8a9a92; }
.chart .bar.best { fill: var(--accent); }
.chart .bar.deal { fill: url(#hatch); }
.chart .lbl { font: 600 15px "Source Sans 3", system-ui, sans-serif; fill: var(--ink); }
.chart .lbl .dl { font-weight: 400; fill: var(--clay); }
.chart .val { font: 700 25px var(--hand); fill: var(--pencil); }
.chart .val.best { fill: var(--accent-dk); }
figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* steps */
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.step.manage { padding: 4px 18px 14px; background: transparent; box-shadow: none; border-style: dashed; }
.step-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.step-head h2 { margin: 0; font-size: 1.2rem; font-family: var(--serif); }
.step-no { font-family: var(--hand); font-size: 1.5rem; color: var(--clay); line-height: 1; }
.step-aside { margin-left: auto; color: var(--muted); font-size: .88rem; }
.empty { color: var(--muted); font-style: italic; margin: 6px 0; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 0; min-height: 1.2em; }
.hint.ok { color: var(--accent-dk); }
.hint.warn { color: var(--late); }

.quick { margin-bottom: 12px; }
.quick-label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
.quick-row { display: flex; gap: 8px; }
.quick-row input { flex: 1; min-width: 0; }
input[type=text], input[type=number], select { border: 1px solid #d9cdb6; background: #fff; border-radius: 10px; padding: 9px 11px; min-height: 42px; }
input[type=number] { -moz-appearance: textfield; }

.options { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.opt-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.opt-item.is-best { border-color: rgba(47,93,80,.55); box-shadow: inset 4px 0 0 var(--accent); }
.opt-item.is-out { background: #faf6ee; border-style: dashed; }
.oi-name { margin: 0; font-weight: 700; }
.oi-store { font-weight: 400; color: var(--muted); }
.oi-meta { margin: 0; color: var(--muted); font-size: .92rem; }
.oi-err { margin: 4px 0 0; color: var(--late); font-size: .9rem; }
.tagcheck { margin: 4px 0 0; font-size: .86rem; display: inline-block; padding: 2px 8px; border-radius: 4px; background: var(--tag); }
.tagcheck.off, .tagcheck.bad { background: #f6d9cc; color: var(--late); }
.stamp { display: inline-block; font: 700 1rem var(--hand); color: var(--accent-dk); border: 1.5px solid var(--accent); border-radius: 6px; padding: 0 6px; margin-right: 8px; transform: rotate(-3deg); }
.oi-unit { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.up { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.up small { font-family: "Source Sans 3", system-ui, sans-serif; font-weight: 400; color: var(--muted); font-size: .8rem; }
.up.best { color: var(--accent-dk); }
.up.deal { color: var(--clay); }
.oi-act { display: flex; gap: 6px; }

.opt-form { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbf8f1; }
.opt-form h3 { margin: 0 0 10px; font-family: var(--serif); }
.grid3 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.field { display: grid; gap: 4px; }
.field label { font-weight: 600; font-size: .9rem; }
.fs { border: 1px dashed #d9cdb6; border-radius: 10px; margin: 12px 0 0; padding: 8px 12px 12px; }
.fs legend { font-weight: 600; font-size: .9rem; padding: 0 4px; }
.deal-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.deal-row input[type=number] { width: 96px; }
.deal-fields { display: inline-flex; gap: 6px; align-items: center; }
.form-error { color: var(--late); font-weight: 600; margin: 10px 0 0; }

.usage-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.usage-row input { width: 100px; }
.usage-lead { margin: 12px 0 8px; }
.tbl-wrap { overflow-x: auto; }
table.usage { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.usage th, table.usage td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #efe7d8; }
table.usage th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
table.usage .num { text-align: right; font-variant-numeric: tabular-nums; }
table.usage tr.best td { font-weight: 700; color: var(--accent-dk); }
table.usage .dl { font-size: .82rem; color: var(--clay); font-weight: 400; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--ink); color: #fffdf8; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: .95rem; z-index: 10; max-width: calc(100% - 32px); }
.foot { max-width: 1000px; margin: 0 auto; padding: 0 18px 28px; color: var(--muted); font-size: .85rem; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.45rem; }
  .grid3 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opt-item { grid-template-columns: 1fr auto; }
  .oi-act { grid-column: 1 / -1; }
  .quick-row { flex-direction: column; }
}
