:root {
  color-scheme: light;
  --ink: #16352e;
  --muted: #6b7b76;
  --green: #1f6b56;
  --green-dark: #173f35;
  --mint: #dff3e8;
  --mint-strong: #bde5d1;
  --cream: #f7f5ed;
  --paper: rgba(255, 255, 252, 0.92);
  --line: #dfe6e1;
  --danger: #b94c42;
  --shadow: 0 24px 60px rgba(23, 63, 53, 0.12);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--cream); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 5%, rgba(189, 229, 209, 0.55), transparent 28rem),
    radial-gradient(circle at 90% 90%, rgba(237, 213, 161, 0.25), transparent 30rem),
    var(--cream);
}

button, input, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.35;
  pointer-events: none;
}
.ambient-one { top: -8rem; right: 5vw; background: #a7d8c0; }
.ambient-two { bottom: -10rem; left: -5rem; background: #efd69f; }

.app-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 72px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 6px 0 38px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; color: white; background: var(--green-dark); box-shadow: 0 10px 24px rgba(23, 63, 53, 0.2); }
.brand-mark svg { width: 26px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; letter-spacing: -0.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 0.75rem; }

.profile-button { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 8px 12px 8px 8px; border: 1px solid rgba(31, 107, 86, 0.12); border-radius: 18px; background: rgba(255, 255, 252, 0.72); box-shadow: 0 8px 24px rgba(23, 63, 53, 0.06); }
.profile-button:hover { border-color: var(--mint-strong); background: #fff; }
.profile-button > svg { width: 18px; margin-left: auto; fill: none; stroke: currentColor; stroke-width: 2; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 13px; color: white; background: var(--green); font-weight: 800; }
.profile-copy { text-align: left; }
.profile-copy small, .profile-copy strong { display: block; }
.profile-copy small { margin-bottom: 1px; color: var(--muted); font-size: 0.68rem; }
.profile-copy strong { max-width: 110px; overflow: hidden; font-size: 0.86rem; text-overflow: ellipsis; white-space: nowrap; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 30px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 9px; color: var(--green); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.hero h1 { max-width: 740px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.65rem, 7vw, 5.4rem); font-weight: 500; letter-spacing: -0.065em; line-height: 0.96; }
.hero > div > p:last-child { max-width: 620px; margin: 18px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.summary { display: flex; gap: 6px; padding: 8px; border: 1px solid rgba(31, 107, 86, 0.1); border-radius: 20px; background: rgba(255, 255, 252, 0.7); }
.summary div { min-width: 108px; padding: 14px 16px; border-radius: 14px; text-align: center; }
.summary div:first-child { background: var(--mint); }
.summary strong, .summary span { display: block; }
.summary strong { font-family: Georgia, serif; font-size: 1.85rem; font-weight: 500; }
.summary span { margin-top: 2px; color: var(--muted); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; }

.view-tabs { display: flex; gap: 6px; width: fit-content; margin-bottom: 18px; padding: 5px; border: 1px solid rgba(31, 107, 86, 0.1); border-radius: 17px; background: rgba(255, 255, 252, 0.65); }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; font-size: 0.86rem; font-weight: 750; }
.tab svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: white; background: var(--green-dark); box-shadow: 0 7px 18px rgba(23, 63, 53, 0.18); }

.view { display: none; }
.view.is-active { display: block; }
#list-view, #inventory-view { padding: 20px; border: 1px solid rgba(31, 107, 86, 0.1); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); backdrop-filter: blur(12px); }

.list-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.list-actions { display: flex; align-items: end; gap: 8px; }
.select-wrap { display: grid; gap: 5px; min-width: min(390px, 70%); }
.select-wrap span, .dialog-input span, .details-grid label { color: var(--muted); font-size: 0.72rem; font-weight: 750; }
.select-wrap select, .dialog-input input, .dialog-input select, .details-grid input { width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; outline: none; }
.select-wrap select { height: 45px; padding: 0 42px 0 13px; font-weight: 750; }

.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; font-weight: 800; transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease; }
.primary-button:active, .secondary-button:active { transform: translateY(1px); }
.primary-button { min-height: 44px; padding: 0 20px; border: 0; color: white; background: var(--green); box-shadow: 0 8px 18px rgba(31, 107, 86, 0.2); }
.primary-button:hover { background: #195b49; }
.primary-button:disabled { cursor: wait; opacity: 0.6; }
.secondary-button { min-height: 45px; padding: 0 15px; border: 1px solid var(--line); background: #fff; }
.secondary-button:hover { border-color: var(--mint-strong); background: var(--mint); }
.secondary-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.full-width { width: 100%; }

.quick-add { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.quick-add:focus-within { border-color: #96cbb2; box-shadow: 0 0 0 4px rgba(31, 107, 86, 0.08); }
.quick-add-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px; }
.quick-add-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; color: var(--green); background: var(--mint); }
.quick-add-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.quick-add-main label { min-width: 0; }
.quick-add-main input { width: 100%; height: 44px; padding: 0 5px; border: 0; color: var(--ink); background: transparent; outline: none; font-size: 1rem; }
.quick-add-main input::placeholder { color: #98a39f; }
.quick-add details { border-top: 1px solid #edf0ee; }
.quick-add summary { width: fit-content; padding: 9px 14px; color: var(--muted); font-size: 0.73rem; font-weight: 700; cursor: pointer; }
.details-grid { display: grid; grid-template-columns: 0.7fr 1fr 1.5fr; gap: 10px; padding: 0 14px 14px; }
.details-grid label { display: grid; gap: 5px; }
.details-grid input { height: 40px; padding: 0 10px; font-size: 0.86rem; }

.status-row { display: flex; justify-content: space-between; padding: 13px 4px 8px; color: var(--muted); font-size: 0.72rem; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #43a479; box-shadow: 0 0 0 3px rgba(67, 164, 121, 0.12); }
.status-row.is-syncing .status-dot { background: #d99a34; }
.text-button { padding: 0; border: 0; color: var(--green); background: transparent; font-size: inherit; font-weight: 800; }

.item-group { margin-top: 14px; }
.group-title { display: flex; align-items: center; gap: 9px; margin: 0 6px 8px; color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.group-title span { display: grid; place-items: center; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 99px; color: var(--green-dark); background: var(--mint); font-size: 0.68rem; }
.items-list { display: grid; gap: 7px; }
.shopping-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 66px; padding: 10px 12px; border: 1px solid #e6ebe7; border-radius: 16px; background: #fff; transition: border 120ms ease, transform 120ms ease, opacity 120ms ease; }
.shopping-item:hover { border-color: var(--mint-strong); transform: translateY(-1px); }
.shopping-item.is-purchased { opacity: 0.64; background: #fafbf9; }
.shopping-item.is-purchased .item-copy strong { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.check-button { display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid #a9bab4; border-radius: 10px; background: white; }
.check-button svg { width: 16px; fill: none; stroke: white; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.check-button:disabled { cursor: not-allowed; border-style: dashed; opacity: .45; }
.is-purchased .check-button { border-color: var(--green); background: var(--green); }
.is-purchased .check-button svg { opacity: 1; }
.item-copy { min-width: 0; }
.item-copy strong { display: block; overflow: hidden; font-size: 0.96rem; text-overflow: ellipsis; white-space: nowrap; }
.item-copy small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.quantity-badge { padding: 6px 9px; border-radius: 9px; color: var(--green-dark); background: var(--mint); font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.delete-button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; color: #96a29e; background: transparent; }
.delete-button:hover { color: var(--danger); background: #fff0ee; }
.delete-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.empty-state { padding: 50px 20px 42px; text-align: center; }
.empty-state.is-hidden { display: none; }
.empty-illustration { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 20px; color: var(--green); background: var(--mint); font-family: Georgia, serif; font-size: 1.6rem; }
.empty-illustration.box { font-size: 2rem; }
.empty-state h2 { margin: 0 0 7px; font-family: Georgia, serif; font-weight: 500; }
.empty-state p { max-width: 440px; margin: 0 auto; color: var(--muted); line-height: 1.55; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2, .ai-card h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 500; letter-spacing: -0.035em; }
.count-pill { padding: 7px 10px; border-radius: 99px; color: var(--green-dark); background: var(--mint); font-size: 0.72rem; font-weight: 800; }
.inventory-add { margin-bottom: 20px; }
.inventory-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.inventory-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 16px; border: 1px solid #e5ebe7; border-radius: 17px; background: #fff; }
.inventory-card.is-missing { border-color: #edc9a6; background: #fffaf4; }
.inventory-card h3 { margin: 0 0 5px; font-size: 0.96rem; }
.inventory-card p { margin: 0; color: var(--muted); font-size: 0.74rem; }
.inventory-actions { display: flex; grid-column: 1 / -1; gap: 7px; margin-top: 7px; }
.inventory-actions button { flex: 1; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 0.72rem; font-weight: 800; }
.inventory-actions button:hover { border-color: var(--mint-strong); background: var(--mint); }
.inventory-actions .add-missing { color: white; border-color: var(--green); background: var(--green); }
.inventory-actions .inventory-delete { color: var(--danger); }
.inventory-actions .inventory-delete:hover { border-color: #e3aaa4; background: #fff0ee; }

.ai-card { position: relative; overflow: hidden; padding: clamp(28px, 6vw, 72px); border-radius: 28px; color: #f6fff9; background: linear-gradient(145deg, #173f35, #1f6b56); box-shadow: var(--shadow); }
.ai-card::after { content: ""; position: absolute; right: -10%; bottom: -50%; width: 27rem; height: 27rem; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255,255,255,.025), 0 0 0 110px rgba(255,255,255,.018); pointer-events: none; }
.ai-card .eyebrow { color: #bde5d1; }
.ai-card > p:not(.eyebrow) { max-width: 690px; margin: 18px 0 0; color: rgba(246,255,249,.75); line-height: 1.7; }
.ai-orbit { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 28px; border: 1px solid rgba(255,255,255,.25); border-radius: 22px; background: rgba(255,255,255,.08); font-size: 1.6rem; }
.ai-flow { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 32px; }
.ai-flow span { padding: 9px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: rgba(255,255,255,.08); font-size: 0.75rem; font-weight: 750; }
.ai-flow b { color: #bde5d1; }
.ai-form { position: relative; z-index: 1; display: grid; gap: 12px; max-width: 760px; margin-top: 30px; padding: 16px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.08); }
.ai-form > label { display: grid; gap: 8px; }
.ai-form > label > span { color: #d9f0e4; font-size: .74rem; font-weight: 800; }
.ai-form textarea { width: 100%; resize: vertical; min-height: 102px; padding: 13px; border: 1px solid rgba(255,255,255,.15); border-radius: 13px; color: #f6fff9; background: rgba(0,0,0,.15); outline: none; line-height: 1.5; }
.ai-form textarea::placeholder { color: rgba(246,255,249,.48); }
.ai-form textarea:focus { border-color: #bde5d1; box-shadow: 0 0 0 3px rgba(189,229,209,.12); }
.ai-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.image-picker, .ai-submit { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 14px; border-radius: 12px; font-size: .78rem; font-weight: 800; cursor: pointer; }
.image-picker { border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.07); }
.image-picker:hover { background: rgba(255,255,255,.12); }
.image-picker svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.image-picker.has-image { color: #173f35; background: #bde5d1; }
.ai-submit { border: 0; color: #173f35; background: #dff3e8; box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.ai-submit:hover { background: #fff; }
.ai-submit:disabled { cursor: wait; opacity: .62; }
.ai-result { position: relative; z-index: 1; max-width: 760px; margin-top: 14px; padding: 18px; border-radius: 18px; color: var(--ink); background: #fffef9; }
.ai-result-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.ai-result h3 { margin: 0; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 500; }
.ai-result-head span { padding: 5px 8px; border-radius: 99px; color: var(--green-dark); background: var(--mint); font-size: .65rem; font-weight: 800; }
.ai-result > p { margin: 7px 0 14px; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.ai-proposals { display: grid; gap: 6px; }
.ai-proposal { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; }
.ai-proposal input { width: 18px; height: 18px; accent-color: var(--green); }
.ai-proposal strong { display: block; font-size: .84rem; }
.ai-proposal small { display: block; margin-top: 2px; color: var(--muted); font-size: .66rem; }
.ai-proposal > span { color: var(--green-dark); font-size: .7rem; font-weight: 800; white-space: nowrap; }
.ai-home-note, .ai-warnings { margin-top: 12px; padding: 10px 11px; border-radius: 11px; font-size: .72rem; line-height: 1.5; }
.ai-home-note { color: #315e50; background: var(--mint); }
.ai-warnings { color: #76552e; background: #fff3dd; }
.ai-apply { width: 100%; min-height: 43px; margin-top: 13px; border: 0; border-radius: 12px; color: white; background: var(--green); font-weight: 800; }
.ai-apply:disabled { cursor: wait; opacity: .6; }

.leaflets-card { padding: clamp(22px, 5vw, 52px); border: 1px solid rgba(31, 107, 86, .1); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.leaflets-lead { max-width: 680px; margin: 0 0 22px; color: var(--muted); line-height: 1.65; }
.leaflets-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.leaflet-store { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 126px; padding: 13px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fff; text-align: left; text-decoration: none; font: inherit; cursor: pointer; transition: transform 120ms ease, box-shadow 120ms ease, border 120ms ease; }
.leaflet-store:hover { transform: translateY(-2px); border-color: var(--mint-strong); box-shadow: 0 14px 30px rgba(23,63,53,.09); }
.store-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: white; font-family: Georgia, serif; font-size: 1.6rem; font-weight: 700; }
.leaflet-store.biedronka .store-mark { color: #231f20; background: #ffd500; }
.leaflet-store.lidl .store-mark { color: #0050aa; background: #fff000; box-shadow: inset 0 0 0 4px #0050aa; }
.leaflet-cover { width: 82px; height: 100px; border-radius: 11px; object-fit: cover; object-position: top; background: #f1f3ef; }
.leaflet-copy { min-width: 0; }
.leaflet-store strong, .leaflet-store small, .leaflet-store .leaflet-copy span { display: block; }
.leaflet-store small { margin-bottom: 5px; color: var(--green); font-size: .68rem; font-weight: 850; text-transform: uppercase; }
.leaflet-store strong { display: -webkit-box; overflow: hidden; font-size: .9rem; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.leaflet-store .leaflet-copy span { margin-top: 7px; color: var(--muted); font-size: .68rem; }
.leaflet-store b { color: var(--green); font-size: .75rem; }
.leaflet-ai-box { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; padding: 20px; border-radius: 18px; background: var(--mint); }
.leaflet-ai-box strong { display: block; }
.leaflet-ai-box p { max-width: 670px; margin: 6px 0 0; color: #496a60; font-size: .78rem; line-height: 1.55; }
.source-note { margin: 15px 2px 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.promotion-status { margin: -8px 0 14px; color: var(--green); font-size: .74rem; font-weight: 800; }
.store-source-badge { flex: 0 0 auto; padding: 9px 12px; border-radius: 99px; color: var(--green-dark); background: #fff; font-size: .72rem; font-weight: 850; }

.leaflet-dialog { width: min(1040px, calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 24px; background: transparent; box-shadow: 0 30px 90px rgba(13, 38, 31, .35); }
.leaflet-dialog::backdrop { background: rgba(12, 29, 25, .68); backdrop-filter: blur(5px); }
.leaflet-dialog-card { position: relative; padding: 22px; border-radius: 24px; background: #fffef9; }
.leaflet-dialog-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding-right: 42px; }
.leaflet-dialog-head h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 500; }
.leaflet-dialog-head p:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); font-size: .72rem; }
.leaflet-dialog-head > span { color: var(--green); font-size: .76rem; font-weight: 850; }
.leaflet-stage { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 10px; margin-top: 15px; }
.leaflet-image-wrap { position: relative; display: grid; place-items: center; overflow: auto; height: min(62dvh, 720px); padding: 8px; border-radius: 16px; background: #e9ece8; }
.leaflet-image-wrap img { display: block; width: auto; max-width: 100%; height: auto; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 35px rgba(13,38,31,.18); cursor: crosshair; }
.leaflet-click-hint { position: absolute; left: 50%; bottom: 17px; padding: 7px 11px; border-radius: 99px; color: white; background: rgba(23,63,53,.88); font-size: .68rem; font-weight: 800; transform: translateX(-50%); pointer-events: none; white-space: nowrap; }
.leaflet-target { position: absolute; width: 30px; height: 30px; border: 3px solid white; border-radius: 50%; background: rgba(31,107,86,.48); box-shadow: 0 0 0 3px var(--green), 0 4px 14px rgba(0,0,0,.3); transform: translate(-50%, -50%); pointer-events: none; }
.leaflet-nav { display: grid; place-items: center; width: 42px; height: 56px; border: 1px solid var(--line); border-radius: 13px; color: var(--green); background: #fff; font-size: 2rem; line-height: 1; }
.leaflet-nav:hover:not(:disabled) { border-color: var(--mint-strong); background: var(--mint); }
.leaflet-nav:disabled { opacity: .28; }
.leaflet-thumbnails { display: flex; justify-content: center; gap: 6px; overflow-x: auto; margin: 12px 54px 0; padding-bottom: 2px; }
.leaflet-thumbnail { position: relative; flex: 0 0 48px; height: 65px; padding: 2px; overflow: hidden; border: 2px solid transparent; border-radius: 9px; background: #f0f2ee; }
.leaflet-thumbnail.is-active { border-color: var(--green); }
.leaflet-thumbnail img { width: 100%; height: 100%; border-radius: 5px; object-fit: cover; object-position: top; }
.leaflet-thumbnail span { position: absolute; right: 3px; bottom: 3px; min-width: 17px; padding: 2px 4px; border-radius: 6px; color: white; background: rgba(23,63,53,.86); font-size: .58rem; font-weight: 800; }
.promotion-pick { display: grid; gap: 9px; margin: 13px 54px 0; padding: 14px; border: 1px solid var(--mint-strong); border-radius: 15px; background: var(--mint); }
.promotion-pick-head { display: flex; justify-content: space-between; gap: 12px; }
.promotion-pick-head span { color: var(--muted); font-size: .62rem; }
.promotion-pick label { display: grid; gap: 4px; color: var(--muted); font-size: .66rem; font-weight: 800; }
.promotion-pick input { width: 100%; height: 39px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.promotion-pick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.promotion-pick p { margin: 0; color: #76552e; font-size: .7rem; }
.promotion-pick-loading { display: flex; align-items: center; gap: 12px; min-height: 45px; color: var(--green-dark); font-size: .76rem; }
.promotion-pick-loading .loader { width: 24px; height: 24px; }

.dialog { width: min(460px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: transparent; box-shadow: 0 30px 80px rgba(13, 38, 31, 0.28); }
.dialog::backdrop { background: rgba(18, 38, 33, 0.48); backdrop-filter: blur(4px); }
.dialog-card { position: relative; padding: 28px; border-radius: 24px; background: #fffef9; }
.dialog-card h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 500; letter-spacing: -0.04em; }
.dialog-lead { margin: 8px 0 20px; color: var(--muted); font-size: 0.86rem; }
.dialog-close { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border: 0; border-radius: 11px; color: var(--muted); background: #f3f4ef; font-size: 1.35rem; }
.profile-list { display: grid; gap: 7px; }
.profile-choice { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: white; text-align: left; }
.profile-choice:hover { border-color: var(--mint-strong); background: var(--mint); }
.profile-choice .avatar { width: 36px; height: 36px; border-radius: 11px; }
.profile-choice strong { display: block; font-size: 0.88rem; }
.profile-choice small { color: var(--muted); font-size: 0.7rem; }
.dialog-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: #99a39f; font-size: 0.68rem; text-transform: uppercase; }
.dialog-divider::before, .dialog-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.dialog-input { display: grid; gap: 6px; margin-bottom: 13px; }
.dialog-input input, .dialog-input select { height: 45px; padding: 0 12px; }
.share-actions { display: grid; gap: 8px; }
.share-link-wrap input { padding-right: 12px; color: #36564e; background: #f7f8f4; font-size: .75rem; }
.share-note { margin: 16px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.danger-button { min-height: 44px; padding: 0 16px; border: 1px solid #efc6c1; border-radius: 13px; color: var(--danger); background: #fff7f5; font-weight: 800; }
.danger-button:hover { border-color: #db9189; background: #fff0ee; }
.danger-button:disabled { cursor: wait; opacity: .6; }
.recipes-card { padding: 26px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.76); box-shadow: var(--shadow); }
.recipes-lead { margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.recipes-grid { display: grid; gap: 14px; }
.recipe-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.recipe-card-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.recipe-card h3 { margin: 0 0 5px; color: var(--green-dark); }
.recipe-meta, .recipe-summary { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.recipe-columns { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; margin-top: 14px; }
.recipe-columns h4 { margin: 0 0 7px; }
.recipe-columns ul, .recipe-columns ol { margin: 0; padding-left: 20px; }
.recipe-columns li { margin-bottom: 6px; line-height: 1.45; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.ai-save-recipe { min-height: 42px; margin-top: 10px; padding: 0 15px; border: 0; border-radius: 12px; color: white; background: var(--green); font-weight: 800; }

.guest-mode .profile-button,
.guest-mode .view-tabs,
.guest-mode .list-toolbar,
.guest-mode #inventory-view,
.guest-mode #ai-view,
.guest-mode #recipes-view,
.guest-mode #promotions-view { display: none !important; }
.guest-mode .topbar { justify-content: flex-start; }
.guest-mode #list-view { max-width: 820px; margin: 0 auto; }

.toast { position: fixed; z-index: 50; right: 24px; bottom: 24px; max-width: min(430px, calc(100% - 32px)); padding: 13px 16px; border-radius: 13px; color: white; background: var(--green-dark); box-shadow: 0 16px 40px rgba(13, 38, 31, 0.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #8e3f38; }

.loading-screen { position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--green-dark); background: var(--cream); transition: opacity 200ms ease, visibility 200ms ease; }
.loading-screen.is-hidden { opacity: 0; visibility: hidden; }
.loader { width: 34px; height: 34px; border: 3px solid var(--mint-strong); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.is-hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 20px, 1120px); padding-top: 12px; }
  .topbar { padding-bottom: 26px; }
  .brand small, .profile-copy small { display: none; }
  .profile-button { min-width: 0; padding-right: 8px; }
  .profile-button > svg { display: none; }
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero h1 { font-size: clamp(2.6rem, 14vw, 4.3rem); }
  .summary { width: 100%; }
  .summary div { flex: 1; }
  .view-tabs { width: 100%; flex-wrap: wrap; }
  .tab { flex: 1 1 calc(50% - 3px); justify-content: center; padding-inline: 8px; font-size: 0.77rem; }
  #list-view, #inventory-view { padding: 13px; border-radius: 22px; }
  .list-toolbar { align-items: stretch; }
  .select-wrap { min-width: 0; flex: 1; }
  .list-actions .secondary-button { align-self: end; width: 45px; padding: 0; font-size: 0; }
  .list-actions .secondary-button svg { margin: 0; }
  .quick-add-main { grid-template-columns: minmax(0, 1fr) auto; }
  .quick-add-icon { display: none; }
  .details-grid { grid-template-columns: 1fr 1fr; }
  .details-grid label:last-child { grid-column: 1 / -1; }
  .shopping-item { grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; }
  .quantity-badge { grid-column: 2; width: fit-content; margin-top: -5px; }
  .delete-button { grid-column: 3; grid-row: 1 / 3; }
  .inventory-grid { grid-template-columns: 1fr; }
  .leaflets-grid { grid-template-columns: 1fr; }
  .leaflet-ai-box { align-items: stretch; flex-direction: column; }
  .ai-card { border-radius: 22px; }
  .recipes-card { padding: 14px; border-radius: 22px; }
  .recipe-columns { grid-template-columns: 1fr; }
  .ai-flow b { display: none; }
  .ai-form-actions { align-items: stretch; flex-direction: column; }
  .image-picker, .ai-submit { width: 100%; }
  .leaflet-dialog { width: calc(100% - 10px); max-height: calc(100dvh - 10px); }
  .leaflet-dialog-card { padding: 14px 10px 12px; }
  .leaflet-stage { grid-template-columns: 34px minmax(0, 1fr) 34px; gap: 4px; }
  .leaflet-image-wrap { height: 58dvh; padding: 4px; }
  .leaflet-nav { width: 33px; height: 50px; }
  .leaflet-thumbnails, .promotion-pick { margin-inline: 38px; }
  .leaflet-click-hint { max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; }
  .toast { right: 16px; bottom: 16px; }
}

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