:root {
  color-scheme: light;
  --ink: #202a22;
  --muted: #48564a;
  --paper: #f9f7ef;
  --line: #cbd2c1;
  --accent: #285438;
  --result: #edf3e8;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 system-ui, sans-serif; }
input, button, select { font: inherit; }
h1, h2, p, dl, dd { margin: 0; }
h2 { font-size: 1.22rem; line-height: 1.2; letter-spacing: -.024em; }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #2456a5; outline-offset: 3px; }
.shell { width: min(72rem, calc(100% - 2rem)); margin-inline: auto; }
.skip-link { position: fixed; z-index: 110; top: .45rem; left: .45rem; padding: .55rem .9rem; transform: translateY(-150%); background: white; }
.skip-link:focus { transform: none; }
.intro { padding-block: clamp(1.2rem, 3vw, 2.65rem) 1.35rem; }
.breadcrumbs { display: flex; gap: .55rem; flex-wrap: wrap; font-size: .88rem; font-weight: 650; }
h1 { margin-block: .5rem; font: 700 clamp(2.25rem, 6.2vw, 4.8rem)/1.03 Georgia, serif; letter-spacing: -.052em; }
.lead { max-width: 42rem; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); }
.trust { margin-top: .65rem; font-size: .87rem; color: var(--muted); }

