:root {
  --rot: #c0392b;
  --rot-dark: #a93226;
  --rot-light: #fde8e8;
  --rot-mid: #e74c3c;
  --grau: #f5f5f5;
  --grau-mid: #e0e0e0;
  --grau-dark: #888;
  --text: #1a1a1a;
  --text-mid: #555;
  --text-light: #888;
  --weiss: #ffffff;
  --border: rgba(0,0,0,0.1);
  --border-mid: rgba(0,0,0,0.2);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: #f4f4f4;
  line-height: 1.5;
}

a { color: var(--rot); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.container { max-width: 480px; margin: 0 auto; padding: 1rem; }
.container-wide { max-width: 900px; margin: 0 auto; padding: 1rem; }

/* ── Navbar ── */
.navbar {
  background: var(--rot);
  color: #fff;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}
.navbar-brand svg { width: 20px; height: 20px; }
.navbar-right { display: flex; align-items: center; gap: 12px; }
.navbar-user { font-size: 13px; opacity: 0.85; }
.navbar-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.navbar-btn:hover { background: rgba(255,255,255,0.3); }

/* ── Cards ── */
.card {
  background: var(--weiss);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--rot); color: #fff; }
.btn-secondary { background: var(--grau); color: var(--text); border: 0.5px solid var(--border-mid); }
.btn-danger { background: #fff; color: var(--rot); border: 0.5px solid var(--rot); }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Forms ── */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-mid);
  margin-bottom: 5px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 0.5px solid var(--border-mid);
  border-radius: var(--radius);
  background: var(--weiss);
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--rot);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}
.field .optional { font-size: 11px; color: var(--text-light); margin-left: 4px; }
.field textarea { resize: vertical; min-height: 80px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--grau-mid);
  margin-bottom: 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  transition: color 0.15s;
}
.tab-btn.active { color: var(--rot); border-bottom-color: var(--rot); }
.tab-btn:hover { color: var(--text); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Badges / Pills ── */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
}
.badge-rot { background: var(--rot-light); color: var(--rot-dark); }
.badge-gruen { background: #e8f5ee; color: #0f6e56; }
.badge-gelb { background: #fef9e7; color: #b7770d; }
.badge-grau { background: var(--grau); color: var(--grau-dark); }

/* ── Alerts ── */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-error { background: var(--rot-light); color: var(--rot-dark); border: 0.5px solid var(--rot); }
.alert-success { background: #e8f5ee; color: #0f6e56; border: 0.5px solid #1d9e75; }
.alert-info { background: #e6f1fb; color: #185fa5; border: 0.5px solid #378add; }
.alert-warn { background: #fef9e7; color: #b7770d; border: 0.5px solid #f0ad4e; }

/* ── Info-grid (Metriken) ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1rem; }
.info-card { background: var(--grau); border-radius: var(--radius); padding: 0.85rem 1rem; }
.info-card .label { font-size: 12px; color: var(--text-light); margin-bottom: 3px; }
.info-card .value { font-size: 18px; font-weight: 600; color: var(--text); }

/* ── Page header ── */
.page-header { padding: 1.25rem 0 0.75rem; }
.page-header h1 { font-size: 20px; font-weight: 600; }
.page-header p { font-size: 13px; color: var(--text-mid); margin-top: 4px; }

/* ── Empty state ── */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-light); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; display: block; opacity: 0.3; }
.empty p { font-size: 14px; }

/* ── Loading spinner ── */
.spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--grau-mid);
  border-top-color: var(--rot);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 999; }
.toast {
  background: #1a1a1a;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── Fahrplan Zeitstrahl ── */
.timeline { display: flex; flex-direction: column; }
.halt { display: grid; grid-template-columns: 48px 20px 1fr; align-items: center; }
.halt-zeiten { text-align: right; padding-right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.halt-zeit { font-size: 12px; color: var(--text); line-height: 1.4; }
.halt-mitte { display: flex; flex-direction: column; align-items: center; align-self: stretch; }
.halt-linie { flex: 1; width: 1.5px; background: var(--grau-mid); }
.halt-linie.hidden { background: transparent; }
.halt-kreis { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--rot); background: var(--rot); flex-shrink: 0; }
.halt-info { padding: 10px 0 10px 12px; }
.halt-name { font-size: 14px; color: var(--text); }
.halt-name.bold { font-weight: 600; }
.halt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gleis { font-size: 12px; font-weight: 500; padding: 3px 8px; border-radius: 4px; background: var(--grau); color: var(--text-mid); white-space: nowrap; }
.halt-hinweis { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 12px; color: #e67e22; }

/* ── Responsive ── */
@media (min-width: 600px) {
  .container { padding: 1.5rem; }
}
