/* =====================================================================
   Kontora · Design-System
   Dark SaaS · Primärblau #1a56ff · strothmann.online-Stil
   ===================================================================== */

:root {
    --blue:        #1a56ff;
    --blue-soft:   #2f6bff;
    --blue-600:    #1546d6;
    --blue-dim:    rgba(26, 86, 255, 0.14);
    --blue-glow:   rgba(26, 86, 255, 0.40);

    --bg:          #0a0d18;
    --bg-2:        #0f1320;
    --surface:     #141a2b;
    --surface-2:   #172036;
    --surface-3:   #1f2942;
    --border:      #243049;
    --border-soft: #1c2538;

    --text:        #eef2fb;
    --text-soft:   #9aa6c4;
    --text-dim:    #6b7799;

    --success:     #2fd081;
    --info:        #2f6bff;
    --warning:     #f5b23d;
    --danger:      #ff5d6c;

    --radius:      14px;
    --radius-sm:   10px;
    --radius-lg:   20px;

    --shadow:      0 12px 40px rgba(0, 0, 0, 0.45);
    --shadow-sm:   0 4px 16px rgba(0, 0, 0, 0.3);

    --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --display: 'Sora', var(--sans);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--sans);
    background:
        radial-gradient(1000px 560px at 82% -10%, rgba(26, 86, 255, 0.20), transparent 58%),
        radial-gradient(820px 480px at -8% 8%, rgba(20, 56, 168, 0.12), transparent 55%),
        var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

/* ---------- App-Shell ---------- */
.app-shell { display: grid; grid-template-columns: 264px 1fr; grid-template-areas: "side main"; min-height: 100vh; }

.sidebar {
    grid-area: side;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
    border-right: 1px solid var(--border-soft);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand-mark {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    font-family: var(--display); font-weight: 800; font-size: 20px; color: #fff;
    background: linear-gradient(135deg, #1a56ff, #0c2e9e);
    box-shadow: 0 8px 24px var(--blue-glow);
}
.brand-text { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--radius-sm);
    color: var(--text-soft); font-weight: 500; font-size: 14.5px;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.is-active {
    background: linear-gradient(90deg, rgba(26, 86, 255, 0.18), rgba(26, 86, 255, 0.05));
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(26, 86, 255, 0.3);
}
.nav-ic { width: 20px; height: 20px; display: grid; place-items: center; flex-shrink: 0; }
.nav-ic svg { width: 19px; height: 19px; }

/* Gruppierte Navigation (Untermenüs per <details>) */
.nav-group { border-radius: var(--radius-sm); }
.nav-group-head { cursor: pointer; list-style: none; user-select: none; }
.nav-group-head::-webkit-details-marker { display: none; }
.nav-grp-label { flex: 1; }
.nav-caret { margin-left: auto; opacity: .45; display: grid; place-items: center; transition: transform .18s ease; }
.nav-caret svg { width: 15px; height: 15px; }
.nav-group[open] > .nav-group-head .nav-caret { transform: rotate(90deg); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px; padding-left: 10px;
           border-left: 1px solid var(--border-soft); margin-left: 21px; }
.nav-sublink { padding: 8px 10px; font-size: 13.5px; }
.nav-sublink .nav-ic { width: 17px; height: 17px; opacity: .8; }
.nav-sublink .nav-ic svg { width: 16px; height: 16px; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.nav-muted { color: var(--text-dim); }
.ver { font-size: 11px; color: var(--text-dim); padding: 10px 12px 0; letter-spacing: .04em; }

/* ---------- Main ---------- */
.main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 34px 18px;
}
.eyebrow {
    display: inline-block;
    font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
    color: var(--blue-soft);
    background: var(--blue-dim);
    border: 1px solid rgba(47, 107, 255, 0.3);
    padding: 5px 12px; border-radius: 999px;
    margin-bottom: 10px;
}
.page-title { font-family: var(--display); font-size: 27px; font-weight: 600; letter-spacing: -0.02em; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text-soft); display: grid; place-items: center;
    transition: border-color .15s, color .15s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--text); border-color: var(--blue); }
