/* Costcard: menu costing. This sheet is the whole look of the product.
   kit.css still loads first for the shared patterns (dialog, More, toast, stacked tables, print);
   everything it draws is restyled here. Nothing is fetched from anywhere: the type ships in fonts/. */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/InterVariable.woff2") format("woff2");
}
@font-face {
  font-family: "Inter"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("fonts/InterVariable-Italic.woff2") format("woff2");
}

/* ---------- tokens ----------
   Warm off-white and deep graphite. One accent, a muted deep green, which also says "on target".
   Oxblood is kept for "over" and for errors, and both always come with words. */
:root {
  --paper: #F5F3EE;
  --card: #FCFBF8;
  --sunk: #ECE9E2;
  --sel: #E9E5DC;
  --ink: #1D2023;
  --ink-2: #3F4449;
  --muted: #5F6469;
  --rule: #DFDBD2;
  --rule-2: #CCC7BC;
  --edge: #7C7F82;
  --good: #2B5C45;
  --over: #7C2A30;
  --mark: var(--ink);
  --focus: var(--ink);
  --toast-err: #E39C97;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans);
  --feat: "cv11" 1, "ss01" 1, "calt" 1;
  --feat-num: "cv11" 1, "ss01" 1, "calt" 1, "tnum" 1;
  --radius: 6px;
  --radius-2: 10px;
  --wrap: 80rem;
  --measure: 40rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15171A; --card: #1C1F22; --sunk: #101214; --sel: #24282C; --ink: #ECE9E2; --ink-2: #C6C4BD; --muted: #9C9D99;
    --rule: #282B2F; --rule-2: #383C40; --edge: #70757A; --good: #8CC3A5; --over: #E39C97; --toast-err: #7C2A30;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15171A; --card: #1C1F22; --sunk: #101214; --sel: #24282C; --ink: #ECE9E2; --ink-2: #C6C4BD; --muted: #9C9D99;
  --rule: #282B2F; --rule-2: #383C40; --edge: #70757A; --good: #8CC3A5; --over: #E39C97; --toast-err: #7C2A30;
  color-scheme: dark;
}
@media (min-width: 64rem) and (pointer: fine) { :root { --tap: 2.5rem; } }

/* ---------- base ---------- */
body {
  font-family: var(--sans); font-size: .9375rem; line-height: 1.5; letter-spacing: -.006em;
  font-variant-numeric: lining-nums; font-feature-settings: var(--feat); font-optical-sizing: auto;
  text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.014em; }
