@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=DM+Sans:wght@400;500;600;700;800&family=Playfair+Display:wght@700&family=Hind+Siliguri:wght@400;500;600;700&display=swap');

:root {
    --blue-dark: #f4f1ec;
    --blue-deep: #000;
    --blue-mid: #f3d9d7;
    --blue-accent: #c42721;
    --blue-bright: #e14a42;
    --blue-light: #c42721;
    --blue-glow: #fff;
    --gold: #c42721;
    --gold-light: #e14a42;
    --white: #16201c;
    --gray-light: #333333;
    --gray-mid: #5a5a5a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --card-bg: #ffffff;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --glow: 0 0 24px rgba(196, 39, 33, 0.18);
}

/*
 * Some surfaces (navbar, content cards, the auth box) are solid/near-solid
 * WHITE regardless of the page background, so text/border colors need to
 * flip to a dark set specifically inside them. Re-declaring the same
 * custom properties here means every existing rule using var(--white),
 * var(--gray-mid), var(--gray-light) or var(--border) automatically picks
 * up the correct value for whichever surface it's nested in — no need to
 * touch each individual rule.
 */
.navbar,
.card,
.metric,
.stat-item,
.product-card,
.auth-box,
.footer {
    --white: #16201c;
    --gray-light: #333333;
    --gray-mid: #5a5a5a;
    --border: rgba(0, 0, 0, 0.12);
    color: var(--white);
}

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

body {
    font-family: 'Inter', 'Hind Siliguri', sans-serif;
    background: var(--blue-dark);
    color: var(--white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background mesh (subtle, light) */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(196,39,33,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(196,39,33,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* NAVBAR */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 0.5rem;
    min-height: 70px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Playfair Display', 'Hind Siliguri', serif;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.logo img {
    height: 62px;
    width: auto;
    display: block;
    filter: drop-shadow(0 0 8px rgba(196,39,33,0.2));
}

.logo .brand-text {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span span,
.logo .brand-accent { color: var(--gold); -webkit-text-fill-color: var(--gold); }

.nav-links { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.nav-links a {
    color: var(--gray-mid);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}
.nav-links a:hover { color: var(--white); background: rgba(196,39,33,0.15); }
.nav-links a.active { color: var(--blue-light); background: rgba(196,39,33,0.2); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.4rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.25s;
    font-family: 'Inter', 'Hind Siliguri', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-accent), var(--blue-bright));
    color: white;
    box-shadow: 0 4px 15px rgba(196,39,33,0.4);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(196,39,33,0.6);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--gold-light));
    color: var(--blue-dark);
    box-shadow: 0 4px 15px rgba(196,39,33,0.4);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(196,39,33,0.6); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--blue-accent);
    color: var(--blue-light);
}
.btn-outline:hover { background: rgba(196,39,33,0.1); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }

/* CONTAINER */
.container { max-width: 1300px; margin: 0 auto; padding: 0 2rem; position: relative; z-index: 1; }

/* HERO */
.hero {
    padding: 7rem 0 5rem;
    text-align: center;
    position: relative;
}
.hero-badge {
    display: inline-block;
    background: rgba(196,39,33,0.15);
    border: 1px solid var(--border);
    color: var(--blue-light);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.hero h1 {
    font-family: 'DM Sans', 'Hind Siliguri', sans-serif;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.15;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--white) 30%, var(--blue-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    font-size: 1.15rem;
    color: var(--gray-mid);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}
.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* STATS BAR */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 3rem 0;
}
.stat-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-item:hover { transform: translateY(-4px); box-shadow: var(--glow); }
.stat-num {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--blue-bright), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label { color: var(--gray-mid); font-size: 0.85rem; margin-top: 0.3rem; }

/* CARDS */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}
.card:hover { border-color: rgba(196,39,33,0.35); box-shadow: var(--glow); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--blue-light); }

/* DASHBOARD LAYOUT */
.dashboard { display: grid; grid-template-columns: 260px 1fr; gap: 1.5rem; padding: 2rem 0; min-height: calc(100vh - 70px); }

