/* ===================================================================
 * BetExchange — Template fedele al layout Betfair Exchange
 * =================================================================== */

:root {
  /* Exfair24 brand */
  --brand-dark:   #0B3B1F;
  --brand-green:  #41C950;
  --brand-yellow: #F4CF14;

  /* Header */
  --hdr-bg: #061A12;
  --hdr-border: #0a2417;
  --hdr-text: #b8cfc0;
  --hdr-text-active: #ffffff;
  --tab-active-bg: #0B3B1F;

  /* Sport nav */
  --nav-bg: #0B3B1F;
  --nav-text: #c0d9c8;
  --nav-active: #ffffff;
  --nav-border: #164d2a;

  /* Page */
  --page-bg: #f0f0f0;
  --white: #ffffff;
  --border: #cccccc;
  --border-light: #e5e5e5;
  --bg-light: #f5f5f5;
  --bg-light2: #ececec;

  /* Text */
  --text-0: #1a1a1a;
  --text-1: #333333;
  --text-2: #666666;
  --text-3: #999999;
  --link: #0059b3;

  /* Back (blue) */
  --back-1: #a6d8ff;      /* best — brightest */
  --back-2: #c8e4f9;
  --back-3: #d8edf8;
  --back-hover: #87c9ff;
  --back-all: #4c87c4;

  /* Lay (pink) */
  --lay-1:  #fac9d4;
  --lay-2:  #fcd8e0;
  --lay-3:  #fde6ea;
  --lay-hover: #f5b6c5;
  --lay-all: #d98096;

  /* Status */
  --red:    #d0021b;
  --green:  #2e7d32;
  --orange: #f5a623;

  /* Sidebar */
  --sb-bg: #ffffff;
  --sb-width: 195px;

  /* Betslip */
  --bsp-width: 260px;

  --shadow: 0 1px 3px rgba(0,0,0,.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font: 12px/1.4 Arial, Helvetica, sans-serif;
  background: var(--page-bg);
  color: var(--text-0);
  -webkit-font-smoothing: antialiased;
}

/* ── TOP BAR ────────────────────────────────────────────── */
.topbar {
  height: 48px;
  background: var(--hdr-bg);
  display: flex; align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--hdr-border);
  position: relative; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 0; flex: 0 0 auto; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Brand logo on a white plate (always legible on any header colour) */
.brand { display: flex; align-items: center; padding-right: 18px; }
.brand-plate {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ffffff;
  padding: 6px 14px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.28);
  transition: box-shadow .15s, transform .05s;
}
.brand:hover .brand-plate { box-shadow: 0 3px 14px rgba(65,201,80,.35); }
.brand:active .brand-plate { transform: translateY(1px); }
.brand-logo {
  height: 30px;
  width: auto;
  display: block;
}

/* Product tabs (Exchange / Sportsbook / Vegas / Live Casino) */
.product-nav { display: flex; align-items: stretch; height: 48px; }
.product-nav a {
  display: flex; align-items: center;
  padding: 0 14px;
  font-size: 13px; font-weight: 600;
  color: var(--hdr-text);
  cursor: pointer; text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color .12s;
}
.product-nav a:hover { color: var(--hdr-text-active); }
.product-nav a.active {
  color: var(--hdr-text-active);
  background: var(--tab-active-bg);
  border-bottom-color: #f5a623;
}

