/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #f59e0b;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Navbar ───────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: .75rem 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.nav-links { display: flex; gap: .25rem; }
.nav-link {
    padding: .4rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: .875rem;
    transition: all .15s;
}
.nav-link:hover { color: var(--text); background: var(--bg-card-hover); }
.nav-link.active { color: var(--accent); background: rgba(59,130,246,.1); }
.nav-burger { display: none; margin-left: auto; cursor: pointer; font-size: 1.5rem;
    line-height: 1; padding: .35rem .55rem; border-radius: var(--radius-sm); color: var(--text); }
.nav-burger:hover { background: var(--bg-card-hover); }

/* ── Beleg-Inbox ──────────────────────────────────────────────── */
.beleg-inbox { display: flex; flex-direction: column; gap: .75rem; }
.beleg-item { display: flex; gap: 1rem; align-items: flex-start; }
.beleg-doc { display: flex; gap: .6rem; align-items: flex-start; flex: 0 0 200px; }
.beleg-thumb { width: 56px; height: 72px; object-fit: cover; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--bg); }
.beleg-doc-meta { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.beleg-doc-meta strong { word-break: break-word; }
.beleg-match { flex: 1; display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.beleg-sugg-label { font-size: .8rem; }
.beleg-sugg { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem;
    align-items: center; text-align: left; padding: .55rem .7rem; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg-input); color: var(--text); cursor: pointer; }
.beleg-sugg:hover { background: var(--bg-card-hover); }
.beleg-sugg.is-high { border-color: rgba(34,197,94,.5); }
.beleg-sugg-main { display: flex; gap: .6rem; align-items: baseline; font-weight: 600; }
.beleg-sugg-amt { font-variant-numeric: tabular-nums; }
.beleg-sugg-sub { grid-column: 1 / 2; font-size: .75rem; }
.beleg-sugg-go { grid-column: 2 / 3; grid-row: 1 / 3; align-self: center; color: var(--green);
    font-weight: 600; font-size: .85rem; white-space: nowrap; }
.beleg-sugg.is-low .beleg-sugg-go { color: var(--text-muted); }
.beleg-nomatch { font-size: .85rem; }
.beleg-dismiss { align-self: flex-start; font-size: .8rem; color: var(--text-muted);
    background: none; border: none; cursor: pointer; padding: .25rem 0; text-decoration: underline; }

/* ── Dashboard: To-dos + Haushaltskonto ───────────────────────── */
.todo-card { margin-bottom: 1rem; border-left: 3px solid var(--yellow); }
.todo-title { font-size: .85rem; color: var(--text-muted); margin-bottom: .6rem; }
.todo-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.todo-item { display: flex; align-items: center; gap: .5rem; padding: .5rem .8rem;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-input);
    color: var(--text); text-decoration: none; min-height: 44px; transition: background .15s; }
.todo-item:hover { background: var(--bg-card-hover); }
.todo-count { font-size: 1.15rem; font-weight: 700; color: var(--yellow);
    font-variant-numeric: tabular-nums; }
.todo-label { font-size: .85rem; }
.household-card { margin-bottom: 1.5rem; }
.household-stats { display: flex; flex-wrap: wrap; gap: 1.5rem; }

