:root {
  --primary: #4a7c59;
  --primary-dark: #3a6248;
  --primary-light: #e8f5ed;
  --accent: #e8753a;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface2: #f8f8f8;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --text2: #666;
  --text3: #999;
  --red: #cc071e;
  --green: #4a7c59;
  --nav-h: 64px;
  --header-h: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 16px; }

.hidden { display: none !important; }

/* Login */
.login-screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--primary); z-index: 1000; }
.login-card { background: var(--surface); border-radius: var(--radius); padding: 2rem; width: min(90vw, 360px); box-shadow: var(--shadow-lg); }
.login-logo { font-size: 3rem; text-align: center; margin-bottom: .5rem; }
.login-card h1 { text-align: center; color: var(--primary); margin-bottom: .5rem; }
.login-card p { text-align: center; color: var(--text2); margin-bottom: 1.5rem; font-size: .9rem; }
.login-card label { display: block; font-size: .85rem; font-weight: 600; color: var(--text2); margin-bottom: 1rem; }
.login-card input { display: block; width: 100%; margin-top: .25rem; padding: .6rem .75rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 1rem; outline: none; }
.login-card input:focus { border-color: var(--primary); }
.error-msg { color: var(--red); font-size: .85rem; margin-bottom: .75rem; padding: .5rem; background: #fff0f0; border-radius: var(--radius-sm); }

/* App layout */
#app { height: 100vh; display: flex; flex-direction: column; }
.tab-content { flex: 1; overflow-y: auto; padding-bottom: var(--nav-h); }
.tab-content.hidden { display: none; }

/* Bottom nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); background: var(--surface); border-top: 1px solid var(--border); display: flex; z-index: 100; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border: none; background: none; cursor: pointer; padding: .4rem; gap: .1rem; color: var(--text3); transition: color .15s; position: relative; }
.nav-btn.active { color: var(--primary); }
.nav-btn.active::before { content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 3px; background: var(--primary); border-radius: 0 0 3px 3px; }
.nav-btn.active .nav-label { font-weight: 800; }
.nav-icon { font-size: 1.4rem; line-height: 1; transition: transform .15s; }
.nav-label { font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

/* Tab headers */
.tab-header { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: .75rem 1rem; display: flex; align-items: center; gap: .75rem; z-index: 10; box-shadow: 0 2px 4px rgba(0,0,0,.04); }
.tab-header h2 { font-size: 1.1rem; font-weight: 700; flex: 1; }
.tab-header .search-inline { flex: 1; min-width: 0; font-size: .9rem; padding: .4rem .75rem; }
.tab-header .actions { display: flex; gap: .4rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem 1rem; border: none; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: none; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: none; color: var(--text2); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: white; }
.btn-icon { padding: .4rem; border-radius: 50%; }
.btn-full { width: 100%; margin-top: .5rem; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

/* Recipe cards */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; padding: .75rem; }
.recipe-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.recipe-card .rc-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); font-size: 3rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.recipe-card img.rc-img { display: block; }
.recipe-card .rc-body { padding: .5rem; display: flex; flex-direction: column; flex: 1; }
.recipe-card .rc-name { font-weight: 600; font-size: .9rem; line-height: 1.3; flex: 1; }
.recipe-card .rc-footer { margin-top: .4rem; }
.recipe-card .rc-meta { display: flex; gap: .4rem; align-items: center; }
.recipe-card .rc-rating { color: #f5a623; font-size: .8rem; }
.recipe-card .rc-portions { color: var(--text3); font-size: .75rem; }
.recipe-card .rc-price { color: var(--accent); font-size: .75rem; font-weight: 600; margin-left: auto; }
.recipe-card .rc-season { display: flex; justify-content: space-between; flex-wrap: nowrap; align-items: center; margin-top: .3rem; }
.recipe-card .rc-season-icon { font-size: .75rem; line-height: 1; }
.recipe-section { margin-bottom: .5rem; }
.recipe-section-header { font-size: .8rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; padding: .5rem .75rem .25rem; }
.month-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); display: inline-block; }
.month-dot.active { background: var(--primary); }

