:root {
    color-scheme: light;
    --bg: #f3f6ff;
    --card: rgba(255, 255, 255, 0.82);
    --card-solid: #ffffff;
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --accent: #0ea5e9;
    --text: #0f172a;
    --muted: #64748b;
    --ok: #15803d;
    --error: #b91c1c;
    --border: #dbe4ff;
    --shadow: 0 20px 50px rgba(79, 70, 229, 0.16);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background:
        radial-gradient(circle at 10% 8%, rgba(79, 70, 229, 0.14), transparent 30%),
        radial-gradient(circle at 90% 0%, rgba(14, 165, 233, 0.15), transparent 32%),
        linear-gradient(180deg, #eef2ff 0%, #f7f9ff 100%),
        var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
}
.container {
    max-width: 1120px;
    margin: 38px auto;
    padding: 0 16px 36px;
}
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}
.section-title {
    margin-bottom: 4px;
}
.section-subtitle {
    margin-bottom: 14px;
    font-size: 14px;
}
.grid {
    display: grid;
    gap: 16px;
}
.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
h1, h2, h3 { margin-top: 0; letter-spacing: -0.01em; }
h1 { font-size: 34px; margin-bottom: 6px; line-height: 1.06; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
p { color: var(--muted); margin-top: 0; }
label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}
input, select, button {
    width: 100%;
    padding: 12px 13px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 14px;
    transition: all .2s ease;
    background: #fff;
}
input:focus, select:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
button {
    border: 0;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark) 120%);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.25);
}
button:hover { transform: translateY(-2px); filter: brightness(1.03); }
button.secondary {
    background: linear-gradient(180deg, #64748b, #475569);
    box-shadow: none;
}
.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}
.metric {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: linear-gradient(180deg, #f8fbff, #f2f6ff);
    position: relative;
    overflow: hidden;
}
.metric::after {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}
.metric strong { display: block; margin-top: 5px; font-size: 18px; color: #1e1b8f; }
.flash {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid;
    font-weight: 600;
}
.flash.ok { color: var(--ok); border-color: #b7e4c7; background: #effcf3; }
.flash.error { color: var(--error); border-color: #fecaca; background: #fef2f2; }
.flash.hide { opacity: 0; transform: translateY(-4px); transition: .25s ease; }
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--card-solid);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}
th, td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
th {
    color: var(--muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: #f5f8ff;
}
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 700;
}
.badge.cost { background: #e8f0ff; color: #1d4ed8; }
.badge.expense { background: #fff4e5; color: #b45309; }
.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.header-actions p {
    margin-bottom: 0;
    max-width: 620px;
}
.quick-help {
    margin: 0 0 16px;
    color: #334155;
    font-size: 14px;
    background: linear-gradient(90deg, #eef6ff, #f7f3ff);
    border: 1px dashed #b9ccff;
    padding: 11px 13px;
    border-radius: 10px;
}
.btn-danger {
    background: linear-gradient(180deg, #ef4444, #dc2626);
    box-shadow: none;
}
.chart-caption {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
}
.empty-state {
    text-align: center;
    color: #64748b;
    padding: 22px 12px;
    font-size: 14px;
}
.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.15), rgba(14, 165, 233, 0.12));
    color: #312e81;
    border: 1px solid #c7d2fe;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 6px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}
.brand-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.auth-shell {
    display: grid;
    gap: 18px;
}
.hero-copy {
    max-width: 680px;
    margin-bottom: 2px;
}
.hero-copy p {
    font-size: 15px;
}
.tabs {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    margin-bottom: 16px;
}
.tab-link {
    text-decoration: none;
    color: #475569;
    font-weight: 700;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 999px;
    transition: all .2s ease;
}
.tab-link:hover {
    background: #eef2ff;
    color: #312e81;
}
.tab-link.active {
    background: linear-gradient(180deg, var(--primary), var(--primary-dark) 120%);
    color: #fff;
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
}
.submit-loading {
    opacity: 0.75;
    pointer-events: none;
    cursor: wait;
}
.quick-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 14px;
}
.quick-chip {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #312e81;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
}
.mobile-fabbar {
    display: none;
}
.budget-v-list { display: flex; flex-direction: column; gap: 16px; }
.budget-v-row {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    background: #fafbff;
}
.budget-v-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.budget-v-head strong { font-size: 15px; color: #0f172a; }
.budget-v-meta { font-size: 13px; color: var(--muted); }
.budget-v-bar {
    height: 12px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.budget-v-fill {
    height: 100%;
    border-radius: 999px;
    background: #94a3b8;
    transition: width .35s ease;
}
.budget-v-fill.status-ok { background: linear-gradient(90deg, #15803d, #22c55e); }
.budget-v-fill.status-warn { background: linear-gradient(90deg, #b45309, #eab308); }
.budget-v-fill.status-over { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.budget-v-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.budget-v-badge.ok { background: #dcfce7; color: #166534; }
.budget-v-badge.warn { background: #fef9c3; color: #854d0e; }
.budget-v-badge.over { background: #fee2e2; color: #991b1b; }
.budget-v-badge.none { background: #f1f5f9; color: #475569; }
@media (max-width: 680px) {
    .container { margin-top: 22px; padding-bottom: 96px; }
    h1 { font-size: 28px; }
    .row { grid-template-columns: 1fr; }
    th, td { padding: 10px 8px; }
    .summary {
        grid-template-columns: 1fr 1fr;
    }
    .quick-actions {
        margin-bottom: 10px;
    }
    .mobile-fabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 25;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(8px);
        border-top: 1px solid #dbe4ff;
    }
    .mobile-fabbar a {
        text-decoration: none;
        text-align: center;
        font-size: 11px;
        font-weight: 700;
        color: #1e1b8f;
        background: #eef2ff;
        border: 1px solid #c7d2fe;
        border-radius: 10px;
        padding: 8px 6px;
    }
}
