:root {
    --bh-primary: #2563eb;
    --bh-primary-hover: #1d4ed8;
    --bh-primary-soft: #eff6ff;
    --bh-accent: #0d9488;
    --bh-accent-soft: #f0fdfa;
    --bh-success: #059669;
    --bh-warning: #d97706;
    --bh-danger: #dc2626;
    --bh-sidebar: #0f172a;
    --bh-sidebar-border: #1e293b;
    --bh-sidebar-text: #94a3b8;
    --bh-sidebar-active: #1e293b;
    --bh-bg: #f1f5f9;
    --bh-surface: #ffffff;
    --bh-border: #e2e8f0;
    --bh-text: #0f172a;
    --bh-text-muted: #64748b;
    --bh-radius: 12px;
    --bh-radius-sm: 8px;
    --bh-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --bh-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
    --bh-font: 'DM Sans', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--bh-font);
    background: var(--bh-bg);
    color: var(--bh-text);
    font-size: 0.9375rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--bh-sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    border-right: 1px solid var(--bh-sidebar-border);
    transition: transform 0.25s ease;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--bh-sidebar-border);
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--bh-primary), var(--bh-accent));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.3;
    color: #f8fafc;
}

.sidebar-brand-meta {
    font-size: 0.75rem;
    color: var(--bh-sidebar-text);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem 1rem;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--bh-sidebar-border); border-radius: 4px; }

.sidebar-section {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 1rem 0.75rem 0.35rem;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--bh-sidebar-text);
    padding: 0.5rem 0.75rem;
    border-radius: var(--bh-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 1px;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.sidebar .nav-link:hover {
    background: var(--bh-sidebar-active);
    color: #e2e8f0;
}

.sidebar .nav-link.active {
    background: var(--bh-sidebar-active);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--bh-primary);
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--bh-sidebar-border);
}

.sidebar-footer .btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--bh-sidebar-border);
    border-radius: var(--bh-radius-sm);
    color: var(--bh-sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-footer .btn-logout:hover {
    background: var(--bh-sidebar-active);
    color: #e2e8f0;
    border-color: #334155;
}

.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--bh-surface);
    border-bottom: 1px solid var(--bh-border);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--bh-text);
    margin: 0;
}

.topbar-subtitle {
    font-size: 0.8125rem;
    color: var(--bh-text-muted);
    margin: 0;
}

.content-area {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
    max-width: none;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--bh-border);
    border-radius: var(--bh-radius-sm);
    padding: 0.375rem 0.5rem;
    color: var(--bh-text);
    cursor: pointer;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; align-items: center; }
}

/* ── Cards ── */
.card {
    border: 1px solid var(--bh-border);
    border-radius: var(--bh-radius);
    box-shadow: var(--bh-shadow);
    background: var(--bh-surface);
    overflow: hidden;
}

.card-header {
    background: var(--bh-surface);
    border-bottom: 1px solid var(--bh-border);
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--bh-text);
}

.card-body { padding: 1.25rem; }
.card-footer {
    background: #f8fafc;
    border-top: 1px solid var(--bh-border);
    padding: 0.75rem 1.25rem;
}

/* ── Stat cards ── */
.stat-card {
    border: 1px solid var(--bh-border);
    border-radius: var(--bh-radius);
    background: var(--bh-surface);
    box-shadow: var(--bh-shadow);
    padding: 1.25rem;
    height: 100%;
    transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
    box-shadow: var(--bh-shadow-md);
    transform: translateY(-1px);
}

.stat-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin-bottom: 0.875rem;
}

