:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f9fafc;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #15803d;
    --warning: #b45309;
    --danger: #dc2626;
    --bank: #2563eb;
    --kfw: #7c3aed;
    --privat: #ea580c;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --radius-sm: 10px;
    --container: 1380px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

.topnav {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topnav-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand a {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text);
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    background: #eef2ff;
    color: var(--primary);
}

.logout-link {
    background: #111827;
    color: #fff !important;
}

.logout-link:hover {
    background: #000000;
}

.page-container {
    max-width: var(--container);
    margin: 32px auto;
    padding: 0 20px 40px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.page-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-compact {
    padding: 18px;
}

.card-title {
    margin: 0 0 18px;
    font-size: 20px;
    font-weight: 700;
}

.grid {
    display: grid;
    gap: 20px;
}

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

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

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.stat-card.bank {
    border-left: 6px solid var(--bank);
}

.stat-card.kfw {
    border-left: 6px solid var(--kfw);
}

.stat-card.privat {
    border-left: 6px solid var(--privat);
}

.stat-card.neutral {
    border-left: 6px solid #334155;
}

.stat-label {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #ffffff;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

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

button:active,
.btn:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: #dc2626;
    color: #ffffff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-small {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 10px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
}

.alert {
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.table-wrap {
    overflow-x: auto;
    width: 100%;
}

.table-wrap table,
table {
    width: 100%;
    min-width: 1450px;
    border-collapse: collapse;
    background: #ffffff;
    table-layout: auto;
}

thead th {
    text-align: left;
    font-size: 13px;
    color: var(--muted);
    font-weight: 700;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody td,
tfoot th,
tfoot td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tbody tr:hover td {
    background: #fafcff;
}

tfoot th,
tfoot td {
    background: #f8fafc;
    font-weight: 700;
}

.table-wrap th:nth-child(1),
.table-wrap td:nth-child(1) {
    min-width: 220px;
}

.table-wrap th:nth-child(2),
.table-wrap td:nth-child(2) {
    min-width: 160px;
}

.table-wrap th:nth-child(3),
.table-wrap td:nth-child(3),
.table-wrap th:nth-child(4),
.table-wrap td:nth-child(4),
.table-wrap th:nth-child(5),
.table-wrap td:nth-child(5),
.table-wrap th:nth-child(6),
.table-wrap td:nth-child(6),
.table-wrap th:nth-child(7),
.table-wrap td:nth-child(7),
.table-wrap th:nth-child(8),
.table-wrap td:nth-child(8),
.table-wrap th:nth-child(9),
.table-wrap td:nth-child(9),
.table-wrap th:nth-child(10),
.table-wrap td:nth-child(10) {
    min-width: 155px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-bank {
    background: rgba(37, 99, 235, 0.1);
    color: var(--bank);
}

.badge-kfw {
    background: rgba(124, 58, 237, 0.1);
    color: var(--kfw);
}

.badge-privat {
    background: rgba(234, 88, 12, 0.1);
    color: var(--privat);
}

.badge-akonto {
    background: rgba(180, 83, 9, 0.12);
    color: #b45309;
}

.badge-schlussrechnung {
    background: rgba(21, 128, 61, 0.12);
    color: #15803d;
}

.badge-muted {
    background: #eef2f7;
    color: #475569;
}

.list-clean {
    list-style: none;
    margin: 0;
    padding: 0;
}

.list-clean li + li {
    margin-top: 10px;
}

.empty-state {
    color: var(--muted);
    padding: 12px 0;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.15), transparent 30%),
        radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.14), transparent 30%),
        var(--bg);
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 32px;
}

.login-card h1 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 28px;
}

.login-card p {
    margin-top: 0;
    color: var(--muted);
    margin-bottom: 24px;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}

.table-muted {
    color: var(--muted);
    font-size: 13px;
}

.text-right {
    text-align: right !important;
}

.text-muted {
    color: var(--muted);
}

.nowrap {
    white-space: nowrap !important;
}

.text-success {
    color: #15803d !important;
    font-weight: 700 !important;
}

.text-danger {
    color: #dc2626 !important;
    font-weight: 700 !important;
}

tr.row-complete > td {
    background: rgba(21, 128, 61, 0.08) !important;
}

tr.row-complete:hover > td {
    background: rgba(21, 128, 61, 0.12) !important;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
    gap: 14px;
    align-items: end;

@media (max-width: 1100px) {
    .grid-4,
    .grid-3,
    .grid-2,
    .form-grid,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .topnav-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        width: 100%;
    }

    .page-container {
        padding: 0 14px 30px;
    }

    .card {
        padding: 18px;
    }

    .stat-value {
        font-size: 24px;
    }

   
}
}