/* ═══════════════════════════════════════
   Kredite — App Styles
   ═══════════════════════════════════════ */

/* Layout */
.page-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.sidebar-shell {
    background: var(--ui-bg-surface);
    border-right: 1px solid var(--ui-border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
}

.main-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar-shell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--ui-border);
    background: var(--ui-bg-surface);
}

.topbar-actions-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-shell {
    padding: 2rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.content-shell > * { padding-left: 2rem; padding-right: 2rem; box-sizing: border-box; }
.content-shell > .step-chart-panel { padding-left: 0; padding-right: 0; }

/* Brand */
.brand-block { margin-bottom: 2rem; }
.brand-kicker { font-size: var(--ui-font-caption); color: var(--ui-text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.brand-title { font-size: var(--ui-font-title); font-weight: 600; text-decoration: none; color: var(--ui-text); }
.brand-copy { font-size: var(--ui-font-caption); color: var(--ui-text-muted); margin: 0.25rem 0 0; }

/* Nav */
.nav-section-label { font-size: var(--ui-font-caption); color: var(--ui-text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; }
.nav-stack { display: flex; flex-direction: column; gap: 0.25rem; }
.nav-entry { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0.75rem; border-radius: var(--ui-radius-control); text-decoration: none; color: var(--ui-text); font-size: var(--ui-font-body); }
.nav-entry:hover { background: var(--ui-bg-muted); }
.nav-entry.active { background: var(--ui-primary-soft); color: var(--ui-primary); font-weight: 600; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: var(--ui-radius-control); background: var(--ui-bg-accent); font-size: 0.7rem; font-weight: 600; color: var(--ui-primary); }

/* Theme toggle */
.theme-toggle { background: var(--ui-bg-muted); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control); padding: 0.35rem 0.75rem; font-size: var(--ui-font-caption); cursor: pointer; color: var(--ui-text-muted); }

/* Dashboard */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.dashboard-card { background: var(--ui-bg-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-panel); padding: 1.5rem; box-shadow: var(--ui-shadow-soft); }
.card-label { font-size: var(--ui-font-caption); color: var(--ui-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem; }
.card-value { font-size: 1.5rem; font-weight: 600; color: var(--ui-text); }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.data-table th { text-align: left; padding: 0.75rem 1rem; font-size: var(--ui-font-caption); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ui-text-muted); border-bottom: 2px solid var(--ui-border); }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--ui-border); }
.data-table tr:hover td { background: var(--ui-bg-muted); }

/* Toolbar */
.toolbar-button { background: var(--ui-primary); color: #fff; border: none; border-radius: var(--ui-radius-control); padding: 0.5rem 1rem; font-size: var(--ui-font-body); cursor: pointer; }
.toolbar-button:hover { background: var(--ui-primary-strong); }
.portfolio-toolbar { display: flex; gap: 0.75rem; }

/* Login */
.login-panel { max-width: 360px; margin: 4rem auto; padding: 2rem; background: var(--ui-bg-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-panel); box-shadow: var(--ui-shadow-card); }
.login-panel h2 { margin: 0 0 1.5rem; }
.login-field { margin-bottom: 1rem; }
.login-field label { display: block; font-size: var(--ui-font-caption); color: var(--ui-text-muted); margin-bottom: 0.25rem; }
.login-field input { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-control); font-size: var(--ui-font-body); box-sizing: border-box; }
.login-btn { width: 100%; padding: 0.6rem; background: var(--ui-primary); color: #fff; border: none; border-radius: var(--ui-radius-control); font-size: var(--ui-font-body); cursor: pointer; }
.login-btn:hover { background: var(--ui-primary-strong); }
.login-error { background: var(--ui-danger-bg); color: var(--ui-danger-text); padding: 0.5rem 0.75rem; border-radius: var(--ui-radius-control); margin-bottom: 1rem; font-size: var(--ui-font-caption); }

/* Chart (Liniendiagramm) */
.step-chart-panel { margin-bottom: 0.75rem; display: flex; flex-direction: column; }
.step-chart-svg { width: 100%; height: 220px; display: block; cursor: grab; user-select: none; }
.step-chart-svg text { font-family: var(--ui-font-family); font-size: 0.65rem; fill: var(--ui-text-faint); }
.step-chart-svg .grid-line { stroke: var(--ui-border); stroke-dasharray: 2 3; }
.step-chart-svg .axis-line { stroke: var(--ui-border-strong); }
.step-chart-svg .chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.step-chart-svg .hover-dot { fill: transparent; stroke: none; pointer-events: none; }
.step-chart-svg .stichtag-line { stroke: var(--ui-primary); stroke-width: 1.5; stroke-dasharray: 4 3; }
.step-chart-svg .stichtag-label { fill: var(--ui-primary); font-size: 0.6rem; font-weight: 600; }
.step-chart-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: 0.5rem; padding: 0 2rem; font-size: var(--ui-font-caption); color: var(--ui-text-muted); }
.step-chart-legend-item { display: inline-flex; align-items: center; gap: 0.3rem; }
.step-chart-legend-swatch { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

/* ═══════════════════════════════════════
   Bootstrap Dark-Theme Overrides
   (dark theme variables come from design-system.css)
   ═══════════════════════════════════════ */

/* Base table */
.theme-dark .table {
    --bs-table-bg: var(--ui-bg-surface);
    --bs-table-color: var(--ui-text);
    --bs-table-border-color: var(--ui-border);
    --bs-table-striped-bg: var(--ui-bg-muted);
    --bs-table-striped-color: var(--ui-text);
    --bs-table-hover-bg: var(--ui-bg-accent);
    --bs-table-hover-color: var(--ui-text);
    color: var(--ui-text);
    border-color: var(--ui-border);
}

/* table-light thead */
.theme-dark .table-light,
.theme-dark .table-light th,
.theme-dark .table-light td {
    --bs-table-bg: var(--ui-bg-muted);
    --bs-table-color: var(--ui-text-faint);
    background: var(--ui-bg-muted) !important;
    color: var(--ui-text-faint) !important;
}

/* table-secondary (footer) */
.theme-dark .table-secondary,
.theme-dark .table-secondary th,
.theme-dark .table-secondary td {
    --bs-table-bg: var(--ui-bg-muted);
    --bs-table-color: var(--ui-text);
    background: var(--ui-bg-muted) !important;
    color: var(--ui-text) !important;
}

/* table-warning rows */
.theme-dark .table-warning,
.theme-dark .table-warning > td,
.theme-dark .table-warning > th,
.theme-dark .table > tbody > tr.table-warning > td {
    --bs-table-bg: var(--ui-warning-bg);
    --bs-table-color: var(--ui-warning-text);
    background: var(--ui-warning-bg) !important;
    color: var(--ui-text) !important;
}

/* table-bordered */
.theme-dark .table-bordered > :not(caption) > * > * {
    border-color: var(--ui-border);
}

/* Card */
.theme-dark .card {
    background: var(--ui-bg-surface);
    border-color: var(--ui-border);
    color: var(--ui-text);
}
.theme-dark .card-header {
    background: var(--ui-bg-muted);
    border-color: var(--ui-border);
    color: var(--ui-text);
}
.theme-dark .card-body {
    color: var(--ui-text);
}

/* Forms */
.theme-dark .form-control,
.theme-dark .form-select {
    background: var(--ui-bg-muted);
    border-color: var(--ui-border-strong);
    color: var(--ui-text);
}
.theme-dark .form-control:focus,
.theme-dark .form-select:focus {
    background: var(--ui-bg-muted);
    border-color: var(--ui-primary);
    color: var(--ui-text);
    box-shadow: 0 0 0 2px rgba(91, 156, 246, 0.2);
}
.theme-dark .form-label {
    color: var(--ui-text-muted);
}

/* Tabs */
.theme-dark .nav-tabs {
    border-color: var(--ui-border);
}
.theme-dark .nav-tabs .nav-link {
    color: var(--ui-text-muted);
}
.theme-dark .nav-tabs .nav-link:hover {
    border-color: var(--ui-border);
    color: var(--ui-text);
}
.theme-dark .nav-tabs .nav-link.active {
    background: var(--ui-bg-surface);
    border-color: var(--ui-border);
    border-bottom-color: var(--ui-bg-surface);
    color: var(--ui-text);
}

/* Alerts */
.theme-dark .alert-danger {
    background: var(--ui-danger-bg);
    border-color: #3a1a1a;
    color: var(--ui-danger-text);
}
.theme-dark .alert-info {
    background: #1a2d3b;
    border-color: #2d4a5c;
    color: #a0d0f8;
}

/* Badges — no text-dark forcing */
.theme-dark .badge.bg-primary {
    background: var(--ui-primary-soft) !important;
    color: var(--ui-primary) !important;
}
.theme-dark .badge.bg-success {
    background: var(--ui-success-bg) !important;
    color: var(--ui-success-text) !important;
}
.theme-dark .badge.bg-info {
    background: var(--ui-bg-accent) !important;
    color: var(--ui-primary) !important;
}
.theme-dark .badge.bg-warning {
    background: var(--ui-warning-bg) !important;
    color: var(--ui-warning-text) !important;
}
.theme-dark .badge.bg-danger {
    background: var(--ui-danger-bg) !important;
    color: var(--ui-danger-text) !important;
}

/* Bootstrap text helpers */
.theme-dark .text-dark {
    color: var(--ui-text) !important;
}
.theme-dark .text-muted {
    color: var(--ui-text-muted) !important;
}

/* Bootstrap bg helpers */
.theme-dark .bg-light {
    background: var(--ui-bg-muted) !important;
}
.theme-dark .bg-white {
    background: var(--ui-bg-surface) !important;
}

/* Buttons */
.theme-dark .btn-outline-primary {
    color: var(--ui-primary);
    border-color: var(--ui-primary);
}
.theme-dark .btn-outline-primary:hover,
.theme-dark .btn-outline-primary:active {
    background: var(--ui-primary);
    color: #fff;
}
.theme-dark .btn-outline-primary:disabled {
    color: var(--ui-text-faint);
    border-color: var(--ui-border);
}
.theme-dark .btn-secondary {
    background: var(--ui-bg-muted);
    border-color: var(--ui-border-strong);
    color: var(--ui-text);
}
.theme-dark .btn-secondary:hover {
    background: var(--ui-bg-accent);
}

/* Spinner */
.theme-dark .spinner-border {
    color: var(--ui-text);
}

/* code */
.theme-dark code {
    color: var(--ui-primary);
    background: var(--ui-bg-muted);
    padding: 0.15em 0.35em;
    border-radius: 3px;
}

/* hr */
.theme-dark hr {
    border-color: var(--ui-border);
    opacity: 1;
}
