:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #d9dee7;
    --accent: #0f766e;
    --accent-2: #2563eb;
    --success: #0f766e;
    --danger: #dc2626;
    --sidebar: #111827;
    --sidebar-text: #d1d5db;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --panel: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --line: #273449;
    --accent: #2dd4bf;
    --accent-2: #60a5fa;
    --success: #2dd4bf;
    --danger: #fb7185;
    --sidebar: #020617;
    --sidebar-text: #cbd5e1;
}

[data-theme="blue"] {
    --bg: #eef5fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #60728a;
    --line: #c8d7e6;
    --accent: #0e7490;
    --accent-2: #1d4ed8;
    --success: #0f766e;
    --danger: #e11d48;
    --sidebar: #0b2742;
    --sidebar-text: #d7e7f5;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
}

.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 28px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}

.brand-mark i {
    font-size: 21px;
}

.brand span, .developer {
    display: block;
    color: var(--sidebar-text);
    opacity: .72;
    font-size: 13px;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 4px;
}

.sidebar .nav-link i {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .09);
    display: inline-grid;
    place-items: center;
    color: #fff;
    flex: 0 0 30px;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar .nav-link:hover i {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.developer {
    position: absolute;
    bottom: 22px;
}

.developer a {
    color: #fff;
}

.main {
    min-width: 0;
}

.topbar {
    min-height: 84px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.topbar h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0;
}

.topbar p {
    margin: 2px 0 0;
    color: var(--muted);
}

.content {
    padding: 28px;
}

.panel, .metric, .table-wrap, .auth-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric {
    padding: 18px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.metric span {
    color: var(--muted);
    font-size: 14px;
}

.metric strong {
    display: block;
    font-size: 28px;
    margin-top: 6px;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff;
    flex: 0 0 52px;
}

.metric-icon i {
    font-size: 25px;
}

.metric-icon.income {
    background: linear-gradient(135deg, var(--success), #14b8a6);
}

.metric-icon.expense {
    background: linear-gradient(135deg, var(--danger), #f97316);
}

.metric-icon.balance {
    background: linear-gradient(135deg, var(--accent-2), #0e7490);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 18px;
    margin-bottom: 16px;
}

.section-title i {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(37, 99, 235, .12);
    color: var(--accent-2);
    display: inline-grid;
    place-items: center;
    flex: 0 0 32px;
}

.panel {
    padding: 20px;
}

.table-wrap {
    overflow: auto;
}

.table {
    color: var(--text);
    margin: 0;
}

.form-control, .form-select {
    background-color: var(--panel);
    color: var(--text);
    border-color: var(--line);
}

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

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-box {
    width: min(440px, 100%);
    padding: 28px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
}

@media (max-width: 991px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        z-index: 20;
        inset: 0 auto 0 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .content, .topbar {
        padding-left: 18px;
        padding-right: 18px;
    }
}

@media print {
    .sidebar, .topbar, .no-print {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content {
        padding: 0;
    }
}
