/* Shared desktop and phone dashboard. Keep visibility owned by the data/tab code. */
:root {
    color-scheme: dark;
    --bg-dark: #0d1117;
    --bg-card: #161c25;
    --border-neon: #2a323e;
    --neon-cyan: #a5c9e8;
    --neon-green: #b8d98c;
    --neon-red: #f59a9a;
    --neon-yellow: #e4c68c;
    --neon-pink: #d5acd4;
    --text-main: #f0f1ed;
    --text-muted: #a0aab8;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
    --glow-cyan: none;
    --glow-green: none;
    --glow-red: none;
    --glow-yellow: none;
    --glow-pink: none;
    --accent: #00ff41;
    --accent-ink: #050b07;
    --surface-soft: #121821;
    --sidebar-width: 224px;
}

html { scroll-padding-top: 24px; }
body {
    padding: 0;
    background: var(--bg-dark);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: visible;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .6; }
a { color: var(--neon-cyan); }
::selection { background: #d4ef7c44; color: #fff; }
:focus-visible {
    outline: 2px solid var(--accent) !important;
    outline-offset: 3px;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111720; }
::-webkit-scrollbar-thumb { background: #3b4655; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #64738a; }

.dashboard-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 30px 16px 22px;
    background: #10151d;
    border-right: 1px solid #252d37;
    overflow-y: auto;
}
.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 10px 32px;
    text-decoration: none;
    color: var(--text-main);
}
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: 11px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: -1px;
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-name { display: block; font-size: 16px; font-weight: 650; letter-spacing: -.35px; line-height: 1.2; }
.brand-caption { display: block; color: #8e9aac; font-size: 11px; letter-spacing: 1.3px; margin-top: 4px; text-transform: uppercase; }
.sidebar-eyebrow, .nav-group-label {
    color: #7f8a9b;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.7px;
    text-transform: uppercase;
    padding: 0 14px;
    margin-bottom: 12px;
}
.dashboard-nav { display: flex; flex-direction: column; gap: 6px; }
.dashboard-nav .neon-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 45px;
    padding: 11px 14px !important;
    font-size: 13px !important;
    font-family: var(--font-sans);
    font-weight: 450;
    text-align: left;
    color: #a7b2c0 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 8px;
    text-shadow: none !important;
    box-shadow: none !important;
}
.dashboard-nav .neon-btn svg, .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.dashboard-nav .neon-btn:hover { background: #1d2530 !important; color: #f0f1ed !important; }
.dashboard-nav .neon-btn.active {
    color: var(--accent) !important;
    background: #d4ef7c10 !important;
    border-color: #d4ef7c18 !important;
    font-weight: 550;
}
.dashboard-nav .neon-btn.active::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.sidebar-footer {
    margin-top: auto;
    padding: 28px 10px 0;
    color: #7f8a9b;
    font-size: 11px;
}
.sidebar-footer p { margin-top: 16px; line-height: 1.7; }
.sidebar-footer-link, .sidebar-footer .neon-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 0 !important;
    color: #c8d1dd !important;
    border: 0 !important;
    background: transparent !important;
    text-decoration: none;
    font-size: 13px !important;
    font-weight: 450;
}
.sidebar-footer-link svg, .sidebar-footer .neon-btn svg { width: 18px; height: 18px; }
.sidebar-footer-link:hover { color: var(--accent) !important; }
.mobile-office-link, .mobile-section-select { display: none; }

