/* ═══════════════════════════════════════════
   BWA-Dashboard — Stylesheet
   Clean, professional financial dashboard
   ═══════════════════════════════════════════ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --bg: #f5f7fa;
    --sidebar-bg: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --green: #22c55e;
    --green-bg: #f0fdf4;
    --yellow: #f59e0b;
    --yellow-bg: #fffbeb;
    --red: #ef4444;
    --red-bg: #fef2f2;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --sidebar-width: 240px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16.5px;
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-subtitle {
    font-size: 0.8rem;
    opacity: 0.6;
}

.nav-links {
    list-style: none;
    padding: 0.5rem 0;
    flex: 1;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.nav-links li a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.nav-links li.active a {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left: 3px solid var(--primary);
}

.nav-icon {
    font-size: 0.8rem;
    width: 1.2rem;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.data-info {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* --- Main Content --- */
.content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
}

/* --- Page Header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

/* --- KPI Grid --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.kpi-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}

.kpi-change {
    font-size: 0.9rem;
    font-weight: 500;
}

.kpi-change.positive { color: var(--green); }
.kpi-change.negative { color: var(--red); }
.kpi-change.neutral { color: var(--text-secondary); }

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1.05rem;
}

th {
    text-align: left;
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.col-name {
    min-width: 200px;
}

.col-status {
    width: 40px;
    text-align: center;
}

/* BWA-Tabelle */
.bwa-table .bwa-sum-row {
    background: #f8fafc;
}

.bwa-table .bwa-sum-row td {
    border-bottom: 2px solid var(--border);
}

.bwa-table .bwa-header-row td {
    padding-top: 1.2rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: none;
}

.bwa-row .col-num.positive { color: var(--green); }
.bwa-row .col-num.negative { color: var(--red); }
.bwa-row .col-num.neutral { color: var(--text-secondary); }
.bwa-sum-row .col-num.positive { color: var(--green); }
.bwa-sum-row .col-num.negative { color: var(--red); }
.bwa-sum-row .col-num.neutral { color: var(--text-secondary); }

/* Deviation-Tabelle */
.deviation-table .positive { color: var(--green); }
.deviation-table .negative { color: var(--red); }

/* Traffic Light */
.traffic-light {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.traffic-green { background: var(--green); }
.traffic-yellow { background: var(--yellow); }
.traffic-red { background: var(--red); }

/* BWA-Detail: 2-Spalten-Layout */
.detail-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.25rem;
    align-items: start;
}
.detail-card-left, .detail-card-right {
    min-height: 300px;
}
.detail-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
}
.detail-full {
    margin-top: 1.25rem;
}

