/* =====================================================================
   Monika Growth Hub — Premium Design System v2
   FinTech + Network-growth platform: confident indigo, warm bronze-gold
   reward accent, disciplined neutrals, Sora display type for numbers
   and headings, Inter/system for body copy.
   ===================================================================== */

:root {
    /* Neutrals */
    --navy: #12142b;
    --navy-soft: #4a4d6b;
    --bg: #f5f6fb;
    --bg-tint: #eef0fa;
    --card-bg: #ffffff;
    --border: #e6e8f3;
    --border-soft: #eef0f8;
    --muted: #6b6f8c;
    --muted-soft: #9498b3;
    /* Primary accent — deep indigo → violet */
    --primary: #4338ca;
    --primary-2: #7c3aed;
    --primary-dark: #372aa8;
    --primary-soft: #eeecfe;
    --primary-soft-2: #e3e0fd;
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    --gradient-primary-radial: radial-gradient(120% 140% at 15% 15%, #5b4fe0 0%, var(--primary) 45%, #3a2f9e 100%);
    /* Lighter periwinkle variant — used for large hero surfaces so they read as
     airy/inviting rather than a dense dark block */
    --gradient-hero: linear-gradient(120deg, #7069f5 0%, #6c60ee 45%, #7b6ff2 100%);
    /* Bronze-gold accent — rewards, ranks, achievements */
    --gold: #b8873a;
    --gold-deep: #8a611f;
    --gold-soft: #fbf3e2;
    --gradient-gold: linear-gradient(135deg, #e7b65c 0%, #b8873a 100%);
    /* Growth accent — distinct from primary, used sparingly for positive metrics */
    --emerald: #0f9d63;
    --emerald-soft: #e9f9f1;
    /* Soft full-card tints for KPI/stat cards (lavender/green/orange/blue rotation) */
    --tint-lavender: #efecfe;
    --tint-green: #e6f7ef;
    --tint-orange: #fdecd9;
    --tint-blue: #e7f1fd;
    /* Status colors */
    --success: #12905a;
    --success-soft: #e9f9f1;
    --danger: #d0392b;
    --danger-soft: #fdedeb;
    --warning: #b5710a;
    --warning-soft: #fdf3e0;
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-xs: 0 1px 2px rgba(18, 20, 43, 0.05);
    --shadow-sm: 0 2px 8px rgba(18, 20, 43, 0.05);
    --shadow: 0 8px 24px rgba(18, 20, 43, 0.08);
    --shadow-lg: 0 20px 48px rgba(28, 24, 84, 0.16);
    --nav-height: 64px;
    --font-display: 'Sora', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--navy);
    font-family: var(--font-body);
    -webkit-tap-highlight-color: transparent;
    line-height: 1.6;
    font-size: 15.5px;
}

::selection {
    background: var(--primary-soft-2);
    color: var(--primary-dark);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #d7d9ec;
    border-radius: 999px;
    border: 2px solid var(--bg);
}

    ::-webkit-scrollbar-thumb:hover {
        background: #c3c6e4;
    }

h1, h2, h3, h4 {
    color: var(--navy);
    font-family: var(--font-display);
    letter-spacing: -0.015em;
    font-weight: 700;
    line-height: 1.25;
}

h1 {
    font-size: 1.9rem;
}

h2 {
    font-size: 1.4rem;
}

h3 {
    font-size: 1.08rem;
    margin: 0 0 12px 0;
}

p {
    margin: 0 0 10px 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

    a:hover {
        color: var(--primary-dark);
        text-decoration: underline;
    }

    /* Accessible keyboard focus everywhere */
    a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
    textarea:focus-visible, [tabindex]:focus-visible {
        outline: 2px solid var(--primary);
        outline-offset: 2px;
        border-radius: 4px;
    }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Small helper text */
.hint-text {
    color: var(--muted);
    font-size: 0.88rem;
}

.eyebrow-label {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    margin: 0 0 4px 0;
}

.text-muted {
    color: var(--muted) !important;
}

.text-success {
    color: var(--success) !important;
    font-weight: 600;
}

.text-danger {
    color: var(--danger) !important;
    font-weight: 600;
}

.nowrap {
    white-space: nowrap;
}

/* ===== App Shell / Navigation ===== */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--border);
}

    .topbar .brand {
        font-family: var(--font-display);
        font-weight: 700;
        font-size: 1.05rem;
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--navy);
    }

    .topbar nav {
        display: flex;
        align-items: center;
        gap: 22px;
        flex-wrap: wrap;
    }

        .topbar nav a {
            color: var(--navy-soft);
            opacity: 0.92;
            font-size: 0.92rem;
            font-weight: 500;
            padding: 6px 2px;
            border-bottom: 2px solid transparent;
            transition: all 0.15s ease;
        }

            .topbar nav a:hover {
                text-decoration: none;
            }

            .topbar nav a.active,
            .topbar nav a:hover {
                opacity: 1;
                color: var(--primary);
                border-bottom: 2px solid var(--primary);
            }

