/* Leasing-Rechner - dunkles, mobil optimiertes Design.
   Aufbau: erst Farben und Grundlagen, dann Bausteine (Karten, Formulare),
   zuletzt die Grafiken. */

:root {
  --bg: #0d1117;
  --bg-verlauf: #131a24;
  --karte: #171e29;
  --rand: #253040;
  --text: #e8eef6;
  --gedimmt: #94a3b8;
  --akzent: #2fd4a7;
  --akzent-dunkel: #10453a;
  --gruen: #2fd4a7;
  --blau: #57a8ff;
  --gelb: #f5b942;
  --rot: #ff6b6b;
  --radius: 16px;
  --schatten: 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  margin: 0;
  padding: 0 0 3rem;
  background: linear-gradient(180deg, var(--bg-verlauf), var(--bg) 320px);
  background-attachment: fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1rem;
}

h1 { font-size: 1.45rem; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; color: var(--gedimmt);
     text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
p { margin: 0.35rem 0; }
a { color: var(--akzent); text-decoration: none; }

/* --- Kopf und Fuss --- */

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  max-width: 680px;
  margin: 0 auto;
  padding: 0.9rem 1rem;
}

.marke { font-weight: 700; font-size: 1rem; color: var(--text); letter-spacing: -0.01em; }
.marke span { color: var(--akzent); }

.kopf nav { display: flex; align-items: center; gap: 0.75rem; }
.kopf nav a, .link-button { color: var(--gedimmt); font-size: 0.88rem; }

.link-button {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 0.88rem; color: var(--gedimmt);
}

.fuss {
  max-width: 680px; margin: 2rem auto 0; padding: 0 1rem;
  color: var(--gedimmt); font-size: 0.8rem; text-align: center;
}

/* --- Karten --- */

