: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;
}

.auth-body {
    min-height: 100vh;
    color: #fff;
}

.auth-body[data-auth-background="aurora"] {
    background:
        radial-gradient(circle at 14% 14%, rgba(45, 212, 191, .52), transparent 28%),
        radial-gradient(circle at 82% 20%, rgba(96, 165, 250, .48), transparent 30%),
        linear-gradient(135deg, #111827 0%, #0f172a 48%, #172554 100%);
}

.auth-body[data-auth-background="emerald"] {
    background:
        radial-gradient(circle at 16% 18%, rgba(20, 184, 166, .55), transparent 30%),
        radial-gradient(circle at 78% 16%, rgba(34, 197, 94, .35), transparent 28%),
        linear-gradient(135deg, #052e2b 0%, #0f172a 58%, #064e3b 100%);
}

.auth-body[data-auth-background="ocean"] {
    background:
        radial-gradient(circle at 12% 20%, rgba(14, 165, 233, .52), transparent 30%),
        radial-gradient(circle at 80% 14%, rgba(99, 102, 241, .44), transparent 28%),
        linear-gradient(135deg, #082f49 0%, #111827 52%, #1e1b4b 100%);
}

.auth-body[data-auth-background="sunset"] {
    background:
        radial-gradient(circle at 18% 18%, rgba(251, 146, 60, .48), transparent 30%),
        radial-gradient(circle at 82% 18%, rgba(244, 63, 94, .34), transparent 26%),
        linear-gradient(135deg, #1f2937 0%, #431407 54%, #111827 100%);
}

.auth-page-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
    gap: 36px;
    place-items: stretch;
    width: min(1160px, calc(100% - 36px));
    margin: 0 auto;
}

.auth-showcase {
    min-height: 680px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 34px;
}

.auth-brand {
    margin-bottom: 0;
}

.auth-brand span,
.auth-brand strong {
    color: #fff;
}

.auth-copy {
    max-width: 640px;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    color: rgba(255, 255, 255, .88);
    font-size: 14px;
}

.auth-copy h1 {
    margin: 18px 0 14px;
    max-width: 720px;
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.02;
    letter-spacing: 0;
}

.auth-copy p {
    max-width: 560px;
    margin: 0;
    color: rgba(255, 255, 255, .76);
    font-size: 18px;
    line-height: 1.55;
}

.auth-preview {
    width: min(620px, 100%);
    padding: 18px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .13);
    border: 1px solid rgba(255, 255, 255, .18);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .24);
}

.preview-top,
.preview-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.preview-top span,
.preview-flow span {
    color: rgba(255, 255, 255, .7);
    font-size: 13px;
}

.preview-top strong {
    display: block;
    margin-top: 4px;
    font-size: 28px;
}

.preview-top i {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .16);
    font-size: 24px;
}

.preview-bars {
    height: 150px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    align-items: end;
    margin: 24px 0;
}

.preview-bars span {
    display: block;
    min-height: 28px;
    border-radius: 8px 8px 3px 3px;
    background: linear-gradient(180deg, #fff, rgba(255, 255, 255, .35));
}

.preview-flow > div {
    flex: 1;
    padding: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
}

.preview-flow i {
    margin-right: 7px;
}

.preview-flow strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
}

.auth-login-panel {
    display: grid;
    place-items: center;
}

.auth-box-modern {
    width: min(430px, 100%);
    color: var(--text);
    background: rgba(255, 255, 255, .94);
    border-color: rgba(255, 255, 255, .75);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .22);
}

.auth-box-modern h2 {
    margin: 0;
    font-size: 22px;
}

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

.auth-footnote {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.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;
    }

    .auth-page-hero {
        grid-template-columns: 1fr;
        width: min(100% - 28px, 620px);
        gap: 18px;
        padding-top: 18px;
        padding-bottom: 18px;
    }

    .auth-showcase {
        min-height: auto;
        padding: 12px 4px;
        gap: 22px;
    }

    .auth-copy h1 {
        font-size: 34px;
    }

    .auth-copy p {
        font-size: 16px;
    }

    .auth-preview {
        display: none;
    }
}

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

    .app-shell {
        display: block;
    }

    .content {
        padding: 0;
    }
}