a:hover { text-decoration-color: currentColor; }
::selection { background: color-mix(in srgb, var(--good) 24%, transparent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
/* Tabular figures wherever a number sits. (Names and selects stay proportional: tabular also widens Inter's hyphen.) */
.num, .fig, .result .key, .stats dd, .stats dt, .signal, .gauge-t, .dish-tab .fc, .dish-tab .mt, .line .amt, .line .src, .sum .val, .sum .what small,
.ledger td, .ledger tfoot th, .insight, .scale-ask, .scale .hint, .caution, .field-msg, .howto .worked {
  font-family: inherit; font-variant-numeric: tabular-nums lining-nums; font-feature-settings: var(--feat-num);
}
.skip { font-family: inherit; font-size: .875rem; font-weight: 500; border-radius: var(--radius); }
.muted { color: var(--muted); }

/* Small capitals for the things that name a column or a group. */
.eyebrow, .key-label, .lines-head, .ledger thead th, .custom-kicker, .dish-head .field > label, .gauge-t {
  font-size: .6875rem; font-weight: 600; line-height: 1.35; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  font-feature-settings: var(--feat), "case" 1; font-style: normal;
}

/* ---------- top bar ---------- */
.strip { flex-wrap: nowrap; gap: 1rem; padding: .875rem 0 .5rem; border-bottom: 0; }
.brand { display: flex; align-items: center; gap: .625rem; min-width: 0; min-height: var(--tap); }
.brand h1 { font-size: 1.125rem; font-weight: 650; line-height: 1; letter-spacing: -.028em; }
.mark { display: block; }
.mark-a { fill: var(--ink); }
.mark-b { fill: var(--good); }
.tagline { display: none; margin-left: .375rem; padding-left: 1rem; border-left: 1px solid var(--rule-2); font-size: .8125rem; line-height: 1.25rem; color: var(--muted); white-space: nowrap; }
@media (min-width: 60rem) { .tagline { display: block; } }
.actions { flex-wrap: nowrap; gap: 0 .125rem; margin: 0 -.625rem 0 0; }
@media (min-width: 40rem) { .actions { flex-wrap: wrap; justify-content: flex-end; } }

/* ---------- views ---------- */
.views { flex-wrap: nowrap; gap: 0 1.75rem; margin: 0 0 2rem; border-bottom: 1px solid var(--rule); }
.view-tab {
  min-height: 2.75rem; padding: .5rem 0; border-bottom: 2px solid transparent;
  font-family: inherit; font-size: .9375rem; font-weight: 500; letter-spacing: -.006em; color: var(--muted);
}
.view-tab:first-child { padding-left: 0; }
.view-tab:hover { color: var(--ink); border-bottom-color: var(--rule-2); }
.view-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.view-tab:focus-visible { outline-offset: -2px; }
@media (max-width: 30rem) { .views { gap: 0; justify-content: space-between; } }

/* ---------- buttons ---------- */
.btn {
  gap: .4rem; padding: .375rem .875rem; font-family: inherit; font-size: .875rem; font-weight: 500; letter-spacing: -.003em;
  border-color: var(--rule-2); border-radius: var(--radius);
}
.btn:hover { background: var(--sunk); border-color: var(--edge); }
.btn:active { background: var(--sel); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn.quiet { border-color: transparent; color: var(--ink-2); font-weight: 500; padding-left: .625rem; padding-right: .625rem; }
.btn.quiet:hover { border-color: transparent; color: var(--ink); background: var(--sunk); }
.btn.danger { color: var(--over); }
.btn.quiet.danger:hover { color: var(--over); }
.btn.danger.primary { background: var(--over); border-color: var(--over); color: var(--paper); }
.btn.danger.primary:hover { background: color-mix(in srgb, var(--over) 88%, var(--ink)); border-color: transparent; }
.btn.add { border: 0; padding-left: .625rem; padding-right: .75rem; color: var(--ink-2); }
.btn.add:hover { color: var(--ink); background: var(--sunk); }
.linkish { padding: 0; border: 0; background: none; font: inherit; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
.linkish { text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); color: var(--ink); font-weight: 500; }
.linkish:hover { text-decoration-color: currentColor; }

/* ---------- form controls ---------- */
.label, .field > label { font-family: inherit; font-size: .8125rem; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.hint { font-family: inherit; font-size: .8125rem; line-height: 1.45; color: var(--muted); }
.input {
  padding: 0 .625rem; font-family: inherit; font-size: 1rem; font-variant-numeric: lining-nums; font-feature-settings: var(--feat); letter-spacing: -.006em;
  background: var(--card); border: 1px solid var(--edge); border-radius: var(--radius);
}
@media (min-width: 64rem) and (pointer: fine) { .input { font-size: .9375rem; } }
.input.num { font-variant-numeric: tabular-nums lining-nums; font-feature-settings: var(--feat-num); }
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--ink-2); }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.input[disabled] { opacity: .5; }
select.input {
  padding-right: 1.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - .8rem) 52%, calc(100% - .55rem) 52%; background-size: .25rem .25rem;
}
.affix > .pre, .affix > .suf { font-family: inherit; font-size: .875rem; color: var(--muted); }
.field-msg { font-family: inherit; font-size: .8125rem; line-height: 1.45; color: var(--ink-2); }
.field-msg.is-error { color: var(--over); font-weight: 500; }
.field-msg.is-error::before { width: .375rem; height: .375rem; margin-right: .4rem; vertical-align: .08em; }

/* ---------- section heads ---------- */
.sec-head { margin-bottom: 1.5rem; }
.sec-head h2 { font-size: 1.375rem; line-height: 1.2; letter-spacing: -.022em; }
.sec-head p { max-width: 44rem; margin-top: .5rem; color: var(--ink-2); }

/* ---------- notices ---------- */
.notice {
  gap: .25rem 1rem; margin: .25rem 0 .75rem; padding: .375rem .375rem .375rem 1rem; background: var(--sunk); border: 0; border-radius: var(--radius-2);
  font-size: .9375rem; color: var(--ink-2);
}
.notice p { padding: .3rem 0; }
.notice.is-error { box-shadow: inset 3px 0 0 var(--over); }
.notice.toast {
  max-width: 38rem; padding: .5rem .5rem .5rem 1.125rem; background: var(--ink); color: var(--paper); border: 0; border-radius: var(--radius-2);
  box-shadow: 0 .75rem 2.5rem rgba(0, 0, 0, .22);
}
.notice.toast.is-error { box-shadow: inset 3px 0 0 var(--toast-err), 0 .75rem 2.5rem rgba(0, 0, 0, .22); }
.notice.toast .btn { color: var(--paper); border-color: color-mix(in srgb, var(--paper) 45%, transparent); }
.notice.toast .btn.quiet { border-color: transparent; color: color-mix(in srgb, var(--paper) 82%, var(--ink)); }
.notice.toast .btn:hover { background: color-mix(in srgb, var(--paper) 14%, transparent); color: var(--paper); }
.notice.toast :focus-visible { outline-color: var(--paper); }

/* ================= Recipes: the list and the dish ================= */
.picker { margin: 0 -.75rem; padding: 0 0 2rem; }
.picker .eyebrow { margin: 0; padding: 0 .75rem .5rem; }
.picker ul + .eyebrow { margin-top: 1.75rem; }
.picker .picker-hint { padding: 0 .75rem .625rem; margin-top: -.25rem; }
.dishes { display: block; border-top: 1px solid var(--rule); }
.dishes li { min-width: 0; border-bottom: 1px solid var(--rule); }
.dishes li:last-child { border-bottom: 0; }
.dish-tab {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nm fc" "mt flag"; align-items: baseline; gap: .0625rem .75rem;
  width: 100%; max-width: none; min-height: 3.5rem; padding: .5625rem .75rem; text-align: left;
  font: inherit; color: var(--ink); background: none; border: 0; border-radius: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.dish-tab:hover { background: var(--sunk); color: var(--ink); }
.dish-tab .nm { grid-area: nm; max-width: none; font-family: inherit; font-size: .9375rem; font-weight: 500; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dish-tab .fc { grid-area: fc; font-size: .9375rem; font-weight: 500; text-align: right; white-space: nowrap; }
.dish-tab .mt { grid-area: mt; font-family: inherit; font-size: .8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dish-tab .flag { grid-area: flag; font-size: .8125rem; color: var(--over); text-align: right; white-space: nowrap; }
.dish-tab .fc:empty, .dish-tab .flag:empty { display: none; }
.dish-tab .fc.is-over { color: var(--over); }
.dish-tab[aria-current="true"] { background: var(--sel); border-color: transparent; box-shadow: inset 2px 0 0 var(--ink); color: var(--ink); }
.dish-tab:focus-visible { outline-offset: -2px; }
.dishes .btn.add { width: 100%; min-height: 2.75rem; justify-content: flex-start; padding-left: .75rem; border-radius: 0; }
.dishes .btn.add:focus-visible { outline-offset: -2px; }

.pane-back {
  display: inline-flex; align-items: center; gap: .3rem; min-height: var(--tap); margin: -.5rem 0 .75rem -.3rem; padding: 0 .5rem 0 .1rem;
  font: inherit; font-size: .875rem; font-weight: 500; color: var(--ink-2); background: none; border: 0; border-radius: var(--radius); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pane-back:hover { color: var(--ink); background: var(--sunk); }

/* Under 66rem the list and the dish take turns (app.js: stacked()). From 66rem they sit side by side. */
@media (max-width: 65.99rem) {
  #view-recipes[data-pane="detail"] .picker { display: none; }
  #view-recipes[data-pane="list"] .dish { display: none; }
}
@media (min-width: 66rem) {
  #view-recipes { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); align-items: start; }
  .picker { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; padding: .25rem 0 2rem; margin-right: 0; scrollbar-width: thin; }
  .dish { margin-left: 2rem; padding-left: 2.5rem; border-left: 1px solid var(--rule); min-height: 36rem; }
  .pane-back { display: none; }
}

/* ---------- the dish ---------- */
.dish { border-top: 0; padding-top: 0; padding-bottom: 3rem; }
.dish-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .25rem 1rem; margin-bottom: 0; padding-bottom: .625rem; border-bottom: 1px solid var(--ink); }
.dish-head .field { flex: 1 1 16rem; max-width: 40rem; gap: .125rem; }
.dish-name.input {
  height: 2.75rem; padding: 0; font-family: inherit; font-size: clamp(1.5rem, 1.2rem + 1.4vw, 1.875rem); font-weight: 600; letter-spacing: -.028em;
  background: transparent; border: 0; border-radius: 0; text-overflow: ellipsis;
}
.dish-name.input:hover { box-shadow: 0 1px 0 var(--edge); }
.dish-name.input:focus-visible { outline: none; box-shadow: 0 2px 0 var(--focus); }
.dish-name.input::placeholder { color: var(--muted); font-weight: 500; }
.dish-head .dish-actions { gap: .125rem; margin-right: -.625rem; }

.dish-grid { display: block; container-type: inline-size; container-name: dish; }

/* ---------- the lead: today's food cost, then the figures that explain it ---------- */
.dish-side { position: static; padding: 1.75rem 0 2rem; border-bottom: 1px solid var(--rule); }
.dish-side .result { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem 3rem; align-items: start; border-top: 0; padding-top: 0; }
@container dish (min-width: 44rem) {
  .dish-side .result { grid-template-columns: minmax(0, 1fr) minmax(0, 23rem); }
  .dish-side.is-prep .result { grid-template-columns: minmax(0, 1fr) minmax(0, 23rem); }
}
.result .key-label { font-size: .6875rem; font-style: normal; color: var(--muted); }
.result .key {
  display: block; margin: .5rem 0 0 -.04em; font-family: inherit; font-size: clamp(3.5rem, 2.6rem + 4vw, 4.75rem); line-height: 1;
  font-weight: 300; letter-spacing: -.05em; color: var(--ink);
}
.result .key-sub { margin-top: .75rem; font-family: inherit; font-size: .9375rem; color: var(--ink-2); }
.dish-side .caution { margin-top: .75rem; font-family: inherit; font-size: .8125rem; font-weight: 500; color: var(--over); }

/* The verdict: a small mark and plain words, coloured to match. */
.signal { gap: .5rem; max-width: 27rem; margin-top: 1rem; padding: 0; border: 0; border-radius: 0; background: none; font-size: .9375rem; line-height: 1.45; font-weight: 500; }
.signal svg { width: 1rem; height: 1rem; margin-top: .17rem; }
.signal.good, .signal.over { border: 0; background: none; }
.signal.good { color: var(--good); }
.signal.over { color: var(--over); }
.signal.idle { color: var(--ink-2); font-weight: 400; }

/* A fine scale: nothing on the left, twice the target on the right, the target in the middle. */
.gauge { position: relative; height: 2.375rem; max-width: 27rem; margin-top: 1.375rem; }
.gauge::before { content: ""; position: absolute; left: 0; right: 0; top: .5rem; height: 1px; background: var(--rule-2); }
.gauge-fill { position: absolute; left: 0; top: calc(.5rem - 1px); width: var(--at, 0%); height: 3px; border-radius: 2px; background: var(--good); }
.gauge-fill::after { content: ""; position: absolute; right: -.25rem; top: -.1875rem; width: .5625rem; height: .5625rem; border-radius: 50%; background: inherit; box-shadow: 0 0 0 2px var(--paper); }
.gauge.over .gauge-fill { background: var(--over); }
.gauge-tick { position: absolute; left: 50%; top: 0; width: 1px; height: 1.0625rem; background: var(--ink); }
.gauge-t { position: absolute; left: 50%; top: 1.375rem; transform: translateX(-50%); white-space: nowrap; }

.dish-side .result .targets { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 0; }
.targets .target-fix { grid-column: 1 / -1; }
.targets .target-fix .linkish { min-height: var(--tap); padding: .5rem 0; }
.stats { margin-top: 1.25rem; }
.stats > div:last-child { padding-bottom: 0; }
.stats > div { gap: 1rem; padding: .625rem 0; border-top: 1px solid var(--rule); }
.stats dt { font-size: .9375rem; color: var(--ink); }
.stats dt small { font-family: inherit; font-size: .8125rem; color: var(--muted); }
.stats dd { font-family: inherit; font-size: 1.0625rem; font-weight: 550; letter-spacing: -.012em; }
.dish-side.is-prep .stats { margin-top: 0; }
.dish-side .stats dd.words { font-family: inherit; font-size: .9375rem; font-weight: 400; white-space: normal; text-align: right; flex: 1 1 0; min-width: 0; letter-spacing: -.006em; }
.dish-side .stats .is-words dt { flex: none; }

/* ---------- what goes in ---------- */
.dish-main { padding-top: 2rem; }
.dish-main h3, .scale h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.014em; }
.dish-main > .hint { margin-top: .375rem; max-width: 42rem; }

/* Lines are lists, not tables: a small card each on a phone, a ruled row when there's room.
   Every input keeps its own label; on the wide layout the labels are hidden and the header row shows instead. */
.lines-box { container-type: inline-size; container-name: lines; margin-top: 1.25rem; }
.lines-head { display: none; gap: 0 .5rem; padding: 0 0 .5rem; align-items: end; }
.line { display: grid; column-gap: .5rem; row-gap: 0; padding: .5rem 0 1.125rem; border-top: 1px solid var(--rule); }
.line > * { margin-top: .5rem; }
.line:first-child { border-top-color: var(--rule-2); }
.line .c-x { grid-area: x; align-self: start; padding-top: 1.36rem; }
.line .c-x .btn { color: var(--muted); }
.line .c-x .btn:hover { color: var(--over); }
.line .c-msg { grid-area: msg; }
.line .c-msg:empty, .line .src:empty { display: none; }
.line .src { margin-top: .125rem; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; gap: .25rem; }
.line .c-cost { grid-area: cost; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: .15rem; }
.line .c-cost .amt { text-align: right; }
.line .c-cost .amt strong { font-size: 1.0625rem; font-weight: 550; letter-spacing: -.012em; }
.line .c-cost .amt small { display: block; font-size: .8125rem; color: var(--muted); }
.lines-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; padding: .5rem 0 0; border-top: 1px solid var(--rule); }
.lines-foot .btn.add { margin-left: -.625rem; }
.keys-hint { margin-top: 1rem; max-width: 42rem; }

.rline {
  grid-template-columns: minmax(0, 1fr) 5.5rem var(--tap);
  grid-template-areas: "item item x" "uses yield yield" "one one one" "cost cost cost" "msg msg msg";
}
.rline .c-item { grid-area: item; }
.rline .c-uses { grid-area: uses; }
.rline .c-yield { grid-area: yield; }
.rline .c-one { grid-area: one; display: grid; gap: .5rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); padding: .75rem; background: var(--sunk); border-radius: var(--radius); }
.rline .c-one .o-name, .rline .c-one .o-go { grid-column: 1 / -1; }
.rline .c-one .o-go { justify-self: start; background: var(--card); }
.rline .c-one .o-go:hover { background: var(--paper); }
.rline.is-prep .c-yield { visibility: hidden; }

.iline {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--tap);
  grid-template-areas: "name name x" "price pack pack" "yield cost cost" "used used used" "msg msg msg";
}
.iline .c-name { grid-area: name; }
.iline .c-price { grid-area: price; }
.iline .c-pack { grid-area: pack; }
.iline .c-yield { grid-area: yield; }
.iline .c-cost { align-self: end; min-height: var(--tap); align-items: center; }
.iline .c-used { grid-area: used; font-size: .875rem; color: var(--ink-2); }
.iline .c-used .label { margin-right: .4rem; }

