/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg:          #0A0D14;
  --s1:          #111520;
  --s2:          #181D2C;
  --s3:          #1E2538;
  --gold:        #C9A84C;
  --gold-dim:    rgba(201,168,76,0.12);
  --gold-border: rgba(201,168,76,0.25);
  --cyan:        #1E88C8;
  --cyan-dim:    rgba(30,136,200,0.12);
  --text:        #E8EAF0;
  --text2:       #B8BDD0;
  --muted:       #9CA5BB;
  --space-1:     0.25rem;
  --space-2:     0.5rem;
  --space-3:     0.75rem;
  --space-4:     1rem;
  --space-6:     1.5rem;
  --border:      rgba(255,255,255,0.07);
  --border2:     rgba(255,255,255,0.12);
  --green:       #3FBF7F;
  --red:         #F07878;
  --orange:      #D4860A;
  --violet:      #9B72E8;
  --r:           10px;
  --rs:          7px;
  --font:        system-ui, sans-serif;
  --fh:          'Bebas Neue', sans-serif;
  --fm:          ui-monospace, monospace;
  --sw:          240px;
  /* Hintergrund-Akzente (theme-überschreibbar) */
  --glow1:         rgba(201,168,76,0.07);
  --glow2:         rgba(30,136,200,0.055);
  --grid-line:     rgba(201,168,76,0.028);
  /* Titel-Gradient (theme-überschreibbar) */
  --grad-title:    linear-gradient(135deg, #F0F2FA, #C9A84C);
  --page-border:   rgba(201,168,76,0.15);
}

