/* =========================================================
   Buchhaltung – Design System (übernommen aus Immobilienverwaltung)
   Modern · clean · Indigo · Poppins
   ========================================================= */
:root{
  --primary:#3B2BBF; --primary-dark:#2A1D94; --primary-deep:#1F1573; --primary-soft:#ECEAFB;
  --bg:#F4F4FA; --surface:#fff; --text:#1B1A33; --muted:#8B8AA8; --muted-strong:#5E5D7C; --line:#E8E7F3;
  --red:#E5566D;   --red-soft:#FDECEF;
  --amber:#D98A14; --amber-soft:#FEF3E0;
  --blue:#2F6FED;  --blue-soft:#E8F0FE;
  --green:#1E9E75; --green-soft:#E4F7F0;
  --grey:#6F6E8C;  --grey-soft:#EEEEF6;
  --radius:16px; --radius-lg:24px;
  --shadow:0 10px 32px rgba(43,31,160,.08);
  --shadow-sm:0 2px 12px rgba(43,31,160,.06);

  --bs-body-font-family:'Poppins',system-ui,-apple-system,'Segoe UI',sans-serif;
  --bs-body-bg:var(--bg); --bs-body-color:var(--text);
  --bs-primary:#3B2BBF; --bs-primary-rgb:59,43,191; --bs-link-color:#3B2BBF;
}

*{ -webkit-tap-highlight-color:transparent; }
body{ font-family:var(--bs-body-font-family); background:var(--bg); color:var(--text); font-size:.94rem; -webkit-font-smoothing:antialiased; }
h1,h2,h3,h4,h5,h6{ font-weight:600; letter-spacing:-.015em; color:var(--text); }
h2{ font-size:1.55rem; } .h3,h3{ font-size:1.3rem; } h5{ font-size:1.05rem; }
a{ color:var(--primary); text-decoration:none; } a:hover{ color:var(--primary-dark); }
.text-muted{ color:var(--muted)!important; }
hr{ border-color:var(--line); opacity:1; }
.ic{ width:20px; height:20px; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; flex:none; }
.ic-sm{ width:16px; height:16px; }

/* ---------- App-Shell ---------- */
.app{ min-height:100vh; }
.sidebar{ display:none; }
.content{ max-width:1400px; margin:0 auto; padding:22px 18px 120px; }

