:root {
  --petrol: #0F3D4A;
  --petrol-soft: #E3ECEE;
  --bg: #F4F5F2;
  --card: #FFFFFF;
  --ink: #14232A;
  --mute: #4A5560;
  --line: #D9DFDC;
  --field: #B4BFBB;
  --orange: #E2702A;
  --red: #B3261E;
  --red-bg: #FCEBE8;
  --amber: #7F4C00;
  --amber-bg: #FDF0D8;
  --green: #17703F;
  --green-bg: #E2F2E8;
  --grey: #56636A;
  --grey-bg: #ECEFEE;
  --r: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 560px; margin: 0 auto; padding: 0 16px calc(116px + env(safe-area-inset-bottom)); }
h1 { font-size: 27px; line-height: 1.2; margin: 10px 0 6px; letter-spacing: -0.4px; }
h2 { font-size: 19px; line-height: 1.3; margin: 28px 0 10px; }
p { margin: 0 0 12px; }
a { color: var(--petrol); }
.mute { color: var(--mute); }
svg.i { width: 24px; height: 24px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Kopfzeile */
.top { display: flex; align-items: center; gap: 10px; min-height: 64px; padding-top: env(safe-area-inset-top); }
.brand { font-weight: 800; font-size: 21px; color: var(--petrol); letter-spacing: -0.3px; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 48px; padding: 0 14px 0 0; margin-left: -4px; background: none; border: 0; color: var(--petrol); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }

/* Listenzeilen */
.row { display: flex; align-items: center; gap: 14px; min-height: 74px; padding: 12px 14px; margin: 10px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: inherit; text-decoration: none; }
.row:active { background: #F3F6F5; }
.row .main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row .t { font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { color: var(--mute); font-size: 15px; }
.row .amt { font-weight: 700; white-space: nowrap; }
.kicon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--grey-bg); color: var(--grey); }
.kicon.rot { background: var(--red-bg); color: var(--red); }
.kicon.gelb { background: var(--amber-bg); color: var(--amber); }
.kicon.gruen { background: var(--green-bg); color: var(--green); }
.pill { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; background: var(--grey-bg); color: var(--grey); }
.pill.rot { background: var(--red-bg); color: var(--red); }
.pill.gelb { background: var(--amber-bg); color: var(--amber); }
.pill.gruen { background: var(--green-bg); color: var(--green); }
.clip svg.i { width: 15px; height: 15px; vertical-align: -2px; color: var(--mute); }

/* Knöpfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 0 20px; border-radius: 14px; border: 1.5px solid var(--petrol); background: var(--card); color: var(--petrol); font: inherit; font-weight: 650; text-align: center; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--petrol); color: #fff; }
.btn.block { display: flex; width: 100%; }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 15px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.quiet { border-color: var(--line); color: var(--ink); }
.btn.redtext { border-color: var(--line); color: var(--red); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btns { display: grid; gap: 10px; margin: 16px 0; }
.btns.two { grid-template-columns: 1fr 1fr; }

/* Große Auswahlkarten */
.big { display: flex; align-items: center; gap: 16px; width: 100%; min-height: 86px; padding: 16px 18px; margin: 12px 0; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.big svg.i { width: 30px; height: 30px; color: var(--petrol); }
.big b { display: block; font-size: 18px; }
.big small { display: block; color: var(--mute); font-size: 15px; }
.big.main { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.big.main svg.i { color: #fff; }
.big.main small { color: #D3E2E6; }

/* Hinweise */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 12px 0; border-radius: var(--r); background: var(--petrol-soft); font-size: 16px; }
.notice.ok { background: var(--green-bg); }
.notice.ok svg.i { color: var(--green); }
.notice.warn { background: var(--amber-bg); }
.notice > div { flex: 1; }
.hint { padding: 14px 16px; margin: 12px 0; border-radius: var(--r); background: var(--amber-bg); }
.hint.info { background: var(--petrol-soft); }
.hint p { margin: 0 0 10px; }
.hint small { display: block; margin: -4px 0 10px; color: var(--mute); font-size: 15px; }
.hint-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.note { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0; color: var(--mute); font-size: 15px; }
.note svg.i { width: 20px; height: 20px; margin-top: 1px; color: var(--green); }
.okline { display: flex; gap: 8px; align-items: center; color: var(--green); font-size: 15px; font-weight: 600; margin: 8px 0 0; }
.okline svg.i { width: 18px; height: 18px; }
.sub { color: var(--mute); font-size: 15px; margin: 6px 0 0; text-align: center; }

/* Frist-Block */
.due { padding: 18px; margin: 14px 0; border-radius: var(--r); background: var(--grey-bg); }
.due.rot { background: var(--red-bg); }
.due.gelb { background: var(--amber-bg); }
.due.gruen { background: var(--green-bg); }
.due .lbl { display: block; color: var(--mute); font-size: 15px; font-weight: 650; margin: 0; }
.due b { display: block; font-size: 24px; line-height: 1.25; margin: 2px 0 10px; }
.due .pill { background: #fff; }
.kchip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--petrol-soft); color: var(--petrol); font-size: 14px; font-weight: 650; }

/* Angaben */
dl.facts { margin: 14px 0; padding: 2px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
dl.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
dl.facts div:last-child { border-bottom: 0; }
dl.facts dt { color: var(--mute); }
dl.facts dd { margin: 0; font-weight: 650; text-align: right; overflow-wrap: anywhere; }

/* Formular */
.fld { display: block; margin: 14px 0; }
.lbl { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-bottom: 6px; font-weight: 650; font-size: 15px; }
input, select, textarea { width: 100%; min-height: 54px; padding: 12px 14px; border: 1.5px solid var(--field); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
textarea { min-height: 100px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15, 61, 74, 0.22); border-color: var(--petrol); }
.fld small { display: block; margin-top: 6px; color: var(--mute); font-size: 14px; }
.tag { padding: 1px 8px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-size: 12px; font-weight: 700; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 6px; }
.seg button { min-height: 52px; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 16px; font-weight: 650; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--petrol); border-color: var(--petrol); color: #fff; }
.calc { padding: 14px 16px; margin: 16px 0; border-radius: var(--r); background: var(--petrol-soft); font-size: 16px; }
.thumb { display: block; max-width: 100%; max-height: 190px; margin: 8px 0; border: 1px solid var(--line); border-radius: 12px; }
.filechip { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin: 8px 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; }
.radio { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 14px; margin: 8px 0; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio input { width: 22px; height: 22px; min-height: 0; margin: 0; padding: 0; accent-color: var(--petrol); }

/* Suche & Filter */
.search { margin: 10px 0 6px; }
.chips { display: flex; gap: 8px; margin: 0 -16px; padding: 6px 16px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--petrol); border-color: var(--petrol); color: #fff; }

/* Kosten */
.card { margin: 14px 0; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.bignum { font-size: 40px; font-weight: 800; line-height: 1.1; letter-spacing: -1px; color: var(--petrol); }
.bar { margin: 14px 0; }
.bar .l { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 15px; }
.bar .l b { white-space: nowrap; }
.bar .track { height: 12px; border-radius: 6px; background: var(--grey-bg); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 6px; background: var(--petrol); }

/* Briefvorschau */
.paper { margin: 14px 0; padding: 22px 20px; background: #fff; border: 1px solid var(--line); border-radius: 6px; color: #111; font-family: Helvetica, Arial, sans-serif; font-size: 13.5px; line-height: 1.5; }
.paper .snd { margin-bottom: 18px; color: #444; font-size: 11.5px; }
.paper .rcp { margin-bottom: 18px; white-space: pre-line; }
.paper .dt { margin-bottom: 14px; text-align: left; }
.paper .su { margin-bottom: 12px; font-weight: 700; }
.paper p { margin: 0 0 10px; }
.paper .miss { color: var(--red); }

/* Navigation */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; max-width: 560px; margin: 0 auto; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--line); }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; color: var(--mute); font-size: 13px; font-weight: 650; text-decoration: none; }
.nav a[aria-current="page"] { color: var(--petrol); }
.nav a.fab { justify-self: center; width: 66px; height: 66px; min-height: 66px; margin-top: -28px; border-radius: 50%; background: var(--orange); color: #fff; box-shadow: 0 6px 16px rgba(226, 112, 42, 0.35); }
.nav a.fab svg.i { width: 32px; height: 32px; stroke-width: 2.6; }

/* Dialog */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(10, 25, 30, 0.45); }
.modal { width: 100%; max-width: 560px; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); background: #fff; border-radius: 22px 22px 0 0; }
.modal h2 { margin-top: 0; }
.row-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

/* Meldung */
#toast { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 50; max-width: min(520px, calc(100% - 32px)); padding: 14px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 16px; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity 0.25s, transform 0.25s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Laden */
.busy { padding: 72px 8px 0; text-align: center; }
.spin { width: 58px; height: 58px; margin: 0 auto 24px; border: 5px solid var(--petrol-soft); border-top-color: var(--petrol); border-radius: 50%; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Start leer */
.hero { padding: 6px 0 2px; }
.hero h1 { font-size: 31px; }
.steps { margin: 24px 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { position: relative; margin: 14px 0; padding-left: 48px; min-height: 36px; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--petrol-soft); color: var(--petrol); font-weight: 800; }
.empty { padding: 28px 0; color: var(--mute); text-align: center; }
.docimg { display: block; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.legal { font-size: 16px; }
.legal h2 { font-size: 17px; }
.ph { padding: 0 4px; border-radius: 4px; background: var(--amber-bg); }
.ver { color: var(--mute); font-size: 15px; text-align: center; margin: 24px 0; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Version 1.1: Rechnungen, Mahnung, Guthaben, Erledigt */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--red); color: #fff; font-size: 13px; font-weight: 700; line-height: 1.5; vertical-align: 2px; }
.seg button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pill svg.i { width: 15px; height: 15px; vertical-align: -2px; }
.due b svg.i { width: 26px; height: 26px; vertical-align: -5px; color: var(--green); }
.calc .okline { margin: 0 0 4px; }
.celebrate { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none; background: rgba(244, 245, 242, 0.55); animation: cel-bg 1.7s ease forwards; }
.cel-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 36px; background: #fff; border-radius: 22px; box-shadow: 0 12px 32px rgba(15, 61, 74, 0.18); color: var(--green); font-size: 20px; animation: cel-pop 1.7s ease forwards; }
.cel-box svg { width: 78px; height: 78px; }
.cel-box circle { fill: var(--green-bg); stroke: var(--green); stroke-width: 2.5; }
.cel-box path { fill: none; stroke: var(--green); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: cel-draw 0.45s 0.15s ease forwards; }
@keyframes cel-pop { 0% { transform: scale(0.7); opacity: 0; } 14% { transform: scale(1.04); opacity: 1; } 24% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cel-draw { to { stroke-dashoffset: 0; } }
@keyframes cel-bg { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cel-box path { stroke-dashoffset: 0; } }

/* Version 1.1.1: erkannten Text anzeigen */
details.raw { margin: 8px 0 4px; }
details.raw summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--petrol); font-size: 15px; font-weight: 650; cursor: pointer; }
details.raw pre { max-height: 260px; overflow: auto; margin: 4px 0 10px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }

/* Version 1.1.4 */
.row .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
textarea.ta2 { min-height: 80px; }
.modal { max-height: 92vh; overflow-y: auto; }

/* Version 1.1.5: Erinnerungs-Auswahl */
button.radio.opt { width: 100%; text-align: left; font: inherit; color: var(--ink); }
button.radio.opt small { display: block; color: var(--mute); font-size: 15px; font-weight: 500; }
button.radio.opt .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }
button.radio.opt[aria-pressed="true"] { border-color: var(--petrol); box-shadow: 0 0 0 1px var(--petrol) inset; }
button.radio.opt[aria-pressed="true"] .dot { border-color: var(--petrol); background: radial-gradient(circle, var(--petrol) 0 45%, #fff 50%); }
.modal .notice { margin: 12px 0; }

/* Startseite: schnell erfassen */
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 6px; }
.quick label, .quick button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 10px 6px; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); color: inherit; font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; }
.quick svg.i { width: 26px; height: 26px; color: var(--petrol); }
/* Dezente Erinnerung an die Sicherung */
.bline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 22px 0 8px; padding: 10px 2px; border-top: 1px solid var(--line); color: var(--mute); font-size: 15px; }
.bline svg.i { width: 18px; height: 18px; color: var(--mute); }
.bline .link { padding: 6px 0; background: none; border: 0; color: var(--petrol); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.bline .link.quiet { color: var(--mute); font-weight: 400; }

/* Startseite: Abschnitt Fristen unter den Erfassen-Knöpfen */
h2.sec { margin-top: 30px; font-size: 26px; }
h2.sec + p.mute { margin-top: 2px; }

/* Mehr: Datenschutz und Impressum dezent als Textlinks; Knopf-Zeile wie Link-Zeile */
.ver a { color: var(--mute); text-decoration: underline; }
button.row { width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }

/* Unterlagen anhängen: Häkchen + Stift zum Umbenennen */
.anh { display: flex; align-items: center; gap: 8px; }
.anh .radio { flex: 1; min-width: 0; }
.anh-name { flex: none; width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; color: var(--petrol); cursor: pointer; }
.anh-name svg.i { width: 22px; height: 22px; }
.notice.versand svg.i { flex: none; width: 22px; height: 22px; margin-top: 2px; }
.mailadr { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; margin: 10px 0; border: 1px solid var(--line, #dde3e5); border-radius: var(--r); font-size: 15px; }
.mailadr b { word-break: break-all; }
.mailadr .btn { flex: none; }
.instbar { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin: 4px 0 14px; border-radius: var(--r); background: var(--petrol-soft); font-size: 16px; }
.instbar .kicon { background: #fff; color: var(--petrol, #0F3D4A); }
.instbar > div { flex: 1; }
.instbar .hint-btns { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
