:root {
  /* Akzent */
  --accent: #b61c3e;
  --accent-weak: rgba(182, 28, 62, 0.12);
  --accent-soft: rgba(182, 28, 62, 0.06);

  /* Light UI */
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #12131a;
  --muted: rgba(18, 19, 26, 0.65);

  --line: rgba(18, 19, 26, 0.1);
  --line-strong: rgba(18, 19, 26, 0.16);

  --shadow: 0 14px 42px rgba(16, 18, 27, 0.1);
  --shadow-soft: 0 10px 26px rgba(16, 18, 27, 0.08);

  --radius: 18px;
  --max: 1120px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell,
    Noto Sans, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: transparent; /* wichtig */
}

/* Fixierter Seitenhintergrund (rollt nicht mit) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;

  background: radial-gradient(
      900px 500px at 12% -10%,
      rgba(182, 28, 62, 0.18),
      transparent 60%
    ),
    radial-gradient(
      900px 520px at 90% 10%,
      rgba(182, 28, 62, 0.1),
      transparent 55%
    ),
    var(--bg);

  /* verhindert „Kacheln“ / Wiederholen */
  background-repeat: no-repeat;
  background-attachment: fixed; /* schadet nicht, aber fixed element ist entscheidend */
}

.wrap {
  max-width: var(--max);
  margin: 22px auto;
  padding: 0 16px 26px;

  /* Fix: iOS/Android Overflow durch 100vw/scrollbar-Bugs */
  /* overflow-x: clip; */
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  margin-bottom: 16px;
  align-items: stretch;
  min-width: 0;
}

.hero-text,
.hero-media {
  background: linear-gradient(180deg, #ffffff, rgba(255, 255, 255, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}

.hero-text {
  padding: 16px;
}

.hero-text h2 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.hero-media {
  display: flex;
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

/* Cards / layout */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;

  /* Fix: verhindert, dass Kinder die Card sprengen */
  overflow: hidden;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 16px;
  min-width: 0;
}

.stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

label span {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  outline: none;
}

input::placeholder {
  color: rgba(18, 19, 26, 0.4);
}

input:focus,
select:focus {
  border-color: rgba(182, 28, 62, 0.5);
  box-shadow: 0 0 0 4px rgba(182, 28, 62, 0.12);
}

small.muted {
  display: block;
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;

  border: 1px solid rgba(182, 28, 62, 0.28);
  background: linear-gradient(
    180deg,
    rgba(182, 28, 62, 0.96),
    rgba(182, 28, 62, 0.86)
  );
  color: #fff;

  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.1px;
  box-shadow: 0 10px 24px rgba(182, 28, 62, 0.18);

  max-width: 100%;
}

.btn.secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--text);
  font-weight: 700;
  box-shadow: none;
}

.btn:hover {
  filter: brightness(1.02);
}

.btn:active {
  transform: translateY(1px);
}

.btn.tiny {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}

.btn.danger {
  background: rgba(182, 28, 62, 0.1);
  border-color: rgba(182, 28, 62, 0.25);
  color: var(--accent);
  box-shadow: none;
}

/* Alerts */
.alert {
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  margin: 12px 0 16px;
}

.alert.ok {
  background: rgba(18, 150, 80, 0.1);
  border-color: rgba(18, 150, 80, 0.18);
}

.alert.error {
  background: rgba(182, 28, 62, 0.1);
  border-color: rgba(182, 28, 62, 0.2);
  color: #6f1025;
}

/* =======================
   TABLE (clean & stable)
   ======================= */

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px; /* stabil bei 5 Spalten */
  table-layout: fixed;
  background: #fff;
}

th,
td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  text-align: left;
  font-size: 13px;
  color: var(--muted);

  position: sticky;
  top: 0;

  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-strong);
}

/* Spaltenbreiten */
thead th:nth-child(1),
tbody td:nth-child(1) {
  width: 18%;
} /* Name */
thead th:nth-child(2),
tbody td:nth-child(2) {
  width: 28%;
} /* Zeit */
thead th:nth-child(3),
tbody td:nth-child(3) {
  width: 18%;
} /* Standort */
thead th:nth-child(4),
tbody td:nth-child(4) {
  width: 18%;
} /* Notiz */
thead th:nth-child(5),
tbody td:nth-child(5) {
  width: 18%;
} /* Aktionen */

tr:hover td {
  background: var(--accent-soft);
}

tr:last-child td {
  border-bottom: none;
}

tbody td:nth-child(3),
tbody td:nth-child(4) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody td:nth-child(2) .mono {
  line-height: 1.2;
  white-space: nowrap;
}