/* ── Steuer: Pauschalen-Eingabe ───────────────────────────────── */
.pauschale-person { padding: .6rem 0; border-top: 1px solid var(--border); }
.pauschale-person:first-of-type { border-top: none; }
.pauschale-name { font-size: .95rem; margin-bottom: .5rem; }
.pauschale-forms { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.pauschale-form { flex: 1 1 280px; }
.pauschale-form > label { display: block; font-size: .85rem; margin-bottom: .35rem; }
.pauschale-fields { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.pauschale-fields input { width: 90px; }
.pauschale-result { margin-top: .4rem; color: var(--green); font-weight: 600; font-size: .9rem; }

/* ── Login ────────────────────────────────────────────────────── */
.login-wrap { max-width: 340px; margin: 4rem auto; }
.login-wrap h1 { font-size: 1.3rem; margin-bottom: 1rem; }
.login-wrap form { display: flex; flex-direction: column; gap: .75rem; }
.login-error { color: var(--red); font-size: .85rem; }

/* ── Layout ───────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 600; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card { text-align: center; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }
.stat-value.income { color: var(--green); }
.stat-value.expense { color: var(--red); }

/* ── Tables ───────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: .6rem .75rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
td {
    padding: .6rem .75rem;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}
tr:hover td { background: var(--bg-card-hover); }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount.positive { color: var(--green); }
.amount.negative { color: var(--red); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); font-size: .8rem; }

/* ── Category Badge ───────────────────────────────────────────── */
.cat-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .15rem .5rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    background: var(--bg-card-hover);
    cursor: pointer;
}
.cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.cat-badge.uncategorized {
    border: 1px dashed var(--text-dim);
    color: var(--text-dim);
}
.tax-tag {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 6px;
    font-size: .72rem;
    background: rgba(99,102,241,.18);
    color: var(--text);
}
.doc-link { text-decoration: none; cursor: pointer; }
.doc-edit { cursor: pointer; opacity: .55; font-size: .8rem; margin-left: .15rem; }
.doc-edit:hover { opacity: 1; }

/* ── Steuer-Seite ─────────────────────────────────────────────── */
.tax-h2 { font-size: 1rem; margin-bottom: .5rem; }
.tax-table { width: 100%; }
.tax-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--border, #2a2f3a); vertical-align: top; }
.tax-table .tax-income td { color: var(--green); }
.tax-table .tax-subtotal td { color: var(--text-dim); }
.tax-table .tax-total td { border-top: 2px solid var(--border, #2a2f3a); border-bottom: none; }
.tax-drill summary { cursor: pointer; color: var(--text-dim); font-size: .78rem; }
.tax-tx { width: 100%; margin-top: .35rem; }
.tax-tx td { padding: .2rem .4rem; font-size: .8rem; border-bottom: 1px dashed var(--border, #2a2f3a); }
.missing-badge { background: var(--yellow); color: #1a1a1a; border-radius: 999px; padding: .05rem .5rem; font-size: .78rem; margin-left: .4rem; }

/* Steuer-Status / geführter Ablauf */
.tax-status { border-left: 3px solid var(--accent); }
.tax-progress { height: 10px; border-radius: 999px; background: var(--bg-input); overflow: hidden; margin: .4rem 0; }
.tax-progress > span { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.tax-steps { list-style: none; padding: 0; margin: .5rem 0 0; counter-reset: step; }
.tax-steps li { position: relative; padding: .25rem 0 .25rem 2rem; counter-increment: step; color: var(--text-muted); font-size: .9rem; }
.tax-steps li::before { content: counter(step); position: absolute; left: 0; top: .2rem; width: 1.35rem; height: 1.35rem; border-radius: 50%; background: var(--accent); color: #fff; font-size: .78rem; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.tax-callout { background: rgba(59,130,246,.10); border: 1px solid rgba(59,130,246,.35); border-radius: var(--radius-sm); padding: .6rem .75rem; font-size: .85rem; margin-top: .75rem; }
.tax-callout strong { color: var(--text); }
.tax-info { cursor: help; color: var(--text-dim); font-size: .8rem; margin-left: .35rem; border: none; background: none; padding: 0; }
.tax-info:hover { color: var(--accent); }
.tax-help-row td { padding-top: 0 !important; border-bottom: 1px solid var(--border) !important; }
.tax-help-row .help-text { color: var(--text-muted); font-size: .8rem; padding: 0 .5rem .4rem; }
.tax-tip { padding: .5rem .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .4rem; }
.tax-tip .tip-label { font-weight: 600; font-size: .85rem; }
.tax-tip .tip-help { color: var(--text-muted); font-size: .8rem; margin-top: .15rem; }
.tax-tip .tip-group { color: var(--text-dim); font-size: .72rem; }

/* ── Beleg-Workflow (Paperless) ───────────────────────────────── */
.doc-thumb { height: 28px; width: auto; border-radius: 3px; vertical-align: middle; border: 1px solid var(--border, #2a2f3a); }
.doc-thumb.sm { height: 36px; margin-right: .5rem; }
.doc-add { background: none; border: 1px dashed var(--text-dim); color: var(--text-dim); border-radius: 6px; padding: .1rem .4rem; cursor: pointer; font-size: .8rem; }
.doc-add:hover { color: var(--text); border-color: var(--text); }
.beleg-dialog { min-width: 420px; max-width: 90vw; }
.beleg-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border, #2a2f3a); margin-bottom: .75rem; }
.beleg-tab { background: none; border: none; color: var(--text-dim); padding: .4rem .7rem; cursor: pointer; border-bottom: 2px solid transparent; }
.beleg-tab.active { color: var(--text); border-bottom-color: var(--accent); }
.beleg-results { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow-y: auto; }
.beleg-result { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; background: none; border: 1px solid var(--border, #2a2f3a); border-radius: 6px; padding: .4rem .5rem; margin-bottom: .35rem; cursor: pointer; color: var(--text); }
.beleg-result:hover { background: var(--bg-card-hover); }
.beleg-result-title { flex: 1; }
.beleg-result-date { font-size: .78rem; }

/* ── Berichte: Vorjahresvergleich ─────────────────────────────── */
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.cmp-cell { background: var(--bg-input); border-radius: var(--radius-sm); padding: .6rem .75rem; }
.cmp-label { font-size: .78rem; color: var(--text-dim); }
.cmp-value { font-size: 1.25rem; font-weight: 600; margin: .15rem 0; }
.cmp-foot { font-size: .78rem; color: var(--text-dim); }
.cmp-delta { font-weight: 600; margin-left: .25rem; }

/* ── Kategorie-Deep-Dive ──────────────────────────────────────── */
.cat-link { color: inherit; text-decoration: none; }
.cat-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Tastatur-Fokus sichtbar machen (Barrierefreiheit) ────────── */
a:focus-visible, button:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

@media print {
    .navbar, .no-print, .nav-links { display: none !important; }
    .container { max-width: none; }
    .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
    body { background: #fff; color: #000; }
    .tax-table td { border-color: #ccc; }
}

/* ── Forms ────────────────────────────────────────────────────── */
input, select, textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: .5rem .75rem;
    font-size: .875rem;
    width: 100%;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}
label {
    display: block;
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .25rem;
}
.form-group { margin-bottom: 1rem; }
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    color: var(--text);
}
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-card-hover); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: .3rem .6rem; font-size: .75rem; }

/* ── Drop Zone ────────────────────────────────────────────────── */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    transition: all .2s;
    cursor: pointer;
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(59,130,246,.05);
}
.dropzone-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.dropzone-text { font-size: .9rem; }

/* Berichte: Personenvergleich-Balken */
.person-bar {
    display: flex;
    height: 28px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card-hover);
}
.person-seg { height: 100%; transition: width .3s; }
.person-seg.seg-me { background: var(--accent); }
.person-seg.seg-partner { background: #ec4899; }
.person-seg.seg-haushalt { background: #14b8a6; }
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}
.legend-dot.seg-me { background: var(--accent); }
.legend-dot.seg-partner { background: #ec4899; }
.legend-dot.seg-haushalt { background: #14b8a6; }

/* Berichte: Top-Empfänger */
.top-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .3rem 0;
}
.top-name {
    width: 160px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: .85rem;
}
.top-bar-wrap { flex: 1; background: var(--bg-card-hover); border-radius: 4px; height: 14px; }
.top-bar { height: 100%; background: var(--accent); border-radius: 4px; min-width: 2px; }
.top-amount { width: 110px; text-align: right; flex-shrink: 0; font-size: .85rem; }

/* Owner-Badge in der Buchungsliste */
.owner-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: .65rem;
    font-weight: 700;
    color: #fff;
    margin-right: .35rem;
    vertical-align: middle;
    flex-shrink: 0;
}
.owner-badge.owner-me { background: var(--accent); }
.owner-badge.owner-partner { background: #ec4899; }
.owner-badge.owner-haushalt { background: #14b8a6; }

/* Dashboard: Personen-Umschalter */
.view-switch {
    display: inline-flex;
    gap: .25rem;
    padding: .25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.view-pill {
    padding: .35rem .9rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: .85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all .15s;
}
.view-pill:hover { color: var(--text); }
.view-pill.active { background: var(--accent); color: #fff; }

/* Abrechnung: Netto-Saldo-Box */
.settle-rows { display: flex; flex-direction: column; gap: .4rem; }
.settle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .85rem;
}
.settle-net {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
    font-weight: 600;
}

/* Owner-Auswahl beim Import */
.owner-select {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.owner-select-label { font-size: .85rem; color: var(--text-muted); }
.owner-radio {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .85rem;
    cursor: pointer;
    transition: all .15s;
}
.owner-radio:has(input:checked) {
    border-color: var(--accent);
    background: rgba(59,130,246,.1);
    color: var(--text);
}

/* ── Import Result ────────────────────────────────────────────── */
.import-result {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}
.import-stat { text-align: center; padding: .75rem; border-radius: var(--radius-sm); background: var(--bg-card-hover); }
.import-stat .value { font-size: 1.5rem; font-weight: 700; }
.import-stat .label { font-size: .75rem; color: var(--text-muted); }

/* ── Category Bar Chart ───────────────────────────────────────── */
.cat-bars { margin-top: 1rem; }
.cat-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 80px;
    align-items: center;
    gap: .75rem;
    padding: .35rem 0;
}
.cat-bar-label { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar-track { height: 20px; background: var(--bg-card-hover); border-radius: 10px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 10px; transition: width .3s ease; min-width: 2px; }
.cat-bar-amount { font-size: .8rem; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Month Nav ────────────────────────────────────────────────── */
.month-nav {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.month-nav .btn { padding: .3rem .6rem; }
.month-nav .current { font-size: 1rem; font-weight: 600; min-width: 120px; text-align: center; }

/* ── Dialog / Modal ───────────────────────────────────────────── */
dialog {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 500px;
    width: 90vw;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin-bottom: 1rem; font-size: 1.1rem; }

/* ── Utilities ────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ── Inline Category Select ───────────────────────────────────── */
.inline-cat-select {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: .8rem;
    padding: .2rem;
    cursor: pointer;
    width: auto;
    max-width: 140px;
}
.inline-cat-select:focus { border: none; outline: 1px solid var(--accent); }

/* ── Filter Bar ───────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: .75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: end;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }
.filter-bar input, .filter-bar select { font-size: .8rem; padding: .4rem .6rem; }

/* ── Reports ──────────────────────────────────────────────────── */
.report-table th, .report-table td { text-align: right; }
.report-table th:first-child, .report-table td:first-child { text-align: left; }
.report-table tfoot td { font-weight: 700; border-top: 2px solid var(--border); }

/* ── Toast / Flash ────────────────────────────────────────────── */
#toastHost {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    display: flex;
    flex-direction: column-reverse;
    gap: .5rem;
    pointer-events: none;
}
.toast {
    padding: .75rem 1.25rem;
    border-radius: var(--radius);
    background: var(--green);
    color: #fff;
    font-size: .875rem;
    font-weight: 500;
    box-shadow: 0 10px 25px -10px rgba(0,0,0,.5);
    animation: slideIn .3s ease, fadeOut .3s ease 2.5s;
    animation-fill-mode: forwards;
    pointer-events: auto;
}
.toast-error { background: var(--red); }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }

/* ── Toggle-Switch (z. B. Regeln aktiv) ───────────────────────── */
.toggle-switch {
    width: 32px;
    height: 18px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0;
    cursor: pointer;
    position: relative;
    transition: background .15s;
    display: inline-block;
    vertical-align: middle;
}
.toggle-switch .toggle-knob {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 14px;
    height: 14px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: transform .15s, background .15s;
}
.toggle-switch.on { background: rgba(34,197,94,.25); border-color: var(--green); }
.toggle-switch.on .toggle-knob { transform: translateX(14px); background: var(--green); }

/* ── Row-Action-Buttons (Edit/Delete in Tabellen) ─────────────── */
.row-action {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: .25rem .4rem;
    border-radius: var(--radius-sm);
    transition: all .15s;
}
.row-action:hover { background: var(--bg-card-hover); color: var(--text); }
.row-action.danger:hover { background: rgba(239,68,68,.15); color: var(--red); }

/* ── Bulk-Actions ─────────────────────────────────────────────── */
.bulk-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    background: rgba(59,130,246,.1);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
}
.bulk-bar select { width: auto; min-width: 180px; }
.bulk-cb { cursor: pointer; }

/* ── Cat-Cell mit Rule-Shortcut ───────────────────────────────── */
.cat-cell { display: inline-flex; align-items: center; gap: .25rem; }
.rule-shortcut {
    color: var(--text-dim);
    text-decoration: none;
    font-size: .75rem;
    padding: .15rem .3rem;
    border-radius: var(--radius-sm);
    transition: all .15s;
    opacity: 0;
}
tr:hover .rule-shortcut { opacity: 1; }
.rule-shortcut:hover { color: var(--accent); background: var(--bg-card-hover); opacity: 1; }

/* ── Notes-Cell ───────────────────────────────────────────────── */
.notes-cell {
    cursor: pointer;
    font-size: .8rem;
    padding: .15rem .35rem;
    border-radius: var(--radius-sm);
    display: inline-block;
    min-width: 1.5rem;
}
.notes-cell:hover { background: var(--bg-card-hover); }
.notes-cell.empty { color: var(--text-dim); opacity: 0; }
tr:hover .notes-cell.empty { opacity: .5; }
.notes-cell.empty:hover { opacity: 1; color: var(--accent); background: var(--bg-card-hover); }

/* ── Share-Cell (geteilte Ausgaben) ───────────────────────────── */
.share-cell {
    cursor: pointer;
    font-size: .8rem;
    padding: .15rem .4rem;
    border-radius: 999px;
    display: inline-block;
    min-width: 2rem;
    text-align: center;
    background: rgba(139,92,246,.15);
    color: #c4b5fd;
}
.share-cell:hover { background: rgba(139,92,246,.3); }
.share-cell.empty { background: transparent; color: var(--text-dim); opacity: .5; }
.share-cell.empty:hover { opacity: 1; color: var(--accent); background: var(--bg-card-hover); }

/* ── Settled Badge ────────────────────────────────────────────── */
.settled-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(34,197,94,.2);
    color: var(--green);
    font-size: .75rem;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid rgba(34,197,94,.4);
    transition: background .15s;
}
.settled-badge:hover { background: rgba(34,197,94,.35); }

/* ── Shared-Banner (Dashboard) ────────────────────────────────── */
.shared-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(139,92,246,.08);
    border: 1px solid rgba(139,92,246,.3);
    border-radius: var(--radius);
    font-size: .85rem;
}
.shared-banner-label { color: var(--text-muted); font-size: .8rem; }
.shared-banner-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 640px) {
    .navbar { flex-wrap: wrap; padding: .5rem .75rem; gap: .5rem; }
    .nav-burger { display: block; }
    /* Menü hinter dem Hamburger einklappen */
    .nav-links { display: none; flex-basis: 100%; flex-direction: column; gap: .1rem; }
    .nav-toggle:checked ~ .nav-links { display: flex; }
    .nav-link { padding: .65rem .75rem; font-size: 1rem; }
    .container { padding: .75rem; }
    .card-grid { grid-template-columns: 1fr 1fr; }
    .cat-bar-row { grid-template-columns: 100px 1fr 60px; }

    /* Größere Touch-Targets */
    .btn, .row-action, .inline-cat-select, select, input[type="text"],
    input[type="password"], input[type="number"] { min-height: 44px; }
    .toggle-switch { transform: scale(1.2); transform-origin: left center; }

    /* Buchungstabelle → gestapelte Karten statt 800px-Scroll */
    .tx-card { overflow-x: visible !important; }
    .tx-table { min-width: 0 !important; }
    .tx-table thead { display: none; }
    .tx-table, .tx-table tbody, .tx-table tr, .tx-table td { display: block; width: 100%; }
    .tx-table tr { border: 1px solid var(--border); border-radius: var(--radius);
        margin-bottom: .6rem; padding: .3rem .7rem; background: var(--bg); }
    .tx-table td { display: flex; justify-content: space-between; align-items: center;
        gap: 1rem; border: none; padding: .4rem 0; max-width: none !important;
        white-space: normal !important; overflow: visible !important;
        text-overflow: clip !important; text-align: left !important; }
    .tx-table td.no-label { justify-content: flex-end; }
    .tx-table td::before { content: attr(data-label); color: var(--text-muted);
        font-size: .75rem; font-weight: 600; flex: 0 0 auto; }
    .tx-table td.no-label::before { content: none; }
    .tx-table .inline-cat-select { flex: 1; width: auto; }
    .tx-table .cat-cell { flex: 1; }

    /* Beleg-Inbox einspaltig, daumengerecht */
    .beleg-item { flex-direction: column; }
    .beleg-doc { flex: 1 1 auto; }
    .beleg-thumb { width: 64px; height: 84px; }
    .beleg-sugg { padding: .7rem; min-height: 44px; }
}
