/* ============================================================
   Supermarkt Preisvergleich — Web-Theme v2 (modernes Dark UI)
   ============================================================ */

:root,
html[data-theme="dark"] {
  /* Surface-Stufen (Material-3-Stil: Layer 0..3) */
  --surface-0: #0E1014;     /* Sidebar / hintergrund */
  --surface-1: #14171E;     /* Body */
  --surface-2: #1B1F28;     /* Karten Stufe 1 */
  --surface-3: #232834;     /* Karten Stufe 2 / Hover */
  --surface-4: #2C3240;     /* Aktive Inputs */

  /* Text */
  --text-1: #F3F4F6;        /* Primary text */
  --text-2: #C7CDD8;        /* Secondary text */
  --text-3: #8A93A2;        /* Tertiary / Mutes */
  --text-4: #5C6473;        /* Disabled / Hints */

  /* Borders */
  --border-1: #232834;
  --border-2: #303747;
}

html[data-theme="light"] {
  --surface-0: #FFFFFF;
  --surface-1: #F8FAFC;     /* off-white body */
  --surface-2: #FFFFFF;     /* cards */
  --surface-3: #F1F5F9;
  --surface-4: #E2E8F0;

  --text-1: #0F172A;
  --text-2: #334155;
  --text-3: #64748B;
  --text-4: #94A3B8;

  --border-1: #E2E8F0;
  --border-2: #CBD5E1;

  --accent-soft: rgba(99, 102, 241, 0.10);
  --success-soft: rgba(16, 185, 129, 0.10);
  --offer-soft: rgba(245, 158, 11, 0.12);
  --danger-soft: rgba(239, 68, 68, 0.10);

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-2: 0 4px 12px rgba(15, 23, 42, 0.10);
}

/* Body-Background-Gradient für Light-Mode (überschreibt das dunkle Radial) */
html[data-theme="light"] body {
  background:
    radial-gradient(circle at 80% -10%, rgba(99, 102, 241, 0.04), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(99, 102, 241, 0.03), transparent 50%),
    var(--surface-1);
}

/* Theme-Toggle-Button in Sidebar */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s ease;
}
.theme-toggle-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

/* Im Light-Mode: einige Inverse-Farben anpassen die im Dark zu hell wären */
html[data-theme="light"] .badge-nutri.nutri-c {
  /* C-Score ist gelb → schwarz Text bereits OK */
}
html[data-theme="light"] .nav-btn {
  color: var(--text-2);
}
html[data-theme="light"] .nav-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
}

  /* Brand / Akzentfarben — weicheres Indigo statt aggressives Königsblau */
  --accent: #6366F1;        /* Indigo-500 */
  --accent-hover: #818CF8;  /* Indigo-400 */
  --accent-active: #4F46E5; /* Indigo-600 */
  --accent-soft: rgba(99, 102, 241, 0.12);

  /* Semantik */
  --success: #10B981;
  --success-soft: rgba(16, 185, 129, 0.14);
  --offer: #F59E0B;         /* warmes Amber statt rotbraun */
  --offer-soft: rgba(245, 158, 11, 0.14);
  --danger: #EF4444;
  --danger-soft: rgba(239, 68, 68, 0.14);

  /* Radius / Schatten */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-glow: 0 0 0 3px rgba(99, 102, 241, 0.25);

  /* Spacing-Rhythmus (4er-Raster) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background:
    radial-gradient(circle at 80% -10%, rgba(99, 102, 241, 0.08), transparent 50%),
    radial-gradient(circle at 0% 100%, rgba(245, 158, 11, 0.04), transparent 40%),
    var(--surface-1);
  background-attachment: fixed;
  color: var(--text-1);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ====================== APP-LAYOUT ====================== */
#app { display: flex; min-height: 100vh; }

aside#sidebar {
  width: 232px;
  background: var(--surface-0);
  border-right: 1px solid var(--border-1);
  padding: 24px 14px 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  padding: 0 6px 28px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 16px;
}
.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
  line-height: 1.2;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.brand-version {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-btn {
  background: transparent;
  color: var(--text-2);
  text-align: left;
  padding: 10px 14px;
  border: none;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.nav-btn:hover {
  background: var(--surface-2);
  color: var(--text-1);
}
.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}
.nav-btn.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.badge {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
  display: none;
}
.badge.show { display: inline-block; }

main#main {
  flex: 1;
  padding: 28px 36px 40px;
  min-width: 0;
}