/* Reusable responsive 2-column grid (collapses to 1 column on mobile) */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* Row of quick-action buttons — wraps neatly, becomes a tidy 2-col grid on mobile */
.quick-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.quick-actions .btn { flex: 1 1 auto; }

/* SIDEBAR */
.sidebar {
    background: rgba(0,0,0,0.045);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 90px;
    backdrop-filter: blur(20px);
}
.sidebar-user { text-align: center; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; }
.sidebar-avatar {
    width: 70px; height: 70px;
    background: linear-gradient(135deg, var(--blue-accent), var(--blue-bright));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 0.8rem;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(196,39,33,0.4);
    overflow: hidden;
}
.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-name { font-weight: 700; font-size: 1rem; margin-bottom: 0.3rem; }
.sidebar-ref {
    font-size: 0.8rem;
    color: var(--gold);
    background: rgba(196,39,33,0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(196,39,33,0.3);
    display: inline-block;
}
.sidebar-balance {
    margin-top: 0.8rem;
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #047857, var(--success));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav a {
    display: flex; align-items: center; gap: 0.8rem;
    color: var(--gray-mid);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 0.3rem;
}
.sidebar-nav a:hover { color: var(--white); background: rgba(196,39,33,0.15); }
.sidebar-nav a.active { color: var(--blue-light); background: rgba(196,39,33,0.2); border-left: 3px solid var(--blue-accent); }
.sidebar-nav .icon { font-size: 1.1rem; width: 20px; text-align: center; }

/* MAIN CONTENT */
.main-content { min-width: 0; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; color: var(--white); }
.page-title span { color: var(--blue-light); }

/* METRIC CARDS */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.2rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}
.metric:hover { transform: translateY(-3px); }
.metric::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--blue-accent), var(--blue-bright));
}
.metric-icon { font-size: 1.8rem; margin-bottom: 0.5rem; }
.metric-val { font-size: 1.6rem; font-weight: 800; color: var(--white); }
.metric-label { font-size: 0.8rem; color: var(--gray-mid); margin-top: 0.2rem; }
.metric-change { font-size: 0.75rem; color: var(--success); margin-top: 0.3rem; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    background: rgba(196,39,33,0.1);
    color: var(--blue-light);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(196,39,33,0.08);
    font-size: 0.9rem;
    color: var(--gray-light);
}
tr:hover td { background: rgba(196,39,33,0.05); }

/* BADGES */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    display: inline-block;
    letter-spacing: 0.5px;
}
.badge-success { background: rgba(16,185,129,0.15); color: #047857; border: 1px solid rgba(16,185,129,0.35); }
.badge-warning { background: rgba(245,158,11,0.15); color: #b45309; border: 1px solid rgba(245,158,11,0.4); }
.badge-danger { background: rgba(239,68,68,0.15); color: #b91c1c; border: 1px solid rgba(239,68,68,0.35); }
.badge-info { background: rgba(196,39,33,0.15); color: var(--blue-light); border: 1px solid var(--border); }

/* FORMS */
.form-group { margin-bottom: 1.2rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--gray-light); margin-bottom: 0.5rem; }
.form-control {
    width: 100%;
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    color: var(--white);
    font-size: 0.9rem;
    font-family: 'Inter', 'Hind Siliguri', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: var(--blue-accent);
    box-shadow: 0 0 0 3px rgba(196,39,33,0.15);
}
.form-control::placeholder { color: var(--gray-mid); }
select.form-control option { background: var(--blue-deep); color: #ffffff; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ALERTS */
.alert {
    padding: 1rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.35); color: #047857; }
.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.35); color: #b91c1c; }
.alert-info { background: rgba(196,39,33,0.1); border: 1px solid var(--border); color: var(--blue-light); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.35); color: #b45309; }

/* PRODUCT CARDS */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.product-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--glow); border-color: rgba(196,39,33,0.5); }
.product-img {
    height: 180px;
    background: linear-gradient(135deg, var(--blue-mid), var(--blue-accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 4rem;
    position: relative;
}
.product-cat {
    position: absolute;
    top: 10px; right: 10px;
    background: #fffa;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.7rem;
    color: var(--blue-light);
    border: 1px solid var(--border);
}
.product-body { padding: 1.2rem; }
.product-name { font-weight: 700; margin-bottom: 0.4rem; font-size: 0.95rem; }
.product-desc { color: var(--gray-mid); font-size: 0.8rem; margin-bottom: 1rem; line-height: 1.5; }
.product-price { font-size: 1.3rem; font-weight: 800; color: var(--gold); margin-bottom: 0.3rem; }
.product-commission { font-size: 0.75rem; color: var(--success); }

/* GENERATION TREE */
.gen-tree { }
.gen-level {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    background: rgba(0,0,0,0.02);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}
.gen-level:hover { border-color: var(--blue-accent); }
.gen-badge {
    min-width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--blue-accent), var(--blue-bright));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.85rem;
    box-shadow: 0 3px 10px rgba(196,39,33,0.4);
}
.gen-info { flex: 1; }
.gen-title { font-weight: 600; font-size: 0.9rem; }
.gen-sub { font-size: 0.78rem; color: var(--gray-mid); margin-top: 0.2rem; }
.gen-count { font-size: 0.8rem; color: var(--gold); font-weight: 600; }