@container lines (min-width: 40rem) {
  .rline-head, .rline {
    grid-template-columns: minmax(11rem, 1fr) 11rem 5.5rem 6rem var(--tap);
    grid-template-areas: "item uses yield cost x" "one one one one one" "msg msg msg msg msg";
    align-items: start;
  }
  .rline .c-one { grid-template-columns: minmax(8rem, 1fr) 7rem 11rem auto; align-items: end; }
  .rline .c-one .o-name, .rline .c-one .o-go { grid-column: auto; }
  .rline-head { display: grid; }
  .rline { padding: 0 0 .5rem; }
  .rline > .field > label, .rline > .c-cost > .label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .rline > .field { gap: 0; }
  .rline .c-x { padding-top: 0; }
  .rline .c-cost { display: block; padding-top: .5rem; text-align: right; }
  .rline .c-cost .amt strong { font-size: .9375rem; }
  .rline .c-cost .amt small { font-size: .75rem; }
}
@container lines (min-width: 58rem) {
  .ing-head, .iline {
    grid-template-columns: minmax(10rem, 1.1fr) 6.5rem 10.5rem 5rem 8.5rem minmax(9rem, 1fr) var(--tap);
    grid-template-areas: "name price pack yield cost used x" "msg msg msg msg msg msg msg";
    align-items: start;
  }
  .iline .c-used { padding-top: .6rem; padding-left: .75rem; }
  .ing-head span:nth-child(6) { padding-left: .75rem; }
  .iline .c-used .label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .iline .c-cost { align-self: start; min-height: 0; display: block; padding-top: .5rem; text-align: right; }
  .ing-head { display: grid; }
  .iline { padding: 0 0 .5rem; }
  .iline > .field > label, .iline > .c-cost > .label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .iline > .field { gap: 0; }
  .iline .c-x { padding-top: 0; }
  .iline .c-cost .amt strong { font-size: .9375rem; }
  .iline .c-cost .amt small { font-size: .75rem; }
}
.rline-head span:nth-child(4), .ing-head span:nth-child(5) { text-align: right; }

