:root {
  --bg: #f8f7f2;
  --surface: #ffffff;
  --ink: #273328;
  --muted: #6f756b;
  --accent: #596b42;
  --line: #dedfd3;
  --soft: #eeefe5;
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
a { color: inherit; }
:focus-visible { outline: 3px solid #8c9f6d; outline-offset: 3px; }
button, input, select, textarea { border-radius: 7px; }
h1, h2, h3, p { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 16px; padding: 12px 18px; background: var(--ink); color: #fff; z-index: 100; }
.skip-link:focus { top: 12px; }
.site-header { max-width: 1180px; padding: 23px 28px; margin: 0 auto; display: flex; align-items: center; gap: 38px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 32px/1 Georgia, "Times New Roman", serif; letter-spacing: -1px; }
.brand img { flex: none; }
.main-nav { display: flex; align-items: center; gap: 26px; }
.main-nav a { position: relative; padding: 10px 0; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.main-nav a[aria-current="page"] { color: var(--ink); }
.main-nav a[aria-current="page"]::after { content: ''; position: absolute; height: 2px; left: 0; right: 0; bottom: 1px; background: var(--accent); }
.nav-badge:empty { display: none; }
.nav-badge { margin-left: 3px; min-width: 20px; padding: 2px 6px; color: var(--accent); background: var(--soft); border-radius: 20px; font-size: 11px; }
.manage-link { margin-left: auto; color: var(--muted); font-size: 13px; text-decoration: none; white-space: nowrap; }
.manage-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.page-shell { max-width: 1180px; margin: 0 auto; padding: 38px 28px 120px; }
.page-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.page-heading h1 { font: 42px/1.12 Georgia, "Times New Roman", serif; letter-spacing: -1.25px; margin: 0; }
.item-count { color: var(--muted); font-size: 13px; margin: 0; }
.search-row { display: flex; align-items: stretch; gap: 12px; margin-bottom: 17px; }
.search-field { display: flex; align-items: center; gap: 11px; flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 15px; color: var(--muted); }
.search-field svg { flex: none; }
.search-field input { width: 100%; min-width: 0; border: 0; outline: none; padding: 13px 0; background: transparent; color: var(--ink); font-size: 15px; line-height: 1.4; }
.search-field:focus-within { outline: 2px solid #8c9f6d; outline-offset: 2px; }
.search-field input:focus-visible { outline: none; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 10px 17px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); font-size: 14px; font-weight: 500; line-height: 1.35; border-radius: 7px; text-decoration: none; }
.button-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button-primary:hover:not(:disabled) { background: #4b5c37; }
.button-quiet { background: transparent; }
.button-quiet:hover { background: var(--soft); }
.selected-filter { min-width: 112px; }
.selected-filter[aria-pressed="true"] { background: var(--soft); color: #3b4e29; border-color: var(--accent); }
.cuisine-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 29px; }
.filter { border: 1px solid var(--line); padding: 8px 13px; background: transparent; color: #5c6457; font-size: 12px; line-height: 1.35; border-radius: 20px; }
.filter:hover { background: var(--soft); }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.recipe-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 23px 20px; }
.recipe-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.recipe-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.recipe-photo { position: relative; display: block; width: 100%; height: 170px; background: #e9ecdf; border: 0; border-radius: 0; padding: 0; overflow: hidden; }
.photo-placeholder { position: absolute; inset: 0; display: grid; place-items: center; }
.photo-placeholder img { width: 46px; height: 46px; opacity: .35; }
.food-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .22s; }
@media (hover: hover) { .recipe-photo:hover .food-photo { transform: scale(1.035); } }
.recipe-select { position: absolute; top: 11px; right: 11px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; }
.recipe-select input { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; appearance: none; background: rgb(255 255 255 / .96); border: 1px solid rgb(67 77 55 / .18); border-radius: 50%; cursor: pointer; box-shadow: 0 1px 5px rgb(34 43 25 / .10); }
.recipe-select input:checked { background: var(--accent); border-color: var(--accent); }
.check-mark { position: relative; pointer-events: none; color: #fff; font-size: 18px; font-weight: 600; opacity: 0; }
.recipe-select input:checked + .check-mark { opacity: 1; }
.recipe-body { padding: 16px 16px 17px; }
.recipe-cuisine { color: var(--accent); font-size: 11px; line-height: 1.3; text-transform: uppercase; letter-spacing: 1.1px; font-weight: 600; margin: 0 0 7px; }
.recipe-body h2 { margin: 0 0 10px; line-height: 1.3; }
.recipe-title { display: block; text-align: left; color: var(--ink); border: 0; border-radius: 0; background: none; font: 19px/1.3 Georgia, "Times New Roman", serif; letter-spacing: -.2px; padding: 0; overflow-wrap: anywhere; }
.recipe-title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.recipe-meta { color: var(--muted); font-size: 11px; margin: 0; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 180px; color: var(--muted); font-size: 14px; }
.loading-dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.notice { padding: 16px; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; line-height: 1.5; }
.error { color: #953d33; background: #fff4f1; border-color: #e8c6c0; }
.notice p { margin-bottom: 12px; }
.empty-state { max-width: 430px; margin: 45px auto; padding: 25px 0; text-align: center; }
.empty-state h2 { font: 27px/1.3 Georgia, serif; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.6; color: var(--muted); margin-bottom: 22px; }
.empty-state > img { margin-bottom: 20px; }
.selection-bar { position: fixed; z-index: 20; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 28px; width: min(590px, calc(100% - 36px)); padding: 14px 16px 14px 21px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 28px rgb(38 48 31 / .15); }
.selection-summary { display: flex; align-items: center; gap: 15px; font-size: 13px; font-weight: 500; }
.clear-selection { border: 0; background: transparent; font-size: 12px; color: var(--muted); padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }
.selection-bar .button { flex: none; }
.text-link { font-size: 13px; color: var(--accent); text-underline-offset: 4px; }
.shopping-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.shopping-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.shopping-recipes { color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 850px; margin-bottom: 27px; }
.shopping-groups { max-width: 800px; display: grid; gap: 27px; }
.shopping-group h2 { font: 24px/1.3 Georgia, serif; margin: 0 0 9px; }
.shopping-group ul { padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--line); }
.shopping-group li { border-bottom: 1px solid var(--line); }
.shopping-item { display: flex; align-items: center; gap: 14px; min-height: 57px; padding: 12px 2px; cursor: pointer; font-size: 15px; }
.shopping-item input { appearance: none; width: 22px; height: 22px; flex: none; border: 1px solid #a6af9a; border-radius: 5px; background: var(--surface); margin: 0; display: grid; place-items: center; cursor: pointer; }
.shopping-item input:checked { background: var(--accent); border-color: var(--accent); }
.shopping-item input:checked::after { content: '✓'; color: #fff; font-size: 15px; }
.shopping-item:has(input:checked) .ingredient-name { text-decoration: line-through; color: var(--muted); }
.shopping-item:has(input:checked) .ingredient-amount { color: var(--muted); }
.ingredient-name { overflow-wrap: anywhere; }
.ingredient-amount { margin-left: auto; text-align: right; color: #45543b; font-variant-numeric: tabular-nums; flex: none; }
.local-notice { color: var(--muted); font-size: 11px; margin: 32px 0 0; }
dialog { color: var(--ink); background: var(--surface); }
dialog::backdrop { background: rgb(25 33 22 / .55); }
.recipe-dialog { width: min(720px, calc(100% - 32px)); max-height: calc(100dvh - 40px); border: 0; padding: 0; border-radius: 15px; overflow-y: auto; overscroll-behavior: contain; }
.close-dialog { position: absolute; right: 14px; top: 14px; z-index: 1; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: rgb(255 255 255 / .95); color: var(--ink); font-size: 27px; line-height: 1; }
.detail-image { width: 100%; height: 275px; object-fit: cover; display: block; }
.detail-body { padding: 30px 34px 35px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; margin-bottom: 11px; padding-right: 25px; }
.detail-body h2 { font: 35px/1.15 Georgia, serif; letter-spacing: -.6px; margin-bottom: 21px; overflow-wrap: anywhere; }
.detail-section { margin-top: 29px; }
.detail-section h3 { font: 23px/1.3 Georgia, serif; margin-bottom: 12px; }
.detail-ingredients { padding: 0; margin: 0; list-style: none; }
.detail-ingredients li { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.detail-ingredients li > span:first-child { overflow-wrap: anywhere; }
.detail-instructions { white-space: pre-wrap; font-size: 15px; line-height: 1.85; overflow-wrap: anywhere; }
.copy-dialog { width: min(560px, calc(100% - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 12px; }
.copy-dialog h2 { font: 28px/1.2 Georgia, serif; }
.copy-dialog p { color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.field input, .field select, .field textarea { border: 1px solid var(--line); padding: 12px; background: var(--surface); color: var(--ink); min-width: 0; width: 100%; font-size: 16px; }
.copy-dialog textarea { resize: vertical; margin-bottom: 16px; }
.toast { position: fixed; z-index: 40; bottom: 105px; left: 50%; transform: translateX(-50%); max-width: min(480px, calc(100% - 36px)); width: max-content; padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 8px; font-size: 14px; box-shadow: 0 4px 16px rgb(0 0 0 / .15); }
@media (max-width: 960px) {
  .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .site-header { gap: 28px; }
}
@media (max-width: 680px) {
  .site-header { padding: 18px 18px 0; gap: 18px; flex-wrap: wrap; }
  .brand { font-size: 29px; }
  .brand img { width: 33px; height: 33px; }
  .manage-link { font-size: 12px; order: 1; }
  .main-nav { width: 100%; order: 2; gap: 26px; padding-top: 1px; }
  .main-nav a { font-size: 13px; padding: 10px 0 14px; }
  .main-nav a[aria-current="page"]::after { bottom: -1px; }
  .page-shell { padding: 27px 18px 110px; }
  .page-heading { margin-bottom: 21px; }
  .page-heading h1 { font-size: 35px; letter-spacing: -.8px; }
  .search-row { gap: 9px; margin-bottom: 15px; }
  .search-field { padding: 0 11px; gap: 8px; }
  .search-field input { font-size: 16px; padding: 12px 0; }
  .search-field svg { width: 17px; height: 17px; }
  .selected-filter { min-width: 80px; font-size: 12px; padding: 10px; }
  .cuisine-filters { gap: 7px; margin-bottom: 24px; }
  .filter { padding: 8px 11px; font-size: 11px; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .recipe-photo { height: 132px; }
  .recipe-card { border-radius: 10px; }
  .recipe-body { padding: 12px 12px 14px; }
  .recipe-title { font-size: 17px; line-height: 1.3; }
  .recipe-cuisine { font-size: 11px; letter-spacing: .6px; margin-bottom: 6px; }
  .recipe-meta { font-size: 11px; }
  .recipe-select { width: 31px; height: 31px; top: 8px; right: 8px; }
  .selection-bar { bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100% - 24px); padding: 11px 12px; gap: 12px; }
  .selection-summary { display: block; font-size: 12px; }
  .selection-summary > span { display: block; }
  .clear-selection { padding: 3px 0; font-size: 11px; }
  .selection-bar .button { padding: 10px 13px; font-size: 13px; }
  .shopping-toolbar { flex-direction: column; align-items: flex-start; }
  .shopping-actions { width: 100%; gap: 6px; }
  .shopping-actions .button { font-size: 12px; padding: 9px 12px; }
  .shopping-item { font-size: 14px; gap: 11px; }
  .shopping-group h2 { font-size: 23px; }
  .recipe-dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 12px; }
  .detail-image { height: 210px; }
  .detail-body { padding: 24px 21px 30px; }
  .detail-body h2 { font-size: 29px; }
  .detail-instructions { font-size: 14px; }
  .ingredient-amount { max-width: 42%; overflow-wrap: anywhere; }
}
@media (max-width: 360px) {
  .site-header { padding-left: 14px; padding-right: 14px; }
  .page-shell { padding-left: 14px; padding-right: 14px; }
  .recipe-grid { gap: 14px 10px; }
  .recipe-body { padding: 11px 10px 13px; }
  .recipe-title { font-size: 16px; }
  .search-field svg { display: none; }
  .search-field input { font-size: 14px; }
  .page-heading .text-link { font-size: 11px; }
}
@media (pointer: coarse) {
  .filter { min-height: 40px; }
  .recipe-select::before { content: ''; position: absolute; inset: -6px; }
  .recipe-title { min-height: 44px; }
  .clear-selection { min-height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
@media print {
  :root { background: #fff; color: #000; }
  body { background: #fff; color: #000; }
  .site-header, .no-print, #recipes-view, .skip-link, dialog, .local-notice { display: none !important; }
  #shopping-view { display: block !important; }
  .page-shell { max-width: none; padding: 0; }
  .page-heading { margin-bottom: 18px; }
  .page-heading h1 { font-size: 28px; }
  .shopping-groups { display: block; max-width: none; }
  .shopping-group { break-inside: avoid; margin-bottom: 22px; }
  .shopping-group h2 { font-size: 20px; }
  .shopping-recipes { font-size: 11px; color: #444; }
  .shopping-item { min-height: 0; padding: 8px 0; font-size: 12px; }
  .shopping-item input { width: 14px; height: 14px; border: 1px solid #777; print-color-adjust: exact; }
  .ingredient-amount { color: #000; }
  #shopping-empty img, #shopping-empty .button { display: none; }
}