/* ===== Topbar user area (logged in) ===== */
.topbar-user-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-tint);
    font-size: 1.05rem;
    color: var(--navy);
    transition: background 0.15s ease;
}

    .topbar-icon-btn:hover {
        background: var(--primary-soft);
        text-decoration: none;
    }

.topbar-icon-dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    border: 1.5px solid #fff;
}

.topbar-user-pill {
    width: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    background: transparent;
    border: 1px solid var(--border);
    box-shadow: none;
    padding: 5px 12px 5px 6px;
    border-radius: 999px;
    color: var(--navy);
}

    .topbar-user-pill:hover {
        background: var(--bg-tint);
        box-shadow: none;
        transform: none;
    }

.topbar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.topbar-user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.topbar-user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--navy);
}

.topbar-user-role {
    font-size: 0.68rem;
    color: var(--muted);
}

.topbar-chevron {
    font-size: 0.8rem;
    color: var(--muted);
}

@media (max-width: 680px) {
    .topbar-user-text {
        display: none;
    }

    .topbar-user-pill {
        padding: 5px 8px 5px 5px;
    }
}

.page-content {
    flex: 1;
    min-width: 0;
    padding: 32px 24px 90px 24px;
    max-width: 1040px;
    width: 100%;
    margin: 0 auto;
}

.app-body {
    display: flex;
    align-items: flex-start;
    width: 100%;
}

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 66px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 30;
    box-shadow: 0 -4px 20px rgba(18, 20, 43, 0.06);
}

    .bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-size: 0.72rem;
        color: var(--muted);
        gap: 3px;
        font-weight: 500;
        transition: color 0.15s ease, transform 0.15s ease;
    }

        .bottom-nav a.active {
            color: var(--primary);
        }

        .bottom-nav a:active {
            transform: scale(0.94);
        }

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

@media (max-width: 680px) {
    .topbar {
        padding: 0 14px;
    }

        .topbar nav {
            display: none;
        }

    .bottom-nav {
        display: flex;
    }

    .page-content {
        padding: 14px 12px 84px 12px;
    }

    h1 {
        font-size: 1.4rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    h3 {
        font-size: 0.98rem;
        margin-bottom: 8px;
    }

    /* ===== Global mobile compacting pass =====
     90% of traffic is mobile — every page that uses the generic .card /
     .grid / .form-group / button classes (i.e. every page not individually
     redesigned) gets a tighter, more native-app-like density here. */
    .card {
        padding: 14px;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    .grid {
        gap: 10px;
    }

    .page-head {
        gap: 10px;
        margin-bottom: 14px;
    }

    .page-head-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 1rem;
    }

    .form-group {
        margin-bottom: 11px;
    }

        .form-group label {
            font-size: 0.78rem;
            margin-bottom: 4px;
        }

    input[type="text"], input[type="password"], input[type="email"], select, textarea {
        padding: 9px 11px;
        font-size: 0.92rem;
    }

    button, .btn {
        padding: 10px;
        font-size: 0.9rem;
    }

    .empty-state {
        padding: 26px 16px;
    }

    .empty-state-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }

    .data-table th, .data-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .hint-text {
        font-size: 0.76rem;
    }
}

