/* =====================================================================
   Haushaltsbuch: Gestaltung
   Design Tokens nach css Vorlage "Look: YNAB" (Farben, Schrift Figtree, Radien, Knöpfe, Eingabefelder).
   Mobil zuerst, ab 768 px breiter. Dunkelmodus folgt dem Gerät.
   Die dunklen Farben, Fehler und Erfolgsfarben sowie die gedämpfte Schrift sind aus der Vorlage
   abgeleitet (dort nicht enthalten) und auf Kontrast nach WCAG geprüft.
   ===================================================================== */

/* Schrift Figtree als lokale Datei (SIL Open Font License, siehe fonts/Figtree-OFL.txt) */
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;

  /* aus der Vorlage */
  --bg: #fef9ed;
  --flaeche: #ffffff;
  --text: #1c1f58;
  --akzent: #545bfe;
  --gruen: #aee865;
  --mint: #41d298;
  --knopf-bg: #aee865;
  --knopf-text: #1c1f58;
  --knopf2-text: #1c1f58;
  --knopf2-rand: #1c1f58;
  --rand-eingabe: #1c1f58;

  /* ergänzt, passend zur Vorlage */
  --flaeche-2: #f6f0e1;
  --text-leise: #5d608c;
  --rand: #e3e3eb;
  --rand-karte: rgb(28 31 88 / 0.1);
  --akzent-text: #ffffff;
  --akzent-weich: #e5e6ff;
  --fehler: #c42b3a;
  --fehler-weich: #fdecee;
  --erfolg: #147a50;
  --erfolg-weich: #e3f8ee;
  --erfolg-balken: var(--mint);
  --schatten: none;

  /* Diagrammfarben: feste Reihenfolge, auf Farbsehschwäche geprüft, Farbe 1 ist der Akzent */
  --serie-1: #545bfe;
  --serie-2: #eb6834;
  --serie-3: #1baf7a;
  --serie-4: #eda100;
  --text-auf-serie-4: #0b0b0b;

  /* Radien und Abstände aus der Vorlage (Grundeinheit 4 px) */
  --radius: 8px;
  --radius-klein: 8px;
  --radius-knopf: 6px;
  --abstand: 16px;
  --schrift: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --schrift-titel: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* abgeleitet: Navy als Fläche, Creme als Schrift */
    --bg: #13153d;
    --flaeche: #1c1f58;
    --flaeche-2: #272b6e;
    --text: #fef9ed;
    --text-leise: #b7b6d6;
    --rand: #333878;
    --rand-karte: rgb(254 249 237 / 0.08);
    --rand-eingabe: #9a9ccc;
    --akzent: #8f95ff;
    --akzent-text: #13153d;
    --akzent-weich: #30358a;
    --knopf-bg: #aee865;
    --knopf-text: #1c1f58;
    --knopf2-text: #fef9ed;
    --knopf2-rand: #fef9ed;
    --fehler: #ff8f96;
    --fehler-weich: #40193a;
    --erfolg: #41d298;
    --erfolg-weich: #14403a;
    --schatten: none;

    --serie-1: #7a80ff;
    --serie-2: #d95926;
    --serie-3: #199e70;
    --serie-4: #c98500;
    --text-auf-serie-4: #ffffff;
  }
}

/* ---------- Grundlagen ---------- */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Abstand zu Notch und Home Leiste auf dem iPhone */
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

[hidden] { display: none !important; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--schrift-titel);
  font-weight: 700;
  line-height: 1.25;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.125rem; }

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

/* Eingabefelder mindestens 16 px, damit Safari auf dem iPhone nicht hineinzoomt */
input, select, textarea, button {
  font: inherit;
  font-size: max(16px, 1rem);
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
}

.app {
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--abstand);
}

@media (min-width: 768px) {
  .app {
    max-width: 64rem;
    padding: 24px 32px;
  }
}

@media (min-width: 1200px) {
  .app { max-width: 76rem; }
}

.laden,
.leise {
  color: var(--text-leise);
}

/* ---------- Hinweis ohne Verbindung (oberhalb der Seite, gleiche Breite wie .app) ---------- */

.verbindung {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 var(--abstand);
}

.verbindung-hinweis {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: var(--abstand) 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-klein);
  background: var(--akzent-weich);
  color: var(--text);
}

