/* nfsubs – Farben als Variablen, Hell/Dunkel wie nfcaltrack/nftravel:
   System-Voreinstellung, data-theme am <html> überschreibt.
   Grundgerüst aus nfcaltrack übernommen, Akzent Violett. */
:root {
  --bg: #f6f7f9;
  --flaeche: #ffffff;
  --flaeche-2: #eef0f3;
  --text: #16181d;
  --leise: #5d636e;
  --rand: #e1e4e9;
  --akzent: #6d28d9;
  --akzent-text: #ffffff;
  --warn: #ea580c;
  --gefahr: #dc2626;
  --gut: #15803d;
  --ring-grund: #e5e7eb;
  --schatten: 0 1px 2px rgb(0 0 0 / .05), 0 6px 20px rgb(0 0 0 / .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14151b; --flaeche: #1d1f27; --flaeche-2: #262a32; --text: #e9eaee; --leise: #9aa1ad;
    --rand: #2d313a; --akzent: #a78bfa; --akzent-text: #160b2e; --warn: #fb923c; --gefahr: #f87171;
    --gut: #4ade80; --ring-grund: #2d313a;
    --schatten: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14151b; --flaeche: #1d1f27; --flaeche-2: #262a32; --text: #e9eaee; --leise: #9aa1ad;
  --rand: #2d313a; --akzent: #a78bfa; --akzent-text: #160b2e; --warn: #fb923c; --gefahr: #f87171;
  --gut: #4ade80; --ring-grund: #2d313a;
  --schatten: 0 1px 2px rgb(0 0 0 / .4), 0 6px 20px rgb(0 0 0 / .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* iOS-Home-Screen-App mit black-translucent: ist die Seite kürzer als der
   Bildschirm, rechnet Safari die Höhe ohne Statusleiste und die feste
   Tab-Leiste rutscht um diesen Betrag nach oben. Mindesthöhe inkl. Statusleiste
   behebt das. */
html { -webkit-text-size-adjust: 100%; min-height: calc(100% + env(safe-area-inset-top)); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--akzent); }
h2 { font-size: 1.25rem; margin: .2rem 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }

/* --- Kopf --- */
.kopf {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .5rem;
  padding: calc(.45rem + env(safe-area-inset-top)) .75rem .45rem;
  background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.marke { display: flex; align-items: center; gap: .45rem; font-weight: 650; color: var(--text); text-decoration: none; }
.punkt { width: .7rem; height: .7rem; border-radius: 50%; background: var(--akzent); }
.offline-badge { margin-left: auto; font-size: .75rem; background: var(--warn); color: #fff; padding: .1rem .45rem; border-radius: 1rem; }

.inhalt { max-width: 40rem; margin: 0 auto; padding: .75rem 1rem 6rem; }

/* --- Tab-Leiste unten (wie eine App) --- */
:root { --tabs-h: 3.6rem; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--flaeche); border-top: 1px solid var(--rand);
}
.tabs a {
  flex: 1; max-width: 10rem; height: var(--tabs-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  color: var(--leise); text-decoration: none; font-size: .72rem;
  -webkit-tap-highlight-color: transparent;
}
.tabs svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.aktiv { color: var(--akzent); font-weight: 600; }
/* Mit Tab-Leiste: Inhalt, „+“ und Meldungen darüber. */
body:has(.tabs:not([hidden])) { padding-bottom: 0; }
body:has(.tabs:not([hidden])) .inhalt { padding-bottom: calc(var(--tabs-h) + 6rem + env(safe-area-inset-bottom)); }
body:has(.tabs:not([hidden])) .fab { bottom: calc(var(--tabs-h) + 1rem + env(safe-area-inset-bottom)); }
body:has(.tabs:not([hidden])) .toast { bottom: calc(var(--tabs-h) + 5.5rem + env(safe-area-inset-bottom)); }

/* --- Karten und Formulare --- */
.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 1rem;
  padding: 1rem; margin: 0 0 .9rem; box-shadow: var(--schatten);
}
.karte.schmal { max-width: 26rem; margin: 2rem auto; }
.karte.deaktiviert { opacity: .7; }
details.karte > summary { cursor: pointer; list-style: none; }
details.karte > summary::-webkit-details-marker { display: none; }
details.karte > summary h3 { display: inline; }
details.karte > summary::after { content: '+'; float: right; color: var(--leise); font-size: 1.2rem; line-height: 1; }
details.karte[open] > summary::after { content: '−'; }
details.karte[open] > summary { margin-bottom: .6rem; }

.formular { display: flex; flex-direction: column; gap: .7rem; }
.feld { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--leise); }
.feld > span:first-child { font-weight: 550; }
.raster2, .raster3 { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.raster3 { grid-template-columns: 1fr 1fr 1fr; }

input, select, textarea, button, .knopf {
  font: inherit; color: var(--text); border-radius: .65rem;
}
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--rand); background: var(--bg);
  font-size: 16px; /* iOS zoomt sonst beim Fokus */
}
textarea { resize: vertical; min-height: 5rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: -1px; }
button, .knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem .9rem; border: 1px solid var(--rand); background: var(--flaeche-2);
  cursor: pointer; text-decoration: none; font-size: .95rem; min-height: 2.5rem;
}
button:disabled { opacity: .5; cursor: default; }
button.primaer, .knopf.primaer { background: var(--akzent); color: var(--akzent-text); border-color: transparent; font-weight: 600; }
button.gefahr { color: var(--gefahr); }
button.leicht { background: transparent; }
button.breit { width: 100%; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: .5rem; }
.knopfreihe.klein button { padding: .3rem .55rem; min-height: 2rem; font-size: .85rem; }
.chip { padding: .3rem .7rem; min-height: 2rem; border-radius: 1rem; font-size: .85rem; }
.schritte { display: flex; flex-wrap: wrap; gap: .4rem; }
.haken { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; }
.haken input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; flex: none; }
.zeile-form { display: flex; gap: .5rem; }
.zeile-form input { flex: 1; }
.link-feld { font-family: ui-monospace, monospace; font-size: .8rem !important; }

