/* ═══════════════════════════════════════════════
   MEMBER ELINVE — Design System v4
   Sage Green · Clean · Native Mobile
   Fonts: Plus Jakarta Sans + Poppins
   ═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Poppins:wght@400;500;600;700&display=swap');

/* ─── CSS Variables ─── */
:root {
    /* Background Layers */
    --bg-base:        #0d1117;
    --bg-surface:     #161b22;
    --bg-elevated:    #21262d;
    --bg-input:       rgba(255, 255, 255, 0.03);
    --bg-input-focus: rgba(255, 255, 255, 0.08);
    --bg-glass:       rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.07);

    /* Text */
    --text-base:      #f0f6fc;
    --text-soft:      #8b949e;
    --text-muted:     #6e7681;
    --text-inv:       #ffffff;

    /* Brand — Premium Blue */
    --brand:          #3b82f6;
    --brand-dim:      #2563eb;
    --brand-deep:     #1d4ed8;
    --brand-light:    #60a5fa;
    --brand-glow:     rgba(59, 130, 246, 0.25);
    --brand-subtle:   rgba(59, 130, 246, 0.12);
    --brand-subtle2:  rgba(59, 130, 246, 0.18);

    /* Accent — Vibrant Teal */
    --accent:         #14b8a6;
    --accent-light:   #2dd4bf;
    --accent-subtle:  rgba(20, 184, 166, 0.12);

    /* Semantic */
    --ok:             #10b981;
    --ok-bg:          rgba(16, 185, 129, 0.1);
    --warn:           #fbbf24;
    --warn-bg:        rgba(251, 191, 36, 0.1);
    --err:            #ef4444;
    --err-bg:         rgba(239, 68, 68, 0.1);
    --info:           #3b82f6;
    --info-bg:        rgba(59, 130, 246, 0.1);

    /* Borders */
    --border:         rgba(255, 255, 255, 0.07);
    --border-soft:    rgba(255, 255, 255, 0.11);

    /* Radius */
    --r-xs:   6px;
    --r-sm:   10px;
    --r-md:   14px;
    --r-lg:   18px;
    --r-xl:   24px;
    --r-full: 9999px;

    /* Shadow */
    --shadow-sm:    0 1px 4px rgba(0,0,0,0.4);
    --shadow-md:    0 4px 16px rgba(0,0,0,0.45);
    --shadow-lg:    0 8px 32px rgba(0,0,0,0.55);
    --shadow-brand: 0 4px 18px var(--brand-glow);

    /* Motion */
    --ease:        all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-fast:   all 0.15s ease;
    --ease-spring: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-w:    260px;
    --topbar-h:     54px;
    --bottomnav-h:  66px;
    --safe-bottom:  env(safe-area-inset-bottom, 0px);
    --safe-top:     env(safe-area-inset-top, 0px);
}

/* ─── Reset ─── */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
}
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    color: var(--text-base);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}
a {
    color: var(--brand-light);
    text-decoration: none;
    transition: var(--ease-fast);
}
a:hover { color: var(--brand); }
img { max-width: 100%; height: auto; }

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-base);
}
h1 { font-size: 1.625rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.975rem; }

.text-muted     { color: var(--text-muted); }
.text-soft      { color: var(--text-soft); }
.text-secondary { color: var(--text-soft); }
.text-ok        { color: var(--ok); }
.text-warn      { color: var(--warn); }
.text-err       { color: var(--err); }
.text-brand     { color: var(--brand); }
.text-sm        { font-size: 0.875rem; }
.text-xs        { font-size: 0.75rem; }
.text-center    { text-align: center; }
.font-bold      { font-weight: 700; }
.font-medium    { font-weight: 500; }