.verbindung-hinweis p { margin: 0; }

@media (min-width: 768px) {
  .verbindung {
    max-width: 64rem;
    padding: 0 32px;
  }
  .verbindung-hinweis { margin-top: 24px; }
}

@media (min-width: 1200px) {
  .verbindung { max-width: 76rem; }
}

/* ---------- Kopfzeile ---------- */

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.kopf-titel {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* ---------- Karten ---------- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand-karte);
  border-radius: var(--radius);
  box-shadow: var(--schatten);
  padding: 20px;
}

/* ---------- Knöpfe ---------- */

/* Standard ist der zweite Knopfstil der Vorlage: transparent mit Rand. Primär ist der grüne Knopf. */
.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--knopf2-rand);
  border-radius: var(--radius-knopf);
  background: transparent;
  color: var(--knopf2-text);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@media (hover: hover) {
  .knopf:hover { background: var(--flaeche-2); }
}

.knopf.primaer {
  background: var(--knopf-bg);
  border-color: var(--knopf-bg);
  color: var(--knopf-text);
}

@media (hover: hover) {
  .knopf.primaer:hover { filter: brightness(0.95); }
}

.knopf:disabled {
  opacity: 0.6;
  cursor: progress;
}

.knopf.breit { width: 100%; }

/* ---------- Formulare ---------- */

.formular {
  display: grid;
  gap: 16px;
}

.feld {
  display: grid;
  gap: 6px;
}

.feld-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-leise);
}

.eingabe {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--rand-eingabe);
  border-radius: var(--radius);
  background: var(--flaeche);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
}

.eingabe:focus {
  outline: 2px solid var(--akzent);
  outline-offset: 0;
  border-color: var(--akzent);
}

.fehlermeldung {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-klein);
  background: var(--fehler-weich);
  color: var(--fehler);
  font-weight: 500;
}

/* ---------- Login ---------- */

