:root {
  --bg: #f2f5f1; --surface: #ffffff; --ink: #1b2430; --muted: #4a5663; --line: #cfd7cd; --grid: #e4e9e2;
  --pine: #14532d; --pine-2: #1d6b3c; --berry: #9f1239; --oven: #c2410c; --oven-bg: #ffedd5; --oven-ink: #7c2d12;
  --stove: #075985; --stove-bg: #e0f2fe; --ok: #166534; --ok-bg: #dcfce7; --bad: #991b1b; --bad-bg: #fee2e2; --warn-bg: #fef3c7;
  --day: #0369a1; --focus: #f59e0b; --nav-h: 62px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.5rem; } h3 { font-size: 1.15rem; margin-top: 1.4rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.loading { padding: 2rem; text-align: center; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons & fields */
.btn { font: inherit; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: 8px; border: 2px solid var(--pine); background: #fff; color: var(--pine); cursor: pointer; }
.btn:hover:not(:disabled) { background: #e8f3ea; }
.btn.primary { background: var(--pine); color: #fff; } .btn.primary:hover:not(:disabled) { background: var(--pine-2); }
.btn.danger { border-color: var(--bad); color: var(--bad); } .btn.danger:hover:not(:disabled) { background: var(--bad-bg); }
.btn.light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); } .btn.light:hover:not(:disabled) { background: rgba(255, 255, 255, .15); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: .95rem; }
.btn.tiny { min-height: 28px; min-width: 28px; padding: 0 6px; font-size: .78rem; border-width: 1px; }
.btn.big { display: block; width: 100%; margin: .6rem 0; min-height: 56px; font-size: 1.15rem; }
.btn:disabled { opacity: .45; cursor: default; }
input, select, textarea { font: inherit; color: inherit; background: #fff; border: 2px solid #8a968a; border-radius: 8px; padding: 8px 10px; min-height: 44px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
input.bad { border-color: var(--bad); background: var(--bad-bg); }
.field { display: flex; flex-direction: column; gap: 4px; margin: .7rem 0; }
.field .fl { font-weight: 600; }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0; }
.err { color: var(--bad); font-weight: 600; min-height: 1.2em; margin: .4rem 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input { width: 24px; height: 24px; min-height: 0; }

/* header, status, tabs */
.top { background: var(--pine); color: #fff; padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; }
.top h1 { font-size: 1.25rem; margin: 0; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status { font-size: .85rem; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.status.ok { background: var(--ok-bg); color: var(--ok); } .status.busy { background: var(--warn-bg); color: #78350f; }
.status.warn { background: var(--warn-bg); color: #78350f; } .status.bad { background: var(--bad-bg); color: var(--bad); }
.banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--warn-bg); border-bottom: 2px solid #d97706; padding: 8px 14px; }
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; background: #e3eae1; border-bottom: 2px solid var(--pine); overflow-x: auto; position: sticky; top: 0; z-index: 40; }
.tab { font: inherit; font-weight: 700; padding: 10px 16px; min-height: 44px; border: 2px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--pine); cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--surface); border-color: var(--pine); color: #000; position: relative; top: 2px; }
main { padding: 14px; max-width: 1400px; margin: 0 auto; }
.view h2 { margin-top: .2rem; }
.lead { color: var(--muted); margin-top: 0; }
.empty { color: var(--muted); font-style: italic; padding: 1rem; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.grp { display: flex; align-items: center; gap: 6px; }
.zl { font-weight: 600; }
.oven-note { padding: 8px 12px; border-radius: 8px; margin-bottom: 8px; font-weight: 600; }
.oven-note.ok { background: var(--ok-bg); color: var(--ok); } .oven-note.bad { background: var(--bad-bg); color: var(--bad); border: 2px solid var(--bad); }

/* Gantt */
.gantt-scroll { overflow: auto; max-height: calc(100vh - 290px); min-height: 280px; background: #fff; border: 2px solid var(--line); border-radius: 8px; -webkit-overflow-scrolling: touch; position: relative; }
.gantt { position: relative; }
.g-row { display: flex; height: 46px; border-bottom: 1px solid var(--line); }
.g-row.dish { height: 62px; background: #eef3ec; }
.g-head { position: sticky; top: 0; z-index: 7; height: 46px; background: #f7f9f6; border-bottom: 2px solid var(--line); }
.g-label { position: sticky; left: 0; z-index: 5; flex: 0 0 var(--labw); width: var(--labw); background: #fff; border-right: 2px solid var(--line); padding: 4px 8px; overflow: hidden; font-size: .82rem; line-height: 1.2; display: flex; align-items: center; }
.g-head .g-label { z-index: 9; background: #f7f9f6; font-weight: 700; }
.g-row.dish .g-label { background: #eef3ec; flex-direction: column; align-items: stretch; justify-content: center; gap: 2px; padding: 3px 6px; }
.oven-row { background: #fffaf3; } .oven-row .g-label { background: #fffaf3; flex-direction: column; align-items: flex-start; justify-content: center; }
.oven-row .g-label small { color: var(--muted); }
.task-label { cursor: pointer; } .task-label span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish-name { font: inherit; font-weight: 800; font-size: .88rem; background: none; border: 0; padding: 0; text-align: left; color: var(--ink); cursor: pointer; min-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini { display: flex; gap: 4px; }
.g-track { position: relative; flex: 0 0 auto; background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px); }
.shade { position: absolute; top: 0; bottom: 0; background: rgba(3, 105, 161, .07); pointer-events: none; }
.midnight { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--day); opacity: .55; pointer-events: none; }
.serve-line { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: var(--berry); z-index: 2; pointer-events: none; }
.tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); padding: 3px 0 0 4px; font-size: .78rem; color: var(--muted); white-space: nowrap; display: flex; flex-direction: column; }
.tick.day { border-left: 2px solid var(--day); color: #0c4a6e; font-weight: 700; }
.tick small { font-size: .72rem; }
.dayflag { position: absolute; bottom: 2px; font-size: .72rem; color: #0c4a6e; font-weight: 700; }
.serve-flag { position: absolute; bottom: 0; transform: translateX(-100%); background: var(--berry); color: #fff; font-size: .75rem; font-weight: 700; padding: 1px 6px; border-radius: 4px 0 0 0; white-space: nowrap; z-index: 3; }
.bar { position: absolute; top: 4px; height: 38px; border: 2px solid transparent; border-radius: 7px; color: #fff; font-size: .85rem; font-weight: 700; display: flex; align-items: center; padding: 0 12px; overflow: visible; white-space: nowrap; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; z-index: 3; }
.bar .bt { overflow: hidden; text-overflow: ellipsis; pointer-events: none; max-width: 100%; }
.bar.k-oven { border-bottom: 5px solid #fdba74; } .bar.k-stove { border-bottom: 5px solid #7dd3fc; }
.bar.k-rest { border-style: dashed; font-weight: 600; }
.bar.dragging { cursor: grabbing; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); z-index: 6; }
.bar .h { position: absolute; top: 0; bottom: 0; width: 20px; cursor: ew-resize; }
.bar .hl { left: 0; } .bar .hr { right: 0; }
.bar .h::after { content: ""; position: absolute; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: currentColor; opacity: .55; }
.bar .hl::after { left: 4px; } .bar .hr::after { right: 4px; }
.bar.narrow { padding: 0 6px; } .bar.narrow .h { display: none; }
.span-bar { position: absolute; top: 14px; height: 34px; border-radius: 6px; color: #fff; font-size: .75rem; font-weight: 700; padding: 0 8px; line-height: 34px; overflow: hidden; white-space: nowrap; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; opacity: .9; z-index: 3; }
.span-bar.dragging { cursor: grabbing; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); z-index: 6; }
.oven-block { position: absolute; top: 7px; height: 28px; background: var(--oven-bg); border: 2px solid var(--oven); color: var(--oven-ink); font-weight: 800; font-size: .8rem; border-radius: 6px; padding: 0 6px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; z-index: 3; }
.conflict { position: absolute; top: 0; bottom: 0; z-index: 4; pointer-events: none; background: repeating-linear-gradient(45deg, rgba(185, 28, 28, .55) 0 6px, rgba(185, 28, 28, .2) 6px 12px); }
.dragtip { position: fixed; z-index: 1000; background: #111827; color: #fff; padding: 6px 10px; border-radius: 6px; font-size: .9rem; font-weight: 600; pointer-events: none; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .88rem; color: var(--muted); margin: .6rem 0; }
.lg::before { content: ""; display: inline-block; width: 22px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 3px; background: #475569; }
.lg.oven::before { border-bottom: 4px solid #fdba74; height: 14px; } .lg.stove::before { border-bottom: 4px solid #7dd3fc; height: 14px; }
.lg.rest::before { background: #47556926; border: 2px dashed #475569; } .lg.lg-serve::before { width: 3px; background: var(--berry); height: 16px; }

/* run sheet */
.day-h { margin-top: 1.4rem; padding-bottom: 4px; border-bottom: 3px solid var(--pine); color: var(--pine); }
.rs-row { display: grid; grid-template-columns: 32px 8.5em 1fr auto; gap: 12px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; cursor: pointer; }
.rs-row input { width: 26px; height: 26px; min-height: 0; }
.rs-time b { display: block; font-size: 1.25rem; } .rs-time span { color: var(--muted); font-size: .9rem; }
.rs-label { display: block; font-size: 1.15rem; font-weight: 700; }
.rs-sub { color: var(--muted); font-size: .92rem; }
.rs-row.done { opacity: .5; } .rs-row.done .rs-label { text-decoration: line-through; }
.dishchip { display: inline-block; color: #fff; font-weight: 700; font-size: .8rem; padding: 1px 9px; border-radius: 99px; }
.chip { text-align: center; border-radius: 8px; padding: 4px 12px; line-height: 1.1; }
.chip.oven { background: var(--oven); color: #fff; } .chip.oven small { display: block; font-size: .7rem; letter-spacing: .06em; } .chip.oven b { font-size: 1.5rem; }
.chip.stove { background: var(--stove-bg); color: var(--stove); font-weight: 800; font-size: .85rem; border: 2px solid var(--stove); }

/* recipes */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.chip-btn { font: inherit; font-weight: 600; min-height: 40px; padding: 0 12px; border: 2px solid var(--line); background: #fff; border-radius: 99px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.chip-btn.sel { border-color: var(--pine); background: #e8f3ea; }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; background: #888; flex: none; }
.recipe { background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 16px; max-width: 900px; }
.rh { padding-left: 12px; margin-bottom: 12px; } .rh h2 { margin: 0; font-size: 1.8rem; } .sub { margin: 2px 0 0; color: var(--muted); }
.keyfacts { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.kf { background: var(--oven-bg); border: 3px solid var(--oven); border-radius: 10px; padding: 8px 16px; min-width: 150px; }
.kf-label { font-size: .75rem; font-weight: 800; letter-spacing: .08em; color: var(--oven-ink); }
.kf-temp { font-size: 2.4rem; font-weight: 900; line-height: 1; color: var(--oven); }
.kf-dur { font-size: 1.5rem; font-weight: 800; color: var(--oven-ink); }
.kf-what { font-size: .85rem; color: var(--oven-ink); }
.tbl-wrap { overflow-x: auto; }
.timing { border-collapse: collapse; width: 100%; }
.timing th, .timing td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.timing th { background: #eef3ec; font-size: .9rem; }
.timing .len { font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.timing .big-temp { font-size: 1.3rem; color: var(--oven); }
.timing tr.k-oven { background: #fff7ed; }
.ings, .shop { list-style: none; padding: 0; margin: 0; }
.ings li { padding: 7px 0; border-bottom: 1px dotted var(--line); font-size: 1.08rem; }
.ings .q { font-weight: 800; display: inline-block; min-width: 4.6em; }
.ings .nt { color: var(--muted); }
.steps { padding-left: 1.5rem; } .steps li { margin: .7rem 0; font-size: 1.08rem; max-width: 70ch; }
.notes { background: var(--warn-bg); border-left: 5px solid #d97706; padding: 10px 14px; border-radius: 6px; margin-top: 1rem; max-width: 70ch; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 1rem 0 .2rem; }
.ing-row { display: grid; grid-template-columns: 64px 74px minmax(120px, 1.4fr) minmax(120px, 1.4fr) 32px; gap: 6px; margin: 6px 0; align-items: center; }
.ing-row input { width: 100%; min-width: 0; }
.step-row { display: grid; grid-template-columns: 24px 1fr auto; gap: 8px; margin: 8px 0; align-items: start; }
.step-row .mini { flex-direction: column; }
.sn { font-weight: 800; padding-top: 10px; }
.task-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); cursor: pointer; }
.sw.sel { box-shadow: 0 0 0 3px var(--ink); }

/* shopping */
.shop li { background: #fff; border: 2px solid var(--line); border-radius: 10px; margin: 6px 0; }
.shop li label { display: grid; grid-template-columns: 30px 7em 1fr; gap: 10px; align-items: center; padding: 10px 12px; cursor: pointer; }
.shop li input { width: 26px; height: 26px; min-height: 0; }
.shop .q { font-weight: 800; } .shop .it { font-size: 1.08rem; }
.shop .for { grid-column: 3; color: var(--muted); margin-top: -8px; }
.shop li.done { opacity: .5; } .shop li.done .it { text-decoration: line-through; }

/* settings, dialogs, login */
.card { background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 12px 16px 16px; margin: 14px 0; max-width: 640px; }
.card h3 { margin-top: .3rem; }
.dlg { border: 3px solid var(--pine); border-radius: 12px; padding: 18px; width: min(560px, calc(100vw - 20px)); max-height: calc(100vh - 20px); overflow: auto; color: var(--ink); }
.dlg::backdrop { background: rgba(10, 25, 15, .55); }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.dlg-sum { font-weight: 700; color: var(--pine); min-height: 1.4em; }
.nudge { display: flex; gap: 8px; flex-wrap: wrap; margin: -2px 0 6px; }
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.lib-item { font: inherit; text-align: left; display: grid; grid-template-columns: 14px 1fr; gap: 2px 8px; align-items: center; padding: 8px 10px; background: #fff; border: 2px solid var(--line); border-radius: 8px; cursor: pointer; min-height: 52px; }
.lib-item:hover { border-color: var(--pine); } .lib-item small { grid-column: 2; color: var(--muted); }
.login { max-width: 420px; margin: 8vh auto; padding: 20px; background: #fff; border: 2px solid var(--line); border-radius: 12px; }
.login input { width: 100%; margin: 8px 0 12px; font-size: 1.3rem; letter-spacing: .1em; text-align: center; }
.login .btn { width: 100%; }
.toast { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; max-width: calc(100vw - 24px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 2000; font-weight: 600; }
.toast.show { opacity: 1; } .toast.error { background: var(--bad); }

/* phones */
@media (max-width: 699px) {
  body { font-size: 16px; }
  main { padding: 10px; }
  .tabs { padding: 6px 4px; background: #e3eae1; justify-content: space-between; overflow: hidden; border-bottom: 2px solid var(--pine); }
  .tab { flex: 1; padding: 6px 2px; font-size: .78rem; border-radius: 8px; border: 2px solid transparent; top: 0; text-align: center; min-width: 0; }
  .tab.on { top: 0; background: var(--pine); color: #fff; border-color: var(--pine); }
  .gantt-scroll { max-height: calc(100vh - 340px); min-height: 320px; }
  .rs-row { grid-template-columns: 30px 1fr auto; } .rs-time { grid-column: 2; } .rs-main { grid-column: 2; } .rs-row .chip { grid-column: 3; grid-row: 1 / span 2; }
  .row2 { grid-template-columns: 1fr; }
  .ing-row { grid-template-columns: 56px 64px 1fr 32px; } .ing-row .note { grid-column: 1 / span 3; }
  .shop li label { grid-template-columns: 30px 1fr; } .shop .q { grid-column: 2; } .shop .it { grid-column: 2; } .shop .for { grid-column: 2; margin-top: 0; }
  .kf-temp { font-size: 2.1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .noprint, .tabs, .top, .toast, .banner { display: none !important; }
  body { background: #fff; font-size: 12pt; padding: 0; }
  .recipe, .card, .rs-row, .shop li { border-color: #999; break-inside: avoid; }
  .gantt-scroll { max-height: none; overflow: visible; }
  main { padding: 0; }
}

/* ---- version 2: touch-friendly sizes and new pieces ---- */
.bar::before { content: ""; position: absolute; left: calc(-4px - var(--ext, 0px)); right: calc(-4px - var(--ext, 0px)); top: -3px; bottom: -3px; }
.g-row.dish .g-label { padding: 0; align-items: stretch; justify-content: stretch; flex-direction: row; }
.dish-name { font: inherit; font-weight: 800; font-size: .9rem; background: none; border: 0; padding: 0 8px; text-align: left; color: var(--ink); cursor: pointer; width: 100%; height: 100%; display: flex; align-items: center; gap: 6px; min-height: 44px; overflow: visible; white-space: normal; }
.dish-name:hover { background: rgba(20, 83, 45, .08); }
.dish-name .dn { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.15; }
.menu-list { display: flex; flex-direction: column; gap: 10px; }
.btn.menu { width: 100%; text-align: left; min-height: 48px; }
.pick-m { display: none; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.pick-m .field { flex: 1; margin: 0; }
.conf { border: 2px solid var(--line); border-radius: 8px; margin: 10px 0; padding: 6px 12px 10px; }
.conf legend { font-weight: 700; padding: 0 6px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 4px; min-height: 44px; cursor: pointer; }
.opt input { width: 24px; height: 24px; min-height: 0; flex: none; margin-top: 2px; }
.bk-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bk-row small { display: block; color: var(--muted); }
@media (max-width: 699px), (pointer: coarse) {
  .btn { min-width: 44px; }
  .btn.small { min-height: 44px; }
  .btn.tiny { min-height: 44px; min-width: 44px; font-size: .95rem; border-width: 2px; }
  input, select { min-height: 48px; }
  .tab { min-height: 48px; }
  .dish-name { min-height: 48px; }
  .bar .h { width: 26px; }
  .sw { width: 44px; height: 44px; }
  .legend { font-size: .95rem; }
}
@media (max-width: 699px) {
  .chips-d { display: none; }
  .pick-m { display: flex; }
  .g-row.dish .g-label { font-size: .85rem; }
}

.howto { margin: 4px 0 10px; } .howto summary { cursor: pointer; font-weight: 700; color: var(--pine); min-height: 44px; display: flex; align-items: center; }

/* ---- version 3: iPhone/iPad Safari and notch-friendly touches ---- */
.gantt-scroll { max-height: calc(100dvh - 290px); }
.top { padding-top: calc(10px + env(safe-area-inset-top)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
main { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.bar, .span-bar { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.dlg.nomodal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 3000; background: #fff; box-shadow: 0 0 0 100vmax rgba(10, 25, 15, .55); }
@media (max-width: 699px) {
  .gantt-scroll { max-height: calc(100dvh - 340px); }
  input, select, textarea { font-size: 16px; } /* 16px or more stops iOS Safari zooming in when a field is tapped */
}

/* ---- version 4: Menu tab, printable-menu preview, combined shopping lines ---- */
.course-h { margin: 1.3rem 0 .3rem; color: var(--pine); border-bottom: 2px solid var(--pine); padding-bottom: 2px; }
.count { font-weight: 700; margin-right: auto; }
.mn-row { background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 6px 12px; margin: 8px 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.mn-row.off { background: #f1f2ef; }
.mn-row.off .mn-name { color: var(--muted); } .mn-row.off .mn-blurb { opacity: .8; }
.mn-main { display: flex; gap: 12px; align-items: center; min-height: 52px; cursor: pointer; }
.mn-main > input { width: 30px; height: 30px; min-height: 0; flex: none; }
.mn-text { display: flex; flex-direction: column; min-width: 0; }
.mn-name { font-size: 1.1rem; }
.mn-blurb { color: var(--muted); } .mn-facts { color: var(--oven-ink); font-weight: 700; }
.mn-tools { display: flex; gap: 6px; }
.mn-more { grid-column: 1 / -1; }
.mn-more summary, .shop details.src summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--pine); font-weight: 700; }
.lib-rows { display: flex; flex-direction: column; }
.lib-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lib-row .mn-text { flex: 1; } .lib-row small { color: var(--muted); }
/* paste a recipe */
.paste-in { min-height: 10rem; }
.paste-preview h3 { margin: .8rem 0 .3rem; font-size: 1rem; }
.paste-sum { font-weight: 600; margin: .6rem 0 .3rem; }
.paste-warn { background: var(--warn-bg); color: #78350f; border-left: 5px solid #d97706; border-radius: 6px; padding: 6px 10px 6px 28px; margin: .4rem 0; }
.paste-list { margin: 0; padding-left: 1.4rem; max-height: 14rem; overflow-y: auto; }
.paste-list li { margin: .15rem 0; overflow-wrap: anywhere; } .paste-list small { color: var(--muted); }
/* make ahead */
.ahead-box { border: 2px solid var(--line); border-radius: 8px; padding: 6px 12px; margin: .8rem 0; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
.ahead-box.on { border-color: var(--stove); background: var(--stove-bg); }
.ahead-box .hint { flex-basis: 100%; margin: 0 0 .3rem; }
.chip-btn.off { opacity: .65; border-style: dashed; }
.offtag { font-weight: 600; color: var(--muted); }
.notmenu { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--warn-bg); border-left: 5px solid #d97706; padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; }
.menu-card { max-width: 760px; }
.mpreview { margin: 10px 0 16px; padding: 8px; background: #e9ece7; border-radius: 8px; }
.paper { background: #fff; max-width: 520px; margin: 0 auto; padding: 34px 26px 30px; text-align: center; font-family: Georgia, "Times New Roman", Times, serif; color: #1b2430; border: 2px solid var(--pine); outline: 1px solid var(--pine); outline-offset: -8px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.empty-paper { color: var(--muted); font-style: italic; font-family: inherit; padding: 30px 20px; }
.p-title { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 1.45rem; line-height: 1.25; overflow-wrap: anywhere; }
.p-orn { position: relative; height: 14px; width: 190px; margin: 12px auto; background: linear-gradient(var(--pine), var(--pine)) left center / 80px 1px no-repeat, linear-gradient(var(--pine), var(--pine)) right center / 80px 1px no-repeat; }
.p-orn::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; background: var(--pine); transform: translate(-50%, -50%) rotate(45deg); }
.p-sub { font-style: italic; color: var(--muted); }
.p-serve { font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: .74rem; color: var(--pine); margin-top: 4px; }
.p-course { margin-top: 22px; }
.p-clabel { font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: .74rem; color: var(--pine); padding-bottom: 5px; position: relative; margin-bottom: 8px; }
.p-clabel::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 36px; margin-left: -18px; border-bottom: 1px solid var(--pine); }
.p-dish { margin: 9px 0; } .p-dname { font-size: 1.12rem; } .p-blurb { font-style: italic; color: var(--muted); font-size: .86rem; }
.p-foot { margin-top: 26px; font-style: italic; color: var(--muted); font-size: .8rem; }
.shop li > .for, .shop li > .sim, .shop li > details { display: block; margin: 0 12px 8px 52px; }
.shop li > .sim { color: #7c2d12; background: var(--warn-bg); padding: 4px 8px; border-radius: 6px; }
.shop details.src ul { margin: 0 0 6px; padding-left: 1.2rem; list-style: disc; }
.shop details.src li { border: 0; margin: 2px 0; background: none; }
.shop li.merged { border-color: #86b894; }
@media (max-width: 699px) {
  .tab { font-size: .72rem; padding: 6px 1px; }
  .mn-row { grid-template-columns: 1fr; }
  .mn-tools { justify-content: flex-end; }
  .shop li > .for, .shop li > .sim, .shop li > details { margin-left: 44px; }
  .paper { padding: 26px 16px 24px; }
  .p-title { font-size: 1.25rem; }
}
@media print {
  .menu-view > .toolbar, .menu-view > .lead, .menu-view > .mn-row, .menu-view > .course-h, .menu-card > h3, .menu-card > .lead { display: none !important; }
  .mpreview { background: none; padding: 0; } .paper { box-shadow: none; max-width: none; }
}

input[type=checkbox], input[type=radio] { accent-color: var(--pine); }
.shop li label { grid-template-columns: 30px 10em 1fr; }
@media (max-width: 699px) { .shop li label { grid-template-columns: 30px 1fr; } }

@media (max-width: 699px) { .tab { white-space: normal; line-height: 1.1; display: flex; align-items: center; justify-content: center; text-align: center; overflow-wrap: anywhere; } }

@media (max-width: 699px) {
  .tabs { gap: 2px; padding-left: 4px; padding-right: 4px; }
  .tab { flex: 1 1 0; width: 0; min-width: 0; overflow-wrap: normal; word-break: normal; padding-left: 0; padding-right: 0; }
}

/* ---- version 5: nutrition ---- */
.nutri { margin-top: 1rem; } .nutri-serv { margin: .2rem 0 .6rem; }
.nutri-wrap { overflow-x: auto; }
.nutri-table { border-collapse: collapse; width: 100%; min-width: 520px; font-variant-numeric: tabular-nums; }
.nutri-table th, .nutri-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.nutri-table thead th { background: #eef3ec; font-size: .85rem; white-space: nowrap; }
.nutri-table .num { text-align: right; white-space: nowrap; } .nutri-table td.sub { color: var(--muted); font-style: italic; white-space: nowrap; }
.nutri-table tbody th { font-weight: 600; } .nutri-table tr.strong th, .nutri-table tr.strong td { font-weight: 800; background: #f5f8f4; border-top: 2px solid var(--pine); }
.nutri-table tr.bad { background: var(--bad-bg); }
.nutri-table.breakdown { min-width: 640px; }
.nutri-warn { background: var(--warn-bg); border-left: 5px solid #d97706; padding: 8px 12px; border-radius: 6px; margin: 10px 0; }
.nutri-detail { margin-top: 10px; } .nutri-detail summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; color: var(--pine); }
.nutri-card { max-width: 860px; }
.ing-row { grid-template-columns: 64px 74px minmax(110px, 1.4fr) minmax(110px, 1.3fr) auto 32px; }
@media (max-width: 699px) {
  .ing-row { grid-template-columns: 56px 64px 1fr 44px; }
  .ing-row .qty { order: 1; } .ing-row .unit { order: 2; } .ing-row .item { order: 3; } .ing-row .del { order: 4; } .ing-row .note { order: 5; grid-column: 1 / span 3; } .ing-row .lab { order: 6; grid-column: 4; padding: 0 2px; font-size: .8rem; }
}

.sub-m { display: none; }
@media (max-width: 699px) {
  .nutri-table:not(.breakdown) { min-width: 0; font-size: .85rem; }
  .nutri-table:not(.breakdown) th, .nutri-table:not(.breakdown) td { padding: 7px 4px; }
  .nutri-table:not(.breakdown) thead th { font-size: .7rem; white-space: normal; line-height: 1.15; }
  .nutri-table td.sub, .nutri-table th.subh { display: none; }
  .sub-m { display: block; font-weight: 400; font-style: italic; color: var(--muted); font-size: .75rem; }
}

.errcard { border-color: var(--bad); }
pre.cmd { background:#1b2430; color:#f5f5f5; padding:10px 12px; border-radius:8px; overflow-x:auto; white-space:pre-wrap; word-break:break-word; font-size:.9rem; }
.banner.build { background: var(--bad-bg); border-bottom-color: var(--bad); flex-wrap: wrap; }
.banner code { background:#fff; padding:1px 6px; border-radius:4px; font-weight:700; }

/* Clean-up preview (v5.2) */
.bar .pin { font-size: .75rem; margin-right: 4px; pointer-events: none; }
.cu-stats { border-collapse: collapse; margin: 6px 0 10px; }
.cu-stats th, .cu-stats td { text-align: left; padding: 4px 12px 4px 0; }
.cu-stats thead th { color: var(--muted); font-size: .85rem; }
.cu-after { font-weight: 700; }
.cu-after.better { color: var(--pine); }
.cu-after.worse { color: var(--bad); }
.cu-count { font-weight: 700; margin: 10px 0 4px; }
.cu-list { margin: 0 0 10px; padding-left: 20px; max-height: 40vh; overflow-y: auto; }
.cu-list li { margin: 3px 0; }
.cu-move { white-space: nowrap; color: var(--muted); }
.cu-none { font-weight: 700; color: var(--pine); }
.after-list { border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px; margin: -4px 0 10px; max-height: 32vh; overflow-y: auto; }
.after-list .check span { font-size: .92rem; }

/* Store-bought dishes (v5.4) */
.mn-bought { min-height: 44px; padding: 0 6px; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.mn-row.bought .mn-facts { color: var(--pine); }
.p-bought { font-size: .68rem; letter-spacing: .15em; text-transform: uppercase; color: var(--pine); margin: 1px 0; }
.bought-note { margin: 0 0 8px; color: var(--muted); }
.mn-tools { flex-wrap: wrap; align-items: center; }

/* Linked steps (v5.5) */
.bar .link { font-size: .72rem; margin-right: 4px; pointer-events: none; }
.bar.linked { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.bar.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 5px #f59e0b; }
.selbar { position: sticky; left: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fffbeb; border: 2px solid #f59e0b; border-radius: 10px; padding: 6px 10px; margin: 0 0 10px; }
.selbar .sel-n { font-weight: 700; margin-right: 4px; }
.linkbox { margin: 0 0 10px; }
.linkbox summary { font-weight: 700; color: var(--pine); min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.link-dname { font-weight: 700; font-size: .85rem; color: var(--muted); margin-top: 6px; }