/* ─── Loading Spinner ─── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: rgba(255,255,255,0.9);
    border-radius: var(--r-full);
    animation: spin 0.6s linear infinite;
    display: none;
    flex-shrink: 0;
}
/* When a form is submitting, show spinner on its submit button */
form.submitting .btn[type="submit"] .btn-spinner,
.btn.loading .btn-spinner {
    display: block;
}
form.submitting .btn[type="submit"] .btn-label,
.btn.loading .btn-label {
    opacity: 0.7;
}
form.submitting .btn[type="submit"],
.btn.loading {
    pointer-events: none;
    opacity: 0.85;
}
/* Ghost/danger spinner uses brand color border */
.btn-ghost.loading .btn-spinner,
.btn-danger.loading .btn-spinner {
    border-color: rgba(122,170,130,0.3);
    border-top-color: var(--brand);
}

/* ─── Auth Layout ─── */
.auth-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg-base);
    position: relative;
    overflow: hidden;
}
.auth-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}
.auth-bg::before {
    content: '';
    position: absolute;
    top: -30%; right: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(122,170,130,0.07) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-bg::after {
    content: '';
    position: absolute;
    bottom: -20%; left: -15%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(77,138,122,0.06) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-xl);
    padding: 36px 32px;
    box-shadow: var(--shadow-lg);
}
.auth-card .logo {
    text-align: center;
    margin-bottom: 28px;
}
.auth-card .logo h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-base);
    letter-spacing: -0.3px;
}
.auth-card .logo h1 span { color: var(--brand); }
.auth-card .logo p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 4px;
}
.auth-logo-mark {
    width: 48px; height: 48px;
    background: var(--brand-subtle);
    border: 1px solid rgba(122,170,130,0.2);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.auth-logo-mark svg { width: 24px; height: 24px; color: var(--brand); }

/* ─── App Layout ─── */
.app-layout {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.sidebar-logo-wrap {
    width: 34px; height: 34px;
    background: var(--brand-subtle);
    border: 1px solid rgba(122,170,130,0.2);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo-wrap svg { width: 18px; height: 18px; color: var(--brand); }
.sidebar-header .brand {
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-base);
    letter-spacing: -0.2px;
}
.sidebar-header .brand-sub {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.4px;
}
.sidebar-nav {
    padding: 10px 10px;
    flex: 1;
}
.sidebar-nav .nav-section {
    font-size: 0.58rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 12px 4px;
    font-weight: 600;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    color: var(--text-soft);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--ease);
    margin-bottom: 2px;
    cursor: pointer;
    min-height: 44px;
    border: 1px solid transparent;
}
.nav-link:hover {
    background: var(--bg-glass-hover);
    color: var(--text-base);
}
.nav-link.active {
    background: var(--brand-subtle);
    color: var(--brand-light);
    border-color: rgba(122,170,130,0.12);
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-link.active svg { opacity: 1; }
.nav-link.active:hover { color: var(--brand-light); }
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Topbar ─── */
.topbar {
    height: var(--topbar-h);
    background: rgba(14, 18, 16, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.topbar .page-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-base);
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-soft);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--r-xs);
    min-width: 40px; min-height: 40px;
    align-items: center;
    justify-content: center;
}
.menu-toggle:active { background: var(--bg-glass); }
.menu-toggle svg { width: 22px; height: 22px; }
.content-area { padding: 20px; flex: 1; }

/* ─── Overlay ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 45;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ─── Bottom Nav ─── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(14, 18, 16, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 50;
    padding: 0 8px;
    padding-bottom: var(--safe-bottom);
}
.bottom-nav-inner {
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    height: var(--bottomnav-h);
    max-width: 480px;
    margin: 0 auto;
}
.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    padding: 6px 4px;
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-decoration: none;
    transition: var(--ease-fast);
    border-radius: var(--r-sm);
    margin: 8px 2px;
}
.bottom-nav-link.active {
    color: var(--brand);
    background: var(--brand-subtle);
}
.bottom-nav-link svg { width: 20px; height: 20px; transition: transform 0.2s ease; }
.bottom-nav-link.active svg { transform: scale(1.08); }

/* ─── Cards ─── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: var(--ease);
}
.card-body { padding: 18px; }
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── Hero / Welcome Card ─── */
.hero-card {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, rgba(122,170,130,0.06) 100%);
    border: 1px solid rgba(122,170,130,0.14);
    border-radius: var(--r-lg);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.hero-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 130px; height: 130px;
    background: radial-gradient(circle, rgba(122,170,130,0.1) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30px, -30px);
}
.hero-greeting {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-base);
    margin-bottom: 4px;
}
.hero-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* ─── Referral Box ─── */
.referral-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}
.referral-label { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.referral-code {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand-light);
    letter-spacing: 1px;
    font-family: 'Poppins', sans-serif;
}

