/* Fahrzeug-Merkliste – ruhiges, helles Layout für die Händler-Demo */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #616e7c;
  --border: #e1e5ea;
  --accent: #1d4ed8;
  --danger: #b91c1c;
  --green-bg: #dcfce7;  --green-fg: #166534;
  --yellow-bg: #fef3c7; --yellow-fg: #92400e;
  --grey-bg: #e5e7eb;   --grey-fg: #374151;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header, main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  padding-bottom: 16px;
}

header h1 { margin: 0; font-size: 1.5rem; }
header h1 a { color: inherit; text-decoration: none; }

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

.new-link, button {
  display: inline-block;
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.new-link:hover, button:hover { filter: brightness(1.1); }
button.danger { background: var(--danger); }

main {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding-top: 16px;
  padding-bottom: 24px;
  margin-bottom: 40px;
}

/* Filter- und Sortierleiste */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}
.filters label { display: flex; flex-direction: column; font-size: .875rem; color: var(--muted); }

select, input, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

/* Tabelle */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: .875rem; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: #f1f5f9; }
tbody tr:hover .sticky-col { background: #f1f5f9; }
tbody th { font-size: inherit; color: inherit; font-weight: normal; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Übersichtstabelle Umsätze: enger, damit alle 8 Spalten bei 1280 px passen. */
.revenue-table th, .revenue-table td { padding: 8px 6px; }
.revenue-table td.car, .revenue-table th:first-child { white-space: normal; min-width: 9rem; }
.revenue-table td.num, .revenue-table th.num, .revenue-table td.tax { white-space: nowrap; }
/* Handy: schmalere Auto-Spalte, damit Umsatz und Gewinn ohne Wischen sichtbar sind. */
@media (max-width: 640px) {
  .revenue-table td.car, .revenue-table th:first-child { min-width: 7rem; }
}

/* Status-Etiketten als Pillen */
.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 600;
}
.status-available { background: var(--green-bg);  color: var(--green-fg); }
.status-reserved  { background: var(--yellow-bg); color: var(--yellow-fg); }
.status-sold      { background: var(--grey-bg);   color: var(--grey-fg); }

.empty { color: var(--muted); padding: 24px 0; }

/* Formular einspaltig */
.vehicle-form {
  display: flex;
  flex-direction: column;
  max-width: 520px;
}
.vehicle-form label { margin-top: 14px; margin-bottom: 4px; font-weight: 600; }
/* Auswahlgruppe (z. B. Geschlecht): deutlich abgesetzt, Optionen nebeneinander */
.vehicle-form fieldset {
  margin: 28px 0 0;
  padding: 10px 14px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.vehicle-form legend { padding: 0 6px; font-weight: 600; }
.vehicle-form fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 20px 0 0;
  font-weight: normal;
}
.error { margin: 4px 0 0; color: var(--danger); font-size: .875rem; }

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}
.delete-link { margin-left: auto; color: var(--danger); }

/* Kopfzeile: Papierkorb + Neues Fahrzeug */
header nav { display: flex; align-items: center; gap: 16px; }

/* Papierkorb */
.trash-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.trash-settings input[type="text"] { width: 4.5em; }
.trash-settings input[type="checkbox"] { width: auto; margin-right: 4px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.row-actions form { margin: 0; }
.row-actions button { padding: 4px 10px; }

/* Stationen: Wisch-Hinweis nur auf dem Handy, Fahrzeug-Spalte bleibt beim Scrollen stehen */
.swipe-hint { display: none; }
.sticky-col { position: sticky; left: 0; background: var(--card); z-index: 1; }

/* Mittlere Breiten: Menüzeile bricht um statt die Seite seitlich zu schieben */
@media (max-width: 1100px) {
  header nav { flex-wrap: wrap; min-width: 0; gap: 8px 16px; justify-content: flex-end; }
}

/* Handy: kleinere Abstände, Tabelle scrollt seitlich */
@media (max-width: 640px) {
  header { flex-direction: column; align-items: flex-start; }
  header nav { flex-wrap: wrap; gap: 8px 16px; }
  main { border-radius: 0; border-left: 0; border-right: 0; }
  th, td { padding: 8px; }
  .swipe-hint { display: block; }
  .sticky-col { white-space: normal; max-width: 40vw; }
}

/* Anmeldung: Hinweise und „Abmelden“ als Link-Knopf */
.flash {
  margin: 0 0 16px;
  padding: 10px 14px;
  background: var(--yellow-bg);
  color: var(--yellow-fg);
  border-radius: 6px;
}
.user-info { color: var(--muted); font-size: .875rem; }
.logout-form { margin: 0; }
button.link-button {
  background: none;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
}

/* Protokoll */
.filter-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 16px; }
.audit-list { list-style: none; padding: 0; margin: 0 0 16px; }
.audit-list li { padding: 6px 0; border-bottom: 1px solid #ddd; overflow-wrap: anywhere; }
.pager { display: flex; gap: 16px; }

/* Abholungen & Auslieferungen */
.pickup-list { list-style: none; padding: 0; margin: 0 0 16px; }
.pickup-row { border-bottom: 1px solid var(--border); }
.pickup-row a { display: block; padding: 8px 0; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.pickup-row a:hover { background: var(--bg); }
.pickup-when { font-weight: 600; }
.pickup-overdue h3 { color: var(--danger); }
.pickup-details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.pickup-details dt { color: var(--muted); font-weight: 600; }
.pickup-details dd { margin: 0; overflow-wrap: anywhere; }
.pickup-details dd.nowrap, .calc td.nowrap { white-space: nowrap; overflow-wrap: normal; }
/* Finanzen nur lesen: sehr schmal Bezeichnung über Wert, sonst wird die Seite zu breit. */
@media (max-width: 400px) {
  .finance-details { grid-template-columns: 1fr; gap: 0; }
  .finance-details dd { margin-bottom: 10px; }
}
.pickup-notes { white-space: pre-wrap; }
.muted { color: var(--muted); font-size: .875rem; }

/* Stationen: ganze Zelle ist ein Link */
.station-cell { padding: 0; }
.station-cell a { display: block; padding: 10px 12px; color: var(--text); text-decoration: none; }
.station-cell a:hover { background: var(--bg); }
.filter-form .checkbox-label { flex-direction: row; align-items: center; gap: 6px; }
.filter-form .checkbox-label input { width: auto; }

/* Begrüßung nach dem Login */
.welcome { font-size: 2rem; text-align: center; margin: 2rem 0 1rem; }
.welcome-next { text-align: center; }

/* Bereich Umsätze */
.cost-item { margin: 0 0 28px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.cost-delete { margin-top: 8px; }
.calc { max-width: 420px; }
.calc td { text-align: right; }

/* Umsätze: Hinweise, Kacheln, Diagramm */
.revenue-note, .revenue-hint { color: var(--muted); font-size: .9rem; }
.revenue-hint { color: var(--yellow-fg); background: var(--yellow-bg); padding: 8px 12px; border-radius: 6px; }
.revenue-years { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.tile-label { display: block; font-size: .8125rem; color: var(--muted); }
.tile strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.revenue-chart { display: block; width: 100%; max-width: 760px; height: auto; margin: 16px 0 24px; }
.chart-month { cursor: pointer; outline: none; }
.chart-month .chart-tip { opacity: 0; pointer-events: none; }
.chart-month:hover .chart-tip, .chart-month:focus .chart-tip { opacity: 1; }
