/* Finanzplaner 6.0 – Babyblau-Design, Plus grün / Minus rot, für Handy zuerst gebaut */
:root {
  --bg: #DCEEFB; --bg2: #EAF4FC; --card: #FFFFFF; --soft: #F2F8FE; --line: #E3EEF8; --line2: #BFDDF5;
  --ink: #0F2A44; --ink2: #33506E; --muted: #4A6683; --faint: #6B7F95;
  --blue: #1E5A8A; --blue2: #3B82C4; --navy: #123E63; --sky: #9CC7EC; --chip: #DDEEFB;
  --green: #15803D; --green-bg: #E2F4E7; --green-bar: #34A853;
  --red: #C62828; --red-bg: #FBE4E3; --red-bar: #E5534B;
  --amber: #B45309; --amber-bg: #FDF0DF; --amber-bar: #E39A3B;
  --violet: #6D4BC2; --violet-bg: #F6F2FD; --violet-bar: #8B6AD6;
  --orange: #C2570C; --orange-on-dark: #FB923C;
  --shadow: 0 2px 10px rgba(30, 90, 138, .07); --shadow-strong: 0 8px 28px rgba(18, 62, 99, .22);
  --radius: 20px; --nav-h: 68px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: Nunito, "Segoe UI Rounded", ui-rounded, "SF Pro Rounded", Inter, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1C2E; --bg2: #10263C; --card: #132C45; --soft: #17344F; --line: #1F3E5C; --line2: #2A5276;
    --ink: #E6F1FB; --ink2: #C4D8EC; --muted: #9DB7D1; --faint: #86A1BC;
    --blue: #7CB8EC; --blue2: #7CB8EC; --navy: #0E2A45; --sky: #3D6A92; --chip: #1C3D5C;
    --green: #4ADE80; --green-bg: #12382A; --green-bar: #34C46A; --red: #FF8A80; --red-bg: #3D1D22; --red-bar: #F0625A;
    --amber: #FBBF5B; --amber-bg: #3A2A12; --amber-bar: #E8A64B; --violet: #C4B1FF; --violet-bg: #251F45; --violet-bar: #9F86F0;
    --orange: #FB923C; --shadow: 0 2px 10px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1C2E; --bg2: #10263C; --card: #132C45; --soft: #17344F; --line: #1F3E5C; --line2: #2A5276;
  --ink: #E6F1FB; --ink2: #C4D8EC; --muted: #9DB7D1; --faint: #86A1BC;
  --blue: #7CB8EC; --blue2: #7CB8EC; --navy: #0E2A45; --sky: #3D6A92; --chip: #1C3D5C;
  --green: #4ADE80; --green-bg: #12382A; --green-bar: #34C46A; --red: #FF8A80; --red-bg: #3D1D22; --red-bar: #F0625A;
  --amber: #FBBF5B; --amber-bg: #3A2A12; --amber-bar: #E8A64B; --violet: #C4B1FF; --violet-bg: #251F45; --violet-bar: #9F86F0;
  --orange: #FB923C; --shadow: 0 2px 10px rgba(0, 0, 0, .35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--blue); }
h1, h2, h3 { color: var(--navy); margin: 0; line-height: 1.2; }
:root[data-theme="dark"] h1, :root[data-theme="dark"] h2, :root[data-theme="dark"] h3 { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) h1, :root:not([data-theme="light"]) h2, :root:not([data-theme="light"]) h3 { color: var(--ink); } }
h1 { font-family: var(--font-head); font-weight: 800; font-size: 28px; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue2); outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pos { color: var(--green); } .neg { color: var(--red); } .neu { color: var(--muted); } .warn { color: var(--amber); } .vio { color: var(--violet); }
.b { font-weight: 700; } .muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; } .center { text-align: center; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb { margin-bottom: 12px; }
.grow { flex: 1; min-width: 0; } .row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; } .stack-s { display: flex; flex-direction: column; gap: 10px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Grundlayout */
.app { display: flex; gap: 20px; max-width: 1380px; margin: 0 auto; padding: 20px; align-items: flex-start; }
.side { position: sticky; top: 20px; flex: 0 0 248px; background: var(--card); border-radius: var(--radius); padding: 20px 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 40px); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; }
.brand-name { font-family: var(--font-head); font-weight: 800; font-size: 19px; color: var(--blue); white-space: nowrap; }
.six { color: var(--orange); }
.side a.nav { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; border-radius: 12px; color: var(--ink2);
  text-decoration: none; font-weight: 500; }