/* ---------- the totals under the lines ---------- */
.sums { margin-top: 1.5rem; margin-left: auto; max-width: 30rem; border-top: 1px solid var(--rule-2); }
.sum { display: grid; grid-template-columns: minmax(0, 1fr) 5.25rem 6rem; gap: .25rem .75rem; align-items: center; min-height: 3rem; padding: .25rem 0; border-bottom: 1px solid var(--rule); }
.sum .what { color: var(--ink-2); }
.sum .what label { display: block; }
.sum .what small { display: block; font-size: .8125rem; color: var(--muted); line-height: 1.35; }
.sum .val { grid-column: 3; font-size: .9375rem; font-weight: 550; text-align: right; }
.sum.wide { grid-template-columns: minmax(0, 1fr) 11rem; }
.sum.wide .val { display: none; }
@media (max-width: 30rem) { .sum.wide { grid-template-columns: minmax(0, 1fr); padding: .6rem 0; } }
.sum.total { border-bottom: 1px solid var(--ink); }
.sum.total .what { color: var(--ink); font-weight: 600; }
.sum.total .val { font-size: 1.125rem; font-weight: 600; letter-spacing: -.014em; }
.sum .field-msg { grid-column: 1 / -1; padding-bottom: .25rem; }
.sum .field-msg:empty, .wi-row .field-msg:empty, .wi-all .field-msg:empty { display: none; }