.avatar {
    width: 40px; height: 40px; border-radius: 11px;
    background: linear-gradient(135deg, #1a56ff, #0c2e9e);
    color: #fff; font-weight: 600; display: grid; place-items: center;
    box-shadow: 0 4px 14px var(--blue-glow);
}

.content { padding: 8px 34px 40px; flex: 1; }

.app-foot {
    display: flex; justify-content: space-between;
    padding: 18px 34px; border-top: 1px solid var(--border-soft);
    color: var(--text-dim); font-size: 12.5px;
}
.app-foot a { color: var(--text-soft); }
.app-foot a:hover { color: var(--blue); }

/* ---------- Flash ---------- */
.flash-stack { padding: 0 34px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.flash {
    padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    border: 1px solid var(--border);
}
.flash-success { background: rgba(45, 212, 167, 0.1); border-color: rgba(45, 212, 167, 0.3); color: #7defcf; }
.flash-error   { background: rgba(255, 93, 108, 0.1); border-color: rgba(255, 93, 108, 0.3); color: #ffaab2; }
.flash-info    { background: rgba(77, 155, 255, 0.1); border-color: rgba(77, 155, 255, 0.3); color: #a8cdff; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.card-lg { padding: 26px; border-radius: var(--radius-lg); }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* KPI-Karten */
.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-label { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.kpi-value { font-family: var(--display); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; }
.kpi-row { display: flex; align-items: baseline; justify-content: space-between; }
.kpi-trend { font-size: 12.5px; font-weight: 600; }
.kpi-up   { color: var(--success); }
.kpi-down { color: var(--danger); }
.kpi-spark { height: 36px; margin-top: 2px; }
.kpi-spark svg { width: 100%; height: 100%; }

/* Sektionskopf */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }
.section-head h2 { font-family: var(--display); font-size: 18px; font-weight: 600; }
.section-head .eyebrow { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-sm); cursor: pointer;
    font-family: var(--sans); font-size: 14px; font-weight: 600;
    border: 1px solid transparent; transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
    background: linear-gradient(135deg, var(--blue), #3d6bff);
    color: #fff; box-shadow: 0 8px 22px var(--blue-glow);
}
.btn-primary:hover { box-shadow: 0 10px 30px var(--blue-glow); }
.btn-ghost {
    background: var(--surface-2); color: var(--text); border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--blue); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-soft); }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 14px; }
table.data thead th {
    text-align: left; padding: 13px 18px; color: var(--text-dim);
    font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
table.data tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--surface-2); }
.t-right { text-align: right; }
.t-mono { font-variant-numeric: tabular-nums; }
.t-strong { font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
    border: 1px solid transparent;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-neutral { color: var(--text-soft); background: var(--surface-3); }
.badge-info    { color: var(--info);    background: rgba(47, 107, 255, 0.14); }
.badge-success { color: var(--success); background: rgba(47, 208, 129, 0.12); }
.badge-danger  { color: var(--danger);  background: rgba(255, 93, 108, 0.12); }

/* ---------- Formulare ---------- */
.form-grid { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-soft); }
.field input, .field select, .field textarea {
    width: 100%; min-width: 0; box-sizing: border-box;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 14px; color: var(--text); font-family: var(--sans); font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 44px; line-height: 1.5; }
.field input[type=file] { padding: 9px 12px; font-size: 13px; color: var(--text-soft); }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26, 86, 255, 0.15);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row > * { min-width: 0; }
.field-row.triple { grid-template-columns: 1fr 1fr 1fr; }
.form-sec { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-dim); margin: 12px 0 -4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* ---------- Empty State ---------- */
.empty {
    text-align: center; padding: 56px 20px; color: var(--text-dim);
}
.empty-ic {
    width: 56px; height: 56px; margin: 0 auto 16px; border-radius: 16px;
    background: var(--surface-2); border: 1px solid var(--border);
    display: grid; place-items: center; color: var(--blue);
}
.empty-ic svg { width: 26px; height: 26px; }
.empty h3 { font-family: var(--display); font-size: 17px; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 14px; max-width: 380px; margin: 0 auto 18px; }

/* Demo-Hinweis */
.demo-note {
    font-size: 12px; color: var(--warning);
    background: rgba(245, 181, 61, 0.08); border: 1px solid rgba(245, 181, 61, 0.25);
    border-radius: var(--radius-sm); padding: 9px 13px; margin-bottom: 18px;
    display: inline-flex; align-items: center; gap: 8px;
}

/* ---------- Auth ---------- */
.auth-wrap { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.auth-card {
    width: 100%; max-width: 408px;
    background: var(--surface); border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg); padding: 38px 34px; box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 8px; }
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-head h1 { font-family: var(--display); font-size: 23px; font-weight: 600; margin-top: 14px; }
.auth-head p { color: var(--text-dim); font-size: 14px; margin-top: 6px; }
.auth-card .btn { width: 100%; justify-content: center; margin-top: 6px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 13.5px; color: var(--text-dim); }
.auth-alt a { color: var(--blue); font-weight: 600; }