.workspace { display: grid; grid-template: "recipe result" auto "ingredients result" 1fr / minmax(0, 1.65fr) minmax(0, 1fr); gap: 1rem 1.15rem; align-items: start; scroll-margin-top: 6rem; }
.recipe { grid-area: recipe; }
.result { grid-area: result; }
.ingredients { grid-area: ingredients; min-width: 0; }
.card { min-width: 0; padding: clamp(.85rem, 2.3vw, 1.4rem); border: 1px solid var(--line); border-radius: .85rem; background: #fffefa; }
.section-heading, .actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.section-heading { justify-content: space-between; gap: .55rem 1rem; }
.ingredients > .section-heading { align-items: flex-start; margin-bottom: .8rem; }
.ingredients > .section-heading > div { flex: 1 1 15rem; }
.recipe-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(5.5rem, .3fr); align-items: end; gap: .6rem; margin-top: .9rem; }
label { min-width: 0; display: block; font-size: .875rem; font-weight: 700; }
.optional, .hint { color: var(--muted); }
.hint { font-size: .86rem; line-height: 1.42; margin-top: .38rem; }
.hint:empty { margin: 0; }
.error, .package-issues { color: #842818; }
input, select { display: block; width: 100%; min-width: 0; min-height: 2.75rem; margin-top: .25rem; padding: .42rem .58rem; background: #fff; color: var(--ink); border: 1px solid #9da894; border-radius: .42rem; font-size: 1rem; }
input[aria-invalid="true"] { border-color: #ac492d; background: #fff5ef; }
button { min-height: 2.75rem; padding: .42rem .68rem; border: 1px solid #879781; border-radius: .48rem; background: white; color: var(--ink); font-size: .875rem; font-weight: 720; cursor: pointer; }
button:hover:not(:disabled) { background: #e8efe3; }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); color: white; border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: #1d422c; }

.result { background: var(--result); }
.totals { display: grid; gap: .5rem; margin-block: .6rem; }
.totals > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .2rem 1rem; border-top: 1px solid #bdc9b9; padding-top: .45rem; }
.totals dt { font-size: .89rem; font-weight: 670; }
.totals dd { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; font-weight: 750; }
.totals .total-primary { border: none; align-items: center; }
.total-primary dd { font: 700 clamp(2rem, 4.8vw, 3rem)/1.03 Georgia, serif; color: var(--accent); letter-spacing: -.035em; }
.result .actions { margin-top: .85rem; }
.edit-jump { display: none; }
#ingredients-title { scroll-margin-top: 5.5rem; }
.result details { margin-top: .65rem; border-top: 1px solid var(--line); }
.line-results { list-style: none; margin: 0; padding: 0; }
.line-results li { padding: .65rem 0; font-size: .89rem; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.line-results p { color: var(--muted); }

.shelf { margin-bottom: .7rem; padding: .1rem .75rem .45rem; background: #f2f2e6; border: 1px solid var(--line); border-radius: .65rem; }
.shelf-tools { display: grid; gap: .6rem; margin-top: .55rem; }
summary { min-height: 2.5rem; padding-block: .48rem; font-weight: 710; cursor: pointer; }
.packages { display: grid; gap: .75rem; margin-block: .45rem .65rem; }
.package { margin: 0; overflow-wrap: anywhere; }
.package legend { padding: 0 .3rem; font-size: .84rem; font-weight: 750; }
.package .section-heading { align-items: end; flex-wrap: nowrap; }
.package-name { flex: 1; }
.measure-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr); gap: .55rem; align-items: end; margin-top: .62rem; }
.stock-details { margin-top: .4rem; }
.stock-details .measure-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 .5rem; }
.package-actions { margin-top: .58rem; }
.package-issues { font-size: .86rem; margin: .6rem 0 0; padding-left: 1.15rem; }

.guide { max-width: 49rem; margin: 2rem 0 3rem; }
.guide > p { margin-block: .45rem .8rem; color: var(--muted); }
.guide details { padding-bottom: .3rem; border-top: 1px solid var(--line); }
.guide details p { padding-bottom: .55rem; }
.related { display: flex; flex-wrap: wrap; gap: .48rem 1rem; }
.print-report { display: none; }

@media (max-width: 48rem) {
  .workspace { grid-template: "recipe" "result" "ingredients" / minmax(0, 1fr); gap: .85rem; }
  .edit-jump { display: inline-flex; align-items: center; min-height: 2.5rem; font-size: .88rem; font-weight: 700; }
}
@media (max-width: 33rem) {
  .intro { padding-block: .9rem 1.05rem; }
  .measure-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .measure-row .price, .measure-row > button { grid-column: 1 / -1; justify-self: start; }
  .measure-row .price { width: 100%; }
  .recipe .section-heading { align-items: start; }
  .package .section-heading { gap: .45rem; }
}

@page { size: Letter portrait; margin: .55in; }
@media print {
  :root, body { background: white; color: #111; }
  body > :not(.print-report) { display: none !important; }
  .print-report { display: block; font: 9pt/1.35 var(--report-font); }
  .report-heading { margin-bottom: 12pt; break-inside: avoid; }
  .report-heading strong { color: #244c32; }
  .print-report h1 { margin: 3pt 0; font: 700 20pt/1.16 var(--report-font); letter-spacing: -.024em; overflow-wrap: anywhere; }
  .print-report table { width: 100%; table-layout: fixed; border-collapse: collapse; font-variant-numeric: tabular-nums; }
  .print-report thead { display: table-header-group; }
  .print-report thead th:nth-child(1) { width: 20%; }
  .print-report thead th:nth-child(2) { width: 14%; }
  .print-report thead th:nth-child(3) { width: 17%; }
  .print-report thead th:nth-child(4) { width: 9%; }
  .print-report thead th:nth-child(5) { width: 11%; }
  .print-report thead th:nth-child(6) { width: 10%; }
  .print-report thead th:nth-child(7) { width: 7%; }
  .print-report thead th:nth-child(8) { width: 12%; }
  .print-report th, .print-report td { padding: 4pt; border: 1px solid #aaa; text-align: right; overflow-wrap: anywhere; }
  .print-report th:first-child { text-align: left; }
  .print-money { white-space: nowrap; }
  .print-report thead th, .print-report .report-totals th, .print-report .report-totals td { background: #f0f1ee; font-weight: 700; }
  .print-report tr, .report-totals { break-inside: avoid; }
  .print-report > p { margin-top: 8pt; }
}
