:root {
    --df-sidebar-width: 272px;
    --df-radius: 1.25rem;
    --df-primary: #1d4ed8;
    --df-primary-dark: #1e40af;
    --df-accent: #dbeafe;
    --df-surface: rgba(255, 255, 255, 0.88);
    --df-surface-strong: #ffffff;
    --df-border: rgba(29, 78, 216, 0.12);
    --df-shadow: 0 1rem 3rem rgba(30, 64, 175, 0.12);
    --bs-primary: var(--df-primary);
    --bs-primary-rgb: 29, 78, 216;
    --bs-link-color: var(--df-primary);
    --bs-link-hover-color: var(--df-primary-dark);
}

body {
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.22), transparent 36%),
        radial-gradient(circle at top right, rgba(147, 197, 253, 0.3), transparent 34%),
        linear-gradient(180deg, #f8fbff 0%, #eef5ff 52%, #e6f0ff 100%);
    color: #16304f;
    min-height: 100vh;
}

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

.auth-shell .bg-primary {
    background:
        linear-gradient(160deg, #1d4ed8 0%, #2563eb 52%, #60a5fa 100%) !important;
}

.glass-card,
.card {
    background: var(--df-surface);
    border: 1px solid var(--df-border);
    border-radius: var(--df-radius);
    box-shadow: var(--df-shadow);
}

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

.sidebar {
    width: var(--df-sidebar-width);
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.16);
    background:
        linear-gradient(180deg, #1e90ff 0%, #1976f3 52%, #1565d8 100%);
    backdrop-filter: blur(20px);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.sidebar-brand-icon {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.sidebar-subtitle,
.sidebar-label {
    color: rgba(255, 255, 255, 0.76);
}

.sidebar-toggle {
    border-radius: 0.9rem;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.sidebar-footer {
    border-color: rgba(255, 255, 255, 0.14) !important;
}

.sidebar,
.sidebar .nav-link,
.sidebar .nav-link i,
.sidebar .h5,
.sidebar h2,
.sidebar p,
.sidebar .small,
.sidebar .fw-semibold,
.sidebar .btn,
.sidebar .sidebar-subtitle,
.sidebar .sidebar-label,
.sidebar .text-body-secondary {
    color: #ffffff !important;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.sidebar .nav-link {
    font-weight: 700;
}

.sidebar .bg-body-tertiary {
    background: rgba(255, 255, 255, 0.14) !important;
}

.sidebar .btn-outline-danger {
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
    background: transparent;
}

.sidebar .btn-outline-danger:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.4);
}

.sidebar .nav-link {
    border-radius: 0.9rem;
    color: #21416b;
    padding: 0.85rem 1rem;
    font-weight: 500;
    transition: 0.2s ease;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.14), rgba(96, 165, 250, 0.18));
    color: var(--df-primary-dark);
    transform: translateX(2px);
}

.content-area {
    flex: 1;
    padding: 1.5rem;
}

.metric-card {
    overflow: hidden;
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(239, 246, 255, 0.9));
}

.metric-card::after {
    content: '';
    position: absolute;
    inset: auto -30px -40px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(29, 78, 216, 0.09);
}

.metric-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: linear-gradient(180deg, #2563eb, #93c5fd);
}

.table thead th {
    white-space: nowrap;
    color: #31527c;
    font-size: 0.82rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(191, 219, 254, 0.12);
}

.table tbody tr:hover {
    background: rgba(191, 219, 254, 0.14);
}

.badge-soft {
    background: rgba(29, 78, 216, 0.12);
}

.badge-transaction {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.78rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: capitalize;
    opacity: 1;
}

.badge-fine {
    background: #fee2e2 !important;
    border-color: #fca5a5;
    color: #b42318 !important;
}

.badge-expense {
    background: #fef3c7 !important;
    border-color: #fcd34d;
    color: #8a5b00 !important;
}

.badge-prize {
    background: #dcfce7 !important;
    border-color: #86efac;
    color: #146c43 !important;
}

.badge-public-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.82rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-public-ledger {
    background: #dbeafe !important;
    border-color: #93c5fd;
    color: #1e40af !important;
}

.badge-public-summary {
    background: #e0f2fe !important;
    border-color: #7dd3fc;
    color: #075985 !important;
}

.badge-public-summary-only {
    background: #e5e7eb !important;
    border-color: #cbd5e1;
    color: #334155 !important;
}

.theme-toggle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border-color: rgba(29, 78, 216, 0.16);
    background: rgba(255, 255, 255, 0.75);
    color: var(--df-primary-dark);
}

.chart-card {
    min-height: 360px;
}

.chart-frame {
    position: relative;
    height: 320px;
    width: 100%;
}

.chart-frame canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.empty-state {
    padding: 2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.65);
    border: 1px dashed rgba(59, 130, 246, 0.28);
    border-radius: var(--df-radius);
}