.container {
    max-width: none;
    min-width: 0;
    margin: 0 0 0 var(--sidebar-width);
    padding: 32px 32px 48px;
    gap: 0;
}
.container > [id^="tab-content-"] { min-width: 0; }
.dashboard-header {
    padding: 0 0 22px;
    margin: 0;
    gap: 18px;
    border: 0;
}
.header-title-box { min-width: 0; }
.page-eyebrow { color: #7f8d9f; font-size: 9px; font-weight: 500; letter-spacing: 1.7px; margin-bottom: 12px; }
.header-title-box h1 {
    font-family: var(--font-sans);
    font-size: 32px;
    font-weight: 550;
    line-height: 1.2;
    letter-spacing: -.9px;
    text-transform: none;
    color: var(--text-main);
    background: none;
    -webkit-text-fill-color: currentColor;
}
.header-title-box h1 span { color: inherit; -webkit-text-fill-color: currentColor; }
.header-title-box p { font-family: var(--font-sans); font-size: 13px; margin-top: 8px; color: #9ba6b5; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.header-actions .neon-btn { font-size: 12px !important; min-height: 38px; padding: 8px 12px !important; }
.header-actions svg { width: 15px; height: 15px; }
.header-actions .export-primary { color: var(--accent-ink) !important; background: var(--accent) !important; border-color: var(--accent) !important; }
.header-actions .signout-btn { border-color: transparent !important; background: transparent !important; color: #a5afbd !important; }
.header-actions > button[onclick="signOutAdmin()"] { border-color: transparent !important; background: transparent !important; color: #a5afbd !important; }
.export-menu, .source-status { position: relative; }
.export-menu summary { list-style: none; cursor: pointer; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-menu > summary.neon-btn { color: var(--accent-ink) !important; background: var(--accent) !important; border-color: var(--accent) !important; }
.export-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 210px;
    padding: 8px;
    border: 1px solid #3c495a;
    border-radius: 10px;
    background: #1a232f;
    box-shadow: 0 12px 30px #0006;
}
.export-options .neon-btn { justify-content: flex-start; border-color: transparent !important; }
.export-menu:not([open]) .export-options { display: none; }
.dashboard-statusbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    padding: 13px 0 20px;
    margin: 0 0 22px;
    border-bottom: 1px solid #252d37;
    color: #98a5b5;
    font-size: 11px;
}
.status-meta { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; }
.sys-status {
    padding: 0;
    border: 0;
    background: transparent;
    font-family: var(--font-sans);
    font-size: 12px;
    color: #c4ceda;
}
.status-indicator { width: 6px; height: 6px; background: var(--accent); box-shadow: none; animation: none; }
#dashboard-connection[data-state="stale"] .status-indicator { background: var(--neon-yellow); }
#dashboard-connection[data-state="loading"] .status-indicator { background: #8d9db3; }
.source-status { margin-left: auto; }
.source-status > summary { cursor: pointer; min-height: 34px; display: flex; align-items: center; gap: 6px; color: #b6c2d2; list-style: none; }
.source-status > summary::after { content: '⌄'; color: #a1b18a; }
.source-status > summary::-webkit-details-marker { display: none; }
.source-status ul {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    min-width: 250px;
    max-width: min(360px, calc(100vw - 32px));
    list-style: none;
    padding: 12px 16px;
    border: 1px solid #3c495a;
    border-radius: 10px;
    background: #1a232f;
    box-shadow: 0 12px 30px #0006;
}
.source-status li { padding: 8px 0; border-bottom: 1px solid #ffffff09; line-height: 1.5; }
.source-status li:last-child { border-bottom: 0; }
.source-status li[data-state="stale"], .source-status li[data-state="error"] { color: #e4c68c; }
.dashboard-statusbar .status-retry { min-height: 32px; padding: 6px 10px !important; font-size: 10px !important; background: transparent !important; }
.dashboard-statusbar [data-state="error"], .dashboard-statusbar .status-error { color: var(--neon-red); }
.dashboard-statusbar [data-state="cached"], .dashboard-statusbar .status-cached { color: var(--neon-yellow); }
.dashboard-data-notice, .dashboard-notice {
    padding: 12px 16px;
    margin-bottom: 18px;
    background: #e4c68c0d;
    border: 1px solid #e4c68c35;
    border-radius: 9px;
    color: #e4c68c;
    font-size: 12px;
}
.dashboard-notice[hidden] { display: none; }
.section-range-label { font-size: 10px; border: 1px solid #354152; border-radius: 5px; padding: 3px 8px; color: #acbacb; margin-right: auto; white-space: nowrap; }
.section-note { padding: 13px 16px; background: #a5c9e80a; border: 1px solid #a5c9e829; border-radius: 8px; color: #aebfd3; font-size: 12px; line-height: 1.6; }

.time-range-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0;
    margin-bottom: 22px;
}
.time-range-bar > div { min-width: 0; flex-wrap: wrap; }
.time-range-bar > div:first-child { display: flex; align-items: center; gap: 5px; }
.time-range-bar > div > span, .time-range-bar label { font-family: var(--font-sans) !important; font-size: 11px !important; color: var(--text-muted) !important; }
.neon-btn, .time-range-btn, .bw-filter-btn, .tab-filter-btn, .action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    border-radius: 7px;
    padding: 7px 11px;
    border: 1px solid #343e4c !important;
    font-family: var(--font-sans) !important;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 500;
    color: #bac4d1 !important;
    background: #1b232e !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: background-color .16s, border-color .16s, color .16s;
    text-decoration: none;
    cursor: pointer;
}
.neon-btn:hover, .time-range-btn:hover, .bw-filter-btn:hover, .tab-filter-btn:hover, .action-btn:hover {
    background: #27313e !important;
    border-color: #536172 !important;
    color: #f0f1ed !important;
    box-shadow: none;
}
.neon-btn.active, .time-range-btn.active, .bw-filter-btn.active, .tab-filter-btn.active {
    background: #d4ef7c18 !important;
    color: var(--accent) !important;
    border-color: #d4ef7c55 !important;
    box-shadow: none;
}
.neon-btn:active { transform: none; }
button[onclick*="clear"], button[onclick*="delete"], button[onclick*="resetAll"] { color: #f3a6a6 !important; }
.bandwidth-time-selector { flex-wrap: wrap; max-width: 100%; border: 0 !important; background: #10161f !important; padding: 4px !important; }
.bw-filter-btn { min-height: 30px; padding: 6px 8px; font-size: 10px; border-color: transparent !important; background: transparent !important; }

.metrics-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
#tab-content-player-feedbacks .metrics-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.metric-card {
    min-width: 0;
    min-height: 144px;
    padding: 21px;
    border: 1px solid #29323e !important;
    background: #171e28;
    border-radius: 12px;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
    gap: 8px;
}
.metric-card::before { display: none; }
.metric-card::after { content: ''; position: absolute; right: 19px; top: 23px; width: 7px; height: 7px; border-radius: 50%; background: var(--card-color, #a5c9e8); opacity: .7; }
.metric-card:hover { transform: none; border-color: #475464 !important; box-shadow: none; }
.metric-card h3 { font-family: var(--font-sans); font-size: 12px; font-weight: 450; letter-spacing: .1px; text-transform: none; padding-right: 11px; margin: 0; color: #aeb9c8; }
.metric-value { font-family: var(--font-sans); font-size: clamp(24px, 2.55vw, 38px); font-weight: 500; letter-spacing: -.9px; flex-wrap: wrap; gap: 5px 8px; color: #f0f1ed !important; overflow-wrap: anywhere; }
.metric-value span { font-size: 10px !important; font-weight: 500; color: #8999ad !important; letter-spacing: .3px; }
.metric-subtitle { font-family: var(--font-sans); font-size: 11px; font-weight: 400 !important; line-height: 1.45; margin-top: 0; color: #96a5b8 !important; overflow-wrap: anywhere; }
#tab-content-analytics > .metrics-grid > .metric-card:first-child { background: var(--accent); border-color: var(--accent) !important; }
#tab-content-analytics > .metrics-grid > .metric-card:first-child h3 { color: #465631; }
#tab-content-analytics > .metrics-grid > .metric-card:first-child .metric-value { color: #1c2b12 !important; }
#tab-content-analytics > .metrics-grid > .metric-card:first-child .metric-value span,
#tab-content-analytics > .metrics-grid > .metric-card:first-child .metric-subtitle { color: #50623a !important; }
#tab-content-analytics > .metrics-grid > .metric-card:first-child::after { background: #526f29; }
.panel .metric-card { min-height: 126px; padding: 17px; background: #131a23; border-radius: 9px; }
.panel .metric-card::after { display: none; }
.panel .metric-value { font-size: 26px; }
#bandwidth-quota-val { font-size: 21px !important; letter-spacing: -.5px; }

.panel {
    min-width: 0;
    border: 1px solid #2a323e !important;
    border-radius: 12px;
    background: #161c25;
    box-shadow: none;
    backdrop-filter: none;
}
#tab-content-analytics > .panel { margin-top: 24px !important; }
.panel-header {
    padding: 19px 22px !important;
    min-width: 0;
    gap: 12px !important;
    background: transparent !important;
    border-bottom: 1px solid #29313d;
}
.panel-title {
    font-family: var(--font-sans);
    font-size: 15px !important;
    font-weight: 550;
    line-height: 1.45;
    text-transform: none;
    letter-spacing: -.15px;
    color: #e6eae9 !important;
    text-shadow: none !important;
    white-space: normal !important;
    min-width: 0;
    flex-wrap: wrap;
}
.panel-title .section-icon { width: 18px; height: 18px; color: #a1b18a; }
.panel-header-actions { flex-wrap: wrap; min-width: 0; gap: 8px; }
.panel-header > div { min-width: 0; }
.panel-body { min-width: 0; padding: 20px 22px !important; overscroll-behavior-x: contain; }
.panel-body > div[style*="overflow-x: auto"] { max-width: 100%; overscroll-behavior-x: contain; }
.workspace-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: 24px; min-width: 0; }
.workspace-grid > div { min-width: 0; }
.workspace-grid > div > .panel + .panel { margin-top: 24px; }
.funnel-metrics-row { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.funnel-pill { min-width: 0 !important; background: #1c2430; border: 1px solid #2c3542 !important; border-radius: 8px; padding: 13px 14px; gap: 5px; }
.funnel-pill-label { font-family: var(--font-sans); color: #aebaca !important; font-size: 10px; line-height: 1.45; letter-spacing: .1px; text-transform: none; }
.funnel-pill-val { font-family: var(--font-sans); color: #ecf0e9; font-size: 25px; font-weight: 500; letter-spacing: -.7px; }
.analytics-charts-grid { gap: 16px; }
.chart-box { background: #111821; border-color: #2a3442; border-radius: 9px; padding: 16px; }
.chart-box-header { flex-wrap: wrap; gap: 8px; font-family: var(--font-sans); font-size: 12px; color: #bbc5d1; margin-bottom: 14px; }
.chart-box-header > div { flex-wrap: wrap; }
.chart-box canvas { max-width: 100%; }
.chart-box > div:has(> canvas) { height: 220px !important; }
.activity-feed-stream { height: 200px; max-height: 200px; gap: 0; padding-right: 4px; }
.feed-row { flex-wrap: wrap; padding: 9px 4px; background: transparent; border: 0; border-bottom: 1px solid #26313f; border-radius: 0; font-family: var(--font-sans); white-space: normal; gap: 5px; }
.feed-row:hover { background: #1b2431; }
.feed-dot { box-shadow: none !important; flex-shrink: 0; }
.feed-desc { font-family: var(--font-sans); white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; flex: 1 1 120px; }
.feed-tag { font-size: 9px; letter-spacing: 0; }
.feed-source { max-width: 100%; overflow-wrap: anywhere; color: #a9c1d3; }
.feed-time { font-size: 10px; }
.badge, .feed-tag, .feed-device {
    font-family: var(--font-sans);
    font-weight: 500;
    text-shadow: none;
    box-shadow: none;
    animation: none;
    border-radius: 5px;
    line-height: 1.5;
    letter-spacing: .1px;
}
.badge { font-size: 10px !important; padding: 3px 7px !important; white-space: normal; }
.badge-live, .badge-online, .badge-sim, .badge-user-auth, .feed-tag.tag-auth { color: #bbd99b !important; background: #b8d98c12 !important; border-color: #b8d98c38 !important; }
.badge-trade, .badge-tutorial, .feed-tag.tag-tut { color: #e4c68c !important; background: #e4c68c12 !important; border-color: #e4c68c38 !important; }
.badge-guest, .feed-tag.tag-play, .feed-device.device-desktop { color: #a5c9e8 !important; background: #a5c9e812 !important; border-color: #a5c9e838 !important; }
.badge-pageview, .feed-tag.tag-view { color: #c7b4df !important; background: #c7b4df12 !important; border-color: #c7b4df38 !important; }
.badge-guest-battle, .feed-tag.tag-fight { color: #f1a7a7 !important; background: #f1a7a712 !important; border-color: #f1a7a738 !important; }
.currency-icon { box-shadow: none !important; text-shadow: none !important; }

table { font-size: 12px; }
.table-container { min-width: 0; max-width: 100%; background: #161c25; border: 1px solid #2a323e; border-radius: 12px; overflow: hidden; }
.table-header { padding: 18px 20px; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid #2a323e; }
.table-header h2 { font-size: 15px; font-weight: 550; line-height: 1.5; }
.table-header > div { flex-wrap: wrap; min-width: 0; }
.table-container > .dashboard-table-scroll { padding: 8px 20px 16px; }
th { padding: 11px 12px; font-family: var(--font-sans); font-size: 10px; letter-spacing: .45px; font-weight: 500; color: #97a7bb; border-bottom: 1px solid #34404f; white-space: nowrap; }
td { padding: 14px 12px; font-family: var(--font-sans); border-bottom-color: #ffffff08; line-height: 1.45; }
th.sort-active, th:hover { color: var(--accent); }
tr:hover td, .clickable-row:hover td { background: #202937; border-bottom-color: #354154; }
.clickable-row:hover td { color: inherit; }
.table-scroll-hint { color: #9aaabd; font-size: 11px; line-height: 1.5; margin-bottom: 10px; }
.table-scroll, .dashboard-table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.dashboard-table-scroll table { min-width: 560px; }
.search-bar, .neon-select, .config-input, .auth-input,
.container textarea, .drawer input:not([type="checkbox"]):not([type="radio"]), .drawer select, .drawer textarea {
    background: #111821 !important;
    color: #e6eae9 !important;
    border: 1px solid #354153 !important;
    border-radius: 7px !important;
    min-height: 36px;
    max-width: 100%;
    font-family: var(--font-sans) !important;
    font-size: 12px;
    box-shadow: none !important;
}
.search-bar { width: 190px; }
.search-bar:focus { width: 190px; }
.search-bar::placeholder, textarea::placeholder, input::placeholder { color: #8291a4; opacity: 1; }
.neon-select { padding-right: 25px !important; }
.config-input { padding-left: 27px; }
.container textarea, .drawer textarea { padding: 10px; resize: vertical; }
.empty-state { font-family: var(--font-sans) !important; font-size: 12px; background: #111821; color: #a5b3c5 !important; border: 1px dashed #354153; line-height: 1.6; }

.bandwidth-details-grid, .bandwidth-breakdown-grid { min-width: 0; }
.bandwidth-details-grid > div { min-width: 0; }
.bandwidth-details-grid > div > div[style*="display: flex"] { gap: 8px; flex-wrap: wrap; }
.bandwidth-details-grid [style*="justify-content: space-between"] { gap: 8px; flex-wrap: wrap; }
.bandwidth-details-grid [style*="font-family"], .mkt-card-box [style*="font-family"] { font-family: var(--font-sans) !important; }
#bandwidth-meter-bar { background: #e4c68c !important; }
#bw-fs-reads-bar, #bw-fs-writes-bar { background: #b8d98c !important; }
#bw-daily-table-container { overflow-x: auto !important; }
#bw-daily-table-container table { min-width: 780px; }
#mkt-channels-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.mkt-card-box .panel-body { padding: 18px !important; overflow-wrap: anywhere; }
.mkt-card-box .panel-body > div[style*="grid-template-columns"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.mkt-card-box .panel-body > div[style*="grid-template-columns"] > div { padding: 12px !important; border-color: #303c4b !important; background: #1c2531 !important; }
#mkt-matrix-panel table { min-width: 920px; }
#mkt-stories-matrix-panel table { min-width: 720px; }
.config-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 245px), 1fr)) !important; gap: 16px !important; }
.config-card { background: #121922; border-color: #303b49; border-radius: 9px; padding: 20px; backdrop-filter: none; }
.config-card:hover { transform: none; box-shadow: none; border-color: #5b6b80; }
.config-coin-badge { font-family: var(--font-sans); text-shadow: none; }
.config-input-group label { font-family: var(--font-sans); text-transform: none; font-size: 12px; letter-spacing: 0; }
.config-input-prefix { font-family: var(--font-sans); }

.drawer {
    background: #121922;
    border-left: 1px solid #3a4655;
    height: 100vh;
    height: 100dvh;
    padding: 26px;
    box-shadow: -15px 0 70px #0007;
    overscroll-behavior-y: contain;
}
.drawer-header { gap: 10px; }
.drawer-header h2 { font-family: var(--font-sans); font-size: 22px; font-weight: 550; letter-spacing: -.4px; color: #f0f1ed; text-transform: none; }
.close-btn { display: grid; place-items: center; min-width: 42px; min-height: 42px; border: 1px solid #344253; border-radius: 8px; line-height: 1; }
.drawer-section-title { font-family: var(--font-sans); font-size: 13px; font-weight: 500; text-transform: none; letter-spacing: 0; color: #c0cad7; border-left-width: 2px; border-left-color: var(--accent); }
.drawer [style*="font-family"] { font-family: var(--font-sans) !important; }
.drawer [style*="display: grid"] > div { min-width: 0; }
.stats-grid-drawer { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-drawer-card { background: #1b2430; border-color: #344153; border-radius: 8px; }
.stat-drawer-card .label { font-family: var(--font-sans); text-transform: none; letter-spacing: 0; font-size: 11px; }
.stat-drawer-card .val { font-family: var(--font-sans); font-weight: 500; overflow-wrap: anywhere; }
.drawer > div { min-width: 0; flex-shrink: 0; }
.drawer table { min-width: 440px; }
.drawer [id$="username"], .drawer [id$="email"] { overflow-wrap: anywhere; }

.loading-cover { font-family: var(--font-sans); color: #cdd6c0; font-size: 15px; gap: 20px; padding: 24px; text-align: center; }
.spinner { border: 3px solid rgba(0, 255, 65, 0.15); border-left-color: #00ff41; box-shadow: 0 0 10px rgba(0, 255, 65, 0.3); width: 30px; height: 30px; }
#auth-gate-overlay { background: rgba(3, 7, 18, 0.96); overflow-y: auto; padding: 24px 0; backdrop-filter: blur(12px); }
.auth-gate-box { width: calc(100% - 32px); max-width: 420px; padding: 36px 30px; border: 1px solid rgba(0, 255, 65, 0.3); border-radius: 16px; background: #0c1017; box-shadow: 0 24px 70px #0004, 0 0 25px rgba(0, 255, 65, 0.08); }
.auth-gate-box::before { content: 'CRYPTO BRAWLER · ADMIN'; position: static; display: block; background: none; color: #00ff41; font-family: var(--font-sans); font-weight: 600; font-size: 11px; letter-spacing: 2px; padding: 0; margin-bottom: 26px; text-shadow: 0 0 10px rgba(0, 255, 65, 0.4); }
.auth-gate-box h2 { font-family: var(--font-sans); font-size: 27px; font-weight: 700; text-transform: none; color: #f8fafc; letter-spacing: -.6px; }
.auth-gate-box p { font-size: 13px; color: #94a3b8; line-height: 1.6; }
.auth-input { min-height: 46px; text-align: left; padding: 12px 14px; font-size: 14px; background: #050811; border: 1px solid #1e293b; color: #fff; border-radius: 8px; }
.auth-input:focus { border-color: #00ff41; box-shadow: 0 0 10px rgba(0, 255, 65, 0.25); outline: none; }
.auth-btn-row { min-height: 46px; border-radius: 8px; font-family: var(--font-sans); font-size: 14px; font-weight: 600; text-transform: none; border: 1px solid #334155 !important; background: #1a2230 !important; color: #f8fafc !important; box-shadow: none !important; }
.auth-btn-row[onclick="submitAdminAuth()"] { background: #00ff41 !important; border-color: #00ff41 !important; color: #030712 !important; font-weight: 700 !important; box-shadow: 0 0 16px rgba(0, 255, 65, 0.35) !important; }
.auth-btn-row[onclick="submitAdminAuth()"]:hover { filter: brightness(1.12); box-shadow: 0 0 24px rgba(0, 255, 65, 0.5) !important; }
.auth-btn-row[onclick="signInAdminGoogle()"] { background: #111827 !important; border: 1px solid #374151 !important; color: #f3f4f6 !important; }
.auth-btn-row[onclick="signInAdminGoogle()"]:hover { background: #1f2937 !important; border-color: #4b5563 !important; }
.auth-error { font-family: var(--font-sans); border-radius: 7px; }

/* Existing dynamic templates use inline semantic colors; normalize their intensity. */
.container [style*="color: #00ff41" i], .drawer [style*="color: #00ff41" i] { color: #b8d98c !important; }
.container [style*="color: #ffcc00" i], .drawer [style*="color: #ffcc00" i], .container [style*="color: #f0b90b" i] { color: #e4c68c !important; }
.container [style*="color: #00f0ff" i], .container [style*="color: #00e5ff" i], .container [style*="color: #38bdf8" i] { color: #a5c9e8 !important; }
.container [style*="color: #ff3131" i], .container [style*="color: #fe2c55" i] { color: #f59a9a !important; }
.container [style*="color: #a855f7" i], .container [style*="color: #d8b4fe" i] { color: #c7b4df !important; }
.container [style*="text-shadow"], .drawer [style*="text-shadow"] { text-shadow: none !important; }

@media (min-width: 1600px) {
    .container { padding-left: 42px; padding-right: 42px; }
    .metric-card { min-height: 156px; }
}
@media (max-width: 1250px) {
    .container { padding: 28px 24px 40px; }
    .metrics-grid, .panel .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    #tab-content-player-feedbacks .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .metric-value { font-size: 32px; }
    .workspace-grid { grid-template-columns: minmax(0, 1fr); }
    .funnel-metrics-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .analytics-charts-grid { grid-template-columns: minmax(0, 1fr); }
    #mkt-channels-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .bandwidth-details-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 980px) and (min-width: 761px) {
    :root { --sidebar-width: 198px; }
    .dashboard-sidebar { padding-inline: 12px; }
    .dashboard-brand { padding-inline: 4px; gap: 8px; }
    .brand-name { font-size: 14px; }
    .brand-caption { font-size: 9px; }
    .dashboard-nav .neon-btn { font-size: 12px !important; padding-inline: 11px !important; gap: 9px; }
    .container { padding-inline: 20px; }
    .header-title-box h1 { font-size: 28px; }
    .header-actions { width: 100%; }
    .funnel-metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #mkt-channels-grid { grid-template-columns: minmax(0, 1fr) !important; }
    #tab-content-player-feedbacks .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
    html { scroll-padding-top: 132px; }
    .dashboard-sidebar {
        inset: 0 0 auto;
        width: 100%;
        height: 64px;
        padding: 0 18px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        border: 0;
        border-bottom: 1px solid #2a323e;
        overflow: visible;
    }
    .dashboard-brand { padding: 0; gap: 10px; }
    .brand-mark { width: 33px; height: 33px; flex-basis: 33px; border-radius: 9px; }
    .brand-name { font-size: 15px; }
    .brand-caption { font-size: 9px; margin-top: 3px; letter-spacing: 1.2px; }
    .dashboard-nav, .sidebar-eyebrow, .nav-group-label { display: none; }
    .sidebar-footer { display: none; }
    .sidebar-footer p, .sidebar-footer .sidebar-caption, .sidebar-footer .sidebar-blurb { display: none; }
    .sidebar-footer-link, .sidebar-footer .neon-btn { font-size: 11px !important; gap: 6px; padding: 8px !important; }
    .sidebar-footer-link svg { width: 15px; height: 15px; }
    .mobile-office-link { display: inline-flex; align-items: center; gap: 6px; min-height: 42px; color: #c1ccdc; text-decoration: none; font-size: 11px; }
    .mobile-office-link svg { width: 16px; height: 16px; }
    .container { margin: 64px 0 0; padding: 23px 16px 36px; }
    .dashboard-header { align-items: flex-start; padding-bottom: 14px; gap: 16px; }
    .header-title-box h1 { font-size: 29px; letter-spacing: -.6px; }
    .header-title-box p { margin-top: 6px; font-size: 12px; }
    .header-actions { gap: 6px; width: 100%; }
    .header-actions .neon-btn { min-height: 40px; font-size: 11px !important; padding: 9px 11px !important; }
    .header-actions .signout-btn { margin-left: auto; }
    .header-actions > button[onclick="signOutAdmin()"] { margin-left: auto; }
    .export-options { right: auto; left: 0; }
    .dashboard-statusbar { padding: 0 0 17px; margin-bottom: 0; font-size: 10px; gap: 8px 12px; }
    .sys-status { font-size: 11px; }
    .source-status { margin-left: 0; }
    .source-status > summary { min-height: 42px; font-size: 11px; }
    .source-status ul { right: auto; left: 0; }
    .dashboard-statusbar .status-retry { min-height: 42px; margin-left: auto; }
    .mobile-section-select {
        display: flex;
        align-items: center;
        gap: 10px;
        position: sticky;
        top: 64px;
        z-index: 40;
        padding: 12px 0;
        margin: 0 0 12px;
        background: var(--bg-dark);
        box-shadow: 0 6px 0 var(--bg-dark);
    }
    .mobile-section-select label { font-size: 11px; color: #9eacbe; }
    #dashboard-section-select { flex: 1; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #3e4b5e; border-radius: 8px; background: #1a232f; color: #e5edda; font-size: 14px; font-family: var(--font-sans); }
    .time-range-bar { margin-bottom: 16px; gap: 10px; }
    .time-range-bar > div { gap: 6px; }
    .time-range-bar > div:first-child { width: 100%; }
    .time-range-btn { flex: 1 0 auto; }
    .neon-btn, .time-range-btn, .tab-filter-btn, .action-btn { min-height: 42px; padding: 9px 10px !important; font-size: 11px !important; }
    .bw-filter-btn { min-height: 40px; font-size: 10px; padding: 7px 8px; flex: 1 0 auto; }
    .search-bar, .neon-select, .config-input { min-height: 42px !important; height: auto !important; font-size: 16px !important; }
    .neon-select { padding: 8px 26px 8px 10px !important; }
    .search-bar, .search-bar:focus { width: 100%; }
    .panel-header-actions .search-bar { flex: 1 1 160px; }
    .panel-header-actions .neon-select { flex: 1 1 150px; }
    .panel-header-actions { width: 100%; }
    .metrics-grid, .panel .metrics-grid, #tab-content-player-feedbacks .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px; }
    .metric-card { min-height: 136px; padding: 16px 13px; border-radius: 10px; gap: 8px; }
    .metric-card::after { right: 12px; top: 20px; width: 5px; height: 5px; }
    .metric-card h3 { font-size: 11px; line-height: 1.4; }
    .metric-value { font-size: 28px; gap: 4px; letter-spacing: -.8px; }
    .metric-value span { font-size: 8px !important; }
    .metric-subtitle { font-size: 10px; line-height: 1.5; }
    .panel .metric-card { min-height: 128px; padding: 13px 11px; }
    .panel .metric-value { font-size: 25px !important; }
    #bandwidth-quota-val { font-size: 19px !important; }
    .panel-header { padding: 16px !important; gap: 10px !important; align-items: flex-start; }
    .panel-title { font-size: 14px !important; }
    .panel-body { padding: 16px !important; }
    #tab-content-analytics > .panel { margin-top: 18px !important; }
    .workspace-grid { gap: 18px; }
    .workspace-grid > div > .panel + .panel { margin-top: 18px; }
    .funnel-metrics-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
    .funnel-pill { padding: 12px; }
    .funnel-pill:last-child:nth-child(odd) { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
    #funnel-registered-breakdown { grid-column: 1 / -1; justify-content: flex-start !important; flex-wrap: wrap; }
    .funnel-pill-label { font-size: 10px; }
    .funnel-pill-val { font-size: 24px; }
    .analytics-charts-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .chart-box { padding: 13px 11px; }
    .chart-box-header { font-size: 11px; gap: 9px; }
    .chart-box-header > div { width: 100%; gap: 5px !important; }
    .chart-box-header .tab-filter-btn { flex: 1 0 auto; }
    .activity-feed-stream { height: 235px; max-height: 235px; }
    .feed-row { gap: 5px; padding-block: 10px; }
    .feed-desc { flex-basis: calc(100% - 100px); }
    .feed-source { margin-left: 10px; }
    table { font-size: 12px; }
    .panel-body > table { min-width: 560px; }
    th { font-size: 10px; padding: 11px 10px; }
    td { padding: 13px 10px; }
    .bandwidth-details-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; }
    .bandwidth-details-grid > div { padding: 14px !important; }
    .bandwidth-breakdown-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .bandwidth-details-grid [style*="display: flex"] > span { overflow-wrap: anywhere; }
    #mkt-channels-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 16px !important; }
    #mkt-stories-matrix-panel .panel-header > div { flex-wrap: wrap; }
    .mkt-card-box .panel-body { padding: 16px !important; }
    #tab-content-marketing > div[style*="display: flex"] { flex-wrap: wrap; }
    #tab-content-multicharts .panel-header > div, #tab-content-tournaments .panel-header > div { flex-wrap: wrap; max-width: 100%; gap: 8px; }
    #multicharts-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .drawer { max-width: 100%; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); gap: 18px; }
    .drawer-header h2 { font-size: 20px; }
    .drawer input:not([type="checkbox"]):not([type="radio"]), .drawer select, .drawer textarea { min-height: 42px; font-size: 16px !important; }
    .drawer [style*="display: flex"] { flex-wrap: wrap; }
    .drawer [style*="grid-template-columns: repeat(4"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .stats-grid-drawer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .drawer-section-title { font-size: 13px; }
    .auth-gate-box { padding: 30px 22px; }
    .auth-input { font-size: 16px; }
}
@media (max-width: 360px) {
    .container { padding-inline: 12px; }
    .dashboard-sidebar { padding-inline: 12px; }
    .brand-name { font-size: 13px; }
    .sidebar-footer-link, .sidebar-footer .neon-btn { font-size: 10px !important; padding-inline: 4px !important; }
    .metrics-grid, .panel .metrics-grid, #tab-content-player-feedbacks .metrics-grid { grid-template-columns: minmax(0, 1fr) !important; }
    .metric-card { min-height: 124px; padding: 17px; }
    .metric-value { font-size: 31px; }
    .metric-card h3 { font-size: 12px; }
    .metric-subtitle { font-size: 11px; }
    .funnel-metrics-row { grid-template-columns: minmax(0, 1fr); }
    .funnel-pill { flex-direction: row; align-items: center; justify-content: space-between; }
    .panel-header, .panel-body { padding: 13px !important; }
    .header-actions .neon-btn { padding-inline: 9px !important; }
}
/* Keep the first metrics close to the top on phones, with full-size controls. */
@media (max-width: 760px) {
    .container { padding-top: 20px; }
    .page-eyebrow { display: none; }
    .dashboard-header { position: relative; display: block; padding-bottom: 4px; }
    .header-title-box h1 { min-height: 44px; display: flex; align-items: center; padding-right: 126px; }
    .header-title-box p { margin-top: 3px; font-size: 11px; line-height: 1.5; }
    .header-actions { position: absolute; right: 0; top: 0; width: auto; }
    .header-actions .neon-btn { min-height: 44px; }
    .header-actions > button[onclick="signOutAdmin()"] {
        position: fixed;
        top: 10px;
        right: 16px;
        z-index: 51;
        min-height: 44px;
        margin: 0;
        color: #c0cad7 !important;
    }
    .export-options { left: auto; right: 0; }
    .mobile-section-select { padding-block: 8px; margin-bottom: 6px; gap: 8px; }
    .mobile-section-select label { font-size: 10px; }
    .dashboard-statusbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 0 10px;
        padding: 3px 0 8px;
        margin-bottom: 12px;
    }
    .dashboard-statusbar .sys-status { grid-column: 1 / -1; min-height: 20px; }
    .dashboard-statusbar .status-meta { font-size: 9px; line-height: 1.4; }
    .source-status > summary { min-height: 44px; font-size: 10px; }
    .source-status ul { right: -98px; left: auto; }
    .dashboard-statusbar .status-retry { min-height: 44px; margin-left: 0; padding-inline: 8px !important; }
    .time-range-bar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: end;
        gap: 6px;
        margin-bottom: 16px;
    }
    .time-range-bar > div:first-child { display: contents !important; }
    .time-range-bar > div:first-child > span {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .time-range-bar .time-range-btn { min-height: 44px; padding: 9px 6px !important; font-size: 10px !important; }
    .time-range-bar > div:last-child {
        display: flex;
        flex-direction: column;
        align-items: stretch !important;
        gap: 2px !important;
        width: 100%;
        margin-left: 0 !important;
    }
    .time-range-bar > div:last-child label { font-size: 8px !important; line-height: 1.25; white-space: nowrap; text-transform: none !important; padding-left: 2px; }
    #default-time-range-select { width: 100%; min-width: 0; min-height: 44px !important; padding: 7px 16px 7px 5px !important; }
    .metric-card { min-height: 120px; gap: 5px; }
    .panel .metric-card { min-height: 120px; }
    .neon-btn, .tab-filter-btn, .action-btn, .bw-filter-btn { min-height: 44px; }
}
@media (max-width: 360px) {
    .header-title-box h1 { font-size: 25px; padding-right: 116px; }
    .header-actions .export-menu > summary { font-size: 10px !important; padding-inline: 9px !important; }
    .header-actions > button[onclick="signOutAdmin()"] { right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Keep account totals first in the familiar overview. */
#tab-content-analytics > .overview-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.color-registered { --card-color: #c8df8e; }
#metric-registered .registration-split { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 500 11px/1.5 var(--font-sans); color: #465631; margin-top: 6px; }
#metric-registered .registration-split span { color: inherit !important; font: inherit; }
@media (max-width: 1200px) {
    #tab-content-analytics > .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .overview-metrics .color-registered { grid-column: 1 / -1; min-height: 120px; }
}
@media (max-width: 760px) {
    #tab-content-analytics > .overview-metrics { gap: 10px; }
    #tab-content-analytics > .overview-metrics .metric-value { font-size: 28px; }
}
#tab-content-analytics > .overview-metrics { margin-bottom: 18px; }
#metric-registered .registration-split { flex-basis: 100%; font-size: 12px; }