/* CART */
.cart-icon { position: relative; cursor: pointer; }
.cart-count {
    position: absolute;
    top: -8px; right: -8px;
    background: var(--gold);
    color: var(--blue-dark);
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 800;
}

/* NOTICE */
.notice-bar {
    background: linear-gradient(90deg, rgba(196,39,33,0.12), rgba(196,39,33,0.05));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    color: var(--blue-light);
}

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none; align-items: center; justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--blue-deep);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem;
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { cursor: pointer; color: var(--gray-mid); font-size: 1.3rem; }
.modal-close:hover { color: var(--white); }

/* GENERATION LEVELS visualization */
.commission-table { margin-top: 1rem; }
.gen-row {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    margin-bottom: 0.3rem;
    transition: background 0.2s;
}
.gen-row:hover { background: rgba(196,39,33,0.08); }
.gen-row .level { width: 80px; font-weight: 700; color: var(--blue-light); font-size: 0.85rem; }
.gen-row .bar-wrap { flex: 1; height: 8px; background: rgba(0,0,0,0.06); border-radius: 4px; margin: 0 1rem; overflow: hidden; }
.gen-row .bar { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--blue-accent), var(--blue-bright)); }
.gen-row .pct { width: 60px; text-align: right; color: var(--gold); font-weight: 600; font-size: 0.85rem; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f2f2f2; }
::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-accent); }

/* AUTH PAGES */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.auth-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 480px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1), var(--glow);
}
.auth-logo { text-align: center; }
.auth-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 0.5rem; }
.auth-sub { text-align: center; color: var(--gray-mid); font-size: 0.9rem; margin-bottom: 2rem; }
.auth-link { color: var(--blue-light); text-decoration: none; font-weight: 600; }
.auth-link:hover { text-decoration: underline; }

/* FOOTER */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    color: var(--gray-mid);
    font-size: 0.85rem;
    margin-top: 4rem;
    position: relative;
    z-index: 1;
}

/* FOOTER SOCIAL ICONS */
.social-icons { display: flex; justify-content: center; align-items: center; gap: 0.65rem; margin-bottom: 1rem; }
.social-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05);
    color: var(--gray-mid);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.social-icon svg { width: 17px; height: 17px; fill: currentColor; display: block; }