/* Segmentierte Auswahl (Slots, Darstellung) */
.segment { display: flex; background: var(--flaeche-2); border-radius: .7rem; padding: .2rem; gap: .2rem; }
.segment label { flex: 1; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span {
  display: block; text-align: center; padding: .4rem .2rem; border-radius: .5rem; cursor: pointer;
  font-size: .85rem; color: var(--leise);
}
.segment input:checked + span { background: var(--flaeche); color: var(--text); font-weight: 600; box-shadow: var(--schatten); }
.segment input:focus-visible + span { outline: 2px solid var(--akzent); }

.leise { color: var(--leise); }
.klein { font-size: .82rem; }
.mitte { text-align: center; }
.fehlertext { color: var(--gefahr); margin: 0; }
.hinweis { background: var(--flaeche-2); border-left: 3px solid var(--warn); padding: .5rem .7rem; border-radius: .4rem; font-size: .9rem; }
.leer-hinweis { padding: 1rem 0; }
.unsichtbar { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.seitenkopf { display: flex; flex-direction: column; gap: .1rem; margin-bottom: .6rem; }
.zurueck { font-size: .9rem; text-decoration: none; }

/* --- Dialog --- */
.dlg {
  border: 1px solid var(--rand); border-radius: 1rem; padding: 0; background: var(--flaeche); color: var(--text);
  width: min(30rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem);
}
.dlg::backdrop { background: rgb(0 0 0 / .45); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100dvh - 2rem); }
.dlg h3 { padding: 1rem 1rem 0; margin: 0 0 .6rem; }
.dlg-rumpf { padding: 0 1rem; overflow: auto; }
.dlg menu { display: flex; gap: .5rem; justify-content: flex-end; padding: .8rem 1rem; margin: 0; flex-wrap: wrap; }
.dlg menu .gefahr { margin-right: auto; }
.vorschau { font-variant-numeric: tabular-nums; margin: 0; }

/* --- Toast --- */
.toast {
  position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); transform: translate(-50%, 1rem);
  background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: .8rem; opacity: 0;
  transition: opacity .2s, transform .2s; z-index: 50; display: flex; gap: .8rem; align-items: center;
  max-width: calc(100vw - 2rem); margin: 0;
}
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }
.toast.fehler { background: var(--gefahr); color: #fff; }
.toast-aktion { background: transparent; color: inherit; border: 1px solid currentColor; min-height: 0; padding: .2rem .6rem; }


/* ========================================================================
   nfsubs
   ======================================================================== */
.zahl { font-variant-numeric: tabular-nums; }
.seitenkopf.zeilig { flex-direction: row; justify-content: space-between; align-items: center; }
.abschnitt { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 1.2rem .2rem .45rem; font-weight: 600; }

/* --- Kopfzahl auf der Startseite --- */
.held { display: flex; flex-direction: column; gap: .15rem; padding: 1.2rem 1.1rem; }
.held-zahl { font-size: 2.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.held-zahl small { font-size: 1rem; font-weight: 500; color: var(--leise); letter-spacing: 0; }
.held-unter { color: var(--leise); font-size: .9rem; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .6rem; margin: 0 0 .9rem; }
.kachel {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 1rem; padding: .75rem .9rem;
  display: flex; flex-direction: column; gap: .1rem; box-shadow: var(--schatten); color: inherit; text-decoration: none;
}
.kachel-titel { font-size: .82rem; color: var(--leise); font-weight: 550; }
.kachel-zahl { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kachel-unter { font-size: .78rem; color: var(--leise); }

/* --- Listen --- */
.liste { list-style: none; margin: 0; padding: 0; }
.gruppe { background: var(--flaeche); border: 1px solid var(--rand); border-radius: 1rem; overflow: hidden; box-shadow: var(--schatten); margin-bottom: .9rem; }
.zeile { border-bottom: 1px solid var(--rand); }
.zeile:last-child { border-bottom: none; }
.zeile-inhalt { display: flex; align-items: center; gap: .7rem; padding: .65rem .85rem; color: inherit; text-decoration: none; }
a.zeile-inhalt:hover { background: var(--flaeche-2); }
.karte .liste .zeile-inhalt { padding-left: 0; padding-right: 0; }
.zeile-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.zeile-titel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.zeile-unter { font-size: .8rem; color: var(--leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile-rechts { display: flex; flex-direction: column; align-items: flex-end; text-align: right; flex: none; }
.zeile-betrag { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.zeile-rechts .zeile-unter { white-space: nowrap; }
.tag-kopf { padding: .45rem .85rem .25rem; font-size: .78rem; font-weight: 600; color: var(--leise); background: var(--flaeche-2); display: flex; justify-content: space-between; }
.summe-zeile { display: flex; justify-content: space-between; padding: .6rem .85rem; font-size: .9rem; color: var(--leise); }
.summe-zeile strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* Symbol eines Abos: Anfangsbuchstabe auf Farbe, wie ein App-Symbol. */
.symbol {
  width: 2.4rem; height: 2.4rem; border-radius: .7rem; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.05rem;
  background: var(--farbe, #64748b); text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12);
}
.symbol.gross { width: 3.6rem; height: 3.6rem; border-radius: 1rem; font-size: 1.6rem; }
.ausgegraut .symbol { filter: grayscale(.8); opacity: .6; }
.ausgegraut .zeile-titel { color: var(--leise); }

/* Marken für Status und Hinweise */
.marke-klein { display: inline-block; font-size: .7rem; font-weight: 600; padding: .05rem .4rem; border-radius: .4rem; vertical-align: .1em; margin-left: .3rem; background: var(--flaeche-2); color: var(--leise); }
.marke-klein.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.marke-klein.akzent { background: color-mix(in srgb, var(--akzent) 16%, transparent); color: var(--akzent); }
.marke-klein.gefahr { background: color-mix(in srgb, var(--gefahr) 16%, transparent); color: var(--gefahr); }

/* --- Handlungsbedarf --- */
.hinweise .zeile-inhalt { align-items: flex-start; }
.hinweis-icon { width: 2.4rem; height: 2.4rem; border-radius: .7rem; display: grid; place-items: center; flex: none; background: var(--flaeche-2); }
.hinweis-icon svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hinweis-icon.wichtig { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.frist { font-weight: 650; white-space: nowrap; }
.frist.knapp { color: var(--warn); }

/* --- Filter und Suche --- */
.werkzeug { display: flex; flex-direction: column; gap: .55rem; margin-bottom: .8rem; }
.suche { position: relative; }
.suche input { padding-left: 2.2rem !important; }
.suche svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 1.1rem; height: 1.1rem; fill: none; stroke: var(--leise); stroke-width: 2; stroke-linecap: round; }
.filterreihe { display: flex; gap: .5rem; align-items: center; }
.filterreihe .segment { flex: 1; overflow-x: auto; }
.filterreihe select { width: auto; flex: none; padding: .45rem .5rem; font-size: .85rem !important; }

/* --- Detail --- */
.detail-kopf { display: flex; gap: .9rem; align-items: center; margin: .3rem 0 1rem; }
.detail-kopf h2 { margin: 0; }
.detail-preis { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-preis small { font-size: .95rem; font-weight: 500; color: var(--leise); }
.fakten { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; font-size: .93rem; }
.fakten dt { color: var(--leise); }
.fakten dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.notiz { white-space: pre-wrap; margin: 0; }
.aktionen { display: flex; flex-direction: column; gap: .5rem; }
.aktionen button, .aktionen .knopf { justify-content: flex-start; }
.aktionen svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Formular --- */
.takt { display: grid; grid-template-columns: auto 5rem 1fr; gap: .5rem; align-items: center; }
.takt > span { color: var(--leise); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip.an { background: var(--akzent); color: var(--akzent-text); border-color: transparent; }
.farben { display: flex; flex-wrap: wrap; gap: .45rem; }
.farben label { position: relative; }
.farben input { position: absolute; opacity: 0; pointer-events: none; }
.farben span { display: block; width: 2rem; height: 2rem; border-radius: .55rem; cursor: pointer; background: var(--farbe); border: 2px solid transparent; }
.farben span.auto { background: conic-gradient(from 45deg, #e11d48, #ca8a04, #16a34a, #2563eb, #7c3aed, #e11d48); }
.farben input:checked + span { outline: 3px solid var(--text); outline-offset: 2px; }
.farben input:focus-visible + span { outline: 3px solid var(--akzent); outline-offset: 2px; }
.euro-feld { position: relative; }
.euro-feld input { padding-right: 2rem !important; font-variant-numeric: tabular-nums; }
.euro-feld::after { content: '€'; position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); color: var(--leise); }
details.mehr > summary { cursor: pointer; color: var(--akzent); font-weight: 550; padding: .3rem 0; }
details.mehr[open] > summary { margin-bottom: .6rem; }
.formular-fuss { display: flex; gap: .5rem; position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + .5rem); }
.formular-fuss button { flex: 1; }

/* --- Statistik --- */
.balken-liste { display: flex; flex-direction: column; gap: .6rem; }
.balken-zeile { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; font-size: .88rem; }
.balken-zeile .balken { grid-column: 1 / -1; height: .5rem; background: var(--ring-grund); border-radius: 1rem; overflow: hidden; }
.balken-fuell { height: 100%; background: var(--akzent); border-radius: 0 4px 4px 0; }
.balken-wert { font-variant-numeric: tabular-nums; color: var(--leise); }
.saeulen { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; align-items: end; height: 9rem; padding-top: 1.2rem; }
.saeule { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; cursor: default; }
.saeule-fuell { flex: none; width: 70%; max-width: 1.6rem; background: var(--akzent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.saeule:hover .saeule-fuell, .saeule:focus .saeule-fuell { opacity: 1; }
.saeule-wert { margin-bottom: .15rem; font-size: .68rem; color: var(--leise); white-space: nowrap; font-variant-numeric: tabular-nums; }
.saeulen-achse { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; border-top: 1px solid var(--rand); padding-top: .25rem; }
.saeulen-achse span { text-align: center; font-size: .68rem; color: var(--leise); }
.tipp {
  position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--bg);
  padding: .35rem .6rem; border-radius: .5rem; font-size: .8rem; transform: translate(-50%, calc(-100% - .5rem));
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ausgleich { margin: 0; font-size: .95rem; }

/* --- Plus-Knopf --- */
.fab {
  position: fixed; right: max(1.2rem, calc(50vw - 19rem)); bottom: calc(1.2rem + env(safe-area-inset-bottom));
  width: 3.6rem; height: 3.6rem; border-radius: 50%; padding: 0;
  background: var(--akzent); color: var(--akzent-text); border: none; box-shadow: 0 6px 20px rgb(0 0 0 / .25); z-index: 5;
}
.fab svg { width: 1.7rem; height: 1.7rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }

.leer { text-align: center; padding: 2.5rem 1rem; color: var(--leise); }
.leer .symbol { margin: 0 auto .8rem; }

/* Nachschliff */
.hinweise .zeile-titel, .hinweise .zeile-unter { white-space: normal; }
.hinweise .frist { font-size: .85rem; padding-top: .1rem; }
.filterreihe { flex-wrap: wrap; }
.filterreihe .segment { flex: 1 1 100%; }
.filterreihe select { flex: 1; }
.klein-knopf { min-height: 0; padding: .2rem .5rem; border: none; color: var(--leise); background: transparent; }
.kacheln.drei { grid-template-columns: repeat(3, 1fr); }
.kacheln.drei .kachel { padding: .65rem .7rem; }
.kacheln.drei .kachel-zahl { font-size: 1.05rem; }
.balken-unter { grid-column: 1 / -1; font-size: .78rem; color: var(--leise); }
.fakten dt { white-space: nowrap; }

/* Geteilt mit anderen */
.teiler-liste { display: flex; flex-direction: column; gap: .5rem; }
.teiler-liste:empty { display: none; }
.teiler-zeile { display: grid; grid-template-columns: 1fr 7.5rem auto; gap: .5rem; align-items: center; }
.fakten .teiler-summe { border-top: 1px solid var(--rand); padding-top: .45rem; }
