:root {
    --ink: #1e2a39;
    --ocean: #0f2f57;
    --azure: #1d4f8c;
    --mint: #0d9b6f;
    --warning: #bb7a12;
    --danger: #b94a48;
    --info: #3f6ea1;
    --sun: #d7e2ee;
    --coral: #b94a48;
    --paper: #f5f7fb;
    --card: #ffffff;
    --surface-0: #ffffff;
    --surface-1: #f8fbff;
    --surface-2: #eef3f9;
    --line-soft: rgba(15, 47, 87, .10);
    --line-strong: rgba(15, 47, 87, .18);
    --shadow: 0 10px 30px rgba(15, 47, 87, .12);
    --radius: 18px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --text-xs: 12px;
    --text-sm: 14px;
    --text-md: 16px;
    --text-lg: 20px;
    --text-xl: 28px;
    --text-2xl: 40px;
}

* { box-sizing: border-box; }
body {
    font-family: "Manrope", system-ui, -apple-system, Segoe UI, sans-serif;
    background: radial-gradient(1200px 600px at -10% -20%, #e2eaf4 0%, rgba(226,234,244,0) 60%),
                radial-gradient(1200px 600px at 110% -10%, #eef3f9 0%, rgba(238,243,249,0) 55%),
                var(--paper);
    color: var(--ink);
    line-height: 1.5;
    letter-spacing: .01em;
}

h1, h2, h3, h4, h5 {
    color: #122840;
    letter-spacing: -0.02em;
}

.sidebar {
    min-height: 100vh;
    color: #fff;
    background: linear-gradient(180deg, #0b2748 0%, #0f2f57 100%);
}

.sidebar a {
    color: #e6edf5;
    text-decoration: none;
    display: block;
    padding: 10px 16px;
}

.sidebar .brand {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .4px;
}

.sidebar nav form button {
    border-radius: 10px;
}

.sidebar a {
    border-radius: 10px;
    margin: 4px 8px;
}

.sidebar a:hover {
    background: #1d4f8c;
    color: #fff;
    transform: translateX(2px);
    transition: transform .15s ease;
}

.mobile-topbar {
    backdrop-filter: blur(6px);
    background: rgba(255,255,255,.92);
}

.mobile-menu {
    padding: 8px 0 12px;
    background: #0f2f57;
}

.mobile-menu .sidebar a {
    margin: 6px 12px;
    background: rgba(255,255,255,.08);
}

.mobile-menu .sidebar a:hover {
    background: rgba(255,255,255,.14);
}

.hamburger-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
}

.nav-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: -2px;
}

.menu-pill {
    background: rgba(255,255,255,.06);
    border-radius: 12px;
}

.menu-group {
    padding: 6px 10px;
}

.card-hero {
    background: linear-gradient(135deg, #0f2f57 0%, #1d4f8c 55%, #2f6eb3 100%);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-chip {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 12px;
    padding: 8px 12px;
}

.fade-in {
    animation: fadeInUp .5s ease both;
}

.stagger-1 { animation-delay: .05s; }
.stagger-2 { animation-delay: .1s; }
.stagger-3 { animation-delay: .15s; }
.stagger-4 { animation-delay: .2s; }

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

@media (max-width: 576px) {
    .card-hero .stat-chip {
        display: block;
        width: 100%;
        margin-bottom: 8px;
    }
    .card-hero .stat-chip:last-child {
        margin-bottom: 0;
    }
}

.card-soft {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.badge-income { background: #0d9b6f; }
.badge-expense { background: #1d4f8c; }

.ux-alert {
    border: 1px solid rgba(15,47,87,.12);
    border-left-width: 4px;
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: #fff;
    color: #223753;
    font-weight: 600;
}

.ux-alert-success {
    border-left-color: #0d9b6f;
    background: linear-gradient(160deg, rgba(13,155,111,.10) 0%, rgba(255,255,255,1) 70%);
}

.ux-alert-danger {
    border-left-color: #b94a48;
    background: linear-gradient(160deg, rgba(185,74,72,.10) 0%, rgba(255,255,255,1) 70%);
}

.ux-empty-state {
    border: 1px dashed rgba(15,47,87,.24);
    border-radius: 14px;
    padding: 18px;
    background: linear-gradient(160deg, rgba(255,255,255,.96) 0%, rgba(243,247,252,.88) 100%);
    text-align: center;
}

.ux-empty-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(15,47,87,.08);
    color: #1d4f8c;
    font-weight: 800;
}

.ux-empty-title {
    font-weight: 700;
    color: #213650;
    margin-bottom: 4px;
}

.ux-empty-desc {
    color: #607188;
    margin-bottom: 12px;
    font-size: 14px;
}

.ux-chart-skeleton {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(100deg, rgba(221,229,238,.8) 20%, rgba(248,251,255,1) 40%, rgba(221,229,238,.8) 60%);
    background-size: 300% 100%;
    animation: uxShimmer 1.35s infinite linear;
}

.ux-table-empty {
    text-align: center;
    color: #607188;
    font-weight: 600;
    padding: 18px !important;
}

@keyframes uxShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

.ux-preset-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.ux-preset-btn {
    border: 1px solid rgba(15,47,87,.16);
    color: #36506f;
    background: rgba(255,255,255,.84);
    border-radius: 999px;
    padding: 6px 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: .03em;
    transition: all .2s ease;
}

.ux-preset-btn:hover {
    border-color: rgba(15,47,87,.36);
    color: #173657;
    background: #fff;
}

.ux-preset-btn.active {
    background: linear-gradient(135deg, #0f2f57, #1d4f8c);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(15,47,87,.22);
}

.ux-table-skeleton {
    display: grid;
    gap: 10px;
}

.ux-table-skeleton-row {
    height: 18px;
    border-radius: 8px;
    background: linear-gradient(100deg, rgba(221,229,238,.8) 20%, rgba(248,251,255,1) 40%, rgba(221,229,238,.8) 60%);
    background-size: 300% 100%;
    animation: uxShimmer 1.35s infinite linear;
}

.ux-table-skeleton-row.sm { width: 42%; }
.ux-table-skeleton-row.md { width: 68%; }
.ux-table-skeleton-row.lg { width: 100%; }

.ux-panel-skeleton {
    display: grid;
    gap: 12px;
}

.ux-panel-card {
    height: 118px;
    border-radius: 14px;
    background: linear-gradient(100deg, rgba(221,229,238,.8) 20%, rgba(248,251,255,1) 40%, rgba(221,229,238,.8) 60%);
    background-size: 300% 100%;
    animation: uxShimmer 1.35s infinite linear;
}

.ux-state {
    opacity: 1;
    transform: translateY(0);
    transition: opacity .22s ease, transform .22s ease;
}

.ux-hidden {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}

.ux-gone {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .ux-state {
        transition: none;
    }
}

.btn-primary {
    background: var(--ocean);
    border-color: var(--ocean);
}

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

.btn-outline-primary {
    border-color: var(--ocean);
    color: var(--ocean);
}

.btn-outline-primary:hover {
    background: var(--ocean);
    color: #fff;
}

.btn-outline-success {
    border-color: var(--mint);
    color: var(--mint);
}

.btn-outline-success:hover {
    background: var(--mint);
    color: #fff;
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(15,47,87,.08);
}

.auth-hero {
    background: linear-gradient(120deg, #0f2f57 0%, #1d4f8c 60%, #2f6eb3 100%);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 18px 20px;
}

.form-control, .form-select {
    border-radius: 12px;
    border: 1px solid rgba(15,47,87,.18);
}

.input-group .btn {
    border-radius: 12px;
}

.toggle-password {
    background: #eef3f9;
    border: 1px solid rgba(15,47,87,.18);
}

.table {
    --bs-table-bg: transparent;
}

.ux-data-table {
    margin: 0;
}

.ux-data-table thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, var(--surface-0), var(--surface-1));
    border-bottom: 1px solid var(--line-strong);
    color: #51657f;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 800;
    padding-top: 12px;
    padding-bottom: 12px;
}

.ux-data-table tbody td {
    border-color: var(--line-soft);
    color: #223753;
    font-size: var(--text-sm);
    font-weight: 600;
    padding-top: 11px;
    padding-bottom: 11px;
    vertical-align: middle;
}

.ux-data-table tbody tr {
    transition: background-color .18s ease, transform .18s ease;
}

.ux-data-table tbody tr:nth-child(even) {
    background: rgba(248, 251, 255, .78);
}

.ux-data-table tbody tr:hover {
    background: rgba(15,47,87,.05);
}

.ux-amount-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .sidebar {
        min-height: auto;
    }
    .card-soft {
        border-radius: 14px;
    }
    .table {
        font-size: 12px;
    }
    .btn, .form-control, .form-select {
        font-size: 14px;
    }

    .ux-data-table thead {
        display: none;
    }

    .ux-data-table tbody tr {
        display: block;
        background: linear-gradient(160deg, rgba(255,255,255,.98) 0%, rgba(241,247,255,.92) 100%) !important;
        border: 1px solid var(--line-soft);
        border-radius: 12px;
        padding: 8px;
        margin-bottom: 10px;
        box-shadow: 0 8px 20px rgba(15, 47, 87, .08);
    }

    .ux-data-table tbody td {
        display: grid;
        grid-template-columns: 96px 1fr;
        gap: 8px;
        border: 0;
        padding: 5px 4px;
        font-size: 13px;
    }

    .ux-data-table tbody td::before {
        content: attr(data-label);
        color: #66798f;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .08em;
        font-weight: 700;
    }

    .ux-data-table tbody td.ux-action-cell {
        display: block;
        padding-top: 10px;
        border-top: 1px solid rgba(15,47,87,.10);
        margin-top: 6px;
    }

    .ux-data-table tbody td.ux-action-cell::before {
        display: none;
    }
}

/* Dashboard Premium */
.dbx-shell {
    position: relative;
}

.dbx-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.dbx-title {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
}

.dbx-subtitle {
    color: #617086;
    font-size: 14px;
}

.dbx-family-accent {
    background: linear-gradient(135deg, #0f2f57 0%, #2f6eb3 55%, #0d9b6f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.dbx-date-pill {
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(15,47,87,.12);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    color: #2d4666;
    white-space: nowrap;
}

.dbx-filter,
.dbx-table-wrap,
.dbx-chart-card,
.dbx-balance,
.dbx-stat {
    border: 1px solid rgba(15,47,87,.08);
    background: linear-gradient(160deg, rgba(255,255,255,.95) 0%, rgba(249,251,255,.92) 100%);
}

.dbx-block-label {
    font-size: 12px;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: #5a6c84;
    font-weight: 700;
}

.dbx-hero {
    position: relative;
    overflow: hidden;
}

.dbx-hero::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -70px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.26) 0%, rgba(255,255,255,0) 72%);
}

.dbx-hero-title {
    font-size: 44px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.dbx-hero-sub {
    font-size: 16px;
    opacity: .9;
}

.dbx-hero-chips {
    align-items: center;
}

.dbx-chip-label {
    display: block;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: .8;
}

.dbx-stat {
    position: relative;
    overflow: hidden;
}

.dbx-stat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 4px;
    background: #7d96b1;
}

.dbx-income::before,
.dbx-income-soft::before {
    background: #0d9b6f;
}

.dbx-expense::before,
.dbx-expense-soft::before {
    background: #1d4f8c;
}

.dbx-stat-label {
    color: #607188;
    font-weight: 600;
    margin-bottom: 4px;
}

.dbx-stat-value {
    font-size: clamp(24px, 2.3vw, 34px);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #15253a;
}

.dbx-balance-value {
    font-size: clamp(28px, 2.7vw, 40px);
    font-weight: 800;
    color: #10233d;
    letter-spacing: -0.02em;
}

.dbx-table thead th {
    border-bottom: 1px solid rgba(15,47,87,.14);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #607188;
}

.dbx-table tbody td {
    border-color: rgba(15,47,87,.08);
    color: #223753;
    font-weight: 500;
}

.dbx-chart-meta {
    color: #607188;
    font-size: 13px;
}

.dbx-canvas-wrap {
    position: relative;
    height: 290px;
}

@media (max-width: 992px) {
    .dbx-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .dbx-title {
        font-size: 30px;
    }

    .dbx-hero-title {
        font-size: 34px;
    }
}

@media (max-width: 576px) {
    .dbx-title {
        font-size: 28px;
    }

    .dbx-hero-title {
        font-size: 28px;
    }

    .dbx-canvas-wrap {
        height: 240px;
    }
}

/* Dashboard Ultra Premium */
.dbx-filter,
.dbx-table-wrap,
.dbx-chart-card,
.dbx-balance,
.dbx-stat {
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.dbx-filter:hover,
.dbx-table-wrap:hover,
.dbx-chart-card:hover,
.dbx-balance:hover,
.dbx-stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(15, 47, 87, .14);
    border-color: rgba(15,47,87,.18);
}

.dbx-stat::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(15,47,87,.06) 0%, rgba(15,47,87,0) 70%);
}