/* ─── Stats Cards ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: var(--ease);
}
.stat-card:active { transform: scale(0.98); }
.stat-card .stat-icon {
    width: 36px; height: 36px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.stat-card .stat-icon svg { width: 18px; height: 18px; }
.stat-card.col-brand .stat-icon, .stat-card.purple .stat-icon { background: var(--brand-subtle); color: var(--brand); }
.stat-card.col-blue  .stat-icon, .stat-card.blue .stat-icon   { background: var(--info-bg); color: var(--info); }
.stat-card.col-ok    .stat-icon, .stat-card.green .stat-icon  { background: var(--ok-bg); color: var(--ok); }
.stat-card.col-warn  .stat-icon, .stat-card.orange .stat-icon { background: var(--warn-bg); color: var(--warn); }
.stat-card .stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    color: var(--text-base);
}
.stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── Section Headers ─── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-base);
}
.section-link { font-size: 0.75rem; color: var(--brand); font-weight: 500; }
.section-link:hover { color: var(--brand-light); }

/* ─── Tab Group ─── */
.tab-group {
    display: flex;
    gap: 3px;
    margin-bottom: 24px;
    background: var(--bg-elevated);
    padding: 4px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
}
.tab-btn {
    flex: 1;
    padding: 9px 12px;
    border-radius: var(--r-xs);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-align: center;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-muted);
    transition: var(--ease-fast);
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    letter-spacing: 0.1px;
}
.tab-btn.active {
    background: var(--brand);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}
.tab-btn:not(.active):hover { color: var(--text-base); background: var(--bg-glass-hover); }
.tab-btn svg { width: 14px; height: 14px; }

/* ─── OTP Input ─── */
.otp-input {
    text-align: center;
    font-size: 2rem;
    letter-spacing: 8px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
}

/* ─── Form Elements ─── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    color: var(--text-base);
    font-size: 0.9rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: var(--ease);
    outline: none;
    min-height: 46px;
}
.form-control:focus {
    background: var(--bg-input-focus);
    border-color: var(--brand-dim);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-control::placeholder { color: var(--text-muted); font-size: 0.85rem; }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23526355' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}
.form-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 5px; line-height: 1.5; }
.form-error { font-size: 0.72rem; color: var(--err); margin-top: 4px; font-weight: 500; }
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    min-height: 44px;
}
.form-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--ease);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    min-height: 44px;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--brand);
    color: #ffffff;
    border-color: transparent;
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover { background: var(--brand-dim); color: #ffffff; box-shadow: 0 6px 24px var(--brand-glow); }

.btn-accent { background: var(--accent); color: white; border-color: transparent; }
.btn-accent:hover { background: var(--accent-light); color: white; }

.btn-ok { background: var(--ok); color: white; }
.btn-ok:hover { color: white; opacity: 0.9; }

.btn-danger {
    background: var(--err-bg);
    color: var(--err);
    border: 1px solid rgba(201,98,98,0.2);
}
.btn-danger:hover { background: rgba(201,98,98,0.18); color: var(--err); }

.btn-danger-solid { background: linear-gradient(135deg, var(--err), #a84040); color: white; border: none; }

.btn-ghost {
    background: transparent;
    color: var(--text-soft);
    border: 1px solid var(--border-soft);
}
.btn-ghost:hover { background: var(--bg-glass-hover); color: var(--text-base); }

.btn-sm  { padding: 6px 14px; font-size: 0.78rem; min-height: 34px; }
.btn-lg  { padding: 13px 28px; font-size: 0.95rem; min-height: 50px; }
.btn-block { width: 100%; display: flex; }
.btn-icon  { padding: 8px; min-width: 40px; }

/* ─── Copy Button ─── */
.promo-text-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.875rem;
    line-height: 1.75;
    color: var(--text-base);
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 12px;
}
.btn-copy {
    background: var(--brand);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--r-sm);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--ease);
    width: 100%;
    min-height: 46px;
    box-shadow: var(--shadow-brand);
}
.btn-copy:active { transform: scale(0.97); }
.btn-copy.copied { background: var(--ok); box-shadow: none; }