/* ===== Page header (icon + title, used across member/admin pages) ===== */
.page-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.page-head-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.page-head h2 {
    margin: 0;
}

.h3-icon {
    margin-right: 4px;
}

/* ===== Card header with icon circle (dashboard sections) ===== */
.card-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.copy-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    padding: 0;
    background: var(--primary-soft);
    color: var(--primary-dark);
    box-shadow: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

    .copy-btn:hover {
        background: var(--primary-soft-2);
        box-shadow: none;
        transform: none;
    }

/* ===== Hero ===== */
.hero {
    position: relative;
    background: var(--gradient-hero);
    border-radius: var(--radius-lg);
    padding: 30px 32px;
    color: #fff;
    box-shadow: 0 16px 32px rgba(76, 68, 220, 0.22);
    margin-bottom: 20px;
    overflow: hidden;
}

    .hero h1, .hero h2 {
        color: #fff;
    }

    .hero p {
        color: rgba(255,255,255,0.85);
    }

.hero-dashboard {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.hero-eyebrow {
    text-transform: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    margin: 0 0 2px 0;
}

.hero-text h1 {
    margin: 0 0 6px 0;
    font-size: 1.7rem;
}

.wave {
    display: inline-block;
    animation: wave-hand 2.2s ease-in-out 1;
    transform-origin: 70% 70%;
}

@keyframes wave-hand {
    0%, 100% {
        transform: rotate(0deg);
    }

    15% {
        transform: rotate(14deg);
    }

    30% {
        transform: rotate(-8deg);
    }

    45% {
        transform: rotate(14deg);
    }

    60% {
        transform: rotate(-4deg);
    }
}

.hero-sub {
    margin: 0;
    font-size: 0.95rem;
}

.hero-motif {
    text-align: right;
    flex-shrink: 0;
    color: rgba(255,255,255,0.92);
}

    .hero-motif .hero-motif-icon {
        font-size: 2rem;
        display: block;
        margin-bottom: 4px;
        filter: brightness(1.4);
    }

    .hero-motif .hero-motif-tagline {
        font-family: var(--font-display);
        font-weight: 700;
        font-size: 0.95rem;
        line-height: 1.3;
        color: #fff;
    }

@media (max-width: 560px) {
    .hero {
        padding: 26px 22px;
    }

    .hero-motif {
        display: none;
    }
}

.skeleton-hero {
    height: 128px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    background: linear-gradient(100deg, var(--bg-tint) 30%, #ffffff 50%, var(--bg-tint) 70%);
    background-size: 200% 100%;
    animation: skeleton-sweep 1.4s ease-in-out infinite;
}

@keyframes skeleton-sweep {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== Cards ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
    padding: 22px;
    margin-bottom: 18px;
}

    .card h3:first-child, .card h3 {
        margin-top: 0;
    }

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ===== Rank summary card (dashboard) ===== */
.rank-card {
    padding: 20px 22px;
}

.rank-card-top {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.rank-card-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rank-medal {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gold-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.rank-card-progress {
    flex: 1;
    min-width: 200px;
}

.rank-card-progress-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 6px;
}

    .rank-card-progress-head strong {
        color: var(--navy);
        font-family: var(--font-display);
    }

/* ===== Stat cards ===== */
.stat-card {
    text-align: left;
    position: relative;
    overflow: hidden;
    padding-top: 20px;
    background: var(--tint-lavender);
    border-color: transparent;
}

.stat-card-accent {
    background: var(--tint-green);
    border-color: transparent;
}

.stat-card-warning {
    background: var(--tint-orange);
    border-color: transparent;
}

.stat-card-success {
    background: var(--tint-blue);
    border-color: transparent;
}

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.75);
    font-size: 1rem;
    margin-bottom: 10px;
}

.stat-card .value {
    font-family: var(--font-display);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.1;
}

.stat-card .value-suffix {
    font-size: 1.1rem;
    color: var(--muted-soft);
    font-weight: 600;
}

.stat-card .label {
    color: var(--muted);
    font-size: 0.82rem;
    margin-top: 5px;
    font-weight: 500;
}

.stat-card-arrow {
    position: absolute;
    top: 20px;
    right: 18px;
    color: var(--muted-soft);
    font-size: 1rem;
}

/* ===== Badges (rank / status pills) ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-gold {
    background: var(--gradient-gold);
    color: #4a3712;
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-primary {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

/* ===== Empty states ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-tint);
    font-size: 1.5rem;
    margin-bottom: 14px;
}

.empty-state p {
    margin: 0 0 4px 0;
    font-weight: 700;
    color: var(--navy);
    font-size: 0.98rem;
}

.empty-state-hint {
    font-size: 0.85rem;
    color: var(--muted);
}

/* ===== Data tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

    .data-table thead th {
        text-align: left;
        padding: 10px 12px;
        font-size: 0.74rem;
        text-transform: none;
        color: var(--muted);
        font-weight: 600;
        border-bottom: 1.5px solid var(--border);
        white-space: nowrap;
    }

    .data-table tbody td {
        padding: 12px;
        border-bottom: 1px solid var(--border-soft);
        color: var(--navy);
        vertical-align: middle;
    }

    .data-table tbody tr:last-child td {
        border-bottom: none;
    }

    .data-table tbody tr:hover {
        background: var(--bg-tint);
    }

/* ===== Forms ===== */
.login-card, .form-card {
    max-width: 420px;
    margin: 40px auto;
    padding: 34px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

    .login-card h3, .form-card h3 {
        margin-bottom: 22px;
        text-align: center;
    }

.form-group {
    margin-bottom: 15px;
}

    .form-group label {
        display: block;
        font-size: 0.82rem;
        color: var(--navy-soft);
        font-weight: 600;
        margin-bottom: 5px;
    }

input[type="text"], input[type="password"], input[type="email"], select, textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--navy);
    background: #fbfcfe;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

    input:focus, select:focus, textarea:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-soft);
        background: #fff;
    }

