/* Budgie: styles shared by every signed-in page.
   Page files keep only what's specific to that page. Change the header,
   nav, colours or loading placeholders here, once. */

:root {
    --bg-color: #fffff3;
    --card-bg: #ffffff;
    --card-bg-hover: #f7f8d0;
    --text-main: #333333;
    --text-muted: #7d8262;
    --text-light: #9fa482;
    --accent-green: #5eb58c;
    --accent-red: #b34149;
    --accent-warning: #e8a838;
    --accent-danger: #d95f4b;
    --progress-bg: #e5e8c5;
    --border-color: #e5e8c5;
    --skeleton: #eef0d6;
    --font-sans: 'Futura', 'Trebuchet MS', Arial, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Always reserve the scrollbar's space. Without this, moving between a
   short page (no scrollbar) and a long one shifts the whole centred layout
   sideways by the scrollbar's width: one of the causes of the "jitter". */
html {
    scrollbar-gutter: stable;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-sans);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ── Header ──────────────────────────────────────────────────────────
   Three fixed columns instead of space-between. Before, the nav's
   position depended on how wide the email on the right was, and the
   email is filled in after the page loads, so the nav visibly slid
   sideways on every page. Now the outer columns share the leftover
   space equally and the nav stays put. */
header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    padding: 30px 0;
}

.logo {
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    text-decoration: none;
}

.logo img {
    height: 42px;
    width: auto;
    object-fit: contain;
}

nav {
    justify-self: center;
    display: flex;
    gap: 30px;
    font-size: 15px;
}

/* Every link carries a transparent underline, so the active one is the
   same height as the rest and nothing shifts when it's coloured in. */
nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 3px solid transparent;
    transition: color 0.15s ease;
}

nav a:hover {
    color: var(--text-main);
}

nav a.active {
    color: var(--text-main);
    border-bottom-color: var(--accent-green);
}

.header-actions {
    justify-self: end;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

#userEmail {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    padding: 0;
    white-space: nowrap;
}

.logout-link:hover {
    color: var(--text-main);
}

.nav-toggle-checkbox {
    display: none;
}

.nav-toggle-label {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.nav-toggle-label span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
}

@media (max-width: 1280px) {
    nav {
        gap: 22px;
        font-size: 14px;
    }

    #userEmail {
        max-width: 140px;
    }
}

@media (max-width: 1060px) {
    #userEmail {
        display: none;
    }

    /* keep the header on one line; email is on Account Settings */
}

@media (max-width: 860px) {
    .container {
        padding: 0 20px;
    }

    header {
        display: flex;
        flex-wrap: wrap;
        row-gap: 10px;
        justify-content: space-between;
    }

    .logo {
        order: 1;
    }

    .nav-toggle-label {
        display: flex;
        order: 2;
    }

    .header-actions {
        order: 3;
        margin-left: auto;
        font-size: 12px;
    }

    #userEmail {
        max-width: 130px;
    }

    nav {
        order: 4;
        width: 100%;
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
    }

    .nav-toggle-checkbox:checked~nav {
        max-height: 600px;
    }

    nav a {
        padding: 14px 4px;
        border-bottom: 1px solid var(--border-color);
    }

    nav a.active {
        border-bottom-color: var(--border-color);
        color: var(--accent-green);
    }
}

/* ── Loading placeholders ───────────────────────────────────────────
   Hold the space real content will take, so the page doesn't reshape
   when data arrives. Add .skeleton to an element while loading and
   remove it once filled in. */
.skeleton {
    color: transparent !important;
    background: var(--skeleton) !important;
    border-color: transparent !important;
    border-radius: 8px;
    pointer-events: none;
    user-select: none;
}

.skeleton * {
    visibility: hidden;
}

.skeleton-block {
    display: block;
    background: var(--skeleton);
    border-radius: 16px;
}

/* ── Status banners (importing / needs reconnecting / errors) ─────── */
.status-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.status-banner.warn {
    background: #fdf1ef;
    border-color: #f3d6d0;
    color: var(--accent-red);
}

.status-banner a {
    color: inherit;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: underline;
}

/* ── Empty / error states ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
}

.empty-state .empty-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.empty-state .empty-body {
    font-size: 14px;
    line-height: 1.6;
    max-width: 420px;
    margin: 0 auto;
}

.empty-state a,
.empty-state button.link {
    color: var(--accent-green);
    font-weight: 700;
    text-decoration: none;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
}

.site-footer {
    text-align: center;
    padding: 24px 20px 40px;
    color: var(--text-light);
    font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}