:root {
    color-scheme:light;
    --canvas:#f7f6f0;
    --surface:#fffefa;
    --ink:#263c31;
    --muted:#69746c;
    --line:#dddfd5;
    --accent:#294f3b;
    --soft:#e9eedf;
    --warn:#875a1e;
    --error:#9b352c;
    --shadow:0 8px 30px #23382c08
}
* {
    box-sizing:border-box
}
html {
    font-family:"Segoe UI",system-ui,sans-serif;
    font-size:16px;
    line-height:1.55;
    background:var(--canvas);
    color:var(--ink)
}
body {
    margin:0
}
a {
    color:inherit;
    text-decoration:none
}
a:hover {
    text-decoration:underline
}
h1,h2,h3,p {
    margin:0 0 1rem
}
h1,h2,h3 {
    line-height:1.16
}
h1 {
    font-family:Georgia,serif;
    font-size:clamp(2.3rem,4vw,3.8rem);
    font-weight:500;
    letter-spacing:-.04em
}
h2 {
    font-size:1.4rem;
    font-weight:600
}
h3 {
    font-size:1.2rem;
    font-weight:600
}
small {
    display:block;
    color:var(--muted);
    font-size:.82rem
}
em {
    font-weight:400;
    color:#61744d
}
button,.button,input,select,textarea {
    font:inherit
}
button,.button {
    display:inline-flex;
    justify-content:center;
    align-items:center;
    gap:.6rem;
    min-height:48px;
    padding:.7rem 1.1rem;
    border:1px solid var(--line);
    border-radius:9px;
    background:var(--surface);
    color:var(--ink);
    cursor:pointer;
    font-weight:600;
    text-decoration:none
}
button:hover,.button:hover {
    border-color:var(--accent);
    text-decoration:none
}
button:disabled {
    opacity:.55;
    cursor:wait
}
.primary {
    background:var(--accent);
    color:#fff;
    border-color:var(--accent)
}
.full {
    width:100%;
    margin-top:1rem
}
.danger {
    color:var(--error);
    background:transparent;
    border-color:transparent
}
.subtle {
    background:transparent
}
.text-link {
    display:inline-block;
    margin:1rem
}
.eyebrow {
    text-transform:uppercase;
    font-size:.7rem;
    letter-spacing:.16em;
    font-weight:700;
    color:var(--muted)
}
.muted {
    color:var(--muted)
}
.app-shell {
    display:grid;
    grid-template-columns:248px minmax(0,1fr);
    min-height:100vh
}
.sidebar {
    padding:36px 20px;
    border-right:1px solid var(--line);
    position:sticky;
    top:0;
    height:100vh;
    display:flex;
    flex-direction:column
}
.brand {
    display:flex;
    align-items:center;
    gap:10px;
    font-family:Georgia,serif;
    font-size:1.45rem;
    margin:0 4px 40px
}
.brand small {
    font:10px "Segoe UI",sans-serif;
    margin-top:6px;
    white-space:nowrap
}
.brand-mark {
    font-size:2.6rem;
    line-height:1;
    width:45px;
    height:48px;
    border-radius:50%;
    color:var(--accent)
}
nav {
    display:flex;
    flex-direction:column;
    gap:7px
}
nav a {
    display:flex;
    align-items:center;
    gap:14px;
    padding:13px 16px;
    min-height:50px;
    border-radius:8px;
    font-size:.9rem
}
nav a>span {
    font-size:1.2rem;
    width:20px;
    text-align:center
}
nav a.active {
    background:var(--soft);
    font-weight:650;
    color:var(--accent)
}
.sidebar-note {
    margin-top:auto;
    padding:30px 14px 0;
    font-size:.85rem
}
.sidebar-note p {
    margin-top:10px
}
main {
    padding:0 44px 60px;
    min-width:0;
    max-width:1600px
}
.topbar {
    display:flex;
    justify-content:space-between;
    align-items:center;
    border-bottom:1px solid var(--line);
    height:78px;
    font-size:.7rem;
    letter-spacing:.12em
}
.topbar a {
    font-size:.8rem;
    letter-spacing:0
}
.hero {
    display:grid;
    grid-template-columns:1.3fr 1fr;
    align-items:center;
    min-height:430px;
    padding:45px 0 40px;
    gap:20px
}
.hero h1 {
    font-size:clamp(2.4rem,3.8vw,4rem);
    margin:20px 0
}
.hero p {
    color:var(--muted);
    font-size:1rem
}
.hero .button {
    margin-top:10px
}
.hero-illustration {
    position:relative;
    display:grid;
    place-items:center;
    min-height:320px
}
.plate {
    position:relative;
    width:280px;
    height:280px;
    background:#eee4ca;
    border:14px solid #e6ddc8;
    border-radius:50%;
    box-shadow:12px 18px 0 #d9d7c530,inset 0 0 0 4px #f7eedb;
    transform:rotate(-15deg)
}
.leaf {
    position:absolute;
    border-radius:60% 12% 60% 12%;
    background:#709361;
    width:90px;
    height:115px;
    box-shadow:inset -6px -2px 0 #517147
}
.l1 {
    top:30px;
    left:32px;
    transform:rotate(-30deg)
}
.l2 {
    top:63px;
    left:100px;
    transform:rotate(50deg);
    background:#91a870
}
.l3 {
    top:122px;
    left:32px;
    transform:rotate(60deg)
}
.tomato {
    position:absolute;
    background:#bb6249;
    border:5px solid #d28165;
    border-radius:50%;
    width:65px;
    height:65px;
    box-shadow:inset 0 0 0 5px #d7956b
}
.t1 {
    top:35px;
    right:29px
}
.t2 {
    bottom:29px;
    left:82px
}
.t3 {
    bottom:71px;
    right:18px;
    width:55px;
    height:55px
}
.grain {
    position:absolute;
    left:75px;
    top:90px;
    width:90px;
    height:75px;
    border-radius:50%;
    background:repeating-linear-gradient(35deg,#dbc88e 0 5px,#e7d7aa 5px 10px);
    transform:rotate(10deg);
    opacity:.9
}
.hand-note {
    position:absolute;
    right:-5px;
    bottom:0;
    transform:rotate(-8deg);
    font-family:Georgia,serif;
    font-style:italic;
    font-size:1rem;
    color:var(--muted)
}
.quick-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:20px;
    margin-bottom:48px
}
.quick-card {
    border:1px solid var(--line);
    border-radius:12px;
    padding:24px;
    display:flex;
    align-items:center;
    gap:18px;
    background:var(--surface)
}
.quick-icon {
    display:grid;
    place-items:center;
    flex-shrink:0;
    font-size:1.8rem;
    background:var(--soft);
    border-radius:50%;
    width:52px;
    height:52px
}
.quick-card h2 {
    font-size:1.05rem;
    margin:0 0 6px
}
.quick-card p {
    font-size:.84rem;
    color:var(--muted);
    margin:0
}
.quick-card>span:last-child {
    margin-left:auto
}
.section-heading {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:20px;
    margin:22px 0
}
.section-heading h2 {
    margin:8px 0 0
}
.section-heading a,.section-heading>span {
    font-size:.85rem;
    color:var(--muted)
}
.recipe-grid {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(min(100%,245px),1fr));
    gap:22px
}
.recipe-card {
    border-radius:12px;
    border:1px solid var(--line);
    overflow:hidden;
    background:var(--surface);
    box-shadow:var(--shadow);
    transition:transform .15s
}
.recipe-card:hover {
    transform:translateY(-3px);
    text-decoration:none
}
.card-art {
    height:145px;
    position:relative;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#e6e9d8;
    color:#6a7953;
    overflow:hidden
}
.card-art>span {
    font:110px Georgia,serif;
    opacity:.5;
    transform:rotate(-15deg);
    line-height:1
}
.card-art small {
    position:absolute;
    bottom:12px;
    left:16px;
    right:16px;
    color:#344b3e;
    font-size:.68rem;
    letter-spacing:.05em
}
.tone-1 {
    background:#e9dccc;
    color:#b0805a
}
.tone-2 {
    background:#dde5df;
    color:#587f78
}
.tone-3 {
    background:#efdfce;
    color:#b38d57
}
.card-body {
    padding:22px
}
.card-body .eyebrow {
    font-size:.62rem
}
.card-body h3 {
    font-family:Georgia,serif;
    font-size:1.45rem;
    margin:12px 0
}
.card-body p {
    font-size:.85rem;
    color:var(--muted);
    min-height:2.7rem
}
.card-meta {
    display:flex;
    justify-content:space-between;
    border-top:1px solid var(--line);
    padding-top:14px;
    color:var(--muted);
    font-size:.77rem
}
.match {
    border-top:1px solid var(--line);
    margin-top:12px;
    padding-top:12px;
    font-size:.82rem
}
.match span {
    display:block;
    color:var(--muted);
    margin-top:5px
}
.page-heading {
    padding:42px 0 22px
}
.page-heading h1 {
    margin:12px 0 16px
}
.page-heading p {
    color:var(--muted);
    max-width:750px
}
.page-heading>a {
    display:block;
    margin-bottom:25px;
    font-size:.85rem
}
.filter-bar {
    display:flex;
    gap:18px;
    flex-wrap:wrap;
    align-items:flex-end;
    padding:20px 0
}
.grow {
    flex:1;
    min-width:180px
}
label {
    display:block;
    font-size:.85rem;
    font-weight:600
}
input,select,textarea {
    display:block;
    width:100%;
    min-height:48px;
    border:1px solid var(--line);
    border-radius:7px;
    background:var(--surface);
    color:var(--ink);
    padding:11px 12px;
    margin:7px 0 15px;
    max-width:100%;
    font-size:16px
}
textarea {
    resize:vertical
}
.filter-bar input,.filter-bar select {
    margin-bottom:0
}
input[type=checkbox] {
    width:24px;
    height:24px;
    min-height:24px;
    accent-color:var(--accent);
    margin:0;
    flex-shrink:0
}
.result-count {
    color:var(--muted);
    font-size:.85rem;
    margin:12px 0 24px
}
.panel {
    background:var(--surface);
    border:1px solid var(--line);
    border-radius:12px;
    padding:26px;
    margin-bottom:22px;
    min-width:0;
    box-shadow:var(--shadow)
}
.panel h2 {
    margin-bottom:20px
}
.tabs {
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin:14px 0 24px
}
.tabs button {
    text-transform:capitalize
}
.tabs .selected {
    background:var(--accent);
    color:white;
    border-color:var(--accent)
}
.tabs span {
    background:#9cae952b;
    padding:0 8px;
    border-radius:20px
}
.pantry-layout {
    display:grid;
    grid-template-columns:1.2fr 1fr;
    gap:24px
}
.ingredient-results {
    max-height:530px;
    overflow:auto;
    margin:18px 0
}
.ingredient-choice {
    display:flex;
    align-items:center;
    border-bottom:1px solid var(--line);
    gap:6px
}
.ingredient-choice label {
    display:flex;
    align-items:center;
    gap:15px;
    min-height:70px;
    flex:1;
    padding:10px 0;
    cursor:pointer
}
.ingredient-choice small {
    font-weight:400
}
.stock-row {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding:14px 0;
    border-bottom:1px solid var(--line)
}
summary {
    min-height:48px;
    padding:12px 0;
    cursor:pointer
}
details[open] {
    padding-bottom:12px
}
.best-next {
    background:var(--soft);
    padding:24px;
    border-radius:12px;
    display:flex;
    gap:20px;
    margin:20px 0 30px
}
.best-next h2 {
    font-family:Georgia,serif;
    font-size:1.7rem;
    margin:8px 0
}
.best-next p {
    margin:0;
    font-size:.85rem
}
.empty {
    padding:55px 25px;
    border:1px dashed var(--line);
    border-radius:12px;
    text-align:center;
    margin:24px 0
}
.empty p {
    color:var(--muted)
}
.error,.notice {
    padding:18px;
    border:1px solid var(--line);
    border-radius:8px;
    margin:18px 0;
    background:var(--surface)
}
.error {
    color:var(--error);
    border-color:currentColor
}
.notice {
    color:var(--warn)
}
.actions {
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin-top:18px
}
.facts {
    display:flex;
    gap:12px;
    flex-wrap:wrap
}
.recipe-tools-actions {
    margin-bottom:22px
}
.lab-fields {
    border:0;
    margin:0;
    padding:0;
    min-width:0
}
.scan-page + .scan-page {
    margin-top:24px;
    padding-top:20px;
    border-top:1px solid var(--line)
}
.facts span {
    background:var(--soft);
    padding:7px 12px;
    border-radius:6px;
    font-size:.85rem
}
.detail-layout {
    display:grid;
    grid-template-columns:minmax(240px,.8fr) minmax(0,1.4fr);
    gap:24px
}
.check-line {
    display:flex;
    gap:15px;
    align-items:center;
    padding:16px 0;
    border-bottom:1px solid var(--line)
}
.check-line small {
    font-weight:400;
    margin-top:3px
}
.method ol {
    padding-left:27px
}
.method li {
    padding:0 0 24px 10px;
    font-size:1.08rem;
    line-height:1.7
}
.on-hand {
    color:var(--accent)
}
.missing {
    color:var(--warn)
}
.editor-grid {
    display:grid;
    grid-template-columns:minmax(0,1.5fr) minmax(260px,.8fr);
    gap:24px
}
.editor-aside {
    min-width:0
}
.editor-line {
    padding:16px 0;
    border-bottom:1px solid var(--line);
    margin-bottom:15px
}
.line-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:10px
}
.line-heading small {
    font-weight:400
}
.quantity-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px
}
.three-fields {
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:12px
}
.inline-check {
    display:flex;
    gap:10px;
    align-items:center;
    min-height:48px
}
.add-results {
    max-height:320px;
    overflow:auto
}
.add-results button {
    width:100%;
    justify-content:flex-start;
    text-align:left;
    margin:5px 0;
    flex-wrap:wrap
}
.add-results button span {
    margin-left:auto
}
.step-edit {
    margin-bottom:22px;
    border-bottom:1px solid var(--line);
    padding-bottom:12px
}
.history-row {
    display:block;
    padding:14px 0;
    border-bottom:1px solid var(--line)
}
.history-row strong {
    font-size:.87rem
}
.settings {
    max-width:800px
}
.settings button {
    margin:8px 10px 0 0
}
.download-row {
    display:flex;
    gap:20px;
    align-items:center;
    justify-content:space-between
}
.modal-backdrop {
    position:fixed;
    inset:0;
    background:#13271eb0;
    z-index:20;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px
}
.modal {
    width:100%;
    max-width:480px;
    max-height:90dvh;
    overflow:auto;
    background:var(--surface);
    border-radius:15px;
    padding:28px
}
.unlock {
    margin:45px auto;
    max-width:550px
}
input:focus,select:focus,textarea:focus,button:focus-visible,a:focus-visible {
    outline:3px solid #a3ae6c;
    outline-offset:3px
}
#blazor-error-ui {
    display:none;
    position:fixed;
    bottom:0;
    background:#fff2c9;
    padding:18px;
    z-index:100;
    width:100%;
    color:#482f1d
}
.sr-only {
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip:rect(0,0,0,0)
}
.loading-shell {
    margin:15vh auto;
    padding:35px;
    max-width:500px;
    text-align:center
}
.loading-shell span {
    font:60px Georgia;
    color:#294f3b
}
[data-theme=dark] {
    color-scheme:dark;
    --canvas:#17231c;
    --surface:#202f25;
    --ink:#edf0e5;
    --muted:#b2bfb0;
    --line:#3d4b40;
    --accent:#4d775a;
    --soft:#2c4030;
    --warn:#e2bd80;
    --error:#f2a79a;
    --shadow:none
}
[data-theme=dark] em {
    color:#b9ca9a
}
@media(max-width:1100px) {
    .app-shell {
        grid-template-columns:210px minmax(0,1fr)
    }
    main {
        padding:0 26px 40px
    }
    .sidebar {
        padding:28px 12px
    }
    .brand small {
        font-size:9px
    }
    .hero {
        grid-template-columns:1.4fr .8fr
    }
    .plate {
        width:220px;
        height:220px;
        transform:scale(.85) rotate(-15deg)
    }
    .hand-note {
        right:0;
        font-size:.9rem
    }
    .quick-card {
        padding:18px;
        gap:12px
    }
    .quick-icon {
        width:42px;
        height:42px
    }
    .editor-grid {
        grid-template-columns:1fr
    }
    .editor-aside {
        display:grid;
        grid-template-columns:1fr 1fr;
        gap:20px
    }
    .editor-aside .panel {
        margin:0
    }
}
@media(max-width:800px) {
    .app-shell {
        display:block
    }
    .sidebar {
        height:auto;
        position:static;
        padding:18px 20px;
        border-right:0;
        border-bottom:1px solid var(--line)
    }
    .brand {
        margin:0 0 16px
    }
    .brand small {
        font-size:10px
    }
    .brand-mark {
        font-size:2.4rem
    }
    nav {
        display:grid;
        grid-template-columns:repeat(4,minmax(0,1fr));
        gap:5px
    }
    nav a {
        padding:9px 5px;
        display:flex;
        flex-direction:column;
        justify-content:center;
        gap:2px;
        text-align:center;
        font-size:.69rem;
        line-height:1.25;
        min-height:54px
    }
    nav a>span {
        font-size:1.15rem
    }
    .sidebar-note {
        display:none
    }
    .topbar {
        height:50px
    }
    .hero {
        min-height:0;
        grid-template-columns:1.4fr .8fr;
        padding:32px 0
    }
    .hero h1 {
        font-size:2.7rem
    }
    .hero-illustration {
        min-height:250px
    }
    .hand-note {
        display:none
    }
    .quick-grid {
        gap:14px;
        margin-bottom:30px
    }
    .quick-card {
        align-items:flex-start
    }
    .quick-card .quick-icon {
        display:none
    }
    .section-heading {
        align-items:flex-start
    }
    .section-heading h2 {
        font-size:1.25rem
    }
    .pantry-layout {
        grid-template-columns:1fr 1fr;
        gap:16px
    }
    .panel {
        padding:20px
    }
    .detail-layout {
        grid-template-columns:1fr 1.3fr;
        gap:16px
    }
    .group-tabs button {
        flex:1;
        min-width:120px
    }
    .page-heading {
        padding-top:30px
    }
}
@media(max-width:580px) {
    main {
        padding:0 18px 35px
    }
    .topbar {
        font-size:.59rem
    }
    .hero {
        grid-template-columns:1fr;
        padding:35px 0 26px
    }
    .hero h1 {
        font-size:2.8rem
    }
    .hero-illustration {
        display:none
    }
    .hero p br {
        display:none
    }
    .text-link {
        margin-left:0
    }
    .quick-grid {
        grid-template-columns:1fr;
        gap:12px
    }
    .quick-card {
        padding:19px
    }
    .quick-card .quick-icon {
        display:grid
    }
    .section-heading {
        flex-direction:column;
        gap:8px
    }
    .section-heading h2 {
        margin:5px 0
    }
    .recipe-grid {
        grid-template-columns:1fr
    }
    .card-art {
        height:140px
    }
    .pantry-layout,.detail-layout {
        grid-template-columns:1fr
    }
    .ingredient-results {
        max-height:400px
    }
    .filter-bar {
        gap:12px
    }
    .filter-bar>label {
        flex:1;
        min-width:140px
    }
    .page-heading h1 {
        font-size:2.5rem
    }
    .panel {
        padding:20px
    }
    .group-tabs {
        gap:7px
    }
    .group-tabs button {
        font-size:.8rem;
        padding:9px;
        min-width:90px
    }
    .best-next {
        padding:20px;
        gap:14px
    }
    .best-next h2 {
        font-size:1.4rem
    }
    .best-next .quick-icon {
        display:none
    }
    .editor-aside {
        display:block
    }
    .editor-aside .panel {
        margin:0 0 22px
    }
    .three-fields {
        grid-template-columns:1fr
    }
    .download-row {
        align-items:flex-start;
        flex-direction:column
    }
    .modal-backdrop {
        padding:12px;
        align-items:flex-end
    }
    .modal {
        max-height:85dvh;
        padding:22px
    }
    .topbar a {
        font-size:.72rem
    }
    .line-heading {
        align-items:flex-start
    }
    .line-heading button {
        padding:8px;
        font-size:.8rem
    }
    .quantity-grid {
        grid-template-columns:minmax(0,1fr) minmax(0,1fr)
    }
}
@media(prefers-reduced-motion:reduce) {
    * {
        transition:none!important;
        scroll-behavior:auto!important
    }
}
[data-theme=dark] nav a.active {
    color:#edf0e5
}
h1[tabindex="-1"]:focus {
    outline:none
}

