/* PlusOderMinus 4 – Glas über einer ruhigen Landschaft aus Moos, Blau und Himmel.
   Überschriften Outfit, Fließtext und Zahlen Work Sans. Palette: #687864 #31708E #5085A5 #8FC1E3 #F7F9FB */
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 300; font-display: swap; src: url("../fonts/outfit-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/outfit-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/outfit-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/outfit-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/work-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/work-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Work Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/work-sans-latin-600-normal.woff2") format("woff2"); }
:root {
  --font: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Outfit", "Work Sans", system-ui, sans-serif;
  --bg: #eef3f7;
  --bg2: #e4ecf2;
  --card: #ffffff;
  --glass: rgba(255, 255, 255, .66);
  --glass-border: rgba(255, 255, 255, .9);
  --text: #14303f;
  --muted: #536570;
  --line: #d6e2ea;
  --brand: #31708e;
  --on-brand: #ffffff;
  --gold: #4d5c49;
  --accent: #2a6584;
  --accent-soft: #dcebf6;
  --in: #2a6584;
  --in-soft: #dcebf6;
  --out: #56654f;
  --out-soft: #e7ede4;
  --warn: #8a5a0a;
  --warn-soft: #f7efd9;
  --danger: #b8323f;
  --chart-in: #5085a5;
  --chart-out: #8a9a85;
  --chart-line: #14303f;
  --logo-bg: #31708e;
  --logo-fg: #f7f9fb;
  --logo-ring: #8fc1e3;
  --wm-i: #5085a5;
  --hdr-line: #8fc1e3;
  --side-bg: rgba(20, 48, 63, .94);
  --side-text: #dbe9f2;
  --side-muted: #93adbd;
  --side-on: #8fc1e3;
  --side-on-text: #0f2633;
  --radius: 20px;
  --tbl-band: rgba(143, 193, 227, .12);
  --tbl-grp: rgba(104, 120, 100, .09);
  --tbl-grp-band: rgba(104, 120, 100, .14);
  --tbl-line: var(--line);
  --shadow: 0 1px 1px rgba(20, 48, 63, .04), 0 12px 32px -12px rgba(20, 48, 63, .18);
  --aurora:
    radial-gradient(900px 600px at 8% 0%, rgba(143, 193, 227, .55), transparent 60%),
    radial-gradient(700px 500px at 95% 15%, rgba(104, 120, 100, .22), transparent 60%),
    radial-gradient(900px 700px at 70% 105%, rgba(80, 133, 165, .25), transparent 60%);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0b1820;
  --bg2: #10222c;
  --card: #142a35;
  --glass: rgba(20, 42, 53, .62);
  --glass-border: rgba(143, 193, 227, .14);
  --text: #eef5f9;
  --muted: #a3b8c4;
  --line: #24404e;
  --brand: #8fc1e3;
  --on-brand: #0b1c26;
  --gold: #c3d0bd;
  --accent: #8fc1e3;
  --accent-soft: rgba(143, 193, 227, .14);
  --in: #8fc1e3;
  --in-soft: rgba(143, 193, 227, .12);
  --out: #bccab4;
  --out-soft: rgba(104, 120, 100, .22);
  --warn: #efc879;
  --warn-soft: rgba(239, 200, 121, .12);
  --danger: #ff8a8a;
  --chart-in: #8fc1e3;
  --chart-out: #8a9c85;
  --chart-line: #f7f9fb;
  --logo-bg: #8fc1e3;
  --logo-fg: #0b1820;
  --logo-ring: #687864;
  --wm-i: #8fc1e3;
  --hdr-line: #5085a5;
  --side-bg: rgba(8, 20, 27, .82);
  --side-text: #d5e5ef;
  --side-muted: #8aa3b2;
  --side-on: #8fc1e3;
  --side-on-text: #0b1c26;
  --shadow: 0 1px 1px rgba(0, 0, 0, .3), 0 16px 40px -16px rgba(0, 0, 0, .6);
  --tbl-band: rgba(143, 193, 227, .06);
  --tbl-grp: rgba(104, 120, 100, .16);
  --tbl-grp-band: rgba(104, 120, 100, .22);
  --tbl-line: #24404e;
  --aurora:
    radial-gradient(900px 600px at 8% 0%, rgba(49, 112, 142, .45), transparent 60%),
    radial-gradient(700px 500px at 95% 15%, rgba(104, 120, 100, .25), transparent 60%),
    radial-gradient(900px 700px at 70% 105%, rgba(80, 133, 165, .28), transparent 60%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 15px/1.5 var(--font); color: var(--text);
  background: var(--aurora), var(--bg); background-attachment: fixed;
  min-height: 100vh;
}
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .5em; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex: none; vertical-align: middle; }

