:root {
  color-scheme: light;
  --canvas: #f7f5ef;
  --paper: #fffdfa;
  --ink: #262122;
  --muted: #64595b;
  --line: #ded5d2;
  --accent: #762f44;
  --accent-dark: #582034;
  --accent-wash: #f3e4e7;
  --error: #9c263b;
  --radius: 18px;
  font: 100%/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: var(--accent-dark); text-underline-offset: .17em; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
h2 { font-size: 1.35rem; letter-spacing: -.02em; }
h3 { font-size: 1.03rem; }
output, .breakdown dd, .purchase-row { font-variant-numeric: tabular-nums; }
.shell { width: min(100% - 3rem, 74rem); margin-inline: auto; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 65px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.masthead-inner > a { font-size: .94rem; }
.masthead-inner .wordmark { font: bold 1.25rem/1 Georgia, serif; text-decoration: none; color: var(--ink); }
.intro { padding: clamp(28px, 5vw, 65px) 0 clamp(24px, 4vw, 44px); display: grid; grid-template-columns: 1.3fr .7fr; align-items: end; gap: clamp(25px, 7vw, 95px); }
.intro h1 { max-width: 15ch; font: 500 clamp(2.5rem, 5.7vw, 4.85rem)/.99 Georgia, serif; letter-spacing: -.064em; }
.intro p { max-width: 58ch; margin-top: 17px; color: var(--muted); font-size: 1.06rem; }
.intro-note { display: grid; gap: 15px; padding-bottom: 3px; }
.intro-note > div { border-left: 2px solid #ad7081; padding-inline-start: 13px; }
.intro-note dt { font-size: .96rem; font-weight: 720; }
.intro-note dd { color: var(--muted); font-size: .94rem; margin-top: 2px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, .44fr); align-items: start; gap: 16px; }
.mobile-totals { display: none; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(16px, 2.3vw, 26px); }
.recipe-heading, .section-heading { display: flex; gap: 12px; align-items: start; justify-content: space-between; flex-wrap: wrap; }
.small-actions { display: flex; gap: 7px 15px; align-items: center; flex-wrap: wrap; }
.text-button { background: transparent; color: var(--accent-dark); border: 0; padding: 2px 0; text-decoration: underline; text-underline-offset: .17em; font-size: .875rem; font-weight: 650; }
.note { color: var(--muted); font-size: .89rem; }
#sample-note { margin-top: 7px; }
.recipe-fields, .extra-fields { display: grid; gap: 10px; }
.recipe-fields { grid-template-columns: minmax(0, 1.55fr) repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.extra-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: 12px 7px; }
.field { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: .875rem; font-weight: 620; }
input, select, textarea { min-width: 0; width: 100%; border: 1px solid #cfc2bf; border-radius: 8px; background: #fff; color: var(--ink); padding: 8px 10px; }
input, select { min-height: 42px; }
input::placeholder { color: #887c7f; opacity: 1; }
[aria-invalid="true"] { border-color: var(--error); }
select { appearance: none; padding-right: 23px; background: linear-gradient(45deg, transparent 50%, #5d5154 50%) right 13px center / 5px 5px no-repeat, linear-gradient(135deg, #5d5154 50%, transparent 50%) right 8px center / 5px 5px no-repeat, #fff; }
textarea { resize: vertical; }
.ingredients-title { margin-top: 21px; margin-bottom: 9px; }
.ingredients-title p { margin-top: 5px; }
.ingredient { min-inline-size: 0; padding: 0; margin: 0 0 7px; border: 0; }
.ingredient-head, .ingredient-grid { display: grid; grid-template-columns: minmax(100px, 2.1fr) minmax(47px, .68fr) repeat(4, minmax(58px, 1fr)) 36px; gap: 7px; }
.ingredient-head { margin-bottom: 5px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.ingredient-grid .field > span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
.ingredient-grid input, .ingredient-grid select { padding-inline-start: 8px; }
.delete-row { border: 1px solid var(--line); color: var(--accent-dark); background: transparent; border-radius: 8px; font-size: 1.34rem; line-height: 1; min-height: 42px; padding: 0; }
.delete-row:hover { background: var(--accent-wash); }
.message { color: var(--error); font-size: .89rem; margin-top: 7px; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; min-height: 42px; border: 1px solid transparent; border-radius: 9px; text-decoration: none; font-weight: 680; font-size: .89rem; line-height: 1.25; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { color: var(--accent-dark); border-color: #c9aeb6; background: var(--paper); }
.button.secondary:hover:not(:disabled) { background: var(--accent-wash); }
#add-ingredient { margin-top: 4px; }
.extras { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 13px; }
.extras summary { color: var(--ink); font-size: .9rem; font-weight: 720; cursor: pointer; }
.storage { margin-top: 16px; }
.totals { position: sticky; top: 16px; }
#scale-label:not(:empty) { margin-top: 6px; }
.key-total { display: grid; margin-top: 18px; padding: 13px 15px; gap: 2px; border-radius: 12px; background: var(--accent-wash); color: var(--accent-dark); }
.key-total span, .purchase-total > span:first-child { font-weight: 710; font-size: .91rem; }
.key-total output, .purchase-total output { font: 500 clamp(2.2rem, 4vw, 3.25rem)/1.03 Georgia, serif; letter-spacing: -.045em; overflow-wrap: anywhere; }
.breakdown { margin-top: 15px; }
.breakdown > div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 7px; font-size: .9rem; }
.breakdown dt { color: var(--muted); }
.breakdown dd { font-weight: 720; text-align: end; }
.purchase-total { display: grid; gap: 3px; border-top: 1px solid var(--line); margin-top: 17px; padding-top: 15px; }
#purchase-list-link { margin-top: 13px; width: 100%; }
.panel-offset { margin-top: 17px; scroll-margin-top: 12px; }
.section-heading p { margin-top: 5px; }
.purchase-items { padding: 0; list-style: none; margin: 12px 0 0; }
.purchase-row { display: grid; grid-template-columns: 1.18fr repeat(3, 1fr) auto; gap: 10px; align-items: baseline; padding-block: 10px; border-top: 1px solid var(--line); font-size: .925rem; }
.purchase-row > strong { overflow-wrap: anywhere; min-width: 0; }
.purchase-row > span { color: var(--muted); }
.purchase-row > strong:last-child { text-align: end; }
#manual-copy, #copy-status { margin-top: 9px; }
.method { padding: 18px 0; max-width: 73ch; }
.method p { color: var(--muted); margin-top: 10px; }
.plan { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.plan p { color: var(--muted); margin-top: 8px; max-width: 66ch; }
.plan .button { flex: none; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; padding-block: 25px 34px; color: var(--muted); font-size: .85rem; }
dialog { max-width: min(28rem, 100% - 2rem); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #23151cd0; }
.dialog-content { padding: 22px; }
.dialog-content p { color: var(--muted); margin-block: 8px 16px; }
.dialog-content .small-actions { justify-content: end; }

@media (max-width: 950px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .mobile-totals { display: flex; align-items: center; justify-content: space-between; gap: 9px; position: sticky; z-index: 1; top: 0; border-radius: 10px; padding: 7px 11px; font-size: .84rem; text-decoration: none; color: #fff; background: var(--accent-dark); }
  .mobile-totals strong { display: block; color: #fff; font-size: 1.13rem; line-height: 1.18; overflow-wrap: anywhere; }
  .mobile-totals span:last-child { flex: none; text-decoration: underline; text-underline-offset: .16em; }
  .totals { position: static; scroll-margin-top: 66px; }
  .breakdown { max-width: 33rem; }
  #purchase-list-link { width: auto; }
}
@media (max-width: 640px) {
  .shell { width: calc(100% - 1.5rem); }
  .masthead-inner { min-height: 57px; }
  .intro { grid-template-columns: 1fr; gap: 17px; }
  .intro p { font-size: 1rem; margin-top: 12px; }
  .intro-note { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; }
  .intro-note > div { padding-inline-start: 8px; }
  .intro-note dd { font-size: .875rem; }
  .recipe-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipe-name { grid-column: 1 / -1; }
  .ingredient-head { display: none; }
  .ingredient { padding: 9px; border: 1px solid var(--line); border-radius: 10px; }
  .ingredient-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; align-items: end; }
  .ingredient-grid .field > span { position: static; inline-size: auto; block-size: auto; clip-path: none; }
  .ingredient-grid .item-name { grid-column: 1 / 3; }
  .ingredient-grid .delete-row { grid-column: 3; grid-row: 3; }
  .purchase-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 7px; }
  .purchase-row > strong:first-child { grid-column: 1 / -1; }
  .purchase-row > strong:last-child { text-align: start; }
  .plan { flex-direction: column; align-items: start; }
}