.dbx-trend {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
}

.dbx-trend-icon {
    font-size: 12px;
    line-height: 1;
}

.dbx-trend-up {
    background: rgba(13, 155, 111, .14);
    color: #087e5b;
}

.dbx-trend-down {
    background: rgba(29, 79, 140, .14);
    color: #1d4f8c;
}

.dbx-trend-neutral {
    background: rgba(96, 113, 136, .14);
    color: #53657c;
}

.dbx-trend-detail {
    margin-top: 4px;
    color: #64758c;
    font-size: 12px;
}

.dbx-flow-pill {
    margin-top: 10px;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    border-radius: 999px;
    padding: 5px 10px;
}

.dbx-flow-positive {
    color: #087e5b;
    background: rgba(13, 155, 111, .12);
}

.dbx-flow-negative {
    color: #1d4f8c;
    background: rgba(29, 79, 140, .12);
}

.dbx-amount-positive {
    color: #0b8f67;
    font-weight: 700;
}

.dbx-amount-negative {
    color: #1d4f8c;
    font-weight: 700;
}

.dbx-table tbody tr {
    transition: background-color .18s ease;
}

.dbx-table tbody tr:hover {
    background: rgba(15,47,87,.035);
}

@media (max-width: 576px) {
    .dbx-trend {
        font-size: 11px;
        padding: 4px 8px;
    }
}
