/* ===================================================================
 * BetExchange — Template fedele al layout Betfair Exchange
 * =================================================================== */

:root {
  /* ─── REAL Betfair palette — extracted live from betfair.ro/exchange/plus ─── */
  /* Brand */
  --brand-dark:   #1e1e1e;   /* Betfair near-black */
  --brand-green:  #ffb80c;   /* Betfair signature yellow */
  --brand-yellow: #ffb80c;

  /* Header — the famous yellow top bar (#ffb80c), dark text on it */
  --hdr-bg: #ffb80c;
  --hdr-border: #e0a300;
  --hdr-text: #1e1e1e;
  --hdr-text-active: #000000;
  --tab-active-bg: #1e1e1e;

  /* Sport nav — black menu bar (#1e1e1e), off-white text */
  --nav-bg: #1e1e1e;
  --nav-text: #f6f6f6;
  --nav-active: #ffffff;
  --nav-border: #303030;

  /* Page — Betfair light-grey content area */
  --page-bg: #dfe5e5;
  --white: #ffffff;
  --border: #cccccc;
  --border-light: #e5e5e5;
  --bg-light: #f5f5f5;
  --bg-light2: #ececec;

  /* Text */
  --text-0: #1e1e1e;
  --text-1: #303030;
  --text-2: #666666;
  --text-3: #999999;
  --link: #167ac6;          /* Betfair link blue */

  /* Back (blue) — back-1 #a6d8ff extracted live; 2/3 are standard Betfair shades */
  --back-1: #a6d8ff;      /* best — closest to mid */
  --back-2: #c5e3ff;
  --back-3: #d8edff;
  --back-4: #ecf5ff;
  --back-5: #f5faff;
  --back-hover: #75c2fc;
  --back-all: #2789ce;

  /* Lay (pink) — lay-1 #fac9d1 extracted live */
  --lay-1:  #fac9d1;
  --lay-2:  #fcdce1;
  --lay-3:  #fde9ec;
  --lay-4:  #fef4f6;
  --lay-5:  #fff8f9;
  --lay-hover: #f8b4c0;
  --lay-all: #d47a8c;

  /* Status */
  --red:    #d0021b;
  --green:  #20a052;        /* Betfair in-play green */
  --orange: #ffb80c;

  /* Sidebar */
  --sb-bg: #ffffff;
  --sb-width: 195px;

  /* Betslip */
  --bsp-width: 340px;

  --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: 55px;
  background: var(--hdr-bg);
  display: flex; align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid var(--hdr-border);
  position: relative; z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
.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 sits directly on the yellow bar (no plate) — part of the header */
.brand { display: flex; align-items: center; padding-right: 18px; }
.brand-plate {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  padding: 4px 2px;
  border-radius: 0;
  transition: transform .05s, opacity .12s;
}
.brand:hover .brand-plate { opacity: .85; }
.brand:active .brand-plate { transform: translateY(1px); }
.brand-logo {
  height: 34px;
  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: #ffffff;                 /* white text on the dark active tab */
  background: var(--tab-active-bg);
  border-bottom-color: var(--brand-green);
}

/* 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(0,0,0,.25); border-radius: 3px;
  background: #fff; color: #1e1e1e; font-size: 12px;
  width: 130px; outline: none;
}
.auth-fields input::placeholder { color: #999; }
.auth-fields input:focus { border-color: #1e1e1e; background: #fff; }
.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: #1e1e1e; }
/* Betfair: dark grey buttons sitting on the yellow header bar */
.btn-login {
  height: 30px; padding: 0 16px;
  background: #fff; border: 1px solid rgba(0,0,0,.3); border-radius: 3px;
  color: #1e1e1e; font-size: 12px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.btn-login:hover { background: #f0f0f0; border-color: #1e1e1e; }
.btn-join {
  height: 30px; padding: 0 18px;
  background: #303030; border: none; border-radius: 3px;
  color: #fff; font-size: 12px; font-weight: 800; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.btn-join:hover { background: #1e1e1e; }
.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: 13px; 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: #ffb80c; 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: #303030;
  padding: 5px 10px;
  padding-left: 8px;
  display: flex; align-items: center;
  font-size: 11px; font-weight: 700;
  color: #f6f6f6;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--brand-green);
  text-transform: uppercase; letter-spacing: .2px;
  gap: 6px;
}
.group-card-hd .g-count { color: #b8b8b8; 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;
  position: relative;            /* containing block for the .row-lock banner */
}
.event-row:hover { background: #f0f5fc; }
.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} }

/* ── Live score badges ─────────────────────────────────────── */
.score-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #1a3a1a; border: 1px solid #2ecc71;
  color: #2ecc71; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 3px;
  vertical-align: middle; line-height: 1.5;
  font-family: monospace; letter-spacing: .5px;
}
.score-badge .score-t {
  font-size: 9px; font-weight: 400; color: #90ee90; letter-spacing: 0;
}
/* Detail view score (larger) */
.ev-score { margin-top: 4px; }
.score-detail {
  display: inline-flex; align-items: baseline; gap: 8px;
}
.score-detail .score-goals {
  font-size: 24px; font-weight: 900; color: #2ecc71; font-family: monospace;
  text-shadow: 0 0 8px rgba(46,204,113,.5); letter-spacing: 2px;
}
.score-detail .score-time {
  font-size: 12px; font-weight: 600; color: #90ee90;
  background: #1a3a1a; border: 1px solid #2ecc71;
  padding: 2px 6px; border-radius: 10px; font-family: monospace;
}
/* Tennis score styles */
.score-tennis { align-items: center; gap: 10px; }
.score-tennis .score-sets {
  font-size: 18px; font-weight: 800; color: #2ecc71; font-family: monospace;
  letter-spacing: 2px; text-shadow: 0 0 6px rgba(46,204,113,.4);
}
.score-tennis .score-game {
  font-size: 14px; font-weight: 700; color: #90ee90; font-family: monospace;
  background: #1a3a1a; border: 1px solid #2ecc71;
  padding: 2px 8px; border-radius: 10px; letter-spacing: 1px;
}

.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: 46px;
  display: flex; flex-direction: row;
  overflow: hidden; cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 2px;
  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: 13px; font-weight: 700; color: #000; font-family: monospace; white-space: nowrap; }