footer#statusbar {
  position: fixed;
  bottom: 0;
  left: 232px;
  right: 0;
  background: var(--surface-0);
  color: var(--text-3);
  padding: 6px 16px;
  border-top: 1px solid var(--border-1);
  font-size: 12px;
  display: none;
}
footer#statusbar.show { display: block; }

/* ====================== PAGE/HEAD ====================== */
.view.hidden { display: none; }
.view { animation: fadeUp 0.3s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head {
  margin-bottom: var(--s-6);
}
.page-head.row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.page-head h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin: 0;
}
.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  margin: 28px 0 4px;
  letter-spacing: -0.005em;
}
.section-sub {
  color: var(--text-3);
  font-size: 13px;
  margin: 0 0 18px;
}
.spacer { flex: 1; }

/* ====================== BUTTONS ====================== */
button {
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
}
button:active { transform: translateY(1px); }

.btn-primary, button.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 9px 18px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.4);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 6px rgba(79, 70, 229, 0.5); }
.btn-primary:active { background: var(--accent-active); }
.btn-primary:disabled { background: var(--surface-3); color: var(--text-4); cursor: default; box-shadow: none; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 8px 16px;
  font-weight: 500;
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--accent); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  padding: 8px 16px;
  font-weight: 600;
}
.btn-danger:hover { background: #DC2626; }

.btn-icon {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  font-size: 16px;
  font-weight: 700;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-1);
}
.btn-icon:hover { background: var(--surface-3); border-color: var(--accent); }

/* ====================== INPUTS ====================== */
input[type="text"], input[type="number"], input[type="email"], select {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 9px 12px;
  color: var(--text-1);
  font-family: inherit;
  font-size: 13.5px;
  min-width: 100px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input[type="text"]::placeholder, input[type="number"]::placeholder {
  color: var(--text-4);
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, input[type="email"]:focus {
  outline: none;
  background: var(--surface-3);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
input[type="text"] { flex: 1; min-width: 240px; }

label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 13px;
}
label.checkbox { color: var(--text-1); cursor: pointer; }

input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ====================== KPI / CATEGORY-GRID ====================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-4);
  margin-bottom: var(--s-8);
}
.kpi-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  min-height: 96px;
  transition: border-color 0.15s, transform 0.15s;
}
.kpi-card:hover {
  transform: translateY(-1px);
  border-color: var(--border-2);
}
.kpi-card .value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-hover);
  line-height: 1.1;
}
.kpi-card .label {
  color: var(--text-3);
  font-size: 13px;
  margin-top: 6px;
  font-weight: 500;
}
.kpi-card.orange .value { color: var(--offer); }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--s-3);
}
.category-tile {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 18px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.category-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: var(--shadow-2);
}
.category-tile .icon {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.category-tile .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}
.category-tile .count {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  font-weight: 500;
}
.category-tile.special {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.08));
  border-color: rgba(245, 158, 11, 0.5);
}
.category-tile.special:hover {
  border-color: var(--offer);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.32), rgba(245, 158, 11, 0.12));
}
.category-tile.special .name { color: var(--offer); }
.category-tile.special .count { color: rgba(245, 158, 11, 0.8); }

