
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --ink: #0f172a;
  --muted: #5b6576;
  --line: #e5e8ee;
  --line-strong: #cdd3dd;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, #c2410c 12%, #ffffff);
  --link: #c2410c;
  --ok: #16a34a;
  --bad: #b3261e;
  --radius: 10px;
  --radius-s: 8px;
  --shadow: none;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1e23;
    --surface: #22262c;
    --surface-2: #282d34;
    --ink: #e9ecf1;
    --muted: #9ba4b3;
    --line: #333944;
    --line-strong: #474f5c;
    --accent: color-mix(in srgb, #c2410c 72%, #ffffff);
    --accent-ink: #0d1424;
    --accent-soft: color-mix(in srgb, #c2410c 22%, #22262c);
    --link: color-mix(in srgb, #c2410c 60%, #ffffff);
    --ok: #4ade80;
    --bad: #ff7b72;
    --shadow: none;
  }
}
@media screen {
:root[data-theme="dark"] {
  --bg: #1b1e23;
  --surface: #22262c;
  --surface-2: #282d34;
  --ink: #e9ecf1;
  --muted: #9ba4b3;
  --line: #333944;
  --line-strong: #474f5c;
  --accent: color-mix(in srgb, #c2410c 72%, #ffffff);
  --accent-ink: #0d1424;
  --accent-soft: color-mix(in srgb, #c2410c 22%, #22262c);
  --link: color-mix(in srgb, #c2410c 60%, #ffffff);
  --ok: #4ade80;
  --bad: #ff7b72;
  --shadow: none;
}
}

.top { background: var(--bg); padding: 12px 0; }
.brand { font-weight: 650; font-size: 19px; letter-spacing: -.01em; }
.brand svg { width: 24px; height: 24px; }
.top nav a { color: var(--muted); }
.top nav a:hover { color: var(--ink); }
h1, h2, h3 { font-weight: 650; letter-spacing: -.022em; }
h1 { font-size: clamp(30px, 4.2vw, 44px); max-width: 20em; }
.hero { padding: 30px 0 14px; }
.lede { font-size: clamp(16px, 1.7vw, 18px); line-height: 1.5; }
.badge { background: none; padding: 0; margin-top: 10px; color: var(--muted); font-size: 14px; }

.panel { border-color: var(--line); }
.form .field label { font-weight: 600; font-size: 14px; }
.field textarea { background: var(--surface); border-color: var(--line-strong); line-height: 1.6; }
.btn { border-radius: 8px; font-weight: 600; }
.btn.secondary { border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); filter: none; }

.out { background: var(--surface-2); border-color: var(--line); }
.out .status { margin-top: 0; font-size: 14px; color: var(--muted); }
.out .status.is-error { color: var(--bad); }
.out .result { margin-top: 12px; }
.out .mini { border: 0; background: none; padding: 4px 0; min-height: 30px; color: var(--accent); font-weight: 600; }
.out .mini:hover { text-decoration: underline; text-underline-offset: 3px; }

.steps li { border-color: var(--line); background: var(--surface); }
.steps li::before { background: var(--accent-soft); color: var(--accent); }

.form .row { gap: 8px; }
.form .row .btn { padding-left: 14px; padding-right: 14px; }

:root { --fc-ok: #13733d; --fc-ok-bg: #e6f4ea; --fc-warn: #7a4e00; --fc-warn-bg: #fbf0d4; --fc-bad: #a32018; --fc-bad-bg: #fce8e6; --paper: var(--surface); }
@media screen and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --fc-ok: #7ddba2; --fc-ok-bg: #1f3a2a; --fc-warn: #f0c364; --fc-warn-bg: #3b3220; --fc-bad: #ff8a80; --fc-bad-bg: #40262a; } }
@media screen { :root[data-theme="dark"] { --fc-ok: #7ddba2; --fc-ok-bg: #1f3a2a; --fc-warn: #f0c364; --fc-warn-bg: #3b3220; --fc-bad: #ff8a80; --fc-bad-bg: #40262a; } }

@media (min-width: 900px) { .tool-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); } }
.fcc { padding: 16px; }
.fcc .field, .fcc .field:last-of-type { margin: 0; gap: 4px; }
.fcc .field label { font-size: 13px; }
.fcc .field input, .fcc .field select { width: 100%; min-height: 44px; padding: 8px 10px; font-size: 16px; font-variant-numeric: tabular-nums; }
.fcc .field select { appearance: none; -webkit-appearance: none; padding-right: 22px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 11px top 50%, right 6px top 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.dish-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.dish-top .dn { grid-column: 1 / -1; }
.dish-hint { margin: 8px 0 0; font-size: 13px; }
.labor { margin: 12px 0 0; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-s); }
.labor summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.labor summary::-webkit-details-marker { display: none; }
.labor summary::after { content: "+"; color: var(--muted); font: 400 20px/1 var(--font-display); }
.labor[open] summary::after { content: "–"; }
.labor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding-bottom: 4px; }
.labor-grid .field:first-child { grid-column: 1 / -1; }
.labor .hint { margin: 8px 0 12px; font-size: 13px; }

.ings { border: 0; margin: 16px 0 0; padding: 0; min-width: 0; }
.ings legend { padding: 0; margin: 0 0 8px; font-weight: 600; font-size: 14px; }
.ings-head { display: none; }
.ing { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 8px; margin: 0 0 8px; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); }
.ing .nm { grid-column: 1 / -1; padding-right: 48px; }
.ing .pr { grid-area: 2 / 1; } .ing .pk { grid-area: 2 / 2; } .ing .ws { grid-area: 3 / 1; } .ing .am { grid-area: 3 / 2; }
.ing .field label { font-size: 12px; font-weight: 500; color: var(--muted); }
.ing input { text-align: right; }
.ing .nm input { text-align: left; }
.pair { display: flex; min-width: 0; }
.pair input { flex: 1 1 44px; min-width: 0; border-radius: var(--radius-s) 0 0 var(--radius-s); }
.fcc .pair select { flex: 0 0 76px; width: 76px; padding: 8px 20px 8px 8px; margin-left: -1px; border-radius: 0 var(--radius-s) var(--radius-s) 0; }
.pair input:focus, .pair select:focus { position: relative; z-index: 1; }
.ing .del { position: absolute; top: 6px; right: 6px; width: 40px; min-height: 40px; padding: 0; font-size: 20px; line-height: 1; color: var(--muted); }
.ings-act { margin: 10px 0 14px; gap: 8px; }
.ings-act .hint { flex: 1 1 100%; font-size: 13px; }
.file-btn { cursor: pointer; }
.file-btn:focus-within { outline: 3px solid var(--link); outline-offset: 2px; }
@media (min-width: 641px) {
  .dish-top { grid-template-columns: minmax(0, 1.7fr) minmax(0, .8fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 8px; }
  .dish-top .field label { white-space: nowrap; }
  .dish-top .dn { grid-column: auto; }
  .labor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .labor-grid .field:first-child { grid-column: auto; }
}
@media (min-width: 900px) { .ings-act .hint { flex: 1 1 200px; } }

.fcc { container-type: inline-size; }
@container (min-width: 540px) {
  .ings-head, .ing { grid-template-columns: minmax(0, 1.3fr) 70px minmax(132px, 1fr) minmax(132px, 1fr) 54px 28px; gap: 6px; }
  .ing .pr, .ing .pk, .ing .ws, .ing .am { grid-area: auto; }
  .ings-head { display: grid; padding: 0 0 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
  .ings-head span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ings-head span:nth-child(2), .ings-head span:nth-child(5) { text-align: right; }
  .ing { align-items: center; margin: 0 0 6px; padding: 0; border: 0; background: none; }
  .ing .nm { grid-column: auto; padding-right: 0; }
  .ing .field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .fcc .ing input, .fcc .ing select { min-height: 38px; padding: 6px 8px; font-size: 14px; }
  .fcc .ing select { padding: 6px 14px 6px 6px; background-position: right 8px top 50%, right 4px top 50%; background-size: 4px 4px; }
  .fcc .ing .pair select { flex-basis: 62px; width: 62px; }
  .fcc .ing .pair input { padding: 6px; }
  .ing .del { position: static; width: 28px; min-height: 38px; }
}

.ticket { position: relative; padding: 22px 16px 14px; background: var(--paper); border: 1px solid var(--line); border-top: 6px solid var(--accent); border-radius: 4px 4px var(--radius-s) var(--radius-s); color: var(--ink); font-variant-numeric: tabular-nums; }
.ticket::before { content: ""; position: absolute; top: 8px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-strong); }
.t-head { display: flex; justify-content: space-between; gap: 12px; margin: 0; font: 600 11px/1.4 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.t-dish { margin: 6px 0 0; font: 650 24px/1.15 var(--font-display); letter-spacing: -.02em; }
.t-meta { margin: 4px 0 0; font: 13px/1.4 var(--font-mono); color: var(--muted); }
.t-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--line-strong); }
.t-tiles > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface-2); min-width: 0; }
.t-tiles dt { font: 600 11px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.t-tiles dd { margin: 0; font: 700 26px/1.1 var(--font-display); letter-spacing: -.02em; overflow-wrap: anywhere; }
.t-tiles span { font-size: 12px; color: var(--muted); }
.t-tiles .price dd { color: var(--accent); }
.t-tiles .fc { border-color: transparent; }
.t-tiles .fc.ok { background: var(--fc-ok-bg); }
.t-tiles .fc.ok dd, .t-tiles .fc.ok span { color: var(--fc-ok); }
.t-tiles .fc.warn { background: var(--fc-warn-bg); }
.t-tiles .fc.warn dd, .t-tiles .fc.warn span { color: var(--fc-warn); }
.t-tiles .fc.bad { background: var(--fc-bad-bg); }
.t-tiles .fc.bad dd, .t-tiles .fc.bad span { color: var(--fc-bad); }
.t-tab { width: 100%; margin: 14px 0 0; border-collapse: collapse; font-size: 14px; }
.t-tab th, .t-tab td { padding: 6px 0 6px 8px; text-align: right; font-weight: 400; border-top: 1px dashed var(--line-strong); }
.t-tab thead th { padding-top: 0; border-top: 0; font: 600 11px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.t-tab tr > :first-child { padding-left: 0; text-align: left; }
.t-tab tbody th { font-weight: 500; }
.t-tab tbody th small { display: block; font-size: 12px; color: var(--muted); }
.t-tab .top3 td:last-child { font-weight: 700; color: var(--accent); }
.t-tab tfoot th, .t-tab tfoot td { font-weight: 700; border-top: 3px double var(--line-strong); }
.t-change { margin: 14px 0 0; padding: 12px; border-radius: var(--radius-s); background: var(--accent-soft); }
.t-label { margin: 0 0 4px; font: 600 11px/1.3 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.t-change p:last-child { margin: 0; font-size: 14px; line-height: 1.5; }
.t-foot { margin: 12px 0 0; font: 12px/1.4 var(--font-mono); color: var(--muted); text-align: center; }
.out-act { margin-top: 14px; gap: 8px; }
.out-act .btn { flex: 1 1 calc(50% - 4px); padding-left: 10px; padding-right: 10px; white-space: nowrap; }
.t-note { margin: 10px 0 0; font-size: 13px; }
@media (max-width: 640px) {
  .ticket { padding: 20px 12px 12px; }
  .t-dish { font-size: 22px; }
  .t-tiles dd { font-size: 23px; }
  .t-tab .used { display: none; }
}
@media print {
  .tool-grid > .form, .out-act, .t-note, .out .status, aside[data-ad] { display: none !important; }
  .ticket { border-top-color: #000; }
  .t-tab .used { display: table-cell; }
}

.okr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.okr select { min-height: 36px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); font-size: 14px; }
.ing.is-warn { background: var(--fc-warn-bg); border-color: transparent; }
.ing-note, .cupw { grid-column: 1 / -1; }
.ing-note { margin: 0; font-size: 13px; color: var(--fc-warn); }
.top-note { margin-top: 8px; }
.fcc [aria-invalid="true"] { border-color: var(--fc-warn); }
.cupw .pair { max-width: 220px; }
.ing .cupw .field label { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; font-size: 12px; color: var(--muted); }
.t-tab .skip th, .t-tab .skip td { color: var(--muted); }
.t-tab .skip small { color: var(--fc-warn); }
.t-prime { margin-top: 14px; }
.t-prime caption { text-align: left; padding-bottom: 6px; }
.t-prime tbody tr:first-child > * { border-top: 0; }
.saved { margin-top: 28px; }
.saved h2 { margin-top: 0; }
.saved-list { list-style: none; margin: 8px 0 12px; padding: 0; border-top: 1px solid var(--line); }
.saved-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.saved-list li.is-open .sd-name { color: var(--accent); }
.sd-name { flex: 1 1 200px; min-height: 40px; padding: 0; border: 0; background: none; color: var(--ink); font: 600 16px/1.3 var(--font-body); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.sd-meta { flex: 1 1 220px; font: 13px/1.4 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.saved-empty { color: var(--muted); font-size: 14px; }
.saved .row .hint { flex: 1 1 220px; font-size: 13px; }
.inv-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px; }
.inv-form .field, .inv-form .field:last-of-type { margin: 0; }
.inv-form .field label { font-size: 13px; }
.inv-form input { min-height: 44px; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; }
.inv-out { grid-column: 1 / -1; margin: 4px 0 0; font-weight: 600; }
.inv-out.is-error { color: var(--bad); }
@media (min-width: 641px) { .inv-form { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media print {
  .hero, .saved, .how, .prose, .inv, .faq { display: none !important; }
  .tool-grid { display: block; }
  .tool-grid .out { position: static; border: 0; background: none; padding: 0; }
  .ticket { max-width: 420px; margin: 0 auto; }
  :root:root:root { color-scheme: light; }
}
.t-tab td { white-space: nowrap; overflow-wrap: normal; }