.karte {
  /* Inhalte der Kacheln sind mittig ausgerichtet. Ausnahmen weiter unten:
     Vertragsdaten (Bezeichnung links, Wert rechts) bleiben zweispaltig. */
  text-align: center;
  background: var(--karte);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.fahrzeugname { font-size: 2rem; margin-bottom: 0.1rem; }

.anmeldung { margin-top: 15vh; }

.klein { font-size: 0.85rem; color: var(--gedimmt); }
.hinweis { color: var(--gedimmt); }

/* --- Zahlen --- */

.grosszahl {
  font-size: 3rem; font-weight: 700; letter-spacing: -0.03em;
  margin: 0.6rem 0 0; line-height: 1.05;
}
.grosszahl span { font-size: 1.1rem; font-weight: 500; color: var(--gedimmt); }

.mittelzahl { font-size: 1.6rem; font-weight: 700; margin: 0.2rem 0; letter-spacing: -0.02em; }
.mittelzahl span { font-size: 0.85rem; font-weight: 500; color: var(--gedimmt); }

.status { font-weight: 600; margin-top: 0.5rem; }
.status-ueber { color: var(--rot); }
.status-unter { color: var(--blau); }
.status-im_rahmen { color: var(--gruen); }

.betrag { font-size: 1.25rem; font-weight: 700; }
.ergebnis-nachzahlung { color: var(--rot); }
.ergebnis-erstattung { color: var(--gruen); }
.ergebnis-im_rahmen { color: var(--gedimmt); }

.prognosen { display: grid; gap: 0.9rem; }
.prognose {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 0.8rem;
}

/* --- Knoepfe --- */

.knopfreihe { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1rem; }

.knopf, button.haupt, .haupt.knopf {
  display: inline-flex; align-items: center; justify-content: center;
  /* Etwas schmaler, damit die beiden Knoepfe der Uebersicht auf dem Handy
     nebeneinander passen. Die Hoehe bleibt bei 48 px - gut zu treffen. */
  min-height: 48px; padding: 0 0.6rem;
  border-radius: 12px; border: 1px solid var(--rand);
  background: rgba(255, 255, 255, 0.04); color: var(--text);
  /* font: inherit muss vor font-size stehen - sonst setzt es die Groesse
     wieder auf den geerbten Wert zurueck. */
  font: inherit; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; text-align: center;
}

.haupt, button.haupt, a.haupt.knopf {
  background: var(--akzent); border-color: var(--akzent); color: #05221c;
}

.klein-knopf { min-height: 38px; padding: 0 0.75rem; font-size: 0.85rem; font-weight: 500; }
.gefahr { color: var(--rot); }
.inline { display: inline; }

/* --- Formulare --- */

.formular { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.75rem; }
.formular label { font-size: 0.85rem; color: var(--gedimmt); margin-top: 0.75rem; text-align: center; }

input[type="text"], input[type="number"], input[type="date"], input[type="password"] {
  display: block;
  width: 100%; max-width: 100%; min-width: 0;
  min-height: 48px; padding: 0 0.8rem; text-align: center;
  border-radius: 12px; border: 1px solid var(--rand);
  background: #0f151e; color: var(--text); font: inherit;
}

/* Datumsfelder in Safari (iPhone) brauchen zwei Sonderbehandlungen:
   1. eine eigene Mindestbreite, sonst ragt das Feld ueber die Kachel hinaus,
   2. der Datumstext klebt sonst am oberen Rand statt in der Mitte.
   Das Feld bleibt ein echtes Datumsfeld - der Kalender-Picker oeffnet sich
   beim Antippen wie gewohnt. */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
input[type="date"]::-webkit-date-and-time-value {
  text-align: center;
  width: 100%;
  height: 100%;
  line-height: 46px;
  margin: 0;
}
input[type="date"]::-webkit-calendar-picker-indicator { margin-left: 0; }
input:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* --- Listen --- */

.liste { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.listenzeile {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 0; border-top: 1px solid var(--rand);
}
.listenzeile .titel { font-weight: 600; margin: 0; }
.listenzeile .aktionen { display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.archiviert { opacity: 0.55; }

.fahrzeugwahl { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.25rem 0 1rem; }
.chip {
  padding: 0.45rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--rand); color: var(--gedimmt); font-size: 0.9rem;
}
.chip.aktiv { background: var(--akzent-dunkel); border-color: var(--akzent); color: var(--akzent); }

/* --- Meldungen --- */

.meldungen { list-style: none; margin: 0 0 1rem; padding: 0; }
.meldung {
  text-align: center; cursor: pointer;
  transition: opacity 0.4s ease, transform 0.4s ease;
  padding: 0.7rem 0.9rem; border-radius: 12px; margin-bottom: 0.5rem;
  border: 1px solid var(--rand); background: var(--karte); font-size: 0.92rem;
}
.meldung.verschwindet { opacity: 0; transform: translateY(-8px); }
.meldung.error { border-color: var(--rot); color: #ffd7d7; }
.meldung.success { border-color: var(--gruen); color: #ccfbee; }

/* --- Vertragsdaten --- */

.vertrag dl { margin: 0; }
.vertrag dl > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.45rem 0; border-top: 1px solid var(--rand);
}
.vertrag dt { color: var(--gedimmt); font-size: 0.9rem; text-align: left; }
.vertrag dd { margin: 0; font-weight: 600; text-align: right; }

/* --- Tacho-Grafik --- */

.tacho { width: 100%; height: auto; margin-top: 1rem; display: block; }
.gauge-track { fill: #0f151e; stroke: var(--rand); }
.gauge-band { fill: rgba(47, 212, 167, 0.22); }
.gauge-fill { fill: var(--gruen); }
.gauge-fill.status-ueber { fill: var(--rot); }
.gauge-fill.status-unter { fill: var(--blau); }
.gauge-target { stroke: var(--text); stroke-width: 2; }
.gauge-limit { stroke: var(--gelb); stroke-width: 2; stroke-dasharray: 3 3; }
.gauge-label { fill: var(--gedimmt); font-size: 10px; }

/* --- Verlaufs-Diagramm --- */

.chart { width: 100%; height: auto; margin-top: 0.5rem; display: block; }
.grid { stroke: var(--rand); stroke-width: 1; }
.achse { fill: var(--gedimmt); font-size: 17px; }
.achse-linie { stroke: var(--rand); stroke-width: 1.5; }
.chart-band { fill: rgba(47, 212, 167, 0.12); }
.chart-target { fill: none; stroke: var(--gedimmt); stroke-width: 2; }
.chart-limit { stroke: var(--gelb); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart-actual { fill: none; stroke: var(--akzent); stroke-width: 2.5; stroke-linejoin: round; }
.chart-dot { fill: var(--akzent); }
.chart-forecast { fill: none; stroke: var(--blau); stroke-width: 2; stroke-dasharray: 6 4; }
.chart-today { stroke: rgba(255, 255, 255, 0.25); stroke-width: 1; stroke-dasharray: 2 3; }

.legende { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 0.9rem; align-items: center; margin-top: 0.6rem; }
.legende-eintrag { display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap; }
.marker { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; }
.marker.punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--akzent); }
.marker.linie { background: var(--gedimmt); }
.marker.hochrechnung { background: var(--blau); }
.marker.flaeche { width: 14px; height: 9px; border-radius: 3px; background: rgba(47, 212, 167, 0.3); }
.marker.soll { width: 3px; height: 12px; background: var(--text); }
.marker.grenze { width: 3px; height: 12px; background: var(--gelb); }

/* --- Groessere Bildschirme --- */

@media (min-width: 560px) {
  .prognosen { grid-template-columns: 1fr 1fr; }
  .grosszahl { font-size: 3.4rem; }
}