/* Recipe detail (modal) */
.recipe-detail { padding: 1rem; max-width: 800px; margin: 0 auto; }
.recipe-detail h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.rd-hero { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.rd-hero-img-wrap { position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.rd-hero-img { width: 140px; height: 140px; object-fit: cover; border-radius: var(--radius); display: block; }
.rd-rotate-btns { position: absolute; bottom: 4px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; opacity: 0; transition: opacity .15s; }
.rd-hero-img-wrap:hover .rd-rotate-btns { opacity: 1; }
.rd-rotate-btn { background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 4px; font-size: 1.1rem; line-height: 1; padding: 2px 7px; cursor: pointer; }
.rd-rotate-btn:hover { background: rgba(0,0,0,.8); }
.rd-hero-info { flex: 1; min-width: 0; padding-top: .25rem; }
.rd-category { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); margin-bottom: .4rem; }
.rd-meta { display: flex; gap: .5rem .75rem; flex-wrap: wrap; color: var(--text2); font-size: .85rem; }
.rd-section { margin-bottom: 1.25rem; }
.rd-section h3 { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: .5rem; border-bottom: 2px solid var(--primary-light); padding-bottom: .25rem; }

/* ---- Recipe detail: wide modal variant ---- */
.modal-container.modal-recipe-detail { max-width: min(96vw, 1200px); max-height: 95vh; }
.modal-recipe-detail .modal-header h3 { font-size: 1.25rem; }
.modal-recipe-detail .rd-body { padding: 1.25rem 1.5rem; }
.modal-recipe-detail .rd-hero { gap: 1.25rem; margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.modal-recipe-detail .rd-hero-img-wrap,
.modal-recipe-detail .rd-hero-img { width: 200px; height: 200px; }
.modal-recipe-detail .rd-hero-img-placeholder { display: flex; align-items: center; justify-content: center; font-size: 3.5rem; background: var(--bg); border-radius: var(--radius); color: var(--text3); }
.modal-recipe-detail .rd-category { font-size: .8rem; }
.modal-recipe-detail .rd-meta { font-size: .95rem; gap: .5rem 1.25rem; }
.modal-recipe-detail .rd-meta span { display: inline-flex; align-items: center; gap: .3rem; }
.modal-recipe-detail .rd-section { margin-bottom: 1.5rem; }
.modal-recipe-detail .rd-section h3 { font-size: 1.05rem; margin-bottom: .75rem; padding-bottom: .35rem; display: flex; align-items: center; gap: .5rem; }
.modal-recipe-detail .rd-count { font-size: .75rem; font-weight: 600; background: var(--primary-light); color: var(--primary); padding: .1rem .5rem; border-radius: 99px; }

/* Body grid: 1 column on mobile, ingredients-heavy split on wide screens */
.modal-recipe-detail .rd-body-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 880px) {
  .modal-recipe-detail .rd-body-grid { grid-template-columns: 1fr minmax(380px, 1.05fr); gap: 2rem; align-items: flex-start; }
}

/* Ingredient list */
.modal-recipe-detail .ingredient-list { display: flex; flex-direction: column; gap: .35rem; }
.modal-recipe-detail .ing-cat-header { font-size: .78rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--primary); background: var(--primary-light); padding: .35rem .7rem; border-radius: 99px; display: inline-block; margin: .65rem 0 .35rem; }
.modal-recipe-detail .ing-cat-header:first-child { margin-top: 0; }