.preserve-lines, .trial-note p { white-space: pre-wrap; overflow-wrap: anywhere; }
.trial-note { border-bottom: 1px solid var(--line); margin-bottom: 15px; padding-bottom: 8px; }
.share-choices { max-height: 440px; overflow-y: auto; }
.new-ingredient {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-top: 18px;
    padding: 18px;
    min-width: 0;
}
.new-ingredient legend {
    font-weight: 600;
    padding: 0 8px;
}
.scan-review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-top: 24px; }
.scan-image { display: block; width: 100%; height: auto; margin-top: 18px; border-radius: 8px; }
.scan-original { align-self: start; position: sticky; top: 18px; }
.capture-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.source-transcript { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; }
.transcription { font-family: ui-monospace, Consolas, monospace; }
@media (max-width: 767px) {
    .scan-review-layout, .capture-choices { grid-template-columns: 1fr; }
    .scan-original { position: static; }
}

.stock-signal .stock-dot { font-size:1.2em; margin-right:.25em; }
.stock-signal.green .stock-dot, span.stock-signal.green { color:#2e8b57; }
.stock-signal.yellow .stock-dot, span.stock-signal.yellow { color:#a97500; }
.stock-signal.red .stock-dot, span.stock-signal.red { color:#c8443c; }
[data-theme=dark] .stock-signal.green .stock-dot, [data-theme=dark] span.stock-signal.green { color:#85d6a1; }
[data-theme=dark] .stock-signal.yellow .stock-dot, [data-theme=dark] span.stock-signal.yellow { color:#f3ce6a; }
[data-theme=dark] .stock-signal.red .stock-dot, [data-theme=dark] span.stock-signal.red { color:#ff9690; }

.mobile-qr { background: #fff; color: #000; width: 280px; max-width: 100%; padding: 12px; margin: 1rem 0; border-radius: 8px; }
.mobile-qr svg { display: block; width: 100%; height: auto; }
.mobile-address { overflow-wrap: anywhere; }
#connect-mobile li { margin-bottom: .8rem; }