.login {
  min-height: calc(100dvh - 2 * var(--abstand) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}

.login-karte {
  width: 100%;
  max-width: 24rem;
  padding: 28px 22px;
}

.login-kopf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

/* ---------- Hilfsklassen ---------- */

/* nur für Screenreader sichtbar */
.unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.symbol {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: none;
}

.symbol svg {
  width: 100%;
  height: 100%;
}

.fehlertext { color: var(--fehler); }

/* ---------- Unterseiten ---------- */

.kopf-unterseite {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.kopf-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kopf-titelzeile p { margin: 2px 0 0; }

.zurueck {
  justify-self: start;
  padding-left: 10px;
}

.kopf-aktionen {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Startseite: Uhr ---------- */

.uhr {
  text-align: center;
  padding: 28px 16px 24px;
  margin-bottom: 20px;
}

.uhr-zeit {
  display: block;
  font-size: clamp(2.75rem, 15vw, 5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.uhr-datum {
  margin: 8px 0 0;
  font-size: 1.125rem;
  color: var(--text-leise);
}

/* ---------- Startseite: Kacheln ---------- */

.kacheln {
  display: grid;
  gap: 16px;
  /* so viele Spalten wie mit mindestens 300 px Platz haben, auf dem Handy eine */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.kachel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 168px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, transform 0.15s;
}

@media (hover: hover) {
  .kachel:hover { border-color: var(--akzent); }
}
.kachel:active { transform: scale(0.99); }

.kachel-kopf {
  display: flex;
  align-items: center;
  gap: 12px;
}

.kachel-symbol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--akzent-weich);
  color: var(--akzent);
}

.kachel-titel {
  flex: 1;
  font-size: 1.125rem;
}

.kachel-pfeil { color: var(--text-leise); }

.kachel-info { margin-top: auto; }

.kachel-info p { margin: 0; }

.kachel-beschriftung {
  font-size: 0.9375rem;
  color: var(--text-leise);
}

.kachel-wert {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.kachel-wert.negativ { color: var(--fehler); }

.kachel-zusatz { color: var(--text-leise); }

/* ---------- Fußzeile ---------- */

/* Fuß der Startseite: Anmeldung, App Sperre, Abmelden */
.fuss-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fuss-meldung {
  flex-basis: 100%;
  margin: 0;
  color: var(--text);
}

/* ---------- App Sperre (js/sperre.js) ---------- */

/* Gesperrt: nur der Sperrbildschirm ist zu sehen, der Rest ist weder sichtbar noch per Tastatur erreichbar */
body.gesperrt > :not(.sperre) { display: none !important; }

.sperre {
  display: grid;
  place-items: center;
  min-height: 90vh;
  min-height: 90dvh;
  padding: var(--abstand);
}

.sperre-inhalt {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: 100%;
  max-width: 22rem;
  text-align: center;
}

.sperre-inhalt h1 { margin: 8px 0 0; font-size: 1.375rem; }
.sperre-inhalt p { margin: 0; }
.sperre-symbol { border-radius: 16px; }

.fuss {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--rand);
  color: var(--text-leise);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .kachel { transition: none; }
  .kachel:active { transform: none; }
}

/* =====================================================================
   Bereiche, Listen und Formulare (Haushaltsbuch, später Meilenstand)
   ===================================================================== */

.raster {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (min-width: 800px) {
  .raster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .raster > .breit { grid-column: 1 / -1; }
}

.bereich {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.bereich > p { margin: 0; }

/* Knöpfe in Karten nur so breit wie ihr Text */
.bereich > .knopf { justify-self: start; }

/* In breiten Karten Bezeichnung und Wert nicht über die ganze Breite auseinanderziehen */
.breit .werte { max-width: 36rem; }

.bereich-kopf {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.bereich-summe {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bereich-summe.leise { font-weight: 400; }

.warnhinweis {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-klein);
  background: var(--fehler-weich);
  color: var(--fehler);
}

/* ---------- Liste ---------- */

.liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.liste > li + li { border-top: 1px solid var(--rand); }

.liste-leer {
  padding: 4px 0;
  color: var(--text-leise);
}

.zeile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 10px 4px;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .zeile:hover { background: var(--flaeche-2); }
}

.zeile-text {
  display: grid;
  min-width: 0;
}

.zeile-titel {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.zeile-zusatz {
  font-size: 0.9375rem;
  color: var(--text-leise);
}

.zeile-wert {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

a.zeile { text-decoration: none; }

.zeile > .fortschritt,
.zeile > .zeile-unten,
.zeile > .zeile-notiz { grid-column: 1 / -1; }

.zeile-unten {
  display: grid;
  gap: 6px;
}

.zeile-notiz {
  font-size: 0.9375rem;
  color: var(--text-leise);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.liste-formular { padding: 12px 0; }

.zeilen-formular {
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-klein);
  background: var(--flaeche-2);
}

.zeilen-formular .eingabe { background: var(--flaeche); }

.knopfreihe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.knopfreihe .gefahr { margin-left: auto; }

.knopf.gefahr {
  color: var(--fehler);
  border-color: var(--fehler);
  background: transparent;
}

.knopf.neu { justify-self: start; }

.feld-hinweis {
  font-size: 0.875rem;
  color: var(--text-leise);
}

textarea.eingabe { resize: vertical; }

/* Auswahlfeld mit eigenem Pfeil, in allen Browsern gleich */
.auswahl-huelle {
  position: relative;
  display: block;
}

.auswahl-huelle::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border: solid var(--text-leise);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  pointer-events: none;
}

.auswahl-huelle .eingabe { padding-right: 44px; }

/* ---------- Werte (Name und Betrag untereinander) ---------- */

.werte {
  display: grid;
  gap: 8px;
  margin: 0;
}

.werte > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.werte dt { color: var(--text-leise); }

/* Summen unter einer Liste (Miete): kräftige Linie darüber wie unter einer Rechnung */
.werte.summen {
  padding-top: 12px;
  border-top: 2px solid var(--text);
}

.werte dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Monatsübersicht ---------- */

.uebersicht {
  width: 100%;
  border-collapse: collapse;
}

.uebersicht th,
.uebersicht td {
  padding: 8px 0;
  border-bottom: 1px solid var(--rand);
}

.uebersicht th {
  text-align: left;
  font-weight: 400;
}

.uebersicht td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.uebersicht tfoot th,
.uebersicht tfoot td {
  border-bottom: 0;
  padding-top: 12px;
  font-weight: 700;
  font-size: 1.125rem;
}

.uebersicht .negativ { color: var(--fehler); }

/* ---------- Diagramm: segmentierter Balken ---------- */

.serie-1 { --farbe: var(--serie-1); }
.serie-2 { --farbe: var(--serie-2); }
.serie-3 { --farbe: var(--serie-3); }
.serie-4 { --farbe: var(--serie-4); }

.legende-farbe {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 3px;
  background: var(--farbe, transparent);
  vertical-align: -1px;
}

.diagramm {
  position: relative;
}

.segmente {
  display: flex;
  gap: 2px; /* Lücke in Hintergrundfarbe zwischen den Teilen */
  height: 28px;
}

.segment {
  /* Breite nur aus dem Betrag (flex-grow im HTML), daher kein Innenabstand am Block */
  flex: 1 1 0;
  min-width: 2px;
  display: flex;
  align-items: center;
  padding: 0;
  border-radius: 4px;
  background: var(--farbe);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.segment.serie-4 { color: var(--text-auf-serie-4); }

.segment-text { padding: 0 8px; }

.segment.aktiv { filter: brightness(1.12); }

@media (hover: hover) {
  .segment:hover { filter: brightness(1.12); }
}

.segment:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.diagramm-tooltip {
  /* erscheint über dem Balken und liegt kurz über dem Text darüber */
  position: absolute;
  bottom: calc(100% + 6px);
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.875rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.diagramm-tooltip strong { font-size: 0.9375rem; }

.legende {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 0.9375rem;
}

.legende li {
  display: inline-flex;
  align-items: center;
}

.legende-anteil {
  margin-left: 6px;
  color: var(--text-leise);
}

/* ---------- Fortschrittsbalken ---------- */

.fortschritt {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--akzent-weich);
  overflow: hidden;
}

.fortschritt-balken {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--akzent);
}

.fortschritt.erreicht .fortschritt-balken { background: var(--erfolg-balken); }

@media (forced-colors: active) {
  .segment, .legende-farbe, .fortschritt-balken { forced-color-adjust: none; }
}

/* =====================================================================
   Meilenstand
   ===================================================================== */

/* ---------- Reiter ---------- */

.reiter {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--flaeche-2);
}

.reiter-eintrag {
  flex: 1;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: var(--radius-knopf);
  color: var(--text-leise);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.reiter-eintrag[aria-current="page"] {
  background: var(--flaeche);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--rand);
}

@media (min-width: 800px) {
  .reiter { max-width: 32rem; }
}

/* ---------- Werte ---------- */

.gross-wert {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

.erfolgstext {
  color: var(--erfolg);
  font-weight: 600;
}

.zelle-hinweis {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-leise);
}

.werte dd { text-align: right; }

/* ---------- Programmtabelle ---------- */

.tabelle-huelle {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.programmtabelle {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.programmtabelle th,
.programmtabelle td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--rand);
  text-align: left;
  vertical-align: top;
}

.programmtabelle th:first-child { padding-left: 0; }
.programmtabelle tr > :last-child { padding-right: 0; }

.programmtabelle thead th {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-leise);
  white-space: nowrap;
}

.programmtabelle tbody th { font-weight: 600; }

.programmtabelle tbody th a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--rand);
  text-underline-offset: 3px;
}

.programmtabelle tbody tr:last-child > * { border-bottom: 0; }

.programmtabelle td { font-variant-numeric: tabular-nums; }
.programmtabelle td.nein { color: var(--text-leise); }

@media (max-width: 599px) {
  .programmtabelle { font-size: 0.875rem; }
  .programmtabelle th,
  .programmtabelle td { padding: 10px 5px; }
  .programmtabelle tbody th { width: 34%; }
}

/* Umrechner: alle Ziele auf einen Blick */
.umrechner-alle:not(:empty) {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--rand);
}

/* auf breiten Bildschirmen nicht über die ganze Karte, sonst stehen Name und Ergebnis weit auseinander */
.umrechner-alle > * { max-width: 40rem; }

.umrechner-alle h3 { margin: 0; font-size: 1.0625rem; }

.programmtabelle .rechts { text-align: right; white-space: nowrap; }

.alle-ziele tbody th { width: auto; }

/* Kategorien (Airlines, Hotels, Bonusprogramme): Überschrift mit kräftiger Trennlinie darunter */
.gruppen-titel,
.alle-ziele tr.gruppe th {
  margin: 0;
  padding: 22px 0 8px;
  border-bottom: 2px solid var(--text);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.staende-gruppen > .gruppe:first-child .gruppen-titel,
.alle-ziele tbody:first-of-type tr.gruppe th { padding-top: 6px; }

.staende-gruppen {
  display: grid;
  gap: 14px;
}

/* Umschalter, zum Beispiel für die Sortierung im Reiter Stände (gleiche Optik wie die Reiter) */
.umschalter {
  justify-self: start;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--flaeche-2);
}

.umschalter-knopf {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-knopf);
  background: transparent;
  color: var(--text-leise);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.umschalter-knopf[aria-pressed="true"] {
  background: var(--flaeche);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--rand);
}

