@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700;800&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* ── Reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Design tokens ───────────────────────────────────────────────────────── */

:root {
    /* Backgrounds */
    --bg:           #080c14;
    --surface:      #0d1220;
    --surface-2:    #131826;
    --border:       #1e2535;
    --border-dim:   rgba(255,255,255,0.04);

    /* Brand colours */
    --cyan:         #00e5ff;
    --cyan-10:      rgba(0,229,255,0.10);
    --cyan-15:      rgba(0,229,255,0.15);
    --cyan-20:      rgba(0,229,255,0.20);
    --cyan-25:      rgba(0,229,255,0.25);
    --gold:         #f5c842;
    --gold-8:       rgba(245,200,66,0.08);
    --gold-25:      rgba(245,200,66,0.25);
    --green:        #00c875;
    --red:          #ff4757;

    /* Text */
    --text:         #e8edf5;
    --text-sec:     #8a9bb8;
    --text-dim:     #6b7a99;
    --text-muted:   #4a5a78;
    --text-deep:    #2e3d55;

    /* Typography */
    --font-ui:      'Space Grotesk', system-ui, sans-serif;
    --font-hd:      'Barlow Condensed', system-ui, sans-serif;

    /* Radii */
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  12px;
    --r-xl:  16px;

    /* Transitions */
    --t-fast: 0.15s ease;
}

/* ── Base ────────────────────────────────────────────────────────────────── */

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
}

/* Mobile viewport — screens are 390px wide, centred on desktop */
.screen {
    width: 100%;
    max-width: 390px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    background: var(--bg);
}

/* ── Typography ──────────────────────────────────────────────────────────── */

.font-hd    { font-family: var(--font-hd); }
.font-ui    { font-family: var(--font-ui); }
.text       { color: var(--text); }
.text-sec   { color: var(--text-sec); }
.text-dim   { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-cyan  { color: var(--cyan); }
.text-gold  { color: var(--gold); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }

/* ── Page header ─────────────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-header-title {
    font-family: var(--font-hd);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.5px;
}

.page-header-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Bottom navigation ───────────────────────────────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 390px;
    display: flex;
    background: #0a0f1a;
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom, 16px);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 2px;
    background: none;
    border: none;
    gap: 3px;
    color: #3a4a62;
    font-family: var(--font-ui);
    font-size: 10px;
    letter-spacing: 0.3px;
    transition: color var(--t-fast);
    text-decoration: none;
}

.nav-item:hover  { color: var(--text-sec); }
.nav-item.active { color: var(--cyan); }

.nav-icon { font-size: 18px; line-height: 1; }

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
}

.card-cyan {
    background: linear-gradient(135deg, var(--cyan-10), rgba(0,229,255,0.03));
    border-color: var(--cyan-20);
}

/* ── Stat cells (used in dashboards) ─────────────────────────────────────── */

.stat-row {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.stat-cell {
    flex: 1;
    padding: 14px 8px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-right: 1px solid var(--border);
}

.stat-cell:last-child { border-right: none; }

.stat-value {
    font-family: var(--font-hd);
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Pills / badges ──────────────────────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-ui);
    letter-spacing: 0.3px;
}

.pill-cyan  { background: var(--cyan-10);  color: var(--cyan);  border: 1px solid var(--cyan-20); }
.pill-gold  { background: var(--gold-8);   color: var(--gold);  border: 1px solid var(--gold-25); }
.pill-green { background: rgba(0,200,117,0.1); color: var(--green); border: 1px solid rgba(0,200,117,0.25); }
.pill-red   { background: rgba(255,71,87,0.1); color: var(--red);   border: 1px solid rgba(255,71,87,0.3); }

.badge-live {
    background: rgba(255,71,87,0.15);
    border: 1px solid rgba(255,71,87,0.4);
    color: var(--red);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    font-family: var(--font-ui);
    letter-spacing: 0.5px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--r-md);
    padding: 15px 20px;
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 700;
    transition: opacity var(--t-fast);
    text-align: center;
}

.btn:hover:not(:disabled) { opacity: 0.85; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary   { background: var(--cyan); color: #080c14; }
.btn-secondary { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid rgba(255,255,255,0.1); }
.btn-sm        { padding: 7px 12px; font-size: 12px; border-radius: var(--r-sm); }

/* ── Forms ───────────────────────────────────────────────────────────────── */

.input {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    outline: none;
    width: 100%;
    transition: border-color var(--t-fast);
}

.input:focus { border-color: var(--cyan); }
.input::placeholder { color: var(--text-muted); }

/* ── Section headings ────────────────────────────────────────────────────── */

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px 6px;
}

.section-title {
    font-family: var(--font-hd);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ── Chat bubbles (AI setup, AI picks) ───────────────────────────────────── */

.bubble-ai {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px 12px 12px 12px;
    padding: 10px 13px;
    font-size: 13.5px;
    color: #c8d8f0;
    line-height: 1.5;
    max-width: 78%;
}

.bubble-user {
    background: var(--cyan-15);
    border: 1px solid var(--cyan-25);
    border-radius: 12px 4px 12px 12px;
    padding: 10px 13px;
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.5;
    max-width: 78%;
}

.ai-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cyan-15);
    border: 1px solid rgba(0,229,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--cyan);
    flex-shrink: 0;
}

/* ── Chat input bar ──────────────────────────────────────────────────────── */

.chat-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-input {
    flex: 1;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 14px;
    color: var(--text-muted);
    font-size: 14px;
}

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--cyan);
    border: none;
    color: #080c14;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Position tag (roster rows) ──────────────────────────────────────────── */

.pos-tag {
    width: 28px;
    height: 20px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    flex-shrink: 0;
}

/* ── Avatar circle ───────────────────────────────────────────────────────── */

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--cyan-10);
    border: 1px solid var(--cyan-20);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--cyan);
    font-family: var(--font-ui);
    flex-shrink: 0;
}

/* ── Flash messages ──────────────────────────────────────────────────────── */

.flash {
    padding: 12px 16px;
    border-radius: var(--r-md);
    font-size: 13px;
    font-weight: 500;
    margin: 10px 16px;
}

.flash-success { background: rgba(0,200,117,0.1); color: var(--green); border: 1px solid rgba(0,200,117,0.25); }
.flash-error   { background: rgba(255,71,87,0.1);  color: var(--red);   border: 1px solid rgba(255,71,87,0.25); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 0;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color var(--t-fast);
}

.tab:hover        { color: var(--text-sec); }
.tab.active       { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ── Grid / bg decoration ────────────────────────────────────────────────── */

.grid-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
    background-size: 32px 32px;
}

.glow-orb {
    position: absolute;
    top: -120px;
    right: -80px;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,229,255,0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.relative  { position: relative; }
.z1        { z-index: 1; }
.flex      { display: flex; }
.flex-col  { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.flex-1 { flex: 1; }
.ml-auto { margin-left: auto; }
.pb-nav  { padding-bottom: 90px; }
.p-16    { padding: 16px; }
.px-16   { padding-left: 16px; padding-right: 16px; }
.overflow-y-auto { overflow-y: auto; }