/* ══ Theme: Pixel Neon – helles Layout ════════════════════════ */
[data-theme="pixel"] {
  /* Pastell-Hintergründe – kein hartes Weiß */
  --bg:          #EDF0FA;
  --s1:          #F5F7FF;
  --s2:          #E4E8F8;
  --s3:          #D5DCF2;
  /* Akzente */
  --gold:        #5B21B6;
  --gold-dim:    rgba(91,33,182,0.10);
  --gold-border: rgba(91,33,182,0.22);
  --cyan:        #0284C7;
  --cyan-dim:    rgba(2,132,199,0.12);
  /* Text auf Pastell */
  --text:        #0F1128;
  --text2:       #374162;
  --muted:       #53617D;
  --border:      rgba(0,0,0,0.07);
  --border2:     rgba(0,0,0,0.13);
  /* Status */
  --green:       #0F6B45;
  --red:         #B91C1C;
  --orange:      #B45309;
  --violet:      #5B21B6;
  /* Glows */
  --glow1:       rgba(91,33,182,0.09);
  --glow2:       rgba(2,132,199,0.08);
  --grid-line:   rgba(91,33,182,0.055);
  /* Titel-Gradient: lila→cyan, lesbar auf hell */
  --grad-title:  linear-gradient(135deg, #1E1B4B, #5B21B6, #0284C7);
  --page-border: rgba(91,33,182,0.18);
}
[data-theme="pixel"] .sidebar,
[data-theme="pixel"] .topbar {
  background: #F5F7FF; border-color: rgba(0,0,0,0.08);
  box-shadow: 2px 0 10px rgba(91,33,182,0.07);
}
[data-theme="pixel"] .sb-avatar { background: var(--s2); color: var(--gold); }
[data-theme="pixel"] .nav-item { color: var(--text2); }
[data-theme="pixel"] .nav-item:hover  { background: rgba(91,33,182,0.07); }
[data-theme="pixel"] .nav-item.active { background: rgba(91,33,182,0.13); color: var(--gold); }
[data-theme="pixel"] .card,
[data-theme="pixel"] .kpi-box,
[data-theme="pixel"] .list-box,
[data-theme="pixel"] .chart-box,
[data-theme="pixel"] .expander,
[data-theme="pixel"] .modal         { background: #F5F7FF; border-color: rgba(0,0,0,0.08); }
[data-theme="pixel"] input,
[data-theme="pixel"] select,
[data-theme="pixel"] textarea       { background: #EDF0FA; border-color: rgba(0,0,0,0.13); color: var(--text); }
[data-theme="pixel"] #pf-lock       { background: #EDF0FA !important; }
[data-theme="pixel"] .pin-key       { background: #F5F7FF; border-color: rgba(0,0,0,0.09);
                                       color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,0.09); }
[data-theme="pixel"] .pin-key:active { background: #E4E8F8; }
[data-theme="pixel"] .pin-key.del   { background: transparent; border-color: transparent; box-shadow: none; }
#pf-emoji-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity 0.5s;
}
[data-theme="pixel"] #pf-emoji-bg { opacity: 1; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; min-height: 100vh; }
a { color: inherit; text-decoration: none; }

/* ── Background Layers ──────────────────────────────────────── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 30%, black 20%, transparent 100%);
  transition: background-image 0.4s;
}
.bg-glow {
  position: fixed; top: -200px; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse, var(--glow1) 0%, transparent 65%);
  transition: background 0.4s;
}
.bg-glow2 {
  position: fixed; bottom: -180px; right: -80px;
  width: 600px; height: 500px; pointer-events: none; z-index: 0;
  background: radial-gradient(circle, var(--glow2) 0%, transparent 65%);
  transition: background 0.4s;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sw); background: #0D1018;
  border-right: 1px solid rgba(201,168,76,0.08);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sb-header { padding: 1.6rem 1.2rem 1.2rem; border-bottom: 1px solid rgba(201,168,76,0.08); }
.sb-user { display: flex; align-items: center; gap: 0.75rem; }
.sb-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: #161C2C; border: 1.5px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fh); font-size: 1rem; letter-spacing: 0.06em;
  color: var(--gold); box-shadow: 0 0 12px rgba(201,168,76,0.12);
}
.sb-name { font-family: var(--fh); font-size: 0.95rem; letter-spacing: 0.08em; color: var(--text); line-height: 1.1; }
.sb-uname { font-size: 0.68rem; color: var(--muted); margin-top: 1px; }
.sb-nav { flex: 1; padding: 0.8rem 0; overflow-y: auto; }
.nav-lbl {
  padding: 0.6rem 1.2rem 0.3rem;
  font-size: 0.6rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.55rem 1.2rem; margin: 1px 0.5rem;
  border-radius: 8px; color: #8892AA;
  font-size: 0.85rem; font-weight: 500;
  transition: background 0.15s, color 0.15s; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active {
  background: var(--gold-dim); color: var(--gold);
  border-left: 2px solid var(--gold);
  border-radius: 0 8px 8px 0;
  margin-left: 0; padding-left: calc(1.2rem - 2px);
  font-weight: 700;
}
.nav-icon { font-size: 1rem; width: 1.2rem; text-align: center; }
.sb-divider { height: 1px; background: rgba(255,255,255,0.05); margin: 0.5rem 1.2rem; }
.btn-cta {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  margin: 0.3rem 0.5rem; padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #B8902A, #D4A843);
  color: #0A0D14; font-weight: 800; border: none; border-radius: 8px;
  font-family: var(--font); font-size: 0.83rem; letter-spacing: 0.04em;
  cursor: pointer; box-shadow: 0 4px 14px rgba(201,168,76,0.22);
  transition: box-shadow 0.2s, transform 0.15s;
}
.btn-cta:hover { box-shadow: 0 6px 20px rgba(201,168,76,0.35); transform: translateY(-1px); }
.sb-footer { padding: 0.8rem 0.5rem 0.6rem; border-top: 1px solid rgba(255,255,255,0.05); }
.btn-logout {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; padding: 0.45rem 0.75rem;
  background: transparent; border: 1px solid rgba(255,255,255,0.05);
  border-radius: 7px; color: var(--text2);
  font-family: var(--font); font-size: 0.78rem; font-weight: 500;
  cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-logout:hover { color: var(--red); border-color: rgba(224,82,82,0.25); background: rgba(224,82,82,0.05); }
.sb-version { text-align: center; padding-top: 0.5rem; font-family: var(--fm); font-size: 0.58rem; color: var(--muted); letter-spacing: 0.12em; }

/* ── Main ───────────────────────────────────────────────────── */
.main { margin-left: var(--sw); flex: 1; padding: 2rem 2.5rem; min-height: 100vh; overflow-x: hidden; }

/* ── Page Header ────────────────────────────────────────────── */
.page-header { margin-bottom: 1.8rem; padding-bottom: 1rem; border-bottom: 1px solid var(--page-border); display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.page-title {
  font-family: var(--fh); font-size: 2.2rem; letter-spacing: 0.10em; line-height: 1;
  background: var(--grad-title);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.page-sub { font-size: 0.82rem; color: var(--muted); margin-top: 0.2rem; }

/* ── Section Label ──────────────────────────────────────────── */
.sec-lbl { display: flex; align-items: center; gap: 0.5rem; margin: 1.4rem 0 0.7rem; }
.sec-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sec-txt { font-family: var(--fh); font-size: 1.05rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text); }
.sec-count { padding: 1px 9px; border-radius: 20px; font-size: 0.68rem; font-weight: 700; background: rgba(255,255,255,0.07); color: var(--text2); }

/* ── KPI Grid ───────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: var(--s1); border: 1px solid var(--border); border-top: 2px solid var(--gold-border); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.kpi-lbl { font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.kpi-val { font-family: var(--fh); font-size: 1.6rem; letter-spacing: 0.04em; color: var(--text); }
.kpi-val.pos { color: var(--green); }
.kpi-val.neg { color: var(--red); }

/* ── Chart Container ────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 1rem; margin-bottom: 1rem; }
.chart-box { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; }
.chart-box h3 { font-family: var(--fh); font-size: 1rem; letter-spacing: 0.08em; color: var(--text2); margin-bottom: 0.5rem; text-transform: uppercase; }

/* ── List Box ───────────────────────────────────────────────── */
.list-box { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; margin-bottom: 0.5rem; }
.list-row { display: flex; align-items: center; padding: 0.65rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.04); transition: background 0.12s; }
.list-row:hover { background: rgba(201,168,76,0.04); }
.list-row:last-child { border-bottom: none; }
.li-icon { font-size: 1.05rem; width: 1.8rem; flex-shrink: 0; }
.li-body { flex: 1; min-width: 0; margin: 0 0.75rem; }
.li-title { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 0.7rem; color: var(--muted); margin-top: 1px; white-space: normal; word-break: break-word; }
.li-right { text-align: right; flex-shrink: 0; max-width: 110px; }
.li-amount { font-weight: 700; font-size: 0.88rem; }
.li-amtsub { font-size: 0.68rem; color: var(--muted); }
.pos { color: var(--green); }
.neg { color: var(--red); }
.warn-col { color: var(--orange); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 0.65rem; font-weight: 600; }
.b-Buchung     { background:rgba(30,136,200,0.12); color:#38C4E8; border:1px solid rgba(30,136,200,0.25); }
.b-Abo         { background:rgba(212,134,10,0.12); color:#D4A843; border:1px solid rgba(212,134,10,0.25); }
.b-Finanzierung{ background:rgba(155,114,232,0.12); color:#9B72E8; border:1px solid rgba(155,114,232,0.25); }
.b-Vertrag     { background:rgba(63,191,127,0.12); color:#3FBF7F; border:1px solid rgba(63,191,127,0.25); }
.b-turnus-Q    { background:rgba(212,134,10,0.14); color:#D4A843; border:1px solid rgba(212,134,10,0.30); }
.b-turnus-J    { background:rgba(155,114,232,0.14); color:#9B72E8; border:1px solid rgba(155,114,232,0.30); }
.b-turnus-E    { background:rgba(30,136,200,0.14); color:#38C4E8;  border:1px solid rgba(30,136,200,0.30); }
.b-konto       { background:rgba(30,136,200,0.12); color:#38C4E8; border:1px solid rgba(30,136,200,0.25); }
[data-theme="pixel"] .b-Buchung, [data-theme="pixel"] .b-turnus-E, [data-theme="pixel"] .b-konto { color: #075985; }
[data-theme="pixel"] .b-Abo, [data-theme="pixel"] .b-turnus-Q { color: #92400E; }
[data-theme="pixel"] .b-Finanzierung, [data-theme="pixel"] .b-turnus-J { color: #5B21B6; }
[data-theme="pixel"] .b-Vertrag { color: #0F6B45; }
[data-theme="pixel"] .seg-btn.active { color: #fff; }

/* ── Progress Bar ───────────────────────────────────────────── */
.prog-wrap { margin: 0.3rem 0 0.5rem; }
.prog-meta { display: flex; justify-content: space-between; font-size: 0.67rem; font-weight: 600; margin-bottom: 4px; }
.prog-track { height: 5px; border-radius: 10px; background: var(--s3); overflow: hidden; }
.prog-fill { height: 100%; border-radius: 10px; }

/* ── Warning ────────────────────────────────────────────────── */
.warn-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 1rem; margin-bottom: 0.35rem;
  border-radius: var(--rs); border-left-width: 3px; border-left-style: solid;
}
.warn-body { flex: 1; }
.warn-title { font-weight: 600; font-size: 0.88rem; }
.warn-sub { font-size: 0.7rem; color: var(--muted); }
.warn-days { font-weight: 700; font-size: 0.82rem; white-space: nowrap; }

/* ── Timeline ───────────────────────────────────────────────── */
.tl-head { display: flex; align-items: center; gap: 0.8rem; margin: 1.6rem 0 0.6rem; }
.tl-head:first-child { margin-top: 0.2rem; }
.tl-month { font-family: var(--fh); font-size: 1rem; letter-spacing: 0.10em; color: var(--gold); white-space: nowrap; }
.tl-line { flex: 1; height: 1px; background: rgba(201,168,76,0.10); }
.tl-totals { display: flex; gap: 0.5rem; font-size: 0.78rem; flex-shrink: 0; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-card { background: var(--s1); border: 1px solid var(--border); border-radius: var(--r); padding: 1.5rem; margin-bottom: 1rem; }
.fg { display: flex; flex-direction: column; gap: 0.35rem; }
.fl { font-size: 0.68rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.fi, .fs {
  background: var(--s2); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--rs); padding: 0.6rem 0.85rem;
  color: var(--text); font-family: var(--font); font-size: 0.88rem;
  transition: border-color 0.2s, box-shadow 0.2s; width: 100%;
}
.fi:focus, .fs:focus {
  outline: none; border-color: rgba(201,168,76,0.45);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.09); background: var(--s3);
}
.fi::placeholder { color: rgba(255,255,255,0.18); }
.fs option { background: var(--s2); }
.fi:-webkit-autofill, .fi:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px var(--s2) inset !important;
  -webkit-text-fill-color: var(--text) !important;
}
.fgrid   { display: grid; gap: 1rem; }
.fgrid-2 { grid-template-columns: 1fr 1fr; }
.fgrid-3 { grid-template-columns: 1fr 1fr 1fr; }
.fcheck { display: flex; align-items: center; gap: 0.5rem; padding-top: 0.5rem; font-size: 0.85rem; }
.fcheck input { width: 16px; height: 16px; accent-color: var(--gold); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn { padding: 0.6rem 1.2rem; border-radius: var(--rs); font-family: var(--font); font-size: 0.83rem; font-weight: 600; cursor: pointer; border: none; transition: all 0.18s; display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-primary { background: linear-gradient(135deg, #B8902A, #D4A843); color: #0A0D14; font-weight: 800; letter-spacing: 0.04em; box-shadow: 0 4px 14px rgba(201,168,76,0.22); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(201,168,76,0.35); transform: translateY(-1px); }
.btn-secondary { background: var(--s2); color: var(--text2); border: 1px solid rgba(255,255,255,0.08); }
.btn-secondary:hover { background: var(--s3); color: var(--text); }
.btn-danger { background: rgba(224,82,82,0.10); color: var(--red); border: 1px solid rgba(224,82,82,0.20); }
.btn-danger:hover { background: rgba(224,82,82,0.18); }
.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.75rem; }
.btn-sm, .modal-close, .seg-btn { min-height: 44px; }
.btn, .nav-item, .exp-head, .topbar-new { min-height: 44px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert { padding: 0.65rem 1rem; border-radius: var(--rs); font-size: 0.82rem; margin-bottom: 1rem; border-left: 3px solid; }
.alert-error   { background:rgba(224,82,82,0.10);   border-color:var(--red);    color:#F0A0A0; }
.alert-success { background:rgba(63,191,127,0.10);  border-color:var(--green);  color:#80D8A8; }
.alert-info    { background:rgba(30,136,200,0.10);  border-color:var(--cyan);   color:#7BBFE8; }
.alert-warn    { background:rgba(212,134,10,0.10);  border-color:var(--orange); color:#D4A843; }

/* ── Modal ──────────────────────────────────────────────────── */
.modal-bd {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px); z-index: 1000;
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-bd.open { display: flex; }
.modal {
  background: var(--s1); border: 1px solid var(--gold-border);
  border-radius: var(--r); box-shadow: 0 24px 80px rgba(0,0,0,0.65);
  width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto;
  padding: 1.8rem; position: relative;
}
.modal-title { font-family: var(--fh); font-size: 1.4rem; letter-spacing: 0.08em; margin-bottom: 1.2rem; display: flex; align-items: center; justify-content: space-between; }
.modal-close { background: var(--s2); border: 1px solid var(--border); border-radius: 6px; width: 28px; height: 28px; color: var(--muted); cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { color: var(--text); }

/* ── Segment Control ────────────────────────────────────────── */
.seg { display: flex; background: var(--s2); border: 1px solid var(--border); border-radius: var(--r); padding: 3px; gap: 2px; }
.seg-btn { flex: 1; text-align: center; padding: 0.35rem 0.5rem; font-size: 0.78rem; font-weight: 500; color: var(--muted); background: none; border: none; border-radius: var(--rs); cursor: pointer; transition: all 0.15s; }
.seg-btn.active { background: var(--gold); color: #0A0D14; font-weight: 700; box-shadow: 0 2px 8px rgba(201,168,76,0.25); }

/* ── Expander ───────────────────────────────────────────────── */
.expander { border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 0.5rem; overflow: hidden; }
.exp-head { width: 100%; border: 0; background: var(--s2); padding: 0.75rem 1rem; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font: inherit; font-size: 0.85rem; color: var(--text2); font-weight: 500; transition: background 0.15s; }
.exp-head:hover { background: var(--s3); }
.exp-arrow { transition: transform 0.2s; font-style: normal; }
.exp-body { display: none; background: var(--s1); padding: 1rem; }
.expander.open .exp-body { display: block; }
.expander.open .exp-arrow { transform: rotate(180deg); }
.entry-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: var(--space-3); padding: var(--space-4); background: var(--s1); border: 1px solid var(--border); border-radius: var(--r); margin-bottom: var(--space-4); }
.entry-filters label { display: flex; flex-direction: column; gap: var(--space-1); color: var(--text2); font-size: 0.82rem; }
.entry-filters input, .entry-filters select { width: 100%; min-width: 0; min-height: 44px; padding: var(--space-2); border: 1px solid var(--border2); border-radius: var(--rs); background: var(--s2); color: var(--text); font: inherit; }
.entry-filter-actions { display: flex; align-items: end; gap: var(--space-2); flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-border); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 960px) { .kpi-grid { grid-template-columns: 1fr 1fr; } .chart-grid { grid-template-columns: 1fr; } .fgrid-3 { grid-template-columns: 1fr 1fr; } }

/* ── Mobile: Sidebar als Drawer, Topbar sichtbar ────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    z-index: 1100;
    /* Safe area für Notch */
    padding-top: env(safe-area-inset-top);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 1050;
    background: rgba(0,0,0,0.60);
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.open { display: block; }

  .main {
    margin-left: 0;
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
    padding-top: calc(56px + 0.75rem);  /* Topbar-Höhe */
  }

  /* Topbar */
  .topbar {
    display: flex;
    position: fixed; top: 0; left: 0; right: 0; z-index: 900;
    height: 56px;
    background: rgba(13,16,24,0.96);
    border-bottom: 1px solid rgba(201,168,76,0.10);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    padding: 0 1rem;
    padding-top: env(safe-area-inset-top);
    gap: 0.75rem;
  }
  .topbar-logo {
    display: flex; align-items: center; gap: 0.55rem;
    flex: 1;
  }
  .topbar-logo img { width: 28px; height: 28px; object-fit: contain; }
  .topbar-logo span {
    font-family: var(--fh); font-size: 1.1rem; letter-spacing: 0.10em;
    background: var(--grad-title);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .hamburger {
    display: flex; flex-direction: column; justify-content: center;
    gap: 5px; width: 44px; height: 44px;
    background: var(--s2); border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; padding: 0 8px;
    flex-shrink: 0;
  }
  .hamburger span {
    display: block; height: 2px; background: var(--text2);
    border-radius: 2px; transition: all 0.22s;
  }
  .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .hamburger.open span:nth-child(2) { opacity: 0; }
  .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .topbar-new { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid var(--gold-border); border-radius: 9px; background: var(--gold-dim); color: var(--gold); font-size: 1.5rem; cursor: pointer; }

  .fgrid-2, .fgrid-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }

  /* page-header: Buttons kompakt auf Mobile */
  .page-header .btn { padding: 0.35rem 0.7rem; font-size: 0.75rem; }
  .page-title { font-size: 1.2rem; }

  /* list-row: kompakter auf Mobile */
  .li-right { max-width: 90px; }
  .li-amount { font-size: 0.82rem; }
  .li-amtsub { font-size: 0.68rem; }
  .list-row { padding: 0.6rem 0.75rem; }
  .li-body { margin: 0 0.5rem; }
  .li-icon { font-size: 1.1rem; }

  /* Modals: volle Breite auf Mobile */
  .modal {
    max-width: calc(100vw - 2rem) !important;
    margin: 1rem;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-bd {
    align-items: flex-end;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Desktop: Topbar + Hamburger + Overlay verstecken */
@media (min-width: 769px) {
  .topbar { display: none; }
  .sidebar-overlay { display: none !important; }
  .hamburger { display: none; }
}
.pf-update-banner {
  position: fixed; z-index: 2000; inset: auto 1rem 1rem auto;
  max-width: min(26rem, calc(100vw - 2rem)); padding: 0.8rem 1rem;
  display: flex; align-items: center; gap: 0.8rem;
  border: 1px solid var(--gold-border); border-radius: var(--r);
  background: var(--s1); color: var(--text); box-shadow: 0 8px 28px rgba(0,0,0,0.25);
}
.pf-update-banner[hidden] { display: none; }
.pf-update-banner button { min-height: 44px; padding: 0.45rem 0.8rem; border: 0; border-radius: var(--rs); background: var(--gold); color: var(--bg); font-weight: 700; cursor: pointer; }
.field-hint { margin-top: 0.45rem; color: var(--text2); font-size: 0.8rem; line-height: 1.4; }
.topbar-new { display: none; }
@media (max-width: 768px) { .topbar-new { display: flex; } }