/* ---------- make a different amount ---------- */
.scale { margin-top: 2.75rem; padding-top: 1.75rem; border-top: 1px solid var(--rule); }
.scale .scale-ask { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .625rem; margin-top: .75rem; color: var(--ink-2); }
.scale .scale-ask .input { width: 5.5rem; }
.scale .table-wrap { margin-top: 1rem; max-width: 44rem; }
.scale .scale-none { margin-top: .75rem; }

/* ================= tables: the menu and the what-if ================= */
.table-wrap { border-radius: 0; }
.ledger { font-size: .9375rem; }
.ledger th, .ledger td { padding: .6875rem .75rem; border-bottom: 1px solid var(--rule); }
.ledger thead th { font-family: inherit; border-bottom: 1px solid var(--rule-2); padding-bottom: .5rem; }
.ledger tbody th { font-weight: 500; }
.ledger tfoot th, .ledger tfoot td { border-top: 1px solid var(--ink); font-weight: 600; }
.ledger tfoot .fl { display: block; font-family: inherit; font-size: .6875rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-feature-settings: var(--feat), "case" 1; }
.ledger td small { display: block; font-family: inherit; font-size: .8125rem; color: var(--muted); font-weight: 400; }
.ledger td small.over-text { color: var(--over); }
.insight { max-width: 46rem; margin-bottom: 1.75rem; padding-left: 1.125rem; border-left: 2px solid var(--ink); font-size: 1.0625rem; font-style: normal; line-height: 1.5; letter-spacing: -.012em; }
.insight:empty { display: none; }
.menu .rank { color: var(--muted); width: 3rem; }
.menu .rk { display: none; }
.menu tbody th, .whatif tbody th { font-size: .9375rem; min-width: 10rem; }
.menu .earn { min-width: 8.5rem; }
.menu .earn strong, .whatif .hit strong { font-weight: 600; }
.menu .bar { display: block; height: 2px; margin-top: .3rem; margin-left: auto; background: var(--ink); border-radius: 1px; }
.menu td .input { width: 5.5rem; margin-left: auto; }
.menu .no-price { font-family: inherit; font-size: .8125rem; font-weight: 400; color: var(--muted); }
.menu-hint { margin-top: 1rem; max-width: var(--measure); }
.whatif .lands { font-family: inherit; min-width: 9rem; }
.whatif .lands strong { font-weight: 600; }
.whatif tr.is-slip th { box-shadow: inset 2px 0 0 var(--over); padding-left: .75rem; }
@media (max-width: 43.99rem) {
  .ledger.stack tbody tr:first-child { border-top: 1px solid var(--rule-2); }
  .ledger.stack tbody th { font-size: 1rem; font-weight: 600; }
  .ledger.stack td::before { font-family: inherit; font-size: .8125rem; font-weight: 400; color: var(--ink-2); }
  .menu .ledger.stack .rank { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .menu .rk { display: inline; color: var(--muted); margin-right: .4rem; font-weight: 400; }
  .menu .bar { display: none; }
  .ledger.stack tfoot .fl { display: none; }
  .ledger.stack td.blank { display: none; }
  .ledger.stack td > span { text-align: right; }
  .whatif .ledger.stack tr.is-slip th { padding-left: .75rem; }
}

/* ---------- what-if controls ---------- */
.wi-controls { display: grid; gap: 1.5rem 3rem; margin-bottom: 2rem; padding: 1.25rem 1.25rem 1rem; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-2); }
@media (min-width: 56rem) { .wi-controls { grid-template-columns: 15rem minmax(0, 1fr); padding: 1.5rem 1.5rem 1.25rem; } }
.wi-controls .input { background-color: var(--paper); }
.wi-all .affix { max-width: 9rem; }
.wi-all .field-msg { margin-top: .35rem; }
.wi-list { margin-top: .4rem; }
.wi-row { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem var(--tap); gap: .4rem; padding: .3rem 0; max-width: 34rem; }
.wi-row .field-msg { grid-column: 1 / -1; }
.wi-foot { display: flex; flex-wrap: wrap; gap: .25rem .5rem; margin-top: .5rem; }
.wi-foot .btn.add { margin-left: -.625rem; }

