:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --card-soft: #f8fafc;
  --line: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --accent: #4f97b7;
  --accent-dark: #3f7f9d;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --ok: #166534;
  --ok-soft: #f0fdf4;
  --info-soft: #eff6ff;
  --shadow: 0 10px 25px rgba(17, 24, 39, 0.06);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc 0, var(--bg) 180px, var(--bg) 100%);
  line-height: 1.5;
}

a { color: var(--accent-dark); }

.site-header {
  padding: 32px 0 18px;
}
.site-header.simple { padding-bottom: 8px; }
.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 18px;
}
.narrow { max-width: 760px; }
.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.header-inner.single { grid-template-columns: minmax(0, 1fr); }

.header-inner > *,
.grid > *,
.items-row > *,
.section-head > * {
  min-width: 0;
}

input,
select,
textarea {
  max-width: 100%;
  min-width: 0;
}
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  -webkit-appearance: none;
  appearance: none;
}
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: auto;
  appearance: auto;
}

input[type="date"] {
  min-height: 48px;
}
.brand-mark {
  margin: 0 0 18px;
}
.brand-mark img {
  display: block;
  width: min(100%, 300px);
  height: auto;
  filter: drop-shadow(0 10px 20px rgba(17, 24, 39, 0.08));
}
h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}
h2 {
  margin: 0;
  font-size: 22px;
}
h3 {
  margin: 0 0 10px;
  font-size: 18px;
}
p { margin: 0 0 12px; }
.lead {
  color: #374151;
  max-width: 760px;
}
.no-margin { margin: 0; }

.page-grid,
.stack-lg {
  display: grid;
  gap: 18px;
}
.stack-md { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 10px; }
.card {
  background: var(--card);
  border: 1px solid rgba(209, 213, 219, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card.compact { padding: 18px; }
.success-card {
  background: linear-gradient(180deg, #ffffff 0, var(--ok-soft) 100%);
}
.success-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ok);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
}
.section-head {
  display: grid;
  gap: 4px;
}
.section-head.between,
.actions.between {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.center { align-items: center; }
.small {
  font-size: 14px;
  color: var(--muted);
}
.muted { color: var(--muted); }
.success { color: var(--ok); }
.error { color: var(--danger); }
.status-line {
  min-height: 22px;
  font-weight: 700;
}

.notice {
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid transparent;
}
.notice.info {
  background: var(--info-soft);
  border-color: #bfdbfe;
}
.notice.ok {
  background: var(--ok-soft);
  border-color: #bbf7d0;
}
.notice.error {
  background: var(--danger-soft);
  border-color: #fecaca;
}
.empty-state {
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--card-soft);
}

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.nested-grid { align-items: end; }
.full-width { grid-column: 1 / -1; }

label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
input, select, textarea, button {
  font: inherit;
}
input, select, textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #9ca3af;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(29, 78, 216, 0.12);
  border-color: var(--accent);
}
textarea {
  min-height: 110px;
  resize: vertical;
}
button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
}
button.secondary { background: #374151; }
button.danger { background: var(--danger); }
button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.items-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 120px;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #e5e7eb;
}
.items-row:last-child { border-bottom: none; padding-bottom: 0; }
.item-meta { display: grid; gap: 3px; }
.item-prices { color: var(--muted); font-size: 14px; }

