:root {
  --paper: #f6f1e7; --card: #fffdf8; --ink: #1f2430; --muted: #5f6672; --line: #e2d9c8;
  --navy: #23395b; --accent: #e8593c; --ok: #2f7d4f; --warn: #b5541b;
  --oven: #e8593c; --hob: #e9a23b; --hands: #23395b; --wait: #b9c4d3; --rest: #8fb39a;
  --radius: 14px; --shadow: 0 1px 0 rgba(31,36,48,.04), 0 6px 18px rgba(31,36,48,.06);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.serif { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1180px; 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: Georgia, "Iowan Old Style", serif; }
.sub { margin: 0; color: var(--muted); font-size: .92rem; }
.top-actions { display: flex; gap: 8px; }
.count { display: inline-block; min-width: 1.4em; padding: 0 6px; border-radius: 99px; background: var(--navy); color: #fff; font-size: .75rem; text-align: center; margin-left: 4px; }

main { max-width: 1180px; margin: 0 auto; padding: 6px 18px 24px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 980px) { .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; } .col-b { position: sticky; top: 12px; } }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; padding: 10px 14px; border-radius: 12px; background: #fbeee3; color: #6e3612; font-size: .93rem; }
.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--navy); text-decoration: underline; font-weight: 600; }

.titlebar { display: flex; align-items: center; gap: 16px; margin: 10px 0 14px; flex-wrap: wrap; }
.meal-title { flex: 1 1 280px; border: 0; border-bottom: 2px dashed var(--line); background: transparent; font-size: 1.35rem; font-family: Georgia, "Iowan Old Style", serif; padding: 6px 2px; min-width: 0; }
.meal-title:focus { outline: none; border-bottom-color: var(--accent); }
.serve-at { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px 6px 14px; box-shadow: var(--shadow); }
.serve-at label { font-weight: 700; font-size: .95rem; }
.serve-at input { border: 0; background: #fbf6ec; border-radius: 8px; padding: 6px 8px; font-size: 1.15rem; font-weight: 700; color: var(--navy); min-height: 40px; }

.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 16px 18px; margin-bottom: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.step-head h2 { margin: 0; font-size: 1.1rem; }
.step-no { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 700; font-size: .9rem; flex: none; }
.step-aside { margin-left: auto; color: var(--muted); font-size: .86rem; text-align: right; }
.hint { color: var(--muted); font-size: .9rem; margin: 6px 0 10px; }
.empty { color: var(--muted); font-style: italic; margin: 8px 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: 9px 14px; min-height: 42px; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(232,89,60,.35); outline-offset: 2px; }
.primary { background: var(--navy); color: #fff; font-weight: 600; }
.primary:hover { background: #1a2c47; }
.ghost { background: transparent; border-color: var(--line); }
.ghost:hover { background: #f1eadc; }
.sm { min-height: 34px; min-width: 34px; padding: 4px 9px; font-weight: 700; }
.field { margin: 0 0 10px; }
.field label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
input[type="text"], input[type="number"], select, textarea { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fffefb; min-height: 40px; width: 100%; min-width: 0; }
textarea { resize: vertical; line-height: 1.45; }

/* Dishes */
.dishes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dish { border: 1px solid var(--line); border-radius: 12px; background: #fffefb; overflow: hidden; }
.dish > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.dish > summary::-webkit-details-marker { display: none; }
.dish-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dish-name { font-weight: 700; }
.dish-meta { color: var(--muted); font-size: .86rem; margin-left: auto; text-align: right; }
.chev { color: var(--muted); transition: transform .15s; }
.dish[open] .chev { transform: rotate(90deg); }
.dish-body { padding: 4px 12px 12px; border-top: 1px dashed var(--line); }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.dgrid .wide { grid-column: 1 / -1; }
.min { display: flex; align-items: center; gap: 6px; }
.min input { width: 84px; }
.min span { color: var(--muted); font-size: .88rem; }
.srow { display: grid; grid-template-columns: 96px 86px 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.srow .extra { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .88rem; margin: -2px 0 4px; }
.srow .extra input[type="number"] { width: 84px; }
.srow .extra label { display: flex; gap: 6px; align-items: center; }
.stitle { font-weight: 600; font-size: .88rem; margin: 8px 0 6px; }
.dish-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.danger { color: #9c2f18; }
.adders { margin-top: 14px; display: grid; gap: 10px; }
.adder { border: 1px dashed var(--line); border-radius: 12px; padding: 8px 12px; background: #fdf9f1; }
.adder > summary { font-weight: 700; cursor: pointer; padding: 4px 0; }
.shelf-group { margin: 6px 0 10px; }
.shelf-group h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 99px; min-height: 36px; padding: 5px 12px; font-size: .92rem; }
.chip:hover { border-color: var(--navy); }
.chip .plus { color: var(--accent); font-weight: 700; margin-right: 4px; }
.notes p { margin: 8px 0 0; padding: 8px 10px; background: #fbeee3; border-radius: 8px; font-size: .9rem; color: #6e3612; }
.notes p.ok { background: #e6f2ea; color: #1f5636; }
.kgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.kgrid .wide { grid-column: 1 / -1; }

/* Plan */
.headline { font-family: Georgia, "Iowan Old Style", serif; font-size: 1.25rem; margin: 2px 0 10px; line-height: 1.35; }
.headline b { color: var(--accent); }
.warn { margin: 0 0 8px; padding: 9px 12px; border-radius: 10px; background: #fbeee3; color: #6e3612; font-size: .92rem; }
.warn.bad { background: #fde4dd; color: #8a2412; }
.warn button { margin-left: 6px; }
.timeline { margin: 6px 0 14px; padding: 10px 0 2px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tl-row { display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 8px; min-height: 24px; }
.tl-name { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-track { position: relative; height: 16px; background: repeating-linear-gradient(90deg, transparent 0 calc(var(--tick) - 1px), #efe7d8 calc(var(--tick) - 1px) var(--tick)); border-radius: 4px; }
.tl-seg { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; min-width: 3px; }
.tl-seg.prep, .tl-seg.hands { background: var(--hands); }
.tl-seg.oven { background: var(--oven); }
.tl-seg.hob { background: var(--hob); }
.tl-seg.hob.attended { background: repeating-linear-gradient(45deg, var(--hob) 0 5px, #c9821f 5px 10px); }
.tl-seg.wait { background: var(--wait); }
.tl-seg.rest { background: var(--rest); }
.tl-seg.ovenbar { background: #f7c9bd; color: #7a2412; font-size: .68rem; font-weight: 700; line-height: 12px; padding-left: 4px; overflow: hidden; white-space: nowrap; }
.tl-axis { display: grid; grid-template-columns: 118px 1fr; gap: 8px; }
.tl-ticks { position: relative; height: 18px; font-size: .72rem; color: var(--muted); }
.tl-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-ticks span:last-child { transform: translateX(-100%); font-weight: 700; color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .78rem; color: var(--muted); margin: 6px 0 2px; }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps .t { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.steps .h { font-weight: 600; }
.steps .s { color: var(--muted); font-size: .88rem; }
.steps li.ev-serve .t, .steps li.ev-serve .h { color: var(--accent); }
.steps li.ev-oven-heat .h, .steps li.ev-oven-change .h, .steps li.ev-oven-off .h { color: #9c2f18; }
.steps li.past { opacity: .5; }
.toast { min-height: 1.4em; color: var(--ok); font-size: .9rem; margin: 6px 0 0; }
.foot { color: var(--muted); font-size: .84rem; text-align: center; margin-top: 18px; }

dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(31,36,48,.35); }
.dlg { padding: 16px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; font-size: 1.15rem; }
.meal-list { list-style: none; margin: 10px 0 0; padding: 0; }
.meal-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.meal-list .open { flex: 1; text-align: left; background: none; border: 0; padding: 4px 0; }
.meal-list .open small { display: block; color: var(--muted); }

/* Cook mode */
.cook { position: fixed; inset: 0; background: #1c2433; color: #f6f1e7; z-index: 50; overflow-y: auto; }
.cook-in { max-width: 760px; margin: 0 auto; padding: 20px 18px 40px; }
.cook-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cook-clock { font-size: 3rem; font-weight: 700; margin: 0; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cook-serve { margin: 0; color: #c9cfda; }
.cook-btns { display: flex; gap: 8px; }
.cook .ghost { border-color: #46526a; color: #f6f1e7; }
.cook .ghost:hover { background: #2a3447; }
.cook-label { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; color: #ffcf6b; margin: 22px 0 6px; }
.cook-now .card, .cook-next .card { background: #26314a; border-radius: 14px; padding: 14px 16px; margin-bottom: 8px; }
.cook-now .card h3 { margin: 0 0 2px; font-size: 1.45rem; font-family: Georgia, serif; }
.cook-next .card h3 { margin: 0 0 2px; font-size: 1.1rem; }
.cook .card p { margin: 0; color: #c9cfda; }
.cook .card .left { color: #ffcf6b; font-weight: 700; font-variant-numeric: tabular-nums; }
.cook-all { list-style: none; padding: 0; margin: 26px 0 0; border-top: 1px solid #36425a; }
.cook-all li { display: grid; grid-template-columns: 80px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid #2c374d; color: #c9cfda; font-size: .92rem; }
.cook-all li.done { opacity: .4; text-decoration: line-through; }
.cook-all li.now { color: #fff; font-weight: 700; }
.cook .flash { animation: flash 1s ease 3; }
@keyframes flash { 50% { background: #e8593c; } }

@media (max-width: 560px) {
  .dgrid, .kgrid { grid-template-columns: 1fr; }
  .srow { grid-template-columns: 1fr 1fr; }
  .srow .slabel { grid-column: 1 / -1; }
  .tl-row, .tl-axis { grid-template-columns: 84px 1fr; }
  .steps li { grid-template-columns: 70px 1fr; }
  .cook-clock { font-size: 2.3rem; }
}
@media print {
  .top-actions, .adders, #step-kitchen, .plan-actions, .banner, .foot, .dish-body, .toast { display: none !important; }
  body { background: #fff; } .step { box-shadow: none; } .layout { display: block; } .col-b { position: static; }
}
