/* Dunkle, an Allianz angelehnte Farbwelt – wie die Vermögen-App (iPhone) */
:root{--bg:#05101B;--bg2:#020A12;--surface:#0E1E2E;--raised:#152B3E;--sep:rgba(255,255,255,.08);--blue:#003781;--accent:#00A5E1;--sky:#96DCFA;--pos:#3DDC97;--neg:#FF6B5A;--warn:#FFB547;--t1:#fff;--t2:rgba(255,255,255,.62);--t3:rgba(255,255,255,.38);color-scheme:dark}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;background:var(--bg);color:var(--t1);font:15px/1.35 -apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",system-ui,sans-serif}
body{min-height:100vh;background:radial-gradient(120% 55% at 0% 0%,rgba(0,55,129,.45),transparent 60%),linear-gradient(#081A2B,var(--bg) 40%,var(--bg2));background-attachment:fixed}
body.locked{overflow:hidden}
main{padding:calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 100px);max-width:640px;margin:0 auto}
h1{font-size:32px;font-weight:700;margin:12px 2px 4px;letter-spacing:-.5px}
h1 small{display:block;font-size:13px;font-weight:500;color:var(--t3);letter-spacing:0;margin-top:2px}
.stack{display:flex;flex-direction:column;gap:16px}
.topbar{display:flex;align-items:center;justify-content:space-between;min-height:44px;gap:8px}
.topbar .grp{display:flex;gap:8px;align-items:center}
.iconbtn{width:40px;height:40px;border-radius:20px;border:1px solid var(--sep);background:var(--surface);color:var(--accent);display:grid;place-items:center;font-size:24px;line-height:1;cursor:pointer;flex:none}
.iconbtn svg{width:20px;height:20px}
.iconbtn.primary{background:linear-gradient(135deg,#003781,#0072B8);color:#fff;border-color:rgba(255,255,255,.14)}
.back{background:none;border:0;color:var(--accent);font:inherit;font-size:16px;padding:6px 0;cursor:pointer}
.linkbtn{background:none;border:0;color:var(--accent);font:inherit;font-weight:600;cursor:pointer;padding:6px 0}
.card{background:var(--surface);border:1px solid var(--sep);border-radius:20px;padding:18px}
.card.tight{padding:6px 16px}
.hdr{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:10px}
.hdr .t{font-size:12.5px;font-weight:600;letter-spacing:1.1px;text-transform:uppercase;color:var(--t2)}
.hdr .s{font-size:12px;color:var(--t3);margin-top:2px}
.hdr .r{font-weight:600;white-space:nowrap}
.num,.v,.big{font-variant-numeric:tabular-nums;font-family:ui-rounded,-apple-system,"SF Pro Rounded",system-ui,sans-serif}
.hero{background:linear-gradient(135deg,#00408F,#006AA8 55%,#0090C9);border:1px solid rgba(255,255,255,.14);border-radius:24px;padding:20px;box-shadow:0 12px 30px rgba(0,55,129,.45)}
.hero .lbl{display:flex;justify-content:space-between;align-items:center;font-size:12px;font-weight:600;letter-spacing:1.2px;color:rgba(255,255,255,.75)}
.hero .big{font-size:38px;font-weight:700;margin:10px 0 14px;white-space:nowrap}
.hero .m .l{color:rgba(255,255,255,.7)}
.brand{display:inline-flex;align-items:flex-end;gap:3px;height:20px}.brand i{width:4px;border-radius:3px;background:#fff}
.metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.metrics.two{grid-template-columns:repeat(2,1fr)}
.m .l{font-size:11.5px;color:var(--t3)} .m .v{font-size:16px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis} .m .x{font-size:10.5px;color:var(--t3)}
.row{display:flex;align-items:center;gap:12px;padding:11px 0;border-bottom:1px solid var(--sep);cursor:pointer}
.row:last-child{border-bottom:0}
.row .main{flex:1;min-width:0}
.row .ti{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .su{font-size:12px;color:var(--t3);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row .end{text-align:right;white-space:nowrap;display:flex;flex-direction:column;align-items:flex-end;gap:4px} .row .end .v{font-weight:600}
.chev{color:var(--t3);font-size:18px;line-height:1}
.kv{display:flex;justify-content:space-between;align-items:baseline;gap:10px;padding:5px 0;font-size:14px}
.kv .k{color:var(--t2)} .kv .v{font-weight:600;text-align:right}
.kv.em{font-size:16px} .kv.em .k{color:var(--t1);font-weight:600} .kv.em .v{font-weight:700}
.sep{height:1px;background:var(--sep);margin:6px 0}
.badge{width:36px;height:36px;border-radius:11px;display:grid;place-items:center;flex:none}
.badge svg{width:18px;height:18px}
.pill{font-size:10.5px;font-weight:600;padding:3px 8px;border-radius:99px;background:rgba(0,165,225,.15);color:var(--accent);white-space:nowrap}
.pill.pos{background:rgba(61,220,151,.15);color:var(--pos)} .pill.warn{background:rgba(255,181,71,.15);color:var(--warn)} .pill.neg{background:rgba(255,107,90,.15);color:var(--neg)} .pill.mute{background:rgba(255,255,255,.08);color:var(--t2)}
.pos{color:var(--pos)} .neg{color:var(--neg)} .warn{color:var(--warn)} .acc{color:var(--accent)} .sky{color:var(--sky)} .t2{color:var(--t2)} .t3{color:var(--t3)}
.hint{display:flex;gap:10px;font-size:12.5px;color:var(--t2);align-items:flex-start;line-height:1.4}
.hint .ic{flex:none;width:18px;height:18px;border-radius:50%;background:var(--warn);color:#05101B;font-weight:800;font-size:12px;display:grid;place-items:center}
.hint.info .ic{background:var(--accent)}
.add{display:flex;justify-content:center;gap:8px;align-items:center;padding:12px;border:1px dashed rgba(0,165,225,.4);border-radius:14px;color:var(--accent);font:inherit;font-weight:600;font-size:14px;background:none;width:100%;cursor:pointer;margin-top:8px}
.seg{display:flex;background:rgba(255,255,255,.08);border-radius:10px;padding:2px;overflow-x:auto;scrollbar-width:none}
.seg::-webkit-scrollbar{display:none}
.seg button{flex:1;border:0;background:none;color:var(--t1);padding:8px 10px;border-radius:8px;font:inherit;font-size:13.5px;cursor:pointer;white-space:nowrap}
.seg button.on{background:rgba(255,255,255,.2);font-weight:600}
.search{display:flex;align-items:center;gap:8px;background:rgba(255,255,255,.08);border-radius:12px;padding:0 12px;height:38px;color:var(--t3)}
.search svg{width:16px;height:16px;flex:none}
.search input{flex:1;background:none;border:0;outline:none;color:var(--t1);font:inherit;font-size:16px;min-width:0}
.actions{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
.act{display:flex;align-items:center;gap:10px;padding:13px 14px;border-radius:16px;border:1px solid var(--sep);background:var(--surface);color:var(--t1);font:inherit;font-size:14px;font-weight:500;cursor:pointer;text-align:left}
.act svg{width:20px;height:20px;flex:none;color:var(--accent)}
.act.main{background:linear-gradient(135deg,#003781,#0072B8);border-color:rgba(255,255,255,.14)} .act.main svg{color:#fff}
.act.pos svg{color:var(--pos)} .act.neg{color:var(--neg)} .act.neg svg{color:var(--neg)}
.empty{text-align:center;color:var(--t3);padding:26px 10px;font-size:14px;line-height:1.5}
.toast{position:fixed;left:50%;bottom:calc(env(safe-area-inset-bottom) + 96px);transform:translateX(-50%);background:var(--raised);border:1px solid var(--sep);padding:10px 16px;border-radius:14px;font-size:14px;z-index:30;box-shadow:0 8px 24px rgba(0,0,0,.4)}
.dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--t3);margin-right:6px}
.dot.ok{background:var(--pos)} .dot.busy{background:var(--accent)} .dot.error{background:var(--neg)} .dot.offline{background:var(--warn)}
.welcome{text-align:center;padding-top:40px} .welcome p{color:var(--t2);line-height:1.5}
.foot{font-size:11px;color:var(--t3);text-align:center;padding:0 12px;line-height:1.4}
svg.chart{width:100%;display:block;overflow:visible}
svg.chart text{fill:var(--t3);font-size:10px;font-family:inherit}

/* Tab-Leiste (iPhone) */
nav#tabs{position:fixed;left:12px;right:12px;bottom:calc(env(safe-area-inset-bottom) + 8px);max-width:560px;margin:0 auto;display:flex;background:rgba(14,30,46,.8);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid rgba(255,255,255,.1);border-radius:28px;padding:6px;z-index:5}
nav#tabs:empty{display:none}
nav#tabs button{flex:1;border:0;background:none;color:var(--t2);font:inherit;font-size:10.5px;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 0;border-radius:22px;cursor:pointer}
nav#tabs button svg{width:22px;height:22px}
nav#tabs button.on{color:var(--accent);background:rgba(255,255,255,.08)}
nav#tabs .navbrand,nav#tabs .navfoot{display:none}

/* Formular-Blätter */
#sheet{position:fixed;inset:0;z-index:10;background:rgba(0,0,0,.55);display:flex;align-items:flex-end;justify-content:center}
#sheet[hidden]{display:none}
.sheet{background:#0B1826;width:100%;max-width:640px;max-height:94vh;border-radius:22px 22px 0 0;overflow:auto;padding:0 16px calc(env(safe-area-inset-bottom) + 28px);border-top:1px solid var(--sep);overscroll-behavior:contain}
.sheet-bar{position:sticky;top:0;display:flex;justify-content:space-between;align-items:center;padding:14px 0;background:#0B1826;z-index:2}
.sheet-bar b{font-size:16px} .sheet-bar button{border:0;background:none;color:var(--accent);font:inherit;font-size:16px;cursor:pointer} .sheet-bar .save{font-weight:700}
fieldset{border:0;margin:0 0 18px;padding:0} legend{font-size:13px;color:var(--t2);padding:0 4px 6px;font-weight:600;width:100%;display:flex;justify-content:space-between;align-items:center}
legend button{border:0;background:none;color:var(--accent);font:inherit;font-size:13px;font-weight:600;cursor:pointer;padding:0}
.fbox{background:var(--surface);border-radius:14px;overflow:hidden}
.fbox+.fbox{margin-top:10px}
.f{display:flex;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--sep);min-height:46px}
.f:last-child{border-bottom:0}
.f label{flex:1;color:var(--t1);font-size:15px;white-space:nowrap}
.f input,.f select,.f textarea{flex:1.3;background:none;border:0;color:var(--accent);font:inherit;font-size:16px;text-align:right;min-width:0;outline:none;width:100%}
.f input[type=date]{text-align:right;-webkit-appearance:none;min-height:24px}
.f select{direction:rtl} .f select option{direction:ltr;background:#0E1E2E}
.f.full input,.f.full textarea{text-align:left;color:var(--t1)}
.f textarea{resize:vertical;min-height:64px;line-height:1.4}
.f .suf{color:var(--t3)}
.f input[type=checkbox]{flex:none;width:50px;height:30px;appearance:none;-webkit-appearance:none;background:rgba(255,255,255,.18);border-radius:20px;position:relative;transition:.2s;cursor:pointer}
.f input[type=checkbox]:checked{background:var(--pos)}
.f input[type=checkbox]::after{content:"";position:absolute;top:2px;left:2px;width:26px;height:26px;border-radius:50%;background:#fff;transition:.2s}
.f input[type=checkbox]:checked::after{left:22px}
.f.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;padding:8px 14px}
.f.grid .c{display:flex;flex-direction:column;gap:2px;min-width:0}
.f.grid .c span{font-size:11px;color:var(--t3)}
.f.grid .c input,.f.grid .c select{text-align:left;flex:none;font-size:15px;padding:4px 0;direction:ltr}
.poshead{display:flex;align-items:center;justify-content:space-between;padding:8px 14px;background:rgba(255,255,255,.04);font-size:12.5px;color:var(--t2)}
.poshead .grp{display:flex;gap:4px}
.poshead button{border:0;background:rgba(255,255,255,.07);color:var(--t2);width:30px;height:28px;border-radius:8px;cursor:pointer;font-size:14px;display:grid;place-items:center}
.poshead button svg{width:15px;height:15px}
.poshead button.del{color:var(--neg)}
.poshead b{color:var(--t1);font-variant-numeric:tabular-nums}
.picker{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.picker button{display:flex;justify-content:space-between;gap:10px;border:1px solid var(--sep);background:var(--surface);color:var(--t1);font:inherit;font-size:14px;padding:11px 14px;border-radius:12px;cursor:pointer;text-align:left}
.picker button span:last-child{color:var(--accent);white-space:nowrap}
.help{font-size:12px;color:var(--t3);padding:6px 4px 0;line-height:1.4}
.danger{width:100%;padding:13px;border-radius:14px;border:0;background:var(--surface);color:var(--neg);font:inherit;font-weight:600;cursor:pointer}
.btn{width:100%;padding:14px;border-radius:14px;border:0;background:linear-gradient(135deg,#003781,#0072B8);color:#fff;font:inherit;font-weight:600;font-size:15px;cursor:pointer}
.btn.ghost{background:var(--surface);color:var(--accent);border:1px solid var(--sep)}
.totals{background:linear-gradient(135deg,rgba(0,55,129,.55),rgba(0,114,184,.35));border:1px solid rgba(255,255,255,.1);border-radius:16px;padding:12px 16px}
.logo-prev{max-width:160px;max-height:60px;background:#fff;border-radius:8px;padding:6px}

/* A4-Vorschau des Belegs (weiß wie auf Papier) */
.a4wrap{position:relative;overflow:hidden;border-radius:10px;box-shadow:0 10px 30px rgba(0,0,0,.45)}
.a4{width:210mm;min-height:297mm;background:#fff;color:#1b1b1b;padding:14mm 20mm 12mm;font:9.5pt/1.4 Helvetica,Arial,sans-serif;transform-origin:0 0;position:absolute;left:0;top:0;display:flex;flex-direction:column}
.a4 .top{display:flex;justify-content:flex-end;align-items:flex-start;min-height:22mm}
.a4 .top img{max-height:18mm;max-width:60mm}
.a4 .co{font-size:15pt;font-weight:700;color:var(--doc);display:flex;align-items:flex-end;gap:8px}
.a4 .co .brand i{background:var(--doc)}
.a4 .addr{display:flex;justify-content:space-between;margin-top:11mm;gap:10mm}
.a4 .sender{font-size:6.8pt;color:#777;border-bottom:.2mm solid #bbb;padding-bottom:1mm;margin-bottom:2.5mm;white-space:nowrap}
.a4 .to{font-size:10.5pt;line-height:1.45;width:85mm}
.a4 .info{width:60mm;font-size:8.8pt;margin-top:6mm}
.a4 .info div{display:flex;justify-content:space-between;gap:4mm;padding:.4mm 0}
.a4 .info span{color:#777}
.a4 h2{font-size:15pt;color:var(--doc);margin:12mm 0 1mm}
.a4 .subj{font-weight:700;font-size:10.5pt}
.a4 .txt{white-space:pre-wrap;margin:4mm 0}
.a4 table{width:100%;border-collapse:collapse;margin-top:3mm;font-size:9pt}
.a4 th{text-align:left;font-size:8pt;color:var(--doc);border-bottom:.5mm solid var(--doc);padding:1.5mm 1mm;font-weight:700}
.a4 td{padding:2mm 1mm;border-bottom:.2mm solid #e2e2e2;vertical-align:top}
.a4 td.r,.a4 th.r{text-align:right;white-space:nowrap}
.a4 td .d{color:#666;font-size:8.3pt;white-space:pre-wrap;margin-top:.6mm}
.a4 .sum{margin-left:auto;width:78mm;margin-top:4mm;font-size:9.3pt}
.a4 .sum div{display:flex;justify-content:space-between;padding:.8mm 1mm}
.a4 .sum .tot{background:var(--doc);color:#fff;font-weight:700;font-size:11pt;padding:2mm 2.5mm;margin-top:1.5mm;border-radius:1mm}
.a4 .note{font-size:8.5pt;color:#555;margin-top:3mm}
.a4 .ft{margin-top:auto;padding-top:8mm;display:grid;grid-template-columns:repeat(3,1fr);gap:4mm;font-size:6.8pt;color:#666;border-top:.2mm solid #ccc;line-height:1.45}
.a4 .ph{color:#c0392b;font-style:italic}

/* PC: Seitenleiste statt Tab-Leiste, breitere Inhalte */
@media (min-width:900px){
  nav#tabs{left:16px;top:16px;bottom:16px;right:auto;width:228px;max-width:none;margin:0;flex-direction:column;justify-content:flex-start;gap:4px;padding:18px 12px;border-radius:24px}
  nav#tabs .navbrand{display:flex;align-items:center;gap:10px;padding:4px 10px 18px;font-weight:700;font-size:17px}
  nav#tabs .navfoot{display:block;margin-top:auto;padding:10px;font-size:12px;color:var(--t3)}
  nav#tabs button{flex:none;flex-direction:row;justify-content:flex-start;gap:12px;font-size:14.5px;padding:11px 14px;border-radius:14px}
  nav#tabs button svg{width:20px;height:20px}
  main{margin:0 0 0 260px;max-width:1120px;padding:24px 36px 48px}
  .toast{bottom:32px}
  #sheet{align-items:center}
  .sheet{max-width:780px;max-height:92vh;border-radius:22px;border:1px solid var(--sep)}
  .cols{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:start}
  .split{display:grid;grid-template-columns:minmax(320px,400px) 1fr;gap:22px;align-items:start}
  .split>.stack:first-child{position:sticky;top:24px}
  .metrics.four{grid-template-columns:repeat(4,1fr)}
}

/* Druck: nur der Beleg */
@media print{
  @page{size:A4;margin:0}
  body{background:#fff}
  body>*:not(#print){display:none!important}
  #print .a4{position:static;transform:none!important;box-shadow:none}
}