/* Auth area */
.btn-mobile {
  display: flex; align-items: center; gap: 5px;
  background: #000; color: #fff;
  border: 1px solid #555; border-radius: 3px;
  padding: 5px 9px; font-size: 11px; cursor: pointer;
}
.btn-mobile i { font-size: 13px; }
.auth-fields { display: flex; gap: 4px; }
.auth-fields input {
  height: 30px; padding: 0 10px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 5px;
  background: rgba(255,255,255,.08); color: #fff; font-size: 12px;
  width: 130px; outline: none;
}
.auth-fields input::placeholder { color: rgba(255,255,255,.45); }
.auth-fields input:focus { border-color: var(--brand-green); background: rgba(255,255,255,.14); }
.remember {
  color: var(--hdr-text); font-size: 11px; cursor: pointer;
  display: flex; align-items: center; gap: 4px; white-space: nowrap;
}
.forgot { font-size: 10px; color: var(--hdr-text); white-space: nowrap; }
.forgot strong { color: #fff; }
.btn-login {
  height: 30px; padding: 0 16px;
  background: transparent; border: 1px solid rgba(255,255,255,.4); border-radius: 5px;
  color: #fff; font-size: 12px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.btn-login:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.btn-join {
  height: 30px; padding: 0 18px;
  background: var(--brand-yellow); border: none; border-radius: 5px;
  color: #1a1a1a; font-size: 12px; font-weight: 800; cursor: pointer;
  box-shadow: 0 2px 8px rgba(244,207,20,.3);
}
.btn-join:hover { background: #ffe14a; }
.lang-flag { font-size: 18px; cursor: pointer; }

/* ── SPORT NAV ──────────────────────────────────────────── */
.sportnav {
  height: 32px;
  background: var(--nav-bg);
  display: flex; align-items: stretch;
  padding: 0;
  border-bottom: 1px solid var(--nav-border);
  overflow: hidden;
  position: relative; z-index: 99;
}
.sportnav a {
  display: flex; align-items: center;
  padding: 0 12px;
  font-size: 12px; font-weight: 600;
  color: var(--nav-text);
  cursor: pointer; text-decoration: none;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.sportnav a:hover { color: var(--nav-active); background: rgba(255,255,255,.07); }
.sportnav a.active { color: var(--nav-active); border-bottom-color: var(--brand-green); }
.nav-spacer { flex: 1; }
.nav-settings {
  display: flex; align-items: center;
  padding: 0 12px;
  color: var(--nav-text); font-size: 12px;
  cursor: pointer;
}
.nav-settings:hover { color: var(--nav-active); }

/* ── LAYOUT ─────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sb-width) 1fr var(--bsp-width);
  min-height: calc(100vh - 80px);
  background: var(--page-bg);
}
.layout.sidebar-hidden {
  grid-template-columns: 22px 1fr var(--bsp-width);
}

/* ── LEFT SIDEBAR ────────────────────────────────────────── */
.sidebar-left {
  background: var(--sb-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 80px);
  font-size: 12px;
}
.sidebar-toggle {
  background: var(--bg-light2);
  padding: 5px 8px;
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 4px;
  user-select: none;
}
.sidebar-toggle:hover { background: #e0e0e0; color: var(--text-0); }
.toggle-arrow { margin-left: auto; font-size: 14px; font-weight: 700; }

.my-markets {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px;
  font-size: 12px; font-weight: 700;
  color: var(--text-0);
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  background: var(--white);
}
.my-markets:hover { background: var(--bg-light); }
.my-star { color: #f5a623; font-size: 11px; }

.sidebar-section-label {
  padding: 5px 10px;
  font-size: 11px; font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .3px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-light);
}

/* Sports list */
.sports-list { list-style: none; }
.sports-list li {
  padding: 6px 10px;
  cursor: pointer;
  color: var(--link);
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 7px;
  transition: background .08s;
}
.sports-list li:hover { background: #eef4fc; }
.sports-list li.loading { color: var(--text-3); cursor: default; }
.sports-list li i { width: 14px; text-align: center; font-size: 11px; color: var(--text-3); }
.sports-list .badge-live {
  margin-left: auto;
  background: var(--red); color: #fff;
  padding: 1px 5px; border-radius: 2px;
  font-size: 9px; font-weight: 800; letter-spacing: .3px;
}

/* Breadcrumb tree (event view) */
.breadcrumb-tree { list-style: none; }
.breadcrumb-tree li {
  padding: 4px 10px 4px 10px;
  color: var(--link);
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  display: flex; align-items: center; gap: 5px;
}
.breadcrumb-tree li:hover { background: #eef4fc; }
.breadcrumb-tree li.current {
  font-weight: 700; color: var(--text-0); cursor: default;
  background: var(--bg-light);
}
.breadcrumb-tree li.indent-1 { padding-left: 18px; }
.breadcrumb-tree li.indent-2 { padding-left: 26px; }
.breadcrumb-tree li.indent-3 { padding-left: 34px; }
.breadcrumb-tree li.indent-4 { padding-left: 42px; }

/* Market check list (event view) */
.market-check-list { list-style: none; border-top: 1px solid var(--border); }
.market-check-list li {
  padding: 5px 10px;
  display: flex; align-items: center; gap: 7px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-0); font-size: 12px;
}
.market-check-list li:hover { background: #eef4fc; }
.market-check-list li.active { font-weight: 700; }
.market-check-list input[type=checkbox] { cursor: pointer; flex-shrink: 0; }
.market-check-list .mkt-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main {
  overflow-y: auto;
  max-height: calc(100vh - 80px);
  background: var(--page-bg);
}

/* List view header */
.list-header {
  background: var(--hdr-bg);
  color: #fff;
  padding: 6px 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.list-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
}
.list-count {
  background: rgba(255,255,255,.2);
  padding: 1px 6px; border-radius: 8px;
  font-size: 10px; font-weight: 700;
}
.list-tabs { display: flex; gap: 2px; }
.tab {
  background: rgba(255,255,255,.2);
  border: none; padding: 3px 9px;
  color: #fff; font-size: 11px; font-weight: 600;
  cursor: pointer; border-radius: 2px; font-family: inherit;
}
.tab:hover { background: rgba(255,255,255,.35); }
.tab.active { background: #fff; color: var(--text-0); }

/* Search bar */
.search-bar {
  background: var(--white);
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.search-bar:focus-within { background: #fafcff; }
.search-bar i { color: var(--text-3); font-size: 12px; }
.search-bar input {
  flex: 1; border: none; outline: none;
  font: 12px Arial, sans-serif; color: var(--text-0);
  background: transparent;
}
.search-bar input::placeholder { color: var(--text-3); }
.search-clear {
  background: var(--bg-light2); border: none; cursor: pointer;
  color: var(--text-2); width: 20px; height: 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.search-clear:hover { background: var(--red); color: #fff; }

/* Market table header */
.market-table-hd {
  display: grid;
  grid-template-columns: 1fr 72px 108px 108px 108px 28px;
  background: var(--bg-light2);
  padding: 4px 10px;
  font-size: 10px; font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  letter-spacing: .3px;
}
.col-event { text-align: left; }
.col-matched, .col-runner, .col-more { text-align: center; }

/* Group card */
.group-card { margin-bottom: 2px; background: var(--white); }
.group-card-hd {
  background: #e8e8e8;
  padding: 5px 10px;
  display: flex; align-items: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-1);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .2px;
  gap: 6px;
}
.group-card-hd .g-count { color: var(--text-3); font-weight: 500; text-transform: none; font-size: 10px; }
.group-card-hd .g-see-all {
  margin-left: auto; color: var(--link);
  cursor: pointer; font-size: 11px; font-weight: 600;
  text-transform: none;
}
.group-card-hd .g-see-all:hover { text-decoration: underline; }

/* Event row */
.event-row {
  display: grid;
  grid-template-columns: 1fr 72px 108px 108px 108px 28px;
  align-items: center;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border-light);
  background: var(--white);
  gap: 2px;
  transition: background .06s;
}
.event-row:hover { background: #f5f8fd; }
.event-row:last-child { border-bottom: 1px solid var(--border); }

.event-info { min-width: 0; }
.event-name {
  font-size: 12px; font-weight: 600; color: var(--text-0);
  cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.event-name:hover { color: var(--link); text-decoration: underline; }
.event-name mark { background: #fff3a0; padding: 0 2px; border-radius: 2px; font-weight: 700; }
.event-meta {
  margin-top: 2px; display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text-3);
}
.event-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 4px; border-radius: 2px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
}
.event-tag.live { background: var(--red); color: #fff; }
.event-tag.live::before { content: ''; display: inline-block; width: 4px; height: 4px; background: #fff; border-radius: 50%; }
.event-tag.upcoming { background: #888; color: #fff; }
.event-tag.starting { background: var(--orange); color: #fff; animation: pulseSoon 1.6s infinite; }
@keyframes pulseSoon { 0%,100%{opacity:1} 50%{opacity:.7} }

.event-matched {
  text-align: center; font-size: 10px; color: var(--text-2);
  font-family: monospace; line-height: 1.2;
}

/* Price cell in LIST view (best back + best lay side by side) */
.price-cell {
  height: 40px;
  display: flex; flex-direction: row;
  overflow: hidden; cursor: pointer;
  border: 1px solid var(--border);
  transition: none;
}
.price-cell.empty { cursor: default; }
.price-cell.no-runner { border: none; background: transparent; pointer-events: none; }
.price-cell.no-runner .back, .price-cell.no-runner .lay { visibility: hidden; background: transparent; }

.price-cell .back,
.price-cell .lay {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1.1; padding: 2px 3px; min-width: 0;
}
.price-cell .back { background: var(--back-1); border-right: 1px solid rgba(0,0,0,.08); }
.price-cell .lay  { background: var(--lay-1); }
.price-cell.empty .back, .price-cell.empty .lay { background: #e8e8e8; }
.price-cell:not(.empty):hover .back { background: var(--back-hover); }
.price-cell:not(.empty):hover .lay  { background: var(--lay-hover); }
.price-cell .price { font-size: 12px; font-weight: 700; color: #000; font-family: monospace; white-space: nowrap; }
.price-cell .size  { font-size: 9px; color: rgba(0,0,0,.55); margin-top: 1px; white-space: nowrap; }
.price-cell.empty .price::after { content: '—'; color: #aaa; }

.price-cell.more {
  border: none; background: transparent; color: var(--text-2);
  align-items: center; justify-content: center; font-size: 18px; font-weight: 700;
  cursor: pointer;
}
.price-cell.more:hover { color: var(--link); }

/* Flash animations */
@keyframes flashUp   { from { box-shadow: inset 0 0 0 9999px rgba(46,204,113,.45); } to { box-shadow: none; } }
@keyframes flashDown { from { box-shadow: inset 0 0 0 9999px rgba(208,2,27,.35); }  to { box-shadow: none; } }
.flash-up   .back { animation: flashUp .55s ease-out; }
.flash-down .back { animation: flashDown .55s ease-out; }
.flash-up-lay   .lay { animation: flashUp .55s ease-out; }
.flash-down-lay .lay { animation: flashDown .55s ease-out; }

/* Skeleton loader */
.skeleton-card { padding: 12px 10px; background: var(--white); border-bottom: 1px solid var(--border-light); }
.skeleton-line {
  height: 10px; border-radius: 2px;
  background: linear-gradient(90deg, #e8e8e8, #f5f5f5, #e8e8e8);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 7px;
}
.skeleton-line.short { width: 40%; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── EVENT DETAIL VIEW (inline) ──────────────────────────── */
.event-detail-header {
  background: #2c2c2c;
  color: #fff;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #000;
}
.event-detail-header .star-btn {
  color: #f5a623; font-size: 16px; cursor: pointer;
}
.event-detail-header .ev-info { flex: 1; min-width: 0; }
.event-detail-header .ev-name {
  font-size: 18px; font-weight: 700; color: #fff;
  line-height: 1.1;
}
.event-detail-header .ev-date { font-size: 11px; color: #aaa; margin-top: 3px; }
.event-detail-header .ev-actions { display: flex; gap: 6px; }
.ev-btn {
  padding: 5px 10px;
  background: #444; border: 1px solid #666;
  color: #fff; font-size: 11px; font-weight: 600; cursor: pointer;
  border-radius: 2px;
}
.ev-btn:hover { background: #555; }
.back-to-list {
  padding: 5px 10px;
  background: transparent; border: 1px solid #555;
  color: #aaa; font-size: 11px; cursor: pointer;
  border-radius: 2px; margin-right: 10px;
}
.back-to-list:hover { color: #fff; border-color: #888; }

/* Match Odds card */
.market-card {
  background: var(--white);
  border-bottom: 3px solid var(--border);
  margin-bottom: 0;
}
.market-card-hd {
  padding: 6px 12px;
  font-size: 12px; font-weight: 700;
  color: var(--text-0);
  border-bottom: 1px solid var(--border-light);
}

/* Feature bar (Going In-Play / Cash Out / Rules / Matched / Refresh) */
.feature-bar {
  background: var(--bg-light);
  padding: 5px 12px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px; flex-wrap: wrap;
}
.feature-bar label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-weight: 600; color: var(--text-1); }
.feature-bar input[type=checkbox] { cursor: pointer; }
.feature-bar .cash-out-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--orange); display: inline-block;
}
.feature-bar .rules-btn {
  display: flex; align-items: center; gap: 3px;
  padding: 2px 7px; border: 1px solid var(--border);
  background: var(--white); font-size: 11px; cursor: pointer; border-radius: 2px;
}
.feature-bar .matched-info {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; color: var(--text-1);
}
.refresh-btn {
  padding: 3px 9px;
  background: var(--bg-light2); border: 1px solid var(--border);
  font-size: 11px; cursor: pointer; border-radius: 2px;
}
.refresh-btn:hover { background: #ddd; }

/* Selections count + overround + Back all / Lay all header row
   Grid mirrors .runner-row: 1fr 64 64 72 | 72 64 64          */
.col-header-row {
  display: grid;
  grid-template-columns: 1fr 64px 64px 72px 72px 64px 64px;
  align-items: center;
  padding: 5px 12px;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  font-size: 11px;
  min-height: 32px;
  gap: 2px;
}
.sel-count { font-weight: 600; color: var(--text-1); }
/* overround-back spans the first 2 back cols (64+64) */
.overround-back {
  grid-column: span 2;
  text-align: center;
  font-size: 11px; color: var(--text-2); font-weight: 600;
}
/* Back all button sits over the 3rd back col (72px best back) */
.back-all-btn {
  text-align: center;
  background: var(--back-all); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 0;
  border-radius: 2px; cursor: pointer;
}
/* Lay all button sits over the 1st lay col (72px best lay) */
.lay-all-btn {
  text-align: center;
  background: var(--lay-all); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 0;
  border-radius: 2px; cursor: pointer;
}
/* overround-lay spans the last 2 lay cols (64+64) */
.overround-lay {
  grid-column: span 2;
  text-align: center;
  font-size: 11px; color: var(--text-2); font-weight: 600;
}

/* Runner rows in event detail — 3 back + 3 lay */
.runner-row {
  display: grid;
  grid-template-columns: 1fr 64px 64px 72px 72px 64px 64px;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  min-height: 44px;
  padding: 0 12px;
  gap: 2px;
}
.runner-row:last-child { border-bottom: none; }
.runner-name-cell {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--text-0);
  min-width: 0;
}
.runner-name-cell .runner-icon {
  width: 20px; height: 20px;
  background: var(--bg-light2); border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-3); flex-shrink: 0;
}
.runner-name-cell .runner-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Depth cells (3x back/lay) */
.depth-cell {
  height: 40px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; line-height: 1.1;
  padding: 2px; font-family: monospace;
  border: none;
}
.depth-cell.back-3 { background: var(--back-3); }
.depth-cell.back-2 { background: var(--back-2); }
.depth-cell.back-1 { background: var(--back-1); }
.depth-cell.lay-1  { background: var(--lay-1); }
.depth-cell.lay-2  { background: var(--lay-2); }
.depth-cell.lay-3  { background: var(--lay-3); }
.depth-cell:not(.empty):hover { filter: brightness(0.93); }
.depth-cell.empty  { background: #eeeeee; cursor: default; }
.depth-cell .d-price { font-size: 13px; font-weight: 700; color: #000; }
.depth-cell .d-size  { font-size: 9px; color: rgba(0,0,0,.55); margin-top: 1px; }
.depth-cell.empty .d-price::after { content: '—'; color: #aaa; font-size: 11px; }

/* Other Markets section */
.other-markets-hd {
  background: #1a1a1a;
  color: #fff;
  padding: 8px 14px;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px;
}
.other-markets-hd .om-close {
  background: transparent; border: 1px solid #555;
  color: #aaa; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 2px; font-size: 12px;
}
.other-markets-hd .om-close:hover { color: #fff; border-color: #888; }

.other-tabs {
  background: var(--white);
  display: flex; align-items: stretch;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.ot-tab {
  padding: 8px 14px;
  background: transparent; border: none;
  color: var(--text-1); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.ot-tab:hover { background: var(--bg-light); color: var(--text-0); }
.ot-tab.active { color: var(--text-0); border-bottom-color: #1a1a1a; }

.other-content {
  background: var(--white);
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.other-content .market-condensed {
  border: none; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.other-content .market-condensed:nth-child(even) { border-right: none; }

.market-condensed {
  background: var(--white);
}
.market-condensed-hd {
  background: var(--bg-light);
  padding: 6px 12px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
  border-bottom: 1px solid var(--border-light);
}
.market-condensed-hd .mc-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.market-condensed-hd .mc-icons { display: flex; gap: 4px; flex-shrink: 0; }
.mc-icon-btn {
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-light2); border: 1px solid var(--border);
  border-radius: 2px; font-size: 9px; cursor: pointer; color: var(--text-2);
}
.mc-icon-btn:hover { background: #ddd; }
.market-condensed-hd .mc-stat { font-size: 10px; color: var(--text-3); font-weight: 600; }

/* Condensed runner row (in Other Markets) */
.cm-row {
  display: grid; grid-template-columns: 1fr 130px;
  align-items: center; padding: 4px 10px;
  border-bottom: 1px solid var(--border-light); gap: 6px;
}
.cm-row:last-child { border-bottom: none; }
.cm-name { font-size: 12px; font-weight: 600; color: var(--text-0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-price-cell {
  height: 36px;
  display: flex; overflow: hidden;
  border: 1px solid var(--border); cursor: pointer;
}
.cm-price-cell .cm-back, .cm-price-cell .cm-lay {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  line-height: 1.1; padding: 2px 3px; font-family: monospace;
}
.cm-price-cell .cm-back { background: var(--back-1); border-right: 1px solid rgba(0,0,0,.08); }
.cm-price-cell .cm-lay  { background: var(--lay-1); }
.cm-price-cell.empty .cm-back, .cm-price-cell.empty .cm-lay { background: #e8e8e8; }
.cm-price-cell:not(.empty) .cm-back:hover { background: var(--back-hover); }
.cm-price-cell:not(.empty) .cm-lay:hover  { background: var(--lay-hover); }
.cm-price-cell .price { font-size: 12px; font-weight: 700; color: #000; }
.cm-price-cell .size  { font-size: 9px; color: rgba(0,0,0,.55); margin-top: 1px; }
.cm-price-cell.empty .price::after { content: '—'; color: #aaa; }
.cm-price-cell.empty .size { visibility: hidden; }

/* View full market link */
.view-full-link {
  padding: 6px 12px;
  font-size: 11px; color: var(--link);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.view-full-link:hover { text-decoration: underline; }

/* ── RIGHT SIDEBAR ────────────────────────────────────────── */
.sidebar-right {
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.betslip { display: flex; flex-direction: column; }
.betslip-tabs {
  display: flex; border-bottom: 1px solid var(--border);
}
.bet-tab {
  flex: 1; padding: 8px 6px;
  background: var(--bg-light);
  border: none; border-bottom: 2px solid transparent;
  color: var(--text-1); font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.bet-tab:hover { background: var(--bg-light2); }
.bet-tab.active { background: var(--white); border-bottom-color: #1a1a1a; color: var(--text-0); }
.bet-count {
  display: inline-flex; background: var(--text-3); color: #fff;
  min-width: 18px; height: 16px; padding: 0 5px;
  border-radius: 8px; font-size: 10px;
  align-items: center; justify-content: center; font-weight: 700;
}
.bet-tab.active .bet-count { background: var(--text-0); }

.betslip-market-name {
  padding: 7px 10px;
  font-size: 12px; font-weight: 700; color: var(--text-0);
  background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}
.betslip-body { flex: 1; overflow-y: auto; min-height: 80px; }
.betslip-empty {
  padding: 14px 12px;
  font-size: 11px; color: var(--text-2); text-align: center; line-height: 1.6;
}
.betslip-empty p { margin-bottom: 6px; }
.btn-multiples {
  display: block; width: 100%; margin-top: 10px;
  padding: 8px 6px;
  background: #f5a623; border: none; border-radius: 2px;
  color: #000; font-size: 11px; font-weight: 700; cursor: pointer;
  line-height: 1.3;
}
.btn-multiples:hover { background: #e09018; }

/* Betslip selection card */
.selection {
  background: #f9f9f9; border: 1px solid var(--border);
  border-radius: 2px; padding: 7px 8px; margin: 6px;
}
.selection.back { border-left: 4px solid var(--back-1); }
.selection.lay  { border-left: 4px solid var(--lay-1); }
.selection-hd { display: flex; align-items: flex-start; gap: 5px; margin-bottom: 5px; }
.selection-info { flex: 1; min-width: 0; }
.selection-name { font-size: 12px; font-weight: 700; }
.selection-meta { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.sel-side { padding: 1px 5px; border-radius: 2px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.selection.back .sel-side { background: var(--back-1); }
.selection.lay  .sel-side { background: var(--lay-1); }
.sel-x { color: var(--text-3); cursor: pointer; padding: 0 4px; }
.sel-x:hover { color: var(--red); }
.selection-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 5px; }
.sel-field { background: #fff; border: 1px solid var(--border); border-radius: 2px; padding: 3px 6px; }
.sel-field-label { font-size: 9px; color: var(--text-3); text-transform: uppercase; font-weight: 700; }
.sel-field input {
  width: 100%; border: none; outline: none; background: transparent;
  font: 700 12px monospace; color: var(--text-0); padding: 1px 0;
}

.betslip-footer {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  background: var(--bg-light);
}
.footer-row {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-1); margin-bottom: 4px;
}
.profit-val { color: var(--green); font-weight: 700; }
.btn-place {
  width: 100%; padding: 8px;
  background: var(--brand-green); border: none; border-radius: 2px;
  color: #000; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit; text-transform: uppercase;
}
.btn-place:hover { background: #35b044; }

.liability-row { color: var(--text-1); }
.liability-val { color: var(--red); font-weight: 700; }

.betslip-options {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--border-light);
  display: flex; flex-direction: column; gap: 4px;
}
.bs-opt {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-2); cursor: pointer;
}
.bs-opt input { cursor: pointer; }

/* Selection card — pro */
.selection-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px;
}
.odds-stepper {
  display: flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: 2px;
  overflow: hidden; background: #fff;
}
.odds-stepper input {
  flex: 1; min-width: 0; border: none; outline: none; text-align: center;
  font: 700 13px monospace; color: var(--text-0); background: transparent;
}
.step-btn {
  width: 26px; border: none; cursor: pointer;
  background: var(--bg-light2); color: var(--text-1);
  font-size: 16px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.step-btn:hover { background: #d8d8d8; }
.step-btn:active { background: #c8c8c8; }
.stake-input {
  width: 100%; border: 1px solid var(--border); border-radius: 2px;
  padding: 5px 7px; font: 700 13px monospace; color: var(--text-0);
  outline: none; background: #fff;
}
.stake-input:focus, .odds-stepper:focus-within { border-color: #f5a623; }

.quick-stakes {
  display: flex; gap: 3px; margin-top: 6px; flex-wrap: wrap;
}
.quick-stakes button {
  flex: 1; min-width: 0; padding: 4px 0;
  background: #eef2f7; border: 1px solid var(--border);
  border-radius: 2px; font-size: 10px; font-weight: 700;
  color: var(--text-1); cursor: pointer;
}
.quick-stakes button:hover { background: #dce6f2; color: var(--link); }
.quick-stakes .qs-clear { flex: 0 0 28px; color: var(--text-3); }
.quick-stakes .qs-clear:hover { background: #fde0e6; color: var(--red); }

.sel-pl {
  display: flex; justify-content: space-between;
  font-size: 11px; margin-top: 6px;
  padding-top: 5px; border-top: 1px dashed var(--border-light);
  color: var(--text-2);
}
.sel-pl .pl-profit { color: var(--green); font-weight: 700; }
.sel-pl.liability { border-top: none; padding-top: 2px; margin-top: 2px; }
.sel-pl .pl-liability { color: var(--red); font-weight: 700; }

/* Book % display in market header — shown only when "Show % Book" is on */
.book-pct { font-weight: 700; color: var(--text-1); }
body:not(.show-book) .book-pct { visibility: hidden; }

/* Live Stream section */
.live-stream-box {
  border-top: 3px solid var(--border);
  flex-shrink: 0;
}
.live-stream-hd {
  background: #1a1a1a;
  color: #fff;
  padding: 6px 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700;
}
.pop-out-btn {
  background: transparent; border: 1px solid #555;
  color: #aaa; font-size: 10px; cursor: pointer;
  padding: 2px 6px; border-radius: 2px;
}
.pop-out-btn:hover { color: #fff; }
.live-stream-tabs {
  display: flex; background: var(--bg-light);
  border-bottom: 1px solid var(--border);
}
.ls-tab {
  flex: 1; padding: 6px 4px;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-1); font-size: 11px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.ls-tab:hover { background: var(--bg-light2); }
.ls-tab.active { color: var(--text-0); border-bottom-color: #1a1a1a; background: var(--white); }
.pitch-area { background: #3a7d44; overflow: hidden; }
.pitch-svg { width: 100%; }
.pitch-svg svg { display: block; width: 100%; height: auto; }

.play-games-bar {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  background: var(--bg-light);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; cursor: pointer;
  color: var(--text-1);
}
.play-games-bar:hover { background: var(--bg-light2); }

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 14px; right: 14px;
  background: var(--text-0); color: #fff;
  border-radius: 3px; padding: 9px 13px;
  font-size: 12px; font-weight: 600;
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
  z-index: 3000; display: flex; align-items: center; gap: 7px;
  animation: toastIn .18s;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast i { font-size: 13px; }
@keyframes toastIn  { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(8px); } }

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ── SUSPENDED MARKET ────────────────────────────────────── */
.market-card.mkt-suspended { position: relative; }
.market-card.mkt-suspended .depth-cell { opacity: .35; pointer-events: none; filter: grayscale(.6); }
.market-card.mkt-suspended .col-header-row::after {
  content: 'SUSPENDED';
  margin-left: auto; margin-right: 12px;
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: .5px;
  padding: 2px 8px; border-radius: 2px;
}

/* ── LADDER BUTTON + MODAL ───────────────────────────────── */
.rspark { margin-left: auto; flex-shrink: 0; opacity: 1; border-radius: 4px; }
.ladder-btn {
  margin-left: 6px; flex-shrink: 0;
  width: 22px; height: 22px;
  background: var(--bg-light2); border: 1px solid var(--border);
  border-radius: 2px; color: var(--text-2); cursor: pointer; font-size: 10px;
}
.ladder-btn:hover { background: #d8d8d8; color: var(--link); }

.ladder-modal {
  position: fixed; inset: 0; z-index: 2500;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ladder-box {
  background: var(--white); width: 320px; max-height: 80vh;
  border-radius: 4px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.ladder-hd {
  background: #1a1a1a; color: #fff;
  padding: 10px 12px; display: flex; align-items: center; justify-content: space-between;
}
.ladder-runner { font-size: 14px; font-weight: 700; }
.ladder-sub { font-size: 10px; color: #aaa; margin-top: 2px; }
.ladder-close {
  background: transparent; border: 1px solid #555; color: #aaa;
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 12px;
}
.ladder-close:hover { color: #fff; }
.ladder-cols {
  display: grid; grid-template-columns: 1fr 70px 1fr;
  background: var(--bg-light2); padding: 4px 0;
  font-size: 10px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; text-align: center;
}
.ladder-body { overflow-y: auto; }
.ladder-row {
  display: grid; grid-template-columns: 1fr 70px 1fr;
  border-bottom: 1px solid var(--border-light); min-height: 30px;
}
.ladder-back, .ladder-lay {
  display: flex; align-items: center; justify-content: center;
  font: 700 12px monospace; color: var(--text-1);
}
.ladder-back.has { background: var(--back-3); cursor: pointer; }
.ladder-back.has.best { background: var(--back-1); }
.ladder-lay.has  { background: var(--lay-3); cursor: pointer; }
.ladder-lay.has.best { background: var(--lay-1); }
.ladder-back.has:hover { background: var(--back-hover); }
.ladder-lay.has:hover { background: var(--lay-hover); }
.ladder-price {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-light); font: 700 12px monospace; color: var(--text-0);
  border-left: 1px solid var(--border-light); border-right: 1px solid var(--border-light);
}
.ladder-price.pb { box-shadow: inset 3px 0 0 var(--back-1); }
.ladder-price.pl { box-shadow: inset -3px 0 0 var(--lay-1); }
.ladder-empty { padding: 30px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ── THEME TOGGLE + CONN BADGE ───────────────────────────── */
.theme-toggle {
  width: 32px; height: 30px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: 5px;
  color: #dfe7e1; cursor: pointer; font-size: 13px;
}
.theme-toggle:hover { background: rgba(255,255,255,.16); color: #fff; }

.conn-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 10px; font-size: 11px; font-weight: 600;
  color: var(--hdr-text);
}
.conn-badge .conn-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--orange); box-shadow: 0 0 5px currentColor;
}
.conn-badge.connecting  .conn-dot { background: var(--orange); animation: pulse 1.5s infinite; }
.conn-badge.connected   .conn-dot { background: #38d96a; color: #38d96a; }
.conn-badge.connected   .conn-label { color: #8ee7a6; }
.conn-badge.disconnected .conn-dot { background: var(--red); color: var(--red); animation: pulse 1s infinite; }
.conn-badge.disconnected .conn-label { color: #ff8a8a; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

.oc-warn { color: var(--orange); font-weight: 800; font-size: 10px; margin-left: 2px; }

/* ── AUTH UI ─────────────────────────────────────────────── */
.auth-group { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 6px;
  color: #fff; font-size: 12px; font-weight: 600;
}
.user-chip i { color: #f5a623; font-size: 16px; }
.wallet-chip {
  display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1;
  padding: 3px 10px; background: var(--brand-dark); border: 1px solid #0d3018; border-radius: 3px;
}
.wallet-bal { color: #38d96a; font-weight: 800; font-size: 13px; font-family: monospace; }
.wallet-exp { color: #e08; color: #ff8a8a; font-size: 9px; font-family: monospace; }

.auth-modal {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center;
  animation: fadeIn .15s;
}
.auth-box { background: var(--white); width: 360px; border-radius: 6px; overflow: hidden; box-shadow: 0 12px 50px rgba(0,0,0,.4); }
.auth-box-hd {
  background: #1a1a1a; color: #fff; padding: 14px 16px;
  font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: space-between;
}
.auth-x { background: transparent; border: none; color: #aaa; cursor: pointer; font-size: 15px; }
.auth-x:hover { color: #fff; }
.auth-box-body { padding: 16px; display: flex; flex-direction: column; }
.auth-box-body label { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; margin: 8px 0 3px; }
.auth-box-body input {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 3px;
  font-size: 13px; outline: none; background: var(--white); color: var(--text-0);
}
.auth-box-body input:focus { border-color: #f5a623; }
.auth-submit {
  margin-top: 14px; padding: 11px; background: #f5a623; border: none; border-radius: 3px;
  color: #000; font-size: 13px; font-weight: 700; cursor: pointer;
}
.auth-submit:hover { background: #e09018; }
.auth-switch { margin-top: 10px; font-size: 11px; color: var(--text-2); text-align: center; }
.auth-switch a { color: var(--link); cursor: pointer; }
.auth-switch a:hover { text-decoration: underline; }

/* Open bets rows */
.openbet-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
  font-size: 11px; color: var(--text-1);
}
.openbet-row .ob-liab { color: var(--red); }
.openbet-row .ob-status {
  margin-left: auto; text-transform: uppercase; font-size: 9px; font-weight: 800;
  background: var(--bg-light2); padding: 1px 6px; border-radius: 2px; color: var(--text-2);
}

/* ── DARK MODE ───────────────────────────────────────────── */
body.dark {
  --page-bg: #14161a;
  --white: #1e2127;
  --border: #33373f;
  --border-light: #2a2d34;
  --bg-light: #23262d;
  --bg-light2: #2b2f37;
  --text-0: #e8e8ea;
  --text-1: #c2c5cc;
  --text-2: #9498a1;
  --text-3: #6b6f78;
  --link: #5aa9ee;
  /* slightly muted back/lay so they're not glaring on dark */
  --back-1: #4a86c5; --back-2: #3b6a9c; --back-3: #2f5985;
  --lay-1: #c56e87; --lay-2: #9c5468; --lay-3: #854a5b;
  --back-hover: #5a96d5; --lay-hover: #d57e97;
}
body.dark { background: var(--page-bg); color: var(--text-0); }
body.dark .price-cell .price,
body.dark .depth-cell .d-price,
body.dark .cm-price-cell .price { color: #fff; }
body.dark .price-cell .size,
body.dark .depth-cell .d-size,
body.dark .cm-price-cell .size { color: rgba(255,255,255,.7); }
body.dark .price-cell.empty .back, body.dark .price-cell.empty .lay,
body.dark .depth-cell.empty, body.dark .cm-price-cell.empty .cm-back, body.dark .cm-price-cell.empty .cm-lay { background: #2a2d34; }
body.dark .event-detail-header { background: #16181c; }
body.dark .other-markets-hd, body.dark .list-header { background: #16181c; }
body.dark .selection { background: #23262d; }
body.dark .sel-field, body.dark .stake-input, body.dark .odds-stepper input,
body.dark .odds-stepper, body.dark .market-condensed-hd, body.dark .feature-bar { background: var(--white); }
body.dark .auth-fields input { background: #0e1013; }
body.dark .toast { background: #2b2f37; }
body.dark .quick-stakes button { background: #2b2f37; color: var(--text-1); }
body.dark .step-btn { background: #2b2f37; color: var(--text-1); }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --sb-width: 175px; --bsp-width: 230px; }
}
@media (max-width: 850px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar-left, .sidebar-right { display: none; }
  .topbar-right .auth-fields, .topbar-right .remember, .topbar-right .forgot { display: none; }
}
