:root {
  --bg: #faf8f4; --card: #fff; --ink: #231f1a; --muted: #6f675d; --line: #e6e0d6;
  --accent: #2f6f4f; --accent-ink: #fff; --warn: #b4571a; --bad: #b3261e; --soft: #eef5f0;
  --radius: 12px; --shadow: 0 1px 2px rgba(35,31,26,.06), 0 4px 14px rgba(35,31,26,.05);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); }
h1 { font-size: 1.9rem; margin: .2rem 0 .3rem; letter-spacing: -.01em; }
h1 small { font-size: .95rem; color: var(--muted); font-weight: 400; margin-left: .4rem; }
h2 { font-size: 1.15rem; margin: 0 0 .7rem; }
h2 small { font-weight: 400; color: var(--muted); float: right; }
h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.sect { margin: 1.6rem 0 .6rem; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; gap: 1.4rem; height: 58px; }
.brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 5px 3px 0 -2px #e0a43a; }
nav { display: flex; gap: .3rem; flex: 1; }
nav a { text-decoration: none; color: var(--muted); padding: .35rem .75rem; border-radius: 8px; font-weight: 500; }
nav a:hover { background: var(--soft); }
nav a.on { color: var(--accent); background: var(--soft); }
.units { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: auto; }
.units a { padding: .25rem .7rem; text-decoration: none; color: var(--muted); font-size: .85rem; }
.units a.on { background: var(--accent); color: var(--accent-ink); }
main { padding-top: 1.4rem; padding-bottom: 2rem; }
.foot { color: var(--muted); font-size: .8rem; padding-bottom: 2rem; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.back { font-size: .85rem; text-decoration: none; }
.meta, .muted { color: var(--muted); }
.small { font-size: .85rem; }
.lede { font-size: 1.05rem; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 1rem; }
.grid .card { margin: 0; }
.recipe { text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; display: block; }
.recipe:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(35,31,26,.1); }
.recipe p { margin: .25rem 0; }
.macros b { font-size: 1.25rem; }
.macros span { color: var(--muted); font-size: .85rem; margin-left: .5rem; }
.tag { display: inline-block; font-size: .72rem; padding: .08rem .5rem; border-radius: 99px; background: #f1ece3; color: var(--muted); margin: 0 .25rem .2rem 0; }
.tag.diet { background: var(--soft); color: var(--accent); }
.btn { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); padding: .5rem 1rem; border-radius: 9px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: .25rem .65rem; font-size: .85rem; }
.linkbtn { background: none; border: 0; color: var(--bad); cursor: pointer; font: inherit; font-size: .85rem; padding: 0; }
input, select, textarea { font: inherit; padding: .42rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ac5ae; border-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters input[type=search] { flex: 1 1 220px; }
.filters input[type=number] { width: 8.5rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem 1rem; margin-bottom: .8rem; }
.fields label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: .2rem; }
.fields input { width: 100%; }
fieldset.diets { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 .8rem; }
legend { font-size: .8rem; color: var(--muted); padding: 0 .3rem; }
.chk { margin-right: 1rem; font-size: .9rem; }
.actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }
.cols { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; align-items: start; }
.cols .card { margin-bottom: 1rem; }
.scale-controls { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: .5rem; }
.scale-controls input[type=number] { width: 5rem; }
.by-ing { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.ingredients { list-style: none; padding: 0; margin: .5rem 0; }
.ingredients li { padding: .38rem 0; border-bottom: 1px dashed var(--line); }
.warnings { color: var(--warn); font-size: .88rem; padding-left: 1.1rem; }
.steps li { margin-bottom: .6rem; }
.nutrition { border: 2px solid var(--ink); box-shadow: none; font-family: "Helvetica Neue", Arial, sans-serif; }
.nutrition h2 { font-size: 1.7rem; font-weight: 900; margin: 0; border-bottom: 1px solid var(--ink); }
.nutrition .cal { display: flex; justify-content: space-between; align-items: baseline; border-top: 8px solid var(--ink); border-bottom: 4px solid var(--ink); padding: .2rem 0; }
.nutrition .cal span { font-weight: 800; font-size: 1.1rem; }
.nutrition .cal b { font-size: 2.2rem; line-height: 1; }
.nutrition table { width: 100%; border-collapse: collapse; }
.nutrition td { padding: .22rem 0; border-top: 1px solid var(--ink); font-size: .92rem; }
.nutrition td:last-child { text-align: right; font-weight: 700; }
.nutrition tr.bold td:first-child { font-weight: 700; }
.nutrition tr.i1 td:first-child { padding-left: 1.2rem; }
.nutrition tr.dvh td { border-top: 0; font-size: .75rem; font-weight: 700; text-align: right; }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; background: var(--soft); border: 1px solid #cfe3d6; }
.flash.error { background: #fdecea; border-color: #f4c3be; color: var(--bad); }
.flash.warning { background: #fff4e5; border-color: #f1d3a8; color: #7a4310; }
.flash ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.table-scroll { overflow-x: auto; }
table.week { border-collapse: separate; border-spacing: 6px; width: 100%; min-width: 980px; }
table.week th { font-size: .8rem; text-align: left; color: var(--muted); }
table.week th small { display: block; font-weight: 400; }
table.week th.slot { width: 80px; vertical-align: middle; }
table.week td { vertical-align: top; background: #fbfaf7; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; width: 13%; }
.cell { display: flex; flex-direction: column; gap: .15rem; font-size: .88rem; }
.cell a { font-weight: 600; text-decoration: none; line-height: 1.25; }
.cell.left { opacity: .88; }
.lock { font-size: .75rem; color: var(--muted); }
td.tot { background: transparent !important; border-style: dashed !important; font-size: .82rem; }
td.tot.ok b { color: var(--accent); }
td.tot.off b { color: var(--warn); }
.row-actions { display: flex; gap: .5rem; }
.summary { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; color: var(--muted); }
.summary b { color: var(--ink); }
.shop { width: 100%; border-collapse: collapse; }
.shop td { padding: .4rem .3rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.shop tr:last-child td { border-bottom: 0; }
.shop .price { text-align: right; white-space: nowrap; color: var(--muted); }
.shop .buy { font-weight: 600; white-space: nowrap; }
.shop tr.covered b { text-decoration: line-through; color: var(--muted); }
.shop tr.soon td:first-child { box-shadow: inset 3px 0 var(--warn); }
.shop tr.expired { opacity: .6; }
.sq { display: inline-block; width: 14px; height: 14px; border: 1.5px solid var(--muted); border-radius: 3px; }
.pill { font-size: .75rem; padding: .08rem .5rem; border-radius: 99px; background: #eee; }
.pill.warn { background: #fde9cf; color: #7a4310; }
.pill.bad { background: #fbdcd9; color: var(--bad); }
.inline-form { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.inline-form input[name=name] { flex: 1 1 140px; }
.rank { list-style: none; padding: 0; margin: 0; }
.rank li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.bar { }
.rank .bar { height: 5px; background: #eee; border-radius: 3px; margin-bottom: .3rem; overflow: hidden; display: block; }
.rank .bar span { display: block; height: 100%; background: var(--accent); }
.share { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.share input { flex: 1 1 300px; }
table.parsed { border-collapse: collapse; width: 100%; font-size: .85rem; }
table.parsed td, table.parsed th { padding: .25rem; text-align: left; }
table.parsed input.wide { width: 260px; }
table.parsed input.num { width: 4rem; }
table.parsed input { width: 100%; min-width: 6rem; }
input.bad { border-color: var(--bad); background: #fff6f5; }
.badtext { color: var(--bad); }
.or { text-align: center; color: var(--muted); }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } .bar { flex-wrap: wrap; height: auto; padding: .5rem 0; } }
@media print {
  .topbar, .noprint, .foot, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .sq { border-color: #000; }
}
table.shop.fixed { table-layout: fixed; }
.shop.fixed td.box { width: 28px; }
.shop.fixed td:nth-child(2) { width: 28%; }
.shop.fixed td:nth-child(4) { width: 22%; }
.shop.fixed td.price { width: 80px; }
@media (max-width: 700px) { table.shop.fixed { table-layout: auto; } }