/* ====================== PRODUCT-CARDS ====================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: var(--s-4);
  margin: var(--s-3) 0 var(--s-8);
}
.product-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-2);
}
.product-card .image {
  height: 130px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  overflow: hidden;
}
.product-card .image img { max-width: 100%; max-height: 100%; object-fit: contain; }

.tag {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tag.offer {
  background: var(--offer-soft);
  color: var(--offer);
}

.product-card .name {
  font-size: 14px;
  font-weight: 600;
  min-height: 36px;
  color: var(--text-1);
  letter-spacing: -0.005em;
}
.product-card .meta {
  color: var(--text-3);
  font-size: 12px;
}
.product-card .price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.price-from { font-size: 11px; color: var(--text-3); }
.price {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-hover);
}
.price.is-offer { color: var(--offer); }
.price-old { color: var(--text-4); text-decoration: line-through; font-size: 12px; }
.price-meta { color: var(--text-3); font-size: 11px; margin-left: auto; }

.offer-info {
  background: var(--offer-soft);
  color: var(--offer);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 4px;
}

.retailer-cell {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.retailer-cell .offer-pill {
  background: var(--offer-soft);
  color: var(--offer);
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.retailer-cell .price-old {
  color: var(--text-4);
  text-decoration: line-through;
  font-size: 10.5px;
}
.retailer-cell .offer-until {
  color: var(--offer);
  font-size: 10.5px;
  opacity: 0.85;
}

.retailer-list {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 4px 8px;
  font-size: 12px;
  margin: 2px 0;
  color: var(--text-2);
}
.retailer-list .dot { font-size: 13px; line-height: 1; }
.retailer-list .more {
  grid-column: 1 / -1;
  color: var(--text-3);
  font-size: 11px;
  font-style: italic;
  margin-top: 2px;
}
.retailer-list .price-cell { text-align: right; font-variant-numeric: tabular-nums; }
.retailer-list .price-cell.offer-cell { color: var(--offer); font-weight: 600; }

.product-card > button {
  margin-top: auto;
}
.product-card .btn-primary,
.product-card .btn-secondary {
  width: 100%;
  font-size: 12.5px;
  padding: 8px 10px;
}

.filter-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--s-5);
}

/* ====================== CART ====================== */
.cart-list { display: flex; flex-direction: column; gap: 8px; }
.cart-row {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s;
}
.cart-row:hover { border-color: var(--border-2); }
.cart-row .name { flex: 1; font-weight: 500; font-size: 14px; }
.cart-row .qty {
  width: 38px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* ====================== OPTIMIZE ====================== */
.opt-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-3);
  margin: var(--s-3) 0;
}
.opt-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.opt-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.opt-card .strategy { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.opt-card .total {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-hover);
  margin-top: 6px;
}
.opt-card .meta { color: var(--text-3); font-size: 12px; margin-top: 4px; }
.opt-card .desc { color: var(--text-3); font-size: 12px; margin-top: 8px; line-height: 1.45; }

.opt-detail .stop {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin: var(--s-3) 0;
}
.opt-detail .stop h3 { margin: 0 0 var(--s-2); color: var(--text-1); font-size: 15px; font-weight: 600; }
.opt-detail .stop table { width: 100%; border-collapse: collapse; }
.opt-detail .stop td, .opt-detail .stop th {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-1);
  font-size: 13px;
}
.opt-detail .stop th { color: var(--text-3); text-align: left; font-weight: 600; }
.opt-detail .stop td.num, .opt-detail .stop th.num { text-align: right; font-variant-numeric: tabular-nums; }
.opt-detail .stop .subtotal { font-weight: 700; }

/* ====================== STORES TABLE ====================== */
.table-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  overflow: hidden;
}
#stores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#stores-table th, #stores-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-1);
}
#stores-table th {
  background: var(--surface-1);
  color: var(--text-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#stores-table th.num, #stores-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
#stores-table tr:last-child td { border-bottom: none; }
#stores-table tr:hover td { background: var(--surface-3); }

a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====================== TOAST ====================== */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--surface-3);
  color: var(--text-1);
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: 13.5px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 1000;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--border-2);
}
#toast.show { opacity: 1; transform: translateY(0); }

.loading-status {
  text-align: center;
  color: var(--text-3);
  padding: var(--s-4);
  font-size: 13px;
}

/* ====================== AUTH-BOX (Sidebar Footer) ====================== */
.auth-box {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 12px;
  font-size: 12px;
  margin-top: 14px;
}
.auth-box .auth-hint {
  color: var(--text-3);
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 500;
}
.auth-box .user-profile {
  display: flex; align-items: center; gap: 10px;
}
.auth-box .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  border: 2px solid var(--surface-1);
}
.auth-box .user-name {
  flex: 1;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auth-box .signout-btn {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-3);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-size: 11px;
}
.auth-box .signout-btn:hover { color: var(--text-1); border-color: var(--danger); background: var(--danger-soft); }

/* ====================== FAVORITES ====================== */
.fav-heart {
  position: absolute;
  top: 18px; right: 18px;
  background: rgba(14, 16, 20, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-2);
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: transform 0.15s, background 0.15s;
  z-index: 2;
}
.fav-heart:hover {
  transform: scale(1.12);
  background: rgba(14, 16, 20, 0.95);
}
.fav-heart.active { color: var(--offer); }

