:root {
  --ink: #142137;
  --ink-soft: #526178;
  --navy: #10233f;
  --navy-2: #1b3c67;
  --berry: #c44b58;
  --berry-dark: #9f3442;
  --cream: #f7f4ee;
  --paper: #fffefb;
  --line: #e7e2da;
  --gold: #e9a83c;
  --shadow: 0 18px 55px rgba(17, 35, 62, .12);
  --radius-lg: 28px;
  --radius-md: 20px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; background: var(--cream); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; max-width: 100%; min-height: 100vh; overflow-x: hidden; color: var(--ink); background: var(--cream); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:disabled { opacity: .62; cursor: not-allowed; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell, main, #app-view { max-width: 100%; }
.app-shell { min-height: 100vh; }
.side-nav { display: none; }
main { min-height: 100vh; padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
.mobile-header { position: sticky; z-index: 20; top: 0; min-height: calc(72px + max(16px, env(safe-area-inset-top))); display: flex; align-items: center; justify-content: space-between; padding: max(16px, env(safe-area-inset-top)) 20px 0; background: rgba(247,244,238,.94); backdrop-filter: blur(16px); }
.brand { appearance: none; border: 0; background: none; padding: 0; display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 20px; cursor: pointer; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; display: block; object-fit: cover; background: var(--navy); box-shadow: 0 8px 20px rgba(16, 35, 63, .18); }
.round-button, .icon-button { appearance: none; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; cursor: pointer; }
.round-button { width: 42px; height: 42px; border-radius: 50%; box-shadow: 0 8px 24px rgba(20, 33, 55, .08); }
.mobile-actions { display: flex; align-items: center; gap: 9px; }
.mobile-account { width: 42px; height: 42px; border: 0; border-radius: 50%; color: white; background: var(--berry); font-weight: 850; cursor: pointer; }
.icon-button { width: 42px; height: 42px; border-radius: 14px; }
.bottom-nav { position: fixed; z-index: 30; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px; border: 1px solid rgba(255,255,255,.68); border-radius: 22px; background: rgba(255, 254, 251, .92); box-shadow: 0 18px 45px rgba(16, 35, 63, .18); backdrop-filter: blur(18px); }
.nav-item { appearance: none; border: 0; background: transparent; padding: 9px 6px; border-radius: 15px; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #728097; font-size: 12px; font-weight: 700; cursor: pointer; }
.nav-item svg { width: 21px; height: 21px; }
.nav-item.is-active { color: var(--navy); background: #eef2f6; }

.page { width: min(1180px, 100%); margin: 0 auto; padding: 8px 18px 40px; }
.home-top { padding: 16px 0 18px; }
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 800; color: var(--berry); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { text-wrap: balance; }
h1 { margin-bottom: 18px; max-width: 760px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 7vw, 58px); line-height: 1.01; letter-spacing: -.035em; }
h2 { font-size: 26px; letter-spacing: -.025em; }
h3 { font-size: 19px; }
.lede { color: var(--ink-soft); font-size: 17px; line-height: 1.6; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: #7a8798; }
.search-wrap input { width: 100%; height: 54px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); padding: 0 48px; outline: none; color: var(--ink); box-shadow: 0 10px 25px rgba(20, 33, 55, .05); }
.search-wrap input:focus { border-color: var(--navy-2); box-shadow: 0 0 0 4px rgba(27, 60, 103, .1); }
.stock-search-wrap { margin: 0 0 18px; }
.chips { display: flex; gap: 9px; overflow-x: auto; padding: 14px 2px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; appearance: none; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; background: transparent; font-size: 14px; font-weight: 750; cursor: pointer; }
.chip-favorite { display: inline-flex; align-items: center; gap: 7px; }
.chip-favorite svg { width: 17px; height: 17px; }
.chip-favorite.is-active svg { fill: currentColor; }
.chip.is-active { color: white; border-color: var(--navy); background: var(--navy); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 22px 0 14px; }
.section-head h2 { margin: 0 0 3px; }
.section-head span { color: var(--ink-soft); font-size: 14px; }
.section-actions { display: flex; gap: 8px; }
.section-actions .button-primary { display: none; }
.recipe-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.recipe-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: 0 12px 35px rgba(20, 33, 55, .06); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-photo { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(135deg, #bd8640, #f3cc83); }
.card-photo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.recipe-placeholder { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; color: rgba(255,255,255,.94); }
.recipe-placeholder span { position: absolute; left: 18px; top: 16px; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; font-weight: 850; }
.recipe-placeholder strong { font-family: Georgia, serif; font-size: clamp(72px, 15vw, 132px); font-weight: 500; opacity: .22; transform: translateY(8px); }
.tone-green { background: linear-gradient(135deg, #224d45, #80aa74); }
.tone-gold { background: linear-gradient(135deg, #9a592e, #dfaa58); }
.tone-berry { background: linear-gradient(135deg, #7d3041, #d36d72); }
.tone-sky { background: linear-gradient(135deg, #245068, #78aeba); }
.tone-navy { background: linear-gradient(135deg, #172f50, #55758f); }
.card-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(9, 21, 37, .28)); pointer-events: none; }
.favorite-button { position: absolute; z-index: 2; top: 13px; right: 13px; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.72); border-radius: 14px; display: grid; place-items: center; color: var(--navy); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); cursor: pointer; }
.favorite-button.is-active { color: white; background: var(--berry); border-color: var(--berry); }
.favorite-button.is-active svg { fill: currentColor; }
.card-body { padding: 18px; }
.card-kicker { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; color: var(--berry); text-transform: uppercase; letter-spacing: .09em; font-size: 12px; font-weight: 850; }
.rating { display: flex; align-items: center; gap: 4px; color: var(--gold); letter-spacing: 0; }
.rating svg { width: 16px; height: 16px; fill: currentColor; stroke-width: 1.5; }
.card-body h3 { margin-bottom: 12px; font-family: Georgia, "Times New Roman", serif; font-size: 26px; line-height: 1.1; }
.meta-row { display: flex; flex-wrap: wrap; gap: 14px; color: var(--ink-soft); font-size: 14px; }
.meta { display: flex; align-items: center; gap: 6px; }
.meta svg { width: 17px; height: 17px; }

.empty-state { border: 1px dashed #cfd5dd; border-radius: var(--radius-lg); padding: 42px 24px; text-align: center; background: rgba(255,255,255,.45); }
.empty-state .empty-icon { width: 58px; height: 58px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; color: var(--berry); background: #fae9ea; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { max-width: 440px; margin: 0 auto 20px; color: var(--ink-soft); line-height: 1.55; }

.detail-page { padding-top: 2px; }
.detail-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.detail-actions-right { display: flex; gap: 8px; }
.detail-actions .favorite-button { position: static; }
.detail-hero { position: relative; min-height: 300px; border-radius: 30px; overflow: hidden; background: var(--navy); box-shadow: var(--shadow); }
.detail-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.detail-hero .recipe-placeholder span { left: 24px; top: 22px; }
.detail-hero .recipe-placeholder strong { font-size: clamp(150px, 38vw, 360px); }
.detail-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,15,27,.05) 25%, rgba(6,15,27,.83)); }
.detail-title { position: absolute; z-index: 1; left: 22px; right: 22px; bottom: 22px; color: white; }
.detail-title .eyebrow { color: #ffd391; }
.detail-title h1 { margin: 0 0 12px; font-size: clamp(36px, 8vw, 62px); }
.detail-title .meta-row { color: rgba(255,255,255,.88); }
.rating-button { appearance: none; border: 0; padding: 0; color: var(--gold); background: transparent; cursor: pointer; }
.rating-picker { margin-top: 14px; padding: 15px 18px; border: 1px solid #f0d49f; border-radius: 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #fff8e9; }
.rating-picker strong, .rating-picker span { display: block; }
.rating-picker span { margin-top: 3px; color: var(--ink-soft); font-size: 13px; }
.rating-stars { display: flex; gap: 3px; }
.rating-stars button { width: 38px; height: 38px; border: 0; padding: 0; display: grid; place-items: center; color: #c7ccd3; background: transparent; cursor: pointer; }
.rating-stars button.is-active { color: var(--gold); }
.rating-stars svg { width: 25px; height: 25px; fill: currentColor; }
.detail-layout { display: grid; gap: 20px; margin-top: 20px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); padding: 22px; box-shadow: 0 10px 30px rgba(20,33,55,.045); }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-title h2 { margin: 0; }
.panel-hint { margin: -7px 0 10px; color: var(--ink-soft); font-size: 13px; line-height: 1.45; }
.ingredients-shopping-button { min-height: 42px; margin: 0 0 9px; padding: 0 14px; font-size: 13px; }
.servings-control { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 5px; background: var(--cream); }
.servings-control button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: white; cursor: pointer; }
.servings-control span { min-width: 26px; text-align: center; font-weight: 800; }
.ingredient-list { display: grid; gap: 4px; }
.ingredient { display: flex; gap: 12px; align-items: flex-start; padding: 11px 6px; border-bottom: 1px solid #f0ece6; cursor: pointer; line-height: 1.45; }
.ingredient:last-child { border-bottom: 0; }
.ingredient input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { flex: 0 0 23px; width: 23px; height: 23px; display: grid; place-items: center; border: 1.5px solid #bcc5d0; border-radius: 8px; color: white; }
.checkmark svg { width: 15px; height: 15px; opacity: 0; }
.ingredient input:checked + .checkmark { background: var(--navy); border-color: var(--navy); }
.ingredient input:checked + .checkmark svg { opacity: 1; }
.ingredient input:checked ~ span:last-child { color: #8d97a4; text-decoration: line-through; }
.step-list { counter-reset: steps; display: grid; gap: 12px; }
.step { position: relative; padding: 4px 0 5px 47px; min-height: 38px; line-height: 1.6; }
.step::before { counter-increment: steps; content: counter(steps); position: absolute; left: 0; top: 0; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--berry); font-weight: 850; }
.note { margin-top: 18px; padding: 15px 0 0; border-top: 1px solid var(--line); color: var(--ink-soft); line-height: 1.55; }
.note strong { color: var(--ink); }
.sticky-cook { position: sticky; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 4; margin-top: 18px; }

.button { min-height: 48px; border: 0; border-radius: 16px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 800; cursor: pointer; transition: transform .15s ease, background .15s ease; }
.button:active { transform: scale(.98); }
.button svg { width: 19px; height: 19px; }
.button-primary { color: white; background: var(--navy); box-shadow: 0 12px 30px rgba(16,35,63,.2); }
.button-primary:hover { background: var(--navy-2); }
.button-secondary { color: white; background: var(--berry); }
.button-ghost { border: 1px solid var(--line); background: var(--paper); }
.button-wide { width: 100%; }
.button-compact { min-height: 42px; border-radius: 14px; padding: 0 15px; font-size: 14px; }
.text-button { border: 0; padding: 6px; color: var(--berry-dark); background: none; font-weight: 750; cursor: pointer; }

.utility-page { padding-top: 18px; }
.utility-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.utility-heading h1 { margin-bottom: 10px; }
.utility-heading .lede { max-width: 650px; margin-bottom: 0; }
.summary-card { flex: 0 0 auto; min-width: 128px; padding: 16px 18px; border-radius: 20px; color: white; background: var(--berry); box-shadow: 0 14px 30px rgba(196,75,88,.2); }
.summary-card strong, .summary-card span { display: block; }
.summary-card strong { font-family: Georgia, serif; font-size: 38px; line-height: .95; }
.summary-card span { margin-top: 7px; font-size: 13px; }
.quick-add { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: 0 10px 30px rgba(20,33,55,.05); }
.quick-add-name { grid-column: 1 / -1; }
.quick-add label { display: grid; gap: 6px; }
.quick-add label > span { color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.quick-add input, .quick-add select { width: 100%; min-width: 0; height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 0 13px; color: var(--ink); background: white; outline: none; }
.quick-add input:focus, .quick-add select:focus { border-color: var(--navy-2); box-shadow: 0 0 0 4px rgba(27,60,103,.1); }
.quick-add .button { grid-column: 1 / -1; }
.shopping-quick-add .stock-form-head, .shopping-date-field { grid-column: 1 / -1; }
.shopping-date-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.shopping-date-field legend { margin-bottom: 7px; padding: 0; color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.shopping-date-picker { position: relative; display: flex; gap: 7px; overflow-x: auto; padding: 2px 1px 5px; scrollbar-width: none; }
.shopping-date-picker::-webkit-scrollbar { display: none; }
.date-chip { flex: 0 0 auto; min-height: 39px; border: 1px solid var(--line); border-radius: 999px; padding: 0 13px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); background: white; font-size: 13px; font-weight: 750; cursor: pointer; }
.date-chip svg { width: 17px; height: 17px; }
.date-chip.is-active { color: white; border-color: var(--berry); background: var(--berry); box-shadow: 0 7px 17px rgba(196,75,88,.2); }
.shopping-custom-date { position: absolute; right: 0; bottom: 0; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.shopping-layout { display: grid; gap: 16px; margin-top: 18px; }
.shopping-groups { display: grid; gap: 20px; }
.shopping-group { min-width: 0; }
.shopping-group + .shopping-group { padding-top: 18px; border-top: 1px solid var(--line); }
.shopping-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.shopping-group-head h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 23px; }
.shopping-group-head span { color: var(--ink-soft); font-size: 13px; }
.list-panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); box-shadow: 0 10px 30px rgba(20,33,55,.045); }
.shopping-list { display: grid; gap: 7px; }
.shopping-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 11px; min-height: 66px; padding: 9px 4px; border-top: 1px solid #f0ece6; }
.shopping-row:first-child { border-top: 0; }
.shopping-check { width: 38px; height: 38px; border: 1.5px solid #b8c2cf; border-radius: 13px; display: grid; place-items: center; color: transparent; background: white; cursor: pointer; }
.shopping-check svg { width: 19px; height: 19px; }
.shopping-row.is-completed .shopping-check { color: white; border-color: var(--navy); background: var(--navy); }
.shopping-copy { min-width: 0; }
.shopping-copy strong, .shopping-copy span { display: block; }
.shopping-copy strong { overflow-wrap: anywhere; font-size: 16px; line-height: 1.35; }
.shopping-copy span { margin-top: 4px; color: var(--ink-soft); font-size: 13px; }
.shopping-copy span b { color: var(--berry-dark); }
.shopping-row.is-completed .shopping-copy strong { color: #8a94a1; text-decoration: line-through; }
.shopping-row-actions { display: flex; align-items: center; gap: 2px; }
.shopping-date-button, .shopping-delete { width: 38px; height: 38px; border: 0; background: transparent; }
.shopping-date-button { width: 38px; height: 38px; color: var(--navy-2); background: transparent; }
.shopping-delete { color: #7b8797; }
.shopping-row-actions svg { width: 19px; height: 19px; }
.completed-panel { align-self: start; }
.muted-copy { margin: 8px 0 0; color: var(--ink-soft); line-height: 1.55; }
.compact-empty { display: grid; justify-items: center; padding: 32px 12px 18px; text-align: center; color: var(--ink-soft); }
.compact-empty > svg { width: 34px; height: 34px; margin-bottom: 12px; color: var(--berry); }
.compact-empty h3 { margin-bottom: 5px; color: var(--ink); }
.compact-empty p { margin: 0; }
.stock-summary { background: var(--navy); }
.stock-tabs { display: flex; gap: 7px; overflow-x: auto; margin: 0 0 18px; padding: 3px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.58); scrollbar-width: none; }
.stock-tabs::-webkit-scrollbar { display: none; }
.stock-tabs button, .period-switch button, .inventory-zones button { flex: 1 0 auto; min-height: 42px; border: 0; border-radius: 13px; padding: 0 14px; color: var(--ink-soft); background: transparent; font-size: 13px; font-weight: 800; cursor: pointer; }
.stock-tabs button.is-active, .period-switch button.is-active, .inventory-zones button.is-active { color: white; background: var(--navy); }
.stock-availability { display: flex; gap: 7px; overflow-x: auto; margin: -7px 0 16px; padding: 2px 1px 5px; scrollbar-width: none; }
.stock-availability::-webkit-scrollbar { display: none; }
.stock-availability button { flex: 0 0 auto; min-height: 39px; border: 1px solid var(--line); border-radius: 999px; padding: 0 13px; color: var(--ink-soft); background: var(--paper); font-size: 13px; font-weight: 800; cursor: pointer; }
.stock-availability button span { margin-left: 4px; opacity: .72; }
.stock-availability button.is-active { color: white; border-color: var(--navy); background: var(--navy); }
.stock-mode-panel { display: grid; gap: 18px; }
.mode-panel-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 15px; }
.mode-panel-head h2 { margin-bottom: 5px; }
.mode-panel-head p { margin: 0; color: var(--ink-soft); line-height: 1.5; }
.mode-panel-head small { display: block; margin-top: 7px; color: var(--ink-soft); }
.period-switch, .inventory-zones { display: flex; gap: 5px; overflow-x: auto; padding: 4px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); scrollbar-width: none; }
.period-switch button { flex: 0 0 auto; min-height: 36px; padding: 0 11px; }
.analytics-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.analytics-summary > div { min-width: 0; padding: 15px 12px; border-radius: 18px; color: white; background: var(--navy); }
.analytics-summary > div:nth-child(2) { background: var(--navy-2); }
.analytics-summary > div:nth-child(3) { background: var(--berry); }
.analytics-summary strong, .analytics-summary span { display: block; }
.analytics-summary strong { font-family: Georgia, serif; font-size: 30px; }
.analytics-summary span { margin-top: 3px; overflow-wrap: anywhere; font-size: 11px; }
.analytics-head { display: none; }
.analytics-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; padding: 14px 2px; border-top: 1px solid #f0ece6; }
.analytics-row:first-of-type { border-top: 0; }
.analytics-row > strong { grid-column: 1 / -1; font-size: 16px; }
.analytics-row span { display: grid; gap: 2px; font-weight: 750; }
.analytics-row span::before { content: attr(data-label); color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.movement-list { display: grid; }
.movement-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 2px; border-top: 1px solid #f0ece6; }
.movement-row:first-child { border-top: 0; }
.movement-row > div { min-width: 0; }
.movement-row strong, .movement-row span, .movement-row small { display: block; }
.movement-row span, .movement-row small { margin-top: 3px; color: var(--ink-soft); font-size: 12px; line-height: 1.35; }
.movement-row b { flex: 0 0 auto; color: var(--ink-soft); }
.movement-row .movement-add { color: #287451; }
.movement-row .movement-use, .movement-row .movement-writeoff { color: var(--berry-dark); }
.inventory-zones { margin-top: -5px; }
.inventory-zones button { flex: 0 0 auto; min-height: 38px; }
.inventory-form { display: grid; gap: 14px; }
.inventory-list { display: grid; gap: 10px; }
.inventory-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 8px 24px rgba(20,33,55,.04); }
.inventory-copy { grid-column: 1 / -1; }
.inventory-copy strong, .inventory-copy span { display: block; }
.inventory-copy span { margin-top: 4px; color: var(--ink-soft); font-size: 12px; }
.inventory-row label { display: grid; gap: 6px; min-width: 0; }
.inventory-row label > span { color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.inventory-row select, .quantity-field { width: 100%; height: 45px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: white; }
.inventory-row select { min-width: 0; padding: 0 9px; }
.quantity-field { display: flex; align-items: center; overflow: hidden; }
.quantity-field input { width: 100%; min-width: 0; height: 100%; border: 0; padding: 0 10px; outline: none; background: transparent; }
.quantity-field span { padding-right: 10px; color: var(--ink-soft); font-size: 12px; }
.inventory-zero { justify-self: start; padding-left: 0; }
.inventory-difference { justify-self: end; align-self: center; color: var(--ink-soft); font-size: 13px; font-weight: 800; }
.inventory-difference.is-positive { color: #287451; }
.inventory-difference.is-negative { color: var(--berry-dark); }
.inventory-save { position: sticky; z-index: 5; bottom: calc(88px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid rgba(255,255,255,.75); border-radius: 20px; background: rgba(255,254,251,.94); box-shadow: 0 14px 40px rgba(16,35,63,.15); backdrop-filter: blur(16px); }
.inventory-save p { display: none; margin: 0; color: var(--ink-soft); font-size: 13px; }
.inventory-save .button { width: 100%; }
.stock-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 26px; background: var(--paper); box-shadow: 0 10px 30px rgba(20,33,55,.05); }
.stock-form.is-editing { scroll-margin-top: 8px; border-color: var(--berry); box-shadow: 0 0 0 4px rgba(196,75,88,.1), 0 10px 30px rgba(20,33,55,.05); }
.stock-form-head, .stock-name, .stock-form > .button { grid-column: 1 / -1; }
.stock-form-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stock-form-tools { display: flex; align-items: center; gap: 7px; }
.scan-stock-button { min-height: 38px; border: 1px solid #d5dde7; border-radius: 13px; padding: 0 11px; display: inline-flex; align-items: center; gap: 7px; color: var(--navy); background: #eef3f8; font-size: 13px; font-weight: 800; cursor: pointer; }
.scan-stock-button svg { width: 18px; height: 18px; }
.stock-form-head h2 { margin: 0; font-size: 21px; }
.stock-form label { display: grid; gap: 6px; min-width: 0; }
.stock-form label > span { color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.stock-form input, .stock-form select { width: 100%; min-width: 0; height: 48px; border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; color: var(--ink); background: white; outline: none; }
.stock-form input:focus, .stock-form select:focus { border-color: var(--navy-2); box-shadow: 0 0 0 4px rgba(27,60,103,.1); }
.stock-zones { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.zone-card { min-height: 92px; border: 2px solid transparent; border-radius: 20px; padding: 15px; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between; color: white; text-align: left; cursor: pointer; box-shadow: 0 10px 26px rgba(20,33,55,.08); }
.zone-card > div { display: flex; align-items: center; justify-content: space-between; }
.zone-card > div strong { font-size: 24px; }
.zone-card > span { font-size: 14px; font-weight: 800; }
.zone-card.is-active { border-color: white; outline: 3px solid var(--berry); }
.zone-all { color: var(--ink); background: var(--paper); border-color: var(--line); }
.zone-all strong, .zone-all span { display: block; }
.zone-all strong { font-family: Georgia, serif; font-size: 30px; line-height: 1; }
.zone-all.is-active { border-color: var(--navy); outline: 0; }
.stock-list-panel { margin-top: 0; }
.stock-list { display: grid; }
.stock-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 13px 2px; border-top: 1px solid #f0ece6; }
.stock-row:first-child { border-top: 0; }
.stock-row.is-zero { opacity: .68; }
.stock-item-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; color: white; font-family: Georgia, serif; font-size: 21px; }
.stock-copy { min-width: 0; }
.stock-copy > div { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.stock-copy strong { overflow-wrap: anywhere; font-size: 16px; }
.stock-copy > span { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 13px; line-height: 1.4; }
.stock-amount { min-width: 56px; text-align: right; }
.stock-amount strong, .stock-amount span { display: block; }
.stock-amount strong { font-size: 18px; }
.stock-amount span { color: var(--ink-soft); font-size: 13px; }
.stock-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.stock-actions .icon-button { width: 38px; height: 38px; color: #6f7d90; background: transparent; }
.stock-action-button { min-height: 38px; border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; color: var(--ink-soft); background: white; font-size: 12px; font-weight: 800; cursor: pointer; }
.stock-action-button.is-add { color: #287451; background: #eff8f3; border-color: #d9ebdf; }
.expiry-badge, .stock-date { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 3px 8px; color: #7a5a13; background: #fff3cf; font-size: 12px; font-weight: 800; }
.expiry-badge.is-urgent { color: #933844; background: #fbe5e8; }
.expiry-badge.is-expired { color: white; background: var(--berry-dark); }
.stock-date { color: var(--ink-soft); background: #f0f2f5; font-weight: 700; }

.import-page { padding-top: 18px; }
.import-intro { max-width: 670px; margin-bottom: 22px; }
.dropzone { min-height: 260px; border: 2px dashed #bcc6d2; border-radius: 30px; display: grid; place-items: center; padding: 32px; text-align: center; background: rgba(255,255,255,.48); transition: border .2s, background .2s; }
.dropzone.is-dragging { border-color: var(--berry); background: #fff5f4; }
.dropzone-inner { max-width: 460px; }
.upload-icon { width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; color: white; background: var(--berry); box-shadow: 0 12px 28px rgba(196,75,88,.25); }
.upload-icon svg { width: 28px; height: 28px; }
.dropzone h2 { margin-bottom: 8px; }
.dropzone p { margin-bottom: 20px; color: var(--ink-soft); line-height: 1.55; }
.dropzone .upload-hint { margin: 12px 0 0; font-size: 13px; }
.format-list { margin-top: 18px; display: grid; gap: 10px; }
.format-row { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 14px; }
.format-row svg { width: 18px; height: 18px; color: var(--berry); }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(8, 20, 37, .56); backdrop-filter: blur(7px); }
.recipe-dialog { width: min(680px, calc(100% - 24px)); max-height: calc(100dvh - 24px); margin: auto; padding: 0; border: 0; border-radius: 28px; background: var(--paper); box-shadow: 0 30px 80px rgba(6,15,27,.32); }
.recipe-dialog form { padding: 24px; display: grid; gap: 17px; overflow: auto; max-height: calc(100dvh - 24px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; font-family: Georgia, serif; font-size: 32px; }
.recipe-dialog label { display: grid; gap: 7px; color: var(--ink); font-size: 14px; font-weight: 750; }
.recipe-dialog input, .recipe-dialog textarea, .recipe-dialog select { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; color: var(--ink); background: white; outline: none; resize: vertical; }
.recipe-dialog input:focus, .recipe-dialog textarea:focus, .recipe-dialog select:focus { border-color: var(--navy-2); box-shadow: 0 0 0 4px rgba(27,60,103,.1); }
.compact-dialog { width: min(520px, calc(100% - 24px)); }
.dialog-copy { margin: -5px 0 0; color: var(--ink-soft); line-height: 1.5; }
.ingredients-selection-tools .text-button { font-size: 13px; }
.ingredients-shopping-list { display: grid; min-height: 96px; max-height: min(42dvh, 480px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 17px; padding: 5px 12px; background: white; }
.ingredient-shopping-row { display: flex !important; grid-template-columns: none !important; flex-direction: row; align-items: flex-start; gap: 10px !important; padding: 11px 2px; border-bottom: 1px solid #f0ece6; cursor: pointer; font-weight: 500 !important; line-height: 1.4; }
.ingredient-shopping-row:last-child { border-bottom: 0; }
.ingredient-shopping-row input { position: absolute; opacity: 0; pointer-events: none; }
.ingredient-shopping-row input:checked + .checkmark { color: white; border-color: var(--navy); background: var(--navy); }
.ingredient-shopping-row input:checked + .checkmark svg { opacity: 1; }
.ingredient-shopping-row > span:last-child { min-width: 0; }
.ingredient-shopping-row strong, .ingredient-shopping-row small { display: block; }
.ingredient-shopping-row strong { font-weight: 600; }
.ingredient-shopping-row small { margin-top: 4px; color: #287451; font-size: 12px; font-weight: 750; }
.ingredients-selection-tools { display: flex; justify-content: flex-end; gap: 10px; margin: -8px 0 -8px; }
.dialog-date-field { padding-top: 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
#ingredients-shopping-form { grid-template-rows: auto auto auto minmax(96px, 1fr) auto auto; overflow: hidden; }
#ingredients-shopping-form .ingredients-shopping-list { min-height: 0; max-height: none; }
#ingredients-shopping-form .dialog-actions { padding-bottom: max(0px, env(safe-area-inset-bottom)); background: var(--paper); }
.barcode-dialog { width: min(590px, calc(100% - 24px)); }
.barcode-camera { position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 20px; background: #071322; }
.barcode-camera video { width: 100%; height: 100%; display: block; object-fit: cover; }
.barcode-frame { position: absolute; left: 8%; right: 8%; top: 32%; height: 36%; border: 3px solid #f2c274; border-radius: 16px; box-shadow: 0 0 0 999px rgba(5,13,23,.25); }
.barcode-scan-actions { display: flex; gap: 9px; }
.barcode-scan-actions .button { flex: 1; }
.barcode-status { margin: -6px 0 0; padding: 10px 12px; border-radius: 13px; color: var(--ink-soft); background: #f1f3f6; font-size: 13px; line-height: 1.4; }
.barcode-status[data-tone="success"] { color: #226744; background: #eaf6ef; }
.barcode-status[data-tone="notice"] { color: #795817; background: #fff5d9; }
.barcode-status[data-tone="error"] { color: #8f2936; background: #fae9eb; }
.barcode-manual { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; }
.barcode-manual .button { min-height: 46px; }
.barcode-result { display: grid; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 19px; background: #faf9f6; }
.barcode-source, .barcode-attribution { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.barcode-source { color: #287451; font-weight: 750; }

.cook-dialog { inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: var(--navy); color: white; }
.cook-screen { min-height: 100%; display: flex; flex-direction: column; padding: max(22px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); }
.cook-top { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.cook-top p { margin: 0; color: rgba(255,255,255,.68); font-size: 14px; font-weight: 750; }
.cook-close { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.1); color: white; }
.progress-track { height: 7px; margin-top: 22px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.13); }
.progress-bar { height: 100%; border-radius: inherit; background: #f2c274; transition: width .28s ease; }
.cook-step { flex: 1; display: grid; align-content: center; width: min(720px, 100%); margin: 0 auto; padding: 38px 0; }
.cook-step-number { margin-bottom: 22px; color: #f2c274; font-size: 15px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.cook-step h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(30px, 7vw, 54px); font-weight: 500; line-height: 1.23; }
.cook-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(720px, 100%); margin: 0 auto; }
.cook-nav .button { min-height: 56px; }
.cook-nav .button-ghost { color: white; border-color: rgba(255,255,255,.2); background: rgba(255,255,255,.08); }
.cook-nav .button-secondary { background: #f2c274; color: var(--navy); }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(98px + env(safe-area-inset-bottom)); transform: translate(-50%, 18px); max-width: calc(100% - 30px); padding: 12px 18px; border-radius: 14px; color: white; background: #16263d; box-shadow: 0 12px 40px rgba(0,0,0,.24); font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 700px) {
  .page { padding: 20px 28px 60px; }
  .mobile-header { padding: env(safe-area-inset-top) 28px 0; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-hero { min-height: 440px; }
  .detail-layout { grid-template-columns: minmax(280px, .75fr) minmax(360px, 1.25fr); align-items: start; }
  .sticky-cook { bottom: 24px; }
  .import-page { display: grid; grid-template-columns: .72fr 1.28fr; gap: 36px; align-items: center; min-height: calc(100vh - 130px); }
  .import-intro { margin: 0; }
  .section-actions .button-primary { display: inline-flex; }
  .quick-add { grid-template-columns: minmax(0, 1fr) 130px 120px auto; align-items: end; }
  .quick-add-name { grid-column: auto; }
  .quick-add .button { grid-column: auto; min-height: 48px; }
  .shopping-layout { grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); }
  .stock-zones { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stock-row { grid-template-columns: 44px minmax(0, 1fr) 80px; }
  .stock-actions { grid-column: 2 / -1; }
  .analytics-head, .analytics-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(90px, .7fr)); gap: 12px; align-items: center; }
  .analytics-head { padding: 0 2px 10px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
  .analytics-row > strong { grid-column: auto; }
  .analytics-row span { display: block; }
  .analytics-row span::before { display: none; }
  .inventory-row { grid-template-columns: minmax(190px, 1fr) minmax(130px, .55fr) minmax(160px, .75fr) auto auto; align-items: end; }
  .inventory-copy { grid-column: auto; align-self: center; }
  .inventory-save p { display: block; }
  .inventory-save .button { width: auto; }
}

@media (max-width: 520px) {
  .utility-heading { align-items: flex-start; flex-direction: column; }
  .summary-card { width: 100%; display: flex; align-items: baseline; gap: 9px; }
  .summary-card span { margin-top: 0; }
  .stock-zones { grid-template-columns: 1fr 1fr; }
  .recipe-dialog { width: calc(100% - 20px); max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))); }
  .recipe-dialog form { max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))); padding: 20px 18px; gap: 14px; }
  .dialog-head h2 { font-size: 29px; }
  .dialog-date-field .shopping-date-picker { flex-wrap: wrap; overflow: visible; }
  .dialog-actions { position: sticky; z-index: 2; bottom: 0; margin: 0 -4px -4px; padding: 10px 4px 4px; background: var(--paper); }
  .dialog-actions .button { min-width: 0; padding: 0 14px; }
  .barcode-dialog-actions .button-primary { flex: 1; }
  .barcode-manual { grid-template-columns: 1fr; }
  .barcode-manual .button { width: 100%; }
  .stock-form-head { align-items: flex-start; }
  .stock-form-tools { flex-wrap: wrap; justify-content: flex-end; }
}

@media (min-width: 1024px) {
  .app-shell { display: grid; grid-template-columns: 245px 1fr; }
  .side-nav { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px; border-right: 1px solid var(--line); background: var(--paper); }
  .side-nav nav { display: grid; gap: 6px; margin-top: 48px; }
  .side-nav .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 12px 14px; font-size: 15px; }
  .side-actions { margin-top: auto; display: grid; gap: 8px; }
  .add-recipe-side, .import-recipe-side { min-height: 48px; border-radius: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; cursor: pointer; }
  .add-recipe-side { border: 0; color: white; background: var(--navy); }
  .import-recipe-side { border: 1px solid var(--line); color: var(--navy); background: var(--paper); }
  .account-card { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 9px; }
  .account-avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; color: white; background: var(--berry); font-weight: 850; }
  .account-card strong, .account-card span { display: block; }
  .account-card strong { font-size: 14px; }
  .account-card span { margin-top: 2px; color: var(--ink-soft); font-size: 12px; }
  .account-logout { border: 0; padding: 5px; background: none; color: var(--berry-dark); font-size: 12px; cursor: pointer; }
  .mobile-header, .bottom-nav { display: none; }
  main { padding: 0; }
  .page { padding: 46px 42px 70px; }
  .home-top { display: grid; grid-template-columns: 1fr minmax(330px, .68fr); gap: 38px; align-items: end; padding: 6px 0 26px; }
  .home-top h1 { margin-bottom: 0; }
  .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-actions { margin-bottom: 18px; }
  .detail-hero { min-height: 500px; }
  .detail-title { left: 38px; bottom: 34px; }
  .detail-layout { gap: 24px; }
  .stock-form { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
  .stock-form-head { grid-column: 1 / -1; }
  .stock-name, .stock-form > .button { grid-column: span 2; }
  .stock-form > .button { min-height: 48px; padding: 0 16px; }
  .stock-row { grid-template-columns: 44px minmax(0, 1fr) 80px minmax(390px, auto); }
  .stock-actions { grid-column: auto; flex-wrap: nowrap; }
}

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 15%, rgba(196,75,88,.14), transparent 28%), var(--cream); }
.login-card { width: min(430px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 30px; background: var(--paper); box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 36px; font-size: 20px; font-weight: 850; }
.login-card h1 { margin-bottom: 12px; font-size: clamp(38px, 10vw, 54px); }
.login-copy { margin-bottom: 24px; color: var(--ink-soft); line-height: 1.55; }
.login-card form { display: grid; gap: 16px; }
.login-card label { display: grid; gap: 7px; font-size: 14px; font-weight: 750; }
.login-card input { width: 100%; height: 52px; border: 1px solid var(--line); border-radius: 15px; padding: 0 14px; background: white; outline: none; }
.login-card input:focus { border-color: var(--navy-2); box-shadow: 0 0 0 4px rgba(27,60,103,.1); }
.test-hint { margin: 20px 0 0; padding: 14px; border-radius: 15px; color: var(--ink-soft); background: #f1f3f6; font-size: 14px; line-height: 1.55; }
.login-error { margin: -8px 0 16px; padding: 11px 13px; border-radius: 13px; color: #8f2936; background: #fae9eb; font-size: 14px; }
.server-error { text-align: center; }
.server-error .login-brand { justify-content: center; }
.is-auth-screen .mobile-header, .is-auth-screen .bottom-nav, .is-auth-screen .side-nav { display: none !important; }
.is-auth-screen .app-shell { display: block; }
.is-auth-screen main { padding: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