.item-thumb {
  width: 64px; height: 64px;
  border-radius: 6px; overflow: hidden;
  background: #f3f4f6;
  display: flex; align-items: center; justify-content: center;
  outline: none;
}
.item-thumb[data-show-images] { cursor: pointer; }
.item-thumb[data-show-images]:hover,
.item-thumb[data-show-images]:focus-visible { box-shadow: 0 0 0 2px rgba(99, 102, 241, .4); }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-thumb-empty { color: #9ca3af; font-size: 26px; }

.link-btn {
  background: none; border: 0;
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-top: 2px;
}
.link-btn:hover { color: #1d4ed8; }

/* Public Lightbox */
.public-lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .85);
  z-index: 999;
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.public-lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255, 255, 255, .15); color: #fff;
  border: 0; border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 22px; cursor: pointer;
}
.public-lightbox-content {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  max-width: 95vw; max-height: 95vh;
}
.public-lightbox-content img#public-lightbox-img {
  max-width: 90vw; max-height: 78vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 32px rgba(0, 0, 0, .5);
  background: #fff;
}
.public-lightbox-counter { color: #fff; font-size: 13px; }
.public-lightbox-thumbs {
  display: flex; gap: 6px;
  overflow-x: auto; max-width: 90vw;
  padding: 4px;
}
.public-lightbox-thumbs img {
  width: 56px; height: 56px;
  object-fit: cover; cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  opacity: 0.6;
}
.public-lightbox-thumbs img.active { border-color: #fff; opacity: 1; }

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.step-box {
  border: 1px solid #dbeafe;
  background: #f8fbff;
  border-radius: 14px;
  padding: 16px;
}
.step-box span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  margin-bottom: 12px;
}
.step-box strong { display: block; margin-bottom: 6px; }

.plain-list,
.segment-list {
  margin: 0;
  padding-left: 18px;
}
.compact-list { gap: 4px; }
.segment-card {
  background: var(--card-soft);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
}
.availability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.availability-item {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}
.availability-item.ok { border-color: #bbf7d0; background: var(--ok-soft); }
.availability-item.fail { border-color: #fecaca; background: var(--danger-soft); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.ok { background: #dcfce7; color: var(--ok); }
.badge.fail { background: #fee2e2; color: var(--danger); }
.badge.neutral { background: #e5e7eb; color: #374151; }

.summary-table {
  width: 100%;
  border-collapse: collapse;
}
.summary-table th,
.summary-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}
.summary-table th { background: #f9fafb; }
.right { text-align: right; }

.quote-totals {
  display: grid;
  gap: 8px;
}
.quote-total-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}
.quote-total-row.strong {
  font-weight: 700;
  font-size: 18px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.wrap-actions { align-items: center; }
.sticky-submit {
  position: sticky;
  bottom: 12px;
  z-index: 5;
}
.hidden { display: none !important; }

@media (max-width: 860px) {
  .header-inner { grid-template-columns: 1fr; }
  .section-head.between,
  .actions.between { flex-direction: column; align-items: stretch; }
  .sticky-submit { position: static; }
}

@media (max-width: 640px) {
  body { background: var(--bg); }
  .wrap { padding: 0 14px; }
  .card { padding: 18px; border-radius: 14px; }
  .items-row {
    grid-template-columns: 56px 1fr;
    grid-template-areas:
      "thumb meta"
      "qty   qty";
    gap: 10px 12px;
  }
  .items-row > .item-thumb { grid-area: thumb; width: 56px; height: 56px; }
  .items-row > .item-meta  { grid-area: meta; }
  .items-row > div:has(input[type="number"]) { grid-area: qty; }
  .summary-table th:nth-child(2),
  .summary-table td:nth-child(2) { width: 80px; }
  .grid-2,
  .nested-grid,
  .availability-grid {
    grid-template-columns: 1fr;
  }
  .brand-mark {
    margin: 0 auto 14px;
    text-align: center;
  }
  .brand-mark img {
    width: min(100%, 230px);
    margin: 0 auto;
  }
  .site-header .header-inner > div:first-child {
    text-align: center;
  }
  button,
  .button-link {
    width: 100%;
  }
  .section-head.between button {
    width: 100%;
  }
}

.site-footer {
  margin-top:40px;
  padding:20px 0;
  text-align:center;
  font-size:14px;
  color:#6b7280;
}
.site-footer a {
  color:inherit;
  text-decoration:none;
}
.site-footer a:hover {
  text-decoration:underline;
}

/* Customer-Session: spezifische Layout-Helfer */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 14px; }
/* Adresse: Straße breit (2fr), PLZ schmal (auto), Ort flexibel (1.5fr) */
.grid-addr {
  display: grid;
  grid-template-columns: 2fr 110px 1.5fr;
  gap: 14px;
}
.spacer-md { height: 8px; }

.cb-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.cb-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
  accent-color: var(--accent, #4f97b7);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .grid-addr { grid-template-columns: 1fr; }
}

/* Same-Address-Box: optisch hervorgehoben, damit klar ist:
   "hier triffst du eine Entscheidung" */
.same-addr-box {
  background: #f1f7f9;
  border: 1px solid #cfe5ee;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.same-addr-box .cb-line {
  font-size: 15px;
}

/* Customer-Session: Erfolgs-Bestätigung nach dem Speichern */
.done-card {
  text-align: center;
  padding: 36px 28px;
  border: 2px solid #86efac;
  background: #f0fdf4;
}
.done-icon {
  width: 64px; height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  line-height: 64px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}
.done-card h2 { color: #14532d; }
.done-card p { color: #166534; line-height: 1.5; }

/* ── Legale Seiten (Impressum, Datenschutz) ──────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #d1d5db;
  color: #4b5563;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 14px;
  transition: background .15s, border-color .15s;
}
.back-link:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

body[data-page="legal"] h2 {
  color: var(--accent, #4f97b7);
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 6px;
  margin-top: 0;
}
body[data-page="legal"] h3 {
  color: #374151;
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 16px;
}
body[data-page="legal"] p { line-height: 1.6; }
body[data-page="legal"] ul { line-height: 1.6; padding-left: 20px; }
body[data-page="legal"] ul li { margin-bottom: 4px; }