/* ====================== GROUP ====================== */
.group-empty {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 36px;
  text-align: center;
  margin: var(--s-6) 0;
}
.group-empty h2 { margin: 0 0 var(--s-2); color: var(--text-1); font-size: 18px; font-weight: 600; }
.group-empty p { color: var(--text-3); margin: 0 0 var(--s-3); font-size: 13px; }
.group-empty button { margin-top: var(--s-3); }

.group-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-4);
  margin: var(--s-4) 0;
}
.group-action-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.group-action-card h3 {
  margin: 0;
  color: var(--text-1);
  font-size: 15px;
  font-weight: 600;
}

.group-header-card {
  background:
    radial-gradient(circle at 100% 0%, var(--accent-soft), transparent 60%),
    var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  margin-bottom: var(--s-4);
}
.group-header-row {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.group-header-row h2 {
  margin: 0;
  color: var(--text-1);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
}
.group-meta {
  display: flex;
  gap: var(--s-4);
  color: var(--text-3);
  font-size: 12px;
  align-items: center;
}
.group-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--offer);
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.group-status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.invite-box {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-top: var(--s-3);
}
.invite-box .label {
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.invite-code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-hover);
  letter-spacing: 2px;
  flex: 1;
}
.copy-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.copy-btn:hover { background: var(--accent-hover); }

.shared-cart-input {
  display: flex; gap: var(--s-2); margin: var(--s-3) 0;
}
.shared-cart-input input { flex: 1; }

.shared-cart-list {
  display: flex; flex-direction: column; gap: 6px;
}
.shared-cart-item {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color 0.15s, opacity 0.2s;
}
.shared-cart-item:hover { border-color: var(--border-2); }
.shared-cart-item.checked { opacity: 0.55; }
.shared-cart-item.checked .name {
  text-decoration: line-through;
  color: var(--text-4);
}
.shared-cart-item .check {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border-2);
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}
.shared-cart-item .check:hover { border-color: var(--accent); }
.shared-cart-item.checked .check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.shared-cart-item .name { flex: 1; font-size: 14px; }
.shared-cart-item .qty {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.shared-cart-item .remove-btn {
  background: transparent;
  border: none;
  color: var(--text-4);
  font-size: 18px;
  cursor: pointer;
  padding: 0 6px;
  border-radius: var(--r-sm);
  width: 28px; height: 28px;
}
.shared-cart-item .remove-btn:hover { color: var(--danger); background: var(--danger-soft); }

.auth-required-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-lg);
  padding: 40px;
  text-align: center;
  margin: var(--s-8) auto;
  max-width: 480px;
}
.auth-required-card h2 { margin: 0 0 var(--s-2); color: var(--text-1); font-size: 20px; font-weight: 600; }
.auth-required-card p { color: var(--text-3); margin: 0 0 var(--s-3); }