/* ─── Modal / Sheet ─── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-sheet {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    width: 100%;
    max-width: 600px;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
}
.modal-handle {
    width: 32px; height: 3px;
    background: var(--border-soft);
    border-radius: 2px;
    margin: 10px auto 0;
}
.modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 1;
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
    background: var(--bg-glass);
    border: none;
    color: var(--text-soft);
    width: 32px; height: 32px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--ease-fast);
    font-size: 1rem;
    line-height: 1;
}
.modal-close:hover { background: var(--bg-glass-hover); color: var(--text-base); }
.modal-body { padding: 18px; }
.modal-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--bg-elevated);
}
.modal-footer .btn { flex: 1; }

@media (min-width: 769px) {
    .modal-backdrop { align-items: center; padding: 20px; }
    .modal-sheet { border-radius: var(--r-xl); max-height: 85vh; }
    .modal-handle { display: none; }
}

/* Confirm Dialog */
.confirm-dialog {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-xl);
    padding: 26px;
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.confirm-dialog .confirm-icon {
    width: 52px; height: 52px;
    border-radius: var(--r-full);
    background: var(--err-bg);
    border: 1px solid rgba(201,98,98,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.confirm-dialog .confirm-icon svg { width: 22px; height: 22px; color: var(--err); }
.confirm-dialog h3 { margin-bottom: 8px; font-size: 1rem; }
.confirm-dialog p { color: var(--text-soft); font-size: 0.85rem; margin-bottom: 22px; }
.confirm-dialog .confirm-actions { display: flex; gap: 10px; }
.confirm-dialog .confirm-actions .btn { flex: 1; }

/* Alpine */
[x-cloak] { display: none !important; }

/* ─── Table ─── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; }
thead { background: rgba(255,255,255,0.02); }
th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-soft);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ─── Drag-to-reorder row ─── */
.drag-row {
    cursor: grab;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.drag-row:active { cursor: grabbing; }
.drag-row.dragging {
    opacity: 0.5;
    background: var(--brand-subtle);
}
.drag-row.drag-over {
    background: var(--brand-subtle2);
    box-shadow: inset 0 2px 0 var(--brand);
}
.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    display: inline-flex;
    align-items: center;
    padding: 4px;
    border-radius: var(--r-xs);
    transition: var(--ease-fast);
}
.drag-handle:hover { color: var(--brand); background: var(--brand-subtle); }
.drag-handle svg { width: 16px; height: 16px; }

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: var(--r-full);
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-affiliate { background: var(--brand-subtle); color: var(--brand-light); border: 1px solid rgba(122,170,130,0.15); }
.badge-reseller  { background: var(--accent-subtle); color: var(--accent-light); }
.badge-admin     { background: var(--warn-bg); color: var(--warn); }
.badge-active    { background: var(--ok-bg); color: var(--ok); }
.badge-inactive  { background: var(--err-bg); color: var(--err); }
.badge-pinned    { background: var(--warn-bg); color: var(--warn); }
.badge-member    { background: var(--bg-glass); color: var(--text-soft); }

/* ─── Gallery Grid ─── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
}
.gallery-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: var(--ease);
}
.gallery-item:active { transform: scale(0.97); }
.gallery-item:hover { border-color: var(--border-soft); }
.gallery-item .gallery-img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery-item .gallery-info { padding: 10px; }
.gallery-item .gallery-title {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-base);
}
.gallery-item .gallery-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
}
.gallery-item .gallery-category {
    display: inline-flex;
    padding: 2px 7px;
    background: var(--brand-subtle);
    border-radius: var(--r-full);
    font-size: 0.62rem;
    color: var(--brand-light);
    font-weight: 500;
}
.gallery-item .gallery-actions { display: flex; gap: 6px; padding: 0 10px 10px; }

/* ─── Filter Section (unified) ─── */
.filter-section { margin-bottom: 16px; }

.filter-bar-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    margin-bottom: 12px;
}
/* Pills row */
.filter-pills-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
/* Scroll wrapper for pills on mobile */
.filter-pills-scroller {
    flex: 1;
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
}
.filter-pills-scroller::-webkit-scrollbar { display: none; }

.filter-pill {
    padding: 5px 14px;
    border-radius: var(--r-full);
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-glass);
    color: var(--text-soft);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--ease-fast);
    text-decoration: none;
    white-space: nowrap;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.filter-pill:hover { background: var(--bg-glass-hover); color: var(--text-base); }
