:root {
  --bg: #eee7d6;
  --paper: #fbf8f0;
  --ink: #23303b;
  --ink-soft: #5b6672;
  --asphalt: #23303b;
  --lane: #f4b942;
  --line: #d9cfb8;
  --danger: #b3402f;
  --danger-bg: #f7e3de;
  --radius: 10px;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

/* Sicherstellen, dass das hidden-Attribut IMMER greift, auch wenn eine
   Klasse an demselben Element explizit einen display-Wert setzt. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 42px;
  background-position: 0 92px;
}

body { min-height: 100vh; }

button, input, select { font-family: inherit; }

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(16px, 4vw, 48px);
  border-bottom: 3px solid var(--asphalt);
  background: var(--paper);
}

.topbar-mark { display: flex; align-items: center; gap: 14px; }
.mark-glyph { font-size: 34px; line-height: 1; }
.mark-text h1 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.01em;
}
.mark-text p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

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

/* ---------- Bericht ---------- */

.report-view {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 60px;
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.report-header h2 { font-family: var(--font-display); margin: 0; font-size: 20px; }
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.report-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}
.report-table th, .report-table td {
  text-align: left;
  padding: 10px 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}
.report-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(35,48,59,0.04);
}
.report-table tbody tr:last-child td { border-bottom: none; }
.report-table td.num, .report-table th.num { text-align: right; }
.driver-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
}
.report-view h3 {
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0 0 10px;
}

@media print {
  .topbar, .report-actions, .hint { display: none !important; }
  body { background: #fff; }
  .report-table { border: 1px solid #999; }
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  padding: 28px clamp(16px, 4vw, 48px) 60px;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

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

/* ---------- Calendar panel ---------- */

.calendar-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.nav-month { flex: 1; text-align: center; }
#month-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  text-transform: capitalize;
}

.nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--asphalt);
  background: var(--paper);
  color: var(--asphalt);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}
.nav-btn:hover { background: var(--asphalt); color: var(--paper); }
.nav-btn:active { transform: scale(0.92); }

.btn-ghost {
  border: 1.5px solid var(--asphalt);
  background: transparent;
  color: var(--asphalt);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost:hover { background: var(--asphalt); color: var(--paper); }
.btn-ghost.small { padding: 6px 12px; font-size: 12px; }

.btn-primary {
  border: none;
  background: var(--asphalt);
  color: var(--paper);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: #364758; }

.weekday-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
  padding: 0 2px 8px;
  border-bottom: 2px dashed var(--line);
  margin-bottom: 6px;
}
.weekday-row span { text-align: center; }

.calendar-grid { display: flex; flex-direction: column; }

.week-row {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: 34px 22px;
  row-gap: 2px;
  padding-bottom: 6px;
}

.day-cell {
  grid-row: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  border-radius: 6px;
  margin: 2px;
  padding-top: 4px;
  transition: background 0.1s ease;
}
.day-cell:hover { background: rgba(35, 48, 59, 0.07); }
.day-cell.outside { color: #c3bba6; cursor: default; }
.day-cell.outside:hover { background: none; }
.day-cell.today { position: relative; }
.day-cell.today span {
  background: var(--lane);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.day-cell.selecting {
  background: var(--asphalt);
  color: var(--paper);
  border-radius: 6px;
}

.route-bar {
  grid-row: 2;
  align-self: center;
  height: 18px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25);
}
.route-bar.cap-start { border-top-left-radius: 9px; border-bottom-left-radius: 9px; margin-left: 2px; }
.route-bar.cap-end { border-top-right-radius: 9px; border-bottom-right-radius: 9px; margin-right: 2px; }

.hint {
  margin: 16px 2px 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- Side panel ---------- */

.side-panel { display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card h2 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 14px;
}

#reservation-form { display: flex; flex-direction: column; gap: 12px; }

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
}

input, select {
  border: 1.5px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--asphalt);
}

.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.form-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 12.5px;
  margin: 0;
}

.form-actions { display: flex; gap: 10px; margin-top: 2px; }

.reservation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 360px;
  overflow-y: auto;
}

.reservation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--asphalt);
  border-radius: 8px;
  padding: 10px 12px;
}

.reservation-info { flex: 1; min-width: 0; }
.reservation-dates {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
}
.reservation-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink-soft);
}
.icon-btn:hover { background: rgba(35,48,59,0.08); color: var(--ink); }

.empty-state { font-size: 13px; color: var(--ink-soft); margin: 0; }

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 48, 59, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.modal-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
}
.modal-card h2 { font-family: var(--font-display); margin: 0 0 16px; font-size: 17px; }

.driver-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

input[type="color"] {
  width: 40px;
  height: 36px;
  padding: 2px;
  cursor: pointer;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--asphalt);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 30;
}
.toast.error { background: var(--danger); }