/* ====================== META-BADGES (Pfand / Score / Diet) ====================== */
.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.meta-badges span {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.02em;
}
.badge-pfand {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-hover);
}
.badge-nutri {
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  padding: 2px 8px !important;
  color: #fff !important;
}
.badge-nutri.nutri-a { background: #038141; }
.badge-nutri.nutri-b { background: #85bb2f; }
.badge-nutri.nutri-c { background: #fecb02; color: #222 !important; }
.badge-nutri.nutri-d { background: #ee8100; }
.badge-nutri.nutri-e { background: #e63312; }
.badge-eco {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}
.badge-eco.eco-a { background: #038141; color: #fff; }
.badge-eco.eco-b { background: #85bb2f; color: #fff; }
.badge-diet {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}
.badge-diet.vegan       { background: rgba(34, 197, 94, 0.22);  color: #86efac; }
.badge-diet.veg         { background: rgba(34, 197, 94, 0.15);  color: #86efac; }
.badge-diet.glutenfrei  { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.badge-diet.laktosefrei { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; }
.badge-diet.bio         { background: rgba(132, 204, 22, 0.22); color: #bef264; }
.badge-diet.fairtrade   { background: rgba(245, 158, 11, 0.20); color: #fcd34d; }
.badge-allergen {
  background: rgba(239, 68, 68, 0.20);
  color: #fca5a5;
}

/* Marken-Pill – prominent unter dem Produktnamen */
.brand-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
  margin-bottom: 4px;
}
.brand-pill {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.sub-pill {
  background: var(--surface-3);
  color: var(--text-2);
  font-weight: 500;
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* Preis pro Einheit (€/kg, €/l) — kompakt rechts in der Preiszeile */
.unit-price {
  font-size: 11px;
  color: var(--text-3);
  font-family: "JetBrains Mono", monospace;
  margin-left: 6px;
}

/* Saison-Badges */
.badge-season {
  font-weight: 600 !important;
}
.badge-season.heimisch {
  background: rgba(34, 197, 94, 0.22);
  color: #86efac;
}
.badge-season.lager {
  background: rgba(180, 130, 60, 0.25);
  color: #fcd34d;
}

/* Loading-Skeletons */
@keyframes skeleton-shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.product-card.skeleton {
  pointer-events: none;
}
.skeleton-image {
  height: 140px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200px 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
  border-radius: 8px;
  margin-bottom: 12px;
}
.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200px 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
  border-radius: 4px;
  margin-bottom: 8px;
}
.skeleton-line.wide   { width: 90%; }
.skeleton-line.medium { width: 70%; }
.skeleton-line.short  { width: 40%; }

/* „Häufig gekauft"-Liste im Account-Center */
.recurring-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.recurring-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  transition: background 0.15s;
}
.recurring-row.added {
  background: var(--success-soft);
}
.recurring-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-1);
}
.recurring-count {
  font-size: 11px;
  color: var(--text-3);
  font-family: "JetBrains Mono", monospace;
}
.btn-icon-add {
  background: var(--accent);
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  padding: 0;
}
.btn-icon-add:hover {
  background: var(--accent-active);
}

/* Inflations-Tracker-Widget */
.inflation-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 16px;
  margin: 16px 0;
}
.inflation-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}
.inflation-header > :first-child {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-1);
}
.inflation-header .meta {
  font-size: 11px;
  color: var(--text-3);
}
.inflation-section {
  margin-top: 8px;
}
.inflation-section h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin: 8px 0 6px;
}
.inflation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
  font-size: 13px;
}
.inflation-row.up   { background: rgba(239, 68, 68, 0.08); }
.inflation-row.down { background: rgba(34, 197, 94, 0.08); }
.inflation-row .cat { color: var(--text-2); }
.inflation-row.up .pct {
  color: #fca5a5;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}
.inflation-row.down .pct {
  color: #86efac;
  font-family: "JetBrains Mono", monospace;
  font-weight: 600;
}

/* Card-Button-Row + Verlauf-Chart-Button */
.card-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.card-chart-btn {
  flex: 0 0 auto;
  width: 36px;
  padding: 0;
  font-size: 14px;
}

/* Preis-Verlauf-Chart im Modal */
.price-chart {
  display: block;
  width: 100%;
  max-width: 720px;
  height: 240px;
  margin: 8px 0 12px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}
.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 8px 0 16px;
}
.chart-stats > div {
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
}
.chart-stats strong { font-size: 16px; color: var(--text-1); }
.chart-stats .meta { font-size: 11px; color: var(--text-3); }
.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 8px;
}
.legend-dot {
  display: inline-block;
  width: 12px;
  height: 3px;
  vertical-align: middle;
  margin-right: 4px;
}
.legend-dot.dot-min { background: var(--accent); }
.legend-dot.dot-max { background: var(--accent-soft); }

/* HTTP-Warning-Banner */
.http-warning-banner {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  background: rgba(245, 158, 11, 0.95);
  color: #1f2937;
  padding: 8px 40px 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  max-width: 90%;
}
.http-warning-banner .dismiss-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  color: #1f2937;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0 8px;
}

/* Onboarding-Location-Box */
.onboard-loc-box {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 16px;
  margin-top: 16px;
}
.onboard-loc-box h3 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 16px;
}
.onboard-loc-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: 8px;
  color: var(--text-1);
  font-size: 14px;
}
.onboard-loc-result {
  margin-top: 10px;
  font-size: 13px;
  min-height: 20px;
}

/* Empty-State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-3);
}
.empty-state .empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state .empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}
.empty-state .empty-hint {
  font-size: 13px;
}

/* Sub-Kategorie-Filter-Chips über der Produkt-Grid */
.sub-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-1);
}
.sub-chip-row .sub-chip {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border-1);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.sub-chip-row .sub-chip:hover {
  background: var(--surface-3);
}
.sub-chip-row .sub-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}

/* Integrierter Preisoptimierer im Warenkorb-Tab */
.cart-optimize-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-1);
}