/* ---------- Responsive ---------- */
/* Hamburger nur mobil; Checkbox + Backdrop dauerhaft AUS dem Grid-Fluss,
   damit das Shell-Grid (Sidebar | Inhalt) nie durch Zusatz-Elemente verrutscht. */
.nav-toggle-cb { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.nav-toggle { display: none; }
.nav-backdrop {
    position: fixed; inset: 0; z-index: 1290;
    background: rgba(6, 9, 18, .58); opacity: 0; pointer-events: none;
    transition: opacity .26s;
}

/* ================= Responsive ================= */
@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .content { padding: 8px 22px 36px; }
    .topbar { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 900px) {
    /* Off-canvas-Sidebar via Hamburger (reine CSS-Checkbox, kein JS) */
    .app-shell { grid-template-columns: 1fr; grid-template-areas: "main"; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; width: 272px; max-width: 84vw;
        z-index: 1300; overflow-y: auto;
        transform: translateX(-100%); transition: transform .26s cubic-bezier(.4, 0, .2, 1);
        box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .6);
    }
    #nav-toggle:checked ~ .sidebar { transform: none; }
    #nav-toggle:checked ~ .nav-backdrop { opacity: 1; pointer-events: auto; }
    .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px; border-radius: 10px; flex: none;
        background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); cursor: pointer;
    }
    .nav-toggle:hover { color: var(--text); border-color: var(--blue); }
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .page-title { font-size: 20px; }
}

@media (max-width: 760px) {
    .grid-4 { grid-template-columns: 1fr; }
    .learn-stats { grid-template-columns: repeat(2, 1fr); }
    .content, .topbar, .flash-stack { padding-left: 16px; padding-right: 16px; }
    .field-row, .field-row.triple { grid-template-columns: 1fr; }
    /* Tabellen horizontal scrollbar machen */
    .card:has(> .data) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data { min-width: 560px; }
    /* Zwei-Spalten-Layouts (z. B. Belege Upload|Liste) stapeln */
    .grid[style*="360px"], .grid[style*="320px"] { grid-template-columns: 1fr !important; }
    .app-foot { flex-direction: column; gap: 6px; align-items: flex-start; }
}

@media (max-width: 460px) {
    .learn-stats { grid-template-columns: 1fr; }
    .content { padding-left: 13px; padding-right: 13px; }
    .topbar { padding-top: 14px; padding-bottom: 14px; }
}