/* Each ingredient is a card with a clear head row + (optional) product list. */
.modal-recipe-detail .ingredient-row { display: block; padding: .55rem .65rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.modal-recipe-detail .ingredient-row:hover { border-color: var(--text3); box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.modal-recipe-detail .ingredient-head { display: grid; grid-template-columns: 1fr auto; gap: .65rem; align-items: center; }
.modal-recipe-detail .ingredient-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .3rem; min-width: 0; }
.modal-recipe-detail .ingredient-amount { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; font-size: 1rem; white-space: nowrap; flex-shrink: 0; }
.modal-recipe-detail .ingredient-name-label { font-size: 1rem; font-weight: 600; color: var(--text); min-width: 0; word-break: break-word; }
.modal-recipe-detail .ingredient-name { display: block; margin: 0; }

/* Product list under an ingredient */
.modal-recipe-detail .ingredient-products { display: flex; flex-direction: column; flex-wrap: nowrap; gap: .25rem; margin: 0; max-height: none; overflow-y: visible; }
.modal-recipe-detail .ingredient-products.is-empty { display: none; }
.modal-recipe-detail .ingredient-products:not(.is-empty) { margin-top: .45rem; padding-top: .45rem; border-top: 1px dashed var(--border); }

/* + Produkt button */
.modal-recipe-detail .ing-add-btn { background: var(--primary-light); color: var(--primary); border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer; padding: .3rem .55rem; font-size: .82rem; font-weight: 600; display: inline-flex; align-items: center; gap: .25rem; width: auto; height: auto; line-height: 1.2; flex-shrink: 0; }
.modal-recipe-detail .ing-add-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.modal-recipe-detail .ing-add-btn .iab-icon { font-size: 1rem; line-height: 1; font-weight: 700; }
@media (max-width: 540px) { .modal-recipe-detail .ing-add-btn .iab-label { display: none; } .modal-recipe-detail .ing-add-btn { padding: .35rem .5rem; } }

/* Product cards inside an ingredient row */
.modal-recipe-detail .ingredient-products .product-select-item { display: flex; gap: .5rem; align-items: flex-start; padding: .35rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface2); cursor: default; }
.modal-recipe-detail .ingredient-products .psi-img { width: 32px; height: 32px; flex-shrink: 0; }
.modal-recipe-detail .ingredient-products .psi-info { flex: 1; min-width: 0; }
.modal-recipe-detail .ingredient-products .psi-name { font-size: .87rem; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-recipe-detail .ingredient-products .psi-meta { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .2rem; }
.modal-recipe-detail .ingredient-products .psi-price { font-size: .76rem; line-height: 1.25; color: var(--text2); flex: 1; min-width: 0; }
.modal-recipe-detail .ingredient-products .psi-price-prop { color: var(--accent); font-weight: 600; }
.modal-recipe-detail .ingredient-products .psi-price-of { color: var(--text3); }
.modal-recipe-detail .ingredient-products .psi-pct-wrap { display: flex; align-items: center; gap: .2rem; font-size: .76rem; flex-shrink: 0; }
.modal-recipe-detail .ingredient-products .psi-pct-input { width: 62px; }
.modal-recipe-detail .ingredient-products .psi-shop { font-size: .68rem; padding: .12rem .42rem; flex-shrink: 0; }
.modal-recipe-detail .ingredient-products .psi-remove-btn { background: none; border: none; cursor: pointer; color: var(--text3); padding: .1rem .3rem; border-radius: var(--radius-sm); font-size: 1rem; line-height: 1; flex-shrink: 0; margin-left: auto; }
.modal-recipe-detail .ingredient-products .psi-remove-btn:hover { color: #c0392b; }

/* Inline search input (revealed by + button) */
.modal-recipe-detail .ing-prod-search { margin-top: .5rem; }
.modal-recipe-detail .ing-prod-input { width: 100%; font-size: .9rem; padding: .45rem .75rem; border: 1.5px solid var(--primary); border-radius: var(--radius-sm); background: var(--surface); outline: none; }

/* Instructions column */
.modal-recipe-detail .instructions-text { font-size: 1rem; line-height: 1.7; }

/* On very narrow mobile, collapse amount column a bit */
@media (max-width: 480px) {
  .modal-recipe-detail .rd-body { padding: 1rem; }
  .modal-recipe-detail .rd-hero-img-wrap,
  .modal-recipe-detail .rd-hero-img { width: 120px; height: 120px; }
}

/* Cook tab layout */
.cook-recipe { padding: .75rem; }
.cook-layout { display: flex; flex-direction: column; gap: 1rem; }
.cook-left { flex-shrink: 0; }
.cook-hero-img { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--radius); margin-bottom: .75rem; }
.cr-name { font-size: 1.3rem; font-weight: 700; margin-bottom: .35rem; }
.cook-meta { color: var(--text2); font-size: .9rem; margin-bottom: .75rem; line-height: 1.5; }
.cook-timers { margin-bottom: .75rem; }
.cook-timers strong { display: block; color: var(--primary); margin-bottom: .4rem; font-size: .9rem; }
.cook-custom-timer { display: flex; gap: .35rem; align-items: center; margin-top: .5rem; }
.cook-section { margin-bottom: 1.25rem; }
.cook-section-title { display: block; color: var(--primary); font-size: 1rem; margin-bottom: .5rem; border-bottom: 2px solid var(--primary-light); padding-bottom: .25rem; }
.cook-ing-cat { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); padding: .5rem 0 .15rem; }
@media (min-width: 600px) and (orientation: landscape), (min-width: 800px) {
  .cook-layout { flex-direction: row; align-items: flex-start; gap: 1.5rem; }
  .cook-left { width: 220px; flex-shrink: 0; position: sticky; top: 0; }
  .cook-hero-img { max-height: 180px; }
  .cook-col { flex: 1; min-width: 0; }
  .cook-col-ings { flex: 0 0 360px; }
}
.ing-cat-header { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); padding: .6rem 0 .2rem; }
.ing-add-btn { background: none; border: 1px solid var(--border); border-radius: 50%; width: 22px; height: 22px; cursor: pointer; color: var(--text3); font-size: .9rem; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.ing-add-btn:hover { border-color: var(--primary); color: var(--primary); }
.ing-search-popup { position: fixed; z-index: 500; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-y: auto; box-shadow: 0 4px 20px rgba(0,0,0,.25); display: none; max-height: 50vh; min-width: 280px; padding: .25rem; }
.ing-search-popup .product-select-item { display: grid; grid-template-columns: 32px 1fr auto; gap: .55rem; align-items: center; padding: .4rem .55rem; border: 1px solid transparent; border-radius: var(--radius-sm); margin-bottom: 2px; }
.ing-search-popup .product-select-item:last-child { margin-bottom: 0; }
.ing-search-popup .product-select-item:hover { background: var(--primary-light); border-color: var(--primary); }
.ing-search-popup .psi-img { width: 32px; height: 32px; }
.ing-search-popup .psi-name { font-size: .87rem; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-search-popup .psi-price { font-size: .76rem; line-height: 1.25; }
.ing-search-popup .psi-pct-input { width: 42px; }
.ing-search-popup .psi-shop { font-size: .68rem; padding: .12rem .42rem; }
.ing-rossmann-btn { display: block; width: 100%; margin-top: .25rem; padding: .35rem .55rem; background: none; border: 1px dashed var(--border); border-radius: var(--radius-sm); cursor: pointer; font-size: .82rem; color: #e2001a; text-align: center; }
.ing-rossmann-btn:hover { background: #fff0f0; border-color: #e2001a; }
.ing-search-divider { font-size: .72rem; color: var(--text3); padding: .3rem .55rem .1rem; border-top: 1px solid var(--border); margin-top: .25rem; }
.ing-prod-search { margin-top: .35rem; position: relative; }
.ing-prod-input { width: 100%; font-size: .8rem; padding: .3rem .6rem; }
.ing-prod-results { position: absolute; left: 0; right: 0; z-index: 200; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-y: auto; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.ing-prod-result { padding: .4rem .6rem; cursor: pointer; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.ing-prod-result:last-child { border-bottom: none; }
.ing-prod-result:hover { background: var(--bg); }
.ing-prod-result-name { font-size: .85rem; }
.ing-prod-result-meta { font-size: .75rem; color: var(--text3); white-space: nowrap; }
.ingredient-row { display: flex; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--border); gap: .5rem; }
.ingredient-amount { font-weight: 600; min-width: 70px; color: var(--accent); }
.ingredient-name { flex: 1; }
.ingredient-products { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .2rem; }
.product-badge { font-size: .7rem; padding: .15rem .4rem; border-radius: 99px; background: var(--primary-light); color: var(--primary); cursor: pointer; }
.product-badge.selected { background: var(--primary); color: white; }
.instructions-text { line-height: 1.7; color: var(--text); font-size: 1rem; }
.instructions-text p { margin: 0 0 .75rem; }
.instr-block { margin-bottom: 1rem; }
p.instr-block:last-child { margin-bottom: 0; }
.instr-step { display: grid; grid-template-columns: 2.2ch 1fr; gap: 0 .4rem; margin-bottom: .35rem; }
.instr-step-num { color: var(--text3); font-weight: 700; text-align: right; padding-top: .02em; }
.ing-ref { color: var(--accent); font-weight: 500; }
.num-ref { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text2); }
.instr-timer-ref { color: var(--primary); font-size: .88em; white-space: nowrap; }
.instr-timer-btn { background: var(--primary-light); border: 1px solid var(--primary); border-radius: 99px; padding: .1em .6em; font-size: .82em; cursor: pointer; color: var(--primary); line-height: 1.4; vertical-align: middle; }
.instr-timer-btn:hover { background: var(--primary); color: white; }

/* Timers */
.timer-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.timer-btn { padding: .4rem .75rem; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 99px; font-size: .85rem; cursor: pointer; }
.timer-btn:hover { background: var(--primary-light); border-color: var(--primary); }
#running-timers { display: flex; flex-direction: column; gap: .3rem; margin: .3rem 0; }
.active-timer { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .35rem .6rem; display: flex; align-items: center; gap: .5rem; }
.active-timer.expired { background: var(--red); border-color: var(--red); color: white; animation: pulse 1s infinite; }
.timer-label { flex: 1; font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer-countdown { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-stop { background: none; border: none; cursor: pointer; font-size: .9rem; opacity: .6; padding: 0; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7} }

/* Week plan */
.week-grid { display: grid; grid-template-columns: 1fr; gap: .5rem; padding: .75rem; }
@media (min-width: 600px) { .week-grid { grid-template-columns: repeat(7, 1fr); } }
.day-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .75rem; transition: box-shadow .15s; min-height: 100px; display: flex; flex-direction: column; gap: .35rem; }
.day-card:hover { box-shadow: var(--shadow-lg); }
.day-name { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--text3); margin-bottom: .1rem; }
.day-name.today { color: var(--primary); }
.day-entry { }
.day-recipe-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: .25rem; }
.day-entry-header { display: flex; align-items: baseline; gap: .3rem; }
.day-recipe { font-size: .85rem; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.day-entry-btns { display: flex; gap: 1px; flex-shrink: 0; }
.day-entry-btns button { background: none; border: none; cursor: pointer; font-size: .8rem; padding: 1px 3px; opacity: .5; border-radius: 3px; }
.day-entry-btns button:hover { opacity: 1; background: var(--bg); }
.day-price { display: flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--text3); margin-top: .1rem; }
.day-price > span { flex: 1; }
.day-entry-sep { height: 1px; background: var(--border); margin: .3rem 0; }
.day-add-btn { background: none; border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text3); font-size: .78rem; padding: .25rem .5rem; cursor: pointer; text-align: center; width: 100%; margin-top: .2rem; }
.day-add-btn:hover { border-color: var(--primary); color: var(--primary); }
.day-empty { color: var(--text3); font-size: .8rem; display: flex; align-items: center; justify-content: center; height: 60px; border: 2px dashed var(--border); border-radius: var(--radius-sm); }
.day-ing-summary { margin-top: .4rem; border-top: 1px solid var(--border); padding-top: .35rem; display: flex; flex-direction: column; gap: .15rem; }
.day-ing-item { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 0 .3rem; font-size: .72rem; }
.day-ing-item.no-prod { opacity: .55; }
.day-ing-name { grid-row: 1; grid-column: 1; font-weight: 600; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-ing-prod { grid-row: 2; grid-column: 1; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-ing-price { grid-row: 1 / 3; grid-column: 2; color: var(--accent); font-weight: 600; align-self: center; white-space: nowrap; }
.psi-price-prop { color: var(--accent); font-weight: 600; }

/* Product cards */
.cat-section { padding: .25rem 0 .5rem; }
.cat-header { font-size: .85rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; padding: .5rem .75rem .25rem; display: flex; align-items: center; gap: .4rem; }
.cat-count { font-weight: 400; color: var(--text3); }
.cat-show-all-wrap { text-align: center; padding: .25rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .6rem; padding: .75rem; }
.product-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s; }
.product-card:hover { transform: translateY(-2px); }
.pc-img-wrap { aspect-ratio: 1; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.pc-img-wrap img { width: 100%; height: 100%; object-fit: contain; }
.pc-body { padding: .5rem; flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.pc-subtitle { font-size: .65rem; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.pc-name { font-size: .82rem; font-weight: 600; line-height: 1.3; }
.pc-attrs { font-size: .65rem; color: var(--text2); }
.pc-price { font-size: 1rem; font-weight: 700; color: var(--text); margin-top: auto; }
.pc-base-price { font-size: .72rem; color: var(--text3); }
.pc-price-drop { font-size: .7rem; color: var(--primary); font-weight: 600; }
.pc-shop-tag { font-size: .65rem; font-weight: 700; padding: .15rem .4rem; border-radius: 99px; color: white; align-self: flex-start; margin-top: .2rem; }
.pc-add-btn { margin-top: .4rem; padding: .3rem; font-size: .8rem; background: var(--primary); color: white; border: none; border-radius: var(--radius-sm); cursor: pointer; }
.pc-add-btn:hover { background: var(--primary-dark); }

/* Search & filters */
.search-bar { display: flex; gap: .5rem; padding: .75rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.search-input { flex: 1; padding: .5rem .75rem; border: 1.5px solid var(--border); border-radius: 99px; font-size: .95rem; outline: none; background: var(--bg); }
.search-input:focus { border-color: var(--primary); background: var(--surface); }
#shop-filter-section { background: var(--surface); box-shadow: 0 2px 4px rgba(0,0,0,.04); }
.filter-bar { display: flex; gap: .4rem; padding: .4rem .75rem; overflow-x: auto; background: var(--surface); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn { flex-shrink: 0; padding: .3rem .65rem; border: 1.5px solid var(--border); border-radius: 99px; background: none; font-size: .78rem; cursor: pointer; white-space: nowrap; }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.filter-separator { width: 1px; background: var(--border); flex-shrink: 0; margin: .2rem 0; }

/* Cart */
#tab-shop { display: flex; flex-direction: column; height: calc(100vh - var(--nav-h)); }
.shop-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.shop-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.shop-main #product-results { flex: 1; min-width: 0; overflow-y: auto; }
.shop-body #cart-section { width: 600px; flex-shrink: 0; overflow-y: auto; border-left: 1px solid var(--border); }
.shop-body #cart-section.hidden { display: none !important; }
.cart-section { background: var(--surface); }
.cart-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .5rem; }
.cart-header h3 { flex: 1; font-size: 1rem; }
.cart-group { border-bottom: 1px solid var(--border); }
.cart-group-header { padding: .5rem 1rem; background: var(--bg); font-size: .8rem; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .03em; cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; }
.cart-group-header .cg-chevron { font-style: normal; font-size: 1rem; line-height: 1; color: var(--text3); }
.cart-group.collapsed .cart-group-body { display: none; }
.cart-item { display: flex; align-items: center; padding: .6rem 1rem; gap: .6rem; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-covered { opacity: .4; }
.ci-qty-label { font-size: .9rem; font-weight: 600; min-width: 24px; text-align: center; color: var(--text2); }
.ci-covered-label { font-size: .78rem; color: var(--text3); white-space: nowrap; font-style: italic; }
.ci-img { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; background: var(--bg); }
.ci-name { flex: 1; font-size: .88rem; font-weight: 600; }
.ci-meta { font-size: .75rem; color: var(--text3); }
.ci-qty { display: flex; align-items: center; gap: .25rem; }
.ci-qty input { width: 40px; text-align: center; border: 1px solid var(--border); border-radius: 4px; padding: .2rem; font-size: .85rem; }
.ci-step, .ci-agg-step { background: none; border: 1px solid var(--border); border-radius: 4px; width: 24px; height: 24px; cursor: pointer; font-size: .9rem; padding: 0; line-height: 1; }
.ci-step:hover, .ci-agg-step:hover:not([disabled]) { background: var(--bg); }
.ci-agg-step[disabled], .ci-step[disabled] { opacity: .35; cursor: not-allowed; }
.ci-agg-input,
.ci-qty-input { width: 56px; height: 24px; text-align: center; border: 1px solid var(--border); border-radius: 4px; padding: 0 .25rem; font-size: .85rem; font-weight: 600; box-sizing: border-box; }
.ci-agg-input:focus,
.ci-qty-input:focus { outline: none; border-color: var(--accent, #4a7c59); }
/* Unit slot: same box whether it's a static label or a toggle button, so the
   row above (kg-toggle) and below (Stk-fixed) align cleanly. */
.ci-unit-slot { box-sizing: border-box; min-width: 44px; height: 24px; display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 600; color: var(--text2); padding: 0 .35rem; }
.ci-unit-label.ci-unit-slot { border: 1px solid transparent; }
.ci-unit-toggle.ci-unit-slot { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.ci-unit-toggle.ci-unit-slot:hover { background: var(--surface); border-color: var(--text3); color: var(--text); }
/* Price column fits "99,99 €" (under 100 €) without wrapping. */
.ci-price { font-size: .9rem; font-weight: 700; min-width: 62px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-totals { padding: 1rem; }
.cart-total-row { display: flex; justify-content: space-between; padding: .3rem 0; font-size: .9rem; }
.cart-total-row.grand { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--border); padding-top: .6rem; margin-top: .3rem; }
.apply-section { padding: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; }

/* Feedback */
.star-rating { display: flex; gap: .2rem; }
.star-btn { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--border); transition: color .1s; }
.star-btn.active { color: #f5a623; }
.feedback-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin: .75rem; overflow: hidden; }
.feedback-card .fc-img { width: 100%; max-height: 200px; object-fit: cover; }
.feedback-card .fc-body { padding: .75rem 1rem; }
.fc-recipe-name { font-weight: 700; font-size: 1rem; margin-bottom: .5rem; }
.fc-date { font-size: .8rem; color: var(--text3); margin-bottom: .75rem; }
.fc-member-row { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.fc-member-row:last-child { border-bottom: none; }
.fc-member-name { min-width: 80px; font-size: .88rem; font-weight: 600; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; display: flex; align-items: flex-end; justify-content: center; animation: fade-in .15s; }
@media (min-width: 600px) { .modal-overlay { align-items: center; } }
@keyframes fade-in { from { opacity: 0; } }
.modal-container { background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto; animation: slide-up .2s; }
.modal-container.modal-wide { max-width: min(95vw, 1100px); max-height: 95vh; }
@media (min-width: 600px) { .modal-container { border-radius: var(--radius); } }
@keyframes slide-up { from { transform: translateY(20px); opacity: 0; } }
.modal-header { display: flex; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border); }
.modal-header h3 { flex: 1; font-size: 1.1rem; }
.modal-body { padding: 1rem; }
.modal-footer { padding: .75rem 1rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; justify-content: flex-end; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--text2); margin-bottom: .35rem; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: .55rem .75rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .95rem; outline: none; background: var(--surface); font-family: inherit; resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); }
.form-row { display: flex; gap: .75rem; }
.form-row .form-group { flex: 1; }
.month-picker { display: flex; gap: .3rem; flex-wrap: wrap; }
.month-toggle { padding: .25rem .45rem; border: 1.5px solid var(--border); border-radius: 4px; background: none; cursor: pointer; font-size: .78rem; }
.month-toggle.active { background: var(--primary); color: white; border-color: var(--primary); }
.timer-input-row { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.timer-input-row input { flex: 1; }
.ingredient-input-row { display: flex; gap: .4rem; align-items: center; margin-bottom: .3rem; }
.ing-amount { width: 72px; flex-shrink: 0; }
.ing-unit { width: 60px; flex-shrink: 0; }
.ing-name { flex: 1; min-width: 0; }
.ing-section-group .ing-amount { width: 72px; flex: 0 0 72px; }
.ing-section-group .ing-unit { width: 60px; flex: 0 0 60px; }
.ing-section-group .ing-name { width: auto; flex: 1; }
.ing-section-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .65rem; margin-bottom: .5rem; background: var(--bg); }
.ing-section-header { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.ing-section-name { flex: 1; font-weight: 600; font-size: .87rem; background: var(--primary-light); border: 1px solid transparent !important; border-radius: var(--radius-sm); padding: .3rem .55rem !important; color: var(--primary); width: auto !important; }
.ing-section-name:focus { border-color: var(--primary) !important; outline: none; }
.remove-section-btn { background: none; border: none; cursor: pointer; color: var(--text3); padding: .2rem .4rem; font-size: .9rem; flex-shrink: 0; }
.remove-section-btn:hover { color: #c0392b; }

/* Import queue */
.import-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; padding: .25rem 0; }
.import-tile { border-radius: var(--radius); overflow: hidden; background: var(--bg); border: 1.5px solid var(--border); cursor: default; transition: box-shadow .15s; }
.import-tile[data-recipe-id] { cursor: pointer; }
.import-tile[data-recipe-id]:hover { box-shadow: var(--shadow-lg); }
.import-tile-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.import-tile-placeholder { display: flex; align-items: center; justify-content: center; font-size: 2.5rem; background: var(--bg); }
.import-tile-info { padding: .5rem; }
.import-tile-name { font-weight: 600; font-size: .85rem; line-height: 1.3; margin-bottom: .2rem; }
.import-tile-meta { font-size: .75rem; color: var(--text3); }
.import-tile-error { font-size: .72rem; color: var(--red); margin-top: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.import-tile-done { border-color: #b8dfc5; }
.import-tile-error { border-color: #f5c6cb; }
.import-spin { display: inline-block; animation: spin 1s linear infinite; }
.import-btn-active { background: var(--primary) !important; color: white !important; border-radius: var(--radius-sm); }
@keyframes spin { to { transform: rotate(360deg); } }
.import-status { font-size: .72rem; padding: .1rem .35rem; border-radius: 99px; }
.import-status.pending { background: #fff3cd; color: #856404; }
.import-status.processing { background: #cce5ff; color: #004085; }
.import-status.done { background: #d4edda; color: #155724; }
.import-status.error { background: #f8d7da; color: #721c24; }

/* Product select in recipe/weekplan */
.product-select-list { max-height: 300px; overflow-y: auto; }
.psi-search-wrap { padding: .25rem 0; }
.psi-search-wrap .psi-search { width: 100%; font-size: .85rem; }
.product-select-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.product-select-item:hover { background: var(--bg); }
.product-select-item.selected { background: var(--primary-light); }
.psi-img { width: 36px; height: 36px; object-fit: contain; background: var(--bg); border-radius: 4px; }
.psi-info { flex: 1; }
.psi-name { font-size: .85rem; font-weight: 600; }
.psi-price { font-size: .78rem; color: var(--text3); }
.psi-shop { font-size: .7rem; padding: .1rem .3rem; border-radius: 4px; color: white; }
.psi-pct-wrap { display: flex; align-items: center; gap: 2px; font-size: .75rem; color: var(--text3); }
.psi-pct-input { width: 46px; padding: .1rem .25rem; font-size: .75rem; text-align: right; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); }
.psi-pct-input:focus { outline: none; border-color: var(--primary); }

/* Toast */
.toast { position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%; transform: translateX(-50%); background: #333; color: white; padding: .6rem 1.25rem; border-radius: 99px; font-size: .9rem; z-index: 600; animation: fade-in .2s; box-shadow: var(--shadow-lg); cursor: pointer; max-width: 90vw; text-align: center; }
.toast.toast-error { background: #c0392b; border-radius: var(--radius); padding: .75rem 1.5rem; }

/* Sync indicator */
.sync-indicator { position: fixed; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); z-index: 200; }
.sync-indicator.syncing { background: #f5a623; animation: pulse 1s infinite; }
.sync-indicator.error { background: var(--red); }

/* Empty states */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1rem; gap: .75rem; color: var(--text3); }
.empty-state .es-icon { font-size: 3rem; }
.empty-state p { font-size: .95rem; text-align: center; }

/* Cook tab specifics */
.cook-ing-item { padding: .5rem 0; border-bottom: 1px solid var(--border); display: flex; gap: .5rem; }
.cook-ing-item:last-child { border-bottom: none; }
.cook-ing-amount { font-weight: 700; color: var(--accent); min-width: 80px; font-size: 1.05rem; }
.cook-ing-name { font-size: 1rem; }
.cook-instructions { font-size: 1.05rem; line-height: 1.9; }
.cook-instructions .instr-block { margin-bottom: 1.1rem; }
.cook-instructions .instr-step { margin-bottom: .55rem; }
.cook-instructions .instr-step-num { font-size: 1.1rem; }
.cook-instructions .instr-timer-btn { font-size: .9em; padding: .12em .7em; }
.custom-timer-input { display: flex; gap: .5rem; align-items: center; padding: .5rem 1rem; }
.custom-timer-input input { flex: 1; padding: .5rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 1.2rem; font-variant-numeric: tabular-nums; text-align: center; }

/* Settings panel */
.settings-panel { padding: 1rem; }

/* Scrollbar styling */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Loading spinner */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state { display: flex; align-items: center; justify-content: center; padding: 2rem; gap: .5rem; color: var(--text3); }

/* Week plan product selection */
.product-selection-list { padding: .5rem 0; }
.ps-ingredient { padding: .5rem 1rem; }
.ps-ing-label { font-size: .85rem; font-weight: 600; color: var(--text2); margin-bottom: .3rem; }

/* Price drop indicator */
.price-drop-badge { display: inline-block; background: #d4edda; color: #155724; font-size: .7rem; padding: .1rem .35rem; border-radius: 99px; font-weight: 600; }

/* Ordered-before badge */
.ordered-badge { display: inline-block; background: var(--primary-light); color: var(--primary); font-size: .65rem; padding: .1rem .3rem; border-radius: 99px; font-weight: 600; }

/* Source viewer modal */
.source-viewer { padding: .5rem; display: flex; flex-direction: column; align-items: center; overflow: auto; }
.source-viewer img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 6px; }

/* Vorrat / Pantry tab */
.pantry-section-header { font-size: .78rem; font-weight: 700; text-transform: uppercase; color: var(--text3); letter-spacing: .04em; padding: .9rem .25rem .3rem; }
.pantry-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.pantry-tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; display: flex; flex-direction: column; gap: .25rem; }
.pantry-tile.pantry-low { border-top: 2px solid var(--accent); }
.pantry-tile-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg); display: block; }
.pantry-tile-img-placeholder { display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.pantry-tile-name { font-weight: 600; font-size: .78rem; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pantry-tile-meta { display: flex; gap: .2rem; flex-wrap: wrap; }
.pantry-tile-arrow { font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text2); }
.pantry-tile-arrow.short { color: var(--accent); }
.pantry-tile-controls { display: flex; align-items: center; gap: .2rem; flex-wrap: wrap; }
.pantry-shop-chip { font-size: .62rem; font-weight: 700; color: white; padding: .08rem .3rem; border-radius: 99px; flex-shrink: 0; }
.pantry-sale-badge { background: #d4edda; color: #155724; font-size: .65rem; padding: .08rem .3rem; border-radius: 99px; font-weight: 700; }
.pantry-low-badge { background: var(--accent); color: white; font-size: .65rem; padding: .08rem .28rem; border-radius: 99px; font-weight: 600; }
.pantry-qty-input, .pantry-target-input { width: 44px; padding: .15rem .25rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .8rem; text-align: center; min-width: 0; }
.pantry-qty-input:focus, .pantry-target-input:focus { border-color: var(--primary); outline: none; }
.pantry-del-btn { background: none; border: none; cursor: pointer; color: var(--text3); font-size: .8rem; padding: .1rem .25rem; border-radius: 4px; }
.pantry-del-btn:hover { background: var(--bg); color: var(--red); }
.pantry-empty { text-align: center; color: var(--text3); padding: 2rem 1rem; font-size: .9rem; }