/* ---------- Rahmen */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px max(16px, calc((100vw - 1320px) / 2));
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.logo {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--logo-fg);
  background: var(--logo-bg); box-shadow: 0 0 0 2px var(--logo-ring);
  font-weight: 500; font-size: 1.4rem; line-height: 1; font-family: system-ui, sans-serif;
}
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: flex; align-items: center; gap: 5px; padding: 7px 10px; border-radius: 999px;
  color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500;
}
.tabs a:hover { background: var(--accent-soft); color: var(--text); }
.tabs a.on { background: var(--brand); color: var(--on-brand); font-weight: 600; }
main { max-width: 1320px; margin: 0 auto; padding: 20px 16px 48px; }
.page-title { font-size: 1.5rem; margin: 4px 0 16px; }

/* ---------- Layout */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap, .wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cards2 { display: grid; grid-template-columns: minmax(220px, 300px); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.r { text-align: right; }
.c-in { color: var(--in); }
.c-out { color: var(--out); }
.strike { text-decoration: line-through; color: var(--muted); }
.hint { font-size: .85rem; color: var(--muted); background: var(--bg2); padding: 8px 12px; border-radius: 10px; }

/* ---------- Karten */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--line); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card.empty { text-align: center; color: var(--muted); padding: 32px 18px; }
.kcard {
  position: relative; overflow: hidden;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 16px 18px;
}
.kcard::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--line); }
.kcard.in::before { background: var(--in); }
.kcard.out::before { background: var(--out); }
.kcard.accent::before { background: var(--accent); }
.kcard.res.good { background: var(--card); }
.kcard.res.good::before { background: var(--in); }
.kcard.res.bad { background: var(--card); }
.kcard.res.bad::before { background: var(--out); }
.kl { color: var(--muted); font-size: .85rem; font-weight: 500; }
.kv { font-size: 1.6rem; font-weight: 700; letter-spacing: -.01em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kcard.res.good .kv { color: var(--in); }
.kcard.res.bad .kv { color: var(--out); }
.ks { color: var(--muted); font-size: .82rem; }
.res { font-weight: 700; font-variant-numeric: tabular-nums; }
.res.plus { color: var(--in); }
.res.minus { color: var(--out); }
.res.big { font-size: 1.4rem; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); font-size: .9rem; }
.notice .ic { margin-top: 2px; color: var(--warn); }
.notice.soft { background: var(--accent-soft); }
.notice.warn { background: var(--warn-soft); }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); vertical-align: middle; }
.pill.grey { background: var(--bg2); color: var(--muted); }
.pill.warn { background: var(--warn-soft); color: var(--warn); font-size: .85rem; }
.warn-t { color: var(--warn); cursor: help; text-decoration: underline dotted; }