input:disabled {
    background: #f1f2f6;
    color: var(--muted);
}

button, .btn {
    width: 100%;
    padding: 12px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
    box-shadow: 0 4px 14px rgba(67, 56, 202, 0.25);
}

    button:hover, .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 18px rgba(67, 56, 202, 0.32);
        text-decoration: none;
    }

    button:active, .btn:active {
        transform: translateY(0);
    }

    button:disabled {
        opacity: 0.55;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

.btn-secondary {
    background: #fff;
    color: var(--primary);
    border: 1.5px solid var(--border);
    box-shadow: none;
}

    .btn-secondary:hover {
        background: var(--primary-soft);
        border-color: var(--primary);
        box-shadow: none;
    }

.btn-gold {
    background: var(--gradient-gold);
    color: #4a3712;
    box-shadow: 0 4px 14px rgba(184, 135, 58, 0.32);
}

.error-msg {
    background: var(--danger-soft);
    color: var(--danger);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 12px;
    border: 1px solid #f6cac4;
}

.success-msg {
    background: var(--success-soft);
    color: var(--success);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 12px;
    border: 1px solid #b9e8cf;
}

/* ===== Referral code chip ===== */
.code-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: 9px 16px;
    border-radius: 999px;
    font-weight: 700;
    font-family: 'Consolas', monospace;
    border: 1px solid var(--primary-soft-2);
}

/* ===== Genealogy tree ===== */
.tree-view {
    overflow-x: auto;
}

.tree-node {
    display: inline-block;
    vertical-align: top;
    text-align: center;
    padding: 10px;
}

    .tree-node .node-box {
        display: inline-block;
        background: #fff;
        border: 2px solid var(--primary);
        border-radius: 12px;
        padding: 10px 16px;
        font-size: 0.85rem;
        font-weight: 700;
        min-width: 90px;
        box-shadow: var(--shadow-sm);
    }

        .tree-node .node-box.empty {
            border-style: dashed;
            color: var(--muted);
            border-color: var(--border);
            font-weight: 400;
            box-shadow: none;
            background: var(--bg-tint);
        }

        .tree-node .node-box.root {
            background: var(--gradient-primary-radial);
            border-color: transparent;
            color: #fff;
            box-shadow: var(--shadow);
        }

            .tree-node .node-box.root div {
                color: #fff;
                opacity: 1;
            }

