/* Layout: single phone-first column of stations, like a tobacconist's counter card. */
:root {
  --bg: #efe7da; --panel: #fbf7f0; --ink: #2a1c13; --muted: #76604f; --line: #dccbb4;
  --brass: #8a5d16; --brass-ink: #fffaf0; --leaf1: #c98b3c; --leaf2: #7a4a26; --leaf3: #b8a05a; --leaf4: #4f3a2c;
  --ok: #3f6b3a; --warn: #9b3d24;
  --display: "Bodoni Moda", "Didot", Georgia, serif;
  --body: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b130e; --panel: #261b14; --ink: #f1e6d6; --muted: #b39d86; --line: #3d2d22;
    --brass: #d4a24c; --brass-ink: #1b130e; --leaf1: #d79a4a; --leaf2: #a8693c; --leaf3: #c9b36a; --leaf4: #8c7462;
    --ok: #8cbf7f; --warn: #e08a6c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b130e; --panel: #261b14; --ink: #f1e6d6; --muted: #b39d86; --line: #3d2d22;
  --brass: #d4a24c; --brass-ink: #1b130e; --leaf1: #d79a4a; --leaf2: #a8693c; --leaf3: #c9b36a; --leaf4: #8c7462;
  --ok: #8cbf7f; --warn: #e08a6c; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.wrap { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.top h1 { font-family: var(--display); font-weight: 800; font-size: 2.4rem; line-height: 1; margin: 0; letter-spacing: -.01em; }
.top p { margin: 8px 0 0; color: var(--muted); max-width: 46ch; }
.station { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.station h2 { font-family: var(--display); font-weight: 600; font-size: 1.35rem; margin: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.station h2 small, .label { font-family: var(--body); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); font-weight: 600; }
.label { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
button, .btn {
  font: 600 .92rem var(--body); border-radius: 4px; padding: 10px 14px; border: 1px solid var(--brass);
  background: var(--brass); color: var(--brass-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button.ghost, .btn.ghost { background: transparent; color: var(--brass); }
button.small, .btn.small { padding: 6px 10px; font-size: .84rem; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
input[type=text], input[type=password], select, textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 9px 10px; min-width: 0; width: 100%;
}
#addForm input { width: auto; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: 500 .88rem var(--body); max-width: 100%; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.chip.unknown { border-style: dashed; }
.toggle { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-weight: 500; }
.toggle[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.status { font-size: .9rem; color: var(--muted); min-height: 1.2em; }
.status.err { color: var(--warn); }
.blends { display: flex; flex-direction: column; gap: 14px; }
.blend { border: 1px solid var(--line); border-radius: 6px; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); }
.blend h3 { font-family: var(--display); font-weight: 600; font-size: 1.2rem; margin: 0; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tag { font: 600 .66rem var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--ok); border: 1px solid currentColor; border-radius: 3px; padding: 2px 6px; white-space: nowrap; }
.bowl { display: grid; grid-template-columns: repeat(4, 1fr); height: 14px; border-radius: 3px; overflow: hidden; gap: 2px; }
.parts { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.parts li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sw { width: 12px; height: 12px; border-radius: 2px; flex: none; }
.parts .n { flex: 1; min-width: 0; font-weight: 500; }
.parts .f { font-family: var(--mono); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.why, .meta { margin: 0; color: var(--muted); font-size: .92rem; }
.pinch { font-size: .88rem; margin: 0; }
.fix { margin: 0; font-size: .9rem; border-left: 3px solid var(--brass); padding-left: 10px; }
details summary { cursor: pointer; color: var(--brass); font-weight: 600; font-size: .9rem; }
details[open] summary { margin-bottom: 10px; }
.tune { display: flex; flex-direction: column; gap: 10px; }
.jar { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
.jar select { width: auto; }
.verdicts { display: flex; flex-wrap: wrap; gap: 6px; }
.verdicts .toggle { font-size: .84rem; }
.buy { border: 1px dashed var(--line); border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.buy strong { font-weight: 600; }
.notice { border: 1px dashed var(--line); border-radius: 6px; padding: 12px; font-size: .9rem; color: var(--muted); }
footer { color: var(--muted); font-size: .8rem; text-align: center; }
dialog { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); padding: 18px; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h3 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 0 0 6px; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
.leafgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; }
.leafgrid label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .9rem; }
.leafgrid select { width: 72px; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
#printArea { display: none; }
@media (prefers-reduced-motion: no-preference) { .blend { animation: in .3s ease both; } @keyframes in { from { transform: translateY(4px); opacity: .6; } to { transform: none; opacity: 1; } } }

/* Recipe card: phone-sized pages, saved as PDF from the print dialog. */
@media print {
  @page { size: 4.5in 8.5in; margin: .35in; }
  :root { --bg: #fff; --panel: #fff; --ink: #2a1c13; --muted: #5d4a3b; --line: #cdb79a; --brass: #8a5d16; color-scheme: light; }
  body { background: #fff; padding: 0; font-size: 12pt; }
  .wrap, dialog { display: none !important; }
  #printArea { display: block; }
  #printArea h1 { font-family: var(--display); font-size: 22pt; margin: 0 0 4pt; }
  #printArea .sub { color: var(--muted); font-size: 9.5pt; margin: 0 0 12pt; }
  #printArea .blend { break-inside: avoid; border: 1px solid var(--line); margin-bottom: 10pt; padding: 10pt; animation: none; }
  #printArea .parts .f { font-size: 15pt; }
  #printArea .bowl span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printArea .sw { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