/* ================= below the sheet ================= */
.howto { margin-top: 3rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.howto > summary { gap: .625rem; min-height: 3.5rem; padding: .75rem 0; font-size: 1rem; font-weight: 600; letter-spacing: -.012em; border-radius: 4px; }
.howto > summary::before { width: .4375rem; height: .4375rem; margin: 0 .25rem 0 .125rem; border-color: var(--ink-2); }
.howto .howto-body { max-width: var(--measure); padding: .25rem 0 2.25rem; color: var(--ink-2); }
.howto h3 { font-size: .9375rem; font-weight: 600; color: var(--ink); margin-top: 1.75rem; }
.howto .worked { padding: 1rem 1.125rem; background: var(--sunk); border-radius: var(--radius-2); font-size: .9375rem; }
.howto .worked .fig { font-weight: 500; color: var(--ink); }
.howto strong { font-weight: 600; color: var(--ink); }

/* Custom version: a ruled note in the same hand as the rest. Hidden in print (kit.css). */
.custom { margin-top: 3rem; padding: 1.75rem 1.25rem 1.5rem; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius-2); }
.custom-kicker { gap: 0; }
.custom-kicker::before { content: none; }
.custom h2 { margin-top: .5rem; font-size: 1.375rem; line-height: 1.2; font-weight: 600; letter-spacing: -.022em; }
.custom-lede { margin-top: .625rem; max-width: var(--measure); color: var(--ink-2); }
.custom-list { column-gap: 2.5rem; margin-top: 1.5rem; border-bottom: 1px solid var(--rule); font-size: .875rem; line-height: 1.5; color: var(--ink-2); }
.custom-list li { padding: .75rem 0; border-top: 1px solid var(--rule); }
.custom-list li:first-child, .custom-list li:nth-child(2) { border-top-color: var(--rule); }
.custom-list strong { display: block; font-weight: 600; color: var(--ink); }
.custom-cta { align-items: center; gap: .5rem 1rem; margin-top: 1.25rem; }
.custom-cta a {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: .5rem 1.125rem; font-size: .9375rem; font-weight: 500; line-height: 1.3;
  color: var(--paper); background: var(--ink); border-radius: var(--radius); text-decoration: none;
}
.custom-cta a:hover { background: var(--ink-2); }
.custom-cta span { font-style: normal; font-size: .875rem; color: var(--muted); }
@media (min-width: 48rem) { .custom { padding: 2.25rem 2.25rem 2rem; } }
@media (min-width: 68rem) {
  .custom { grid-template-columns: 20rem minmax(0, 1fr); column-gap: 4rem; padding: 2.5rem 2.5rem 2.25rem; }
  .custom-list { margin-top: 0; }
  .custom-cta { margin-top: 1.5rem; }
  .custom-cta span { margin-top: .625rem; }
}