.chart { position: relative; width: 100%; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 8px; }
.mini-kpis > div { background: var(--bg2); border-radius: 12px; padding: 10px; }
.mini-kpis span { display: block; color: var(--muted); font-size: .8rem; }
.mini-kpis b, .mini-kpis .res { font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.welcome { text-align: center; max-width: 640px; margin: 24px auto; padding: 32px 24px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.welcome h2 { font-size: 1.4rem; }

.yearnav { display: flex; align-items: center; gap: 6px; }
.yearnav strong { font-size: 1.2rem; min-width: 3.2em; text-align: center; }

/* ---------- Bedienelemente */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--bg2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg2); }
.btn.sm { padding: 5px 10px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.danger-text { color: var(--danger); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--bg2); color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; text-align: left; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; padding: 0; }
.search { width: min(320px, 100%); border-radius: 999px; padding-left: 14px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld > span { font-size: .82rem; color: var(--muted); font-weight: 500; }
.fld input, .fld select, .fld textarea { width: 100%; }
.fld.sm > span { font-size: .75rem; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.amount { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.amount:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.amount input { border: 0; box-shadow: none !important; text-align: right; flex: 1; width: 100%; background: transparent; }
.amount span { padding: 0 10px 0 2px; color: var(--muted); }
.amount.bad { border-color: var(--danger); }
.months-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.more { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg2); }
.seg { display: inline-flex; background: var(--bg2); border-radius: 12px; padding: 3px; gap: 2px; align-self: flex-start; }
.seg button { border: 0; background: transparent; padding: 7px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg.sm button { padding: 4px 12px; font-size: .85rem; }

.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--in); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px; text-align: center;
  border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; color: var(--accent); font-weight: 600; position: relative;
}
.drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.drop input, .file-btn input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-btn { position: relative; }

/* ---------- Listen */
.list-card { padding: 6px 0; }
.list-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 10px 18px 8px; border-bottom: 1px solid var(--line); }
.list-h span { color: var(--muted); font-size: .85rem; }
.list-h.in h3 { color: var(--in); }
.list-h.out h3 { color: var(--out); }
.item { display: flex; align-items: center; gap: 12px; padding: 8px 18px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.off .item-main, .item.off .item-amt { opacity: .5; }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: none; border: 0; padding: 4px 0; text-align: left; cursor: pointer; }
.item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.item-sub { color: var(--muted); font-size: .82rem; }
.item-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-amt.in { color: var(--in); }
.item-amt.out { color: var(--out); }
.item-amt small { color: var(--muted); font-weight: 500; }
.wi-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wi-row:last-child { border-bottom: 0; }
.wi-row > :first-child { flex: 1; min-width: 0; }
.pct { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.pct input { width: 64px; text-align: right; padding: 4px 6px; }

/* ---------- Tabellen */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th.r { text-align: right; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg2); }
.tbl tr.off { opacity: .5; }
.tbl.imp tbody tr { cursor: default; }
.tbl.imp select { max-width: 220px; }
.cell-in { width: 100%; min-width: 160px; padding: 4px 8px; }