.tree-children {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    position: relative;
}

@media (max-width: 680px) {
    .tree-node .node-box {
        min-width: 70px;
        font-size: 0.75rem;
        padding: 7px 9px;
    }
}

/* ===== PWA Install Button ===== */
.install-pwa-btn {
    width: auto;
    padding: 7px 14px;
    font-size: 0.85rem;
    background: var(--gradient-gold);
    color: #4a3712;
    box-shadow: 0 3px 10px rgba(184, 135, 58, 0.28);
    white-space: nowrap;
    margin-left: auto;
}

.install-pwa-hint {
    font-size: 0.72rem;
    color: var(--muted);
    max-width: 180px;
    margin: 0 0 0 auto;
    text-align: right;
}

@media (max-width: 680px) {
    .install-pwa-btn {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

        .install-pwa-btn .btn-label {
            display: none;
        }

    .install-pwa-hint {
        display: none;
    }
}

/* ===== Member Sidebar ===== */
.sidebar-toggle {
    width: auto;
    padding: 8px 10px;
    background: transparent;
    color: var(--navy);
    box-shadow: none;
    font-size: 1.2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-right: 8px;
}

    .sidebar-toggle:hover {
        background: var(--primary-soft);
        box-shadow: none;
        transform: none;
    }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 20, 43, 0.4);
    backdrop-filter: blur(1px);
    z-index: 40;
}

.member-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 264px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    z-index: 41;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}

    .member-sidebar.open {
        transform: translateX(0);
    }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 16px;
    background: var(--gradient-primary-radial);
    color: #fff;
    font-weight: 700;
}

.sidebar-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    border: 1.5px solid rgba(255,255,255,0.4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sidebar-close {
    width: auto;
    background: rgba(255,255,255,0.15);
    box-shadow: none;
    color: #fff;
    font-size: 0.9rem;
    padding: 4px 9px;
    border-radius: 6px;
}

    .sidebar-close:hover {
        background: rgba(255,255,255,0.28);
        box-shadow: none;
        transform: none;
    }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    overflow-y: auto;
    flex: 1;
}

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 20px;
        color: var(--navy-soft);
        font-size: 0.92rem;
        font-weight: 500;
        border-left: 3px solid transparent;
        transition: background 0.12s ease, color 0.12s ease;
    }

        .sidebar-nav a .icon {
            font-size: 1.1rem;
            width: 22px;
            text-align: center;
        }

        .sidebar-nav a:hover {
            background: var(--primary-soft);
            text-decoration: none;
            color: var(--primary);
        }

        .sidebar-nav a.active {
            background: var(--primary-soft);
            color: var(--primary);
            border-left-color: var(--primary);
            font-weight: 700;
        }

.sidebar-nav-logout {
    color: var(--danger) !important;
}

    .sidebar-nav-logout:hover {
        background: var(--danger-soft) !important;
        color: var(--danger) !important;
    }

    .sidebar-nav-logout .icon {
        color: var(--danger);
    }

.sidebar-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 20px;
    background: transparent;
    color: var(--navy-soft);
    font-size: 0.92rem;
    font-weight: 500;
    font-family: var(--font-body);
    border: none;
    border-left: 3px solid transparent;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

    .sidebar-nav-group-toggle:hover {
        background: var(--primary-soft);
        color: var(--primary);
        box-shadow: none;
        transform: none;
    }

    .sidebar-nav-group-toggle.active {
        background: var(--primary-soft);
        color: var(--primary);
        border-left-color: var(--primary);
        font-weight: 700;
    }

.sidebar-nav-group-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--muted-soft);
}

