/* EFW Finances – ruhige Flächen, große Zahlen, ein tiefes Grün. Nur aktuelle Browser (ein Nutzer); heller und dunkler Modus. */
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
:root {
  color-scheme: light dark;
  --gruen: #1f5c46; --gruen-hell: #e3efe9; --flaeche: #f5f5f2; --karte: #ffffff; --text: #16201c; --leise: #6b756f; --linie: #e4e6e1;
  --warn: #9a5b00; --warn-hell: #fdf1dc; --rot: #a3261d; --rot-hell: #fbe9e7; --radius: 18px;
  --schatten: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(20 40 30 / 0.06);
  /* Stufen der Geldgeber: ein Grün von hell (unsicher) bis tief (sicher) */
  --s4: #1f5c46; --s3: #4f9479; --s2: #9cc8b5; --s1: #d6e8df; --s0: #e4e6e1;
}
@media (prefers-color-scheme: dark) {
  :root { --gruen: #6fc3a0; --gruen-hell: #17332a; --flaeche: #0f1513; --karte: #18201d; --text: #eef2ef; --leise: #9aa59f; --linie: #27312d;
    --warn: #f0b860; --warn-hell: #33270f; --rot: #f08a80; --rot-hell: #3a1a17; --schatten: none;
    --s4: #6fc3a0; --s3: #3f8a6d; --s2: #2a5c49; --s1: #1f3b31; --s0: #27312d; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--flaeche); color: var(--text); font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--gruen); text-decoration: none; }
h1 { font-size: 15px; font-weight: 600; color: var(--leise); margin: 0 0 6px; letter-spacing: 0.01em; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
p { margin: 0 0 10px; }
.kopf { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 20px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 10px max(20px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--flaeche) 82%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px); border-bottom: 1px solid var(--linie); }
.marke { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.marke img { border-radius: 6px; }
.kopf nav { display: flex; gap: 4px; margin-right: auto; }
.kopf nav a { padding: 6px 12px; border-radius: 999px; color: var(--leise); font-weight: 500; font-size: 15px; }
.kopf nav a.aktiv { background: var(--gruen-hell); color: var(--gruen); }
main { max-width: 980px; margin: 0 auto; padding: 24px max(20px, env(safe-area-inset-right, 0px)) calc(48px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
.karte { background: var(--karte); border-radius: var(--radius); padding: 22px; box-shadow: var(--schatten); margin-bottom: 16px; }
.raster { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin-bottom: 16px; }
.raster .karte { margin: 0; }
.zahl { font-size: clamp(30px, 6vw, 44px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif; }
.zahl.klein { font-size: 26px; }
.zahl.gruen { color: var(--gruen); } .zahl.rot { color: var(--rot); }
.leise { color: var(--leise); font-size: 14px; }
.hinweis { background: var(--warn-hell); color: var(--warn); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; font-size: 15px; }
.hinweis.fehler { background: var(--rot-hell); color: var(--rot); }
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 14px 0; border-top: 1px solid var(--linie); }
.liste li:first-child { border-top: 0; }
.liste .betrag { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.liste .unten { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pille { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--linie); color: var(--leise); }
.pille.heute { background: var(--gruen-hell); color: var(--gruen); } .pille.ab { background: var(--warn-hell); color: var(--warn); } .pille.nicht { background: var(--rot-hell); color: var(--rot); }
.btn { appearance: none; border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 600; background: var(--gruen); color: var(--karte); cursor: pointer; }
.btn.zweit { background: var(--gruen-hell); color: var(--gruen); }
.btn:disabled { opacity: 0.5; cursor: default; }
.link { appearance: none; border: 0; background: none; font: inherit; color: var(--leise); cursor: pointer; padding: 6px; }
.reihe { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.feld { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); font: inherit; font-size: 16px; }
code.adresse { display: block; padding: 12px 14px; border-radius: 12px; background: var(--flaeche); border: 1px solid var(--linie); font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; margin: 10px 0; user-select: all; }
.anmelden { min-height: 80vh; display: grid; place-items: center; text-align: center; }
.anmelden img { border-radius: 22px; box-shadow: var(--schatten); margin-bottom: 18px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--flaeche); padding: 10px 18px; border-radius: 999px; font-size: 15px; font-weight: 500; z-index: 20; max-width: 90vw; }
.toast.fehler { background: var(--rot); color: #fff; }
dl.werte { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; margin: 0; }
dl.werte dt { color: var(--leise); } dl.werte dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
@media (max-width: 560px) { .kopf { gap: 10px; } .marke span { display: none; } .karte { padding: 18px; } }

/* Kopfzeile einer Ansicht: Jahres-Segmente links, Hauptknopf rechts */
.kopfzeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.segmente { display: inline-flex; background: var(--linie); border-radius: 12px; padding: 3px; }
.segmente a { padding: 7px 16px; border-radius: 9px; color: var(--leise); font-weight: 500; font-variant-numeric: tabular-nums; }
.segmente a.aktiv { background: var(--karte); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); }
.karte-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; }
.raster.drei { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 18px; }

/* Deckungsbalken und Legenden */
.balken { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--s0); }
.balken span { min-width: 3px; }
.s4 { background: var(--s4); } .s3 { background: var(--s3); } .s2 { background: var(--s2); } .s1 { background: var(--s1); } .s0 { background: var(--s0); }
.legende { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--leise); margin-top: 10px; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.legende i.block { width: 10px; height: 10px; border-radius: 3px; }
i.strich { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--gruen); }
i.strich.erwartet { border-top-style: dashed; } i.strich.optimistisch { border-top: 2px dotted var(--leise); }

/* Geldgeber-Tabelle */
.tabelle-karte { padding: 8px 0; overflow-x: auto; }
table.gg { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.gg th, table.gg td { padding: 6px 10px; text-align: left; vertical-align: middle; border-top: 1px solid var(--linie); }
table.gg th:first-child, table.gg td:first-child { padding-left: 22px; } table.gg th:last-child, table.gg td:last-child { padding-right: 22px; }
table.gg thead th { border-top: 0; font-size: 13px; color: var(--leise); font-weight: 500; }
table.gg tr.gruppe th { padding-top: 22px; font-size: 15px; font-weight: 600; border-top: 0; }
table.gg tfoot th { font-weight: 600; padding-top: 14px; padding-bottom: 14px; border-top: 2px solid var(--linie); }
.zahl-z { text-align: right !important; white-space: nowrap; }
td.name { width: 40%; } td.name .klein { display: block; font-size: 12px; }
.link-name { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.link-name:hover { color: var(--gruen); }
.feld.klein-feld { padding: 7px 10px; border-radius: 9px; font-size: 15px; background: transparent; border-color: transparent; }
.feld.klein-feld:hover, .feld.klein-feld:focus { border-color: var(--linie); background: var(--flaeche); }
input.klein-feld { width: 9.5em; text-align: right; }
select.klein-feld { width: auto; padding-right: 4px; }
.stufe-punkt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 2px; vertical-align: middle; }
tr.aus td:not(.schalter-z) { opacity: 0.42; } tr.aus input[data-betrag] { text-decoration: line-through; }
tr.abgesagt input[data-betrag] { text-decoration: line-through; color: var(--leise); }
.schalter-z { text-align: center !important; width: 70px; }
.schalter { position: relative; display: inline-block; width: 42px; height: 26px; flex: none; }
.schalter input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.schalter span { position: absolute; inset: 0; border-radius: 999px; background: var(--linie); transition: background 0.15s; }
.schalter span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); transition: transform 0.15s; }
.schalter input:checked + span { background: var(--gruen); } .schalter input:checked + span::after { transform: translateX(16px); }
.schalter input:focus-visible + span { outline: 2px solid var(--gruen); outline-offset: 2px; }

/* Kontokurve */
.kurve { position: relative; margin: 8px 0 12px; min-width: 0; overflow: hidden; }
.kurve svg { display: block; touch-action: pan-y; }
.kurve .gitter { stroke: var(--linie); stroke-width: 1; } .kurve .gitter.null { stroke: var(--leise); stroke-opacity: 0.5; }
.kurve .achse { fill: var(--leise); font-size: 11px; } .kurve .achse.mitte { text-anchor: middle; } .kurve .achse.markiert { fill: var(--text); font-weight: 500; }
.kurve .linie { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.kurve .linie.sicher { stroke: var(--gruen); } .kurve .linie.erwartet { stroke: var(--gruen); stroke-dasharray: 6 4; stroke-opacity: 0.75; } .kurve .linie.optimistisch { stroke: var(--leise); stroke-dasharray: 2 4; }
.kurve .flaeche { fill: var(--gruen); fill-opacity: 0.07; }
.kurve .punkt { fill: var(--gruen); stroke: var(--karte); stroke-width: 2; }
.kurve .kreuz { stroke: var(--leise); stroke-width: 1; }
.kurve .kreuz[hidden], .tipp[hidden] { display: none; }
.tipp { position: absolute; top: 8px; background: var(--karte); border: 1px solid var(--linie); box-shadow: var(--schatten); border-radius: 12px; padding: 10px 12px; font-size: 13px; pointer-events: none; display: grid; gap: 4px; min-width: 190px; }
.tipp span { display: flex; align-items: center; gap: 6px; color: var(--leise); } .tipp em { margin-left: auto; font-style: normal; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Budget */
table.bu tr.e1 td.name { padding-left: 22px; } table.bu tr.e2 td.name { padding-left: 52px; } table.bu tr.e3 td.name { padding-left: 76px; }
table.bu tr.e2 td, table.bu tr.e3 td { font-size: 15px; }
table.bu tr.e1.hat-kinder td.name .link-name { font-weight: 500; }
table.bu tr[hidden] { display: none; }
.auf { appearance: none; border: 0; background: none; font: inherit; font-size: 18px; line-height: 1; width: 22px; margin-left: -24px; color: var(--leise); cursor: pointer; transition: transform 0.15s; display: inline-block; }
.auf.offen { transform: rotate(90deg); }
table.bu tr.e1 td.name:has(.auf) { padding-left: 22px; }
.fuss { padding: 8px 22px 6px; margin: 0; }
.link.klein { font-size: 14px; color: var(--gruen); padding: 0 0 0 6px; }
.warn-text { color: var(--warn) !important; } .rot-text { color: var(--rot); } .gruen-text { color: var(--gruen); }
.zahl.klein.rot { color: var(--rot); } .zahl.klein.gruen { color: var(--gruen); }
table.mini { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
table.mini th { font-size: 13px; color: var(--leise); font-weight: 500; text-align: left; padding: 6px 0; }
table.mini td { padding: 7px 0; border-top: 1px solid var(--linie); }
.hbalken { display: grid; gap: 9px; margin-top: 6px; }
.hb-zeile { display: grid; grid-template-columns: minmax(120px, 30%) 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-spur { display: grid; gap: 2px; }
.hb { display: block; height: 10px; border-radius: 0 4px 4px 0; min-width: 2px; } .hb.vor { height: 5px; }
.hb-wert { font-variant-numeric: tabular-nums; font-weight: 500; min-width: 84px; text-align: right; }
.btn.gefahr { background: var(--rot-hell); color: var(--rot); }

/* Blatt */
.overlay { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.32); display: grid; place-items: center; padding: 20px; }
.sheet { background: var(--karte); border-radius: 22px; width: min(520px, 100%); max-height: 90dvh; overflow: auto; box-shadow: 0 20px 60px rgb(0 0 0 / 0.25); }
.sheet-kopf { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 4px 22px; position: sticky; top: 0; background: var(--karte); }
.sheet-kopf h2 { margin: 0; } .sheet-inhalt { padding: 10px 22px 22px; }
body.gesperrt { overflow: hidden; }
.formular { display: grid; gap: 14px; }
.formular label { display: grid; gap: 6px; font-size: 14px; color: var(--leise); font-weight: 500; }
.formular .zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.formular .btn { margin-top: 4px; }
.zeile-schalter { display: flex !important; justify-content: space-between; align-items: center; color: var(--text) !important; font-size: 16px !important; }
.liste.kompakt li { padding: 8px 0; }
textarea.feld { resize: vertical; }

@media (max-width: 680px) {
  /* Am Handy: jede Zeile zweistufig – Name oben, darunter Betrag, Stufe und Schalter */
  .vj, table.gg thead { display: none; }
  table.gg, table.gg tbody, table.gg tfoot { display: block; }
  table.gg tr { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 6px; padding: 8px 14px 8px 16px; border-top: 1px solid var(--linie); }
  table.gg th, table.gg td { padding: 0 !important; border: 0 !important; }
  table.gg tr[data-id] td.name { grid-column: 1 / -1; width: auto; padding: 2px 0 2px 10px !important; }
  table.gg tr.gruppe { grid-template-columns: 1fr auto auto; border-top: 0; padding-top: 20px; } table.gg tr.gruppe th { padding: 0 !important; } table.gg tr.gruppe [data-anzahl] { padding-left: 10px !important; }
  table.gg tfoot tr { grid-template-columns: 1fr auto; border-top: 2px solid var(--linie); padding: 14px 16px; } table.gg tfoot th[colspan] { display: none; }
  input.klein-feld { width: 7.5em; text-align: left; } select.klein-feld { width: 100%; }
  table.gg:not(.bu) td:nth-child(4) { display: flex; align-items: center; min-width: 0; }
  table.bu input.klein-feld { text-align: right; width: 7em; } .hbalken { gap: 6px; } .hb-zeile { row-gap: 3px; }
  .schalter-z { width: auto; }
  .marke span, #abmelden { display: none; }
  table.bu tr { grid-template-columns: 1fr auto; } table.bu td.name, table.bu th.name { grid-column: auto !important; }
  table.bu tr.e1 td.name { padding-left: 0 !important; } table.bu tr.e2 td.name { padding-left: 18px !important; } table.bu tr.e3 td.name { padding-left: 32px !important; }
  .auf { margin-left: 0; }
  .hb-zeile { grid-template-columns: 1fr auto; } .hb-spur { grid-column: 1 / -1; grid-row: 2; }
  .overlay { place-items: end center; padding: 0; } .sheet { border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .formular .zwei { grid-template-columns: 1fr; }
  .kopf nav a { padding: 6px 9px; }
}

/* Das Attribut hidden muss immer gewinnen – sonst zeigt eine Regel wie .kopf { display: flex } Verstecktes doch an (Menü vor der Anmeldung). */
[hidden] { display: none !important; }