.plan-wrap { overflow: auto; max-height: calc(100vh - 210px); background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.plan { border-collapse: separate; border-spacing: 0; font-size: .8rem; font-variant-numeric: tabular-nums; min-width: 100%; }
.plan th, .plan td { padding: 6px 7px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--tbl-line); background: var(--card); }
.plan thead th { position: sticky; top: 0; z-index: 2; color: var(--muted); font-weight: 600; background: var(--card); }
.plan .name { position: sticky; left: 0; z-index: 1; text-align: left; min-width: 140px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); }
.plan thead .name { z-index: 3; }
.plan .sum { font-weight: 700; border-left: 1px solid var(--line); }
.plan th.cur, .plan td.cur { box-shadow: inset 0 0 0 9999px color-mix(in srgb, var(--accent) 7%, transparent); }
.plan thead th.cur { color: var(--accent); }
.plan tr.grp td { background: var(--tbl-grp); font-weight: 700; cursor: pointer; }
.plan tr.grp.in td.name { color: var(--in); }
.plan tr.grp.out td.name { color: var(--out); }
.plan .tri { display: inline-block; width: 1.1em; color: var(--muted); }
.plan tr.contract td.name .link-btn::after { content: " ·V"; color: var(--muted); font-size: .7rem; }
.plan td.name .link-btn { color: var(--text); font-weight: 500; padding-left: 1.1em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.plan td.cell { cursor: pointer; }
.plan td.cell:hover { background: var(--accent-soft); }
.plan td.ovr { font-style: italic; color: var(--accent); }
.plan tfoot td { font-weight: 700; position: sticky; z-index: 2; }
.plan tfoot td.name { z-index: 3; }
.plan tfoot tr.tin td { bottom: 99px; color: var(--in); border-top: 2px solid var(--line); }
.plan tfoot tr.tout td { bottom: 66px; color: var(--out); }
.plan tfoot tr.tres td { bottom: 33px; }
.plan tfoot tr.tcum td { bottom: 0; font-weight: 500; color: var(--muted); }
.plan tfoot tr.tin td.name, .plan tfoot tr.tout td.name, .plan tfoot tr.tcum td.name { color: inherit; }
.plan tfoot .plus { color: var(--in); }
.plan tfoot .minus { color: var(--out); }
.plan tfoot tr.tres td { background: color-mix(in srgb, var(--accent) 6%, var(--card)); }
.plan tfoot tr td { height: 33px; }

.sticky-bar { position: sticky; bottom: 12px; z-index: 5; }

/* ---------- Dialoge, Meldungen */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(11, 28, 38, .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: var(--card); border-radius: 20px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(11, 28, 38, .35); animation: pop .18s ease-out; }
.modal.wide { width: min(860px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 14px 6px 20px; }
.modal-b { padding: 8px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-f { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; background: var(--text); color: var(--card); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 500; animation: pop .2s; max-width: calc(100vw - 32px); }
.toast.err { background: var(--danger); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

/* ---------- Mobil */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .top { padding: 8px 12px; backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--card); }
  .top .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0;
    background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .brand { flex: 1; }
  .tabs a { flex-direction: column; gap: 1px; padding: 6px 4px; font-size: .64rem; border-radius: 10px; flex: 1; min-width: 0; }
  .tabs a span { display: block; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabs a.on { background: var(--accent-soft); color: var(--accent); }
  main { padding: 14px 12px 96px; }
  .page-title { font-size: 1.3rem; margin-bottom: 12px; }
  .cards3 { grid-template-columns: 1fr; gap: 10px; }
  .kv { font-size: 1.4rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .months-grid { grid-template-columns: repeat(3, 1fr); }
    .mini-kpis { grid-template-columns: 1fr 1fr 1fr; }
  .mini-kpis > div { padding: 8px; }
  .mini-kpis b, .mini-kpis .res { font-size: .9rem; }
  .card { padding: 14px; }
  .hide-sm { display: none; }
  .plan-wrap { max-height: calc(100vh - 230px); }
  .plan .name { min-width: 120px; max-width: 140px; }
  .toasts { bottom: 84px; }
  .sticky-bar { bottom: 76px; }
  .overlay { align-items: end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; width: 100%; }
}
@media print {
  .top, .toasts, .btn, .icon-btn { display: none !important; }
  body { background: #fff; }
  .plan-wrap { max-height: none; overflow: visible; }
}

/* Diagramme schrumpfen mit (Chart.js in Grid/Flex) */
.grid-2 > *, .cards3 > *, .stack > * { min-width: 0; }
.chart canvas { max-width: 100%; }

/* Sperrbildschirm */
.lock-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.lock { width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 28px 24px; }
.lock h1 { font-size: 1.4rem; }
.lock .form { width: 100%; text-align: left; }
.lock .btn.primary { width: 100%; }
.logo.big { width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; font-weight: 700; }
.lock-err { color: var(--danger); font-weight: 600; font-size: .9rem; }
.lock .notice { text-align: left; }
@media (max-width: 640px) { .lock-btn { margin-left: -8px; } }

/* Gruppe: Auswahlliste mit „Neue Gruppe …“ */
.group-new { display: flex; align-items: center; gap: 6px; }
.group-new input { flex: 1; min-width: 0; }
.tbl.imp .group-new input { min-width: 140px; }

/* Sortieren */
.sorts { display: flex; gap: 8px; flex-wrap: wrap; }
.sort { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.sort select { padding: 5px 8px; font-size: .85rem; color: var(--text); }

/* Rundenknopf */
.round-btn {
  flex: none; height: 32px; min-width: 44px; padding: 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums;
}
.round-btn:hover { background: var(--bg2); color: var(--text); }
.round-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* Was wäre wenn: Einheit */
.unit-btn { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg2); font-weight: 700; cursor: pointer; color: var(--accent); }
.unit-btn:hover { border-color: var(--accent); }
.pct input { width: 80px; }
.pct input.bad { border-color: var(--danger); }
@media (max-width: 640px) { .sorts { width: 100%; } .sort { flex: 1; } .sort select { flex: 1; min-width: 0; } }

/* Jahresplan: gebänderte Monatsspalten (Feb, Apr, Jun, …) und Zeilenhervorhebung */
.plan tr > :nth-child(2n+3):nth-child(-n+13) { background: var(--tbl-band); }
.plan tr.grp > :nth-child(2n+3):nth-child(-n+13) { background: var(--tbl-grp-band); }
.plan tfoot tr.tres > :nth-child(2n+3):nth-child(-n+13) { background: color-mix(in srgb, var(--accent) 6%, var(--tbl-band)); }
.plan .sum { background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.plan tr.grp .sum { background: var(--tbl-grp-band); }
.plan .name, .plan .sum { border-color: var(--tbl-line); }
.plan tbody tr:not(.grp):hover > td { background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.plan td.cell:hover { background: var(--accent-soft) !important; }
[data-theme="dark"] .plan thead th { color: var(--text); background: #2a2640; }
[data-theme="dark"] .plan thead th.cur { color: var(--accent); }
[data-theme="dark"] .plan tfoot tr.tin td { border-top-color: #5a5288; }

/* Konten */
.acc-select { max-width: 190px; font-weight: 600; border-radius: 999px; padding: 6px 12px; background: var(--accent-soft); border-color: transparent; color: var(--text); }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.acc-card { display: flex; flex-direction: column; gap: 10px; }
.acc-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.acc-name { font-size: 1.1rem; font-weight: 700; border-color: transparent; background: transparent; padding: 4px 6px; margin: -4px -6px; }
.acc-name:hover { border-color: var(--line); }
.acc-new { border-style: dashed; justify-content: center; }
.pill.xfer { background: var(--in-soft); color: var(--text); }
.xfer-mark { margin-left: 4px; color: var(--accent); font-weight: 700; }
@media (max-width: 640px) { .acc-select { max-width: 42vw; } .tabs a { font-size: .58rem; } }
@media (max-width: 640px) { .brand > span:last-child { display: none; } .brand { flex: 0 0 auto; } .acc-select { flex: 1; max-width: none; } }


/* Server: Speicherstatus, Benutzer */
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); white-space: nowrap; flex: none; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--in); }
.sync.busy .dot { background: var(--warn); }
.sync.bad { color: var(--danger); font-weight: 600; }
.sync.bad .dot { background: var(--danger); }
.new-user { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.tbl.users tbody tr { cursor: default; }

/* ---------- PlusOderMinus Marke */
body { font-size: 15.5px; }
.top { border-bottom: 1px solid var(--line); }
[data-theme="dark"] .top { background: color-mix(in srgb, var(--bg) 82%, transparent); }
.tabs a { color: var(--accent); font-weight: 500; }
.tabs a:hover { color: var(--text); }
.page-title { font-weight: 300; letter-spacing: -.01em; color: var(--gold); font-size: 2.4rem; line-height: 1.1; margin: 10px 0 22px; }
h2 { font-weight: 500; letter-spacing: .01em; }
.wordmark { font-weight: 400; letter-spacing: .02em; color: var(--gold); font-size: 1.15rem; }
.wordmark i { font-style: normal; font-weight: 300; color: var(--wm-i); }
h1.wordmark { font-weight: 300; font-size: 2rem; letter-spacing: .04em; }
.logo.big { border-radius: 50%; font-size: 1.9rem; }
.kv { font-weight: 500; }
.kcard.accent::before { background: var(--chart-out); }
.welcome h2 { font-weight: 300; font-size: 2rem; color: var(--gold); letter-spacing: -.01em; }

/* Kopfzeile passt sich dem Platz an (Stufen setzt js/app.js, nur über 640px) */
.tabs a:focus-visible { outline-offset: -2px; }
.top.fit1 .brand > .wordmark, .top.fit1 .sync-t { display: none; }
.top.fit1 { gap: 10px; }
.top.fit2 .tabs a span { display: none; }
.top.fit2 .tabs a { padding: 8px 10px; }
.top.fit3 .acc-select { max-width: 130px; }
.top.fit3 .tabs a { padding: 8px 8px; }

/* ---------- Verfeinerung 3.5: ruhige Flächen, eine Wasserlinie als Blickfang */
.card, .kcard { box-shadow: none; }
.card { border-radius: 16px; }
.kcard { border-radius: 14px; }
.kcard::before { width: 3px; }
.kl { font-weight: 400; }
.plan thead th { font-weight: 500; }
.notice.soft { background: var(--accent-soft); }

/* Bilanz: das Jahresergebnis ist die Wasserlinie, über der Linie Plus, darunter Minus */
.bilanz {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px 56px; align-items: end;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 34px 38px 26px;
}
.bilanz .kcard { background: none; border: 0; border-radius: 0; padding: 0; overflow: visible; }
.bilanz .kcard::before { content: none; }
.bilanz .kcard.res.good, .bilanz .kcard.res.bad { background: none; }
.bilanz .res .kl { font-size: 1.05rem; color: var(--text); }
.bilanz .res .kv { font-size: clamp(2.9rem, 6.2vw, 4.75rem); font-weight: 300; letter-spacing: -.035em; line-height: 1; margin: 6px 0 8px; }
.bilanz-calc { display: grid; grid-template-columns: 1fr 1fr; padding-bottom: 6px; }
.bilanz-calc .kcard + .kcard { border-left: 1px solid var(--line); padding-left: 24px; }
.bilanz-calc .kv { font-size: 1.55rem; font-weight: 400; margin: 2px 0; }
.bilanz-calc .in .kv { color: var(--in); }
.bilanz-calc .out .kv { color: var(--out); }
.bilanz .res .ks { font-weight: 400; }
.bilanz-note { grid-column: 1 / -1; margin: 8px 0 0; color: var(--muted); max-width: 72ch; }

.waterline { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); margin-top: 18px; }
.wl { display: grid; grid-template-rows: 64px 44px auto auto; text-align: center; min-width: 0; }
.wl-up, .wl-down { display: flex; padding: 0 7px; }
.wl-up { align-items: flex-end; background: color-mix(in srgb, #8fc1e3 13%, transparent); }
.wl-down { align-items: flex-start; background: color-mix(in srgb, #687864 9%, transparent); border-top: 1.5px solid var(--text); }
.wl:first-child .wl-up, .wl:first-child .wl-down { border-radius: 0; }
.wl i { display: block; width: 100%; min-height: 3px; }
.wl-up i { background: var(--chart-in); border-radius: 5px 5px 0 0; }
.wl-down i { background: var(--chart-out); border-radius: 0 0 5px 5px; }
.wl-m { margin-top: 8px; font-size: .78rem; color: var(--muted); }
.wl-v { font-size: .8rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wl.plus .wl-v { color: var(--in); }
.wl.minus .wl-v { color: var(--out); }
.waterline .wl:first-child .wl-up { border-top-left-radius: 10px; }
.waterline .wl:last-child .wl-up { border-top-right-radius: 10px; }
.waterline .wl:first-child .wl-down { border-bottom-left-radius: 10px; }
.waterline .wl:last-child .wl-down { border-bottom-right-radius: 10px; }

.welcome .logo.big { width: 64px; height: 64px; font-size: 2.1rem; }

@media (max-width: 900px) {
  .bilanz { grid-template-columns: 1fr; padding: 24px 20px 20px; gap: 18px; }
}
@media (max-width: 640px) {
  .page-title { font-size: 1.9rem; margin-bottom: 14px; }
  .bilanz-calc .kv { font-size: 1.25rem; }
  .bilanz-calc .kcard + .kcard { padding-left: 16px; }
  .wl { grid-template-rows: 48px 34px auto auto; }
  .wl-up, .wl-down { padding: 0 2px; }
  .wl-v { display: none; }
  .wl-m { font-size: .68rem; }
}

/* ================================================================
   Version 4: Glas-Oberfläche, Seitenleiste ab 1100 px, Outfit + Work Sans
   ================================================================ */
body { font-size: 16px; }
h1, h2, h3, .page-title, .kv, .wordmark, .yearnav strong, .bilanz-calc .kv, .wl-v { font-family: var(--font-head); }
h2 { font-size: 1.12rem; font-weight: 500; letter-spacing: -.005em; }
button, a, select, [role="button"], .plan td.cell { cursor: pointer; }
.btn, .icon-btn, .tabs a, .round-btn, .link-btn, .acc-select { transition: background-color .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease; }

/* Glasflächen */
.card, .kcard, .bilanz, .plan-wrap {
  background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
}
.bilanz { border-radius: 26px; }
.plan-wrap { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
.kcard::before { content: none; }
.kcard { padding: 18px 20px; }
.kcard .kl::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--muted); }
.kcard.in .kl::before { background: var(--chart-in); }
.kcard.out .kl::before { background: var(--chart-out); }
.kcard.accent .kl::before { background: var(--brand); }
.bilanz .kcard .kl::before { content: none; }
.kv { font-weight: 500; letter-spacing: -.02em; }

/* Titel */
.page-title { font-size: 2.3rem; font-weight: 600; letter-spacing: -.03em; color: var(--text); margin: 6px 0 20px; }
.welcome h2 { font-family: var(--font-head); font-weight: 500; font-size: 2rem; color: var(--text); letter-spacing: -.02em; }

/* Bedienelemente */
.btn { border-radius: 12px; padding: 9px 16px; background: var(--card); }
.btn.primary { border-radius: 999px; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--brand) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.18); }
.btn.primary:hover { filter: none; background: color-mix(in srgb, var(--brand) 88%, #000); }
input, select, textarea { border-radius: 12px; }
.notice, .hint { border-radius: 14px; }
.mini-kpis > div { border-radius: 14px; }

/* Bilanz */
.bilanz .res .kl { font-family: var(--font-head); font-size: 1.1rem; font-weight: 500; }
.bilanz .res .kv { font-weight: 500; font-size: clamp(3rem, 6.4vw, 5.25rem); letter-spacing: -.045em; }
.bilanz-calc .kv { font-weight: 500; font-size: 1.7rem; }
.wl-up { background: color-mix(in srgb, #8fc1e3 16%, transparent); }
.wl-down { background: color-mix(in srgb, #687864 11%, transparent); }
.wl i { transform-origin: bottom; animation: wl-grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.wl-down i { transform-origin: top; }
.wl:nth-child(2) i { animation-delay: .03s; } .wl:nth-child(3) i { animation-delay: .06s; } .wl:nth-child(4) i { animation-delay: .09s; }
.wl:nth-child(5) i { animation-delay: .12s; } .wl:nth-child(6) i { animation-delay: .15s; } .wl:nth-child(7) i { animation-delay: .18s; }
.wl:nth-child(8) i { animation-delay: .21s; } .wl:nth-child(9) i { animation-delay: .24s; } .wl:nth-child(10) i { animation-delay: .27s; }
.wl:nth-child(11) i { animation-delay: .3s; } .wl:nth-child(12) i { animation-delay: .33s; }
@keyframes wl-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .wl i { animation: none; } * { transition: none !important; } }

/* Kopfzeile Tablet/Handy */
.top-tools { display: contents; }
.top { background: color-mix(in srgb, var(--card) 78%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.tabs a { color: var(--muted); }
.tabs a:hover { color: var(--text); background: var(--accent-soft); }
.tabs a.on { background: var(--brand); color: var(--on-brand); }

/* Seitenleiste ab 1100 px */
@media (min-width: 1100px) {
  .app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
  .top {
    position: sticky; top: 0; height: 100vh; flex-direction: column; align-items: stretch; gap: 18px;
    padding: 24px 16px 18px; background: var(--side-bg); color: var(--side-text); border: 0;
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  }
  .top .brand { padding: 0 6px; font-size: 1.1rem; }
  .top .brand > .wordmark { display: inline; color: #f7f9fb; font-weight: 500; letter-spacing: -.01em; }
  .top .wordmark i { color: var(--side-on); }
  .top .acc-select { width: 100%; max-width: none; background: rgba(255,255,255,.08); color: var(--side-text); border: 1px solid rgba(255,255,255,.12); }
  .top .acc-select option { color: #14303f; background: #fff; }
  .top .tabs { flex-direction: column; flex: 1; gap: 3px; overflow: visible; }
  .top .tabs a { color: var(--side-muted); padding: 11px 14px; border-radius: 12px; gap: 12px; font-weight: 500; font-size: .98rem; }
  .top .tabs a span { display: inline; }
  .top .tabs a:hover { color: #fff; background: rgba(255,255,255,.07); }
  .top .tabs a.on { background: var(--side-on); color: var(--side-on-text); }
  .top-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 14px 4px 0; border-top: 1px solid rgba(255,255,255,.1); }
  .top .round-btn { background: transparent; border-color: rgba(255,255,255,.2); color: var(--side-text); }
  .top .round-btn.on { background: var(--side-on); border-color: var(--side-on); color: var(--side-on-text); }
  .top .icon-btn { color: var(--side-muted); }
  .top .icon-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
  .top .sync { color: var(--side-muted); order: 5; width: 100%; padding: 4px 2px 0; }
  .top .sync .sync-t { display: inline; }
  main { max-width: 1280px; width: 100%; margin: 0 auto; padding: 34px 40px 64px; }
  .page-title { font-size: 2.6rem; }
}

@media (max-width: 640px) {
  .top { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--card); }
  .top .tabs { background: color-mix(in srgb, var(--card) 86%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
  .top .tabs a { min-height: 48px; justify-content: center; }
  .top .tabs a.on { background: var(--accent-soft); color: var(--accent); }
  .page-title { font-size: 1.9rem; }
  .card, .kcard, .bilanz { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--card); }
}
.bilanz .kcard { background: none; border: 0; box-shadow: none; padding: 0; border-radius: 0; -webkit-backdrop-filter: none; backdrop-filter: none; }
