/* Theme: Kundenfarbe #004077 (rgb 0,64,119 / hsl 208,100%,23%) + Abstufungen. */
:root {
  --bg: #f4f7fa;
  --card: #ffffff;
  --text: #12263a;
  --muted: #5a6e80;
  --line: #d7e1eb;
  --accent: #004077;
  --accent-dark: #00305a;
  --soft: #e6f0f9;
  --warning: #fff7ed;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #e3edf7, var(--bg) 42%);
}
a { color: var(--accent-dark); }
.page { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.page.narrow { width: min(760px, calc(100% - 32px)); }
.page.wide { width: min(1320px, calc(100% - 24px)); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.brand { font-weight: 800; font-size: 1.05rem; }
.tag, .eyebrow { color: var(--accent-dark); font-weight: 700; letter-spacing: .03em; text-transform: uppercase; font-size: .78rem; }
.card, .metric, .hero {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(0,48,90,.08);
  padding: 26px;
}
.hero { margin-top: 60px; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.05; margin: 10px 0 16px; }
h2 { font-size: 1.25rem; margin: 0 0 14px; }
p { line-height: 1.55; }
.muted { color: var(--muted); }
.salutation { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
.grid { display: grid; gap: 18px; margin: 18px 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.subtle { background: var(--soft); }
.address-block { font-size: 1.25rem; line-height: 1.35; margin: 16px 0; }
.meta { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; font-weight: 700; }
.meta.large { grid-template-columns: 110px 1fr; font-size: 1.05rem; }
.notice { background: var(--warning); border: 1px solid #fed7aa; padding: 12px 14px; border-radius: 14px; }
.form-card { margin-top: 18px; }

/* Ansichts-Umschalter Kalender/Liste */
.view-toggle { display: flex; gap: 6px; background: var(--soft); border-radius: 999px; padding: 4px; }
.view-toggle a {
  padding: 7px 16px; border-radius: 999px; text-decoration: none;
  font-weight: 700; font-size: .9rem; color: var(--accent-dark);
}
.view-toggle a.active { background: var(--accent); color: #fff; }

/* Listenansicht */
.slot-list { display: grid; gap: 12px; margin: 18px 0 22px; }
.slot {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  background: #fff;
}
.slot:hover { border-color: var(--accent); }
.slot input { margin-top: 5px; transform: scale(1.2); accent-color: var(--accent); }
.slot span { display: grid; gap: 4px; }
.slot em { font-style: normal; font-size: 1.04rem; }
.slot small { color: var(--muted); }
.slot.disabled { opacity: .45; cursor: not-allowed; }

/* Kalenderansicht (Hauptansicht): Wochenraster Mo-Fr, Begehungen nur werktags */
.cal { display: grid; gap: 10px; margin: 18px 0 8px; }
.cal-week-head { display: flex; gap: 12px; align-items: baseline; font-weight: 800; font-size: .95rem; margin-top: 8px; }
.cal-week-head .muted { font-weight: 400; font-size: .85rem; }
.cal-week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.cal-day { border: 1px solid var(--line); border-radius: 14px; padding: 8px; background: #fff; min-height: 92px; }
.cal-day.empty { background: transparent; border-style: dashed; opacity: .55; }
.cal-date { font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.cal-slot {
  position: relative;
  display: grid; gap: 1px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 7px 9px;
  margin-top: 6px;
  cursor: pointer;
  background: #fff;
  font-weight: 400;
}
.cal-slot:hover { border-color: var(--accent); }
.cal-slot input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.cal-slot .cal-time { font-weight: 700; font-size: .86rem; }
.cal-slot .cal-free { color: var(--muted); font-size: .78rem; }
.cal-slot:has(input:checked) { border-color: var(--accent); background: var(--soft); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-slot:has(input:checked) .cal-free { color: var(--accent-dark); font-weight: 700; }
/* Fallback ohne :has() (alte Browser): Auswahl bleibt über Haken + Farbe sichtbar. */
.cal-slot input:checked ~ .cal-time { color: var(--accent-dark); }
.cal-slot input:checked ~ .cal-time::after { content: " ✓"; color: var(--accent); font-weight: 800; }
.cal-slot:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.cal-slot.disabled { opacity: .45; cursor: not-allowed; }
.cal-slot.disabled input { cursor: not-allowed; }
.cal-hint { font-size: .85rem; margin: 4px 0 18px; }

.fields { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
label { font-weight: 700; }
input[type="tel"], textarea {
  width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
  font: inherit; background: #fff;
}
.privacy { font-size: .9rem; color: var(--muted); }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 13px 20px;
  background: var(--accent); color: white; text-decoration: none; font-weight: 800; cursor: pointer;
}
.button:hover { background: var(--accent-dark); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.full { width: 100%; font-size: 1.05rem; }
.button.ghost { background: #e9f1f8; color: var(--accent-dark); }
.button.small { padding: 9px 13px; font-size: .9rem; }
.success { text-align: center; margin-top: 40px; }
.check { width: 66px; height: 66px; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center; font-size: 2.2rem; margin: 0 auto 12px; }
.metric strong { display: block; font-size: 2rem; }
.metric span { color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
/* Admin: lange Listen scrollen im Rahmen statt auf der Seite (~20-30 Zeilen). */
.table-frame { max-height: 62vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.table-frame table th { position: sticky; top: 0; background: #fff; z-index: 1; box-shadow: 0 1px 0 var(--line); }
.table-frame.slot-admin { padding: 0 14px; }
th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--accent-dark); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.filter-bar input[type="search"], .filter-bar select, .settings-form input[type="text"],
.settings-form input[type="number"], .settings-form input[type="date"], .settings-form input[type="file"],
.settings-form textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; background: #fff;
}
.filter-bar input[type="search"] { min-width: 220px; }
.result-count { margin-left: auto; font-size: .9rem; }

/* Admin-Einstellungen */
.msg { background: #e8f5ee; border: 1px solid #b5e0c8; color: #14532d; padding: 11px 14px; border-radius: 12px; font-weight: 600; }
.msg.error { background: #fdeeee; border-color: #f3c1c1; color: #7f1d1d; }
.settings-form { display: grid; gap: 16px; margin-top: 14px; }
.settings-form textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; }
.settings-form input[type="text"] { width: 100%; }
.settings-form .small { margin: 6px 0 0; font-size: .86rem; }
.settings-form .button { justify-self: start; }
.upload-row { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.info-box { background: var(--soft); border-radius: 12px; padding: 10px 14px; font-size: .9rem; }
.info-box summary { cursor: pointer; font-weight: 700; color: var(--accent-dark); }
.info-box ul { margin: 8px 0 4px; padding-left: 20px; }
.info-box li { margin: 3px 0; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.checkbox input { margin-top: 4px; transform: scale(1.15); accent-color: var(--accent); }
.checkbox.danger { background: var(--warning); border: 1px solid #fed7aa; border-radius: 12px; padding: 10px 14px; }
.team-box { display: grid; gap: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin: 0; background: var(--soft); }
.team-box legend { display: none; }
.team-head { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.team-head > div { flex: 1 1 240px; }
.button.ghost.danger { background: #fdeeee; color: #7f1d1d; }
.plan-preview {
  background: #0f2740; color: #dbeafe; border-radius: 14px; padding: 16px;
  overflow-x: auto; font-size: .85rem; line-height: 1.5; white-space: pre;
}
code { background: var(--soft); border-radius: 6px; padding: 1px 5px; font-size: .88em; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.status { padding: 4px 9px; border-radius: 999px; background: #eef2f2; font-weight: 700; }
.status.booked { background: #dcfce7; color: #166534; }
.status.cancelled { background: #fdeeee; color: #7f1d1d; }
/* Slot-Nachsteuerung (/admin/slots) */
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form input[type="text"] { width: 62px; }
.day-group.closed { opacity: .82; }
.day-group .actions form { display: inline-block; }
/* Footer der Kundenseiten (Texte & Branding im Admin) */
.site-footer { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 18px 6px 8px; color: var(--muted); font-size: .88rem; }
.site-footer a { color: inherit; }
.slot-admin { display: grid; gap: 8px; }
.slot-row { display: grid; grid-template-columns: 1.5fr 1.2fr 1fr .4fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
/* flow-root: verhindert, dass Kind-Margins durch body durchkollabieren —
   sonst misst das Auto-Resize-Skript (body.scrollHeight) zu wenig und das
   iFrame schneidet unten ab. */
body.embedded { background: transparent; display: flow-root; }
body.embedded .page { width: 100%; padding: 0; }
body.embedded .card { box-shadow: none; border-radius: 16px; }

@media (max-width: 760px) {
  .page { width: min(100% - 20px, 1120px); padding-top: 16px; }
  .topbar { align-items: flex-start; gap: 10px; flex-direction: column; }
  .grid.two, .grid.three, .fields { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; }
  .slot-row { grid-template-columns: 1fr; gap: 3px; }
  .card, .metric, .hero { border-radius: 18px; padding: 18px; }
  /* Kalender wird auf schmalen Screens zur Tages-Agenda: leere Tage raus,
     Tage untereinander, Zeitfenster nebeneinander. */
  .cal-week { grid-template-columns: 1fr; }
  .cal-day { display: flex; align-items: center; gap: 10px; min-height: 0; }
  .cal-day.empty { display: none; }
  .cal-date { margin: 0; flex: 0 0 72px; }
  .cal-slot { margin-top: 0; flex: 1; }
}