/* Aktionen nebeneinander (Wrapper .inline in <td>) */
.actions-col {
  white-space: nowrap;
}

.actions-col .inline {
  display: inline-flex;
  gap: 10px;
  align-items: center;
}

.actions-col form {
  margin: 0;
}

.actions-col button.btn,
.actions-col a.btn {
  white-space: nowrap;
}

/* Mobile/Tablet: Tabelle scrollt statt zu zerbrechen */
@media (max-width: 980px) {
  table {
    min-width: 920px;
  }
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

.muted {
  color: var(--muted);
}

.footer {
  margin-top: 14px;
  padding: 6px 2px;
}

/* --- Responsive --- */
@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-media {
    min-height: 190px;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Fix: das "grid" Formular (Code-Seite / ggf. andere) darf auf Mobile nicht 2 Spalten erzwingen */
.grid {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
  min-width: 0;
}

@media (max-width: 520px) {
  .logo {
    width: 40px;
    height: 40px;
  }
  .brand-text h1 {
    font-size: 18px;
  }

  .btn {
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

/* --- Layout Update: Buchungsformular neben Transporterbild --- */
.hero.hero-booking {
  display: grid;
  grid-template-columns: 1fr 0.95fr;
  gap: 14px;
  align-items: stretch;
}

.hero-booking-form {
  padding: 16px;
}

.grid.grid-2cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.fullwidth {
  width: 100%;
}

@media (max-width: 980px) {
  .hero.hero-booking {
    grid-template-columns: 1fr;
  }
  .hero-media {
    min-height: 220px;
  }
}

@media (max-width: 520px) {
  .grid.grid-2cols {
    grid-template-columns: 1fr;
  }
}

/* =======================
   Kalender (Jan/Feb) - SKIP DAYS
   ======================= */

.cal-wrap {
  margin-top: 16px;
}

.cal-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 980px) {
  .cal-2 {
    grid-template-columns: 1fr;
  }
}

.calendar .cal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.calendar .cal-head h2 {
  margin: 0;
  font-size: 16px;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  position: relative;

  grid-template-rows: 44px; /* Header */
  grid-auto-rows: 64px; /* Wochen */
}

.cal-dow {
  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;
  color: var(--muted);
  font-weight: 900;

  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.cal-day {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--line);
  height: 64px;
  overflow: hidden;
  z-index: 2;

  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
}

.cal-day.out {
  background: rgba(255, 255, 255, 0.65);
  color: rgba(18, 19, 26, 0.35);
}

/* buchbarer Bereich (grün) */
.cal-day.avail {
  background: rgba(18, 150, 80, 0.1);
  border-color: rgba(18, 150, 80, 0.22);
}

/* nicht buchbarer Bereich (grau) */
.cal-day.na {
  background: rgba(18, 19, 26, 0.04);
  border-color: rgba(18, 19, 26, 0.1);
  color: rgba(18, 19, 26, 0.4);
}

.cal-num {
  position: absolute;
  top: 8px;
  left: 10px;
  font-weight: 900;
  font-size: 13px;
}

/* Tagesmarkierung (für Tagesbuchungen) */
.cal-day::before {
  content: "";
  position: absolute;
  inset: 0;
  background: transparent;
}

.cal-day.book-full::before {
  background: rgba(182, 28, 62, 0.18);
}

.cal-day.book-am::before {
  background: linear-gradient(
    90deg,
    rgba(182, 28, 62, 0.18) 0 50%,
    transparent 50% 100%
  );
}

.cal-day.book-pm::before {
  background: linear-gradient(
    90deg,
    transparent 0 50%,
    rgba(182, 28, 62, 0.18) 50% 100%
  );
}

/* Multi-day Balken (volle Kachel-Höhe) */
.cal-bar {
  height: 64px;
  align-self: stretch;

  background: rgba(182, 28, 62, 0.14);
  border: 1px solid rgba(182, 28, 62, 0.22);
  box-shadow: 0 12px 28px rgba(182, 28, 62, 0.1);

  border-radius: 14px;
  position: relative;
  z-index: 1;

  /* Gap optisch schließen */
  margin-left: -4px;
  margin-right: -4px;

  display: flex;
  align-items: center;
  padding: 0 12px;
  overflow: hidden;
}

.cal-bar.start {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

.cal-bar.end {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.cal-bar:not(.start):not(.end) {
  border-radius: 10px;
}

.cal-bar-label {
  font-size: 12px;
  font-weight: 900;
  color: #711326;
  white-space: nowrap;
  user-select: none;
}