.filter-pill.active {
    background: var(--brand-subtle);
    color: var(--brand-light);
    border-color: var(--brand-glow);
}

/* ─── Search Box (unified) ─── */
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: var(--r-sm);
    padding: 0 12px;
    min-height: 38px;
    transition: var(--ease-fast);
    flex-shrink: 0;
}
.search-box:focus-within {
    border-color: var(--brand-dim);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.search-box svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-base);
    font-size: 0.85rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    width: 160px;
    min-width: 0;
}
.search-box input::placeholder { color: var(--text-muted); }

/* Legacy search wrapper (member) */
.search-wrapper { position: relative; width: 100%; }
.search-wrapper .search-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px; height: 18px;
}
.search-wrapper .search-input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    color: var(--text-base);
    font-size: 0.875rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    outline: none;
    transition: var(--ease);
    min-height: 44px;
}
.search-wrapper .search-input:focus {
    border-color: var(--brand-dim);
    box-shadow: 0 0 0 3px var(--brand-glow);
}
.search-wrapper .search-input::placeholder { color: var(--text-muted); }

/* ─── Announcement Cards ─── */
.announcement-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
    margin-bottom: 10px;
    transition: var(--ease);
}
.announcement-card.pinned {
    border-left: 2px solid var(--warn);
    background: linear-gradient(135deg, rgba(201,164,89,0.03), var(--bg-surface));
}
.announcement-card:active { transform: scale(0.99); }
.announcement-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.announcement-avatar {
    width: 34px; height: 34px;
    border-radius: var(--r-full);
    background: linear-gradient(135deg, var(--brand-dim), var(--brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: white;
    flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
}
.announcement-meta .announcement-author { font-weight: 600; font-size: 0.83rem; color: var(--text-base); }
.announcement-meta .announcement-time { font-size: 0.68rem; color: var(--text-muted); }
.announcement-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-base);
}
.announcement-body { color: var(--text-soft); font-size: 0.85rem; line-height: 1.7; white-space: pre-line; }
.announcement-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* ─── Comment Thread ─── */
.comment-thread { margin-top: 14px; }
.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-avatar {
    width: 30px; height: 30px;
    border-radius: var(--r-full);
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.68rem;
    color: white;
    flex-shrink: 0;
}
.comment-avatar.admin-avatar { background: linear-gradient(135deg, var(--warn), #b8912a); }
.comment-content { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; flex-wrap: wrap; }
.comment-author { font-weight: 600; font-size: 0.8rem; color: var(--text-base); }
.comment-time { font-size: 0.63rem; color: var(--text-muted); }
.comment-body { font-size: 0.85rem; color: var(--text-soft); line-height: 1.6; }
.comment-replies { margin-left: 40px; border-left: 2px solid var(--border); padding-left: 12px; }

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 18px;
    list-style: none;
}
.pagination li { list-style: none; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: var(--r-xs);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-soft);
    border: 1px solid var(--border);
    transition: var(--ease-fast);
    text-decoration: none;
}
.pagination a:hover { background: var(--bg-glass-hover); color: var(--text-base); }
.pagination .active span { background: var(--brand); color: white; border-color: var(--brand); }
.pagination .disabled span { opacity: 0.3; }

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    width: 90%;
    max-width: 380px;
}
.toast {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    font-size: 0.83rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
}
@keyframes toast-in {
    from { transform: translateY(-16px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.toast-success { background: rgba(101,168,124,0.12); border: 1px solid rgba(101,168,124,0.25); color: var(--ok); }
.toast-error   { background: rgba(201,98,98,0.12);  border: 1px solid rgba(201,98,98,0.25);  color: var(--err); }

/* ─── Dropzone ─── */
.dropzone {
    border: 2px dashed var(--border-soft);
    border-radius: var(--r-md);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--ease);
    background: var(--bg-glass);
}
.dropzone:active, .dropzone.dragover { border-color: var(--brand); background: var(--brand-subtle); }
.dropzone .dropzone-icon { font-size: 2rem; margin-bottom: 8px; opacity: 0.4; }
.dropzone .dropzone-text { font-size: 0.85rem; color: var(--text-soft); }
.dropzone .dropzone-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }
.image-preview { max-width: 100%; max-height: 200px; border-radius: var(--r-sm); margin-top: 10px; display: none; object-fit: contain; }
.image-preview.show { display: block; }

/* ─── Promo Detail ─── */
.promo-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.promo-image-container { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); background: var(--bg-elevated); }
.promo-image-container img { width: 100%; display: block; }
.promo-info-container { display: flex; flex-direction: column; gap: 14px; }

