/* QTB · Modern UI layer (loaded last). Restyles the shared building blocks of the whole app:
 * type, header, tab bar, panels, stat boxes, buttons, chips, badges, banners, tables.
 * Earlier theme files use !important heavily, so this layer does too, with `html body` for priority.
 * Design tokens first: change the look here. */
:root {
  --ui-bg: #0a0e14;
  --ui-surface: #111722;
  --ui-surface-2: #171f2c;
  --ui-line: #243042;
  --ui-line-soft: rgba(255, 255, 255, .06);
  --ui-text: #f6f8fb;
  --ui-text-2: #d3dce7;
  --ui-text-3: #a9b6c6;
  --ui-accent: #22e39b;          /* primary / "most likely" green */
  --ui-accent-ink: #04150d;
  --ui-blue: #5cc8ff;
  --ui-amber: #fbbf24;
  --ui-red: #ff6b78;
  --ui-radius: 14px;
  --ui-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- type ---------- */
html body, html body .pg, html body button, html body input, html body select, html body textarea,
html body .pt, html body .btn, html body .tab, html body .bdg, html body .lchip, html body .sbl, html body .sbv,
html body .ib, html body .wb, html body .eb, html body .ob, html body td, html body th, html body .hdr-stat,
html body .eng-chip, html body .rc-match, html body .rc-sub, html body .sec, html body .cbadge {
  font-family: var(--ui-font) !important;
  letter-spacing: normal !important;
  text-shadow: none !important;
}
html body { background: var(--ui-bg) !important; color: var(--ui-text) !important; font-feature-settings: "tnum" 1, "cv11" 1; }
html body .pg { background: var(--ui-bg) !important; }

/* ---------- header ---------- */
html body .hdr {
  position: sticky !important; top: 0; z-index: 40;
  background: rgba(10, 14, 20, .92) !important; backdrop-filter: blur(10px);
  border: 0 !important; border-bottom: 1px solid var(--ui-line-soft) !important;
  box-shadow: none !important; margin: 0 !important; border-radius: 0 !important;
}
html body .logo { font-family: var(--ui-font) !important; font-weight: 800 !important; font-size: 20px !important; letter-spacing: -.02em !important; color: var(--ui-text) !important; }
html body .hdr-stat, html body .eng-chip {
  background: var(--ui-surface) !important; border: 1px solid var(--ui-line) !important; border-radius: 999px !important;
  padding: 6px 12px !important; font-size: 12.5px !important; font-weight: 600 !important; color: var(--ui-text-2) !important;
}
html body .hdr-stat b, html body .hdr-nv { color: var(--ui-accent) !important; font-weight: 700 !important; }

/* ---------- tab bar: one row, scrolls sideways when narrow ---------- */
html body .tabs {
  background: var(--ui-bg) !important; border: 0 !important; border-bottom: 1px solid var(--ui-line-soft) !important;
  border-radius: 0 !important; margin: 0 !important; padding: 8px 14px !important; box-shadow: none !important;
  flex-wrap: nowrap !important; min-height: 0 !important;
}
html body .tabs-primary { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; gap: 4px !important; -webkit-overflow-scrolling: touch; }
html body .tabs-primary::-webkit-scrollbar { display: none; }
html body .tabs .tab, html body .tabs-primary > button {
  flex: none !important; width: auto !important; white-space: nowrap !important; margin: 0 !important;
  font-size: 14px !important; font-weight: 600 !important; padding: 9px 14px !important; min-height: 38px !important;
  border-radius: 10px !important; border: 1px solid transparent !important; background: transparent !important;
  color: var(--ui-text-2) !important; box-shadow: none !important; transform: none !important;
}
html body .tabs .tab:hover:not(.on) { background: var(--ui-surface) !important; color: var(--ui-text) !important; border-color: var(--ui-line) !important; }
html body .tabs .tab.on { background: var(--ui-accent) !important; color: var(--ui-accent-ink) !important; border-color: var(--ui-accent) !important; }
html body .tabs .tab .tn { background: rgba(255,255,255,.12) !important; color: inherit !important; border-radius: 999px !important; padding: 1px 7px !important; font-size: 11.5px !important; margin-left: 6px; }
html body .tabs .tab.on .tn { background: rgba(0,0,0,.18) !important; }
html body #qa-fab.docked, html body #qc-btn { border: 1px solid var(--ui-line) !important; background: var(--ui-surface) !important; color: var(--ui-text) !important; }
html body #qa-fab.docked:hover, html body #qc-btn:hover { border-color: var(--ui-accent) !important; }

/* ---------- panels ---------- */
html body .pnl {
  background: var(--ui-surface) !important; border: 1px solid var(--ui-line-soft) !important;
  border-radius: var(--ui-radius) !important; box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25) !important;
  margin-bottom: 14px !important; overflow: hidden;
}
html body .ph { background: transparent !important; border-bottom: 1px solid var(--ui-line-soft) !important; padding: 14px 18px !important; min-height: 0 !important; }
html body .pt { font-size: 16px !important; font-weight: 700 !important; text-transform: none !important; color: var(--ui-text) !important; }
html body .pb { padding: 16px 18px !important; }

