:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --border: #dde3ea;
  --accent: #155d8f;
  --accent-soft: #e4eef6;
  --danger: #c62828;
  --ok: #1b7f4b;
  --ok-soft: #e6f6ed;
  --warn: #a15c00;
  --warn-soft: #fff4e0;
  --head: #0b3c5f; /* Kopfzeile */
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.error { color: var(--danger); }

/* Kopfzeile */
.top { background: var(--head); color: #c5cfdb; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 24px; }
.brand { display: block; text-decoration: none; }
/* Händlerlogo auf weißem Feld, damit jedes Logo auf dem blauen Kopf lesbar ist; ohne Logo der Firmenname */
.brand img { display: block; max-width: 180px; max-height: 44px; padding: 4px 8px; background: #fff; border-radius: 6px; }
.brand-name { font-size: 20px; font-weight: 700; color: #1f2933; }
.brand-name.on-dark { color: #fff; }
/* Logo des angemeldeten Kunden: auf weißem Feld, damit auch dunkle Logos auf dem blauen Kopf gut aussehen */
.cust-logo { display: flex; align-items: center; gap: 14px; }
.cust-logo::before { content: ''; width: 1px; height: 32px; background: rgba(255,255,255,.25); }
.cust-logo img { display: block; max-height: 40px; max-width: 180px; padding: 4px 8px; background: #fff; border-radius: 6px; }
@media (max-width: 900px) { .cust-logo img { max-height: 32px; max-width: 120px; } }
.login-logo { display: flex; justify-content: center; margin: 0 auto 18px; }
.login-logo img { display: block; max-width: 220px; max-height: 90px; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px; }
.top nav[hidden] { display: none; }
.top nav a { color: inherit; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.top nav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.top nav a.active { color: #fff; background: rgba(110,160,255,.18); }
.count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; }
.user { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 14px; }
button.link { background: none; border: none; color: #9db8ff; padding: 0; cursor: pointer; font: inherit; }
button.link:hover { color: #fff; }
/* mehrere Warenkörbe: Reiter über dem Warenkorb */
.carts-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 16px; }
.carts-bar .spacer { flex: 1; }
.cart-tab { border-radius: 999px; padding: 6px 12px; }
.cart-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.cart-tab.on .count { background: #fff; color: var(--accent); }
.cart-tab:not(.on) .count { background: #8a96a8; }
.carts-bar button.link { color: var(--accent); text-decoration: underline; }
.carts-bar button.link.danger { color: var(--danger); }

main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px; }
/* Werbung unten (Banner aus PartFlow → Mehr → Webshop-Werbung) */
.promo { width: 100%; max-width: 1100px; margin: 0 auto 28px; padding: 0 20px; }
.promo-slide { display: flex; align-items: stretch; min-height: 150px; border-radius: 14px; overflow: hidden;
  background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(11, 60, 95, .15); animation: promo-in .4s ease; }
.promo-slide[hidden] { display: none; }
.promo-img { width: 38%; max-width: 420px; object-fit: cover; flex-shrink: 0; }
.promo-body { flex: 1; min-width: 0; padding: 22px 28px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.promo-body h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.promo-body p { margin: 0; font-size: 15px; line-height: 1.5; opacity: .92; max-width: 60ch; }
.promo-btn { align-self: flex-start; margin-top: 6px; padding: 9px 18px; border-radius: 999px; border: 0; font-weight: 700; font-size: 14px;
  cursor: pointer; background: #fff; color: var(--accent); }
.promo-btn:hover { filter: brightness(.95); }
.promo-dunkel { background: var(--head); }
.promo-dunkel .promo-btn { color: var(--head); }
.promo-hell { background: var(--accent-soft); color: var(--text); border: 2px solid var(--accent); box-shadow: none; }
.promo-hell .promo-btn { background: var(--accent); color: #fff; }
.promo-aktion { background: linear-gradient(120deg, #d9480f, #f08c00); }
.promo-aktion .promo-btn { color: #c2410c; }
.promo-dots { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.promo-dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 0; background: var(--border); cursor: pointer; }
.promo-dot.on { background: var(--accent); width: 26px; border-radius: 5px; }
@keyframes promo-in { from { opacity: .3; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .promo-slide { animation: none; } }
@media (max-width: 640px) {
  .promo-slide { flex-direction: column; }
  .promo-img { width: 100%; max-width: none; height: 160px; }
  .promo-body { padding: 18px; }
  .promo-body h2 { font-size: 20px; }
}
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 18px; border-top: 1px solid var(--border); background: var(--panel); }

/* Formulare und Knöpfe */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input.big { width: 100%; font-size: 17px; padding: 12px 14px; margin-bottom: 16px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; white-space: nowrap; }
button:hover { border-color: #b8c3d0; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #1d4fd0; }
button:disabled { opacity: .5; cursor: default; }
[hidden] { display: none !important; }
.big-btn { padding: 12px 22px; font-size: 17px; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* Anmeldung */
.login-box { max-width: 400px; margin: 40px auto; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 28px; }
.login-box form, .stack { display: flex; flex-direction: column; gap: 12px; }
.login-box label, .stack label, .note { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }

/* Ergebnislisten */
.list { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px 18px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none; }
.row:last-child { border-bottom: none; }
.row:has(img.thumb) { grid-template-columns: 64px minmax(0, 1fr) auto auto auto; }
a.row:hover { background: #f7f9fc; }
.row-price { text-align: right; white-space: nowrap; }
.row-buy { display: flex; gap: 6px; justify-content: flex-end; }
.row-buy input { width: 64px; }
.price b { font-size: 17px; }
.empty { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 30px; text-align: center; color: var(--muted); }
@media (max-width: 900px) {
  .row, .row:has(img.thumb) { grid-template-columns: minmax(0, 1fr) auto; }
  .row .thumb { display: none; }
  .row-buy { grid-column: 1 / -1; }
  .top { padding: 10px 16px; }
  main { padding: 16px; }
}

/* Verfügbarkeit als Ampel */
.avail { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.avail i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.avail.ok i { background: #1b9a59; }
.avail.soon i { background: #f0a800; }
.avail.ask i { background: #b8c1cc; }
.avail.no i { background: #c62828; }
.cutoff { font-size: 12px; color: var(--ok); margin-top: 2px; }
.cutoff.late, .cutoff.days { color: var(--warn); }
/* Liefertermin im Warenkorb: grün = bis morgen, orange = später, rot = nicht bestellbar */
.deliv { font-size: 14px; font-weight: 600; white-space: nowrap; }
.deliv.ok { color: var(--ok); }
.deliv.late { color: #b45a00; }
.deliv.no { color: var(--danger); white-space: normal; max-width: 260px; }
.row.late { background: #fff3e0; box-shadow: inset 4px 0 0 #f08c00; }
.row.blocked { background: #fdecea; box-shadow: inset 4px 0 0 var(--danger); }
.deliv-note { background: #fff3e0; border-left: 4px solid #f08c00; padding: 8px 12px; border-radius: 6px; }

/* Retouren */
.actions-row { display: flex; justify-content: flex-end; margin-top: 18px; }
.ret-form { margin-top: 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px; }
.ret-form h2 { margin: 0; }
.ret-form > label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.ret-form .list { border-radius: 8px; }
.ret-qty { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.ret-qty input { width: 72px; text-align: center; font-weight: 600; }
.ret-row { grid-template-columns: minmax(0, 1fr) auto; }
.ret-credit { margin-top: 6px; padding: 6px 10px; background: #e6f6ed; border-left: 3px solid #1b9a59; border-radius: 4px; }
.ret-answer { margin-top: 6px; padding: 6px 10px; background: #f3f6fa; border-left: 3px solid var(--accent); border-radius: 4px; }

/* Reifen */
.tyre-form { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tyre-form label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.tyre-form select, .tyre-form input { font-size: 15px; }
#t-w, #t-r, #t-rim { width: 84px; font-weight: 600; }#t-qty { width: 70px; }
#t-go { padding: 9px 20px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.chip { padding: 3px 10px; font-size: 13px; border-radius: 999px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #eef1f5; }
.tag.season-sommer { background: #fff4d6; color: #8a5a00; }
.tag.season-winter { background: #e3f0ff; color: #1f5fae; }
.tag.season-ganzjahr { background: #e9f6ee; color: #23744a; }
.eu-row { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
.eu { display: inline-block; min-width: 20px; text-align: center; font-weight: 700; font-size: 12px; color: #fff; border-radius: 3px; padding: 1px 4px; background: #c3cad3; }
.eu-A { background: #00843d; } .eu-B { background: #52ae32; } .eu-C { background: #c8d400; color: #333; }
.eu-D { background: #f9b200; color: #333; } .eu-E { background: #e2001a; }
.thumb { width: 64px; height: 64px; object-fit: contain; border-radius: 6px; background: #fff; }
.thumb.none { display: none; }

/* Warenkorb, Bestellungen */
.totals { margin: 12px 0 0 auto; max-width: 340px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 4px; }
.totals .gross { font-weight: 700; font-size: 17px; border-top: 2px solid var(--text); margin-top: 4px; padding-top: 8px; }
.note { margin-top: 16px; }
.note textarea { min-height: 70px; resize: vertical; }
.status { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.done { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 30px; text-align: center; }

dialog { border: none; border-radius: 12px; padding: 22px 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 32, .45); }
dialog h2 { margin-top: 0; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(90px); background: #16202c; color: #fff; padding: 10px 18px; border-radius: 8px; transition: transform .2s; max-width: 90vw; z-index: 100; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }

/* Altteilpfand (Austauschteile) */
.price .deposit { color: #8a5a00; margin-top: 2px; }