/* Aktive Strategie-Karte markieren */
.opt-card {
  cursor: pointer;
  transition: all 0.15s ease;
}
.opt-card:hover {
  transform: translateY(-1px);
}
.opt-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  background: rgba(99, 102, 241, 0.06);
}

/* ─── Plan-gruppierter Warenkorb (Tabellen-Layout) ──────────────────────── */
.plan-grouped-cart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--r-md);
}
.plan-header-label {
  font-weight: 700;
  color: var(--accent-hover);
  font-size: 15px;
}
.plan-header-meta {
  font-size: 12px;
  color: var(--text-2);
}
.plan-store-table-section {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  overflow: hidden;
}
.plan-store-table-section.unmatched {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.04);
}
.plan-store-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface-3);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-1);
}
.plan-store-header .store-subtotal {
  color: var(--accent-hover);
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}
.plan-store-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;     /* Spaltenbreiten verbindlich */
}
/* Spaltenbreiten: Produkt füllt den Rest, Numerische sind kompakt */
.plan-store-table th:nth-child(1),
.plan-store-table td:nth-child(1) {
  width: auto;             /* Produktname nimmt den Rest */
}
.plan-store-table th:nth-child(2),
.plan-store-table td:nth-child(2) {
  width: 70px;             /* Menge */
}
.plan-store-table th:nth-child(3),
.plan-store-table td:nth-child(3) {
  width: 100px;            /* Einzelpreis */
}
.plan-store-table th:nth-child(4),
.plan-store-table td:nth-child(4) {
  width: 100px;            /* Summe */
}
.plan-store-table th:nth-child(5),
.plan-store-table td:nth-child(5) {
  width: 42px;             /* Aktionen */
}
.plan-store-table th,
.plan-store-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-1);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-store-table tbody tr:last-child td {
  border-bottom: none;
}
.plan-store-table th {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border-1);
  background: var(--surface-2);
}
.plan-store-table .num {
  text-align: right;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}
.plan-store-table .subtotal {
  font-weight: 700;
  color: var(--text-1);
}
.plan-store-table .actions {
  text-align: right;
  padding: 4px 8px;
}
.plan-store-table .name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.plan-store-table .product-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.plan-store-table tr.is-offer .subtotal,
.plan-store-table tr.is-offer .product-name {
  color: var(--danger);
}
.plan-store-table .muted {
  color: var(--text-3);
}
.product-name.checked-name {
  text-decoration: line-through;
  color: var(--text-3);
}
/* Klickbarer „Erledigt"-Indikator im Gruppen-Cart */
.group-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-2);
  border-radius: 4px;
  background: var(--surface-1);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: transparent;
  transition: all 0.15s;
  flex-shrink: 0;
}
.group-check:hover {
  border-color: var(--accent);
}
.group-check.checked {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.offer-pill {
  display: inline-block;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 999px;
  margin-left: 6px;
}

/* ====================== LOCATION-BADGE (oben) ====================== */
.location-badge {
  background: var(--accent-soft);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--accent-hover);
  border-radius: var(--r-md);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--s-4);
  font-size: 13px;
}
.location-badge .loc-icon { font-size: 16px; }
.location-badge .loc-text { flex: 1; }
.location-badge .loc-clear {
  background: transparent;
  border: none;
  color: var(--accent-hover);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.location-badge .loc-clear:hover {
  background: rgba(99, 102, 241, 0.2);
}

/* ====================== UNIVERSAL MODAL ====================== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-root.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
.modal-window {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 24px;
  width: min(560px, calc(100% - 32px));
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text-1); }
.modal-title {
  margin: 0 0 16px;
  color: var(--text-1);
  font-size: 18px;
  font-weight: 700;
}
.modal-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border-1);
}
.modal-check input { width: 16px; height: 16px; }
.modal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-1);
  margin-bottom: 16px;
}
.modal-tabs button {
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}
.modal-tabs button.active {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
}
.modal-tab-content { min-height: 200px; }

/* Allergen-Chip-Box */
.allergen-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.allergen-chips .chip {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border-1);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.allergen-chips .chip:hover {
  background: var(--surface-3);
}
.allergen-chips .chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}
.account-header {
  background: var(--surface-2);
  padding: 12px 14px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-size: 14px;
}

.diet-badge {
  display: none;
  background: var(--offer);
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}
.diet-badge.show { display: inline-block; }