/* ---------- stat boxes (Bankroll / ROI / Win rate / Pending) ---------- */
html body .sb {
  background: var(--ui-surface) !important; border: 1px solid var(--ui-line-soft) !important; border-radius: var(--ui-radius) !important;
  padding: 18px 16px !important; text-align: left !important; box-shadow: none !important; border-top-width: 1px !important;
}
html body .sbv { font-size: 28px !important; font-weight: 800 !important; color: var(--ui-text) !important; line-height: 1.1 !important; }
html body .sbl { font-size: 12px !important; font-weight: 600 !important; text-transform: uppercase !important; color: var(--ui-text-3) !important; margin-top: 6px !important; letter-spacing: .06em !important; }

/* ---------- buttons ---------- */
html body .btn {
  border-radius: 10px !important; min-height: 38px !important; font-size: 13.5px !important; font-weight: 650 !important;
  padding: 8px 16px !important; text-transform: none !important; box-shadow: none !important; transition: background .15s, border-color .15s, color .15s !important;
}
html body .btn.b-sm { min-height: 32px !important; font-size: 13px !important; padding: 6px 12px !important; }
html body .b-gold, html body .b-em { background: var(--ui-accent) !important; color: var(--ui-accent-ink) !important; border: 1px solid var(--ui-accent) !important; }
html body .b-gold:hover:not(:disabled), html body .b-em:hover:not(:disabled) { filter: brightness(1.08); }
html body .b-ghost { background: var(--ui-surface-2) !important; color: var(--ui-text) !important; border: 1px solid var(--ui-line) !important; }
html body .b-ghost:hover:not(:disabled) { border-color: var(--ui-accent) !important; color: var(--ui-text) !important; }

/* ---------- league chips ---------- */
html body .lchip {
  background: var(--ui-surface-2) !important; border: 1px solid var(--ui-line) !important; color: var(--ui-text-3) !important;
  border-radius: 999px !important; font-size: 12.5px !important; font-weight: 500 !important; padding: 5px 11px !important;
}
html body .lchip.on { background: rgba(34, 227, 155, .12) !important; border-color: rgba(34, 227, 155, .55) !important; color: var(--ui-text) !important; }

/* ---------- badges ---------- */
html body .bdg { border-radius: 6px !important; padding: 3px 8px !important; font-size: 11.5px !important; font-weight: 700 !important; }

/* ---------- banners ---------- */
html body .ib, html body .wb, html body .eb, html body .ob {
  border-radius: 12px !important; padding: 12px 16px !important; font-size: 13.5px !important; line-height: 1.55 !important;
  border: 1px solid var(--ui-line) !important; border-left-width: 4px !important; background: var(--ui-surface) !important; color: var(--ui-text-2) !important;
}
html body .ib { border-left-color: var(--ui-blue) !important; }
html body .wb { border-left-color: var(--ui-amber) !important; }
html body .eb { border-left-color: var(--ui-red) !important; }

/* ---------- tables ---------- */
html body table { border-collapse: separate !important; border-spacing: 0 !important; }
html body th { background: transparent !important; color: var(--ui-text-3) !important; font-size: 11.5px !important; font-weight: 700 !important; text-transform: uppercase !important; letter-spacing: .05em !important; padding: 10px 12px !important; border-bottom: 1px solid var(--ui-line) !important; }
html body td { padding: 11px 12px !important; border-bottom: 1px solid var(--ui-line-soft) !important; font-size: 13.5px !important; color: var(--ui-text) !important; }
html body tbody tr:hover td { background: rgba(255,255,255,.025) !important; }

/* ---------- inputs ---------- */
html body input:not([type=checkbox]):not([type=radio]), html body select, html body textarea {
  background: var(--ui-surface-2) !important; border: 1px solid var(--ui-line) !important; border-radius: 10px !important;
  color: var(--ui-text) !important; padding: 8px 12px !important; min-height: 38px;
}
html body input:focus, html body select:focus, html body textarea:focus { outline: none !important; border-color: var(--ui-accent) !important; box-shadow: 0 0 0 3px rgba(34,227,155,.18) !important; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  html body .hdr { height: 54px !important; padding: 0 12px !important; }
  html body .hdr-stat { display: none !important; }
  html body .tabs { padding: 6px 8px !important; }
  html body .tabs .tab, html body .tabs-primary > button { font-size: 13.5px !important; padding: 8px 12px !important; }
  html body .ph { padding: 12px 14px !important; }
  html body .pb { padding: 12px 14px !important; }
  html body .sbv { font-size: 24px !important; }
  html body td { padding: 9px 8px !important; font-size: 13px !important; }
}

