/* ============================================================
   NexaWager Design System
   Premium dark sportsbook UI
   ============================================================ */
:root {
    --bg: #080B12;
    --secondary: #0E131C;
    --panel: #121824;
    --card: #171E29;
    --border: #252D3A;

    --blue: #0878FF;
    --blue-bright: #167CFF;
    --blue-soft: #3C9BFF;

    --text: #F4F6FA;
    --text-2: #A6ADBA;
    --muted: #707887;

    --positive: #19C98B;
    --danger: #F05D68;
    --warning: #F3B94B;
    --live: #FF4655;

    --radius: 10px;
    --radius-sm: 7px;
    --gap: 16px;
    --header-h: 60px;

    --font: 'Inter', 'Manrope', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #34405280; }

/* Layout helpers */
.container { max-width: 1600px; margin: 0 auto; padding: 0 20px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-positive { color: var(--positive); }
.text-danger { color: var(--danger); }
.text-blue { color: var(--blue-soft); }
.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; }
.small { font-size: 12px; }
.uppercase { text-transform: uppercase; letter-spacing: 0.04em; }
.bold { font-weight: 700; }

/* Header */
.nw-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    background: var(--secondary);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
}
.nw-header .container { display: flex; align-items: center; gap: 20px; width: 100%; }
.nw-logo { font-size: 20px; font-weight: 800; letter-spacing: 0.5px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.nw-logo b { color: var(--blue); }
.nw-nav { display: flex; align-items: center; gap: 4px; }
.nw-nav a {
    padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px; color: var(--text-2);
    transition: background .15s, color .15s;
}
.nw-nav a:hover, .nw-nav a.active { background: var(--card); color: var(--text); }
.nw-header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.odds-toggle { display: flex; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.odds-toggle a { padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.odds-toggle a.active { background: var(--blue); color: #fff; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
    font-weight: 600; font-size: 13px; background: var(--card); color: var(--text);
    transition: filter .15s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-positive { background: var(--positive); color: #04120c; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }

/* Cards / panels */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 16px; }
.section-title { font-size: 16px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-live { background: rgba(255,70,85,.15); color: var(--live); }
.badge-live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
.badge-blue { background: rgba(8,120,255,.15); color: var(--blue-soft); }
.badge-positive { background: rgba(25,201,139,.15); color: var(--positive); }
.badge-danger { background: rgba(240,93,104,.15); color: var(--danger); }
.badge-warning { background: rgba(243,185,75,.15); color: var(--warning); }
.badge-muted { background: var(--card); color: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-control {
    width: 100%; padding: 11px 13px; background: var(--secondary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: 14px; transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--blue); }
.form-control::placeholder { color: var(--muted); }
select.form-control { appearance: none; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 5px; }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-2); }
.checkbox-row input { margin-top: 2px; }

/* Alerts */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: rgba(25,201,139,.1); border-color: rgba(25,201,139,.3); color: var(--positive); }
.alert-danger { background: rgba(240,93,104,.1); border-color: rgba(240,93,104,.3); color: var(--danger); }
.alert-info { background: rgba(8,120,255,.1); border-color: rgba(8,120,255,.3); color: var(--blue-soft); }
.alert-warning { background: rgba(243,185,75,.1); border-color: rgba(243,185,75,.3); color: var(--warning); }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-visual {
    flex: 1; background: linear-gradient(160deg, #0b1220, #060910 60%);
    position: relative; display: flex; flex-direction: column; justify-content: center; padding: 60px;
    border-right: 1px solid var(--border);
}
.auth-visual::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(8,120,255,.22), transparent 45%);
    pointer-events: none;
}
.auth-visual h1 { font-size: 44px; line-height: 1.1; margin: 0 0 16px; position: relative; }
.auth-visual p { color: var(--text-2); font-size: 16px; max-width: 420px; position: relative; }
.auth-form-side { width: 480px; max-width: 100%; display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 24px; margin: 0 0 6px; }
.auth-box .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; padding: 11px 12px; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.table td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.table tr:hover td { background: rgba(255,255,255,.015); }
.table td.strong { color: var(--text); font-weight: 600; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .icon { font-size: 34px; margin-bottom: 10px; opacity: .5; }

/* Grid */
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .auth-visual { display: none; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .nw-nav { display: none; }
}

/* ============================================================
   Sportsbook layout (public)
   ============================================================ */
.sb-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; max-width: 1600px; margin: 0 auto; padding: 16px 20px 80px; align-items: start; }
.sb-main { min-width: 0; }
.sb-side { position: sticky; top: 76px; }

/* Hero carousel */
.hero-carousel { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; height: 220px; }
.hero-slide { position: absolute; inset: 0; display: none; align-items: center; padding: 30px 34px; background-size: cover; background-position: center; text-decoration: none; }
.hero-slide::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6,9,16,.82), rgba(6,9,16,.35)); }
.hero-slide.active { display: flex; }
.hero-content { position: relative; max-width: 60%; }
.hero-content h2 { font-size: 30px; font-weight: 800; margin: 0 0 8px; color: #fff; line-height: 1.1; }
.hero-content p { color: var(--text-2); margin: 0 0 16px; font-size: 14px; }
.hero-dots { position: absolute; bottom: 12px; left: 34px; display: flex; gap: 6px; z-index: 2; }
.hero-dot { width: 8px; height: 8px; border-radius: 50%; border: none; background: rgba(255,255,255,.4); cursor: pointer; }
.hero-dot.active { background: var(--blue); }

/* Sidebar widget banners */
.side-banner { display: block; border-radius: var(--radius); overflow: hidden; background-size: cover; background-position: center; min-height: 120px; position: relative; text-decoration: none; border: 1px solid var(--border); }
.side-banner::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,9,16,.2), rgba(6,9,16,.8)); }
.side-banner-body { position: relative; padding: 14px; }