/* ---------- sevDesk-Import: schwebendes Status-Kästchen ---------- */
.sev-fab{
    position:fixed; right:22px; bottom:22px; z-index:1200;
    width:300px; max-width:calc(100vw - 32px);
    display:flex; gap:13px; align-items:center;
    padding:14px 16px;
    background:linear-gradient(180deg,#1b2238,#141a2b);
    border:1px solid #2b3552; border-radius:15px;
    box-shadow:0 20px 44px -14px rgba(0,0,0,.62), inset 0 1px 0 rgba(255,255,255,.03);
    color:#e8edf7; cursor:pointer;
    transform:translateY(150%); opacity:0; pointer-events:none;
    transition:transform .38s cubic-bezier(.2,.8,.2,1), opacity .38s;
}
.sev-fab.on{ transform:translateY(0); opacity:1; pointer-events:auto; }
.sev-fab:hover{ border-color:#3a4670; }
.sev-fab-ic{
    position:relative; width:36px; height:36px; flex:0 0 36px; border-radius:10px;
    display:grid; place-items:center;
    background:rgba(26,86,255,.16); color:#5b8cff;
}
.sev-fab-ic svg{ position:absolute; width:19px; height:19px; }
.sev-fab-ic > svg:first-child{ animation:sevSpin 1.05s linear infinite; }
.sev-fab-ic-ok, .sev-fab-ic-err{ display:none; }
.sev-fab.done .sev-fab-ic{ background:rgba(34,197,94,.16); color:#34d27e; }
.sev-fab.failed .sev-fab-ic{ background:rgba(229,72,77,.16); color:#ef5a5f; }
.sev-fab.done .sev-fab-ic > svg:first-child,
.sev-fab.failed .sev-fab-ic > svg:first-child{ display:none; }
.sev-fab.done .sev-fab-ic-ok{ display:block; }
.sev-fab.failed .sev-fab-ic-err{ display:block; }
.sev-fab-body{ flex:1; min-width:0; }
.sev-fab-top{ display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.sev-fab-title{ font-size:13px; font-weight:600; letter-spacing:.01em; }
.sev-fab-pct{ font-size:12px; color:#9fb0cc; font-variant-numeric:tabular-nums; }
.sev-fab-bar{ height:6px; border-radius:99px; background:#222a40; margin:9px 0 7px; overflow:hidden; }
.sev-fab-bar > span{ display:block; height:100%; width:0; border-radius:99px;
    background:linear-gradient(90deg,#1a56ff,#4f86ff); transition:width .5s ease; }
.sev-fab.done .sev-fab-bar > span{ background:linear-gradient(90deg,#16a34a,#34d27e); }
.sev-fab.failed .sev-fab-bar > span{ background:linear-gradient(90deg,#e5484d,#ef6065); }
.sev-fab-detail{ font-size:12px; color:#d4deef; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sev-fab-eta{ font-size:11px; color:#6f86ff; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sev-fab.done .sev-fab-eta{ color:#34d27e; }
.sev-fab.failed .sev-fab-eta{ color:#ef6065; }
@keyframes sevSpin{ to{ transform:rotate(360deg); } }
@media (max-width:560px){ .sev-fab{ right:12px; bottom:12px; left:12px; width:auto; } }

/* ---------- Belege-Seite (zuvor inline in receipts.php) ---------- */
.learn-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:1px;background:var(--border-soft);padding:0;overflow:hidden;}
.ls-item{padding:18px 22px;background:var(--surface);}
.ls-val{font-family:var(--display);font-size:24px;font-weight:700;line-height:1;letter-spacing:-0.02em;}
.ls-lab{font-size:12.5px;color:var(--text-dim);margin-top:7px;}

/* ---------- Topbar links (Hamburger-Defaults stehen vor den Media-Queries) ---------- */
.topbar-left{ display:flex; align-items:center; gap:14px; min-width:0; }
.dropzone{border:2px dashed var(--border);border-radius:var(--radius);padding:24px 18px;text-align:center;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:9px;transition:border-color .15s,background .15s;}
.dropzone:hover,.dropzone.drag{border-color:var(--blue);background:rgba(26,86,255,.05);}
.dz-ic{width:44px;height:44px;border-radius:12px;background:var(--surface-2);display:grid;place-items:center;color:var(--blue-soft);}
.dz-ic svg{width:23px;height:23px;}
.dz-text{color:var(--text-soft);font-size:13.5px;}
.dz-name{color:var(--blue-soft);font-size:13px;font-weight:600;}
.rcpt{display:grid;grid-template-columns:1fr 320px;gap:16px;align-items:center;padding:15px 4px;border-bottom:1px solid var(--border-soft);}
.rcpt:last-of-type{border-bottom:none;}
.rcpt-head{display:flex;align-items:center;gap:9px;}
.rcpt-vendor{font-weight:600;font-size:14.5px;}
.tag-learn{display:inline-flex;align-items:center;gap:4px;font-size:10.5px;font-weight:600;color:var(--blue-soft);background:var(--blue-dim);border:1px solid rgba(47,107,255,.28);padding:2px 8px;border-radius:999px;}
.tag-learn svg{width:11px;height:11px;}
.rcpt-meta{color:var(--text-soft);font-size:12.5px;margin-top:4px;}
.match-line{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;}
.match-conf{font-size:12.5px;font-weight:700;color:var(--text-soft);font-variant-numeric:tabular-nums;}
.match-txn{font-size:12px;color:var(--text-soft);display:flex;align-items:center;gap:6px;margin-bottom:7px;}
.match-txn svg{width:13px;height:13px;color:var(--blue-soft);flex:0 0 13px;}
.badge-warning{color:var(--warning);background:rgba(245,178,61,.14);}
.badge-warning svg,.badge-success svg{width:12px;height:12px;}
.confbar{height:5px;border-radius:3px;background:var(--surface-3);overflow:hidden;}
.confbar span{display:block;height:100%;border-radius:3px;}
.rcpt-actions{display:flex;gap:8px;margin-top:9px;}
.assign-form{display:flex;gap:8px;margin-top:8px;}
.assign-form select{flex:1;min-width:0;}
.btn-sm{padding:7px 12px;font-size:12.5px;}
.btn-ghost{background:var(--surface-2);border:1px solid var(--border);color:var(--text-soft);}
.btn-ghost:hover{color:var(--text);border-color:var(--blue);}
.badge svg{vertical-align:-1px;}
@media(max-width:1100px){.rcpt{grid-template-columns:1fr;}.grid[style*="360px"]{grid-template-columns:1fr !important;}}

/* ---------- Rechnungs-Vorschau-Modal ---------- */
.row-click{ cursor:pointer; }
tr.row-click:hover > td{ background:var(--surface-2); }
.kpreview{ position:fixed; inset:0; z-index:1400; display:flex; align-items:center; justify-content:center;
    background:rgba(6,9,18,.72); backdrop-filter:blur(3px); opacity:0; pointer-events:none; transition:opacity .2s; padding:28px; }
.kpreview.on{ opacity:1; pointer-events:auto; }
.kpreview-box{ width:min(880px,96vw); height:min(92vh,1120px); display:flex; flex-direction:column;
    background:var(--surface); border:1px solid var(--border); border-radius:18px; overflow:hidden;
    box-shadow:0 40px 90px -24px rgba(0,0,0,.78); transform:translateY(14px) scale(.985); transition:transform .22s ease; }
.kpreview.on .kpreview-box{ transform:none; }
.kpreview-head{ display:flex; align-items:center; gap:12px; padding:16px 18px 14px; }
.kpreview-title{ font-weight:700; font-size:17px; letter-spacing:-.01em; flex:1; color:var(--text); }
.kpreview-open{ font-size:12.5px; color:var(--text-soft); text-decoration:none; padding:7px 12px;
    border:1px solid var(--border); border-radius:9px; background:var(--bg-2,#161b2c); transition:.15s; white-space:nowrap; }
.kpreview-open:hover{ color:var(--text); border-color:var(--blue); }
.kpreview-close{ width:40px; height:40px; border-radius:11px; border:1px solid var(--border); background:var(--bg-2,#161b2c);
    color:var(--text-soft); font-size:22px; line-height:1; cursor:pointer; display:grid; place-items:center; flex:none; transition:.15s; }
.kpreview-close:hover{ color:var(--text); border-color:var(--blue); background:var(--surface-2); }
.kpreview-body{ position:relative; flex:1; min-height:0; margin:0 14px; border-radius:12px; overflow:hidden; border:1px solid var(--border); }
.kpreview-frame{ width:100%; height:100%; border:0; background:#525659; display:block; }
.kpreview-status{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:14px; padding:24px; text-align:center; background:var(--surface); color:var(--text-soft); font-size:13.5px; }
.kpreview-status[hidden]{ display:none; }
.kpreview-status p{ margin:0; max-width:340px; line-height:1.5; }
.kpreview-status .kpreview-err{ color:var(--text); font-weight:600; }
.kpreview-spin{ width:34px; height:34px; border-radius:50%; border:3px solid var(--border);
    border-top-color:var(--blue); animation:kpreview-spin .8s linear infinite; }
@keyframes kpreview-spin{ to{ transform:rotate(360deg); } }
.kpreview-foot{ padding:11px 18px 15px; }
.kpreview-cap{ font-size:12.5px; color:var(--text-dim); }
@media (max-width:560px){ .kpreview{ padding:0; } .kpreview-box{ width:100vw; height:100vh; border-radius:0; }
    .kpreview-body{ margin:0; border-radius:0; border-left:0; border-right:0; } }

/* ---------- Detailansicht: Schlüssel-Wert-Tabellen ---------- */
.muted{ color:var(--text-dim); }
.kv{ width:100%; border-collapse:collapse; }
.kv th{ text-align:left; font-weight:500; color:var(--text-dim); font-size:13px; padding:5px 16px 5px 0; vertical-align:top; white-space:nowrap; }
.kv td{ padding:5px 0; font-size:13.5px; color:var(--text); }
.kv .t-right{ text-align:right; }

/* ===== Beleg-Detailansicht: Positionen + Summen ===== */
.docpos{ width:100%; border-collapse:collapse; font-size:13.5px; }
.docpos thead th{ text-align:left; font-size:11px; font-weight:600; letter-spacing:.05em; text-transform:uppercase;
    color:var(--text-dim); padding:0 14px 11px; border-bottom:1px solid var(--border); white-space:nowrap; }
.docpos thead th.r{ text-align:right; }
.docpos tbody td{ padding:13px 14px; border-bottom:1px solid var(--border-soft); vertical-align:top; color:var(--text); }
.docpos tbody tr:last-child td{ border-bottom:none; }
.docpos td.r{ text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.docpos td.num{ color:var(--text-dim); font-variant-numeric:tabular-nums; }
.docpos td.muted{ color:var(--text-dim); }
.docpos .pt{ font-weight:600; color:var(--text); }
.docpos .pd{ margin-top:4px; font-size:12px; line-height:1.5; font-weight:400; color:var(--text-dim); }
.docpos .pdisc{ display:inline-block; margin-top:5px; font-size:11.5px; color:var(--text-dim); }

.docsum{ display:flex; justify-content:flex-end; margin-top:8px; }
.docsum-box{ width:min(384px,100%); padding-top:4px; }
.docsum-row{ display:flex; align-items:baseline; justify-content:space-between; gap:24px; padding:7px 2px; font-size:13.5px; }
.docsum-row .lab{ color:var(--text-soft); }
.docsum-row .val{ font-variant-numeric:tabular-nums; color:var(--text); white-space:nowrap; padding-left:18px; }
.docsum-row.grand{ margin-top:8px; padding-top:13px; border-top:1px solid var(--border); }
.docsum-row.grand .lab, .docsum-row.grand .val{ font-size:15px; font-weight:700; color:var(--text); }
.docsum-div{ height:1px; background:var(--border-soft); margin:9px 2px; }
.docsum-row.pay .lab, .docsum-row.pay .val{ color:var(--text-dim); }
.docsum-row.open .lab{ font-weight:600; color:var(--text); }
.docsum-row.open .val{ font-weight:700; color:var(--warning); }

/* ---------- Gefahrenzone (destruktive Aktionen) ---------- */
.btn-danger{ background:#c0392b; border-color:#c0392b; color:#fff; }
.btn-danger:hover{ background:#a93226; border-color:#a93226; }
.danger-zone{ border-color:rgba(192,57,43,.45); background:linear-gradient(180deg, rgba(192,57,43,.06), transparent 60%); }
.danger-zone h2{ margin:8px 0 6px; font-size:18px; }
.eyebrow-danger{ color:#ff8a8a; background:rgba(192,57,43,.14); border-color:rgba(192,57,43,.35); }
.dz-counts{ display:flex; flex-wrap:wrap; gap:8px; margin:14px 0 4px; }
.dz-pill{ font-size:12.5px; padding:5px 11px; border-radius:999px; background:var(--bg-2,#161b2c); border:1px solid var(--border,#22283a); color:var(--text-soft,#9fb0cc); }
.dz-pill strong{ color:var(--text,#e8edf7); }
.dz-form{ margin-top:14px; }
.dz-check{ margin:6px 0 12px; }

/* Belege-Filter-Pills */
.rc-listhead{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.rc-filters{ display:flex; gap:8px; flex-wrap:wrap; }
.rc-pill{ display:inline-flex; align-items:center; gap:7px; padding:6px 12px; border-radius:999px;
    border:1px solid var(--border); background:var(--bg-2,#161b2c); color:var(--text-soft);
    font-size:12.5px; font-weight:600; text-decoration:none; transition:.15s; white-space:nowrap; }
.rc-pill:hover{ color:var(--text); border-color:var(--blue); }
.rc-pill span{ display:inline-grid; place-items:center; min-width:20px; height:18px; padding:0 6px; border-radius:999px;
    background:var(--surface-2); color:var(--text-dim); font-size:11px; }
.rc-pill.on{ background:var(--blue); border-color:var(--blue); color:#fff; }
.rc-pill.on span{ background:rgba(255,255,255,.22); color:#fff; }

/* Klickbare Tabellenzeilen (z. B. Übersicht → Detailvorschau) */
.data tr.row-click{ cursor:pointer; transition:background .12s; }
.data tr.row-click:hover{ background:var(--bg-2,#161b2c); }
.data tr.row-click:hover td:first-child{ box-shadow:inset 3px 0 0 var(--blue); }

/* Massenbestätigung */
.mass-confirm{ border:1px solid var(--border); }
.mc-head{ display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap; }
.mc-title{ font-family:var(--display); font-size:15.5px; font-weight:600; margin-top:4px; }
.mc-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.mc-vendors{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:14px; padding-top:14px; border-top:1px solid var(--border-soft,var(--border)); }
.mc-vlabel{ font-size:12px; color:var(--text-dim); }
.btn-xs{ padding:4px 10px; font-size:12px; border-radius:8px; }
.btn-chip{ border:1px solid var(--border); background:var(--bg-2,#161b2c); color:var(--text-soft); display:inline-flex; align-items:center; gap:6px; }
.btn-chip:hover{ color:var(--text); border-color:var(--blue); }
.btn-chip .chip-n{ display:inline-grid; place-items:center; min-width:18px; height:16px; padding:0 5px; border-radius:999px; background:var(--surface-2); color:var(--text-dim); font-size:10.5px; }

/* Gutschrift-Kennzeichen */
.tag-credit{ display:inline-flex; align-items:center; gap:4px; font-size:11px; font-weight:600; padding:2px 8px; border-radius:999px;
    background:rgba(245,181,61,.14); color:#f5b53d; border:1px solid rgba(245,181,61,.3); }

/* Abweichungsnotiz */
.match-dev{ display:flex; align-items:center; gap:6px; font-size:12px; margin:6px 0 2px; line-height:1.35; }
.match-dev svg{ width:14px; height:14px; flex:none; }
.match-dev-warn{ color:#f5b53d; }
.match-dev-ok{ color:var(--success,#2dd4a7); }
.match-dev:not(.match-dev-warn):not(.match-dev-ok){ color:var(--text-dim); }

/* Netto-/Brutto-Preismodus-Umschalter + Live-Summen (Rechnungs-/Serienformular) */
#pmHint { font-style:normal; font-weight:400; color:var(--text-dim); text-transform:none; letter-spacing:0; }
.pricemode { display:inline-flex; background:var(--bg-2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:3px; gap:2px; }
.pricemode .pm-opt { display:inline-flex; align-items:center; gap:6px; padding:6px 14px; border-radius:6px; font-size:13px; font-weight:500; color:var(--text-soft); cursor:pointer; user-select:none; }
.pricemode .pm-opt input { position:absolute; opacity:0; width:0; height:0; }
.pricemode .pm-opt:has(input:checked) { background:var(--blue); color:#fff; }
.doctotals { margin-top:18px; margin-left:auto; max-width:340px; font-size:13.5px; }
.doctotals .dt-row { display:flex; justify-content:space-between; gap:24px; padding:5px 2px; }
.doctotals .dt-row span:last-child { font-variant-numeric:tabular-nums; }
.doctotals .dt-sub { color:var(--text-dim); }
.doctotals .dt-grand { font-weight:700; font-size:15px; border-top:1.5px solid var(--border); margin-top:4px; padding-top:9px; }
@media (max-width:680px){ .doctotals{ margin-left:0; max-width:none; } }

/* ---------------- Prüfansicht: Beleg & Umsatz nebeneinander ---------------- */
.rv-wrap{ position:fixed; inset:0; z-index:1000; }
.rv-backdrop{ position:absolute; inset:0; background:rgba(4,8,18,.72); backdrop-filter:blur(3px); }
.rv-panel{ position:relative; margin:3vh auto; width:min(1180px, 94vw); max-height:94vh; display:flex; flex-direction:column;
  background:var(--bg-1); border:1px solid var(--border); border-radius:14px; box-shadow:0 24px 80px rgba(0,0,0,.55); overflow:hidden; }
.rv-head{ display:flex; justify-content:space-between; align-items:center; gap:12px; padding:14px 18px; border-bottom:1px solid var(--border); }
.rv-title{ font-family:var(--display); font-size:16px; margin-top:2px; }
.rv-grid{ display:grid; grid-template-columns: 1.25fr 1fr; gap:0; min-height:0; flex:1; }
.rv-doc{ border-right:1px solid var(--border); background:var(--bg-2); min-height:0; }
.rv-doc iframe{ width:100%; height:100%; min-height:62vh; border:0; background:#fff; }
.rv-side{ padding:16px 18px; overflow:auto; display:flex; flex-direction:column; gap:14px; }
.rv-block .rv-k{ font-size:11px; letter-spacing:.08em; text-transform:uppercase; color:var(--text-dim); margin-bottom:6px; }
.rv-facts{ font-size:13.5px; display:flex; flex-direction:column; gap:2px; }
.rv-txn-amt{ font-family:var(--display); font-size:20px; }
.rv-purpose{ color:var(--text-soft); font-size:12.5px; margin-top:4px; word-break:break-word; }
.rv-chips{ display:flex; flex-wrap:wrap; gap:6px; }
.rv-chip{ background:rgba(64,120,255,.12); border:1px solid rgba(64,120,255,.35); color:var(--text);
  border-radius:999px; padding:4px 10px; font-size:12px; }
.rv-chip-score{ background:rgba(46,204,113,.10); border-color:rgba(46,204,113,.35); }
.rv-alt{ display:flex; justify-content:space-between; align-items:center; gap:10px; padding:8px 10px;
  border:1px solid var(--border); border-radius:10px; margin-bottom:6px; background:var(--bg-2); }
.rv-alt-info{ font-size:13px; min-width:0; }
.rv-actions{ display:flex; gap:10px; margin-top:2px; padding-top:12px; border-top:1px solid var(--border); }
@media (max-width: 860px){
  .rv-grid{ grid-template-columns: 1fr; }
  .rv-doc{ border-right:0; border-bottom:1px solid var(--border); }
  .rv-doc iframe{ min-height:40vh; }
}

/* ---------------- Banking: CSV-Import-Karte ---------------- */
.bi-grid{ display:grid; grid-template-columns: 1.05fr 1fr; gap:26px; align-items:start; }
.bi-sub{ color:var(--text-soft); font-size:13px; line-height:1.55; margin:8px 0 12px; max-width:520px; }
.bi-chips{ display:flex; flex-wrap:wrap; gap:6px; }
.bi-chip{ display:inline-flex; align-items:center; gap:5px; font-size:11.5px; color:var(--text-dim);
  border:1px solid var(--border); border-radius:999px; padding:4px 10px; background:var(--bg-2); white-space:nowrap; }
.bi-chip svg{ width:12px; height:12px; color:var(--success); flex:none; }
.bi-action{ display:flex; flex-direction:column; gap:10px; min-width:0; }
.bi-drop{ padding:22px 16px; }
.bi-controls{ display:flex; gap:10px; align-items:stretch; }
.bi-controls select.bi-input{ flex:1; width:100%; }
.bi-controls .btn{ white-space:nowrap; }
@media (max-width: 900px){
  .bi-grid{ grid-template-columns: 1fr; gap:16px; }
}

/* ---------------- Exporte: Belege-ZIP & Umsätze-CSV ---------------- */
.rx-export{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-left:auto; }
.rx-selall-wrap{ display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--text-dim); cursor:pointer; white-space:nowrap; }
.rcpt:has(> input.rx-sel){ grid-template-columns:24px 1fr 320px; }
.rcpt > input.rx-sel{ align-self:start; margin-top:5px; accent-color:var(--blue); cursor:pointer; justify-self:start; }
.tx-export{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  border:1px solid var(--border); border-radius:var(--radius); background:var(--bg-2); padding:8px 12px; margin:0 0 12px; }
.tx-export-form{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0; }
.tx-export-label{ display:inline-flex; align-items:center; gap:6px; font-size:12px; letter-spacing:.05em; text-transform:uppercase; color:var(--text-dim); }
.tx-export-accs{ display:flex; gap:6px; flex-wrap:wrap; }
.tx-acc-chip{ display:inline-flex; align-items:center; gap:5px; font-size:12px; color:var(--text-soft);
  border:1px solid var(--border); border-radius:999px; padding:3px 9px; background:var(--bg-1); cursor:pointer; }
.tx-acc-chip input{ accent-color:var(--blue); }
.tx-export-date{ width:135px; padding:6px 8px; font-size:12.5px; }
.tx-sel-td{ width:28px; }
.tx-sel-td input, #txSelAll{ accent-color:var(--blue); cursor:pointer; }

/* Trainings-Export */
.rx-training{ display:flex; align-items:center; gap:6px; margin:0; }
.rx-training-scope{ padding:5px 8px; font-size:12.5px; border:1px solid var(--border); border-radius:8px; background:var(--bg-1); color:var(--text-soft); }

/* Wiederkehrende Rechnung im Beleg-Formular */
.rec-box{ margin-top:14px; padding:12px 14px; border:1px dashed var(--border); border-radius:10px; background:var(--bg-1); }
.rec-toggle{ display:flex; align-items:center; gap:8px; font-weight:600; cursor:pointer; }
.rec-fields{ margin-top:12px; }
.rec-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; }
.rec-grid label{ display:flex; flex-direction:column; gap:4px; font-size:13px; }
.rec-int{ display:flex; gap:6px; }
.rec-count{ width:64px; }
.rec-hint{ margin:10px 0 0; font-size:12.5px; }
.rcpt-src{ margin-left:8px; font-size:11px; vertical-align:middle; }

/* Prüf-Modal: klickbare Betrags-Kandidaten (Live-Training) */
.rv-k-hint{ display:block; font-weight:400; text-transform:none; letter-spacing:0; color:var(--text-dim); font-size:11.5px; margin-top:2px; }
.rv-amts{ display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.rv-amt{ display:flex; align-items:baseline; gap:8px; width:100%; text-align:left; padding:8px 10px; border:1px solid var(--border);
         border-radius:8px; background:var(--bg-1); color:var(--text); cursor:pointer; font:inherit; }
.rv-amt:hover:not(:disabled){ border-color:var(--accent); background:var(--bg-2); }
.rv-amt strong{ font-size:14px; white-space:nowrap; }
.rv-amt-kind{ font-size:10.5px; padding:1px 6px; border-radius:99px; background:var(--bg-2); color:var(--text-soft); white-space:nowrap; }
.rv-amt-lbl{ color:var(--text-dim); font-size:11.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.rv-amt-cur{ border-color:var(--accent); background:color-mix(in srgb, var(--accent) 12%, var(--bg-1)); cursor:default; }
.rv-amt-cur .rv-amt-lbl{ color:var(--text-soft); }
.rcpt-tag{ background:color-mix(in srgb, var(--accent) 14%, var(--bg-1)); font-size:11px; margin-left:6px; }