@media (hover: hover) {
  .umschalter-knopf[aria-pressed="false"]:hover { color: var(--text); }
}

/* letzte Zeile vor der nächsten Kategorie ohne eigene Linie, die Trennlinie reicht */
.alle-ziele tbody tr:last-child > * { border-bottom: 0; }

.alle-ziele tr.gewaehlt > * { background: var(--akzent-weich); }
.alle-ziele tr.gewaehlt > :first-child { padding-left: 8px; border-radius: var(--radius-klein) 0 0 var(--radius-klein); }
.alle-ziele tr.gewaehlt > :last-child { padding-right: 8px; border-radius: 0 var(--radius-klein) var(--radius-klein) 0; }

/* ---------- Programmformular ---------- */

.quelle-gruppe {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 12px 14px 14px;
  border: 1px solid var(--rand);
  border-radius: var(--radius-klein);
  background: var(--flaeche);
  min-width: 0;
}

.quelle-gruppe legend {
  padding: 0 6px;
  font-weight: 700;
}

.verhaeltnis {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.verhaeltnis .eingabe {
  width: 6.5rem;
  text-align: center;
}

.feld-schalter {
  display: grid;
  gap: 4px;
}

.schalter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}

.schalter-eingabe {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--akzent);
}

/* ---------- Umrechner ---------- */