.sidebar-nav-submenu {
    display: flex;
    flex-direction: column;
    background: var(--bg-tint);
}

    .sidebar-nav-submenu a {
        padding: 9px 20px 9px 54px;
        font-size: 0.85rem;
        color: var(--navy-soft);
        border-left: 3px solid transparent;
    }

        .sidebar-nav-submenu a:hover {
            background: var(--primary-soft);
            color: var(--primary);
            text-decoration: none;
        }

        .sidebar-nav-submenu a.active {
            color: var(--primary);
            font-weight: 700;
            border-left-color: var(--primary);
        }

.sidebar-promo {
    margin: 12px 16px 20px 16px;
    padding: 18px 16px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    text-align: left;
}

.sidebar-promo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #fff;
    font-size: 1rem;
    margin-bottom: 10px;
}

.sidebar-promo-title {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--navy);
    font-size: 0.95rem;
    line-height: 1.3;
    margin: 0;
}

.sidebar-promo-sub {
    font-size: 0.74rem;
    color: var(--muted);
    line-height: 1.4;
    margin: 0;
}

/* Desktop: sidebar becomes a persistent in-flow column instead of an overlay */
@media (min-width: 901px) {
    .sidebar-toggle {
        display: none;
    }

    .member-sidebar {
        width: 224px;
        position: sticky;
        top: var(--nav-height);
        left: auto;
        bottom: auto;
        height: calc(100vh - var(--nav-height));
        transform: none;
        box-shadow: none;
        border-right: 1px solid var(--border);
        flex-shrink: 0;
    }

    .sidebar-close {
        display: none;
    }

    .sidebar-backdrop {
        display: none;
    }

    .sidebar-nav a {
        padding: 10px 14px;
        font-size: 0.85rem;
        gap: 10px;
    }

        .sidebar-nav a .icon {
            width: 18px;
            font-size: 1rem;
        }

    .sidebar-nav-group-toggle {
        padding: 10px 14px;
        font-size: 0.85rem;
        gap: 10px;
    }

        .sidebar-nav-group-toggle .icon {
            width: 18px;
            font-size: 1rem;
        }

    .sidebar-nav-submenu a {
        padding: 8px 14px 8px 42px;
        font-size: 0.8rem;
    }

    .sidebar-promo {
        margin: 12px 10px 18px 10px;
        padding: 14px 12px;
    }
}

@media (min-width: 681px) {
    .member-sidebar {
        width: 280px;
    }
}

/* Rank progress bar */
.progress-track {
    width: 100%;
    height: 10px;
    background: #eef0f5;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-gold);
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.ticket-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-soft);
}

    .ticket-item:last-child {
        border-bottom: none;
    }

/* ===== Bar chart (income analytics) ===== */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 170px;
    margin-top: 18px;
    padding-top: 6px;
}

.bar-chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

.bar-chart-value {
    font-size: 0.74rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--navy-soft);
    margin-bottom: 6px;
}

.bar-chart-bar {
    width: 100%;
    background: var(--gradient-primary);
    border-radius: 8px 8px 3px 3px;
    transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    min-height: 4px;
}

.bar-chart-label {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 8px;
    font-weight: 600;
}

.legend-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== My Team page ===== */
.team-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

    .team-filter-bar input[type="text"] {
        flex: 2;
        min-width: 200px;
    }

    .team-filter-bar select {
        flex: 1;
        min-width: 130px;
        width: auto;
    }

.team-view-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

    .team-view-toggle button {
        width: auto;
        padding: 8px 16px;
        background: #fff;
        color: var(--navy-soft);
        border: 1px solid var(--border);
        box-shadow: none;
        font-size: 0.85rem;
    }

        .team-view-toggle button.active {
            background: var(--gradient-primary);
            color: #fff;
            border-color: transparent;
        }

        .team-view-toggle button:hover {
            transform: none;
        }

    .team-view-toggle a {
        font-size: 0.82rem;
        font-weight: 600;
    }

.team-table thead th:first-child {
    padding-left: 16px;
}

.team-table tbody td:first-child {
    padding-left: 16px;
}

