/* Heimbringer – "Nachtfahrt"
   Signatur: Scheinwerfer-Amber auf tiefem Nachtblau. Status leuchtet.
   Mobile-first; alles soll im Dunkeln am Handy gut lesbar sein. */

:root {
  --night: #0c1018;       /* Hintergrund */
  --panel: #161c28;       /* Karten */
  --panel-2: #1f2736;     /* erhoehte Flaechen */
  --line: #2a3346;        /* Trennlinien */
  --ink: #eef1f6;         /* Text */
  --muted: #8b94a7;       /* Sekundaertext */
  --beam: #ffb454;        /* Scheinwerfer-Amber, Signatur + Primaeraktion */
  --beam-soft: #4a3a23;
  --go: #38d9c8;          /* "unterwegs" lebendiges Mint */
  --go-soft: #173c3a;
  --back: #9b8cff;        /* "Rueckweg" */
  --danger: #ff6b6b;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background:
    radial-gradient(120% 80% at 50% -10%, #11182a 0%, var(--night) 55%) fixed,
    var(--night);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 18px 16px 96px;
}

/* --- Kopf --- */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 2px 18px;
}
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--beam);
  display: grid; place-items: center;
  box-shadow: 0 0 18px rgba(255, 180, 84, 0.45);
  font-size: 19px;
}
.brand h1 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin: 0;
}
.brand .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* --- Status-Banner (Signatur) --- */
.status {
  position: relative;
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.status .beam {
  position: absolute; inset: 0;
  background: radial-gradient(70% 120% at 18% 0%, var(--beam-soft) 0%, transparent 60%);
  opacity: 0.9; pointer-events: none;
}
.status[data-state="driving"] .beam {
  background: radial-gradient(70% 120% at 18% 0%, var(--go-soft) 0%, transparent 60%);
}
.status .row { position: relative; display: flex; align-items: center; gap: 12px; }
.dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--beam); box-shadow: 0 0 0 6px rgba(255, 180, 84, 0.14);
  flex: none;
}
.status[data-state="driving"] .dot {
  background: var(--go); box-shadow: 0 0 0 0 rgba(56, 217, 200, 0.5);
  animation: pulse 1.6s ease-out infinite;
}
.status[data-state="returning"] .dot { background: var(--back); box-shadow: 0 0 0 6px rgba(155, 140, 255, 0.16); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(56, 217, 200, 0.5); }
  100% { box-shadow: 0 0 0 16px rgba(56, 217, 200, 0); }
}
.status .label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.status .headline {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 23px; font-weight: 600; letter-spacing: -0.01em;
}
.status .meta { position: relative; color: var(--muted); font-size: 13px; margin-top: 10px; }
.status .meta b { color: var(--ink); font-weight: 600; }

/* --- Karte --- */
#map {
  height: 230px; border-radius: var(--radius);
  border: 1px solid var(--line); margin-bottom: 16px; background: #0a0e16;
  position: relative; z-index: 0; /* haelt Leaflet-Ebenen unter dem Overlay */
}
.leaflet-container { background: #0a0e16; font: inherit; }
/* dunkle Tiles */
.leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.95); }
.car-marker {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--beam); display: grid; place-items: center; font-size: 16px;
  box-shadow: 0 0 0 4px rgba(255, 180, 84, 0.22), 0 0 22px rgba(255, 180, 84, 0.7);
}
.car-marker.driving { background: var(--go); box-shadow: 0 0 0 4px rgba(56, 217, 200, 0.22), 0 0 22px rgba(56, 217, 200, 0.7); }
.venue-marker {
  width: 16px; height: 16px; border-radius: 50%; background: transparent;
  border: 2px solid var(--muted); box-shadow: 0 0 0 4px rgba(139,148,167,0.12);
}

/* --- Karten / Listen --- */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 14px; margin-bottom: 14px;
}
.card > h2 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); margin: 2px 2px 10px; font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.count { color: var(--beam); font-variant-numeric: tabular-nums; }

.item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 4px; border-top: 1px solid var(--line);
}
.item:first-of-type { border-top: 0; }
.item .who { font-weight: 600; }
.item .where { color: var(--muted); font-size: 13.5px; }
.item .body { flex: 1; min-width: 0; }
.item .pill {
  flex: none; font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--muted); white-space: nowrap;
}
.item .tag { font-size: 11.5px; color: var(--muted); }
.item .tag b { color: var(--ink); }
.empty { color: var(--muted); font-size: 13.5px; padding: 6px 4px; }

/* riding-Markierung */
.item.riding .who::after { content: " · unterwegs"; color: var(--go); font-weight: 500; font-size: 12.5px; }

/* --- Buttons --- */
button, .btn {
  font: inherit; cursor: pointer; border: 0; border-radius: 12px;
  padding: 12px 16px; font-weight: 600; color: var(--night); background: var(--beam);
  transition: transform 0.06s ease, filter 0.15s ease;
}
button:active { transform: translateY(1px); }
button:hover { filter: brightness(1.05); }
button.ghost { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
button.go { background: var(--go); }
button.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.full { width: 100%; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow.seg button { flex: 1; }

/* fixierter Haupt-Button unten */
.fab {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--night) 38%);
}
.fab .inner { max-width: 560px; margin: 0 auto; }
.fab button { width: 100%; padding: 15px; font-size: 16px; box-shadow: var(--shadow); }

/* --- Formular / Felder --- */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 2px 5px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px 13px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--beam); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; min-height: 60px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 1em; }

/* --- Overlay (Login) --- */
.overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 22px;
  background: rgba(8, 11, 18, 0.92); backdrop-filter: blur(6px);
}
.overlay[hidden] { display: none; }
.overlay .box {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; box-shadow: var(--shadow);
}
.overlay h2 { font-family: "Space Grotesk", sans-serif; margin: 6px 0 2px; font-size: 19px; }
.overlay p { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }

/* --- Toast --- */
.toast {
  position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  padding: 11px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 1100; max-width: 92vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.topnav { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.topnav a { color: var(--muted); font-size: 13px; text-decoration: none; border-bottom: 1px dotted var(--line); }
.topnav a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