.social-icon:hover { background: var(--gold); color: #fff; transform: translateY(-2px); }


/* MOBILE NAV TOGGLE (pure CSS, no JS needed) */
.nav-toggle-checkbox { display: none; }
.nav-toggle {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    color: var(--white);
    user-select: none;
}
.nav-toggle:hover { background: rgba(0,0,0,0.06); }

/* RESPONSIVE */
@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; }
    .grid-2col { grid-template-columns: 1fr !important; }
    .quick-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .quick-actions .btn { width: 100%; justify-content: center; text-align: center; }
    /* On mobile the sidebar stacks above the main content in normal flow
       (not an overlay) — give it a solid, clearly separated light card
       look here specifically, consistent with the rest of the light theme. */
    .sidebar {
        position: static;
        background: #ffffff;
        border: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(0,0,0,0.08);
        margin-bottom: 1.5rem;
    }
    .form-row { grid-template-columns: 1fr; }
    .navbar { padding: 0 1rem; }
    .hero { padding: 4rem 0 3rem; }

    /* Compact 2-column metric cards instead of one huge column */
    .metrics { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
    .metric { padding: 0.9rem 1rem; }
    .metric-icon { font-size: 1.4rem; margin-bottom: 0.35rem; }
    .metric-val { font-size: 1.25rem; }
    .metric-label { font-size: 0.72rem; }
    /* An odd number of cards otherwise leaves the last one stranded alone
       with an awkward empty gap beside it — stretch it full-width instead. */
    .metrics .metric:last-child:nth-child(odd) { grid-column: 1 / -1; }

    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        padding: 1rem;
        box-shadow: 0 12px 24px rgba(0,0,0,0.15);
        border-bottom: 1px solid var(--border);
        z-index: 999;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
    }
    .nav-toggle-checkbox:checked ~ .nav-links { display: flex; }
    .nav-links a, .nav-links .btn { width: 100%; text-align: center; justify-content: center; }
    .nav-links .cart-icon { align-self: center; }

    /* ── Tables (admin lists etc.) — tighter so more fits before scrolling ── */
    .page-title { font-size: 1.15rem; margin-bottom: 1rem; }
    .card { padding: 1rem; border-radius: 14px; }
    .card-header { margin-bottom: .8rem; padding-bottom: .6rem; }
    .card-title { font-size: 1rem; }
    th { padding: 0.5rem 0.6rem; font-size: 0.68rem; white-space: nowrap; }
    td { padding: 0.55rem 0.6rem; font-size: 0.78rem; }
    td img { max-width: 44px !important; height: auto !important; }
    .badge { font-size: 0.68rem; padding: 0.2rem 0.5rem; }
    .btn-sm { padding: 0.3rem 0.55rem; font-size: 0.72rem; }

    /* ── Buttons / actions — wrap cleanly instead of overflowing ── */
    .btn { padding: 0.65rem 1.1rem; font-size: 0.85rem; }
    td[style*="white-space:nowrap"] { white-space: normal !important; }
    td[style*="white-space:nowrap"] .btn-sm { display: inline-block; margin: 2px; }

    /* ── Forms — full-width, comfortable tap targets ── */
    .form-control { font-size: 16px; padding: 0.65rem 0.8rem; } /* 16px prevents iOS auto-zoom on focus */
    .form-label { font-size: 0.82rem; }
    .form-group { margin-bottom: 0.9rem; }

    /* ── Alerts ── */
    .alert { padding: 0.75rem 0.9rem; font-size: 0.82rem; }

    /* ── Section titles on public pages ── */
    .section-title { font-size: 1.4rem !important; }
}

@media (max-width: 420px) {
    /* Extra-narrow phones — collapse the metric grid to a single column
       so numbers and labels never feel cramped. */
    .metrics { grid-template-columns: 1fr; }
    .metrics .metric:last-child:nth-child(odd) { grid-column: auto; }
    .quick-actions { grid-template-columns: 1fr; }
    th, td { font-size: 0.72rem; padding: 0.45rem 0.5rem; }
}

/* PULSE ANIMATION */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.pulse { animation: pulse 2s infinite; }

/* GLOW EFFECT */
.glow-blue { box-shadow: 0 0 20px rgba(196,39,33,0.5); }
.glow-gold { box-shadow: 0 0 20px rgba(196,39,33,0.5); }

/* Number counter */
.counter { font-variant-numeric: tabular-nums; }