/* Collapsible */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.collapsible-header:hover { opacity: 0.8; }
.collapse-icon {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

/* Responsive: unter 1200px stacken */
@media (max-width: 1200px) {
    .detail-grid { grid-template-columns: 1fr; }
}

/* BWA-Detail: Spalten-Trenner */
.col-sep { border-left: 2px solid var(--border); padding-left: 0.75rem !important; }
.col-pct { font-size: 0.9rem; color: var(--text-secondary); }
.neutral { color: var(--text-secondary); }

/* Buchungsvergleich */
.change-summary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.change-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.change-neu { background: #dbeafe; color: #1d4ed8; }
.change-weg { background: #fde8e8; color: #c81e1e; }
.change-edit { background: #fef3c7; color: #92400e; }
.change-same { background: #f1f5f9; color: #64748b; }

.status-tag {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.tag-neu { background: #dbeafe; color: #1d4ed8; }
.tag-weg { background: #fde8e8; color: #c81e1e; }
.tag-edit { background: #fef3c7; color: #92400e; }
.tag-same { background: #f1f5f9; color: #94a3b8; }

.change-row-weggefallen td { opacity: 0.6; }
.change-row-gleich td { color: var(--text-secondary); }

/* Filter-Badge Interaktion */
.change-badge.clickable { cursor: pointer; transition: opacity 0.15s, transform 0.15s; }
.change-badge.clickable:hover { transform: scale(1.05); }
.change-badge.badge-active { outline: 2px solid currentColor; outline-offset: 1px; }
.change-badge.badge-dimmed { opacity: 0.35; }
.change-reset { background: var(--border); color: var(--text-secondary); cursor: pointer; }
.change-reset:hover { background: #cbd5e1; }

/* Settings Link-Form */
.settings-link-form { margin-top: 0.75rem; }
.settings-link-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.settings-link-field { flex: 1; min-width: 150px; }
.settings-link-field label { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
.settings-link-field select,
.settings-link-field input {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
}
.settings-link-field-url { flex: 2; }
.settings-link-field-btn { flex: 0 0 auto; }

/* Field-Links im Snapshot-Formular */
.cf-field-links {
    margin-top: 0.2rem;
    margin-bottom: 0.3rem;
}
.cf-field-links a {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    word-break: break-all;
    line-height: 1.4;
}
.cf-field-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Account Links */
.account-link {
    color: var(--primary);
    text-decoration: none;
}

.account-link:hover {
    text-decoration: underline;
}

/* Sortierbare Spalten */
.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    color: var(--primary);
}

/* Total Row */
.total-row td {
    border-top: 2px solid var(--text);
    border-bottom: none;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.btn-analyze {
    background: #f0f4ff;
    color: var(--primary);
    border: 1px solid #c7d8f5;
}

.btn-analyze:hover {
    background: #dce7fb;
}

.btn-analyze:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Forms --- */
.inline-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

select, input[type="number"], input[type="text"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: white;
    color: var(--text);
}

select:focus, input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.threshold-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.threshold-input {
    width: 60px;
    text-align: center;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* --- Upload --- */
.upload-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 700px;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-group {
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.4rem;
}

.form-group select {
    width: 100%;
}

.file-uploads {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.file-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.file-group input[type="file"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
}

.file-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.required-badge {
    font-size: 0.65rem;
    background: var(--red-bg);
    color: var(--red);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

.optional-badge {
    font-size: 0.65rem;
    background: var(--bg);
    color: var(--text-secondary);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
}

.month-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.month-tag {
    background: var(--bg);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* --- Analysis --- */
.analysis-row td {
    background: #f8fafc;
    padding: 1rem 1.5rem;
}

.analysis-content {
    max-width: 800px;
}

.analysis-text {
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--text);
}

.analysis-text li {
    margin-left: 1.5rem;
    margin-bottom: 0.3rem;
}

.analysis-error {
    color: var(--red);
    font-size: 0.875rem;
}

.loading {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-style: italic;
}

/* --- Charts --- */
.chart-container {
    height: 350px;
    position: relative;
}

.chart-container-small {
    height: 250px;
    position: relative;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* --- Flash Messages --- */
.flash-messages {
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.flash-success {
    background: var(--green-bg);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.flash-error {
    background: var(--red-bg);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
    color: var(--text);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.empty-hint {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

/* --- Search --- */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.booking-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.search-input {
    width: 250px;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header h2, .sidebar-subtitle, .nav-links li a span:not(.nav-icon),
    .sidebar-footer { display: none; }

    .nav-links li a { justify-content: center; padding: 1rem; }

    .content {
        margin-left: 60px;
        padding: 1rem;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        flex-direction: column;
    }
}

/* ─── CashFlow Rückspiegel ─── */
.btn-link-danger {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}
.btn-link-danger:hover {
    background: #fee2e2;
    border-radius: 4px;
}

.cat-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}
.cat-personal { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.cat-operating { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.cat-tax { background: #fce7f3; color: #9d174d; border-color: #f9a8d4; }
.cat-internal { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.cat-income { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }

.month-tag.active {
    background: #2563eb;
    color: white;
}

/* ─── CashFlow Upload UI (Cards + Grids) ─── */
.cf-form {
    max-width: 960px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cf-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.cf-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.cf-card-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #0f172a;
}

.cf-card-hint {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.cf-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.cf-card-body {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cf-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    margin-top: 0.5rem;
}

.cf-section-label:first-child {
    margin-top: 0;
}

.cf-section-hint {
    text-transform: none;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 0.5rem;
    font-style: italic;
    letter-spacing: normal;
}

.cf-grid {
    display: grid;
    gap: 1rem;
}

.cf-grid-2 { grid-template-columns: repeat(2, 1fr); }
.cf-grid-3 { grid-template-columns: repeat(3, 1fr); }

.cf-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.cf-field-date {
    max-width: 240px;
}

.cf-field-full {
    grid-column: 1 / -1;
}

.cf-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
}

.cf-label-hint {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.7rem;
}

.cf-field input[type="text"],
.cf-field input[type="date"],
.cf-field textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: #0f172a;
    background: white;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.cf-field input[type="text"]:focus,
.cf-field input[type="date"]:focus,
.cf-field textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cf-field input::placeholder {
    color: #cbd5e1;
}

/* Input mit Euro-Suffix */
.cf-input-eur {
    position: relative;
    display: flex;
    align-items: center;
}

.cf-input-eur input {
    padding-right: 2.25rem !important;
    text-align: right;
}

.cf-input-eur span {
    position: absolute;
    right: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
    pointer-events: none;
}

/* Drop-Zone */
.cf-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.cf-dropzone:hover,
.cf-dropzone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}

.cf-dropzone.has-files {
    align-items: stretch;
    text-align: left;
}

.cf-dropzone input[type="file"] {
    display: none;
}

.cf-dropzone-icon {
    font-size: 2rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.cf-dropzone.has-files .cf-dropzone-icon {
    display: none;
}

.cf-dropzone-title {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
}

.cf-dropzone.has-files .cf-dropzone-title {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.cf-dropzone-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.cf-dropzone.has-files .cf-dropzone-hint {
    display: none;
}

.cf-file-list {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
}

.cf-dropzone.has-files .cf-file-list {
    display: flex;
}

.cf-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}

.cf-file-icon { font-size: 1rem; }
.cf-file-name { flex: 1; font-weight: 500; color: #334155; word-break: break-all; }
.cf-file-size { color: #94a3b8; font-size: 0.75rem; }

/* Action-Buttons */
.cf-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.5rem;
}

.cf-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.cf-btn-primary {
    background: #2563eb;
    color: white;
}
.cf-btn-primary:hover {
    background: #1d4ed8;
}

.cf-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.cf-btn-ghost:hover {
    background: #f8fafc;
}

/* Snapshots-Tabelle in Cards */
.cf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.cf-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.cf-table th.num,
.cf-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cf-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.cf-table tr:last-child td {
    border-bottom: none;
}

.cf-table tr:hover {
    background: #fafbfc;
}

/* Mobile */
@media (max-width: 768px) {
    .cf-grid-2,
    .cf-grid-3 {
        grid-template-columns: 1fr;
    }
    .cf-card-body {
        padding: 1.25rem;
    }
    .cf-card-header {
        padding: 1rem 1.25rem;
    }
}

/* ─── CashFlow Dashboard Tabelle ─── */
.cf-table-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.cf-table-wide {
    min-width: 100%;
    width: max-content;
}

.cf-table-wide th,
.cf-table-wide td {
    white-space: nowrap;
    padding: 0.85rem 1rem;
}

.cf-table-wide .sticky-col {
    position: sticky;
    left: 0;
    background: white;
    z-index: 2;
    box-shadow: 2px 0 4px -2px rgba(0,0,0,0.05);
}

.cf-table-wide thead .sticky-col {
    background: #fafbfc;
    z-index: 3;
}

.cf-table-wide tr:hover .sticky-col {
    background: #fafbfc;
}

.cf-table-wide .actions-col {
    position: sticky;
    right: 0;
    background: white;
    z-index: 2;
    box-shadow: -2px 0 4px -2px rgba(0,0,0,0.05);
    text-align: right;
    width: 80px;
}

.cf-table-wide thead .actions-col {
    background: #fafbfc;
    z-index: 3;
}

.cf-table-wide tr:hover .actions-col {
    background: #fafbfc;
}

.btn-link-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    color: #2563eb;
    font-size: 1rem;
    text-decoration: none;
    margin-right: 0.25rem;
    transition: background 0.15s;
}
.btn-link-edit:hover {
    background: #dbeafe;
}

/* ─── CashFlow Quick-Links zu Banken/Tools ─── */
.cf-quicklinks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.cf-quicklink {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 1rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: #334155;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: all 0.15s;
}

.cf-quicklink:hover {
    background: #f8fafc;
    border-color: #2563eb;
    color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37,99,235,0.1);
}

.cf-quicklink-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.cf-quicklink-label {
    font-weight: 600;
}

.cf-current-val {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.cf-field label {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

/* ─── CashFlow Matrix (transponiert: Zeilen=Kennzahlen, Spalten=Snapshots) ─── */
.cf-matrix-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.cf-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.cf-matrix thead th {
    position: sticky;
    top: 0;
    background: #fafbfc;
    border-bottom: 2px solid var(--border);
    padding: 0.9rem 1rem;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
    z-index: 2;
}

.cf-matrix .cf-matrix-label-col {
    position: sticky;
    left: 0;
    background: white;
    text-align: left;
    font-weight: 500;
    color: #334155;
    min-width: 260px;
    padding: 0.7rem 1.25rem;
    border-right: 2px solid var(--border);
    z-index: 1;
    white-space: nowrap;
}

.cf-matrix thead .cf-matrix-label-col {
    background: #fafbfc;
    z-index: 3;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cf-matrix-snap-col {
    min-width: 160px;
}

.cf-matrix-date {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    text-align: right;
}

.cf-matrix-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.2rem;
    margin-top: 0.2rem;
}

.cf-matrix-actions form {
    display: inline;
}

.cf-matrix-val {
    text-align: right;
    padding: 0.7rem 1rem;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    white-space: nowrap;
}

.cf-matrix-comment {
    text-align: left;
    padding: 0.7rem 1rem;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
    max-width: 240px;
    white-space: normal;
    word-wrap: break-word;
}

/* Zeile-Highlight bei Hover — nur Datenzellen */
.cf-matrix tbody tr:not(.cf-matrix-group-header):hover .cf-matrix-val,
.cf-matrix tbody tr:not(.cf-matrix-group-header):hover .cf-matrix-label-col,
.cf-matrix tbody tr:not(.cf-matrix-group-header):hover .cf-matrix-comment {
    background: #f8fafc;
}

/* Gruppen-Header */
.cf-matrix-group-header td {
    background: #eef2ff;
    color: #3730a3;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.55rem 1.25rem;
    border-top: 1px solid #c7d2fe;
    border-bottom: 1px solid #c7d2fe;
    position: sticky;
    left: 0;
}

/* Summen-Zeilen fett */
.cf-matrix-sum .cf-matrix-label-col {
    font-weight: 700;
    color: #0f172a;
}

.cf-matrix-sum .cf-matrix-val {
    font-weight: 700;
    color: #0f172a;
    background: #f8fafc;
}

.cf-matrix-sum:hover .cf-matrix-val {
    background: #f1f5f9 !important;
}

/* Neueste Spalte dezent hervorheben */
.cf-matrix .cf-matrix-latest {
    background: #eff6ff !important;
}

.cf-matrix thead .cf-matrix-latest {
    background: #dbeafe !important;
}

.cf-matrix-sum.cf-matrix-sum .cf-matrix-latest,
.cf-matrix .cf-matrix-sum td.cf-matrix-latest {
    background: #dbeafe !important;
}