.price-cell .size  { font-size: 10px; color: rgba(0,0,0,.55); margin-top: 1px; white-space: nowrap; }
.price-cell.empty .price::after { content: '—'; color: #aaa; }
.price-cell.empty .size { visibility: hidden; }

.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: #ffb80c; 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-score { margin-top: 6px; }
.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-5 { background: var(--back-5); }
.depth-cell.back-4 { background: var(--back-4); }
.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.lay-4  { background: var(--lay-4); }
.depth-cell.lay-5  { background: var(--lay-5); }
/* Depth cells 4 and 5 are hidden by default — appear only when server sends real liquidity */
.depth-cell.back-4, .depth-cell.back-5,
.depth-cell.lay-4,  .depth-cell.lay-5  { display: none; }
/* Empty header placeholders for depth 4/5 columns */
.depth-hd { display: none; }

/* ── Dynamic depth expansion (mirrors Betfair behaviour) ───── */
/* depth-4: 9-column grid — shows cells back-4 and lay-4 */
.market-card.has-depth-4 .col-header-row,
.market-card.has-depth-4 .runner-row {
  grid-template-columns: 1fr 54px 64px 64px 72px 72px 64px 64px 54px;
}
.market-card.has-depth-4 .depth-hd-back-4,
.market-card.has-depth-4 .depth-hd-lay-4  { display: block; }
.market-card.has-depth-4 .depth-cell.back-4,
.market-card.has-depth-4 .depth-cell.lay-4  { display: flex; }
/* depth-5: 11-column grid — shows cells back-4/5 and lay-4/5 */
.market-card.has-depth-5 .col-header-row,
.market-card.has-depth-5 .runner-row {
  grid-template-columns: 1fr 48px 54px 64px 64px 72px 72px 64px 64px 54px 48px;
}
.market-card.has-depth-5 .depth-hd-back-4,
.market-card.has-depth-5 .depth-hd-back-5,
.market-card.has-depth-5 .depth-hd-lay-4,
.market-card.has-depth-5 .depth-hd-lay-5  { display: block; }
.market-card.has-depth-5 .depth-cell.back-4,
.market-card.has-depth-5 .depth-cell.back-5,
.market-card.has-depth-5 .depth-cell.lay-4,
.market-card.has-depth-5 .depth-cell.lay-5  { display: flex; }

.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; }
.depth-cell.empty .d-size { visibility: hidden; }
/* User's own unmatched offer in the ladder */
.depth-cell.my-offer { outline: 2px solid #2789ce; outline-offset: -2px; }
.depth-cell.my-offer .d-price::after { content: ' ★'; color: #2789ce; font-size: 8px; }
/* Runner P&L indicator (>> ±X.XX) */
.runner-pl { font-size: 11px; font-family: monospace; margin-left: 6px; white-space: nowrap; font-weight: 600; }
.runner-pl.pl-pos { color: #20a052; }
.runner-pl.pl-neg { color: #d0021b; }

/* 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: var(--brand-green); }

.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: #ffb80c; 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 {
  padding: 0;
  background: var(--bg-light);
}
.betslip-footer .betslip-options {
  padding: 8px 10px;
}
.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: #ffb80c; }

.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; }

/* Betfair-style betslip selection — light back-blue / lay-pink, dark text */
.bf-selection { border-bottom: 1px solid var(--border); }
.bf-sel-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px;
  background: #d7dce2; color: #1e1e1e;
  font-size: 11px; font-weight: 700; letter-spacing: .2px;
}
/* Back header → Betfair light blue; Lay header → Betfair light pink (same hues as the price cells) */
.bf-selection.back .bf-sel-hd { background: var(--back-1); color: #1e1e1e; border-bottom: 1px solid var(--back-hover); }
.bf-selection.lay .bf-sel-hd  { background: var(--lay-1);  color: #1e1e1e; border-bottom: 1px solid var(--lay-hover); }
.bf-sel-x {
  cursor: pointer; font-size: 16px; font-weight: 700;
  opacity: .65; line-height: 1; padding: 0 2px; color: inherit;
}
.bf-sel-x:hover { opacity: 1; color: var(--red); }
.bf-sel-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; background: #e9f3fc;
}
.bf-selection.lay .bf-sel-row { background: #fdeef2; }
.bf-sel-name { flex: 1; font-size: 12px; font-weight: 700; color: var(--text-0); min-width: 0; }
/* Legacy — kept for any reference outside betslip */
.bf-sel-odds {
  flex-shrink: 0; width: 72px; padding: 4px 4px;
  border: 1px solid var(--border); font: 700 13px monospace;
  color: #000; text-align: center; outline: none; background: #fff;
}
.bf-sel-odds:focus { border-color: var(--orange); }

/* Custom Betfair-style tick stepper (replaces native number spinner) */
.bf-odds-wrap {
  display: flex; align-items: stretch;
  flex-shrink: 0; width: 80px; height: 30px;
  border: 1px solid var(--border); background: #fff; overflow: hidden;
}
.bf-odds-wrap:focus-within { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.bf-odds-inp {
  flex: 1; min-width: 0;
  padding: 0 2px; border: none; outline: none;
  font: 700 13px monospace; color: #000; text-align: center;
  background: transparent;
}
/* Remove browser-native number spinners from the text fallback */
.bf-odds-inp::-webkit-inner-spin-button,
.bf-odds-inp::-webkit-outer-spin-button { -webkit-appearance: none; }
.bf-step-btn {
  flex-shrink: 0; width: 20px;
  border: none; border-left: 1px solid var(--border); outline: none;
  cursor: pointer; padding: 0;
  background: #dde8f5; color: #446;
  font-size: 8px; font-weight: 900; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  user-select: none; touch-action: none; -webkit-user-select: none;
}
.bf-step-btn.bf-step-dn { border-left: none; border-right: 1px solid var(--border); }
.bf-step-btn:hover { background: #b8cfec; color: #000; }
.bf-step-btn:active { background: #9abce0; }
.bf-selection.lay .bf-step-btn { background: #f0d5dc; color: #644; }
.bf-selection.lay .bf-step-btn:hover { background: #e0b5c0; }
.bf-sel-stake {
  flex-shrink: 0; width: 86px; padding: 4px 6px;
  border: 1px solid var(--border); font: 700 13px monospace;
  color: #000; outline: none; background: #fff;
  -moz-appearance: textfield;
}
.bf-sel-stake:focus { border-color: var(--orange); }
.bf-sel-stake::-webkit-outer-spin-button,
.bf-sel-stake::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bf-sel-profit-col {
  flex-shrink: 0; display: flex; flex-direction: column;
  align-items: flex-end; min-width: 68px;
}
.bf-profit-label { font-size: 9px; color: var(--text-3); text-transform: uppercase; letter-spacing: .3px; }
.bf-profit-val { font-size: 12px; font-weight: 700; color: var(--green); }
.bf-sel-meta {
  padding: 3px 10px 6px; font-size: 11px;
  color: var(--text-2); background: #fff; border-top: 1px solid var(--border-light);
}
.bf-sel-meta .pl-liability { font-weight: 700; color: var(--red); }

/* Betfair-style footer */
.bf-footer-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border); background: var(--bg-light);
}
.bf-cancel-all {
  flex-shrink: 0; padding: 7px 10px; border: 1px solid #bbb;
  border-radius: 3px; background: #d4d4d4; color: #333;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.bf-cancel-all:hover { background: #bbb; }
#btnPlace { flex: 1; }

/* ── BetEx-style tabular betslip ─────────────────────────────── */
.bx-bs { font-size: 12px; }
.bx-hd, .bx-line {
  display: grid;
  grid-template-columns: minmax(62px,1.2fr) 80px 1fr 1fr;
  align-items: center; gap: 4px; padding: 6px 8px;
}
.bx-hd {
  background: #f3c6d2; color: #333; font-weight: 600; font-size: 10.5px;
  border-bottom: 1px solid var(--lay-hover);
}
.bx-hd-side { font-weight: 700; }
.bx-hd-side.back { color: #1e4d80; }
.bx-hd-side.lay  { color: #9c2b46; }
.bx-hd-odds, .bx-hd-stake { text-align: center; }
.bx-hd-out { display: flex; flex-direction: column; gap: 1px; font-size: 10px; }
.bx-hd-out label { display: flex; align-items: center; gap: 3px; cursor: pointer; white-space: nowrap; }
.bx-hd-out input[type=radio] { margin: 0; width: 12px; height: 12px; }

.bx-sel { border-bottom: 1px solid var(--border); }
.bx-sel.lay  { background: #fdeef2; }
.bx-sel.back { background: #eef4fd; }
.bx-c-side { display: flex; align-items: center; gap: 5px; font-weight: 400; min-width: 0; color: var(--text-0); }
.bx-c-side .bx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bx-x { cursor: pointer; color: #999; font-weight: 700; flex-shrink: 0; }
.bx-x:hover { color: var(--red); }
.bx-c-odds { display: flex; align-items: stretch; justify-content: center; }
.bx-c-odds .bf-odds-inp { width: 48px; text-align: center; }
.bx-odds-steps { display: flex; flex-direction: column; }
.bx-odds-steps button {
  width: 16px; height: 11px; line-height: 9px; padding: 0; font-size: 8px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; color: #555;
}
.bx-odds-steps button:hover { background: #eee; }
.bx-c-stake { display: flex; justify-content: center; }
.bx-c-stake .bf-sel-stake { width: 100%; text-align: center; }
.bx-c-out { text-align: right; font-weight: 700; color: var(--text-0); padding-right: 2px; }
.bx-quick { display: flex; gap: 6px; padding: 0 8px 8px; }
.bx-quick button {
  flex: 1; padding: 5px 0; background: #fff; border: 1px solid var(--border);
  border-radius: 3px; cursor: pointer; font-size: 11px; color: #444;
}
.bx-quick button:hover { background: #f0f0f0; border-color: #999; }
.bx-liab-total { text-align: right; padding: 8px 10px; font-size: 12px; color: var(--text-1); }
.bx-liab-total b { font-size: 13px; color: var(--text-0); }

/* ── BetEx-style Open Bets (Unmatched / Matched tables) ──────── */
.obx-wrap { font-size: 12px; padding-bottom: 8px; }
.obx-sec-hd {
  background: #2b2b2b; color: #fff; font-weight: 700; font-size: 11.5px;
  padding: 7px 10px; margin-top: 10px;
}
.obx-wrap > .obx-sec-hd:first-child { margin-top: 0; }
.obx-none { text-align: center; color: var(--text-1); padding: 16px 8px; font-size: 12px; }

.obx-tbl { border: 1px solid var(--border); border-top: none; }
.obx-hd, .obx-row {
  display: grid; grid-template-columns: minmax(0,1.45fr) 76px 1fr 1fr;
  align-items: center; gap: 4px; padding: 5px 8px;
}
.obx-hd { font-size: 10px; font-weight: 700; }
.obx-back .obx-hd { background: #cfe0f5; color: #1e4d80; }
.obx-lay  .obx-hd { background: #f3c6d2; color: #9c2b46; }
.obx-hd-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obx-hd-c { text-align: center; }
.obx-back .obx-row { background: #eef4fd; }
.obx-lay  .obx-row { background: #fdeef2; }
.obx-sel {
  display: flex; align-items: center; gap: 5px; min-width: 0;
  font-weight: 700; color: var(--text-0);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.obx-x { cursor: pointer; color: #b33; font-weight: 700; flex-shrink: 0; }
.obx-x:hover { color: var(--red); }
.obx-num { text-align: center; font-weight: 600; color: var(--text-0); }
.obx-odds-cell { display: flex; align-items: stretch; justify-content: center; }
.obx-odds-cell .obx-inp { width: 46px; text-align: center; }
.obx-spin { display: flex; flex-direction: column; }
.obx-spin button {
  width: 16px; height: 11px; line-height: 9px; padding: 0; font-size: 8px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; color: #555;
}
.obx-spin button:hover { background: #eee; }
.obx-stake-cell { display: flex; justify-content: center; }
.obx-stake-cell .obx-inp { width: 100%; max-width: 70px; text-align: center; }
.obx-inp { border: 1px solid var(--border); border-radius: 3px; padding: 3px 2px; font-size: 11px; font-family: inherit; }
.obx-sub { padding: 3px 8px 6px; font-size: 10px; color: var(--text-2); background: #fff; }
.obx-evlink { color: var(--accent, #1f6fd6); font-weight: 600; cursor: pointer; }
.obx-evlink:hover { text-decoration: underline; }
.obx-co { padding: 0 8px 8px; background: #fff; }
.obx-co .ob-cashout-btn { width: 100%; }

.obx-actions { display: flex; gap: 6px; padding: 8px; }
.obx-btn {
  flex: 1; padding: 7px 0; border: 1px solid var(--border); border-radius: 3px;
  cursor: pointer; font-size: 11px; font-weight: 700; font-family: inherit;
}
.obx-cancel-all { background: var(--red); color: #fff; border-color: var(--red); }
.obx-cancel-all:hover { filter: brightness(.94); }
.obx-reset { background: #e9e9e9; color: #444; }
.obx-reset:hover { background: #ddd; }
.obx-update { background: var(--orange, #f7a700); color: #1a1a1a; border-color: var(--orange, #f7a700); }
.obx-update:hover { filter: brightness(.96); }

/* 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); }

/* ── MATCH NOTIFICATION POPUP ───────────────────────────── */
.match-notif {
  position: fixed; top: 80px; right: 14px; z-index: 9999;
  display: flex; align-items: flex-start; gap: 12px;
  background: #fff; color: #1a1a1a;
  border: 1px solid #ccc; border-left: 5px solid var(--green);
  border-radius: 10px; padding: 14px 16px;
  min-width: 260px; max-width: 320px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  transform: translateX(130%); transition: transform .35s cubic-bezier(.34,1.56,.64,1);
}
.match-notif.mn-visible { transform: translateX(0); }
.mn-icon { color: var(--green); font-size: 24px; margin-top: 2px; flex-shrink: 0; }
.mn-body { flex: 1; min-width: 0; }
.mn-title { font-size: 14px; font-weight: 800; color: #1a1a1a; }
.mn-detail { font-size: 13px; margin-top: 3px; color: #333; }
.mn-detail b { color: var(--green); font-size: 15px; }
.mn-sub { font-size: 11px; color: #888; margin-top: 3px;
          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-close {
  background: transparent; border: none; cursor: pointer;
  color: #aaa; font-size: 14px; padding: 0 2px; flex-shrink: 0; line-height: 1;
}
.mn-close:hover { color: #333; }

/* ── IN-PLAY DELAY ───────────────────────────────────────── */
.bs-inplay-badge {
  display: inline-flex; align-items: center;
  background: var(--red); color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: .4px;
  padding: 1px 5px; border-radius: 3px; margin-left: 6px;
  vertical-align: middle; text-transform: uppercase;
  animation: pulse-red 1.2s infinite;
}
@keyframes pulse-red { 0%,100%{opacity:1} 50%{opacity:.7} }

/* Countdown ring inside the Place bet button */
.cd-ring {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 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 / CLOSED MARKET — event-detail view ───────── */
.market-card.mkt-suspended, .market-card.mkt-closed { position: relative; }
.market-card.mkt-suspended .depth-cell,
.market-card.mkt-closed .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;
}
.market-card.mkt-closed .col-header-row::after {
  content: 'CLOSED';
  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;
}

/* ── MARKET LOCK BANNER — event-list view (Betfair "Closed") ─────────────
   Absolutely-positioned grid item: grid-column uses NEGATIVE line numbers so it
   always covers the 3 price columns immediately before the "›" column, on every
   breakpoint (where the matched column is hidden and line numbers shift). */
.row-lock {
  display: none;
  position: absolute;
  grid-column: -5 / -2;          /* the 3 price cells, never the trailing › cell */
  grid-row: 1;
  top: 4px; bottom: 4px; left: 0; right: 0;
  align-items: center; justify-content: center;
  z-index: 4;
  background: #fbeaec;
  border: 1px solid var(--red);
  border-radius: 2px;
  cursor: not-allowed;
}
.row-lock.show { display: flex; }
.row-lock span {
  color: var(--red);
  font-size: 12px; font-weight: 800; letter-spacing: .6px;
  text-transform: uppercase;
}
.row-lock.is-suspended { background: #fff4e0; border-color: #d98000; }
.row-lock.is-suspended span { color: #b56500; }
/* belt-and-suspenders: cells under the banner are not interactive */
.event-row.row-locked .price-cell:not(.more) { pointer-events: none; }

/* ── 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(0,0,0,.06); border: 1px solid rgba(0,0,0,.25); border-radius: 3px;
  color: #303030; cursor: pointer; font-size: 13px;
}
.theme-toggle:hover { background: rgba(0,0,0,.12); color: #000; }

.conn-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 10px; font-size: 11px; font-weight: 600;
  color: var(--nav-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: #1e1e1e; font-size: 12px; font-weight: 700;
}
.user-chip i { color: #303030; 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 #000; 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; }

/* Account trigger (clickable chip → opens account menu) */
.account-trigger {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; padding: 3px 8px 3px 4px; border-radius: 6px;
  transition: background .12s;
}
.account-trigger:hover { background: rgba(0,0,0,.10); }
.acct-caret { color: rgba(0,0,0,.55); font-size: 10px; }

/* ── Betfair-style dropdown menus ─────────────────────────── */
.bf-dropdown {
  position: fixed; z-index: 5000;
  background: #fff; color: var(--text-0);
  border: 1px solid #c9c9c9; border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,.28);
  min-width: 244px; overflow: hidden;
  animation: bfDrop .14s ease;
}
@keyframes bfDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Account header */
.bf-acct-hd {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px; background: var(--brand-dark); color: #fff;
}
.bf-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-green); color: #06251a;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; flex-shrink: 0;
}
.bf-acct-name { font-weight: 800; font-size: 14px; }
.bf-acct-role { font-size: 11px; color: var(--brand-yellow); margin-top: 1px; }
.bf-acct-bal { padding: 10px 16px; border-bottom: 1px solid #eee; }
.bf-acct-bal > div { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 3px 0; }
.bf-acct-bal span { color: var(--text-2); }
.bf-acct-bal b { font-family: monospace; font-size: 14px; }
.bf-acct-bal b.pos { color: var(--green); }
.bf-acct-bal b.amb { color: #c98a00; }

/* Menu items */
.bf-menu { padding: 6px; }
.bf-menu a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: 6px;
  font-size: 13px; color: var(--text-0); cursor: pointer; text-decoration: none;
}
.bf-menu a i { width: 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.bf-menu a:hover { background: #f0f4f8; }
.bf-menu a.bf-danger { color: var(--red); }
.bf-menu a.bf-danger i { color: var(--red); }
.bf-menu a.bf-danger:hover { background: #fdeaea; }
.bf-sep { height: 1px; background: #eee; margin: 5px 0; }

/* Settings dropdown */
.bf-set-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; font-weight: 800; font-size: 13px;
  background: var(--bg-light); border-bottom: 1px solid #eee;
}
.bf-set-hd i { color: var(--brand-green); }
.bf-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #f2f2f2;
}
.bf-toggle:hover { background: #fafcff; }
.bf-toggle input { width: 18px; height: 18px; accent-color: var(--brand-green); cursor: pointer; }
.bf-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; font-size: 13px; border-bottom: 1px solid #f2f2f2;
}
.bf-stake {
  width: 80px; padding: 6px 8px; border: 1px solid #ccc; border-radius: 5px;
  font: 700 13px monospace; text-align: right; color: var(--text-0); outline: none;
}
.bf-stake:focus { border-color: var(--brand-green); }
.bf-lang { display: flex; gap: 4px; }
.bf-lang button {
  width: 34px; padding: 5px 0; border: 1px solid #ccc; border-radius: 5px;
  background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; color: var(--text-2);
}
.bf-lang button.on { background: var(--brand-green); color: #fff; border-color: var(--brand-green); }

/* Statement modal body */
.stmt-body { max-height: 60vh; overflow: auto; padding: 4px 0; }
.stmt-loading { padding: 24px; text-align: center; color: var(--text-3); }
.stmt-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid #f0f0f0;
}
.stmt-type { font-size: 12px; font-weight: 700; color: var(--text-0); text-transform: capitalize; }
.stmt-date { font-size: 10px; color: var(--text-3); margin-top: 2px; }
.stmt-amt { font-family: monospace; font-weight: 800; font-size: 13px; }
.stmt-amt.pos { color: var(--green); }
.stmt-amt.neg { color: var(--red); }

/* Dark mode for dropdowns */
body.dark .bf-dropdown { background: #1c1f26; border-color: #333; color: #e2e8f0; }
body.dark .bf-menu a { color: #e2e8f0; }
body.dark .bf-menu a:hover { background: #262a33; }
body.dark .bf-toggle, body.dark .bf-row { border-color: #2a2d34; }
body.dark .bf-toggle:hover { background: #23262d; }
body.dark .bf-set-hd { background: #16181c; border-color: #2a2d34; }
body.dark .bf-sep, body.dark .bf-acct-bal { border-color: #2a2d34; }
body.dark .bf-stake, body.dark .bf-lang button { background: #11141a; color: #e2e8f0; border-color: #333; }
body.dark .stmt-row { border-color: #23262d; }

.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: #ffb80c; }
.auth-submit {
  margin-top: 14px; padding: 11px; background: #ffb80c; 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 cards ─────────────────────────────────────── */
.ob-card {
  background: var(--bg-light); border: 1px solid var(--border);
  border-radius: 6px; margin: 6px 6px 2px; padding: 9px 10px;
  transition: box-shadow .12s;
}
.ob-card.ob-unmatched { border-left: 3px solid var(--orange); }
.ob-header { display: flex; align-items: flex-start; gap: 6px; }
.ob-info { flex: 1; min-width: 0; }
.ob-name { font-size: 12px; font-weight: 700; }
.ob-sub { font-size: 10px; color: var(--text-2); margin-top: 1px;
          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-details {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px;
  font-size: 11px; color: var(--text-1);
}
.ob-liab { color: var(--red); font-weight: 700; }
.ob-profit { color: var(--green); font-weight: 700; }

/* Unmatched badge bar */
.ob-unmatched-bar {
  margin-top: 7px; padding: 5px 8px;
  background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.25);
  border-radius: 5px; display: flex; align-items: center;
}
.ob-badge-unmatched {
  font-size: 10px; font-weight: 700; color: var(--orange);
  text-transform: uppercase; letter-spacing: .3px;
  animation: pulseSoon 1.4s infinite;
}

/* Edit row (quota + importo + azioni) */
.ob-edit-row {
  margin-top: 8px; display: flex; gap: 7px; align-items: flex-end; flex-wrap: wrap;
}
.ob-edit-field { display: flex; flex-direction: column; flex: 1; min-width: 80px; }
.ob-edit-field label {
  font-size: 9px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px;
}
.ob-edit-field input {
  width: 100%; padding: 6px 7px;
  border: 1px solid var(--border); border-radius: 5px;
  background: var(--white); font: 700 12px monospace; color: var(--text-0);
  outline: none;
}
.ob-edit-field input:focus { border-color: var(--orange); }

/* Stepper inline quota */
.ob-stepper { display: flex; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.ob-stepper button {
  width: 24px; border: none; background: var(--bg-light2);
  cursor: pointer; font-size: 14px; font-weight: 700; color: var(--text-1);
}
.ob-stepper button:hover { background: #d8d8d8; }
.ob-stepper input {
  flex: 1; min-width: 0; border: none; border-left: 1px solid var(--border);
  border-right: 1px solid var(--border); text-align: center;
  padding: 6px 3px; font: 700 12px monospace; color: var(--text-0);
  background: var(--white); outline: none;
}

/* Save / Cancel action buttons */
.ob-edit-actions { display: flex; gap: 5px; align-self: flex-end; }
.ob-btn-save {
  width: 32px; height: 32px; border: none; border-radius: 6px;
  background: var(--green); color: #fff; cursor: pointer; font-size: 13px;
}
.ob-btn-save:hover { filter: brightness(1.12); }
.ob-btn-cancel {
  width: 32px; height: 32px; border: none; border-radius: 6px;
  background: var(--red-bg); border: 1px solid var(--red); color: var(--red);
  cursor: pointer; font-size: 13px;
}
.ob-btn-cancel:hover { background: var(--red); color: #fff; }

/* Matched bar */
.ob-matched-bar {
  margin-top: 7px; display: flex; align-items: center; justify-content: space-between;
}
.ob-badge-matched {
  font-size: 10px; font-weight: 700; color: var(--green);
  text-transform: uppercase; letter-spacing: .3px;
}
.ob-btn-cancel-small {
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-2); border-radius: 4px; padding: 2px 6px;
  font-size: 10px; cursor: pointer;
}
.ob-btn-cancel-small:hover { border-color: var(--red); color: var(--red); }

/* Partial bet: two-section layout (matched ↑ / queued ↓) */
.ob-card.ob-partial { border-left: 3px solid var(--orange); }
.ob-section-matched {
  margin-top: 7px; padding: 6px 8px;
  background: rgba(74,222,128,.07); border: 1px solid rgba(74,222,128,.25);
  border-radius: 5px 5px 0 0;
}
.ob-section-queue {
  padding: 6px 8px;
  background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.25);
  border-top: none; border-radius: 0 0 5px 5px;
}
.ob-section-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.ob-section-amt { font-size: 12px; font-weight: 700; color: var(--text-0); }
.ob-section-matched .ob-matched-bar { margin-top: 5px; }
.ob-section-queue .ob-edit-row { margin-top: 5px; }

/* Compact single-line edit row for the queued portion of partial bets */
.ob-edit-compact { flex-wrap: nowrap; gap: 5px; align-items: center; }
.ob-stepper-grow { flex: 1 1 0; min-width: 90px; }
.ob-compact-amount {
  flex: 0 0 68px; min-width: 0;
  padding: 6px 5px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--white); font: 700 12px monospace; color: var(--text-0);
  outline: none; -moz-appearance: textfield; text-align: right;
}
.ob-compact-amount::-webkit-outer-spin-button,
.ob-compact-amount::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ob-compact-amount:focus { border-color: var(--orange); }

/* Cash Out button */
.ob-cashout-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: 5px; cursor: pointer;
  padding: 7px 12px; font: 700 12px inherit; color: #fff;
  background: var(--brand-green); transition: filter .12s, background .12s;
}
.ob-cashout-btn i { font-size: 12px; }
.ob-cashout-btn:hover:not(:disabled) { filter: brightness(1.08); }
.ob-cashout-btn.co-pos { background: var(--green); }
.ob-cashout-btn.co-neg { background: #c98a00; }     /* amber when cashing out at a loss */
.ob-cashout-btn.co-na, .ob-cashout-btn:disabled {
  background: var(--bg-light2); color: var(--text-3); cursor: default;
}

/* ─────────────────────────────────────────────────────────────
   OPEN BETS THEME PICKER
   ───────────────────────────────────────────────────────────── */
.ob-theme-picker {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 6px 8px 5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
  align-items: center;
}
.ob-theme-picker-label {
  font-size: 9px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .4px; margin-right: 2px;
}
.ob-theme-btn {
  width: 22px; height: 20px; border: 1px solid var(--border);
  border-radius: 3px; background: var(--white); cursor: pointer;
  font-size: 9px; font-weight: 700; color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1; flex-shrink: 0;
  transition: border-color .1s, background .1s, color .1s;
}
.ob-theme-btn:hover { border-color: var(--orange); color: var(--orange); }
.ob-theme-btn.ob-theme-active {
  background: #1a1a1a; border-color: #1a1a1a; color: #fff;
}

/* ─────────────────────────────────────────────────────────────
   THEME 1 — Refined Classic  (top-accent card, shadow)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="1"] .ob-card {
  border: none; border-radius: 8px; margin: 7px 7px 3px;
  padding: 10px 13px;
  box-shadow: 0 2px 10px rgba(0,0,0,.09);
  border-top: 3px solid #4a90d9;
}
#betslipBody[data-ob-theme="1"] .ob-card.ob-unmatched,
#betslipBody[data-ob-theme="1"] .ob-card.ob-partial { border-top-color: var(--orange); }
#betslipBody[data-ob-theme="1"] .ob-name { font-size: 13px; }
#betslipBody[data-ob-theme="1"] .ob-details { font-size: 12px; gap: 10px; }
#betslipBody[data-ob-theme="1"] .ob-cashout-btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ─────────────────────────────────────────────────────────────
   THEME 2 — Betfair Pro  (dark header strip per card)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="2"] .ob-card {
  border-radius: 0; margin: 0 0 2px; padding: 0;
  background: transparent; border: none; box-shadow: none;
  border-left: none; overflow: hidden;
}
#betslipBody[data-ob-theme="2"] .ob-header {
  background: #303030; color: #fff; padding: 6px 10px;
}
#betslipBody[data-ob-theme="2"] .ob-name { color: #fff; font-size: 12px; }
#betslipBody[data-ob-theme="2"] .ob-sub { color: #aaa; }
#betslipBody[data-ob-theme="2"] .sel-side {
  background: rgba(255,255,255,.13); padding: 2px 8px;
  border-radius: 3px; font-size: 10px; color: #ddd;
}
#betslipBody[data-ob-theme="2"] .ob-details {
  background: #f5f7fa; padding: 6px 10px;
  border-bottom: 1px solid #e0e3e8; margin-top: 0; font-size: 12px;
}
#betslipBody[data-ob-theme="2"] .ob-unmatched-bar,
#betslipBody[data-ob-theme="2"] .ob-matched-bar { background: #f5f7fa; padding: 5px 10px; margin-top: 0; }
#betslipBody[data-ob-theme="2"] .ob-section-matched { border-radius: 0; margin-top: 0; }
#betslipBody[data-ob-theme="2"] .ob-section-queue { border-radius: 0; }
#betslipBody[data-ob-theme="2"] .ob-edit-row { padding: 5px 10px 8px; background: #f5f7fa; }
#betslipBody[data-ob-theme="2"] .ob-cashout-btn {
  border-radius: 0; width: 100%; justify-content: center;
}

/* ─────────────────────────────────────────────────────────────
   THEME 3 — Ultra Compact  (dense list, no radius, tiny text)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="3"] .ob-card {
  border-radius: 0; margin: 0; padding: 4px 8px 5px;
  background: transparent; border: none; border-left: 3px solid var(--green);
  box-shadow: none; border-bottom: 1px solid var(--border-light);
}
#betslipBody[data-ob-theme="3"] .ob-card.ob-unmatched,
#betslipBody[data-ob-theme="3"] .ob-card.ob-partial { border-left-color: var(--orange); }
#betslipBody[data-ob-theme="3"] .ob-name { font-size: 11px; }
#betslipBody[data-ob-theme="3"] .ob-sub { font-size: 9px; }
#betslipBody[data-ob-theme="3"] .ob-details { font-size: 10px; margin-top: 2px; gap: 6px; }
#betslipBody[data-ob-theme="3"] .ob-unmatched-bar { margin-top: 2px; padding: 2px 5px; }
#betslipBody[data-ob-theme="3"] .ob-badge-unmatched,
#betslipBody[data-ob-theme="3"] .ob-badge-matched { font-size: 9px; }
#betslipBody[data-ob-theme="3"] .ob-matched-bar { margin-top: 3px; }
#betslipBody[data-ob-theme="3"] .ob-cashout-btn { padding: 4px 8px; font-size: 10px; }
#betslipBody[data-ob-theme="3"] .ob-section-matched,
#betslipBody[data-ob-theme="3"] .ob-section-queue { padding: 3px 6px; }
#betslipBody[data-ob-theme="3"] .ob-edit-field label { font-size: 8px; margin-bottom: 2px; }
#betslipBody[data-ob-theme="3"] .ob-edit-row { margin-top: 4px; gap: 4px; }

/* ─────────────────────────────────────────────────────────────
   THEME 4 — Betting Ticket  (ivory, dashed border, serif-ish)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="4"] .ob-card {
  border-radius: 6px; margin: 7px 8px; padding: 10px 12px;
  background: #fffef7; border: 1.5px dashed #c9b96a;
  box-shadow: 2px 2px 6px rgba(160,140,60,.12);
}
#betslipBody[data-ob-theme="4"] .ob-card.ob-unmatched,
#betslipBody[data-ob-theme="4"] .ob-card.ob-partial { border-color: #e0921e; background: #fffbf0; }
#betslipBody[data-ob-theme="4"] .ob-name { font-size: 13px; }
#betslipBody[data-ob-theme="4"] .ob-sub { color: #a08040; }
#betslipBody[data-ob-theme="4"] .ob-details {
  margin-top: 7px; padding-top: 7px;
  border-top: 1px dashed #d4c070; font-size: 11px; gap: 8px;
}
#betslipBody[data-ob-theme="4"] .ob-matched-bar {
  margin-top: 7px; padding-top: 7px; border-top: 1px dashed #d4c070;
}
#betslipBody[data-ob-theme="4"] .ob-section-matched {
  margin-top: 7px; border-top: 1px dashed #d4c070; background: transparent; border: none;
  border-top: 1px dashed #8cb86e; padding-top: 5px;
}
#betslipBody[data-ob-theme="4"] .ob-section-queue {
  border: none; border-top: 1px dashed #d4a040; padding-top: 5px;
}
#betslipBody[data-ob-theme="4"] .ob-cashout-btn { border-radius: 20px; }

/* ─────────────────────────────────────────────────────────────
   THEME 5 — Profit Hero  (P&L number is the focal point)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="5"] .ob-card {
  border-radius: 8px; margin: 6px; padding: 10px 12px;
  border: 1px solid var(--border); background: var(--white);
  box-shadow: none;
}
#betslipBody[data-ob-theme="5"] .ob-profit { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
#betslipBody[data-ob-theme="5"] .ob-liab   { font-size: 22px; font-weight: 900; letter-spacing: -.5px; }
#betslipBody[data-ob-theme="5"] .ob-details {
  flex-direction: column-reverse; gap: 2px; align-items: flex-start; margin-top: 5px;
}
#betslipBody[data-ob-theme="5"] .ob-cashout-btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ─────────────────────────────────────────────────────────────
   THEME 6 — Night / Dark  (dark bg, neon accents)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="6"] .ob-card {
  background: #1e2330; border: 1px solid #2a3040;
  border-radius: 7px; margin: 5px 6px; padding: 10px 11px;
  box-shadow: 0 3px 12px rgba(0,0,0,.35);
  border-left: 3px solid #3a8fd9;
}
#betslipBody[data-ob-theme="6"] .ob-card.ob-unmatched,
#betslipBody[data-ob-theme="6"] .ob-card.ob-partial { border-left-color: #fb923c; }
#betslipBody[data-ob-theme="6"] .ob-name { color: #dce8f8; font-size: 12px; }
#betslipBody[data-ob-theme="6"] .ob-sub  { color: #5a6a80; }
#betslipBody[data-ob-theme="6"] .ob-details { color: #8090a8; }
#betslipBody[data-ob-theme="6"] .ob-profit { color: #4ade80; }
#betslipBody[data-ob-theme="6"] .ob-liab   { color: #f87171; }
#betslipBody[data-ob-theme="6"] .sel-side  { color: #7090b8; }
#betslipBody[data-ob-theme="6"] .ob-badge-matched   { color: #4ade80; }
#betslipBody[data-ob-theme="6"] .ob-badge-unmatched { color: #fb923c; }
#betslipBody[data-ob-theme="6"] .ob-unmatched-bar { background: rgba(251,146,60,.08); border-color: rgba(251,146,60,.2); }
#betslipBody[data-ob-theme="6"] .ob-section-matched { background: rgba(74,222,128,.06); border-color: rgba(74,222,128,.18); }
#betslipBody[data-ob-theme="6"] .ob-section-queue   { background: rgba(251,146,60,.06); border-color: rgba(251,146,60,.18); }
#betslipBody[data-ob-theme="6"] .ob-section-amt { color: #b0c0d8; }
#betslipBody[data-ob-theme="6"] .ob-edit-field label { color: #5a6a80; }
#betslipBody[data-ob-theme="6"] .ob-edit-field input,
#betslipBody[data-ob-theme="6"] .ob-stepper input,
#betslipBody[data-ob-theme="6"] .ob-compact-amount { background: #252b35; border-color: #3a4455; color: #dce8f8; }
#betslipBody[data-ob-theme="6"] .ob-stepper button { background: #2d3340; color: #8090a8; }
#betslipBody[data-ob-theme="6"] .ob-stepper { border-color: #3a4455; }

/* ─────────────────────────────────────────────────────────────
   THEME 7 — Split: left info / right action
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="7"] .ob-card {
  display: flex; flex-direction: row; align-items: stretch; gap: 0;
  border-radius: 6px; margin: 6px; padding: 0; overflow: hidden;
  border: 1px solid var(--border); background: var(--white); box-shadow: none;
}
#betslipBody[data-ob-theme="7"] .ob-card > *:not(.ob-matched-bar):not(.ob-unmatched-bar) { flex: 1; min-width: 0; }
/* Left info column */
#betslipBody[data-ob-theme="7"] .ob-header { padding: 8px 10px 0; flex: 1; }
#betslipBody[data-ob-theme="7"] .ob-details { padding: 4px 10px 8px; margin-top: 0; flex: 1; font-size: 11px; }
/* Right action column — cashout button stacked vertically */
#betslipBody[data-ob-theme="7"] .ob-matched-bar {
  margin-top: 0; flex-direction: column; justify-content: center; gap: 4px;
  padding: 8px 8px; background: #f4f8fc;
  border-left: 1px solid var(--border); min-width: 100px; max-width: 110px;
}
#betslipBody[data-ob-theme="7"] .ob-unmatched-bar {
  margin-top: 0; padding: 8px 8px;
  background: rgba(245,158,11,.06);
  border-left: 1px solid rgba(245,158,11,.25);
  min-width: 80px; max-width: 90px;
  align-items: flex-start;
}
#betslipBody[data-ob-theme="7"] .ob-cashout-btn { width: 100%; justify-content: center; padding: 5px 6px; font-size: 11px; }
/* Partial: keep sections in left column, override flex */
#betslipBody[data-ob-theme="7"] .ob-section-matched,
#betslipBody[data-ob-theme="7"] .ob-section-queue { flex: 1; }

/* ─────────────────────────────────────────────────────────────
   THEME 8 — Gradient Header  (back=blue, lay=pink gradient)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="8"] .ob-card {
  border-radius: 8px; margin: 7px 7px 3px; padding: 0; overflow: hidden;
  border: none; box-shadow: 0 3px 12px rgba(0,0,0,.12);
}
#betslipBody[data-ob-theme="8"] .ob-header {
  background: linear-gradient(135deg, #1a5fa8 0%, #4a90d9 100%);
  padding: 9px 12px; color: #fff;
}
/* Lay cards get a different header gradient — we detect via side badge */
#betslipBody[data-ob-theme="8"] .ob-header .sel-side:contains("LAY") { background: transparent; }
/* Fallback: alternate header tint for unmatched/partial */
#betslipBody[data-ob-theme="8"] .ob-card.ob-unmatched .ob-header,
#betslipBody[data-ob-theme="8"] .ob-card.ob-partial .ob-header {
  background: linear-gradient(135deg, #9a5200 0%, #ffb80c 100%);
}
#betslipBody[data-ob-theme="8"] .ob-name { color: #fff; font-size: 13px; }
#betslipBody[data-ob-theme="8"] .ob-sub  { color: rgba(255,255,255,.75); }
#betslipBody[data-ob-theme="8"] .sel-side { background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 3px; color: #fff; }
#betslipBody[data-ob-theme="8"] .ob-details { padding: 8px 12px 4px; font-size: 12px; gap: 10px; }
#betslipBody[data-ob-theme="8"] .ob-matched-bar { padding: 4px 12px 9px; margin-top: 0; }
#betslipBody[data-ob-theme="8"] .ob-unmatched-bar { margin: 0; padding: 6px 12px 8px; border: none; border-top: 1px solid rgba(245,158,11,.2); border-radius: 0; }
#betslipBody[data-ob-theme="8"] .ob-section-matched { margin: 0; border-radius: 0; padding: 5px 12px; }
#betslipBody[data-ob-theme="8"] .ob-section-queue { border-radius: 0; padding: 5px 12px; }
#betslipBody[data-ob-theme="8"] .ob-cashout-btn { border-radius: 4px; }

/* ─────────────────────────────────────────────────────────────
   THEME 9 — Rounded Bubbles  (iOS-style pill cards)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="9"] .ob-card {
  border-radius: 16px; margin: 7px 8px; padding: 12px 14px;
  background: var(--white); border: 1.5px solid var(--border);
  box-shadow: 0 4px 14px rgba(0,0,0,.07);
}
#betslipBody[data-ob-theme="9"] .ob-card.ob-unmatched,
#betslipBody[data-ob-theme="9"] .ob-card.ob-partial {
  border-color: var(--orange); background: #fffbf5;
}
#betslipBody[data-ob-theme="9"] .ob-name { font-size: 13px; font-weight: 800; }
#betslipBody[data-ob-theme="9"] .ob-sub  { font-size: 11px; }
#betslipBody[data-ob-theme="9"] .sel-side {
  padding: 3px 10px; border-radius: 20px; font-size: 10px;
  background: #e8f0fb; color: #1a5fa8;
}
#betslipBody[data-ob-theme="9"] .ob-details {
  margin-top: 8px; gap: 8px; font-size: 12px;
  padding-top: 8px; border-top: 1px solid var(--border-light);
}
#betslipBody[data-ob-theme="9"] .ob-badge-matched {
  background: #dcfce7; color: #166534; padding: 2px 8px;
  border-radius: 20px; font-size: 10px;
}
#betslipBody[data-ob-theme="9"] .ob-badge-unmatched {
  background: #fff7ed; color: #9a3412; padding: 2px 8px;
  border-radius: 20px; font-size: 10px;
}
#betslipBody[data-ob-theme="9"] .ob-cashout-btn { border-radius: 20px; width: 100%; justify-content: center; margin-top: 8px; }
#betslipBody[data-ob-theme="9"] .ob-section-matched { border-radius: 10px 10px 0 0; }
#betslipBody[data-ob-theme="9"] .ob-section-queue   { border-radius: 0 0 10px 10px; }
#betslipBody[data-ob-theme="9"] .ob-edit-field input,
#betslipBody[data-ob-theme="9"] .ob-stepper { border-radius: 8px; }

/* ─────────────────────────────────────────────────────────────
   THEME 10 — Sports Broadcast  (dark navy, gold odds)
   ───────────────────────────────────────────────────────────── */
#betslipBody[data-ob-theme="10"] .ob-card {
  background: #0f1623; border: 1px solid #1e2d42;
  border-radius: 0; margin: 0 0 2px; padding: 10px 12px;
  box-shadow: none; border-left: 4px solid #ffd700;
}
#betslipBody[data-ob-theme="10"] .ob-card.ob-unmatched,
#betslipBody[data-ob-theme="10"] .ob-card.ob-partial { border-left-color: #ff8c00; }
#betslipBody[data-ob-theme="10"] .ob-name { color: #ffffff; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }
#betslipBody[data-ob-theme="10"] .ob-sub  { color: #4a6080; font-size: 10px; }
#betslipBody[data-ob-theme="10"] .sel-side { color: #7090a8; font-size: 9px; }
#betslipBody[data-ob-theme="10"] .ob-details { color: #7090a8; font-size: 11px; margin-top: 5px; }
#betslipBody[data-ob-theme="10"] .ob-details b { color: #ffd700; font-size: 15px; }
#betslipBody[data-ob-theme="10"] .ob-profit { color: #4ade80; font-size: 13px; }
#betslipBody[data-ob-theme="10"] .ob-liab   { color: #f87171; font-size: 13px; }
#betslipBody[data-ob-theme="10"] .ob-badge-matched   { color: #4ade80; }
#betslipBody[data-ob-theme="10"] .ob-badge-unmatched { color: #ff8c00; }
#betslipBody[data-ob-theme="10"] .ob-unmatched-bar { background: rgba(255,140,0,.07); border-color: rgba(255,140,0,.2); }
#betslipBody[data-ob-theme="10"] .ob-section-matched { background: rgba(74,222,128,.05); border-color: rgba(74,222,128,.15); }
#betslipBody[data-ob-theme="10"] .ob-section-queue   { background: rgba(255,140,0,.05); border-color: rgba(255,140,0,.15); }
#betslipBody[data-ob-theme="10"] .ob-section-amt { color: #b0c8e0; }
#betslipBody[data-ob-theme="10"] .ob-edit-field label { color: #4a6080; }
#betslipBody[data-ob-theme="10"] .ob-edit-field input,
#betslipBody[data-ob-theme="10"] .ob-stepper input,
#betslipBody[data-ob-theme="10"] .ob-compact-amount { background: #182030; border-color: #2a3d55; color: #dce8f8; }
#betslipBody[data-ob-theme="10"] .ob-stepper button { background: #1e2d42; color: #6080a0; }
#betslipBody[data-ob-theme="10"] .ob-stepper { border-color: #2a3d55; }
#betslipBody[data-ob-theme="10"] .ob-cashout-btn { border-radius: 2px; }

/* ── Inline quick-bet row (appears below clicked event) ──── */
.inline-qb-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 12px;
  background: #e8f3fb; border-bottom: 2px solid #9ec8e8;
  font-size: 12px;
}
.inline-qb-row.lay { background: #fce8ee; border-bottom-color: #e8a0b4; }
.event-row.qb-active { background: #d5eaf8 !important; }
.iqb-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.iqb-label { font-size: 10px; font-weight: 700; color: #1a5fa8; text-transform: uppercase; letter-spacing: .3px; }
.inline-qb-row.lay .iqb-label { color: #a83060; }
.iqb-name { font-size: 12px; font-weight: 600; color: var(--text-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iqb-cancel {
  padding: 6px 14px; border: 1px solid #bbb; border-radius: 3px;
  background: #d4d4d4; color: #333; font-size: 12px; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.iqb-cancel:hover { background: #c0c0c0; }
.iqb-stepper { display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.iqb-stepper button {
  width: 26px; border: none; background: #e0e0e0;
  cursor: pointer; font-size: 15px; font-weight: 700; color: #333; padding: 0;
}
.iqb-stepper button:hover { background: #c8c8c8; }
.iqb-stepper input {
  width: 62px; border: none;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  text-align: center; padding: 6px 2px; font: 700 13px monospace; color: #000;
  background: var(--back-1); outline: none; -moz-appearance: textfield;
}
.iqb-stepper input.lay-odds { background: var(--lay-1); }
.iqb-stepper input::-webkit-outer-spin-button,
.iqb-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.iqb-stake {
  width: 80px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 3px;
  background: #fff; font: 700 13px monospace; color: #000; outline: none;
  -moz-appearance: textfield; flex-shrink: 0;
}
.iqb-stake:focus { border-color: var(--orange); }
.iqb-stake::-webkit-outer-spin-button,
.iqb-stake::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.iqb-place {
  flex-shrink: 0; padding: 6px 18px; border: none; border-radius: 3px;
  background: #ffb80c; color: #1e1e1e; font: 700 13px inherit; cursor: pointer;
}
.iqb-place:hover:not(:disabled) { filter: brightness(1.08); }
.iqb-place:disabled { opacity: .5; cursor: default; }

/* ── MY BETS view ─────────────────────────────────────────── */
#myBetsView { background: var(--white); min-height: 100%; }
.mb-loading { padding: 40px; text-align: center; color: var(--text-3); }
.mb-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--hdr-bg); color: #fff; padding: 9px 14px;
}
.mb-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.mb-back {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
  color: #fff; border-radius: 5px; padding: 6px 12px; font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.mb-back:hover { background: rgba(255,255,255,.22); }
.mb-summary {
  display: flex; gap: 0; background: var(--bg-light); border-bottom: 1px solid var(--border);
}
.mb-summary > div {
  flex: 1; padding: 10px 14px; border-right: 1px solid var(--border-light);
  display: flex; flex-direction: column; gap: 2px;
}
.mb-summary > div:last-child { border-right: none; }
.mb-summary span { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.mb-summary b { font-size: 16px; font-family: monospace; }
.mb-summary b.pos { color: var(--green); }
.mb-summary b.neg { color: var(--red); }

.mb-filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--white);
}
.mb-fgroup { display: flex; gap: 2px; background: var(--bg-light); border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.mb-pill {
  border: none; background: transparent; cursor: pointer;
  padding: 5px 11px; border-radius: 5px; font-size: 12px; font-weight: 600; color: var(--text-2);
}
.mb-pill:hover { color: var(--text-0); }
.mb-pill.on { background: var(--brand-green); color: #fff; }
.mb-search {
  display: flex; align-items: center; gap: 6px; flex: 1; min-width: 160px;
  background: var(--bg-light); border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px;
}
.mb-search i { color: var(--text-3); font-size: 12px; }
.mb-search input { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; color: var(--text-0); }

.mb-tablewrap { overflow-x: auto; }
.mb-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
.mb-table th {
  text-align: left; padding: 9px 12px; background: var(--bg-light2);
  font-size: 10px; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2);
  border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
.mb-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-light); white-space: nowrap; vertical-align: top; }
.mb-table td.num { text-align: right; font-family: monospace; }
.mb-table tr:hover td { background: #f7fafd; }
.mb-date { font-size: 11px; }
.mb-ev { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.mb-mkt { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.mb-side { padding: 2px 7px; border-radius: 3px; font-size: 10px; font-weight: 800; }
.mb-side.back { background: var(--back-1); color: #053; }
.mb-side.lay  { background: var(--lay-1); color: #503; }
.mb-status { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.mb-status.s-matched   { background: #d6ecff; color: #1a6cc4; }
.mb-status.s-unmatched { background: #fff0cc; color: #aa7700; }
.mb-status.s-won       { background: #d6f5e0; color: #1d8a44; }
.mb-status.s-lost      { background: #fde0e0; color: #c0271b; }
.mb-status.s-void, .mb-status.s-cancelled { background: #eaeaea; color: #777; }
.mb-status.s-cashed_out { background: #e6e0ff; color: #6a3fd0; }
.mb-table .pos { color: var(--green); font-weight: 700; }
.mb-table .neg { color: var(--red); font-weight: 700; }
.mb-table .muted { color: var(--text-3); }
.mb-co {
  border: none; background: var(--brand-green); color: #fff; cursor: pointer;
  border-radius: 5px; padding: 6px 10px; font-size: 11px; font-weight: 700; min-width: 92px;
}
.mb-co:hover:not(:disabled) { filter: brightness(1.08); }
.mb-co.co-neg { background: #c98a00; }
.mb-co:disabled { background: var(--bg-light2); color: var(--text-3); cursor: default; }
.mb-cancel {
  border: 1px solid var(--border); background: var(--white); color: var(--text-2);
  border-radius: 5px; padding: 6px 10px; font-size: 11px; cursor: pointer;
}
.mb-cancel:hover { border-color: var(--red); color: var(--red); }
.mb-empty { padding: 40px; text-align: center; color: var(--text-3); }

/* Dark mode */
body.dark #myBetsView { background: #15171c; }
body.dark .mb-summary, body.dark .mb-filters, body.dark .mb-table th { background: #1a1d23; }
body.dark .mb-table td { border-color: #23262d; }
body.dark .mb-table tr:hover td { background: #1e2128; }
body.dark .mb-fgroup, body.dark .mb-search { background: #11141a; border-color: #2a2d34; }

/* Mobile My Bets */
@media (max-width: 860px) {
  .mb-summary > div { padding: 8px 10px; }
  .mb-summary b { font-size: 14px; }
  .mb-filters { padding: 8px 10px; gap: 8px; }
  .mb-pill { padding: 6px 10px; }
  .mb-search input { font-size: 16px; }
}

/* ── 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: 300px; }
}

/* Mobile-only elements hidden on desktop by default */
.mob-backdrop, .mob-bottomnav, .mob-sheet-hd { display: none; }

/* ═══════════════════════════════════════════════════════════
   MOBILE  (≤ 860px) — phones & small tablets
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {

  /* ── Layout → single column, room for bottom nav ── */
  .layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .main {
    max-height: none;
    padding-bottom: 64px;           /* clear the bottom nav */
  }

  /* ── Top bar ── */
  .topbar { height: 46px; padding: 0 8px; }
  .brand { padding-right: 0; }
  .brand-plate { padding: 4px 9px; border-radius: 8px; }
  .brand-logo { height: 22px; }

  /* topbar-right becomes a dropdown account panel */
  .topbar-right {
    display: none;
    position: absolute; top: 46px; right: 6px;
    flex-direction: column; align-items: stretch; gap: 10px;
    background: var(--hdr-bg);
    border: 1px solid var(--hdr-border); border-radius: 10px;
    padding: 14px; width: min(320px, 92vw);
    box-shadow: 0 12px 36px rgba(0,0,0,.5);
    z-index: 300;
  }
  body.mob-account-open .topbar-right { display: flex; }
  .topbar-right .auth-group { flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
  .auth-fields { flex-direction: column; gap: 8px; }
  .auth-fields input { width: 100%; height: 40px; font-size: 15px; }
  .btn-login, .btn-join { width: 100%; height: 42px; justify-content: center; font-size: 14px; }
  .user-chip, .wallet-chip { width: 100%; justify-content: center; padding: 8px; }
  .lang-switcher { justify-content: center; gap: 16px; }
  .lang-btn { font-size: 24px !important; }
  .theme-toggle { align-self: center; }

  /* ── Sport nav → horizontal scroll ── */
  .sportnav {
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    height: 40px;
    scrollbar-width: none;
  }
  .sportnav::-webkit-scrollbar { display: none; }
  .sportnav a { padding: 0 14px; font-size: 13px; flex: 0 0 auto; }
  .nav-spacer, .nav-settings, .conn-badge { display: none; }

  /* ── LEFT SIDEBAR → off-canvas drawer ── */
  .sidebar-left {
    display: block;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; max-width: 84vw;
    background: var(--sb-bg);
    z-index: 250;
    transform: translateX(-100%);
    transition: transform .26s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
    padding-top: 8px;
  }
  body.mob-menu-open .sidebar-left { transform: translateX(0); }
  .sidebar-left .sidebar-toggle { display: none; }   /* desktop collapse bar irrelevant */
  /* bigger touch targets in drawer */
  .sports-list li, .sports-list a { min-height: 42px; }

  /* ── RIGHT SIDEBAR (betslip) → bottom sheet ── */
  .sidebar-right {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    max-height: 82vh;
    border-left: none; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    z-index: 260;
    transform: translateY(105%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -8px 36px rgba(0,0,0,.32);
  }
  body.mob-betslip-open .sidebar-right { transform: translateY(0); }
  .mob-sheet-hd {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; position: relative;
    border-bottom: 1px solid var(--border);
    background: var(--bg-light);
    border-radius: 16px 16px 0 0;
  }
  .mob-sheet-grab {
    position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 2px; background: #ccc;
  }
  .mob-sheet-title { font-size: 14px; font-weight: 800; color: var(--text-0); margin-top: 4px; }
  .mob-sheet-close {
    margin-left: auto; margin-top: 4px;
    width: 30px; height: 30px; border: none; background: var(--bg-light2);
    border-radius: 50%; cursor: pointer; color: var(--text-1); font-size: 14px;
  }
  /* hide live-stream + games in the sheet — declutter on mobile */
  .live-stream-box, .play-games-bar { display: none; }
  /* touch-friendly betslip controls */
  .betslip-tabs .bet-tab { padding: 12px 6px; font-size: 13px; }
  .stake-input, .odds-stepper input { height: 38px; font-size: 16px; }  /* 16px prevents iOS zoom */
  .step-btn { width: 38px; height: 38px; font-size: 18px; }
  .quick-stakes button { padding: 9px 4px; font-size: 13px; }
  .btn-place { padding: 14px; font-size: 15px; }

  /* ── Event list / odds grid ─────────────────────────────────
     Mobile layout: BACK + LAY entrambi visibili, celle più larghe.
     Colonna X nascosta per mercati 2-runner (tennis, baseball…).
     Grid: event-name | cell1 | cellX | cell2 | ›
     Ogni cella 72px → back(36) + lay(36) leggibili fino a "99.9"
  ── */

  /* Header row */
  .market-table-hd {
    grid-template-columns: minmax(0,1fr) 72px 72px 72px 22px;
    padding: 5px 8px; gap: 3px;
  }
  .col-matched { display: none; }
  .col-runner  { font-size: 10px; font-weight: 800; text-align: center; }

  /* Event row */
  .event-row {
    grid-template-columns: minmax(0,1fr) 72px 72px 72px 22px;
    padding: 8px 8px; gap: 3px; min-height: 52px; align-items: center;
  }
  .event-row .ev-matched, .event-row [id$="-matched"] { display: none; }

  /* Collapse no-runner columns (X for 2-runner sports like tennis) */
  .event-row .price-cell.no-runner { width: 0 !important; min-width: 0 !important; padding: 0 !important; border: none !important; overflow: hidden; }
  /* When X is hidden, stretch the remaining 2 cells */
  .event-row:has(.price-cell.no-runner) {
    grid-template-columns: minmax(0,1fr) 84px 0 84px 22px;
  }
  .market-table-hd:has(+ * .price-cell.no-runner) {
    grid-template-columns: minmax(0,1fr) 84px 0 84px 22px;
  }

  /* Event info: allow 2-line wrap */
  .event-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .event-name {
    font-size: 12.5px; font-weight: 700; line-height: 1.25;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  .event-meta { flex-wrap: wrap; gap: 3px; }
  .event-tag  { font-size: 10px; padding: 1px 5px; }

  /* Price cell: BACK + LAY visibili — 36px each inside 72px */
  .price-cell {
    height: 48px;
    border-radius: 0; overflow: hidden;
    border: 1px solid var(--border);
  }
  .price-cell .back, .price-cell .lay {
    padding: 2px 2px;
  }
  .price-cell .price {
    font-size: 12px; font-weight: 800;
    color: #000; white-space: nowrap;
  }
  .price-cell .size {
    font-size: 8px; color: rgba(0,0,0,.5); margin-top: 0;
    white-space: nowrap;
  }
  .price-cell.empty { background: #eee; }
  .price-cell.empty .back, .price-cell.empty .lay { background: #e8e8e8; }

  /* ›  more button */
  .price-cell.more { font-size: 14px; color: var(--text-2); }

  /* Group card header — cleaner */
  .group-card-hd {
    padding: 6px 8px; font-size: 11px; gap: 6px;
    border-radius: 0;
  }

  /* List header + filters */
  .list-header { flex-wrap: wrap; gap: 4px; padding: 5px 8px; }
  .list-title   { font-size: 13px; }
  .list-tabs    { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; display: flex; }
  .list-tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 6px 11px; font-size: 11px; flex: 0 0 auto; border-radius: 4px; }

  /* Search bar */
  .search-bar { padding: 6px 8px; }
  .search-bar input { font-size: 16px; } /* prevent iOS zoom */

  /* ── Event DETAIL view ─────────────────────────────────────
     Show name + best BACK + best LAY (3 columns).
     Level 2-3 depths removed — clean professional view.
  ── */
  .col-header-row, .runner-row {
    grid-template-columns: minmax(0,1fr) 1fr 1fr;
    padding: 0 10px;
  }
  .depth-cell.back-3, .depth-cell.back-2, .depth-cell.lay-2, .depth-cell.lay-3 { display: none; }
  .overround-back, .overround-lay, .ladder-btn { display: none; }
  /* Keep depth-4/5 hidden on mobile regardless of has-depth class */
  .depth-cell.back-4, .depth-cell.back-5,
  .depth-cell.lay-4,  .depth-cell.lay-5,
  .depth-hd { display: none !important; }

  /* Back/Lay tiles in detail */
  .depth-cell {
    height: 52px; border-radius: 6px; margin: 2px 2px;
  }
  .depth-cell .d-price { font-size: 15px; font-weight: 800; }
  .depth-cell .d-size  { font-size: 9px; margin-top: 1px; }

  /* Runner row */
  .runner-row {
    min-height: 56px; padding: 4px 10px;
    border-bottom: 1px solid var(--border-light);
  }
  .runner-name-cell {
    font-size: 12px; font-weight: 700;
    padding-right: 8px;
  }
  .runner-name-cell .rspark { display: none; }    /* hide sparkline → more name space */
  .runner-name-cell .runner-label { flex: 1; white-space: normal; line-height: 1.2; }

  /* Col headers (Back/Lay) */
  .col-header-row { padding: 6px 10px; background: var(--bg-light); }
  .back-all-btn, .lay-all-btn { border-radius: 4px; font-size: 12px; padding: 5px 0; }

  /* Event detail header */
  .event-detail-header {
    padding: 10px 10px 8px;
    flex-wrap: wrap; gap: 8px;
  }
  .event-detail-header .ev-name { font-size: 15px; line-height: 1.3; }
  .event-detail-header .ev-meta { flex-wrap: wrap; gap: 5px; font-size: 11px; }
  .back-to-list { font-size: 12px; padding: 5px 10px; }
  .live-badge   { font-size: 10px; padding: 2px 7px; }

  /* Other markets — full width stacked */
  .other-content { padding: 0; }
  .other-content .market-condensed { width: 100% !important; border-right: none; }
  .cm-row {
    grid-template-columns: minmax(0,1fr) 110px;
    padding: 8px 10px; min-height: 44px; align-items: center;
  }
  .cm-name { font-size: 12px; }
  .cm-price-cell { height: 44px; border-radius: 5px; overflow: hidden; }
  .cm-price-cell .cm-back, .cm-price-cell .cm-lay { padding: 2px 4px; }

  /* Market header */
  .market-condensed-hd { padding: 8px 10px; }
  .mc-title { font-size: 12px; }
  .mc-stat  { font-size: 10px; }
  .market-card-hd { padding: 8px 10px 6px; }
  .event-detail-mkt-name { font-size: 13px; }

  /* Feature bar */
  .feature-bar { padding: 6px 10px; gap: 8px; overflow-x: auto; flex-wrap: nowrap; }
  .feature-bar::-webkit-scrollbar { display: none; }
  .fb-item { flex: 0 0 auto; font-size: 11px; }

  /* ── Backdrop ── */
  .mob-backdrop {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 240;
    opacity: 0; pointer-events: none; transition: opacity .26s;
  }
  body.mob-menu-open .mob-backdrop,
  body.mob-betslip-open .mob-backdrop { opacity: 1; pointer-events: auto; }

  /* ── Bottom navigation bar ── */
  .mob-bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    height: 56px; background: var(--hdr-bg);
    border-top: 1px solid var(--hdr-border);
    z-index: 270;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mob-nav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; background: none; border: none; cursor: pointer;
    color: var(--hdr-text); font-size: 9.5px; font-weight: 600; position: relative;
    font-family: inherit;
  }
  .mob-nav-btn i { font-size: 18px; }
  .mob-nav-btn.active { color: var(--brand-green); }
  .mob-nav-btn:active { background: rgba(255,255,255,.06); }
  .mob-bet-badge {
    position: absolute; top: 4px; right: calc(50% - 22px);
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--brand-yellow); color: #1a1a1a;
    border-radius: 8px; font-size: 10px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
  }
}

/* Extra-small phones (≤360px) */
@media (max-width: 360px) {
  .market-table-hd, .event-row { grid-template-columns: minmax(0,1fr) 54px 54px 54px 22px; }
  .price-cell .price { font-size: 12px; }
  .mob-nav-btn span:not(.mob-bet-badge) { font-size: 9px; }
  .event-name { font-size: 12px; }
}

/* Dark mode: mobile price cells */
@media (max-width: 860px) {
  body.dark .event-row .price-cell .back { background: #1a3a5e; }
  body.dark .event-row .price-cell:not(.empty):hover .back { background: #1e4470; }
  body.dark .price-cell .price { color: #9ecfff; }
  body.dark .price-cell .size  { color: rgba(158,207,255,.6); }
  body.dark .price-cell.empty  { background: #1e2128; }
  body.dark .group-card-hd     { background: #1a1d24; }
  body.dark .event-row         { background: #13151a; }
  body.dark .event-row:hover   { background: #1a1d24; }
  body.dark .runner-row        { border-color: #23262d; }
}

/* ── BETFAIR-STYLE UTILITY CLASSES ───────────────────────── */

/* Betfair-style live count badge in nav */
.live-count {
  background: var(--red);
  color: #fff;
  border-radius: 8px;
  padding: 1px 5px;
  font-size: 9px;
  font-weight: 700;
  margin-left: 3px;
  vertical-align: middle;
}

/* Betfair betslip column header */
.betslip-col-hd {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 2px 10px 4px;
  border-bottom: 1px solid var(--border-light);
}
.betslip-col-hd span {
  font-size: 10px;
  color: var(--text-3);
  text-align: right;
  min-width: 60px;
}

/* Header Exchange tagline */
.hdr-tagline {
  font-size: 9px;
  color: #6b5410;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: block;
  margin-top: -2px;
}

/* Quick-stake buttons */
.bf-quick-stakes {
  display: flex;
  gap: 4px;
  padding: 4px 10px 6px;
  flex-wrap: wrap;
  background: #fafafa;
  border-top: 1px solid var(--border-light);
}
.bfqs {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  font: 600 11px inherit;
  cursor: pointer;
  color: var(--text-1);
  transition: background .1s;
}
.bfqs:hover { background: #f0f0f0; border-color: #999; }