.btn {
    border-radius: 0.95rem;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    box-shadow: 0 0.6rem 1.4rem rgba(37, 99, 235, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    border-color: #1e40af;
}

.btn-outline-primary {
    border-color: rgba(37, 99, 235, 0.3);
    color: var(--df-primary-dark);
    background: rgba(255, 255, 255, 0.7);
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-danger:hover {
    transform: translateY(-1px);
}

.form-control,
.form-select {
    border-radius: 0.9rem;
    border-color: rgba(59, 130, 246, 0.2);
    background: rgba(255, 255, 255, 0.84);
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37, 99, 235, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.12);
}

.alert {
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 0.8rem 2rem rgba(15, 23, 42, 0.08);
}

.rounded-4.bg-body-tertiary,
.bg-body-tertiary {
    background: rgba(219, 234, 254, 0.42) !important;
}

[data-bs-theme="dark"] {
    --df-surface: rgba(17, 29, 52, 0.96);
    --df-surface-strong: #14233d;
    --df-border: rgba(147, 197, 253, 0.22);
    --df-shadow: 0 1.1rem 3rem rgba(2, 6, 23, 0.48);
    --bs-body-bg: #081121;
    --bs-body-bg-rgb: 8, 17, 33;
    --bs-body-color: #dbeafe;
    --bs-secondary-color: #93c5fd;
}

[data-bs-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.22), transparent 32%),
        radial-gradient(circle at top right, rgba(96, 165, 250, 0.12), transparent 28%),
        linear-gradient(180deg, #081121 0%, #0b1730 48%, #102042 100%);
    color: #dbeafe;
}

[data-bs-theme="dark"] .sidebar {
    background:
        linear-gradient(180deg, rgba(10, 20, 38, 0.96) 0%, rgba(15, 35, 68, 0.9) 100%);
}

[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .glass-card {
    background:
        linear-gradient(180deg, rgba(20, 35, 61, 0.98) 0%, rgba(14, 27, 49, 0.96) 100%);
    border-color: rgba(147, 197, 253, 0.2);
    box-shadow:
        0 1.2rem 2.8rem rgba(2, 6, 23, 0.44),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: #c7dcff;
}

[data-bs-theme="dark"] .sidebar .nav-link.active,
[data-bs-theme="dark"] .sidebar .nav-link:hover {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(96, 165, 250, 0.18));
}

[data-bs-theme="dark"] .metric-card,
[data-bs-theme="dark"] .metric-card::before,
[data-bs-theme="dark"] .rounded-4.bg-body-tertiary,
[data-bs-theme="dark"] .bg-body-tertiary,
[data-bs-theme="dark"] .empty-state,
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .theme-toggle,
[data-bs-theme="dark"] .btn-outline-primary {
    background-color: rgba(20, 35, 61, 0.88) !important;
}

[data-bs-theme="dark"] .metric-card {
    background:
        linear-gradient(180deg, rgba(22, 40, 72, 0.98), rgba(17, 31, 56, 0.96));
}

[data-bs-theme="dark"] .metric-card::after {
    background: rgba(96, 165, 250, 0.12);
}

[data-bs-theme="dark"] .rounded-4.bg-body-tertiary,
[data-bs-theme="dark"] .bg-body-tertiary,
[data-bs-theme="dark"] .empty-state {
    border: 1px solid rgba(147, 197, 253, 0.16);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    border-color: rgba(147, 197, 253, 0.22);
    color: #eff6ff;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: rgba(191, 219, 254, 0.6);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: rgba(24, 43, 74, 0.96) !important;
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.16);
}

[data-bs-theme="dark"] .empty-state {
    background: rgba(18, 34, 58, 0.9) !important;
}

[data-bs-theme="dark"] .btn-outline-primary {
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, 0.28);
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
    background: rgba(37, 99, 235, 0.16);
}

[data-bs-theme="dark"] .table thead th,
[data-bs-theme="dark"] .text-body-secondary {
    color: #93c5fd !important;
}

[data-bs-theme="dark"] .table {
    --bs-table-color: #e2ecff;
}

[data-bs-theme="dark"] .badge-fine {
    background: #7f1d1d !important;
    border-color: #ef4444;
    color: #fee2e2 !important;
}

[data-bs-theme="dark"] .badge-expense {
    background: #78350f !important;
    border-color: #f59e0b;
    color: #fde68a !important;
}

[data-bs-theme="dark"] .badge-prize {
    background: #14532d !important;
    border-color: #22c55e;
    color: #dcfce7 !important;
}

[data-bs-theme="dark"] .badge-public-ledger {
    background: #1d4ed8 !important;
    border-color: #60a5fa;
    color: #eff6ff !important;
}

[data-bs-theme="dark"] .badge-public-summary {
    background: #0f766e !important;
    border-color: #2dd4bf;
    color: #ecfeff !important;
}

[data-bs-theme="dark"] .badge-public-summary-only {
    background: #334155 !important;
    border-color: #94a3b8;
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .table tbody tr:hover {
    background: rgba(37, 99, 235, 0.12);
}

@media (max-width: 991.98px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        min-height: 0;
        position: relative;
        border-right: 0;
        border-bottom: 1px solid var(--df-border);
        border-radius: 0 0 1.25rem 1.25rem;
        margin-bottom: 1rem;
    }

    .content-area {
        padding: 1rem;
    }

    .sidebar .collapse {
        margin-top: 0.75rem;
    }

    .sidebar .nav-link {
        padding: 0.9rem 1rem;
    }

    .sidebar-footer {
        padding-bottom: 0.25rem;
    }

    .chart-frame {
        height: 280px;
    }
}