.stat-card-icon.income { background: var(--bh-accent-soft); color: var(--bh-accent); }
.stat-card-icon.expense { background: #fef2f2; color: var(--bh-danger); }
.stat-card-icon.result { background: var(--bh-primary-soft); color: var(--bh-primary); }
.stat-card-icon.open { background: #fffbeb; color: var(--bh-warning); }

.stat-card-label {
    font-size: 0.8125rem;
    color: var(--bh-text-muted);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bh-text);
    letter-spacing: -0.02em;
}

.stat-card-value.positive { color: var(--bh-success); }
.stat-card-value.negative { color: var(--bh-danger); }

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

.page-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.page-header-desc {
    font-size: 0.875rem;
    color: var(--bh-text-muted);
    margin: 0.25rem 0 0;
}

/* ── Tables ── */
.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--bh-border);
    color: var(--bh-text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: var(--bh-text);
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

.table .amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.table a:not(.btn) { color: var(--bh-primary); text-decoration: none; font-weight: 500; }
.table a:not(.btn):hover { color: var(--bh-primary-hover); text-decoration: underline; }

.table-empty {
    text-align: center;
    padding: 3rem 1rem !important;
    color: var(--bh-text-muted);
}

.table-empty i { font-size: 2rem; opacity: 0.4; display: block; margin-bottom: 0.5rem; }

/* ── Badges ── */
.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-status.concept, .badge-status.open { background: #fef3c7; color: #92400e; }
.badge-status.betaald, .badge-status.success { background: #d1fae5; color: #065f46; }
.badge-status.warning { background: #fef3c7; color: #92400e; }
.badge-status.secondary { background: #f1f5f9; color: #475569; }

/* ── Buttons ── */
.btn {
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--bh-radius-sm);
    padding: 0.5rem 1rem;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--bh-primary);
    border-color: var(--bh-primary);
    color: #fff;
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--bh-primary-hover);
    border-color: var(--bh-primary-hover);
    color: #fff;
}

.btn-outline-secondary {
    border-color: var(--bh-border);
    color: var(--bh-text-muted);
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--bh-text);
}

.btn-sm { padding: 0.3rem 0.625rem; font-size: 0.8125rem; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* ── Forms ── */
.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--bh-text);
    margin-bottom: 0.375rem;
}

.form-control, .form-select {
    border: 1px solid var(--bh-border);
    border-radius: var(--bh-radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--bh-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── Alerts ── */
.alert {
    border: none;
    border-radius: var(--bh-radius-sm);
    font-size: 0.875rem;
    padding: 0.875rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}

.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }

/* ── Quick links ── */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.quick-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: var(--bh-surface);
    border: 1px solid var(--bh-border);
    border-radius: var(--bh-radius-sm);
    color: var(--bh-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.quick-link:hover {
    border-color: var(--bh-primary);
    box-shadow: var(--bh-shadow);
    color: var(--bh-primary);
}

.quick-link i {
    font-size: 1.125rem;
    color: var(--bh-primary);
}

/* ── Login ── */
.login-page {
    min-height: 100vh;
    display: flex;
}

.login-brand {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0d9488 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.login-brand-content { position: relative; z-index: 1; max-width: 420px; }

.login-brand h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
}

.login-brand p {
    font-size: 1rem;
    opacity: 0.85;
    line-height: 1.6;
}

.login-brand-features {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-brand-feature {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    opacity: 0.9;
}

.login-brand-feature i {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-form-panel {
    width: 480px;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bh-bg);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bh-surface);
    border: 1px solid var(--bh-border);
    border-radius: var(--bh-radius);
    box-shadow: var(--bh-shadow-md);
    padding: 2rem;
}

.login-card h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    color: var(--bh-text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.75rem;
}

@media (max-width: 767.98px) {
    .login-page { flex-direction: column; }
    .login-brand { padding: 2rem; min-height: auto; }
    .login-brand-features { display: none; }
    .login-form-panel { width: 100%; }
}

/* ── Pagination ── */
.pagination { margin: 0; gap: 0.25rem; }
.page-link {
    border-radius: var(--bh-radius-sm) !important;
    border-color: var(--bh-border);
    color: var(--bh-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.page-item.active .page-link {
    background: var(--bh-primary);
    border-color: var(--bh-primary);
}

/* ── Misc ── */
code {
    font-size: 0.8125rem;
    background: var(--bh-primary-soft);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.input-group-text {
    border-color: var(--bh-border);
    color: var(--bh-text-muted);
}

.input-group .form-control:focus {
    box-shadow: none;
}

.input-group:focus-within {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    border-radius: var(--bh-radius-sm);
}

.input-group:focus-within .input-group-text,
.input-group:focus-within .form-control {
    border-color: var(--bh-primary);
}