.umrechner {
  display: grid;
  gap: 20px;
  align-items: start;
}

@media (min-width: 800px) {
  .umrechner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
}

.wahl-gruppe {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.wahl-gruppe legend { padding: 0; margin-bottom: 6px; }

.wahl {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--rand);
  border-radius: var(--radius-klein);
  background: var(--flaeche);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wahl input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--akzent);
}

.wahl:has(input:checked) {
  border-color: var(--akzent);
  background: var(--akzent-weich);
}

.umrechner-ergebnis {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-klein);
  background: var(--flaeche-2);
}

.umrechner-ergebnis p { margin: 0; }

.ergebnis-beschriftung {
  color: var(--text-leise);
  font-size: 0.9375rem;
}

.schritte {
  display: grid;
  gap: 10px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none; /* die Schritte sind im Text nummeriert */
}

.schritte span { display: block; }
.schritt-titel { font-weight: 600; }

.hinweis-box {
  padding: 10px 12px;
  border-radius: var(--radius-klein);
  background: var(--akzent-weich);
}

/* ---------- Liniendiagramm ---------- */

.liniendiagramm {
  position: relative;
  height: 220px;
}

.liniendiagramm svg {
  display: block;
  touch-action: pan-y; /* waagerecht wischen bewegt die Auswahl, senkrecht scrollt die Seite */
  -webkit-tap-highlight-color: transparent;
}

.liniendiagramm svg:focus { outline: none; }
.liniendiagramm svg:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }

.liniendiagramm .diagramm-tooltip {
  bottom: auto;
  top: 0;
}

.ld-raster { stroke: var(--rand); stroke-width: 1; }

.ld-achse {
  fill: var(--text-leise);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ld-linie {
  fill: none;
  stroke: var(--serie-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ld-punkt,
.ld-auswahl {
  fill: var(--serie-1);
  stroke: var(--flaeche);
  stroke-width: 2;
}

.ld-endwert {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.ld-kreuz {
  stroke: var(--text-leise);
  stroke-width: 1;
}