.side a.nav:hover { background: var(--soft); }
.side a.nav.active { background: var(--chip); color: var(--navy); font-weight: 700; }
:root[data-theme="dark"] .side a.nav.active { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .side a.nav.active { color: var(--ink); } }
.side .nav-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.side .badge { margin-left: auto; }
main.content { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; padding-bottom: 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topbar .date { color: var(--muted); font-size: 14px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--card); color: var(--blue); display: inline-flex;
  align-items: center; justify-content: center; position: relative; box-shadow: var(--shadow); flex-shrink: 0; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red-bar);
  color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.footer { text-align: center; color: var(--faint); font-size: 12.5px; padding: 18px 0 8px; line-height: 1.6; }
.footer strong { color: var(--blue); }

/* Handy: untere Leiste mit großem Plus */
.bottom-nav { display: none; }
@media (max-width: 899px) {
  .app { display: block; padding: 14px 14px calc(var(--nav-h) + 34px + env(safe-area-inset-bottom)); }
  .side { display: none; }
  h1 { font-size: 24px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding: 0 6px env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(18, 62, 99, .08);
    align-items: stretch; justify-content: space-around; }
  .bottom-nav a, .bottom-nav button.more { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-size: 11.5px; font-weight: 600; color: var(--muted); text-decoration: none; border: 0; background: transparent; min-width: 0; position: relative; }
  .bottom-nav a.active { color: var(--blue); }
  .bottom-nav .fab-slot { flex: 0 0 76px; position: relative; }
  .fab { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--bg);
    background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(30, 90, 138, .4); }
  :root[data-theme="dark"] .fab { background: #2F7AC0; }
  .bottom-nav .badge { position: absolute; top: 6px; left: calc(50% + 6px); }
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fab { background: #2F7AC0; } }

/* ---------- Karten & Kennzahlen */
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card.tight { padding: 14px 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 4px; }
.card-head a, .link-btn { font-size: 14px; color: var(--blue); background: none; border: 0; padding: 10px 4px; margin: -10px -4px; font-weight: 600; text-decoration: none; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.kpi { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.kpi .lab { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 14px; gap: 6px; min-height: 26px; }
.kpi .val { font-size: 28px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.3px; overflow-wrap: anywhere; }
.kpi .hint { font-size: 13px; color: var(--muted); }
.kpi.hero { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(30, 90, 138, .28); }
:root[data-theme="dark"] .kpi.hero { background: #1D4E7A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kpi.hero { background: #1D4E7A; } }
.kpi.hero .lab, .kpi.hero .hint { color: #D3E8FA; }
.kpi.focus { border: 2px solid var(--sky); }
.minis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); }
.mini { background: var(--card); border-radius: 18px; padding: 13px 14px; display: flex; gap: 11px; align-items: center; box-shadow: var(--shadow); min-width: 0; }
.mini .ic { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px; }
.mini .l { font-size: 12.5px; color: var(--muted); } .mini .v { font-size: 17px; font-weight: 700; white-space: nowrap; }
.ic.vio { background: var(--violet-bg); } .ic.amb { background: var(--amber-bg); } .ic.blu { background: var(--chip); } .ic.grn { background: var(--green-bg); } .ic.red { background: var(--red-bg); }
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis .kpi { padding: 13px 14px; }
  .kpis .kpi .val { font-size: 21px; }
  .kpis .kpi.wide { grid-column: 1 / -1; }
  .kpis .kpi.wide .val { font-size: 30px; }
  .minis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 16px; }
}

/* ---------- Knöpfe, Chips, Hilfe */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 14px;
  border: 1.5px solid var(--line2); background: var(--card); color: var(--navy); font-weight: 700; font-size: 15.5px; text-decoration: none; }
:root[data-theme="dark"] .btn { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn { color: var(--ink); } }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(30, 90, 138, .25); }
:root[data-theme="dark"] .btn.primary { background: #2F7AC0; border-color: #2F7AC0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: #2F7AC0; border-color: #2F7AC0; } }
.btn.big { min-height: 54px; font-size: 17px; border-radius: 16px; padding: 12px 22px; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn.danger { background: var(--red-bg); border-color: var(--red-bg); color: var(--red); }
.btn.green { background: var(--green-bar); border-color: var(--green-bar); color: #fff; }
.btn.small { min-height: 40px; padding: 6px 13px; font-size: 14px; border-radius: 12px; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; }
.btns > .btn { flex: 1 1 auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; border: 1.5px solid var(--line2); background: var(--soft); color: var(--navy); border-radius: 999px; min-height: 44px; padding: 8px 16px;
  font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
:root[data-theme="dark"] .chip { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip { color: var(--ink); } }
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.add { border-style: dashed; background: transparent; color: var(--blue2); font-weight: 700; }
.chip .amt { font-weight: 500; opacity: .85; }
.quickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.qbtn { border: 1.5px solid var(--line2); background: var(--soft); border-radius: 16px; min-height: 64px; padding: 8px 10px; font-weight: 700; font-size: 15px;
  color: var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; line-height: 1.2; }
:root[data-theme="dark"] .qbtn { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qbtn { color: var(--ink); } }
.qbtn span { font-weight: 500; font-size: 13px; color: var(--muted); }
.qbtn.add { border-style: dashed; background: transparent; color: var(--blue2); font-size: 22px; }
.help { width: 44px; height: 44px; margin: -9px; padding: 0; border: 0; background: transparent; display: inline-flex; align-items: center;
  justify-content: center; flex-shrink: 0; vertical-align: middle; }
.help i { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--sky); background: var(--card); color: var(--blue); font-style: normal;
  font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.kpi.hero .help i { background: transparent; border-color: #9CC7EC; color: #fff; }
.help[aria-expanded="true"] i { background: var(--blue); border-color: var(--blue); color: #fff; }
.popover { position: fixed; z-index: 90; max-width: min(340px, calc(100vw - 24px)); background: var(--navy); color: #fff; border-radius: 14px; padding: 12px 14px;
  font-size: 14px; line-height: 1.5; box-shadow: var(--shadow-strong); }
:root[data-theme="dark"] .popover { background: #2A5276; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .popover { background: #2A5276; } }
.popover b { display: block; margin-bottom: 4px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--red-bar); color: #fff; font-size: 11.5px; font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 4px; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; background: var(--chip); color: var(--blue); white-space: nowrap; }
.tag.grn { background: var(--green-bg); color: var(--green); } .tag.red { background: var(--red-bg); color: var(--red); }
.tag.amb { background: var(--amber-bg); color: var(--amber); } .tag.vio { background: var(--violet-bg); color: var(--violet); } .tag.grey { background: var(--soft); color: var(--muted); }

/* ---------- Listen */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.item:last-child { border-bottom: 0; }
button.item, a.item { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: inherit; text-decoration: none; padding-left: 0; padding-right: 0; }
.item .av { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; font-size: 17px; }
.av.in { background: var(--green-bg); color: var(--green); } .av.out { background: var(--red-bg); color: var(--red); } .av.tr { background: var(--chip); color: var(--muted); }
.av.sv { background: var(--violet-bg); color: var(--violet); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s.wrap, .item .t.wrap { white-space: normal; }
.item .amt { font-weight: 700; white-space: nowrap; text-align: right; }
.item .amt small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.item .date { width: 46px; text-align: center; flex-shrink: 0; line-height: 1.1; }
.item .date b { display: block; font-size: 18px; } .item .date span { font-size: 11px; color: var(--muted); }
.day-head { font-size: 13px; font-weight: 700; color: var(--muted); padding: 14px 0 2px; display: flex; justify-content: space-between; text-transform: none; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; font-size: 15px; }
.empty .em { font-size: 34px; display: block; margin-bottom: 6px; }

/* Fortschrittsbalken (Breite per Skript) */
.bar { height: 10px; background: var(--chip); border-radius: 6px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--blue2); border-radius: 6px; transition: width .4s ease; }
.bar.amb > i { background: var(--amber-bar); } .bar.red { background: var(--red-bg); } .bar.red > i { background: var(--red-bar); }
.bar.grn > i { background: var(--green-bar); } .bar.vio { background: #E4DAF7; } .bar.vio > i { background: var(--violet-bar); }
:root[data-theme="dark"] .bar.vio { background: #2E2757; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bar.vio { background: #2E2757; } }
.budget { padding: 8px 0 12px; border-bottom: 1px solid var(--line); }
.budget:last-child { border-bottom: 0; }
.budget .top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: 14.5px; }
.goal { background: var(--violet-bg); border-radius: 16px; padding: 15px; }
.goal .big { font-size: 22px; font-weight: 700; color: var(--violet); margin: 4px 0; overflow-wrap: anywhere; }

/* ---------- Hinweis-Kästen */
.note { border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; line-height: 1.45; }
.note .em { font-size: 22px; line-height: 1; flex-shrink: 0; }
.note.blue { background: var(--chip); } .note.green { background: var(--green-bg); } .note.red { background: var(--red-bg); } .note.amber { background: var(--amber-bg); }
.note.vio { background: var(--violet-bg); }
.note h3 { margin-bottom: 2px; }
.check-banner { cursor: pointer; border: 0; width: 100%; text-align: left; color: inherit; font: inherit; }
.tips { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.tip { background: var(--card); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.tip b { display: block; }

/* ---------- Formulare */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 14px; font-weight: 600; color: var(--ink2); display: flex; align-items: center; gap: 4px; }
.field .hint { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], input[type=email], input[type=search], input[type=month],
input:not([type]), select, textarea {
  width: 100%; min-height: 50px; border: 1.5px solid var(--line2); border-radius: 14px; background: var(--card); padding: 11px 14px; font-size: 16px;
  color: var(--ink); appearance: none; -webkit-appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue2); outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 196, .2); }
input[type=date], input[type=time], input[type=month] { min-width: 0; }
.amount-wrap { position: relative; }
.amount-input { font-size: 38px !important; font-weight: 700; text-align: center; min-height: 76px !important; padding: 8px 54px 8px 14px !important; letter-spacing: -.5px; }
.amount-wrap .eur { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 26px; font-weight: 700; color: var(--muted); pointer-events: none; }
.g2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; } .g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
@media (max-width: 380px) { .g3 { grid-template-columns: 1fr 1fr; } }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch .txt { flex: 1; min-width: 0; } .switch .txt small { display: block; color: var(--muted); font-size: 13px; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 16px; background: var(--line2); position: relative; flex-shrink: 0;
  transition: background .2s; margin: 0; cursor: pointer; }
.switch input::after { content: ""; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .2s; }
.switch input:checked { background: var(--green-bar); } .switch input:checked::after { left: 23px; }
.seg { display: flex; background: var(--soft); border-radius: 14px; padding: 4px; gap: 4px; border: 1.5px solid var(--line2); }
.seg button { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--navy); box-shadow: var(--shadow); }
:root[data-theme="dark"] .seg button.on { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { color: var(--ink); } }
.seg button.on.out { color: var(--red); } .seg button.on.in { color: var(--green); }
.err { color: var(--red); font-size: 14px; font-weight: 600; }
.code-input { font-size: 30px !important; letter-spacing: 10px; text-align: center; font-weight: 700; }
.photo-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.thumb { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 1.5px solid var(--line2); background: var(--soft); }
details.more { border-top: 1px solid var(--line); padding-top: 6px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--blue); min-height: 44px; display: flex; align-items: center; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "＋"; margin-right: 8px; } details.more[open] summary::before { content: "－"; }

/* ---------- Fenster (unten auf dem Handy, mittig am PC) */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(9, 28, 46, .45); display: flex; align-items: flex-end; justify-content: center;
  animation: fade .15s ease; }
.sheet { background: var(--bg2); width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; border-radius: 24px 24px 0 0; display: flex; flex-direction: column;
  box-shadow: var(--shadow-strong); animation: up .22s ease; }
.sheet.wide { max-width: 760px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px 20px; }
.sheet-head h2 { font-size: 19px; }
.sheet-body { overflow-y: auto; padding: 4px 20px 20px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg2); border-radius: 0 0 24px 24px; }
.sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line2); margin: 8px auto 0; }
@media (min-width: 700px) {
  .backdrop { align-items: center; padding: 24px; }
  .sheet { border-radius: 24px; max-height: 88vh; }
  .sheet .grab { display: none; }
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog-center { align-items: center; padding: 16px; }
.dialog-center .sheet { border-radius: 24px; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); z-index: 95;
  display: flex; flex-direction: column; gap: 8px; width: min(480px, calc(100vw - 24px)); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: var(--navy); color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-strong);
  font-size: 15px; animation: up .2s ease; }