/* ---------- foot: what it is, what stays on the device, and who made it ---------- */
.foot { display: block; margin-top: 3rem; padding: 1.5rem 0 2.5rem; border-top: 0; font-size: .8125rem; line-height: 1.55; color: var(--muted); }
.foot .about { display: grid; gap: .5rem; max-width: 44rem; }
.foot .privacy { margin: 0; padding: 0; max-width: none; border: 0; font-size: inherit; font-style: normal; color: inherit; }
.foot .by { margin-top: 1.75rem; font-style: normal; color: var(--muted); }
.foot a { display: inline; min-height: 0; }

/* ---------- dialog ---------- */
.dialog { width: min(27rem, calc(100vw - 2rem)); padding: 1.5rem; background: var(--card); border: 1px solid var(--rule-2); border-radius: 14px; box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .28); }
.dialog::backdrop { background: rgba(16, 18, 20, .5); }
.dialog h2 { font-size: 1.1875rem; line-height: 1.3; letter-spacing: -.018em; }
.dialog p { margin-top: .5rem; color: var(--ink-2); }
.dialog .dialog-actions { margin-top: 1.5rem; }

/* ---------- the File menu on a phone (kit.css "More") ---------- */
@media (max-width: 39.99rem) {
  .actions:has(.more[data-ready]) { gap: 0 .125rem; margin: 0 -.5rem 0 0; }
  .actions:has(.more[data-ready]) > .btn.quiet, .more[data-ready] .more-btn { padding-left: .625rem; padding-right: .625rem; }
  .more[data-ready] .more-btn::after { width: .375rem; height: .375rem; margin: -.2rem .125rem 0 .2rem; }
  .more[data-ready].is-open .more-btn { background: var(--sunk); }
  .more[data-ready] .more-list { top: calc(100% - .25rem); min-width: 13rem; padding: .375rem; background: var(--card); border: 1px solid var(--rule-2); border-radius: var(--radius-2); box-shadow: 0 .75rem 2.5rem rgba(0, 0, 0, .2); }
  .more[data-ready] .more-list .btn { min-height: 2.75rem; padding-left: .75rem; font-size: .9375rem; color: var(--ink); }
  .strip:has(.more[data-ready]) .theme-btn { position: static; }
}

