@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

@font-face {
    font-family: "Gotham";
    src: local("Gotham"), local("Gotham Book"), local("Gotham Regular");
    font-weight: 400;
    font-style: normal;
}

:root {
    --bg: #eef5ff;
    --bg-strong: #dbe9ff;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-soft: #f7fbff;
    --text: #11233f;
    --muted: #5f728f;
    --line: rgba(18, 58, 120, 0.12);
    --brand: #123a78;
    --brand-soft: #4e86d9;
    --brand-pale: #e5f0ff;
    --danger: #c43f4d;
    --success: #1f7a52;
    --shadow: 0 18px 40px rgba(18, 58, 120, 0.12);
    --font-heading: "Poppins", "Segoe UI", sans-serif;
    --font-subheading: "Poppins", "Segoe UI", sans-serif;
    --font-body: "Gotham", "Avenir", "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(78, 134, 217, 0.16), transparent 24%),
        radial-gradient(circle at top right, rgba(18, 58, 120, 0.12), transparent 28%),
        linear-gradient(180deg, #f7fbff 0%, #eef5ff 48%, #e8f1ff 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.9rem 0.95rem;
    background: #ffffff;
    color: var(--text);
    font-size: 0.98rem;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: 2px solid rgba(78, 134, 217, 0.26);
    outline-offset: 1px;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.page-shell {
    min-height: 100vh;
    padding: 0.9rem;
}

.page-container {
    width: min(1080px, 100%);
    margin: 0 auto;
}

.stack-sm > * + * {
    margin-top: 0.55rem;
}

.stack-md > * + * {
    margin-top: 0.95rem;
}

.stack-lg > * + * {
    margin-top: 1.35rem;
}

.panel,
.hero-card,
.stat-card,
.list-card,
.table-wrap,
.auth-card,
.flash,
.compact-hero,
.period-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.panel,
.hero-card,
.table-wrap,
.auth-card,
.flash,
.compact-hero,
.period-card {
    padding: 1rem;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.auth-stack {
    width: min(420px, 100%);
    display: grid;
    gap: 1rem;
}

.auth-card {
    padding: 1.1rem;
}

.login-heading,
.brand-title,
.display-title,
.section-title {
    margin: 0;
    color: var(--brand);
    font-family: var(--font-heading);
}

.login-heading {
    text-align: center;
    font-size: clamp(2.2rem, 7vw, 3rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.brand-title {
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.display-title {
    font-size: clamp(1.8rem, 4.4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.05;
}

.section-title {
    font-size: 1.08rem;
    font-weight: 700;
}

.section-subtitle,
.muted,
.field span,
.stat-label,
.page-kicker,
.eyebrow {
    margin: 0;
    color: var(--muted);
    font-family: var(--font-subheading);
}

.page-kicker,
.eyebrow {
    font-size: 0.82rem;
}

.topbar {
    display: grid;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 1rem;
}

.brand-block {
    display: grid;
    gap: 0.25rem;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin: 0;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    background: var(--brand-pale);
    color: var(--brand);
    font-size: 0.92rem;
}

.topbar-actions {
    display: grid;
    gap: 0.7rem;
}

.nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    padding: 0.35rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--line);
}

.nav-link {
    padding: 0.75rem 0.6rem;
    border-radius: 12px;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
    font-family: var(--font-subheading);
    font-size: 0.94rem;
}

.nav-link.active {
    background: var(--brand);
    color: #ffffff;
}

.hero-grid,
.stats-grid,
.summary-grid,
.two-column,
.grid-two,
.toolbar,
.period-grid {
    display: grid;
    gap: 0.9rem;
}

.compact-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
}

.compact-hero-copy {
    display: grid;
    gap: 0.2rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    background: var(--brand-pale);
    color: var(--brand);
    font-weight: 700;
    font-family: var(--font-subheading);
    font-size: 0.86rem;
}

.badge.expense {
    background: rgba(196, 63, 77, 0.12);
    color: var(--danger);
}

.hero-stats,
.kpi-strip {
    display: grid;
    gap: 0.8rem;
}

.stat-card,
.list-card {
    padding: 0.95rem;
}

.stat-value {
    margin: 0.15rem 0 0;
    font-size: 1.35rem;
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--brand);
}

.period-card {
    display: grid;
    gap: 0.25rem;
}

.period-date {
    margin: 0;
    color: var(--brand);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
}

.period-date-divider {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.toggle-password {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 12px;
    padding: 0.76rem 1rem;
    font-weight: 700;
    font-family: var(--font-subheading);
    font-size: 0.95rem;
    transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.toggle-password:hover {
    transform: translateY(-1px);
}

.primary-button {
    border: 0;
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-soft) 100%);
    color: #ffffff;
}

.secondary-button {
    border: 0;
    background: var(--brand-pale);
    color: var(--brand);
}

.ghost-button {
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--brand);
}

.danger-button {
    border: 0;
    background: rgba(196, 63, 77, 0.12);
    color: var(--danger);
}

.button-full {
    width: 100%;
}

.field {
    display: block;
}

.field span {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.94rem;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 5.4rem;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    min-height: 36px;
    padding: 0.48rem 0.8rem;
    border: 0;
    background: transparent;
    color: var(--brand);
    transform: translateY(-50%);
}

.toggle-password:hover {
    transform: translateY(-50%);
    background: var(--brand-pale);
}

.flash {
    margin-bottom: 1rem;
    font-weight: 700;
}

.flash.success {
    color: var(--success);
}

.flash.error {
    color: var(--danger);
}

.row-between {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
}

.actions-row,
.toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.transaction-list {
    display: grid;
    gap: 0.75rem;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface-soft);
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td {
    padding: 0.8rem 0.65rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 0.95rem;
}

.summary-table th {
    color: var(--muted);
    font-family: var(--font-subheading);
    font-weight: 700;
    background: rgba(229, 240, 255, 0.55);
}

.insight-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--muted);
}

.insight-list li + li {
    margin-top: 0.45rem;
}

.empty-state {
    padding: 1rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px dashed rgba(18, 58, 120, 0.18);
    color: var(--muted);
}

.desktop-note {
    color: var(--muted);
    font-size: 0.92rem;
}

@media (max-width: 640px) {
    .row-between {
        flex-direction: column;
    }

    .compact-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-row .primary-button,
    .actions-row .secondary-button,
    .actions-row .ghost-button,
    .toolbar-actions .primary-button,
    .toolbar-actions .secondary-button,
    .toolbar-actions .ghost-button {
        flex: 1 1 100%;
    }
}

@media (min-width: 768px) {
    .page-shell {
        padding: 1.35rem;
    }

    .topbar {
        grid-template-columns: 1fr auto;
    }

    .topbar-actions {
        justify-items: end;
    }

    .hero-grid {
        grid-template-columns: 0.95fr 1.05fr;
    }

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

    .summary-grid,
    .grid-two,
    .toolbar,
    .kpi-strip,
    .two-column,
    .period-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .hero-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}