:root[data-theme="dark"] .toast { background: #2A5276; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #2A5276; } }
.toast.err { background: #8E1F1F; } .toast .grow { line-height: 1.35; }
.toast button { background: transparent; border: 1.5px solid rgba(255, 255, 255, .5); color: #fff; border-radius: 10px; min-height: 38px; padding: 4px 12px; font-weight: 700; }

/* ---------- Tabellen */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 8px 6px; border-bottom: 1.5px solid var(--line2); white-space: nowrap; }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.r, .tbl th.r { text-align: right; white-space: nowrap; }
.tbl tr.sum td { font-weight: 700; border-top: 1.5px solid var(--line2); border-bottom: 0; }

/* ---------- Diagramme (SVG) */
.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--line); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink2); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.lg-in { background: var(--green-bar); } .lg-out { background: var(--red-bar); } .lg-blue { background: var(--blue2); } .lg-vio { background: var(--violet-bar); }
.lg-amb { background: var(--amber-bar); } .lg-grey { background: var(--sky); }
.catbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; }
.catbar:last-child { border-bottom: 0; }
.catbar .bar { grid-column: 1 / -1; margin-top: 2px; }
.catbar .d { font-size: 12.5px; }

/* ---------- Kalender */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wd { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.cal .d { min-height: 62px; border-radius: 12px; background: var(--soft); border: 1.5px solid transparent; padding: 5px 4px; display: flex; flex-direction: column;
  align-items: center; gap: 3px; font-size: 14px; color: var(--ink); min-width: 0; }
.cal button.d { width: 100%; }
.cal .d.empty-d { background: transparent; }
.cal .d.today { border-color: var(--blue2); } .cal .d.sel { background: var(--blue); color: #fff; }
.cal .d .n { font-weight: 700; }
.cal .d .dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.cal .d .dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dot-in { background: var(--green-bar); } .dot-out { background: var(--red-bar); } .dot-open { background: var(--amber-bar); } .dot-done { background: var(--sky); }
.cal .d .sum { font-size: 10.5px; font-weight: 700; white-space: nowrap; overflow: hidden; max-width: 100%; }
.cal .d.sel .sum { color: #fff !important; }
@media (min-width: 900px) { .cal .d { min-height: 86px; } .cal .d .sum { font-size: 12px; } }

/* ---------- Anmelden */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #F4FAFF 0%, var(--bg) 60%); }
:root[data-theme="dark"] .auth { background: var(--bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth { background: var(--bg); } }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo .name { font-family: var(--font-head); font-weight: 800; font-size: 30px; color: var(--navy); margin-top: 10px; }
:root[data-theme="dark"] .auth-logo .name { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-logo .name { color: var(--ink); } }
.auth-logo .slogan { color: var(--muted); max-width: 330px; margin: 6px auto 0; font-size: 15px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 24px; padding: 22px; box-shadow: var(--shadow-strong); }
.steps { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.steps .n { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--chip); color: var(--blue); font-weight: 800; font-size: 12.5px; }
.steps .n.on { background: var(--blue); color: #fff; } .steps .ln { flex: 1; height: 2px; background: var(--line2); }
.secure { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--green); font-size: 13px; font-weight: 600; margin-top: 12px; }
.auth .foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; line-height: 1.6; }
.auth .credit { text-align: center; font-size: 12.5px; color: var(--faint); margin-top: 18px; line-height: 1.6; }
.auth .credit strong { color: var(--blue); }
.qr { display: block; width: 220px; height: 220px; margin: 6px auto; border-radius: 14px; background: #fff; padding: 4px; image-rendering: pixelated; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--soft); border-radius: 12px; padding: 10px; text-align: center;
  font-size: 15px; font-weight: 700; letter-spacing: 1px; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: 16px; }
.codes span { background: var(--soft); border-radius: 10px; padding: 8px; text-align: center; }

/* ---------- Willkommen */
.welcome-hero { text-align: center; padding: 8px 0 4px; }
.welcome-hero .em { font-size: 52px; line-height: 1.1; }
.welcome-hero h2 { font-family: var(--font-head); font-size: 26px; font-weight: 800; margin-top: 6px; }
.welcome-hero p { color: var(--ink2); margin: 6px 0 0; font-size: 16px; }
.welcome-hero strong { color: var(--green); }
.features { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.feature { background: var(--card); border-radius: 16px; padding: 12px; }
.feature .em { font-size: 22px; } .feature b { display: block; margin-top: 4px; font-size: 14.5px; } .feature span { font-size: 12.5px; color: var(--muted); line-height: 1.35; display: block; }
@media (max-width: 360px) { .features { grid-template-columns: 1fr; } }

/* ---------- Kassenbon-Kamera */
.bon-btn { border-style: dashed; border-color: var(--blue2); color: var(--blue); background: var(--soft); min-height: 54px; }
.qbtn.bon { border-style: dashed; border-color: var(--blue2); color: var(--blue); }
.filled { animation: filled 1.6s ease; }
@keyframes filled { 0% { box-shadow: 0 0 0 3px var(--green-bar); background: var(--green-bg); } 100% { box-shadow: none; } }
.ocr-text { white-space: pre-wrap; font-size: 12px; max-height: 180px; overflow: auto; background: var(--card); border-radius: 10px; padding: 8px; margin: 6px 0 0; }

/* ---------- Sonstiges */
.show-desk { display: none !important; }
@media (min-width: 900px) { .show-desk { display: inline-flex !important; } }
.logo-svg { display: block; flex-shrink: 0; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-grid a { background: var(--card); border-radius: 16px; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; color: var(--ink2); font-weight: 600; font-size: 13px; text-align: center; padding: 8px; position: relative; }
.menu-grid a .badge { position: absolute; top: 8px; right: 8px; }
.menu-grid svg { color: var(--blue); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; font-size: 15px; }
.kv .k { color: var(--muted); } .kv .v { text-align: right; font-weight: 600; white-space: nowrap; }
.kv .sum { border-top: 1.5px solid var(--line2); padding-top: 6px; font-weight: 800; }
.calc { background: var(--card); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.calc .line { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 15.5px; border-bottom: 1px dashed var(--line2); }
.calc .line:last-child { border-bottom: 0; } .calc .line.total { font-size: 19px; font-weight: 800; border-top: 2px solid var(--navy); border-bottom: 0; margin-top: 4px; padding-top: 10px; }
.calc .op { color: var(--muted); width: 18px; display: inline-block; font-weight: 700; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--blue2); animation: spin .8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.notif.unread { background: var(--soft); border-radius: 12px; padding-left: 8px; padding-right: 8px; }
.pill-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav .lbl-m { font-weight: 800; font-size: 17px; min-width: 130px; text-align: center; color: var(--navy); }
:root[data-theme="dark"] .month-nav .lbl-m { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .month-nav .lbl-m { color: var(--ink); } }
.plan-item { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); min-height: 60px; }
.plan-item:last-child { border-bottom: 0; }
.tick { width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line2); background: var(--card); flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: transparent; }
.tick.done { background: var(--green-bar); border-color: var(--green-bar); color: #fff; }
.tick.late { border-color: var(--amber-bar); }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin: 14px 0 2px; }
.danger-zone { border: 1.5px solid var(--red-bg); }
@media print { .side, .bottom-nav, .top-actions, .btn, .help { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }

/* ---------- Sachleistungen: Knöpfe unter dem Namen */
.sach-row { flex-wrap: wrap; row-gap: 8px; }
.sach-row .main { flex: 1 1 100%; }
.sach-row .btns { margin-left: auto; flex-wrap: nowrap; }

/* ---------- Einfache Ansicht: Erweiterte Felder ausblenden (Einstellungen → Ansicht → Alle Funktionen) */
body.einfach .adv { display: none !important; }
.auto-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.auto-row .main { flex: 1; min-width: 0; }
.auto-row .mini-field { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 2px; }
.auto-row .mini-field input { width: 56px; text-align: center; }
.auto-row .mini-field select { width: 76px; }
.chip.new-cat { border-style: dashed; color: var(--blue); }

/* ---------- „Als App installieren“ */
.install-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: var(--shadow-strong); max-width: 520px; margin: 0 auto;
  animation: ib-in .35s ease; }
.install-bar .ib-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.install-bar .ib-txt span { color: var(--muted); font-size: 13px; }
.install-bar .ib-k { color: var(--ink); white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.install-bar .ib-btns { display: flex; align-items: center; gap: 6px; }
.install-bar .ib-ic svg, .install-bar .ib-ic img { display: block; }
body:has(.bottom-nav) .install-bar, body:has(nav.bottom) .install-bar { bottom: calc(var(--nav-h, 64px) + 16px + env(safe-area-inset-bottom)); }
@keyframes ib-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
body:has(#install-bar) .auth, body:has(#install-bar) #main { padding-bottom: 150px; }

/* ---------- Einladung: zuerst nur das Logo */
.invite-splash { all: unset; box-sizing: border-box; min-height: 100vh; min-height: 100dvh; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  cursor: pointer; background: radial-gradient(circle at 50% 40%, var(--soft), var(--bg)); -webkit-tap-highlight-color: transparent; }
.invite-splash .inv-logo { display: block; border-radius: 34px; box-shadow: var(--shadow-strong); animation: inv-pulse 2.2s ease-in-out infinite; }
.invite-splash .inv-logo svg { display: block; }
.invite-splash .inv-tap { color: var(--muted); font-size: 15px; letter-spacing: .02em; }
.invite-splash:focus-visible .inv-logo { outline: 3px solid var(--blue); outline-offset: 6px; }
@keyframes inv-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (prefers-reduced-motion: reduce) { .invite-splash .inv-logo { animation: none; } }
.invite-pop .em { font-size: 54px; line-height: 1; }
.invite-pop h2 { margin: 12px 0 8px; line-height: 1.3; }
.inv-pop-logo { display: flex; justify-content: center; } .inv-pop-logo svg { border-radius: 20px; box-shadow: var(--shadow); }

/* ---------- Datumsfelder zum Tippen */
.date-wrap { position: relative; display: flex; align-items: stretch; gap: 6px; width: 100%; min-width: 0; }
.date-wrap .date-txt { flex: 1; min-width: 0; }
.date-wrap .date-txt.bad { border-color: var(--red, #dc2626); box-shadow: 0 0 0 2px rgba(220, 38, 38, .2); }
.date-wrap .date-cal { flex: 0 0 auto; width: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); font-size: 20px; cursor: pointer; }
.date-wrap .date-native { position: absolute; right: 0; bottom: 0; width: 48px; height: 100%; opacity: 0; pointer-events: none; }
.rate-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; } .rate-row > span:first-child { flex: 1; min-width: 140px; }

/* ---------- Emojis */
.av.em { background: var(--soft); font-size: 22px; }
.emoji-big { font-size: 34px; width: 64px; height: 64px; border-radius: 18px; border: 2px dashed var(--blue2); background: var(--soft); cursor: pointer; flex: 0 0 auto; }
.emoji-field .row-flex { gap: 12px; align-items: center; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; margin-top: 4px; }
.emoji-grid button { font-size: 26px; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.emoji-grid button:active { transform: scale(.94); }
.chip .ce { margin-right: 4px; }
.ams-sum { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin: 8px 0 4px; }
.ams-sum > div { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.ams-sum .lab { font-size: 12px; color: var(--muted); }
.ams-sum b { font-size: 20px; }
