:root {
    --bg: #eef3fb;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --line: rgba(17, 35, 71, 0.08);
    --text: #1f3352;
    --muted: #7283a7;
    --primary: #2f80ed;
    --primary-deep: #194b96;
    --green: #31c48d;
    --red: #ff6b6b;
    --orange: #ffb454;
    --purple: #8b7cf7;
    --shadow: 0 24px 70px rgba(31, 51, 82, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Plus Jakarta Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(47, 128, 237, 0.22), transparent 25%),
        radial-gradient(circle at bottom right, rgba(49, 196, 141, 0.18), transparent 30%),
        var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.auth-body {
    display: grid;
    place-items: center;
    padding: 32px 18px;
}

.auth-shell {
    width: min(1120px, 100%);
    display: grid;
    gap: 24px;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-panel {
    border-radius: 32px;
    padding: 34px;
    box-shadow: var(--shadow);
}

.auth-brand {
    background: linear-gradient(135deg, #0e2f63, #1f5fb5 55%, #49b8d8);
    color: #fff;
    position: relative;
    overflow: hidden;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: auto -10% -30% auto;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.brand-badge,
.chip,
.pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
}

.brand-badge,
.chip {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.auth-brand h1 {
    margin: 18px 0 12px;
    font-size: clamp(2.2rem, 4vw, 3.8rem);
    line-height: 1.02;
}

.auth-brand p {
    color: rgba(255, 255, 255, 0.8);
    max-width: 560px;
}

.auth-highlight-grid,
.stat-grid,
.mini-kpi-grid {
    display: grid;
    gap: 14px;
}

.auth-highlight-grid {
    margin-top: 28px;
    grid-template-columns: repeat(3, 1fr);
}

.glass-card,
.panel,
.auth-card {
    background: var(--surface);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.55);
}

.glass-card {
    padding: 18px;
    border-radius: 22px;
    color: #fff;
}

.glass-card span {
    display: block;
    font-size: 12px;
    opacity: 0.75;
}

.glass-card strong {
    display: block;
    margin-top: 8px;
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: min(440px, 100%);
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.logo-row {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 24px;
}

.logo-mark,
.avatar {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #4ec3f7);
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
}

.logo-row h2,
.section-head h1,
.section-head h2,
.hero-card h1 { margin: 0; }

.stack-form,
.goal-list,
.activity-list,
.user-list,
.transaction-list {
    display: grid;
    gap: 14px;
}

.stack-form label,
.filter-row label {
    display: grid;
    gap: 8px;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 16px;
    padding: 14px 16px;
    outline: none;
    color: var(--text);
}

input:focus,
select:focus {
    border-color: rgba(47, 128, 237, 0.55);
    box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.12);
}

button { border: 0; cursor: pointer; }

.primary-button,
.secondary-button,
.ghost-button,
.primary-mini {
    padding: 14px 18px;
    border-radius: 16px;
    font-weight: 700;
}

.primary-button,
.primary-mini {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
    box-shadow: 0 16px 28px rgba(47, 128, 237, 0.22);
}

.secondary-button,
.ghost-button {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.demo-switcher {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.demo-actions,
.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
}

.flash-success {
    background: rgba(49, 196, 141, 0.12);
    color: #187a57;
}

.flash-error {
    background: rgba(255, 107, 107, 0.12);
    color: #b44444;
}

.app-shell {
    width: min(460px, calc(100% - 24px));
    margin: 18px auto;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 34px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.app-topbar {
    background: linear-gradient(180deg, #14315c, #173d73 68%, rgba(23, 61, 115, 0));
    color: #fff;
    padding: 18px 18px 28px;
}

.topbar-row,
.hero-top,
.section-head,
.transaction-row,
.legend-row,
.goal-title-row,
.user-card,
.activity-card,
.filter-row,
.summary-pills,
.nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-actions,
.nav-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-button {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.app-content {
    display: grid;
    gap: 16px;
    padding: 0 16px 112px;
    margin-top: -18px;
}

.panel,
.hero-card {
    border-radius: 28px;
    padding: 18px;
    box-shadow: 0 20px 44px rgba(31, 51, 82, 0.08);
}

.hero-card {
    background: linear-gradient(160deg, #15355f, #266bc9 62%, #60d2df);
    color: #fff;
}

.eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.balance-card {
    margin-top: 18px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    padding: 18px;
}

.balance-card strong {
    display: block;
    margin: 8px 0;
    font-size: 2rem;
}

.stat-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-top: 16px;
}

.stat-grid.triple { grid-template-columns: repeat(3, 1fr); }

.metric-card,
.goal-card,
.transaction-item,
.empty-card,
.mini-kpi,
.activity-card,
.user-card,
.donut-card {
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px;
}

.metric-card.positive strong,
.positive { color: var(--green); }

.metric-card.negative strong,
.negative { color: var(--red); }

.section-head { margin-bottom: 16px; }
.text-link { font-size: 14px; color: var(--primary); font-weight: 700; }

.bar-chart {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    align-items: end;
    min-height: 190px;
}

.bar-item {
    display: grid;
    gap: 10px;
    justify-items: center;
}

.bar-group {
    height: 150px;
    width: 100%;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 6px;
}

.bar {
    width: 14px;
    border-radius: 999px 999px 6px 6px;
}

.bar.income { background: linear-gradient(180deg, #81f0c0, var(--green)); }
.bar.expense { background: linear-gradient(180deg, #ffc78a, var(--orange)); }

.progress-track {
    height: 10px;
    background: #edf3fb;
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--primary), #62d2df);
}

.transaction-item {
    display: grid;
    gap: 8px;
}

.transaction-main {
    display: flex;
    gap: 12px;
    align-items: center;
}

.transaction-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-weight: 800;
    color: #fff;
}

.transaction-icon.income { background: linear-gradient(135deg, #31c48d, #7de2ba); }
.transaction-icon.expense { background: linear-gradient(135deg, #ff7a7a, #ffb4a9); }

.transaction-copy { flex: 1; }
.transaction-copy strong { display: block; }
.amount { font-weight: 800; }
.amount.income { color: var(--green); }
.amount.expense { color: var(--red); }

.filter-row { flex-wrap: wrap; align-items: end; }
.filter-row label { flex: 1 1 150px; }
.summary-pills { margin-bottom: 16px; flex-wrap: wrap; }

.pill {
    background: #edf3fb;
    color: var(--text);
}

.pill.positive { background: rgba(49, 196, 141, 0.14); }
.pill.negative { background: rgba(255, 107, 107, 0.14); }

.segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.segmented label { position: relative; }
.segmented input { position: absolute; inset: 0; opacity: 0; }

.segmented span {
    display: grid;
    place-items: center;
    min-height: 52px;
    border-radius: 16px;
    background: #edf3fb;
    color: var(--text);
    font-weight: 700;
}

.segmented input:checked + span {
    background: linear-gradient(135deg, var(--primary), var(--primary-deep));
    color: #fff;
}

.compact { padding-top: 10px; }
.mini-kpi-grid { grid-template-columns: repeat(3, 1fr); }

.donut-and-legend {
    display: grid;
    gap: 18px;
    grid-template-columns: 220px 1fr;
    align-items: center;
}

.donut-card { display: grid; place-items: center; }

.donut-chart {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background:
        conic-gradient(
            #31c48d 0 calc(var(--slice1) * 1%),
            #ffb454 calc(var(--slice1) * 1%) calc((var(--slice1) + var(--slice2)) * 1%),
            #ff6b6b calc((var(--slice1) + var(--slice2)) * 1%) calc((var(--slice1) + var(--slice2) + var(--slice3)) * 1%),
            #8b7cf7 calc((var(--slice1) + var(--slice2) + var(--slice3)) * 1%) 100%
        );
    display: grid;
    place-items: center;
}

.donut-hole {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 12px;
}

.legend-list { display: grid; gap: 10px; }

.legend-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.legend-row:last-child { border-bottom: 0; }

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.color-1 { background: var(--green); }
.color-2 { background: var(--orange); }
.color-3 { background: var(--red); }
.color-4 { background: var(--purple); }

.admin-hero { background: linear-gradient(160deg, #0c2344, #1c467f 58%, #2f80ed); }
.chip-blue { background: rgba(149, 204, 255, 0.22); }
.user-copy { flex: 1; }

.status-badge.success {
    background: rgba(49, 196, 141, 0.14);
    color: #19895f;
}

.status-badge.warning {
    background: rgba(255, 180, 84, 0.18);
    color: #a45d11;
}

.activity-card { display: grid; gap: 6px; }

.bottom-nav {
    position: sticky;
    bottom: 0;
    background: linear-gradient(180deg, rgba(17, 45, 83, 0.03), #16345f 35%, #0d2547);
    padding: 14px 16px 18px;
}

.nav-row a {
    flex: 1;
    min-height: 58px;
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.72);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
}

.nav-row a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

@media (max-width: 960px) {
    .auth-shell,
    .donut-and-legend { grid-template-columns: 1fr; }

    .auth-highlight-grid,
    .stat-grid.triple,
    .mini-kpi-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .auth-panel,
    .auth-card { padding: 22px; }

    .app-shell {
        width: calc(100% - 12px);
        border-radius: 26px;
    }

    .app-content { padding: 0 12px 104px; }
    .stat-grid,
    .auth-highlight-grid,
    .mini-kpi-grid { grid-template-columns: 1fr; }
    .bar-chart { gap: 6px; }
}