.brand{ display:flex; align-items:center; gap:11px; font-weight:700; font-size:1.05rem; color:var(--text); letter-spacing:-.01em; }
.brand:hover{ color:var(--text); }
.brand small{ display:block; font-weight:500; font-size:.68rem; color:var(--muted); letter-spacing:.02em; margin-top:-2px; }
.brand-mark{ width:40px; height:40px; border-radius:13px; background:linear-gradient(135deg,#5747E0,var(--primary-dark)); color:#fff; display:grid; place-items:center; box-shadow:0 6px 16px rgba(59,43,191,.35); }

/* mobile top bar */
.topbar{ position:relative; overflow:hidden; background:linear-gradient(135deg,var(--primary-deep),var(--primary)); color:#fff; padding:calc(18px + env(safe-area-inset-top)) 20px 30px; border-radius:0 0 30px 30px; display:flex; align-items:center; justify-content:space-between; }
.topbar::after{ content:""; position:absolute; width:190px; height:190px; border-radius:50%; background:rgba(255,255,255,.07); right:-50px; top:-80px; }
.topbar .brand, .topbar .brand:hover{ color:#fff; position:relative; z-index:1; }
.topbar .brand small{ color:rgba(255,255,255,.65); }
.topbar .brand-mark{ background:rgba(255,255,255,.16); box-shadow:none; }
.topbar .menu-btn{ position:relative; z-index:1; width:42px; height:42px; border-radius:14px; border:0; background:rgba(255,255,255,.16); color:#fff; display:grid; place-items:center; }

/* mobile tab bar */
.tabbar{ position:fixed; left:12px; right:12px; bottom:calc(12px + env(safe-area-inset-bottom)); z-index:50; background:#fff; border-radius:26px; padding:8px; display:flex; gap:4px; box-shadow:0 14px 44px rgba(31,21,115,.22); }
.tabbar a{ flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; padding:9px 4px 8px; border-radius:19px; color:var(--muted); font-size:.68rem; font-weight:500; }
.tabbar a.active{ background:var(--primary-soft); color:var(--primary); }
.tabbar a .ic{ width:22px; height:22px; }

@media (min-width:992px){
  .app{ display:grid; grid-template-columns:272px 1fr; }
  .topbar,.tabbar{ display:none; }
  .sidebar{ display:flex; flex-direction:column; position:sticky; top:0; height:100vh; background:#fff; padding:26px 18px 20px; border-right:1px solid var(--line); }
  .content{ padding:36px 44px 60px; width:100%; }
  .nav-app{ margin-top:34px; display:flex; flex-direction:column; gap:6px; }
  .nav-app a{ display:flex; align-items:center; gap:13px; padding:12px 15px; border-radius:15px; color:var(--muted-strong); font-weight:500; transition:.15s; }
  .nav-app a:hover{ background:var(--bg); color:var(--text); }
  .nav-app a.active{ background:var(--primary); color:#fff; box-shadow:0 8px 20px rgba(59,43,191,.32); }
  .sidebar-foot{ margin-top:auto; background:var(--bg); border-radius:18px; padding:14px; display:flex; align-items:center; gap:12px; }
  .sidebar-foot .avatar{ width:38px; height:38px; border-radius:12px; background:var(--primary); color:#fff; display:grid; place-items:center; font-weight:600; flex:none; }
  .sidebar-foot .who{ min-width:0; flex:1; font-size:.78rem; line-height:1.25; }
  .sidebar-foot .who b{ display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; }
  .sidebar-foot button{ border:0; background:transparent; color:var(--muted-strong); padding:6px; border-radius:10px; }
  .sidebar-foot button:hover{ background:#fff; color:var(--red); }
}

/* ---------- Bausteine ---------- */
.card{ border:0; border-radius:var(--radius-lg); box-shadow:var(--shadow); background:var(--surface); overflow:hidden; }
.card-header{ background:transparent; border-bottom:1px solid var(--line); padding:16px 22px; font-size:.95rem; }
.card-body{ padding:22px; }
.card.text-center .card-header{ border-bottom:0; padding-bottom:0; }

.tile{ width:46px; height:46px; border-radius:15px; display:grid; place-items:center; flex:none; }
.tile-red{ background:var(--red-soft); color:var(--red); } .tile-amber{ background:var(--amber-soft); color:var(--amber); }
.tile-blue{ background:var(--blue-soft); color:var(--blue); } .tile-green{ background:var(--green-soft); color:var(--green); }
.tile-grey{ background:var(--grey-soft); color:var(--grey); } .tile-primary{ background:var(--primary-soft); color:var(--primary); }

.stat{ padding:18px; }
.stat .num{ font-size:2rem; font-weight:700; line-height:1.1; margin-top:16px; letter-spacing:-.02em; }
.stat .lbl{ color:var(--muted); font-size:.8rem; }

.item{ display:flex; align-items:center; gap:14px; padding:14px 16px; background:#fff; border-radius:20px; box-shadow:var(--shadow-sm); color:var(--text); transition:transform .15s, box-shadow .15s; }
a.item:hover, .item:hover{ transform:translateY(-1px); box-shadow:var(--shadow); color:var(--text); }
.item-main{ display:flex; align-items:center; gap:14px; flex:1; min-width:0; color:inherit; }
.item-main:hover{ color:inherit; }
.item-body{ flex:1; min-width:0; display:flex; flex-direction:column; }
.item-title{ font-weight:600; line-height:1.3; }
.item-sub{ color:var(--muted-strong); font-size:.82rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.item-meta{ color:var(--muted); font-size:.74rem; margin-top:2px; }
.item-end{ display:flex; flex-direction:column; align-items:flex-end; gap:6px; flex:none; }
.item-list{ display:flex; flex-direction:column; gap:12px; }
@media (max-width:575px){ .item-end .pill + .pill{ display:none; } }

.icon-btn{ border:0; background:transparent; color:var(--muted); padding:7px; border-radius:10px; display:inline-flex; }
.icon-btn:hover{ background:var(--red-soft); color:var(--red); }
/* Positionen verschieben: neutral statt rot, deaktiviert ausgegraut */
.icon-btn.hoch:hover, .icon-btn.runter:hover{ background:var(--line); color:var(--text); }
.icon-btn:disabled{ opacity:.3; pointer-events:none; }

.pill{ display:inline-block; border-radius:999px; padding:.32em .8em; font-size:.72rem; font-weight:600; white-space:nowrap; }
.pill-red{ background:var(--red-soft); color:var(--red); } .pill-amber{ background:var(--amber-soft); color:var(--amber); }
.pill-blue{ background:var(--blue-soft); color:var(--blue); } .pill-green{ background:var(--green-soft); color:var(--green); }
.pill-grey{ background:var(--grey-soft); color:var(--grey); }

.segmented{ display:inline-flex; background:#fff; padding:4px; border-radius:999px; box-shadow:var(--shadow-sm); }
.segmented a{ padding:8px 18px; border-radius:999px; color:var(--muted-strong); font-weight:500; font-size:.84rem; }
.segmented a.active{ background:var(--primary); color:#fff; box-shadow:0 6px 14px rgba(59,43,191,.3); }

.empty{ text-align:center; color:var(--muted); padding:44px 16px; }
.empty .tile{ margin:0 auto 12px; width:60px; height:60px; border-radius:20px; }

/* ---------- Bootstrap-Overrides ---------- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:.4rem; white-space:nowrap; border-radius:999px; font-weight:500; padding:.6rem 1.25rem; border-width:1.5px; font-size:.9rem; transition:.15s; }
.btn-sm{ padding:.34rem .85rem; font-size:.8rem; } .btn-lg{ padding:.9rem 1.6rem; font-size:1rem; font-weight:600; }
.btn-primary{ --bs-btn-color:#fff; --bs-btn-bg:var(--primary); --bs-btn-border-color:var(--primary); --bs-btn-hover-color:#fff; --bs-btn-hover-bg:var(--primary-dark); --bs-btn-hover-border-color:var(--primary-dark); --bs-btn-active-color:#fff; --bs-btn-active-bg:var(--primary-deep); --bs-btn-active-border-color:var(--primary-deep); --bs-btn-focus-shadow-rgb:59,43,191; --bs-btn-disabled-bg:var(--primary); --bs-btn-disabled-border-color:var(--primary); box-shadow:0 8px 20px rgba(59,43,191,.28); }
.btn-success{ --bs-btn-bg:var(--green); --bs-btn-border-color:var(--green); --bs-btn-hover-bg:#178563; --bs-btn-hover-border-color:#178563; --bs-btn-active-bg:#12694e; --bs-btn-active-border-color:#12694e; box-shadow:0 8px 20px rgba(30,158,117,.25); }
.btn-outline-primary{ --bs-btn-color:var(--primary); --bs-btn-border-color:#D9D5F6; --bs-btn-hover-bg:var(--primary-soft); --bs-btn-hover-color:var(--primary-dark); --bs-btn-hover-border-color:#D9D5F6; --bs-btn-active-bg:var(--primary-soft); --bs-btn-active-color:var(--primary-dark); --bs-btn-active-border-color:#D9D5F6; }
.btn-outline-secondary{ --bs-btn-color:var(--muted-strong); --bs-btn-border-color:var(--line); --bs-btn-hover-bg:var(--bg); --bs-btn-hover-color:var(--text); --bs-btn-hover-border-color:var(--line); --bs-btn-active-bg:var(--bg); --bs-btn-active-color:var(--text); --bs-btn-active-border-color:var(--line); background:#fff; }
.btn-danger{ --bs-btn-color:#fff; --bs-btn-bg:var(--red); --bs-btn-border-color:var(--red); --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#D4435A; --bs-btn-hover-border-color:#D4435A; --bs-btn-active-color:#fff; --bs-btn-active-bg:#C23A50; --bs-btn-active-border-color:#C23A50; --bs-btn-disabled-bg:var(--red); --bs-btn-disabled-border-color:var(--red); box-shadow:0 8px 20px rgba(229,86,109,.28); }
.btn-outline-danger{ --bs-btn-color:var(--red); --bs-btn-border-color:#F6D3D9; --bs-btn-hover-bg:var(--red-soft); --bs-btn-hover-color:var(--red); --bs-btn-hover-border-color:#F6D3D9; --bs-btn-active-bg:var(--red-soft); --bs-btn-active-color:var(--red); --bs-btn-active-border-color:#F6D3D9; }
.btn-link{ color:var(--muted-strong); text-decoration:none; }

.form-label{ font-size:.8rem; font-weight:500; color:var(--muted-strong); margin-bottom:.35rem; }
.form-control,.form-select{ border-radius:14px; border:1.5px solid var(--line); background-color:#fff; padding:.72rem .95rem; font-size:.92rem; color:var(--text); }
.form-control::placeholder{ color:#B4B3C9; }
.form-control:focus,.form-select:focus{ border-color:var(--primary); box-shadow:0 0 0 4px rgba(59,43,191,.12); }
textarea.form-control{ min-height:110px; }
.form-check-input{ border-color:#C9C7E6; width:1.15em; height:1.15em; }
.form-check-input:checked{ background-color:var(--primary); border-color:var(--primary); }
.form-check-input:focus{ box-shadow:0 0 0 4px rgba(59,43,191,.12); border-color:var(--primary); }
.form-text{ color:var(--muted); font-size:.76rem; }
.text-danger{ color:var(--red)!important; font-size:.8rem; }

.table{ --bs-table-bg:transparent; --bs-table-hover-bg:#F8F8FD; --bs-table-border-color:var(--line); margin:0; }
.table thead th{ font-size:.68rem; text-transform:uppercase; letter-spacing:.07em; color:var(--muted); font-weight:600; border-bottom:1px solid var(--line); padding:14px 18px; background:transparent; }
.table td{ padding:14px 18px; border-color:var(--line); vertical-align:middle; }
.table-hover>tbody>tr:hover>*{ --bs-table-accent-bg:#F8F8FD; }
.table tbody tr:last-child td{ border-bottom:0; }

.alert{ border:0; border-radius:16px; padding:14px 18px; font-size:.88rem; }
.alert-success{ background:var(--green-soft); color:#0F7A57; } .alert-danger{ background:var(--red-soft); color:#C23A52; } .alert-warning{ background:var(--amber-soft); color:#9A6208; }
.badge{ border-radius:999px; font-weight:600; padding:.42em .85em; }
.badge.text-bg-secondary{ background:var(--grey-soft)!important; color:var(--grey)!important; }
.badge.text-bg-light{ background:var(--grey-soft)!important; color:var(--grey)!important; border:0!important; }

.list-group-item{ border-color:var(--line); padding:14px 22px; }
.dropdown-menu{ border:0; border-radius:18px; box-shadow:var(--shadow); padding:8px; }
.dropdown-item{ border-radius:12px; padding:10px 14px; font-size:.9rem; }

/* Bestätigungs-Popup (data-confirm) */
.confirm-modal .modal-dialog{ max-width:400px; padding:0 16px; margin-inline:auto; }
.confirm-modal .modal-content{ border:0; border-radius:var(--radius-lg); box-shadow:0 30px 80px rgba(31,21,115,.28); }
.confirm-modal .modal-body{ padding:30px 26px 24px; text-align:center; }
.confirm-modal .tile{ width:60px; height:60px; border-radius:20px; margin:0 auto 16px; }
.confirm-modal .tile .ic{ width:26px; height:26px; }
.confirm-titel{ font-size:1.1rem; font-weight:600; margin:0 0 6px; color:var(--text); }
.confirm-text{ color:var(--muted-strong); font-size:.9rem; margin:0 0 22px; }
.confirm-actions{ display:flex; gap:10px; }
.confirm-actions .btn{ flex:1; }
.confirm-actions .btn-light{ --bs-btn-bg:var(--grey-soft); --bs-btn-border-color:var(--grey-soft); --bs-btn-color:var(--muted-strong); --bs-btn-hover-bg:var(--line); --bs-btn-hover-border-color:var(--line); }
.modal-backdrop.show{ opacity:.35; background:var(--primary-deep); }
.dropdown-item:active{ background:var(--primary); }
dl dt{ color:var(--muted); font-weight:500; font-size:.8rem; }
dl dd{ margin-bottom:.7rem; }

/* ---------- Login ---------- */
.auth{ min-height:100vh; display:grid; place-items:center; padding:24px; background:radial-gradient(900px 500px at 15% -10%,#6656F0 0%,transparent 60%),linear-gradient(160deg,var(--primary-deep),var(--primary)); }
.auth-card{ background:#fff; border-radius:30px; padding:34px 30px; width:100%; max-width:420px; box-shadow:0 40px 90px rgba(0,0,0,.28); }
.auth-card .brand{ justify-content:center; margin-bottom:22px; flex-direction:column; text-align:center; gap:12px; }
.auth-card h1{ font-size:1.35rem; text-align:center; margin-bottom:4px; }

/* ---------- Sidebar-Konto ---------- */
.sidebar-konto{ display:flex; align-items:center; gap:12px; min-width:0; flex:1; color:inherit; text-decoration:none; border-radius:12px; }
.sidebar-konto:hover{ color:var(--primary); }

/* ---------- Mandanten-Switch ---------- */
.mandant-switch{ margin-top:22px; }
.mandant-btn{ width:100%; display:flex; align-items:center; gap:11px; padding:11px 13px; border:1.5px solid var(--line); border-radius:16px; background:#fff; color:var(--text); text-align:left; transition:.15s; }
.mandant-btn:hover, .mandant-btn[aria-expanded="true"]{ border-color:var(--primary); background:var(--primary-soft); }
.mandant-btn .tile{ width:34px; height:34px; border-radius:11px; }
.mandant-btn .tile .ic{ width:17px; height:17px; }
.mandant-btn .txt{ flex:1; min-width:0; line-height:1.2; }
.mandant-btn .txt small{ display:block; color:var(--muted); font-size:.68rem; font-weight:500; text-transform:uppercase; letter-spacing:.06em; }
.mandant-btn .txt b{ display:block; font-weight:600; font-size:.86rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mandant-switch .dropdown-menu{ width:100%; max-height:60vh; overflow-y:auto; }
.mandant-switch .dropdown-item.active, .topbar .dropdown-item.active{ background:var(--primary-soft); color:var(--primary); font-weight:600; }
.dropdown-header{ font-size:.68rem; text-transform:uppercase; letter-spacing:.07em; color:var(--muted); font-weight:600; }
.nav-gruppe{ margin:18px 0 4px 15px; font-size:.66rem; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); font-weight:600; }

/* Mandanten-Auswahl (Kacheln) */
.mandant-kachel{ display:flex; align-items:center; gap:14px; width:100%; padding:18px; border:0; border-radius:20px; background:#fff; box-shadow:var(--shadow-sm); text-align:left; color:var(--text); transition:transform .15s, box-shadow .15s; }
.mandant-kachel:hover{ transform:translateY(-1px); box-shadow:var(--shadow); }

/* Seitenkopf */
.seitenkopf{ display:flex; flex-wrap:wrap; gap:12px; justify-content:space-between; align-items:center; margin-bottom:22px; }
.seitenkopf h2{ margin:0; }
.seitenkopf .sub{ color:var(--muted); font-size:.85rem; }
.betrag{ font-variant-numeric:tabular-nums; text-align:right; white-space:nowrap; }

@media print{ .sidebar, .topbar, .tabbar, .btn{ display:none !important; } }

/* ---------- Belegerfassung ---------- */
.pos-tabelle td{ padding:8px 6px; vertical-align:top; }
.pos-tabelle th{ padding:10px 6px; }
.pos-tabelle .form-control, .pos-tabelle .form-select{ padding:.5rem .65rem; font-size:.86rem; border-radius:11px; }
.pos-tabelle .calc{ padding-top:.95rem; font-size:.86rem; color:var(--muted-strong); }
.pos-tabelle tfoot td{ border-bottom:0; font-weight:600; }

/* Formatierter Text (Quill) */
.rt-editor{ font-family:inherit; font-size:.92rem; background:#fff; }
/* Quill setzt height:100% – im Raster würde der Editor dadurch über die Nachbarfelder wachsen */
.ql-container.rt-editor, .pos-tabelle .ql-container{ height:auto; }
.ql-toolbar.ql-snow{ border-color:var(--line); border-radius:11px 11px 0 0; font-family:inherit; }
.ql-container.ql-snow{ border-color:var(--line); border-radius:0 0 11px 11px; font-family:inherit; }
.rt-titel .ql-editor{ min-height:0; padding:.55rem .75rem; }
.rt-text .ql-editor{ min-height:110px; }
.rt-zweck .ql-editor{ min-height:70px; }
.ql-editor.ql-blank::before{ font-style:normal; color:var(--muted); }
/* In den Rechnungspositionen: Bubble-Theme (Werkzeugleiste beim Markieren), wie ein Eingabefeld */
.pos-tabelle .ql-container.ql-bubble{ border:1px solid var(--line); border-radius:11px; font-family:inherit; font-size:.86rem; background:#fff; }
.pos-tabelle .ql-bubble .ql-editor{ padding:.45rem .65rem; min-height:0; }
.pos-tabelle .rt-pos-text .ql-editor{ min-height:2.2rem; font-size:.82rem; color:var(--muted-strong); }
.pos-tabelle .ql-bubble .ql-tooltip{ z-index:20; }
/* Benutzer & Rechte: Matrix */
.rechte-matrix th.fokus, .rechte-matrix td.fokus{ background:#F4F2FE; }
.rechte-matrix .rolle-wahl{ min-width:110px; }
.rechte-matrix .rolle-wahl.geaendert{ border-color:#E0A100; box-shadow:0 0 0 2px rgba(224,161,0,.18); }

/* Rechnungspositionen: kompakte Liste, Bearbeiten im Popup */
.pos-liste .pos-bez{ cursor:pointer; min-width:220px; }
.pos-liste .anz-text{ max-width:520px; }
.pos-liste td{ vertical-align:top; padding-top:.7rem; padding-bottom:.7rem; }
.icon-btn.bearbeiten:hover{ background:var(--line); color:var(--text); }
.artikel-eintrag[hidden]{ display:none; }
.rt-anzeige p{ margin:0; }
.rt-anzeige ul, .rt-anzeige ol{ margin:0; padding-left:1.2rem; }
.differenz-ok{ color:var(--green); } .differenz-falsch{ color:var(--red); }
.ac-wrap{ position:relative; }
.ac-liste{ position:absolute; z-index:30; left:0; right:0; top:100%; margin-top:4px; background:#fff; border-radius:14px; box-shadow:var(--shadow); padding:6px; max-height:280px; overflow-y:auto; }
.ac-liste[hidden]{ display:none; }
.ac-liste button{ display:block; width:100%; text-align:left; border:0; background:transparent; padding:8px 10px; border-radius:10px; font-size:.88rem; }
.ac-liste button:hover, .ac-liste button.aktiv{ background:var(--primary-soft); color:var(--primary); }
.ac-gewaehlt{ display:flex; align-items:center; gap:10px; padding:.6rem .9rem; border:1.5px solid var(--primary); background:var(--primary-soft); border-radius:14px; }
.ac-gewaehlt b{ flex:1; }
.segmented label{ padding:8px 18px; border-radius:999px; color:var(--muted-strong); font-weight:500; font-size:.84rem; cursor:pointer; margin:0; }
.segmented input{ position:absolute; opacity:0; pointer-events:none; }
.segmented input:checked + label{ background:var(--primary); color:#fff; box-shadow:0 6px 14px rgba(59,43,191,.3); }
.journal-kopf td{ background:var(--bg); font-weight:600; font-size:.84rem; }
.journal-zeile td{ font-size:.86rem; padding-top:8px!important; padding-bottom:8px!important; }
.verlauf li{ font-size:.82rem; padding:6px 0; border-bottom:1px solid var(--line); }
.verlauf li:last-child{ border-bottom:0; }

/* ---------- Beleg-Upload / KI ---------- */
.dropzone{ display:flex; align-items:center; gap:14px; padding:18px; border:2px dashed #D9D5F6; border-radius:18px; background:var(--primary-soft); cursor:pointer; transition:.15s; margin:0; }
.dropzone:hover, .dropzone.ueber{ border-color:var(--primary); background:#E2DEFA; }
.beleg-vorschau{ position:sticky; top:16px; }
.vorschau-inhalt{ background:var(--bg); height:calc(100vh - 140px); min-height:420px; overflow:auto; display:flex; align-items:flex-start; justify-content:center; }
.vorschau-inhalt img{ max-width:100%; height:auto; display:block; }
.vorschau-inhalt iframe{ width:100%; height:100%; border:0; }
@media (max-width:1199px){ .beleg-vorschau{ position:static; } .vorschau-inhalt{ height:60vh; } }
.ki-unsicher, .form-control.ki-unsicher, .form-select.ki-unsicher{ background-color:#FFF6D6 !important; border-color:#E8B931 !important; }
.segmented.ki-unsicher{ box-shadow:0 0 0 2px #E8B931; }
.ki-box{ display:flex; gap:12px; align-items:flex-start; padding:14px 16px; border-radius:16px; font-size:.88rem; }
.ki-box.laedt{ background:var(--primary-soft); color:var(--primary-dark); }
.ki-box.ok{ background:var(--green-soft); color:#0F7A57; }
.ki-box.warn{ background:var(--amber-soft); color:#8A5A0B; }
.ki-box .spinner-border{ width:1.2rem; height:1.2rem; border-width:.18em; flex:none; margin-top:2px; }
.ki-box ul{ margin:6px 0 0; padding-left:1.1rem; }

/* ---------- Kopfleiste (Desktop): Firmenwechsel + Benutzermenü oben rechts ---------- */
.kopfleiste{ display:none; }
.kopf-btn{ display:flex; align-items:center; gap:10px; padding:7px 12px 7px 8px; border:1.5px solid var(--line); border-radius:15px; background:#fff; color:var(--text); text-align:left; max-width:320px; transition:.15s; }
.kopf-btn:hover, .kopf-btn[aria-expanded="true"]{ border-color:var(--primary); background:var(--primary-soft); }
.kopf-btn .tile{ width:32px; height:32px; border-radius:10px; }
.kopf-btn .tile .ic{ width:16px; height:16px; }
.kopf-btn .avatar{ width:32px; height:32px; border-radius:10px; background:var(--primary); color:#fff; display:grid; place-items:center; font-weight:600; flex:none; }
.kopf-txt{ min-width:0; line-height:1.15; }
.kopf-txt small{ display:block; color:var(--muted); font-size:.66rem; font-weight:500; text-transform:uppercase; letter-spacing:.06em; }
.kopf-txt b{ display:block; font-weight:600; font-size:.86rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kopf-menue{ min-width:260px; max-height:70vh; overflow-y:auto; }
.kopf-menue .dropdown-item.active{ background:var(--primary-soft); color:var(--primary); font-weight:600; }
@media (min-width:992px){
  .kopfleiste{ display:flex; justify-content:flex-end; align-items:center; gap:10px; padding:16px 44px 0; max-width:1400px; margin:0 auto; width:100%; }
  .content{ padding-top:18px; }
  /* Kompakte Navigation: passt ohne Scrollen auf Laptop-Bildschirme; Scrollen nur als Notfall bei sehr kleinen Fenstern */
  .sidebar{ overflow-y:auto; padding-top:22px; }
  .nav-app{ margin-top:22px; gap:2px; }
  .nav-app a{ padding:8px 14px; border-radius:12px; font-size:.9rem; }
  .nav-app a .ic{ width:18px; height:18px; }
  .nav-gruppe{ margin:12px 0 3px 14px; }
}

/* Mobiles Menü: nie höher als der Bildschirm */
.topbar .dropdown-menu{ max-height:calc(100vh - 110px); overflow-y:auto; }

/* ---------- Kontenplan: aufklappbare Kontenklassen ---------- */
.klasse-kopf td{ background:var(--bg) !important; font-size:.85rem; font-weight:600; color:var(--text); cursor:pointer; user-select:none; }
.klasse-kopf:hover td{ background:var(--primary-soft) !important; color:var(--primary); }
.klasse-kopf:focus-visible{ outline:2px solid var(--primary); outline-offset:-2px; }
.klasse-pfeil{ margin-right:6px; vertical-align:-2px; transition:transform .15s; }
.kontenklasse.zu .klasse-pfeil{ transform:rotate(-90deg); }
.kontenklasse.zu tr:not(.klasse-kopf){ display:none; }

/* ---------- Berichte: Bilanz, Erfolgsrechnung, MWST ---------- */
.bericht .table td{ border-color:var(--line); }
.bericht .b-titel td{ font-size:1.02rem; font-weight:700; color:var(--primary); background:var(--bg); padding-top:14px; }
.bericht .b-gruppe td{ font-weight:600; }
.bericht .b-position td{ color:var(--text); }
.bericht .b-konto td{ font-size:.82rem; color:var(--muted); padding-top:4px; padding-bottom:4px; }
.bericht .b-konto a{ color:inherit; }
.bericht .b-konto a:hover{ color:var(--primary); }
.bericht:not(.mit-konten) .b-konto{ display:none; }
.bericht .b-zwischentotal td{ font-weight:600; border-top:1.5px solid var(--text); background:var(--primary-soft); }
.bericht .b-total td{ font-weight:700; font-size:1.02rem; border-top:2px solid var(--text); border-bottom:3px double var(--text); }
.bericht .text-muted-b{ color:var(--muted); }

/* ---------- Übersicht: Kennzahlen und «Zu erledigen» ---------- */
.kpi{ display:block; padding:18px; height:100%; transition:.15s; }
.kpi:hover{ transform:translateY(-2px); }
.kpi .tile{ margin-bottom:14px; }
.kpi .lbl{ color:var(--muted); font-size:.8rem; font-weight:500; }
.kpi .num{ font-size:1.6rem; font-weight:700; line-height:1.2; letter-spacing:-.02em; font-variant-numeric:tabular-nums; margin:2px 0; }
.kpi .sub{ font-size:.78rem; color:var(--muted); }
.aufgaben .tile{ width:38px; height:38px; flex:none; }
.diagramm{ width:100%; height:auto; display:block; }
.diagramm .gitter{ stroke:var(--line); stroke-width:1; }
.diagramm .achse{ fill:var(--muted); font-size:11px; font-family:inherit; }
.diagramm .balken-ertrag{ fill:var(--green); }
.diagramm .balken-aufwand{ fill:var(--red); opacity:.75; }
.diagramm .zukunft{ opacity:.35; }
.diagramm g:hover rect{ filter:brightness(.9); }
.legende{ display:inline-block; width:10px; height:10px; border-radius:3px; margin-right:6px; vertical-align:-1px; }
.letzte-buchungen .list-group-item{ padding:10px 16px; }
.letzte-buchungen a:hover .text-truncate{ color:var(--primary); }
@media (max-width:575.98px){
  .kpi{ padding:14px; }
  .kpi .tile{ width:34px; height:34px; margin-bottom:10px; }
  .kpi .num{ font-size:1.15rem; }
  .kpi .lbl, .kpi .sub{ font-size:.72rem; }
}

/* ---------- Bankimport ---------- */
.bank-tabelle td{ vertical-align:top; }
.bank-andere summary{ cursor:pointer; color:var(--primary); width:max-content; }
.bank-andere[open] summary{ margin-bottom:2px; }
.nav-pills .nav-link{ color:var(--primary); border-radius:12px; }
.nav-pills .nav-link.active{ background:var(--primary); }

@media (min-width:992px){
  .nav-app a{ padding:7px 14px; }
  .nav-gruppe{ margin:10px 0 2px 14px; }
}