/* ─── User Avatar ─── */
.user-info { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: var(--r-full);
    background: linear-gradient(135deg, var(--brand-deep), var(--brand));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    color: white;
    flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
}
.user-details .user-name { font-size: 0.83rem; font-weight: 600; color: var(--text-base); }
.user-details .user-role { font-size: 0.62rem; color: var(--text-muted); text-transform: capitalize; }

/* ─── Empty State ─── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .empty-icon {
    margin: 0 auto 14px;
    width: 56px; height: 56px;
    border-radius: var(--r-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.empty-state .empty-icon svg { width: 24px; height: 24px; color: var(--text-muted); }
.empty-state h3 { font-size: 0.95rem; color: var(--text-soft); margin-bottom: 6px; }
.empty-state p { font-size: 0.83rem; max-width: 300px; margin: 0 auto; color: var(--text-muted); }

/* ─── Divider ─── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── Utilities ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.success { color: var(--ok); }
.danger  { color: var(--err); }

/* ─── Alert banners ─── */
.alert { padding: 11px 14px; border-radius: var(--r-sm); font-size: 0.83rem; font-weight: 500; margin-bottom: 14px; }
.alert-success { background: var(--ok-bg); border: 1px solid rgba(101,168,124,0.2); color: var(--ok); }
.alert-error, .alert-danger { background: var(--err-bg); border: 1px solid rgba(201,98,98,0.2); color: var(--err); }
.alert-warning { background: var(--warn-bg); border: 1px solid rgba(201,164,89,0.2); color: var(--warn); }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .promo-detail { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .member-menu-toggle { display: none !important; }

    .bottom-nav { display: block; }
    .content-area {
        padding: 14px 14px;
        padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 14px);
    }

    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 1.4rem; }

    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

    .filter-bar-wrap { padding: 10px 12px; }
    .filter-pills-row { flex-wrap: nowrap; }

    .search-box { width: 100%; }
    .search-box input { width: 100%; }

    .auth-card { padding: 28px 20px; }

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

    h1 { font-size: 1.3rem; }
    h2 { font-size: 1.1rem; }

    .form-row { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

/* ─── Animations ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.25s ease; }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInBg {
    from { opacity: 0; }
    to   { opacity: 1; }
}
