:root {
    --bg-color: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --radius: 12px;
}

[data-theme="light"] {
    --bg-color: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.2s ease, color 0.2s ease;
    min-height: 100vh;
}

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

/* Layout */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

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

.nav-item {
    color: var(--text-muted);
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    transition: all 0.15s ease;
}
.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.container {
    max-width: 1350px;
    margin: 25px auto;
    padding: 0 20px;
}

/* Cards & Components */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
}

.kpi-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
}
.kpi-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-muted { color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn:hover {
    text-decoration: none;
    opacity: 0.92;
    transform: translateY(-1px);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; border-radius: 6px; }

/* Forms & Inputs */
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-primary);
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    background: #090d16;
    border: 2px solid #475569;
    border-radius: 8px;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}
.form-control::placeholder {
    color: #64748b;
    opacity: 0.8;
}
.form-control:hover {
    border-color: #64748b;
    background: #0c121e;
}
.form-control:focus {
    border-color: #38bdf8;
    background: #0f172a;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .form-control {
    background: #ffffff;
    border: 2px solid #cbd5e1;
    color: #0f172a;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .form-control:hover {
    border-color: #94a3b8;
}
[data-theme="light"] .form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
}
th, td {
    padding: 10px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
th {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    white-space: nowrap;
}
tbody tr:hover {
    background: var(--bg-hover);
}

/* 2x1 Button Grid für Tabellen-Aktionen: Oben Hinzufügen / Editieren, Unten Löschen */
.btn-grid-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 140px;
    margin-left: auto;
}
.btn-grid-actions .btn {
    width: 100%;
    height: 27px;
    padding: 0 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
}
.btn-grid-actions .btn-delete-full {
    grid-column: span 2;
}

/* Progress Bar */
.progress-container {
    background: var(--bg-hover);
    border-radius: 10px;
    overflow: hidden;
    height: 12px;
    width: 100%;
    margin: 8px 0;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: 10px;
    transition: width 0.4s ease;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
}
.badge-monthly { background: #3b82f622; color: #60a5fa; }
.badge-quarterly { background: #8b5cf622; color: #a78bfa; }
.badge-semi_annual { background: #f59e0b22; color: #fbbf24; }
.badge-annual { background: #ec489922; color: #f472b6; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}
.alert-success { background: #10b98122; color: #34d399; border: 1px solid #10b98144; }
.alert-danger { background: #ef444422; color: #f87171; border: 1px solid #ef444444; }
.alert-info { background: #06b6d422; color: #38bdf8; border: 1px solid #06b6d444; }

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-backdrop.active {
    display: flex;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--card-shadow);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

/* Utilities */
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.text-right { text-align: right; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .app-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .nav-links { flex-wrap: wrap; width: 100%; }
    .kpi-grid { grid-template-columns: 1fr; }
}
