:root {
    --ink: #173f35;
    --ink-2: #285b4e;
    --sage: #7f9f89;
    --sage-soft: #dfe9df;
    --cream: #f7f3e9;
    --paper: #fffdf8;
    --coral: #e77c64;
    --coral-soft: #fae4dc;
    --gold: #e4ac4c;
    --gold-soft: #f7e7bc;
    --red: #b84d3b;
    --text: #253b35;
    --muted: #748079;
    --line: #e5e7df;
    --shadow: 0 18px 45px rgba(29, 58, 49, .09);
    --radius: 22px;
    --font: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --serif: "DM Serif Display", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--text); background: var(--cream); font-family: var(--font); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { color: var(--ink); }
h1 { margin-bottom: 10px; font-family: var(--serif); font-size: clamp(2.4rem, 4vw, 4.4rem); font-weight: 400; line-height: .98; letter-spacing: -.035em; }
h1 em { color: var(--coral); font-weight: 400; }
h2 { margin-bottom: 8px; font-family: var(--serif); font-size: clamp(1.65rem, 2.5vw, 2.35rem); font-weight: 400; line-height: 1.1; }
h3 { color: var(--ink); }

.eyebrow { margin: 0 0 10px; color: var(--sage); font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.light { color: #d8e8df; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-size: 1.2rem; font-weight: 700; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px 4px 13px 4px; color: var(--paper); background: var(--coral); font-family: var(--serif); font-size: 1.55rem; font-weight: 400; box-shadow: 0 7px 18px rgba(231, 124, 100, .25); }
.brand-light { color: white; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 9px; padding: 10px 18px; border: 0; border-radius: 13px; font-weight: 700; transition: transform .2s, box-shadow .2s, background .2s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--ink); box-shadow: 0 10px 22px rgba(23, 63, 53, .17); }
.button-primary:hover { background: var(--ink-2); }
.button-accent { color: white; background: var(--coral); box-shadow: 0 10px 22px rgba(231, 124, 100, .2); }
.button-cream { color: var(--ink); background: var(--paper); }
.button-dark { color: white; background: var(--ink); }
.button-ghost { color: var(--ink); background: transparent; border: 1px solid var(--line); box-shadow: none; }
.button-large { width: 100%; min-height: 54px; justify-content: space-between; padding: 13px 20px; }
.button-loading { display: none; }
.is-loading .button-label { display: none; }
.is-loading .button-loading { display: inline; }

.form-stack { display: grid; gap: 17px; }
.form-stack label { display: grid; gap: 7px; color: var(--ink); font-size: .87rem; font-weight: 650; }
.field-hint { color: var(--muted); font-size: .74rem; font-weight: 500; }
input, select, textarea { width: 100%; border: 1px solid #d9ddd5; border-radius: 12px; outline: none; color: var(--text); background: white; }
input, select { min-height: 47px; padding: 10px 13px; }
textarea { padding: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(127, 159, 137, .15); }
input:disabled { color: #77827c; background: #f1f2ed; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.compact { grid-template-columns: .9fr 1.1fr; }
.password-field { position: relative; display: block; }
.password-field button { position: absolute; top: 5px; right: 6px; width: 38px; height: 37px; border: 0; border-radius: 9px; background: transparent; opacity: .55; }
.optional-panel { padding: 14px; border: 1px solid var(--line); border-radius: 13px; }
.optional-panel summary { cursor: pointer; color: var(--ink); font-weight: 700; }
.optional-panel summary span { color: var(--muted); font-size: .75rem; font-weight: 500; }
.optional-panel[open] summary { margin-bottom: 15px; }
.alert { padding: 13px 15px; border-radius: 12px; font-size: .88rem; }
.alert-error { color: #862f22; background: #fbe2dc; border: 1px solid #efbcb0; }
.alert-success { color: #285d48; background: #e1f1e7; border: 1px solid #b8dac5; }
.alert-warning { color: #705317; background: #fbf0cd; border: 1px solid #eddaa2; }

/* Installation */
.install-page { min-height: 100vh; background: var(--ink); }
.install-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(320px, .8fr) minmax(620px, 1.2fr); }
.install-intro { position: relative; display: flex; overflow: hidden; flex-direction: column; justify-content: center; padding: 9vw 7vw; color: #e4eee8; background: radial-gradient(circle at 85% 20%, rgba(231,124,100,.2), transparent 30%), var(--ink); }
.install-intro::after { position: absolute; right: -90px; bottom: -80px; width: 340px; height: 340px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; content: ""; box-shadow: 0 0 0 55px rgba(255,255,255,.025), 0 0 0 110px rgba(255,255,255,.018); }
.install-intro .brand { position: absolute; top: 45px; left: 7vw; color: white; }
.install-intro h1 { color: white; }
.install-intro p:not(.eyebrow) { max-width: 470px; color: #bfd1c8; font-size: 1.05rem; }
.install-points { display: grid; z-index: 1; margin-top: 35px; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.install-points span { font-size: .88rem; }
.install-card { overflow: auto; padding: 60px clamp(30px, 6vw, 90px); background: var(--paper); }
.step-badge { padding: 6px 11px; border-radius: 999px; color: var(--ink); background: var(--sage-soft); font-size: .75rem; font-weight: 700; }
.install-card h3 { margin: 8px 0 -4px; padding-top: 9px; border-top: 1px solid var(--line); font-size: .9rem; }

/* Authentication */
.auth-page { min-height: 100vh; background: var(--paper); }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: 1.05fr .95fr; }
.auth-visual { position: relative; display: flex; overflow: hidden; flex-direction: column; justify-content: space-between; padding: 44px clamp(35px, 6vw, 88px); color: white; background: radial-gradient(circle at 15% 75%, rgba(127,159,137,.38), transparent 28%), radial-gradient(circle at 90% 12%, rgba(231,124,100,.25), transparent 27%), var(--ink); }
.register-visual { background: radial-gradient(circle at 85% 75%, rgba(228,172,76,.22), transparent 30%), radial-gradient(circle at 15% 12%, rgba(231,124,100,.2), transparent 27%), var(--ink); }
.auth-copy { z-index: 1; max-width: 620px; }
.auth-copy h1 { color: white; font-size: clamp(3.7rem, 6vw, 7rem); }
.auth-copy p { max-width: 510px; color: #cad8d1; font-size: 1.08rem; }
.auth-quote { z-index: 1; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; background: rgba(255,255,255,.07); backdrop-filter: blur(10px); }
.auth-quote span { color: var(--coral); font-family: var(--serif); font-size: 2rem; }
.auth-quote p { margin: 0; color: #e4ece7; font-size: .92rem; }
.floating-ingredients { position: absolute; inset: 0; pointer-events: none; }
.floating-ingredients span { position: absolute; display: grid; width: 65px; height: 65px; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; background: rgba(255,255,255,.08); font-size: 2rem; backdrop-filter: blur(8px); }
.floating-ingredients span:nth-child(1) { top: 21%; right: 12%; transform: rotate(-8deg); }
.floating-ingredients span:nth-child(2) { top: 37%; right: 30%; width: 49px; height: 49px; font-size: 1.5rem; }
.floating-ingredients span:nth-child(3) { right: 8%; bottom: 25%; }
.floating-ingredients span:nth-child(4) { bottom: 32%; left: 6%; width: 52px; height: 52px; font-size: 1.5rem; }
.floating-ingredients span:nth-child(5) { top: 12%; left: 36%; width: 44px; height: 44px; font-size: 1.25rem; }
.auth-form-wrap { display: grid; place-items: center; padding: 45px; }
.auth-form-card { width: min(100%, 450px); }
.auth-form-card h2 { margin-bottom: 9px; font-size: 3rem; }
.auth-lead { margin-bottom: 32px; color: var(--muted); }
.auth-switch { margin: 25px 0 0; color: var(--muted); text-align: center; font-size: .87rem; }
.auth-switch a { color: var(--coral); font-weight: 700; }

/* App frame */
.app-page { min-height: 100vh; background: #f6f4ed; }
.app-shell { min-height: 100vh; padding-left: 244px; }
.sidebar { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; display: flex; width: 244px; flex-direction: column; padding: 28px 20px 20px; border-right: 1px solid rgba(255,255,255,.08); color: #d8e3dd; background: var(--ink); }
.sidebar .brand { margin: 0 10px 42px; color: white; }
.main-nav { display: grid; gap: 7px; }
.main-nav > a { position: relative; display: flex; min-height: 47px; align-items: center; gap: 13px; padding: 10px 12px; border-radius: 12px; color: #b7cbc1; font-size: .9rem; font-weight: 600; }
.main-nav > a:hover { color: white; background: rgba(255,255,255,.06); }
.main-nav > a.active { color: white; background: rgba(255,255,255,.11); }
.main-nav > a.active::before { position: absolute; left: -20px; width: 3px; height: 25px; border-radius: 0 3px 3px 0; background: var(--coral); content: ""; }
.nav-icon { display: grid; width: 24px; height: 24px; place-items: center; font-size: 1.2rem; }
.nav-badge { margin-left: auto; padding: 3px 6px; border-radius: 999px; color: white; background: var(--coral); font-size: .56rem; letter-spacing: .03em; text-transform: uppercase; }
.sidebar-bottom { display: grid; margin-top: auto; gap: 12px; }
.install-button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; color: #cbd9d2; background: rgba(255,255,255,.04); font-size: .78rem; }
.user-card { display: grid; align-items: center; gap: 9px; padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.08); grid-template-columns: auto 1fr auto; }
.avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: var(--ink); background: var(--gold-soft); font-size: .88rem; font-weight: 800; }
.user-card strong, .user-card small { display: block; }
.user-card strong { color: white; font-size: .8rem; }
.user-card small { color: #8fac9d; font-size: .67rem; }
.main-content { min-height: 100vh; }
.page-container { width: min(100%, 1440px); margin: 0 auto; padding: 47px clamp(28px, 4.4vw, 72px) 80px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 35px; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); }
.page-heading .button { margin-top: 6px; }
.mobile-header, .bottom-nav { display: none; }
.toast { position: fixed; z-index: 100; top: 20px; right: 25px; display: flex; max-width: 440px; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 13px; background: white; box-shadow: var(--shadow); font-size: .84rem; animation: toast-in .35s ease; }
.toast > span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: white; background: var(--sage); font-weight: 800; }
.toast.alert-error > span { background: var(--coral); }
.toast button { margin-left: auto; border: 0; color: var(--muted); background: transparent; font-size: 1.2rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* Dashboard */
.dashboard-heading h1 { font-size: clamp(2.8rem, 4vw, 4.8rem); }
.empty-hero { display: grid; overflow: hidden; min-height: 260px; align-items: center; margin-bottom: 32px; padding: 38px 50px; border-radius: 28px; color: white; background: var(--ink); grid-template-columns: 1.2fr .8fr; }
.empty-hero h2 { color: white; font-size: 2.5rem; }
.empty-hero p { max-width: 540px; color: #c0d1c8; }
.empty-hero-art { position: relative; height: 180px; }
.empty-hero-art span { position: absolute; display: grid; width: 78px; height: 78px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.1); font-size: 2.5rem; }
.empty-hero-art span:nth-child(1) { top: 5px; left: 20px; }
.empty-hero-art span:nth-child(2) { top: 55px; right: 15px; }
.empty-hero-art span:nth-child(3) { bottom: 0; left: 110px; }
.empty-hero-art span:nth-child(4) { top: 0; right: 110px; width: 55px; height: 55px; font-size: 1.8rem; }
.stats-grid { display: grid; margin-bottom: 25px; gap: 14px; grid-template-columns: repeat(3, 1fr); }
.stat-card { display: grid; min-height: 104px; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); grid-template-columns: auto 1fr auto; transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card.warm { border-color: #f0c7bc; background: #fffaf7; }
.stat-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; font-size: 1.4rem; }
.stat-icon.sage { background: var(--sage-soft); }
.stat-icon.coral { background: var(--coral-soft); }
.stat-icon.gold { background: var(--gold-soft); }
.stat-card strong, .stat-card small { display: block; }
.stat-card strong { color: var(--ink); font-family: var(--serif); font-size: 1.7rem; font-weight: 400; line-height: 1; }
.stat-card small { margin-top: 4px; color: var(--muted); font-size: .72rem; }
.stat-arrow { color: var(--sage); font-size: 1.4rem; }
.expiry-strip { display: grid; align-items: center; gap: 18px; margin-bottom: 38px; padding: 14px 18px; border: 1px solid #efd3c7; border-radius: 17px; background: #fff8f3; grid-template-columns: auto 1fr auto; }
.expiry-title { display: flex; align-items: center; gap: 10px; padding-right: 18px; border-right: 1px solid #ecd9cf; }
.expiry-title > span { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; background: var(--coral-soft); }
.expiry-title strong, .expiry-title small { display: block; }
.expiry-title strong { color: var(--ink); font-size: .78rem; }
.expiry-title small { color: var(--muted); font-size: .64rem; }
.expiry-list { display: flex; overflow: hidden; gap: 8px; }
.expiry-pill { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; background: white; font-size: .72rem; }
.expiry-pill small { color: var(--coral); }
.expiry-strip > a { color: var(--coral); font-size: .76rem; font-weight: 700; white-space: nowrap; }
.section-block { margin-top: 40px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2, .section-heading p { margin-bottom: 0; }
.section-heading > a { color: var(--coral); font-size: .8rem; font-weight: 700; }
.recipe-carousel { display: grid; overflow-x: auto; padding: 2px 2px 14px; gap: 17px; grid-auto-columns: minmax(285px, 1fr); grid-auto-flow: column; overscroll-behavior-inline: contain; scroll-snap-type: inline mandatory; }
.recipe-carousel .recipe-card { scroll-snap-align: start; }
.recipe-card { overflow: hidden; border: 1px solid var(--line); border-radius: 19px; background: var(--paper); transition: transform .2s, box-shadow .2s; }
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.recipe-art { position: relative; display: grid; height: 164px; place-items: center; }
.recipe-art > span:first-child { filter: drop-shadow(0 9px 10px rgba(0,0,0,.12)); font-size: 5.3rem; transform: rotate(-4deg); transition: transform .25s; }
.recipe-card:hover .recipe-art > span:first-child { transform: scale(1.08) rotate(2deg); }
.tone-1 { background: #e4eadb; }
.tone-2 { background: #f2dfd1; }
.tone-3 { background: #e7e2ca; }
.tone-4 { background: #dbe8e2; }
.tone-5 { background: #eadedc; }
.match-badge, .ai-badge, .favorite-badge { position: absolute; top: 12px; padding: 5px 8px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.06); font-size: .63rem; font-weight: 800; }
.match-badge { left: 12px; color: #705317; background: #fff8df; }
.match-badge.complete { color: #285d48; background: #e7f5eb; }
.ai-badge { right: 12px; color: white; background: var(--coral); }
.favorite-badge { right: 12px; color: var(--coral); background: white; }
.recipe-art .ai-badge + .favorite-badge { right: 64px; }
.recipe-card-body { padding: 17px; }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 5px; color: var(--sage); font-size: .65rem; font-weight: 700; text-transform: uppercase; }
.recipe-card h3 { margin: 7px 0 7px; font-family: var(--serif); font-size: 1.35rem; font-weight: 400; line-height: 1.15; }
.recipe-card-body > p { display: -webkit-box; overflow: hidden; min-height: 37px; margin-bottom: 14px; color: var(--muted); font-size: .76rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.missing-line { display: flex; min-height: 27px; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .67rem; }
.missing-line .good { color: var(--ink-2); font-weight: 700; }
.mini-arrow { color: var(--coral); font-size: 1rem; }
.soft-empty { display: flex; align-items: center; gap: 18px; padding: 25px; border: 1px dashed #cfd6cc; border-radius: 17px; background: rgba(255,255,255,.45); }
.soft-empty > span { font-size: 2.5rem; }
.soft-empty strong { color: var(--ink); }
.soft-empty p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.ai-callout { position: relative; display: grid; overflow: hidden; align-items: center; gap: 25px; margin-top: 42px; padding: 30px 35px; border-radius: 23px; color: #d4e2db; background: var(--ink); grid-template-columns: 1fr auto; }
.ai-callout h2 { margin-bottom: 7px; color: white; }
.ai-callout p:not(.eyebrow) { max-width: 630px; margin: 0; font-size: .85rem; }
.ai-callout .button { z-index: 2; }
.ai-sparkles { position: absolute; top: -15px; right: 30%; color: rgba(255,255,255,.08); font-size: 7rem; transform: rotate(13deg); }
.ai-sparkles span { font-size: .5em; }

/* Stock */
.stock-layout { display: grid; align-items: start; gap: 28px; grid-template-columns: minmax(0, 1fr) 330px; }
.stock-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.search-field { position: relative; display: block; width: min(100%, 420px); }
.search-field > span { position: absolute; z-index: 1; top: 50%; left: 15px; color: var(--sage); font-size: 1.2rem; transform: translateY(-50%); }
.search-field input { padding-left: 42px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: .66rem; }
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { display: block; width: 7px; height: 7px; border-radius: 50%; }
.dot.coral { background: var(--coral); }
.dot.red { background: var(--red); }
.stock-group { margin-bottom: 30px; }
.stock-group-title { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.stock-group-title h2 { margin: 0; font-family: var(--font); font-size: .88rem; font-weight: 700; }
.stock-group-title span { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; color: var(--ink); background: var(--sage-soft); font-size: .62rem; font-weight: 800; }
.stock-table { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.stock-row { display: grid; min-height: 68px; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); grid-template-columns: auto 1fr auto auto; }
.stock-row:last-child { border-bottom: 0; }
.stock-row.soon { box-shadow: inset 3px 0 var(--coral); }
.stock-row.expired { box-shadow: inset 3px 0 var(--red); opacity: .75; }
.food-avatar { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 12px; background: #edf0e8; font-size: 1.2rem; }
.stock-name strong, .stock-name small { display: block; }
.stock-name strong { color: var(--ink); font-size: .82rem; }
.stock-name small { color: var(--muted); font-size: .66rem; }
.stock-name .expiry-text { color: var(--coral); }
.stock-quantity { min-width: 78px; color: var(--text); text-align: right; font-size: .76rem; font-weight: 700; }
.row-actions { display: flex; gap: 4px; opacity: .45; transition: opacity .2s; }
.stock-row:hover .row-actions { opacity: 1; }
.row-actions a, .row-actions button { display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 8px; color: var(--ink); background: transparent; }
.row-actions button:hover, .row-actions a:hover { background: var(--coral-soft); }
.stock-form-card { position: sticky; top: 25px; padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 12px 35px rgba(29,58,49,.06); scroll-margin-top: 20px; }
.stock-form-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 23px; }
.stock-form-head h2 { margin: 0; font-size: 1.65rem; }
.stock-form-head > span { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: var(--ink); background: var(--sage-soft); }
.form-tip { display: flex; gap: 9px; margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); font-size: .68rem; }
.form-tip p { margin: 0; }
.form-tip strong { display: block; color: var(--ink); }
.empty-state { display: grid; min-height: 380px; place-items: center; align-content: center; padding: 40px; border: 1px dashed #cbd3c7; border-radius: 20px; text-align: center; }
.empty-state .empty-icon { font-size: 3.5rem; }
.empty-state h2 { margin: 13px 0 7px; }
.empty-state p { max-width: 450px; color: var(--muted); }

/* Recipe library */
.recipe-heading { align-items: flex-end; }
.recipe-filters { display: grid; align-items: center; gap: 11px; margin-bottom: 30px; grid-template-columns: minmax(260px, 1fr) 210px auto; }
.recipe-search { width: 100%; }
.filter-chips { display: flex; gap: 8px; grid-column: 1 / -1; }
.filter-chips label input { position: absolute; opacity: 0; }
.filter-chips span { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--paper); cursor: pointer; font-size: .69rem; font-weight: 600; }
.filter-chips input:checked + span { border-color: var(--ink); color: white; background: var(--ink); }
.recipe-grid { display: grid; gap: 20px; grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Recipe detail */
.recipe-detail-page { min-height: 100vh; }
.recipe-hero { padding: 28px clamp(28px, 5vw, 75px) 45px; }
.recipe-hero-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 30px; }
.recipe-hero-nav > a { color: var(--ink); font-size: .76rem; font-weight: 700; }
.favorite-button { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid rgba(23,63,53,.15); border-radius: 999px; color: var(--ink); background: rgba(255,255,255,.5); font-size: .7rem; font-weight: 700; }
.favorite-button.active { color: white; background: var(--coral); border-color: var(--coral); }
.recipe-hero-content { display: grid; width: min(100%, 1150px); align-items: center; gap: 45px; margin: 0 auto; grid-template-columns: 240px 1fr; }
.recipe-big-emoji { display: grid; width: 230px; height: 230px; place-items: center; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: rgba(255,255,255,.25); filter: drop-shadow(0 17px 18px rgba(35,67,56,.12)); font-size: 8rem; }
.recipe-kicker { display: flex; gap: 8px; margin-bottom: 10px; }
.recipe-kicker > span { padding: 5px 8px; border-radius: 999px; color: var(--ink); background: rgba(255,255,255,.45); font-size: .63rem; font-weight: 800; text-transform: uppercase; }
.recipe-kicker .ai-source { color: white; background: var(--coral); }
.recipe-hero h1 { max-width: 760px; font-size: clamp(2.8rem, 5vw, 5.2rem); }
.recipe-hero-content > div:last-child > p { max-width: 720px; color: rgba(23,63,53,.72); }
.recipe-facts { display: flex; gap: 8px; margin-top: 24px; }
.recipe-facts > span { display: grid; min-width: 130px; padding: 10px 13px; border-radius: 12px; background: rgba(255,255,255,.42); grid-template-columns: auto 1fr; }
.recipe-facts b { margin-right: 8px; grid-row: 1 / 3; }
.recipe-facts strong, .recipe-facts small { display: block; }
.recipe-facts strong { color: var(--ink); font-size: .74rem; }
.recipe-facts small { color: rgba(23,63,53,.65); font-size: .6rem; }
.recipe-detail-grid { display: grid; width: min(100%, 1150px); align-items: start; gap: 55px; margin: 0 auto; padding: 50px 30px 90px; grid-template-columns: 360px 1fr; }
.ingredient-panel { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.availability-card { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; padding: 13px; border-radius: 14px; background: #eef3eb; }
.score-ring { --score: 50; display: grid; width: 52px; height: 52px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: conic-gradient(var(--sage) calc(var(--score) * 1%), #d6dfd4 0); }
.score-ring::before { position: absolute; width: 40px; height: 40px; border-radius: 50%; background: #eef3eb; content: ""; }
.score-ring span { z-index: 1; color: var(--ink); font-size: .67rem; font-weight: 800; }
.availability-card strong { color: var(--ink); font-size: .78rem; }
.availability-card p { margin: 2px 0 0; color: var(--muted); font-size: .64rem; }
.panel-heading h2 { margin: 0; font-size: 1.65rem; }
.panel-heading > span { color: var(--muted); font-size: .68rem; }
.ingredient-list { margin: 0; padding: 0; list-style: none; }
.ingredient-list li { display: grid; min-height: 52px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); grid-template-columns: auto 1fr auto; }
.ingredient-list .check { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: white; background: var(--sage); font-size: .65rem; font-weight: 800; }
.ingredient-list li.missing .check { color: var(--coral); background: var(--coral-soft); }
.ingredient-list strong { display: block; color: var(--ink); font-size: .75rem; }
.ingredient-list small { color: var(--coral); font-size: .58rem; }
.ingredient-list b { color: var(--muted); font-size: .7rem; font-weight: 600; }
.shopping-note { display: block; margin-top: 17px; color: var(--coral); text-align: center; font-size: .7rem; font-weight: 700; }
.instructions-panel > .panel-heading { padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.step-list { display: grid; margin: 25px 0 35px; padding: 0; gap: 26px; list-style: none; counter-reset: steps; }
.step-list li { display: grid; align-items: start; gap: 17px; grid-template-columns: auto 1fr; }
.step-list li > span { display: grid; width: 37px; height: 37px; place-items: center; border: 1px solid #c8d5cb; border-radius: 50%; color: var(--ink); font-family: var(--serif); font-size: 1rem; }
.step-list strong { color: var(--ink); font-family: var(--serif); font-size: 1.05rem; font-weight: 400; }
.step-list p { margin: 5px 0 0; color: var(--muted); font-size: .86rem; }
.cook-card { display: grid; gap: 18px; padding: 20px; border: 1px solid #d9e3d7; border-radius: 16px; background: #edf3eb; }
.cook-card > div { display: flex; gap: 12px; }
.cook-card > div > span { font-size: 1.7rem; }
.cook-card strong { color: var(--ink); font-size: .83rem; }
.cook-card p { margin: 3px 0 0; color: var(--muted); font-size: .68rem; }
.cook-card form { display: flex; align-items: end; gap: 10px; }
.cook-card label { color: var(--ink); font-size: .67rem; font-weight: 700; }
.cook-card input { width: 75px; min-height: 42px; }
.cook-card button { flex: 1; }

/* AI */
.ai-page { max-width: 1200px; }
.ai-orb { display: grid; width: 75px; height: 75px; place-items: center; border-radius: 50%; color: white; background: var(--coral); box-shadow: 0 0 0 11px var(--coral-soft); font-size: 2rem; }
.ai-disabled-card { display: grid; min-height: 350px; align-items: center; gap: 28px; padding: 50px; border-radius: 24px; color: #cad8d1; background: var(--ink); grid-template-columns: auto 1fr; }
.ai-disabled-card h2 { color: white; }
.ai-disabled-card p:not(.eyebrow) { max-width: 650px; }
.ai-disabled-icon { display: grid; width: 110px; height: 110px; place-items: center; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; background: rgba(255,255,255,.07); font-size: 3rem; }
.ai-disabled-card code { color: white; }
.ai-workspace { display: grid; align-items: start; gap: 26px; grid-template-columns: minmax(0, 1fr) 320px; }
.ai-form-card, .ai-stock-card { padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 10px 35px rgba(29,58,49,.05); }
.ai-form-intro { display: flex; gap: 15px; margin-bottom: 27px; }
.ai-form-intro > span { display: grid; width: 45px; height: 45px; flex: 0 0 auto; place-items: center; border-radius: 14px; color: white; background: var(--coral); }
.ai-form-intro h2 { margin-bottom: 4px; }
.ai-form-intro p { margin: 0; color: var(--muted); font-size: .82rem; }
.portion-picker { display: flex; gap: 8px; }
.portion-picker label input { position: absolute; opacity: 0; }
.portion-picker span { display: grid; width: 48px; height: 43px; place-items: center; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: white; cursor: pointer; }
.portion-picker input:checked + span { border-color: var(--ink); color: white; background: var(--ink); }
.usage-note { margin: -7px 0 0; color: var(--muted); text-align: center; font-size: .66rem; }
.ai-stock-card { position: sticky; top: 25px; }
.ai-stock-list { display: flex; flex-wrap: wrap; gap: 7px; }
.ai-stock-list > span { display: flex; align-items: center; gap: 6px; padding: 7px 9px; border-radius: 9px; color: var(--ink); background: #edf1e9; font-size: .7rem; font-weight: 650; }
.ai-stock-list small { color: var(--muted); font-size: .58rem; font-weight: 500; }
.ai-stock-list a { width: 100%; margin-top: 5px; color: var(--coral); font-size: .68rem; font-weight: 700; }
.privacy-note { display: flex; gap: 9px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.privacy-note p { margin: 0; color: var(--muted); font-size: .64rem; }
.privacy-note strong { display: block; color: var(--ink); }

/* Profile */
.profile-page { max-width: 1050px; }
.profile-grid { display: grid; align-items: start; gap: 22px; grid-template-columns: 310px 1fr; }
.profile-card { padding: 27px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.identity-card { text-align: center; }
.profile-avatar { display: grid; width: 85px; height: 85px; place-items: center; margin: 0 auto 16px; border-radius: 50%; color: var(--ink); background: var(--gold-soft); font-family: var(--serif); font-size: 2.3rem; }
.identity-card h2 { margin-bottom: 4px; }
.identity-card > p { color: var(--muted); font-size: .76rem; }
.profile-stats { display: grid; margin-top: 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); grid-template-columns: repeat(2, 1fr); }
.profile-stats span { padding: 16px 8px; }
.profile-stats span + span { border-left: 1px solid var(--line); }
.profile-stats strong, .profile-stats small { display: block; }
.profile-stats strong { color: var(--ink); font-family: var(--serif); font-size: 1.3rem; font-weight: 400; }
.profile-stats small { color: var(--muted); font-size: .57rem; }
.profile-install { margin-top: 20px; border-color: var(--line); color: var(--ink); background: transparent; }
.security-card { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; }
.security-card > div { display: flex; align-items: center; gap: 13px; }
.security-card > div > span { display: grid; width: 45px; height: 45px; place-items: center; border-radius: 13px; background: var(--sage-soft); }
.security-card h3 { margin: 0 0 3px; font-size: .87rem; }
.security-card p { margin: 0; color: var(--muted); font-size: .7rem; }
.not-found { min-height: 70vh; border: 0; }

@media (max-width: 1100px) {
    .recipe-grid { grid-template-columns: repeat(2, 1fr); }
    .stock-layout { grid-template-columns: minmax(0, 1fr) 290px; }
    .recipe-detail-grid { gap: 30px; grid-template-columns: 330px 1fr; }
    .recipe-hero-content { grid-template-columns: 190px 1fr; }
    .recipe-big-emoji { width: 180px; height: 180px; font-size: 6rem; }
}

@media (max-width: 860px) {
    .app-shell { padding: 0 0 72px; }
    .sidebar { display: none; }
    .mobile-header { display: flex; height: 67px; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--paper); }
    .mobile-header .brand-mark { width: 33px; height: 33px; font-size: 1.3rem; }
    .bottom-nav { position: fixed; z-index: 50; right: 0; bottom: 0; left: 0; display: grid; height: 68px; padding: 6px 8px max(6px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,253,248,.96); backdrop-filter: blur(12px); grid-template-columns: repeat(4, 1fr); }
    .bottom-nav a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); }
    .bottom-nav a > span { font-size: 1.2rem; line-height: 1; }
    .bottom-nav small { font-size: .57rem; font-weight: 650; }
    .bottom-nav a.active { color: var(--coral); }
    .page-container { padding: 32px 20px 55px; }
    .stock-layout, .ai-workspace { grid-template-columns: 1fr; }
    .stock-form-card, .ai-stock-card { position: static; }
    .recipe-hero { padding-inline: 20px; }
    .recipe-detail-grid { grid-template-columns: 1fr; }
    .recipe-hero-content { gap: 25px; grid-template-columns: 140px 1fr; }
    .recipe-big-emoji { width: 135px; height: 135px; font-size: 4.5rem; }
    .recipe-facts { flex-wrap: wrap; }
    .recipe-facts > span { min-width: 110px; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .auth-form-wrap { min-height: 100vh; padding: 30px; }
    .install-shell { grid-template-columns: 1fr; }
    .install-intro { min-height: 380px; padding: 110px 35px 50px; }
    .install-intro .brand { left: 35px; }
    .install-card { padding: 45px 30px; }
}

@media (max-width: 620px) {
    h1 { font-size: 2.7rem; }
    .page-heading { align-items: center; margin-bottom: 28px; }
    .page-heading > .button { padding: 10px 13px; font-size: .72rem; }
    .desktop-only { display: none; }
    .stats-grid { overflow-x: auto; padding-bottom: 8px; grid-template-columns: repeat(3, 230px); }
    .expiry-strip { grid-template-columns: 1fr auto; }
    .expiry-list { display: none; }
    .expiry-title { border-right: 0; }
    .recipe-carousel { margin-right: -20px; grid-auto-columns: 82vw; }
    .ai-callout { grid-template-columns: 1fr; padding: 28px; }
    .recipe-grid { grid-template-columns: 1fr; }
    .recipe-filters { grid-template-columns: 1fr auto; }
    .recipe-filters .recipe-search { grid-column: 1 / -1; }
    .recipe-filters select { min-width: 0; }
    .filter-chips { overflow-x: auto; margin-right: -20px; padding-bottom: 5px; }
    .filter-chips label { flex: 0 0 auto; }
    .stock-toolbar { align-items: stretch; flex-direction: column; }
    .search-field { width: 100%; }
    .legend { justify-content: flex-end; }
    .stock-row { gap: 8px; padding: 10px; grid-template-columns: auto 1fr auto; }
    .row-actions { grid-column: 2 / -1; justify-content: flex-end; margin-top: -10px; opacity: 1; }
    .stock-quantity { min-width: 60px; }
    .recipe-hero-nav .favorite-button span { display: none; }
    .recipe-hero-content { text-align: center; grid-template-columns: 1fr; }
    .recipe-big-emoji { width: 145px; height: 145px; margin: 0 auto; }
    .recipe-kicker, .recipe-facts { justify-content: center; }
    .recipe-hero-content > div:last-child > p { font-size: .82rem; }
    .recipe-detail-grid { padding: 28px 15px 70px; }
    .cook-card form { align-items: stretch; flex-direction: column; }
    .cook-card input { width: 100%; }
    .profile-grid { grid-template-columns: 1fr; }
    .security-card { align-items: stretch; flex-direction: column; grid-column: auto; }
    .form-grid.two, .form-grid.three { grid-template-columns: 1fr; }
    .install-points { grid-template-columns: 1fr; }
    .ai-disabled-card { padding: 35px 25px; text-align: center; grid-template-columns: 1fr; }
    .ai-disabled-icon { margin: auto; }
    .ai-orb { width: 53px; height: 53px; box-shadow: 0 0 0 7px var(--coral-soft); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

.offline-page { display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: 45px clamp(28px, 8vw, 100px) 10vh; color: #c7d7cf; background: radial-gradient(circle at 80% 25%, rgba(231,124,100,.2), transparent 30%), var(--ink); }
.offline-page > div { max-width: 700px; }
.offline-page h1 { color: white; }
.offline-page p:not(.eyebrow) { max-width: 570px; }
.offline-icon { display: block; margin-bottom: 20px; font-size: 4rem; }