.member-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.team-group-row {
    background: var(--bg-tint);
    cursor: pointer;
    font-size: 0.88rem;
}

    .team-group-row:hover {
        background: var(--primary-soft);
    }

    .team-group-row td {
        padding: 12px 16px;
    }

.team-group-chevron {
    display: inline-block;
    width: 16px;
    color: var(--muted);
    margin-right: 6px;
}

.team-group-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.72rem;
    font-weight: 700;
    margin-right: 8px;
}

.team-group-stats {
    float: right;
    font-size: 0.82rem;
    color: var(--muted);
}

@media (max-width: 680px) {
    .team-group-stats {
        display: block;
        float: none;
        margin-top: 4px;
    }
}

/* ===== MGH Business Plan card (dark navy, matches official plan graphic) ===== */
.mgh-plan-card {
    background: #fff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-top: 16px;
}

.mgh-plan-header {
    background: #12173f;
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    letter-spacing: 0.02em;
}

.mgh-plan-header-icon {
    font-size: 1.2rem;
}

.mgh-plan-subtitle {
    text-align: center;
    color: var(--navy-soft);
    font-weight: 600;
    padding: 12px 0 4px 0;
    margin: 0;
}

.mgh-plan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

    .mgh-plan-table thead th {
        background: #12173f;
        color: #fff;
        padding: 10px 16px;
        text-align: center;
        font-weight: 600;
    }

    .mgh-plan-table tbody td {
        padding: 10px 16px;
        text-align: center;
        border-bottom: 1px solid var(--border-soft);
    }

    .mgh-plan-table tbody tr:nth-child(even) {
        background: var(--bg-tint);
    }

.mgh-plan-income {
    color: var(--success);
    font-weight: 700;
    font-family: var(--font-display);
}

.mgh-plan-total {
    background: #12173f;
    color: #fff;
    text-align: center;
    padding: 12px;
    font-weight: 600;
    font-family: var(--font-display);
}

    .mgh-plan-total span {
        color: var(--gold);
        margin-left: 6px;
    }

.mgh-plan-footnote {
    text-align: center;
    font-size: 0.82rem;
    color: var(--navy-soft);
    padding: 14px 20px;
    margin: 0;
}

/* ===== Profile page ===== */
.profile-header-card {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 460px;
}

.profile-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--gradient-primary-radial);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.92rem;
}

    .detail-row:last-of-type {
        border-bottom: none;
    }

    .detail-row span {
        color: var(--muted);
        font-size: 0.85rem;
    }

    .detail-row strong {
        color: var(--navy);
        font-weight: 600;
    }

/* ===== Password strength meter ===== */
.strength-meter {
    height: 5px;
    background: var(--border-soft);
    border-radius: 999px;
    margin-top: 8px;
    overflow: hidden;
}

.strength-meter-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.2s ease, background 0.2s ease;
}

    .strength-meter-bar.weak {
        width: 33%;
        background: var(--danger);
    }

    .strength-meter-bar.fair {
        width: 66%;
        background: var(--warning);
    }

    .strength-meter-bar.strong {
        width: 100%;
        background: var(--success);
    }

.strength-meter-label {
    font-size: 0.74rem;
    font-weight: 600;
    margin-top: 4px;
    display: inline-block;
}

/* ===== Quick link cards (admin dashboard) ===== */
.quick-link-card {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

    .quick-link-card:hover {
        text-decoration: none;
        transform: translateY(-2px);
        box-shadow: var(--shadow);
        border-color: var(--primary-soft-2);
    }

    .quick-link-card h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }

/* ===== Footer ===== */
.site-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 32px 24px 20px 24px;
    margin-top: 20px;
}

.site-footer-grid {
    max-width: 1040px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 22px;
    font-size: 0.85rem;
}

    .site-footer-grid p {
        margin: 5px 0;
    }

.site-footer-heading {
    font-family: var(--font-display);
    font-weight: 700;
    margin-bottom: 8px !important;
}

.site-footer-bottom {
    text-align: center;
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 22px;
}
