:root {
  color-scheme: light;
  --background: #f7f7f2;
  --surface: #fff;
  --surface-soft: #fbfbf8;
  --text: #222b23;
  --muted: #59645b;
  --line: #e4e8df;
  --accent: #284933;
  --primary: #2a4734;
  --primary-hover: #345b40;
  --active: #e9efe5;
  --sage: #e7efe4;
  --sage-ink: #3b5f46;
  --gold: #f8eedb;
  --gold-ink: #825319;
  --lavender: #eeebf7;
  --lavender-ink: #66518a;
  --coral: #faeae4;
  --coral-ink: #973f2a;
  --blue: #e7eef5;
  --blue-ink: #41647e;
  --shadow: 0 2px 6px #222b2307;
  --serif: Georgia, 'Times New Roman', serif;
  --sidebar: 235px;
  --topbar: 68px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="scuro"] {
  color-scheme: dark;
  --background: #171e18;
  --surface: #202921;
  --surface-soft: #1b241c;
  --text: #edf2e8;
  --muted: #aeb9ab;
  --line: #354336;
  --accent: #c1e0bb;
  --primary: #354f3b;
  --primary-hover: #47664c;
  --active: #2d4231;
  --sage: #334939;
  --sage-ink: #b7d7b6;
  --gold: #493a26;
  --gold-ink: #f0cb87;
  --lavender: #3d354b;
  --lavender-ink: #d7c6f4;
  --coral: #492e29;
  --coral-ink: #ffc2b3;
  --blue: #2d4050;
  --blue-ink: #b9d8ee;
  --shadow: 0 2px 6px #0001;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, textarea:disabled { cursor: default; opacity: .58; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
main:focus { outline: none; }
svg { flex-shrink: 0; vertical-align: middle; }
h1, h2, p { margin: 0; }
ul { padding: 0; margin: 0; list-style: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip { position: fixed; z-index: 20; top: .75rem; left: .75rem; padding: .6rem .9rem; transform: translateY(-180%); border-radius: .5rem; background: var(--surface); color: var(--accent); }
.skip:focus { transform: none; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
.launch-error { max-width: 40rem; margin: 5rem auto; }
.launch-error p { margin-top: 1rem; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: 28px 17px 19px; border-right: 1px solid var(--line); background: var(--surface-soft); overflow-y: auto; }
.brand { display: inline-flex; gap: 11px; align-items: center; align-self: flex-start; margin: 1px 9px 36px; font-size: 1.37rem; font-weight: 720; line-height: 1.15; letter-spacing: -.055em; white-space: nowrap; }
.brand b { font-weight: inherit; color: var(--accent); }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: .61rem; font-weight: 700; letter-spacing: .14em; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: #294733; color: #e1eecc; padding-top: 3px; }
.desktop-nav { display: grid; gap: 23px; }
.nav-group { display: grid; gap: 3px; }
.nav-group > p { padding: 0 12px 3px; color: var(--muted); font-size: .69rem; letter-spacing: .12em; font-weight: 700; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 43px; padding: 0 11px; border-radius: 9px; color: var(--muted); font-size: .92rem; font-weight: 560; }
.nav-link:hover, .nav-link[aria-current] { background: var(--active); color: var(--accent); }
.nav-link[aria-current] { font-weight: 720; }
.sidebar-footer { margin-top: auto; padding-top: 22px; }
.household-link { display: flex; align-items: center; gap: 10px; padding: 12px 7px 1px; border-top: 1px solid var(--line); }
.household-link strong, .household-link small { display: block; overflow-wrap: anywhere; }
.household-link strong { font-size: .82rem; }
.household-link small { color: var(--muted); font-size: .74rem; }
.avatars { display: inline-flex; flex-shrink: 0; align-items: center; }
.avatars span { display: grid; place-items: center; width: 30px; height: 30px; border: 2px solid var(--surface-soft); border-radius: 50%; background: #dce8d9; color: #395844; font-size: .69rem; font-weight: 800; }
.avatars span + span { margin-left: -9px; background: #efe0ce; color: #755334; }
.workspace { min-width: 0; }
.topbar { min-height: var(--topbar); background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: var(--topbar); max-width: 1460px; margin: 0 auto; padding: 0 clamp(26px, 3.2vw, 48px); gap: 12px; }
.workspace-label, .header-actions, .local-status { display: flex; align-items: center; gap: 9px; }
.workspace-label { font-size: .91rem; font-weight: 640; }
.workspace-label svg { color: var(--accent); }
.header-actions { gap: 15px; flex-shrink: 0; }
.local-status { color: var(--muted); font-size: .84rem; font-weight: 600; white-space: nowrap; }
.local-status i { border-radius: 50%; width: 7px; height: 7px; background: #709d68; }
.header-divider { width: 1px; height: 23px; background: var(--line); }
.mobile-brand, .bottom-nav { display: none; }

.content { max-width: 1460px; margin: 0 auto; padding: 28px clamp(26px, 3.2vw, 48px) 48px; }
.page-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 25px; }
.page-title h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2.2rem, 3.2vw, 3.02rem); line-height: 1.09; letter-spacing: -.048em; }
.page-title p { margin-top: 6px; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; min-height: 43px; padding: 8px 15px; border: 1px solid transparent; border-radius: 9px; font-size: .91rem; line-height: 1.3; font-weight: 700; white-space: nowrap; }
.primary { background: var(--primary); color: #f8fcf2; box-shadow: var(--shadow); }
.primary:hover { background: var(--primary-hover); }
.secondary { color: var(--accent); border-color: var(--line); background: var(--surface); }
.secondary:hover { background: var(--active); }
.icon-button { display: inline-grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; padding: 0; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.icon-button:hover:not(:disabled) { background: var(--active); color: var(--accent); }
.text-button { padding: 0; background: transparent; border: 0; text-align: left; }
.text-link { color: var(--accent); font-weight: 700; font-size: .875rem; white-space: nowrap; }
.text-link:hover, .item-name:hover { text-decoration: underline; text-underline-offset: .2em; }
.item-name { font-weight: 700; overflow-wrap: anywhere; }
.danger-quiet:hover:not(:disabled) { background: var(--coral); color: var(--coral-ink); }

.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 245px; border-radius: 19px; background: #263d2d; color: #f7f8ef; box-shadow: var(--shadow); }
.hero-image { position: absolute; z-index: -2; inset: 0 0 0 37%; background: url('./assets/cucina.jpg') center 53% / cover no-repeat; }
.hero::after { position: absolute; z-index: -1; content: ''; inset: 0; background: linear-gradient(90deg, #253d2e 28%, #253d2ef5 35%, #253d2e65 56%, #16211900 76%); }
.hero-copy { max-width: 61%; padding: 28px 35px; }
.hero-date { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: #dce8d5; font-size: .81rem; font-weight: 600; }
.hero h2 { font: 400 clamp(2.35rem, 4vw, 3.66rem)/.99 var(--serif); letter-spacing: -.055em; margin-bottom: 20px; overflow-wrap: anywhere; }
.hero-button { background: #e4eed9; color: #243f2c; }
.hero-button:hover { background: #f2f7ea; }
.hero-button:focus-visible { outline-color: #e4eed9; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 13px; margin-top: 25px; margin-bottom: 13px; }
.section-heading h2, .panel-heading h2, .feature h2, .settings-card h2, .side-panel h2, .catalog-card h2 { font-size: 1.15rem; line-height: 1.28; font-weight: 730; letter-spacing: -.025em; }
.demo-link { color: var(--muted); font-size: .78rem; font-weight: 630; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; }
.demo-link:hover { color: var(--accent); background: var(--active); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.metric { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-rows: min-content; column-gap: 8px; min-height: 126px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px 17px; box-shadow: var(--shadow); }
.metric:hover { border-color: var(--accent); }
.metric-label { grid-area: 1 / 1; align-self: center; color: var(--muted); font-size: .875rem; line-height: 1.25; font-weight: 650; }
.metric > .tile { grid-row: 1 / span 2; grid-column: 2; }
.metric-value { grid-column: 1; font-size: 2rem; font-weight: 690; line-height: 1.15; margin-top: 5px; letter-spacing: -.065em; }
.metric-detail { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; margin-top: 7px; }
.tile { display: grid; place-items: center; flex-shrink: 0; width: 39px; height: 39px; border-radius: 10px; }
.sage { background: var(--sage); color: var(--sage-ink); }
.gold { background: var(--gold); color: var(--gold-ink); }
.lavender { background: var(--lavender); color: var(--lavender-ink); }
.coral { background: var(--coral); color: var(--coral-ink); }
.blue { background: var(--blue); color: var(--blue-ink); }
.neutral { background: var(--active); color: var(--accent); }
.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 23px; padding: 3px 8px; font-size: .75rem; font-weight: 680; line-height: 1.2; border-radius: 5px; white-space: nowrap; }
.dashboard-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 17px 18px 12px; }
.panel-heading p { color: var(--muted); margin-top: 4px; font-size: .85rem; }
.panel-heading .text-link { padding-top: 1px; }
.preview-list { padding: 0 18px 8px; }
.preview-row { display: flex; align-items: center; min-height: 55px; gap: 10px; border-top: 1px solid var(--line); }
.preview-row .tile { width: 34px; height: 34px; border-radius: 8px; }
.row-copy { flex: 1; display: grid; min-width: 0; }
.row-copy > strong, .row-copy > button { color: var(--text); font-size: .91rem; line-height: 1.3; overflow-wrap: anywhere; }
.row-copy > span, .row-detail { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.row-detail { white-space: nowrap; }
.check { display: inline-grid; place-items: center; width: 34px; height: 38px; flex: 0 0 auto; position: relative; padding: 0; border: 0; border-radius: 8px; background: transparent; color: transparent; }
.check::before { content: ''; position: absolute; width: 21px; height: 21px; border: 1.5px solid var(--muted); border-radius: 6px; }
.check:hover { color: var(--muted); background: var(--surface-soft); }
.check[aria-pressed="true"] { color: var(--surface); }
.check[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }
.check svg { z-index: 1; }
.empty { display: grid; place-items: center; gap: 8px; text-align: center; min-height: 174px; padding: 24px; }
.empty p { color: var(--muted); max-width: 34ch; font-size: .92rem; }
.empty .button { margin-top: 5px; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.filter-tab { display: inline-flex; justify-content: center; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: .875rem; font-weight: 650; }
.filter-tab:hover, .filter-tab[aria-pressed="true"] { background: var(--active); color: var(--accent); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 9px; padding: 13px 15px 0; }
.filter-bar .search-input { flex: 1 1 210px; }
input:not([type="checkbox"]), select, textarea { min-width: 0; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; min-height: 42px; padding: 8px 10px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 49%, var(--muted) 51%), linear-gradient(135deg, var(--muted) 49%, transparent 51%); background-position: calc(100% - 13px) 50%, calc(100% - 8px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.search-input { display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--surface); }
.search-input:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.search-input input { padding: 7px 0; width: 100%; border: 0; color: var(--text); outline: none; background: transparent; }
.search-input input:focus-visible { outline: none; }
.result-count { margin: 11px 15px 8px; color: var(--muted); font-size: .84rem; }
.inventory-row, .inventory-head { display: grid; grid-template-columns: minmax(165px, 1.7fr) minmax(92px, .7fr) minmax(75px, .65fr) minmax(108px, 1fr) auto; gap: 10px; align-items: center; padding: 10px 15px; }
.inventory-head { color: var(--muted); background: var(--surface-soft); font-size: .8rem; font-weight: 690; }
.inventory-head > span:last-child { min-width: 76px; }
.inventory-row, .shopping-row { border-top: 1px solid var(--line); }
.inventory-row:first-child, .shopping-row:first-child { border-top: 0; }
.product-main { display: flex; gap: 9px; min-width: 0; align-items: center; }
.inventory-place, .inventory-amount { font-size: .86rem; overflow-wrap: anywhere; }
.inventory-place { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.inventory-amount { display: grid; }
.inventory-amount span { color: var(--muted); font-size: .77rem; }
.inventory-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.row-actions { display: flex; gap: 1px; }
.shopping-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(215px, .36fr); gap: 17px; align-items: start; }
.shopping-row { display: flex; align-items: center; gap: 9px; padding: 10px 15px; }
.checked-row .row-copy strong { color: var(--muted); text-decoration: line-through; }
.side-panel { padding: 18px; }
.side-panel h2 { margin-top: 11px; }
.side-panel dl { margin: 10px 0; }
.side-panel dl div { display: flex; justify-content: space-between; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.side-panel dd { margin: 0; font-weight: 700; }
.side-panel > p { margin-top: 14px; }
.catalog-search { max-width: 450px; margin-bottom: 17px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.catalog-card, .feature { padding: 18px; }
.feature .tile, .catalog-card .tile { margin-bottom: 13px; }
.feature p, .catalog-card p, .settings-card p { margin-top: 6px; color: var(--muted); font-size: .93rem; }
.catalog-footer { display: flex; justify-content: space-between; align-items: center; gap: 5px; margin-top: 13px; }
.content > .feature { margin-top: 17px; }
.progress-row { display: grid; grid-template-columns: 105px 1fr 30px; gap: 12px; align-items: center; margin: 13px 0; }
.progress-row meter { width: 100%; height: 15px; }
.settings-grid { display: grid; grid-template-columns: 1fr .9fr; gap: 16px; align-items: start; }
.settings-stack { display: grid; gap: 16px; }
.settings-card { padding: 18px; display: grid; gap: 12px; }
.settings-card .tabs { padding: 0; border: 0; }
.settings-card label, .modal-form label { display: grid; gap: 4px; font-size: .9rem; font-weight: 650; min-width: 0; }
.settings-card label input, .settings-card label textarea, .modal-form label input:not([type="checkbox"]), .modal-form select { width: 100%; font-size: 1rem; font-weight: 400; }
.settings-card .profile-fields { display: grid; gap: 8px; }
.data-settings .button { max-width: 100%; white-space: normal; }

.assistant { display: grid; grid-template-rows: 1fr auto; min-height: min(590px, 72vh); padding: 24px; }
.assistant-center { display: grid; place-items: center; align-content: center; gap: 13px; text-align: center; padding: 25px 0 39px; }
.assistant-mark { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 17px; background: var(--sage); color: var(--sage-ink); }
.assistant h2 { font: 400 clamp(2rem, 4vw, 3rem)/1.1 var(--serif); letter-spacing: -.044em; }
.assistant p { max-width: 46ch; color: var(--muted); }
.composer { width: min(100%, 650px); margin: 0 auto; padding: 11px; border-radius: 15px; background: var(--surface-soft); border: 1px solid var(--line); }
.composer textarea { display: block; background: transparent; border: 0; resize: none; padding: 6px; width: 100%; }
.composer-actions { display: flex; justify-content: space-between; }
.composer-actions > button { background: var(--active); }

dialog { max-height: calc(100dvh - 24px); width: min(500px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--text); box-shadow: 0 18px 70px #0005; overflow: auto; }
dialog::backdrop { background: #16201997; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 17px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; background: var(--surface); }
.dialog-heading h2 { font-size: 1.22rem; letter-spacing: -.025em; overflow-wrap: anywhere; }
.modal-form { display: grid; gap: 13px; padding: 17px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-form .inline-field { display: flex; align-items: center; width: fit-content; min-height: 35px; gap: 8px; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.destructive { background: #9c422f; color: white; }
.destructive:hover { background: #873222; }
.form-error, .settings-card .form-error { color: var(--coral-ink); background: var(--coral); border-radius: 6px; padding: 7px 9px; }
.choice-list, .dialog-nav { display: grid; gap: 5px; padding: 12px; }
.choice-list button, .dialog-nav a { display: flex; text-align: left; align-items: center; gap: 10px; padding: 9px; border: 0; border-radius: 8px; background: var(--surface); color: var(--accent); }
.choice-list button:hover, .dialog-nav a:hover { background: var(--active); }
.choice-list small { display: block; color: var(--muted); font-size: .84rem; }
.catalog-details { display: grid; margin: 0; gap: 9px; }
.catalog-details div { padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.catalog-details dt { color: var(--muted); font-size: .86rem; }
.catalog-details dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.product-photo { max-height: 170px; max-width: 100%; object-fit: contain; }
.toast { z-index: 25; position: fixed; bottom: 22px; right: 22px; max-width: calc(100vw - 44px); padding: 10px 14px; border-radius: 9px; background: var(--primary); color: white; box-shadow: 0 5px 17px #0002; font-size: .9rem; }
.toast-error { background: #923d2b; }

@media (max-width: 1120px) {
  :root { --sidebar: 200px; }
  .inventory-row, .inventory-head { grid-template-columns: minmax(125px, 1.3fr) minmax(80px, .68fr) minmax(60px, .53fr) minmax(88px, .9fr) auto; gap: 6px; }
  .inventory-row .icon-button { width: 33px; }
  .inventory-head > span:last-child { min-width: 67px; }
}

@media (max-width: 875px) {
  .app-shell { display: block; }
  .sidebar, .workspace-label { display: none; }
  .topbar-inner { min-height: 60px; padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left)); }
  .topbar { min-height: 60px; padding-top: env(safe-area-inset-top); }
  .mobile-brand { display: block; }
  .mobile-brand .brand { margin: 0; font-size: 1.2rem; gap: 8px; }
  .mobile-brand .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .mobile-brand .brand-mark svg { width: 21px; }
  .mobile-brand .brand small { font-size: .52rem; margin-top: 3px; }
  .bottom-nav { position: fixed; z-index: 5; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); background: var(--surface-soft); border-top: 1px solid var(--line); }
  .bottom-nav a, .bottom-nav button { display: grid; place-items: center; align-content: center; gap: 2px; padding: 4px 1px; min-height: 46px; background: transparent; border: 0; border-radius: 8px; color: var(--muted); font-size: .72rem; font-weight: 650; }
  .bottom-nav [aria-current], .bottom-nav .more-current { color: var(--accent); background: var(--active); font-weight: 750; }
  .content { padding: 22px max(18px, env(safe-area-inset-right)) calc(81px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
  .toast { bottom: calc(71px + env(safe-area-inset-bottom)); right: 14px; max-width: calc(100% - 28px); }
}

@media (max-width: 625px) {
  .page-title { align-items: flex-start; gap: 8px; margin-bottom: 19px; }
  .page-title h1 { font-size: clamp(1.95rem, 7.7vw, 2.45rem); }
  .page-title p { font-size: .9rem; }
  .page-title > .button { margin-top: 2px; padding-inline: 8px; font-size: .78rem; }
  .page-title > .button svg { width: 15px; }
  .hero { border-radius: 15px; min-height: 222px; }
  .hero-copy { max-width: 81%; padding: 26px 19px 22px; }
  .hero-image { left: 19%; background-position: 54% 54%; }
  .hero::after { background: linear-gradient(90deg, #253d2e 11%, #253d2ee9 29%, #253d2e79 65%, #253d2e20); }
  .hero h2 { font-size: clamp(2.3rem, 9.6vw, 3rem); }
  .metrics { gap: 7px; }
  .metric { padding: 9px; grid-template-columns: 1fr; column-gap: 0; min-height: 136px; }
  .metric > .tile { grid-row: 1; grid-column: 1; width: 29px; height: 29px; margin-bottom: 6px; border-radius: 7px; }
  .metric > .tile svg { width: 16px; }
  .metric-label { grid-area: 2 / 1; font-size: .75rem; }
  .metric-value { margin-top: 3px; font-size: 1.53rem; }
  .metric-detail { margin-top: 4px; font-size: .69rem; line-height: 1.25; }
  .dashboard-panels, .shopping-layout, .settings-grid { grid-template-columns: 1fr; gap: 12px; }
  .section-heading { margin-top: 20px; margin-bottom: 9px; }
  .dashboard-panels { margin-top: 13px; }
  .preview-row { min-height: 55px; }
  .inventory-head { display: none; }
  .inventory-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "product product actions" "place amount amount" "status status status"; gap: 7px 10px; padding: 11px 12px; }
  .inventory-row .product-main { grid-area: product; }
  .inventory-row .inventory-place { grid-area: place; }
  .inventory-row .inventory-amount { grid-area: amount; display: flex; align-items: center; gap: 6px; }
  .inventory-row .inventory-status { grid-area: status; }
  .inventory-row .row-actions { grid-area: actions; }
  .inventory-row .icon-button, .shopping-row .icon-button { width: 39px; height: 40px; }
  .inventory-row .product-main .tile { width: 34px; height: 34px; }
  .tabs { gap: 3px; padding: 8px; }
  .filter-tab { padding: 0 7px; font-size: .8rem; }
  .filter-bar { padding: 10px 8px 0; gap: 6px; }
  .filter-bar .search-input { flex: 1 0 100%; }
  .filter-bar select { min-width: 0; flex: 1 1 120px; }
  .search-input input, .filter-bar select { font-size: 1rem; }
  .feature-grid { grid-template-columns: 1fr; gap: 9px; }
  .assistant { min-height: 450px; padding: 12px; }
}

@media (max-width: 360px) {
  .local-status, .header-divider { display: none; }
  .page-title { flex-direction: column; align-items: flex-start; }
  .hero-copy { max-width: 94%; }
}

.mobile-menu { display: none; }
.record-stack, .scan-list { display: grid; gap: .75rem; }
.record-stack > h3, .feature h3 { margin: 0; font-size: 1rem; }
.record-stack label, .record-row label, .feature > label, .scanner-layout label, .plan > label {
  display: grid; min-width: 0; gap: 4px; font-size: .9rem; font-weight: 650;
}
.record-stack input, .record-stack select, .record-stack textarea { font-size: 1rem; }
.record-stack label > input:not([type="checkbox"]), .record-stack label > textarea, .record-stack label > select,
.record-row label > input:not([type="checkbox"]), .record-row label > select { width: 100%; }
.record-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .55rem; }
.record-actions .button { white-space: normal; }
.record-row { min-width: 0; margin: 0 0 .6rem; padding: .8rem; border: 1px solid var(--line); border-radius: .65rem; }
.record-row > * + *, .profile-fields > * + * { margin-top: .5rem; }
summary { cursor: pointer; font-weight: 650; }
.feature details > summary, .modal-form summary { padding: .25rem 0; }
.list-lines { padding: .4rem 0; }
.list-lines li { margin-bottom: .35rem; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { display: block; padding: .7rem .85rem; border-radius: .55rem; background: var(--active); color: var(--accent); overflow-wrap: anywhere; }
.notice a { text-decoration: underline; }
.file-control { display: grid; gap: 5px; font-weight: 650; margin-top: .5rem; }
.file-control input { width: 100%; }
.receipt-preview { display: block; max-width: 100%; max-height: 360px; margin: .5rem auto; object-fit: contain; }
.product-thumb { width: 52px; height: 52px; padding: 3px; border-radius: 9px; object-fit: contain; background: var(--surface-soft); }
.catalog-card > .product-thumb { width: 72px; height: 72px; margin-bottom: .75rem; }
.inventory-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: .65rem; padding: .75rem; }
.inventory-cards .inventory-row { display: flex; flex-wrap: wrap; justify-content: space-between; padding: .75rem; border: 1px solid var(--line); border-radius: .75rem; }
.inventory-cards .product-main { flex: 1 1 100%; }
.inventory-cards .inventory-status { flex: 1 1 100%; }
.inventory-head > span:last-child { min-width: 116px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .55rem; margin: .85rem 0; }
.plan-day { min-height: 74px; gap: .4rem; display: grid; align-content: start; border: 1px solid var(--line); border-radius: .7rem; padding: .65rem; }
.plan-day strong { text-transform: capitalize; }
.plan-meal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .35rem; margin-top: .3rem; padding-top: .4rem; border-top: 1px solid var(--line); }
.plan-meal .button { min-height: 38px; padding: 5px 8px; }
.breakdown li { display: grid; grid-template-columns: minmax(5rem, 1fr) minmax(2rem, 2fr) auto; align-items: center; gap: .6rem; padding: .25rem 0; overflow-wrap: anywhere; }
.breakdown meter { width: 100%; }
#scan-video { width: 100%; min-height: 100px; max-height: 340px; object-fit: contain; background: #111; border-radius: .65rem; }
.scan-row { margin: .35rem 0; padding: .6rem; display: grid; gap: .55rem; border: 1px solid var(--line); border-radius: .7rem; }
.scan-row input, .scan-row select { width: 100%; }
.guest-shell { padding: max(1.25rem, env(safe-area-inset-top)) 1rem 2rem; }
.auth-gate { max-width: 470px; display: grid; gap: .9rem; margin: 1rem auto; padding: clamp(1rem, 5vw, 2rem); }
.auth-gate h1 { font: 400 2.45rem/1.1 var(--serif); }
.chat-box { display: grid; gap: 1rem; }
.chat-timeline { display: grid; gap: .75rem; min-height: 16vh; }
.chat-message { justify-self: start; min-width: 0; width: min(100%, 46rem); padding: .75rem; background: var(--surface-soft); border-radius: .75rem; }
.chat-user { justify-self: end; width: fit-content; max-width: min(85%, 39rem); background: var(--active); }
.chat-message .notice { margin-top: .65rem; }
.assistant-shortcuts { justify-content: center; }
.update-notice { position: fixed; z-index: 5; top: max(env(safe-area-inset-top), .55rem); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 1rem); display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--surface); box-shadow: var(--shadow); }

@media (max-width: 1120px) { .inventory-head > span:last-child { min-width: 101px; } }
@media (max-width: 875px) {
  .mobile-menu { display: inline-grid; }
  .header-actions { gap: .4rem; }
  .topbar-inner { padding-right: max(10px, env(safe-area-inset-right)); }
  .bottom-nav button, .bottom-nav a { min-height: 46px; }
  .icon-button.mobile-menu, .preview-row .check, .shopping-row .check { min-width: 44px; min-height: 44px; }
}
@media (max-width: 625px) {
  .inventory-row .icon-button, .shopping-row .icon-button { min-width: 44px; min-height: 44px; }
  .shopping-row { padding-inline: .5rem; gap: .3rem; }
  .row-actions { gap: 0; }
  .plan-grid { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
}
@media (max-width: 360px) {
  .header-divider { display: none; }
  .local-status { display: flex; gap: .28rem; max-width: 74px; font-size: .71rem; }
  .topbar-inner { padding-left: 10px; }
  .chat-user { max-width: 94%; }
}