/* Sport nav (horizontal) */
.sport-nav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; margin-bottom: 4px; }
.sport-nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.sport-nav a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.sport-nav a .ic { font-size: 16px; }

/* League chips */
.league-nav { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; }
.league-nav a { padding: 6px 13px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--secondary); border: 1px solid var(--border); color: var(--text-2); white-space: nowrap; }
.league-nav a.active { background: rgba(8,120,255,.14); color: var(--blue-soft); border-color: var(--blue); }

/* Filter bar */
.sb-filters { display: flex; gap: 6px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.sb-filters a { padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; background: var(--card); border: 1px solid var(--border); color: var(--text-2); }
.sb-filters a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.sb-search { margin-left: auto; }
.sb-search input { padding: 8px 12px; background: var(--secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13px; min-width: 220px; }

/* Promo banners */
.promo-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 12px; margin-bottom: 18px; }
.promo-strip .banner { background: linear-gradient(120deg, #0b1c3a, #0b1220); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; position: relative; overflow: hidden; }
.promo-strip .banner::after { content:''; position:absolute; right:-30px; top:-30px; width:120px; height:120px; background: radial-gradient(circle, rgba(8,120,255,.35), transparent 70%); }
.promo-strip .banner .k { font-size: 11px; text-transform: uppercase; color: var(--blue-soft); font-weight: 700; }
.promo-strip .banner .t { font-size: 16px; font-weight: 800; margin: 4px 0; }

/* Admin promo image banners (homepage strip) */
.promo-banner-card { position: relative; display: block; min-height: 110px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background-size: cover; background-position: center; text-decoration: none; }
.promo-banner-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(6,9,16,.7), rgba(6,9,16,.25)); }
.promo-banner-card .pbc-body { position: relative; padding: 14px; }
.promo-banner-card .t { font-size: 16px; font-weight: 800; margin-bottom: 2px; }

/* Featured competition cards */
.featured-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 12px; margin-bottom: 22px; }
.featured-card { background: linear-gradient(135deg,#141d2c,#0d1420); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.featured-card .lbl { font-size: 10px; letter-spacing:.08em; text-transform: uppercase; color: var(--muted); }
.featured-card .teams { font-size: 17px; font-weight: 700; margin: 8px 0; }

/* Section heading */
.sb-section-h { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 12px; }
.sb-section-h h2 { font-size: 17px; margin: 0; }

/* Team badge (logo or initials) */
.team-badge { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--secondary); border-radius: 6px; overflow: hidden; vertical-align: middle; }
.team-badge img { width: 100%; height: 100%; object-fit: contain; }
.team-badge .tb-init { font-weight: 800; color: var(--text-2); }
.mc-team-name { display: flex; align-items: center; gap: 8px; }

/* Match card */
.match-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; margin-bottom: 10px; }
.match-card .mc-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.match-card .mc-body { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.mc-teams a { display: block; }
.mc-team { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; padding: 3px 0; }
.mc-team .sc { color: var(--text); font-weight: 800; }
.mc-odds { display: flex; gap: 6px; }
.odds-btn { min-width: 62px; text-align: center; background: var(--secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 6px; cursor: pointer; transition: background .12s, border-color .12s; }
.odds-btn .lab { display: block; font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.odds-btn .val { font-size: 14px; font-weight: 700; color: var(--text); }
.odds-btn:hover { border-color: var(--blue); }
.odds-btn.picked { background: var(--blue); border-color: var(--blue); }
.odds-btn.picked .val, .odds-btn.picked .lab { color: #fff; }
.odds-btn.suspended { opacity: .5; cursor: not-allowed; }
.mc-more { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Betslip sidebar */
.betslip-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.betslip-head { padding: 13px 15px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.betslip-tabs { display: flex; border-bottom: 1px solid var(--border); }
.bs-tab { flex: 1; background: none; border: none; padding: 13px 10px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; justify-content: center; gap: 6px; }
.bs-tab.active { color: var(--text); border-bottom-color: var(--blue); }
.book-code { font-family: monospace; font-size: 18px; font-weight: 800; color: var(--blue-soft); letter-spacing: 1px; }
#betslip { padding: 12px 15px; }
.bs-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; margin-bottom: 9px; }
.bs-item.suspended { opacity: .6; }
.bs-item-head { display: flex; justify-content: space-between; align-items: center; }
.bs-sel { font-weight: 700; font-size: 13px; }
.bs-remove { background: none; border: none; color: var(--muted); font-size: 18px; line-height: 1; }
.bs-ev { font-size: 11px; color: var(--muted); margin: 3px 0; }
.bs-odds { font-size: 14px; font-weight: 700; color: var(--blue-soft); }
.bs-totals { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }
.bs-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; color: var(--text-2); }
.bs-stake { margin-bottom: 10px; }
.bs-stake label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bs-stake input { width: 100%; padding: 10px 12px; background: var(--secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 15px; }

/* Registration panel (guest) */
.reg-panel { background: linear-gradient(135deg,#0c1a34,#0b1220); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }

/* Popular leagues list */
.pop-list a { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.pop-list a:last-child { border-bottom: none; }

/* Footer */
.nw-footer { border-top: 1px solid var(--border); background: var(--secondary); padding: 30px 20px; margin-top: 30px; }
.nw-footer .cols { max-width: 1600px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
.nw-footer a { color: var(--muted); font-size: 13px; display: block; padding: 4px 0; }
.nw-footer a:hover { color: var(--text); }
.nw-footer .rg-note { max-width: 1600px; margin: 20px auto 0; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

/* Betslip drawer backdrop + close handle (mobile) */
.betslip-close { display: none; }
body.drawer-lock { overflow: hidden; }

@media (max-width: 1024px) {
    .sb-layout { grid-template-columns: 1fr; padding: 12px 14px 90px; }
    .sb-side { position: static; display: none; }
    .sb-side.drawer-open {
        display: block; position: fixed; inset: 0 0 0 0; z-index: 300;
        margin: 0; padding: 14px; overflow-y: auto; background: var(--secondary);
        -webkit-overflow-scrolling: touch;
    }
    .sb-side.drawer-open .betslip-close { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
    .nw-footer .cols { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Global mobile containment — prevent horizontal scrolling
   ============================================================ */
html, body { max-width: 100vw; overflow-x: hidden; }
.container, .sb-layout, .app-main, .account-layout { max-width: 100%; }
img, table, video, iframe { max-width: 100%; }
/* Flex rows must be allowed to shrink so long children don't force width */
.nw-header .container, .nw-header-right, .nw-logo, .mc-body, .mc-teams, .bet-meta { min-width: 0; }
.nw-logo { overflow: hidden; }
/* Horizontal strips scroll internally, never push the page wide */
.sport-nav, .league-nav, .sb-filters, .filter-tabs { max-width: 100%; -webkit-overflow-scrolling: touch; }
.data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 640px) {
    .sb-search { margin-left: 0; width: 100%; }
    .sb-search input { min-width: 0; width: 100%; }
    .sb-filters { gap: 5px; }
    .promo-strip, .featured-grid { grid-template-columns: 1fr; }
    .mc-body { grid-template-columns: 1fr; gap: 8px; }
    .mc-odds { justify-content: flex-start; }
    .odds-btn { flex: 1; min-width: 0; }
    .nw-footer .cols { grid-template-columns: 1fr 1fr; }
    .app-main { padding: 14px 12px 90px; }
}

/* ============================================================
   Header extras: hamburger, mobile menu, balance dropdown
   ============================================================ */
.nw-hamburger { display: none; background: none; border: none; color: var(--text); font-size: 22px; margin-right: 4px; cursor: pointer; }

.balance-menu { position: relative; }
.balance-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 8px); width: 220px; z-index: 120;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,.45);
}
.balance-menu.open .balance-dropdown { display: block; }
.bd-row { display: flex; justify-content: space-between; margin-bottom: 6px; }

/* Dashboard compact stats */
.dash-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dash-stats .ds { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.dash-stats .ds .l { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.dash-stats .ds .v { font-size: 20px; font-weight: 800; margin-top: 4px; }

/* Mobile slide-out menu */
.mobile-menu { display: none; position: fixed; inset: 0; z-index: 400; }
.mobile-menu.open { display: block; }
.mm-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.mm-panel {
    position: absolute; top: 0; left: 0; bottom: 0; width: 82%; max-width: 320px;
    background: var(--secondary); border-right: 1px solid var(--border); padding: 16px;
    overflow-y: auto; transform: translateX(-100%); transition: transform .22s ease; z-index: 1;
}
.mobile-menu.open .mm-panel { transform: translateX(0); }
.mm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.mm-balance { background: linear-gradient(135deg,#0c1a34,#0b1220); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.mm-nav a, .mm-nav form { display: block; }
.mm-nav a { padding: 11px 4px; font-size: 15px; font-weight: 600; color: var(--text-2); border-bottom: 1px solid var(--border); }
.mm-nav a:hover { color: var(--text); }
.mm-divider { height: 10px; }
body.menu-lock { overflow: hidden; }

@media (max-width: 900px) {
    .nw-hamburger { display: block; }
    .nw-nav { display: none; }
    .nw-hide-mobile { display: none !important; }
    .odds-toggle { display: none; }
    .nw-logo img { max-height: 28px !important; }
    .dash-stats { grid-template-columns: repeat(2, 1fr); }

    /* Tighten the header so it never overflows the viewport width */
    .nw-header .container { gap: 10px; padding: 0 12px; overflow: hidden; }
    .nw-header-right { gap: 6px; min-width: 0; }
    .nw-logo { font-size: 17px; }
    .balance-pill { padding: 7px 10px; font-size: 12px; white-space: nowrap; }
    /* Anchor the balance dropdown to the screen edge so it can't widen the page */
    .balance-dropdown { position: fixed; right: 10px; left: auto; top: calc(var(--header-h) + 6px); width: calc(100vw - 20px); max-width: 300px; }
}

/* ============================================================
   CONSOLIDATED RESPONSIVE RULES (authoritative, loaded last)
   Cleans up mobile layout across the whole app.
   ============================================================ */

/* Tablet and below */
@media (max-width: 1024px) {
    .sb-layout { grid-template-columns: 1fr; gap: 14px; padding: 12px 12px 92px; }
    .sb-side { display: none; }
    .sb-side.drawer-open {
        display: block; position: fixed; inset: 0; z-index: 350;
        margin: 0; padding: 14px; overflow-y: auto; background: var(--secondary);
        -webkit-overflow-scrolling: touch;
    }
    .sb-side.drawer-open .betslip-close { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
    .hero-carousel { height: 180px; }
    .hero-content h2 { font-size: 22px; }
    .hero-content { max-width: 85%; }
}

/* Phones */
@media (max-width: 768px) {
    :root { --header-h: 56px; }

    /* Header */
    .nw-hamburger { display: block; }
    .nw-nav, .odds-toggle, .nw-hide-mobile { display: none !important; }
    .nw-header .container { gap: 8px; padding: 0 12px; overflow: hidden; }
    .nw-header-right { gap: 6px; min-width: 0; margin-left: auto; }
    .nw-logo { font-size: 16px; }
    .nw-logo img { max-height: 26px !important; }
    .balance-pill { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
    .balance-dropdown { position: fixed; right: 8px; left: 8px; top: calc(var(--header-h) + 6px); width: auto; max-width: none; }

    /* Section headings */
    .sb-section-h { margin: 16px 0 10px; }
    .sb-section-h h2 { font-size: 15px; }

    /* Sport / league nav: compact, single row, swipeable */
    .sport-nav { gap: 6px; padding: 8px 0; }
    .sport-nav a { flex-direction: row; padding: 8px 12px; font-size: 12px; }
    .sport-nav a .ic { font-size: 14px; }
    .league-nav { gap: 6px; padding: 2px 0 10px; }

    /* Filters + search stack neatly */
    .sb-filters { gap: 6px; }
    .sb-search { margin-left: 0; width: 100%; order: 10; }
    .sb-search input { width: 100%; min-width: 0; }

    /* Promo + featured single column */
    .promo-strip, .featured-grid { grid-template-columns: 1fr; gap: 10px; }
    .featured-card .teams { font-size: 15px; }

    /* Match card: teams stacked above a full-width odds row */
    .match-card { padding: 12px; }
    .match-card .mc-body { grid-template-columns: 1fr; gap: 10px; }
    .mc-team { font-size: 14px; }
    .mc-odds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .odds-btn { min-width: 0; width: 100%; padding: 9px 4px; }

    /* Grids collapse */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .dash-stats { grid-template-columns: repeat(2, 1fr); }

    /* Account area: nav becomes a horizontal scroll strip */
    .account-layout { grid-template-columns: 1fr; gap: 14px; }
    .account-nav { display: flex; overflow-x: auto; position: static; border-radius: var(--radius); }
    .account-nav a { white-space: nowrap; border-left: none; border-bottom: 2px solid transparent; }
    .account-nav a.active { border-left: none; border-bottom-color: var(--blue); }

    /* Content padding */
    .app-main { padding: 14px 12px 92px; }
    .container { padding: 0 12px; }

    /* Tables scroll inside their wrapper */
    .data-table-wrap { overflow-x: auto; }
    .table { min-width: 560px; }

    /* Footer */
    .nw-footer .cols { grid-template-columns: 1fr 1fr; gap: 16px; }

    /* Auth: hide the side visual, full-width form */
    .auth-visual { display: none; }
    .auth-form-side { width: 100%; padding: 28px 18px; }

    /* Admin: sidebar off-canvas already handled; tighten content */
    .admin-content { padding: 14px 12px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr !important; }
}

/* Small phones */
@media (max-width: 400px) {
    .mc-odds { gap: 4px; }
    .odds-btn { padding: 8px 2px; }
    .odds-btn .val { font-size: 13px; }
    .dash-stats { grid-template-columns: 1fr 1fr; }
    .hero-content h2 { font-size: 19px; }
}
