/* ---- Fonts (self-hosted, no CDN at runtime) ---- */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/static/fonts/inter-400.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/static/fonts/inter-500.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/static/fonts/inter-600.woff2") format("woff2");
}

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/static/fonts/inter-700.woff2") format("woff2");
}

:root {
    --font: "Inter", ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
    --radius: 14px;
    --accent: #5b6cff;
    --accent-dark: #4353e6;
}

body {
    font-family: var(--font);
    padding-bottom: 4.5rem; /* leave room for the mobile bottom nav */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font);
    font-weight: 600;
    letter-spacing: -0.01em;
}

strong {
    font-weight: 600;
}

a {
    color: var(--accent);
}

/* ---- Header / nav ---- */

header.container {
    padding-top: 1.25rem;
    padding-bottom: 1.25rem;
}

header.container nav {
    flex-wrap: wrap;
}

.brand {
    text-decoration: none;
    color: var(--pico-color);
    font-size: 1.1rem;
}

.top-nav a {
    text-decoration: none;
    font-weight: 500;
    color: var(--pico-muted-color);
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.top-nav a:hover {
    background: var(--pico-card-sectioning-background-color, #f1f2f9);
    color: var(--pico-color);
}

/* ---- Top nav (desktop) / bottom nav (mobile) ---- */

.bottom-nav {
    display: none;
}

@media (max-width: 767px) {
    .top-nav {
        display: none;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
        justify-content: space-around;
        background: var(--pico-card-background-color);
        border-top: var(--pico-border-width) solid var(--pico-muted-border-color);
        padding: 0.5rem 0 0.6rem;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    }

    .bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.15rem;
        color: var(--pico-muted-color);
        text-decoration: none;
        font-size: 0.68rem;
        font-weight: 500;
    }

    .bottom-nav a span {
        font-size: 1.3rem;
    }

    .logout-btn {
        white-space: nowrap;
    }
}

/* ---- Cards ---- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.two-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.two-col-grid > section {
    /* override the default min-width: auto — otherwise a wide nested .card-grid
       can force this column past its 1fr share and collapse the layout to one
       column even when there's room for two. */
    min-width: 0;
}

@media (max-width: 767px) {
    .two-col-grid {
        grid-template-columns: 1fr;
    }
}

.totals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 220px));
    gap: 1rem;
    margin-bottom: 2rem;
}

.total-card {
    text-align: center;
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    background: linear-gradient(155deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 6px 16px rgba(91, 108, 255, 0.22);
}

.total-card h2, .total-card h3 {
    margin-bottom: 0.15rem;
    color: #fff;
    font-size: 1.5rem;
}

.total-card p {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
}

.total-card.muted {
    background: var(--pico-card-background-color);
    color: var(--pico-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--pico-muted-border-color);
}

.total-card.muted h3 {
    color: var(--pico-color);
    font-size: 1.3rem;
}

.total-card.muted p {
    color: var(--pico-muted-color);
}

section > h3 {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pico-muted-color);
}

.category-card,
.account-card {
    margin: 0;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.category-card progress {
    width: 100%;
    accent-color: var(--accent);
}

.stale-warning {
    color: #c0392b;
    font-weight: 600;
}

/* ---- Tables scroll horizontally on narrow screens instead of the whole page ---- */

.table-scroll {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    font-size: 0.92rem;
}

/* ---- Money alignment ---- */

td.amount,
th.amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---- CRUD list rows ---- */

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    background: var(--pico-muted-border-color);
    color: var(--pico-muted-color);
    font-size: 0.75rem;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.row-actions button {
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
    margin: 0;
}

tr.row-error td {
    border-top: none;
    padding-top: 0;
}

/* ---- Auth pages (login/register): centered card, no nav ---- */

body.auth-page {
    padding-bottom: 0;
}

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    max-width: 420px;
}

.auth-card {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.25rem;
    font-size: 1.6rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--pico-muted-color);
    margin-bottom: 1.5rem;
}

.auth-footer-link {
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 0;
}

/* ---- Stale rates banner (header) ---- */

.stale-banner {
    background: #fdecea;
    color: #c0392b;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.stale-banner a {
    color: inherit;
    text-decoration: underline;
}