/* while the Live tab is open, the app's own active tab must look inactive */
html body.lc-open .tabs .tab.on:not(#lc-btn) { background: transparent !important; border-color: transparent !important; color: var(--ui-text-2) !important; }
html body .tabs #lc-btn.tab.on { background: var(--ui-accent) !important; color: var(--ui-accent-ink) !important; border-color: var(--ui-accent) !important; }

/* ---------- QuantEdge logo ---------- */
html body .hdr .logo {
  display: inline-flex !important; flex-direction: row !important; flex-wrap: wrap !important; align-items: center !important; gap: 0 !important;
  font-family: var(--ui-font) !important; font-size: 25px !important; font-weight: 800 !important; letter-spacing: -.035em !important;
  line-height: 1 !important; text-transform: none !important; max-width: 290px;
}
html body .hdr .logo::before {
  content: "Q"; flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; margin-right: 10px; border-radius: 9px; font-size: 18px; font-weight: 900; letter-spacing: 0;
  color: #04150d; background: linear-gradient(135deg, #2ef2a8, #10b981); box-shadow: 0 0 18px rgba(34, 227, 155, .5);
}
html body .hdr .logo .qe-q { color: #ffffff !important; }
html body .hdr .logo .qe-e { color: #22e39b !important; text-shadow: 0 0 16px rgba(34, 227, 155, .6) !important; }
html body .hdr .logo::after {
  content: "SPORTS INTELLIGENCE ANALYTICS" !important; flex-basis: 100%; padding-left: 40px; margin-top: 3px;
  font: 600 9.5px/1.2 var(--ui-font) !important; letter-spacing: .18em !important; color: #8fa3b8 !important;
}
@media (max-width: 760px) {
  html body .hdr .logo { font-size: 21px !important; }
  html body .hdr .logo::before { width: 26px; height: 26px; font-size: 15px; margin-right: 8px; }
  html body .hdr .logo::after { display: none !important; }
}

/* ---------- Premium terminal finish ---------- */
:root {
  --ui-bg: #050607; --ui-surface: #111214; --ui-surface-2: #17191c; --ui-line: #26292e; --ui-line-soft: #1c1e22;
  --ui-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
}
html body, html body .pg { background: var(--ui-bg) !important; }
html body .hdr { background: rgba(5, 6, 7, .94) !important; }
/* numbers in monospace, labels small uppercase */
html body .sbv, html body .hdr-nv, html body .lc-score, html body .lc-tick, html body .lc-odd, html body .mkt-prob, html body .mkt-odds,
html body .co-labels b, html body .lc-nums, html body .lc-clock, html body .an-eff { font-family: var(--ui-mono) !important; font-variant-numeric: tabular-nums; }
html body .sbl, html body th, html body .mkt-card-title, html body .lc-ch, html body .an-group, html body .lc-league, html body .lc-chance small {
  text-transform: uppercase !important; letter-spacing: .07em !important; }
/* tabs as a segmented control */
html body .tabs-primary { background: #0c0d0f; border: 1px solid var(--ui-line); border-radius: 12px; padding: 4px !important; }
html body .tabs .tab.on, html body .tabs #lc-btn.tab.on {
  background: #1d2024 !important; color: #ffffff !important; border-color: #2c3036 !important; box-shadow: inset 0 -2px 0 #22e39b !important; }
html body .tabs .tab.on .tn { background: rgba(34, 227, 155, .18) !important; color: #22e39b !important; }
html body .lc-subtabs button.on, html body .lc-cats button.on { background: #1d2024 !important; color: #fff !important; border-color: #2c3036 !important; box-shadow: inset 0 -2px 0 #22e39b; }
/* live: green pulse, big monospace score, thicker 1X2 bar */
html body #lc-btn i, html body .lc-pill.live i { background: #22e39b !important; animation: qepulse 1.4s infinite !important; }
@keyframes qepulse { 0% { box-shadow: 0 0 0 0 rgba(34,227,155,.7) } 70% { box-shadow: 0 0 0 7px rgba(34,227,155,0) } 100% { box-shadow: 0 0 0 0 rgba(34,227,155,0) } }
html body .lc-pill.live { background: rgba(34, 227, 155, .12) !important; color: #22e39b !important; }
html body .tabs #lc-btn.tab:not(.on) { color: #22e39b !important; }
html body .lc-row.is-live { box-shadow: inset 3px 0 0 #22e39b !important; }
html body .lc-score { font-size: 26px !important; font-weight: 800 !important; color: #fff !important; text-shadow: 0 2px 10px rgba(0,0,0,.6); }
html body .lc-score.on { color: #22e39b !important; }
html body .lc-bar { height: 8px !important; border-radius: 4px !important; }
html body .lc-bar .h { background: #22e39b !important; } html body .lc-bar .d { background: #4a5059 !important; } html body .lc-bar .a { background: #ff6b78 !important; }
html body .lc-match { background: #0e0f11 !important; border-color: #202328 !important; transition: border-color .2s ease; }
html body .lc-match:hover { border-color: #3a3f46 !important; }
/* most likely: dark green with a soft glow */
html body .lc-chance.likely { background: #0a2214 !important; border-color: #22e39b !important; box-shadow: 0 0 14px rgba(34, 227, 155, .18) !important; }
/* cards and rows */
html body .mkt-card, html body .an-item, html body .lc-card { background: var(--ui-surface) !important; border-color: var(--ui-line) !important; }
html body .mkt-row { transition: background .15s ease; } html body .mkt-row:hover { background: #1a1c20; }
html body .btn, html body .tab, html body .pnl, html body .sb { transition: all .2s ease !important; }