/* ---------- print: a plain costing sheet ---------- */
.print-head { margin: 0 0 1.25rem; padding-bottom: .5rem; border-bottom: 1px solid #000; }
.print-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
.print-title span { margin-left: .5rem; font-size: .875rem; font-weight: 400; letter-spacing: 0; }
.print-date { font-size: .8125rem; }
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --paper: #fff; --card: #fff; --sunk: #fff; --sel: #fff; --ink: #000; --ink-2: #222; --muted: #555; --rule: #bbb; --rule-2: #999; --edge: #999;
    --good: #000; --over: #000; color-scheme: light;
  }
  html { font-size: 11px; }
  .input, .wi-controls .input { height: auto; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
  select.input { background-image: none; padding-right: 0; }
  .affix.has-pre > .input { padding-left: .75rem; }
  .affix.has-suf > .input { padding-right: .9rem; }
  .dish-main > .hint, .scale-none, .keys-hint { display: none; }
  .scale:has(#f-make:placeholder-shown) { display: none; }
  #view-recipes { display: block; }
  #view-recipes[data-pane] .dish { display: block; }
  .dish { margin: 0; padding: 0; border: 0; min-height: 0; }
  .pane-back, .gauge { display: none !important; }
  .dish-head { padding-bottom: .25rem; }
  .dish-head .field > label { display: none; }
  .dish-name.input { height: auto; font-size: 1.6rem; }
  .dish-side { padding: 1rem 0; }
  .dish-side .result { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 2.5rem; }
  .result .key { font-size: 2.6rem; font-weight: 400; }
  .signal { border: 0; }
  .dish-main { padding-top: 1rem; }
  .line { break-inside: avoid; padding: 0 0 .3rem; }
  .line .c-x, .lines-foot, .rline .c-one .o-go { display: none; }
  .rline .c-one { background: none; padding: 0; }
  .sums, .scale, .dish-side { break-inside: avoid; }
  .menu .bar { display: none; }
  .wi-controls { border: 0; padding: 0; }
  .sec-head p { display: none; }
  .howto, .custom, .foot { display: none !important; }
}

/* ---------- the way back to the tools list: small and quiet, above the product's own bar ---------- */
.to-tools {
  display: inline-flex; align-items: center; gap: .25rem; min-height: 1.75rem; margin-top: .5rem;
  font-size: .8125rem; font-weight: 500; line-height: 1; color: var(--muted); text-decoration: none;
}
.to-tools:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.to-tools svg { flex: none; }
@media print { .to-tools { display: none; } }
