:root {
  --bg: #f8f6f1;
  --surface: #ffffff;
  --ink: #1e1d1a;
  --muted: #5a5750;
  --line: #ddd8cc;
  --accent: #9c3b22;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7e1;
  --warn: #8a4b00;
  --warn-soft: #fbf1dc;
  --bad: #b3261e;
  --focus: #1a5fd0;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1f1d1a;
    --ink: #eeebe4;
    --muted: #aca79c;
    --line: #3a3630;
    --accent: #f0a088;
    --accent-ink: #1d0f0a;
    --accent-soft: #3a231c;
    --warn: #f3c37a;
    --warn-soft: #2f2817;
    --bad: #ffb4ab;
    --focus: #8ab4ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px 14px; flex-wrap: wrap; font-size: 14px; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav a:hover { color: var(--accent); }

.hero { padding: 24px 0 8px; }
h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em; }
.lede { color: var(--muted); margin: 0; max-width: 760px; }

#tool { display: grid; gap: 20px; padding: 16px 0 32px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel h2 { font-size: 20px; margin: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.note { font-size: 14px; color: var(--muted); margin: 0 0 12px; max-width: 820px; }
.fine { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.help { margin: 0; font-size: 13px; color: var(--muted); }
.status:empty { display: none; }
.status { margin: 10px 0 0; padding: 8px 12px; background: var(--accent-soft); border-radius: 8px; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.wide { grid-column: span 2; }
@media (max-width: 420px) { .field.wide { grid-column: auto; } }
.field label, .settings label { font-size: 14px; font-weight: 600; }
input, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible { border-color: var(--focus); }
#recipe-select { width: auto; max-width: 100%; font-weight: 600; }
#currency { width: 64px; }

.btn {
  font: inherit; font-size: 15px; font-weight: 600; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; cursor: pointer; display: inline-block;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { border-color: var(--line); color: var(--muted); }
.btn.file { position: relative; }
.btn.file input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.btn.file:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.linkish { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; text-align: left; }
.icon { font: inherit; font-size: 20px; line-height: 1; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon:hover { color: var(--bad); border-color: var(--bad); }

.lines { display: grid; gap: 8px; margin-bottom: 10px; }
.line { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.line-head { font-size: 13px; font-weight: 600; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.l-cost { font-weight: 600; }
.bad { color: var(--bad); font-size: 13px; font-weight: 600; }
@media (max-width: 700px) {
  .line-head { display: none; }
  .line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(52px, auto); gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
  .line > span:first-child { grid-column: 1 / 4; }
  .line > .icon { grid-column: 4; grid-row: 1; justify-self: end; }
  .line > .l-cost { grid-column: 4; grid-row: 2; white-space: nowrap; }
  .line input, .line select { padding: 7px 6px; }
}

.results { margin-top: 16px; padding: 14px 16px; background: var(--accent-soft); border-radius: var(--radius); }
.results dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 20px; }
.results dt { font-size: 14px; color: var(--muted); }
.results dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.results .big dd { font-size: 24px; }
.warn { margin: 10px 0 0; padding-left: 18px; color: var(--warn); font-size: 14px; }
.warn:empty { display: none; }

.ings { display: grid; gap: 10px; }
.ing { display: grid; grid-template-columns: minmax(0, 2fr) repeat(6, minmax(0, 1fr)); gap: 8px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.ing .field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.ing-foot { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; font-size: 13px; color: var(--muted); }
.ing-foot .icon { margin-left: auto; }
.ing-unit-price { font-weight: 600; color: var(--ink); }
@media (max-width: 900px) { .ing { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ing > .field:first-child { grid-column: 1 / -1; } }
@media (max-width: 420px) { .ing { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 13px; color: var(--muted); }
tbody th { font-weight: 600; }
tr.current { background: var(--accent-soft); }
.settings .row label { margin-right: 4px; }

.content { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; padding-bottom: 40px; }
@media (max-width: 860px) { .content { grid-template-columns: minmax(0, 1fr); } }
.prose { max-width: 760px; }
.prose h2 { font-size: 22px; margin: 28px 0 8px; }
.prose h2:first-child { margin-top: 0; }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { margin: 8px 0 0; }
.conv { font-size: 14px; }

.pro { background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 18px; position: sticky; top: 12px; }
@media (max-width: 860px) { .pro { position: static; } }
.pro h2 { font-size: 19px; margin: 0 0 6px; }
.pro p { margin: 0 0 10px; font-size: 15px; }
.pro ul { margin: 0 0 12px; padding-left: 18px; font-size: 15px; }
.pro form { display: grid; gap: 10px; }
.pro label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 4px; }
.pro .fine { margin: 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.form-msg { color: var(--bad); font-size: 14px; margin: 0; }
.form-msg:empty { display: none; }
.thanks { font-weight: 600; color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 0; margin: 12px 0 0; list-style: none; }
.cards a { display: block; height: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; color: var(--accent); }
.cards span { font-size: 14px; color: var(--muted); }

.site-foot { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 14px; color: var(--muted); }
.site-foot p { margin: 0 0 6px; }