.lists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.list-card {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px;
  text-align: center;
}
.list-card .list-icon { font-size: 28px; }
.list-card .list-name { font-weight: 600; margin: 4px 0; }
.list-card .list-count { font-size: 11px; color: var(--text-3); margin-bottom: 8px; }
.list-card .list-actions { display: flex; gap: 4px; justify-content: center; }
.list-card .list-actions button { font-size: 11px; padding: 4px 8px; }

.settings-section {
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.settings-section.danger-section {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
}
.settings-section h3 { margin: 0 0 6px; font-size: 14px; }

.onboard-step {
  display: flex; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-1);
}
.onboard-step:last-child { border-bottom: none; }
.onboard-step .icon { font-size: 28px; line-height: 1.3; width: 36px; text-align: center; }

.legal-footer {
  position: fixed;
  bottom: 8px; right: 12px;
  font-size: 11px;
  color: var(--text-4);
  z-index: 100;
}
.legal-footer a { color: var(--text-3); margin: 0 4px; }
.legal-footer a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ====================== SCROLLBAR ====================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ====================== MOBILE-HAMBURGER ====================== */
#mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9100;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-1);
  color: var(--text-1);
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
#mobile-menu-btn:active { transform: scale(0.95); }

#mobile-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 8900;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#mobile-backdrop.open {
  display: block;
  opacity: 1;
}

/* ====================== RESPONSIVE (Tablet 768px) ====================== */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ====================== RESPONSIVE (Phone 768px) ====================== */
@media (max-width: 768px) {
  #app {
    flex-direction: row;
    /* sidebar slidet von links rein */
  }

  /* Hamburger sichtbar machen */
  #mobile-menu-btn { display: block; }

  /* Sidebar wird Drawer */
  aside#sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 260px;
    z-index: 9000;
    transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.4);
    border-right: 1px solid var(--border-1);
    border-bottom: none;
    padding: 16px 12px;
    overflow-y: auto;
  }
  aside#sidebar.open {
    left: 0;
  }

  nav {
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
  }
  .nav-btn {
    padding: 12px 14px;
    font-size: 15px;
    text-align: left;
  }
  .nav-btn.active::before { display: block; }
  .auth-box { display: block; }

  main#main {
    padding: 14px;
    padding-top: 64px; /* Platz für Hamburger oben */
    width: 100%;
  }
  footer#statusbar { left: 0; right: 0; }

  /* Heads kompakter */
  .page-head h1 { font-size: 20px; }
  .page-head.row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .page-head.row .spacer { display: none; }

  /* Cards: 1-2 Spalten */
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }
  .product-card { padding: 10px; }
  .product-card .image { height: 100px; }
  .product-card .name { font-size: 13px; line-height: 1.3; }
  .product-card .price { font-size: 18px; }

  /* Filter-Card: alles untereinander */
  .filter-card {
    flex-direction: column;
    gap: 8px;
  }
  .filter-card input,
  .filter-card select,
  .filter-card button {
    width: 100%;
  }

  /* KPI-Grid: 2 Spalten */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .kpi-card { padding: 12px; }
  .kpi-card .value { font-size: 22px; }

  /* Kategorie-Grid: kompakter */
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  /* Tabellen scrollbar machen */
  .table-wrap { overflow-x: auto; }
  table { min-width: 600px; }

  /* Plan-Optimizer-Tabellen kompakter */
  .plan-store-table th,
  .plan-store-table td { padding: 6px 8px; font-size: 12px; }
  .plan-store-table th:nth-child(2),
  .plan-store-table td:nth-child(2) { width: 50px; }
  .plan-store-table th:nth-child(3),
  .plan-store-table td:nth-child(3) { width: 70px; }
  .plan-store-table th:nth-child(4),
  .plan-store-table td:nth-child(4) { width: 70px; }

  /* Modal-Window: fast Vollbild */
  .modal-window {
    width: 95vw;
    max-width: none;
    max-height: 90vh;
  }
  .legal-footer {
    bottom: 4px;
    right: 6px;
    font-size: 10px;
  }

  /* HTTP-Warn-Banner kompakter */
  .http-warning-banner {
    font-size: 11px;
    padding: 6px 32px 6px 10px;
    max-width: 95%;
  }
}

/* Sehr schmal (< 380px): noch kompakter */
@media (max-width: 380px) {
  .card-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr !important; }
  .product-card .image { height: 140px; }
}
