/* ============================================================
   COMMAND CENTRE — DESIGN SYSTEM
   ============================================================ */

/* --- Fonts (self-hosted; served from /fonts/, copied by build.ts) --- */
/* Inter latin-ext — self-hosted (variable weight 400–700) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Inter latin — self-hosted (variable weight 400–700) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* JetBrains Mono latin-ext — self-hosted (variable weight 400–700) */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* JetBrains Mono latin — self-hosted (variable weight 400–700) */
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Tokens --- */
:root {
  /* Tells the browser to draw its own widgets for a dark page. Without it every native part
     an author cannot reach is rendered for a light one: the date field's calendar icon, the
     number inputs' spinners, form scrollbars. There is no light theme to switch to, so this
     is a statement of fact rather than a preference. */
  color-scheme: dark;

  --bg:          #0d1117;
  --surface:     #161b27;
  --surface-2:   #1c2235;
  --row-alt:     rgba(255, 255, 255, .025);
  --border:      #252d3d;
  --border-2:    #1a2030;
  --text:        #e2e8f4;
  --text-2:      #8896b3;
  --text-3:      #3d4a62;
  --green:       #10d48e;
  --green-10:    rgba(16, 212, 142, .1);
  --red:         #f2546a;
  --red-10:      rgba(242, 84, 106, .1);
  --amber:       #f59e0b;
  --blue:        #4f8ef7;
  --sidebar-bg:  #090d12;
  --font-num:    'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --radius:      8px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Base --- */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

aside {
  width: 200px;
  min-width: 200px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}

aside h1 {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  letter-spacing: .02em;
  transition: color .12s;
}
.logout-btn:hover { color: var(--red); }

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  margin-left: auto;
  font-family: inherit;
  transition: color .12s;
}
.sidebar-close:hover { color: var(--text); }

.sidebar-nav { padding: 10px 8px; flex: 1; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.dashboard-nav-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  margin-bottom: 2px;
  border-radius: 6px;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: background .12s, color .12s, border-color .12s;
}
.dashboard-nav-item:hover {
  background: var(--surface);
  color: var(--text);
}
.dashboard-nav-item.active {
  background: var(--surface);
  color: var(--text);
  border-left-color: var(--green);
  font-weight: 600;
}

.dashboard-nav-icon { display: none; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */

main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
  background: var(--bg);
}

/* ============================================================
   TOOLBAR
   ============================================================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.toolbar h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.back-btn {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  transition: color .12s;
  white-space: nowrap;
}
.back-btn:hover { color: var(--text); }

.detail-action-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.detail-action-btn:hover { border-color: var(--green); color: var(--green); }

/* What is already staked on the match being viewed. Amber while any of it is still running,
   the same word this UI uses for an open bet everywhere else; muted once it is all history. */
.match-bets-link {
  background: none;
  border: none;
  border-bottom: 1px dotted currentColor;
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s;
}
.match-bets-link--open { color: var(--amber); }
.match-bets-link:hover { color: var(--text); }

/* ============================================================
   ADMIN SETTINGS
   ============================================================ */

.admin-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  max-width: 640px;
}
.admin-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 20px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color .12s, color .12s;
}
.admin-tile:hover { border-color: var(--green); color: var(--green); }

/* ============================================================
   USER FORM (Users admin page)
   ============================================================ */

.user-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.user-form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.user-form-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.user-form-row input, .user-form-row select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
}
.user-form-row input:focus, .user-form-row select:focus { outline: none; border-color: var(--green); }
.user-form-actions { display: flex; gap: 10px; align-items: center; }

/* ============================================================
   TABLES
   ============================================================ */

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

thead th {
  background: transparent;
  color: var(--text-2);
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }

tbody tr { border-bottom: 1px solid var(--border-2); }
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr.clickable:hover { background: var(--surface-2); cursor: pointer; }

tbody td {
  padding: 9px 14px;
  color: var(--text);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.fk-label { color: var(--blue); }
.cell-null { color: var(--text-3); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-2);
  font-size: 12px;
}
.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-family: inherit;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 12px;
  transition: border-color .12s, color .12s;
}
.pagination button:hover:not(:disabled) { border-color: var(--green); color: var(--text); }
.pagination button:disabled { opacity: .3; cursor: default; }

/* Delete buttons */
.delete-all-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.delete-all-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.delete-all-btn:disabled { opacity: .3; cursor: default; }

.row-delete-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  transition: color .12s;
}
.row-delete-btn:hover:not(:disabled) { color: var(--red); }
.row-delete-btn:disabled { opacity: .3; cursor: default; }

/* ============================================================
   STATES
   ============================================================ */

.empty {
  color: var(--text-2);
  padding: 48px 0;
  text-align: center;
  font-size: 14px;
}

.loading {
  color: var(--text-2);
  padding: 48px 0;
  text-align: center;
  font-size: 14px;
}

/* ============================================================
   CARDS (base)
   ============================================================ */

.arb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  max-width: 720px;
  margin-bottom: 16px;
}

/* ============================================================
   DASHBOARD — OPPORTUNITY CARDS
   ============================================================ */

.dashboard-group { margin-bottom: 32px; }

.dashboard-group-heading {
  font-size: 11px;
  font-weight: 700;
  color: #57657e;
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.dashboard-card {
  max-width: none;
  margin-bottom: 0;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dashboard-card:hover {
  border-color: var(--green);
  background: var(--surface-2);
}

.dashboard-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.dashboard-profit {
  font-family: var(--font-num);
  font-size: 30px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: -.02em;
  line-height: 1;
}

.dashboard-profit--neg { color: var(--red); }

.arb-match {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.arb-team {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.arb-vs {
  font-size: 11px;
  color: #5a6a84;
  font-weight: 400;
  flex-shrink: 0;
}

.arb-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.arb-meta span + span::before { content: ' · '; color: var(--text-3); }
/* Odds past the stale boundary on a dashboard card — the separators either side stay muted,
   only the age itself lifts. */
.odds-age-stale { color: var(--amber); }

.dashboard-card-books {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}

.book-chip {
  font-size: 11px;
  font-weight: 500;
  color: #b0bdd4;
  background: var(--surface-2);
  border: 1px solid #2e3a52;
  padding: 2px 8px;
  border-radius: 10px;
}

/* ============================================================
   MATCHES BROWSE — league list + a league's match grid
   ============================================================ */

.browse-matches-table .odds-cell { white-space: nowrap; }

.browse-teams { display: flex; align-items: center; gap: 8px; }

/* Outcome price columns + Profit — narrower and centered than the default table padding, so
   a row of several short columns reads as one tight block rather than spread across the
   table's usual generous spacing. */
.browse-matches-table th.browse-num-col,
.browse-matches-table td.browse-num-col {
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
}

.browse-odds-value {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.browse-price {
  font-family: var(--font-num);
  font-weight: 600;
}

/* Plain small text, not a chip — deliberately narrow (most bookmaker names truncate) since
   the row's real content is the price; the full name is still available via the title
   tooltip and, one click away, the match page. */
.browse-bookmaker {
  display: inline-block;
  max-width: 25px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--text-3);
}

.scan-warn-banner {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  border: 1px solid color-mix(in srgb, #f59e0b 30%, transparent);
  color: var(--amber); /* amber-700 fails contrast on the dark banner backdrop */
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.dash-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 14px;
}

.dash-filter-label {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.dash-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.dash-filter-toggle input[type="checkbox"] {
  accent-color: var(--green);
  cursor: pointer;
}

.dash-filter-slider {
  width: 140px;
  accent-color: var(--green);
  cursor: pointer;
}

.dash-filter-slider:disabled {
  opacity: 0.4;
  cursor: default;
}

.dash-filter-value {
  font-family: var(--font-num);
  font-size: 13px;
  color: var(--green);
  min-width: 36px;
}

.dash-filter-value--off {
  color: var(--text-3);
}

.dash-filter-count {
  font-size: 12px;
  color: var(--text-3);
}

/* ============================================================
   MARKET BADGE / TABS
   ============================================================ */

.market-badge {
  display: inline-block;
  background: var(--surface-2);
  color: #b0bdd4;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #2e3a52;
  margin-bottom: 8px;
  white-space: nowrap;
}

.dashboard-card--ended { opacity: .55; }

/* The fleet-wide gap (docs/pipeline/exchanges.md). A golden opportunity does not stand out by
   profit rate -- the whole point is that a modest rate the fleet can absorb beats a big one it
   cannot -- so it is flagged rather than left to be inferred from the number. Deliberately no
   rand figure here: sizing belongs on the calculator and in the email, not on a browse
   surface (docs/pipeline/server.md). */
.dashboard-card--golden { border-color: var(--amber); }

.golden-badge {
  display: inline-block;
  background: var(--surface-2);
  color: var(--amber);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #2e3a52;
  margin-right: 4px;
  white-space: nowrap;
}

.ended-badge {
  display: inline-block;
  background: var(--surface-2);
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid #2e3a52;
  margin-right: 4px;
  white-space: nowrap;
}

.category-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.category-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  padding: 7px 18px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.category-tab:hover { border-color: var(--green); color: var(--text); }
.category-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
}

.market-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.market-tab {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  padding: 6px 16px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.market-tab:hover { border-color: var(--green); color: var(--text); }
.market-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
  font-weight: 600;
}

.capture-links {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
}
.capture-links a { color: var(--blue); text-decoration: none; }
.capture-links a:hover { text-decoration: underline; }

/* ============================================================
   ARB STATS (scan page, opportunity page)
   ============================================================ */

.arb-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 720px;
  margin-bottom: 24px;
}
.arb-summary.single-stat { grid-template-columns: max-content; max-width: 240px; }

/* A column so the figure can be pinned to the bottom (see .arb-stat-value): the grid stretches
   every tile to the tallest, and a label that wraps to two lines would otherwise push its own
   number down out of line with the rest of the row. */
.arb-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.arb-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}
.arb-stat-value {
  /* Bottom of the tile, so a row of figures reads along one line however the labels wrap. */
  margin-top: auto;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text);
  letter-spacing: -.02em;
}

.profit-pos { color: var(--green); }
.profit-neg { color: var(--red) !important; }
/* A positive profit that can't be trusted (see .arb-stale-banner) — amber rather than red,
   which here always means the number itself is negative. */
.profit-stale { color: var(--amber); }

/* ============================================================
   FRESHNESS COLUMN (Match view odds age) — plain text, not a chip,
   so it lines up as its own column to the left of the bookmaker name.
   ============================================================ */

.freshness-cell {
  width: 64px;
  white-space: nowrap;
}
.freshness-label {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-num);
}
.freshness-fresh { color: rgba(16, 212, 142, .65); }
.freshness-aging { color: rgba(245, 158, 11, .65); }
.freshness-stale { color: rgba(242, 84, 106, .65); }

.refresh-icon-btn {
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  padding: 0 4px 0 0;
  line-height: 1;
  vertical-align: middle;
}
.refresh-icon-btn:hover { color: var(--green); }
.refresh-icon-btn:disabled { color: var(--text-3); cursor: default; }
/* visibility, not display: none — the icon's width stays reserved so the freshness text
   next to it lines up at the same offset whether or not this particular row shows one. */
.refresh-icon-btn--hidden { visibility: hidden; pointer-events: none; }
/* Chained with the base class for higher specificity than :disabled (spinning always implies
   disabled — the icon should still read as "active", not greyed out, while it's spinning). */
.refresh-icon-btn.refresh-icon-btn--spinning { animation: refresh-icon-spin .7s linear infinite; color: var(--green); }
/* The base size suits inline table rows; next to a toolbar h2 it needs to hold its own. */
.refresh-icon-btn--toolbar { font-size: 15px; padding: 0; }
@keyframes refresh-icon-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================
   BET BOX
   ============================================================ */

.arb-bets h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
}

.live-arb-calc { margin-top: 28px; }

/* Bigger section headings ("Live Arb Calculator", "Bookmaker Odds") -- distinct from the
   small-caps .arb-bets h3 label style used elsewhere (e.g. the Scan detail "Targets" table).
   h3.section-heading ties .arb-bets h3 on specificity, so source order (defined after it)
   settles which wins for the Live Arb Calculator heading, which matches both selectors. */
h3.section-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: 14px;
}

/* Louder than .scan-warn-banner's amber: a stale leg means the profit sitting right below
   this may not be placeable at all, which is a worse thing to miss than a slow scan. */
.arb-stale-banner {
  background: var(--red-10);
  border: 1px solid rgba(242, 84, 106, .35);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

/* Amber, unlike .arb-stale-banner's red: the arb is real, the entered size (or a missing
   exchange rate) is the problem — a warning to act on, not a figure to distrust. */
.arb-capacity-banner {
  background: rgba(245, 158, 11, .08);
  border: 1px solid rgba(245, 158, 11, .35);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  color: var(--amber);
  font-size: 13px;
  font-weight: 600;
}

/* Red like the stale banner: an exchange book that cannot absorb its allocated stake is
   not a smaller arb, it is no arb — no profit figure or bets render beneath this. */
.arb-infeasible-banner {
  background: var(--red-10);
  border: 1px solid rgba(242, 84, 106, .35);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

/* "$144.20 @16.05" in the exchange bet row's sub line — the smaller secondary text of
   req §6, kept out of bet-row-main so exchange rows keep the bookmaker rows' height.
   Pushed to the row's right edge so it reads as a second line under the leg's
   "returns R…", which sits at that same edge. */
.bet-usd-secondary { color: var(--text-2); white-space: nowrap; margin-left: auto; }

.pm-derived-odds { font-weight: 600; }
.pm-capacity { color: var(--text-2); }

/* The rate line at the panel's foot: the rate in use, its freshness, and the session-only
   override input (styled like the editable odds). */
.fx-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  font-family: var(--font-num);
  color: var(--text-2);
}
.fx-footer-rate.fx-missing { color: var(--amber); font-weight: 600; }
.fx-override { display: inline-flex; align-items: center; gap: 6px; }
.fx-override-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
}

.live-arb-panel {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

/* Target Stake + Round Bets on the left (stacked), Profit pinned top-right -- all three are
   the same "small-caps label above, value below" shape (.stake-control-label). */
.live-arb-panel-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.live-arb-controls { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
/* Stack label-above-value here, overriding .stake-control's default inline baseline layout
   (shared with page-results.html's "Days back" filter, which stays inline next to its
   button -- this override is scoped to the calculator panel only). Covers both Target
   Stake (inside .live-arb-controls) and the Profit block (a sibling .stake-control). */
.live-arb-panel-top .stake-control, .round-bets-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Right-align the label and the figures under it as one flush-right column -- .stake-control's
   shared align-items: baseline would otherwise leave each child shrink-to-fit at the left edge.
   Needs the descendant selector to outweigh that rule. Extra breathing room from the panel's
   right edge, beyond .live-arb-panel's own padding. */
.live-arb-panel-top .live-arb-panel-profit-block { align-items: flex-end; padding-right: 12px; }

.live-arb-panel-profit {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-num);
  line-height: 1.15;
}
/* The rate leads; the rand amount sits beneath it as a lighter subscript so the two read as
   one figure instead of competing. Both share the profit-pos/profit-neg/profit-stale colour
   set on their wrapper. */
.live-arb-panel-profit-values {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.live-arb-panel-profit-amount {
  font-size: 12px;
  font-weight: 400;
  font-family: var(--font-num);
  line-height: 1.2;
  opacity: .7;
}

.stake-control { display: flex; align-items: baseline; gap: 8px; }
.stake-control-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stake-control-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text);
}

/* Fixed height matches .stake-input's rendered height (font + padding + border-bottom) so
   the checkbox lines up with the stake input on the same row. */
.round-bets-checkbox {
  display: flex;
  align-items: center;
  height: 24px;
  cursor: pointer;
}
.round-bets-checkbox input[type="checkbox"] { transform: scale(1.15); }

.stake-input {
  width: 80px;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text);
  background: transparent;
  padding: 0 0 2px 2px;
  transition: border-color .12s;
}
.stake-input:focus { outline: none; border-bottom-color: var(--green); }

/* -/+ buttons flanking every number input, shown only on touch devices: mobile browsers
   render no native spinner at all, so these are the only way to nudge a value there, while
   desktop keeps the native spinner it has always had. The wrapper stays inline-flex on every
   device -- as plain inline, the hidden buttons' surrounding whitespace would reopen as a gap
   between the R and its amount -- and aligns on the baseline, so the R sits on the same line
   as the digits rather than being centred against a taller input box. */
.num-stepper { display: inline-flex; align-items: center; }
/* The R and its amount share a baseline in here; the box as a whole is what gets centred
   against the buttons, which is why they need a wrapper of their own rather than sitting in
   the stepper directly (baseline-aligned items would ride up against the taller buttons). */
.num-stepper-value { display: inline-flex; align-items: baseline; }
.num-step { display: none; }

@media (hover: none) and (pointer: coarse) {
  /* Only now is the native spinner worth hiding: on a touch browser that does render one,
     the two controls would double up. */
  .num-stepper input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
  .num-stepper input[type="number"]::-webkit-outer-spin-button,
  .num-stepper input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

  .num-step {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text-2);
    font-family: inherit;
    font-size: 17px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    /* A held button must step, not scroll the page out from under the finger. */
    touch-action: none;
  }
  .num-step:active { background: var(--border); color: var(--text); }
  .bet-row-sub .num-step { width: 28px; height: 28px; margin: 0 3px; font-size: 15px; }
}

/* The flanked stake input has to give back the width the buttons take, but only where they
   actually show. */
@media (hover: none) and (pointer: coarse) and (max-width: 600px) {
  .bet-stake .stake-input { width: 72px; }
}
}

.match-odds-table thead th,
.match-odds-table tbody td { padding: 5px 14px; }

.odds-cell { position: relative; white-space: nowrap; }
.odds-input {
  width: 64px;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-family: var(--font-num);
  color: var(--text);
  background: transparent;
  padding: 0 0 2px 2px;
  transition: border-color .12s, background-color .12s;
}
.odds-input:focus { outline: none; border-bottom-color: var(--green); }
.odds-input-inline { width: 56px; font-size: 13px; }
.odds-edited { background: rgba(245, 158, 11, .12); border-bottom-color: var(--amber); }
.odds-reset-btn {
  border: none;
  background: none;
  color: var(--amber);
  font-size: 12px;
  cursor: pointer;
  padding: 0 0 0 2px;
  line-height: 1;
}

.bet-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 14px;
}

/* One outcome's stake, whether that is one book or several. The rule between groups is the
   heavier one: outcomes are what the arb is made of, and the rows inside a group are only
   ever a division of one of them. */
.bet-group { border-bottom: 1px solid var(--border); }
.bet-group:last-of-type { border-bottom: none; }

.bet-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px 0;
}
/* Only rendered for a split -- see page-match.html. */
.bet-group-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.bet-group-stake {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text);
  letter-spacing: -.02em;
}
.bet-group-return { font-size: 11px; font-family: var(--font-num); color: var(--green); }

.bet-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  padding: 12px 20px 16px;
}
.bet-row + .bet-row { border-top: 1px solid var(--border-2); padding-top: 16px; }

.bet-row-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1 1 auto;
  min-width: 0;
}
.bet-row-id { flex: 1 1 auto; min-width: 0; }

.bet-outcome {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.bet-market-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid #2e3a52;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  white-space: nowrap;
}
.bet-bookmaker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.bet-bookmaker {
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
  transition: color .12s;
}
.bet-bookmaker:hover { text-decoration: underline; }
.bet-bookmaker.no-link { color: var(--text-2); }

/* Reads as the bookmaker name it replaces (the old .bet-bookmaker link), not as a form
   control -- picking the book is a normal part of reading the slip, not a settings change. */
.bet-book-select {
  font-family: inherit;
  font-size: 12px;
  color: var(--blue);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 1px 2px;
  max-width: 100%;
  cursor: pointer;
}
.bet-book-select:hover, .bet-book-select:focus { border-bottom-color: var(--blue); outline: none; }
/* The native dropdown list inherits nothing from the closed control on most platforms. */
.bet-book-select option { background: var(--surface); color: var(--text); }

.bet-split-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0 20px 14px;
  background: none;
  border: none;
  color: var(--text-3);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: color .12s;
}
.bet-split-btn:hover { color: var(--blue); }

.bet-exclude-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  font-family: inherit;
  transition: color .12s;
}
.bet-exclude-btn:hover { color: var(--red); }

.bet-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}

.bet-stake {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -.02em;
}
.bet-stake .stake-input { font-size: 22px; width: 90px; }

.bet-stake-return {
  font-size: 13px;
  font-family: var(--font-num);
  font-weight: 500;
  color: var(--green);
  white-space: nowrap;
}

.bet-row-sub {
  flex: 1 0 100%;
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: #d8e2f0;
  font-family: var(--font-num);
  margin-top: 2px;
}
.bet-row-sub span + span:not(.num-stepper)::before { content: '·'; margin-right: 14px; color: var(--border); }
/* No separator on the right-aligned USD text — margin-left:auto already opens a gap before it,
   and a '·' there would float loose in the middle of that gap. */
.bet-row-sub span + span.bet-usd-secondary::before { content: none; }

/* Icon on the right of the freshness label here (unlike the odds table's freshness-cell,
   which keeps the icon on the left) -- explicit flex + gap since the button's own
   padding-right (spacing it from a label that used to follow it) no longer applies now
   that the label comes first. */
.bet-row-freshness { flex: 1 0 100%; margin-top: 2px; display: flex; align-items: center; gap: 4px; }

.bet-box-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.bet-box-total-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .07em;
}
.bet-box-total-value {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--text);
  letter-spacing: -.02em;
}

/* Deliberately the only filled button on the page: everything else here explores a price,
   this one records money that has already left your account. */
.slip-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.place-bet-btn {
  background: var(--green);
  border: none;
  border-radius: var(--radius);
  color: #06210f;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  cursor: pointer;
  transition: filter .12s;
}
.place-bet-btn:hover:not(:disabled) { filter: brightness(1.08); }
.place-bet-btn:disabled { opacity: .5; cursor: default; }
.slip-saved { font-size: 12px; color: var(--green); font-family: var(--font-num); }
.slip-save-error { font-size: 12px; color: var(--red); }

/* ---- Bets page ---- */

/* Secondary line under a summary figure: what the number is made of. */

.bets-filters { display: flex; gap: 6px; margin-left: auto; }

.bets-list { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }

.bet-event {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.bet-event-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
}
.bet-event-head:hover { background: var(--surface); }
.bet-event-toggle { color: var(--text-3); font-size: 11px; width: 10px; }
.bet-event-id { flex: 1 1 auto; min-width: 0; }
.bet-event-fixture { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.bet-event-meta { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); }
.bet-event-figures { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.bet-event-profit { font-size: 17px; font-weight: 700; font-family: var(--font-num); letter-spacing: -.02em; }
.bet-event-profit--unknown { color: var(--text-3); }
.bet-event-staked { font-size: 11px; font-family: var(--font-num); color: var(--text-3); }

.bet-event-body { border-top: 1px solid var(--border); padding: 4px 18px 14px; }
.bet-slip { padding: 14px 0; border-bottom: 1px solid var(--border-2); }
.bet-slip:last-child { border-bottom: none; }
.bet-slip-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bet-slip-id { font-family: var(--font-num); font-size: 12px; color: var(--text-2); }
.bet-slip-placed { font-size: 11px; color: var(--text-3); }
.bet-slip-imported {
  font-size: 10px;
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
}
.bet-slip-status { font-size: 11px; margin-left: auto; }
.bet-slip-status--open { color: var(--amber); }
.bet-slip-status--settled { color: var(--text-3); }

.bet-leg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.bet-leg-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  padding: 4px 10px 4px 0;
}
.bet-leg-table td { padding: 5px 10px 5px 0; font-family: var(--font-num); color: var(--text); }
.bet-leg-table td:first-child { font-family: inherit; }
.bet-leg-secondary { margin-left: 6px; font-size: 10px; color: var(--text-3); }

.bet-leg-currency { color: var(--text-3); margin-right: 1px; }
.bet-stake-input { width: 72px; }

.bet-leg-select {
  font-family: inherit;
  font-size: 12px;
  /* A form control takes the platform's colour, not the page's, so this has to be said out
     loud — without it the text renders black on the dark surface. The status dropdown hid the
     omission for a while by always carrying a .bet-leg-status--* colour of its own. */
  color: var(--text);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 1px 2px;
  cursor: pointer;
}
.bet-leg-select:hover, .bet-leg-select:focus { border-bottom-color: var(--blue); outline: none; }
.bet-leg-select option { background: var(--surface); color: var(--text); }

.bet-leg-winner {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-2);
  font-family: inherit;
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.bet-leg-winner:hover:not(:disabled) { color: var(--green); border-color: var(--green); }
.bet-leg-winner:disabled { opacity: .4; cursor: default; }

.bet-slip-delete {
  background: none;
  border: none;
  color: var(--text-3);
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  transition: color .12s;
}
.bet-slip-delete:hover { color: var(--red); }

.bet-leg-status--won { color: var(--green); }
.bet-leg-status--lost { color: var(--red); }
.bet-leg-status--void { color: var(--text-3); }
.bet-leg-status--pending { color: var(--text-2); }

.bet-slip-foot {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 11px;
  font-family: var(--font-num);
  color: var(--text-2);
}
.bet-slip-expected { margin-left: auto; color: var(--text-3); }

/* Fewer than four tiles should not stretch to fill the row: these widths keep a tile exactly
   the size it is in the four-up layout (720px across 4 columns with 12px gaps = 171px). */
.arb-summary--two { grid-template-columns: repeat(2, 1fr); max-width: 354px; }
.arb-summary--three { grid-template-columns: repeat(3, 1fr); max-width: 537px; }
/* Six figures read as one band across a wide screen, and wrap rather than squeeze on a narrow
   one — a rand figure clipped mid-digit is worse than a second row. */
.arb-summary--six {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  max-width: 1086px;
}
.arb-summary--seven {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  max-width: 1269px;
}

.bets-section { margin-top: 28px; }
.bets-section-head { display: flex; align-items: baseline; gap: 12px; }
.bets-section-head .section-heading { margin-bottom: 0; }
.bets-section-count { font-size: 11px; color: var(--text-3); font-family: var(--font-num); }

.list-sort { display: flex; align-items: center; gap: 6px; margin: 10px 0 4px; flex-wrap: wrap; }
.list-sort-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-right: 2px;
}
.sort-chip {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-family: inherit;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.sort-chip:hover { color: var(--text); border-color: var(--text-3); }
.sort-chip.active { color: var(--green); border-color: var(--green); }

.table-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-num);
}
.pager-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: inherit;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.pager-btn:hover:not(:disabled) { color: var(--text); border-color: var(--text-3); }
.pager-btn:disabled { opacity: .35; cursor: default; }

/* ---- Bankroll page ---- */

.bets-tabs { display: flex; gap: 6px; margin-left: 16px; }

.bankroll-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 20px 0 6px;
}
.bankroll-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
}
.bankroll-input:focus { outline: none; border-color: var(--blue); }
.bankroll-input option { background: var(--surface); color: var(--text); }
.bankroll-input--narrow { width: 64px; }
.bankroll-input--amount { width: 120px; font-family: var(--font-num); }
.bankroll-input--note { flex: 1 1 160px; min-width: 120px; }

.bankroll-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 14px;
}
.bankroll-table th.sortable { cursor: pointer; user-select: none; }
.bankroll-table th.sortable:hover { color: var(--text-2); }
.bankroll-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid var(--border);
}
.bankroll-table td {
  padding: 7px 12px 7px 0;
  font-family: var(--font-num);
  color: var(--text);
  border-bottom: 1px solid var(--border-2);
}
.bankroll-book { font-family: inherit; font-weight: 600; }
.bankroll-note { font-family: inherit; color: var(--text-3); }
.bankroll-log { margin-top: 28px; }

/* Money in flight. Framed rather than listed, because its whole job is to be the thing you
   cannot scroll past without noticing you are owed a payout. */
.bankroll-pending {
  margin-top: 20px;
  padding: 2px 14px 10px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
}
.bankroll-pending .section-heading { color: var(--amber); }
.bankroll-pending .bankroll-table { margin-top: 4px; }
.bankroll-overdue td { color: var(--amber); }
.bankroll-overdue-flag {
  font-size: 10px;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
}
.pending-confirm {
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-2);
  font-family: inherit;
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.pending-confirm:hover:not(:disabled) { color: var(--green); border-color: var(--green); }
.pending-confirm:disabled { opacity: .4; cursor: default; }

/* The state a logged transaction is in, and the control that changes it. Hidden until the row
   is hovered or focused while it says "landed" — 87 rows of a permanently visible toggle is a
   grid of noise, and the only state worth seeing at a glance is the one still owed. */
.txn-pending {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-3);
  font-family: inherit;
  font-size: 10px;
  padding: 1px 5px;
  margin-left: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s, color .12s;
}
tr:hover .txn-pending, .txn-pending:focus { opacity: 1; }
.txn-pending:hover:not(:disabled) { color: var(--text); border-color: var(--border); }
.txn-pending--waiting {
  opacity: 1;
  color: var(--amber);
  border-color: var(--amber);
}
.txn-pending--waiting:hover:not(:disabled) { color: var(--amber); }

.bankroll-pending-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}

/* Reads as the value it replaces, not as a form control: correcting a logged transaction is
   part of reading the ledger, the same bargain .bet-leg-select strikes on the Bets page. */
.bankroll-cell-input {
  font-family: inherit;
  font-size: 12px;
  color: inherit;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 1px 2px;
  max-width: 100%;
}
.bankroll-cell-input:hover, .bankroll-cell-input:focus { border-bottom-color: var(--blue); outline: none; }
.bankroll-cell-input:disabled { opacity: .4; }
.bankroll-cell-input--note { width: 100%; color: var(--text-3); }

/* The book and its source link ride together, so a long name can never push the ↗ onto its
   own line and read as belonging to the next column. */
.bet-leg-book { display: inline-flex; align-items: center; gap: 4px; }

/* ---- One bookmaker's statement ---- */

.ledger-picker { margin-left: auto; min-width: 200px; }

/* Two row shapes in one chronological list, so the eye needs a cheap way to tell a transfer
   from a bet without reading the columns. The tint goes on the cells rather than the row: an
   x-for row's first child is Alpine's <template>, so td:first-child matches nothing here. */
.ledger-table td { vertical-align: middle; }
.ledger-row--txn td { background: rgba(79, 142, 247, .06); }
.ledger-row--txn td:nth-child(1) { box-shadow: inset 2px 0 0 var(--blue); }
.ledger-fixture { display: flex; flex-direction: column; gap: 1px; max-width: 320px; }

.excluded-row { opacity: .3; }
.excluded-row td { text-decoration: line-through; }

/* ============================================================
   DETAIL CARD
   ============================================================ */

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 680px;
}

.detail-card dl { display: grid; grid-template-columns: 180px 1fr; }

.detail-card .field { display: contents; }

.detail-card .field:not(:last-child) dt,
.detail-card .field:not(:last-child) dd { border-bottom: 1px solid var(--border-2); }

.detail-card dt {
  background: var(--sidebar-bg);
  padding: 10px 16px;
  font-weight: 600;
  color: var(--text-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.detail-card dd {
  padding: 10px 16px;
  color: var(--text);
  word-break: break-all;
  font-size: 13px;
}

.detail-card a { color: var(--blue); text-decoration: none; }
.detail-card a:hover { text-decoration: underline; }

/* Related panels */
.related-section { margin-top: 28px; max-width: 900px; }

.related-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 12px;
}

.related-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.related-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background .12s;
}
.related-header:hover { background: var(--surface-2); }

.related-title { font-weight: 600; color: var(--text); font-size: 13px; }
.related-via { font-size: 12px; color: var(--text-2); }

.related-count {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.related-toggle {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: color .12s;
}
.related-toggle:hover { color: var(--text); }

.related-body { border-top: 1px solid var(--border); }
.related-body table { border-radius: 0; border: none; }
.related-body .pagination { padding: 10px 16px; margin-top: 0; border-top: 1px solid var(--border); }
.related-loading { padding: 20px; text-align: center; color: var(--text-2); font-size: 13px; }

/* ============================================================
   COLLECT PAGE
   ============================================================ */

.collect-page {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 700px;
}

/* Config section */
.collect-config {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pipeline-selectors {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.scrape-selector {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.scrape-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}

.scrape-selector-header h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.scrape-toggle-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: color .12s;
}
.scrape-toggle-all:hover { color: var(--text); }

.scrape-checklist {
  padding: 6px 0;
  max-height: 240px;
  overflow-y: auto;
}

.scrape-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background .1s, color .1s;
}
.scrape-check-item:hover { background: var(--surface-2); color: var(--text); }
.scrape-check-item input[type=checkbox] {
  accent-color: var(--green);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Run row */
.collect-run-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.scrape-run-btn {
  background: var(--green);
  border: none;
  border-radius: var(--radius);
  color: var(--bg);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  padding: 12px 28px;
  cursor: pointer;
  transition: opacity .15s;
  letter-spacing: .01em;
  white-space: nowrap;
}
.scrape-run-btn:hover:not(:disabled) { opacity: .85; }
.scrape-run-btn:disabled { opacity: .4; cursor: default; }

.collect-selection-meta {
  font-size: 13px;
  color: var(--text-2);
}

.scrape-error {
  color: var(--red);
  background: var(--red-10);
  border: 1px solid rgba(242, 84, 106, .25);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
}

/* Collapsible sections (progress, results) */
.collect-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.collect-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collect-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.collect-progress-summary {
  font-size: 12px;
  font-family: var(--font-num);
  color: var(--text-2);
}

/* Agent list — compact rows replace the old card grid */
.agent-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-scraping { background: var(--amber); animation: blink 1.2s ease-in-out infinite; }
.dot-ok       { background: var(--green); }
.dot-failed   { background: var(--red); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .25; }
}

.agent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-2);
  background: var(--surface);
}
.agent-row:last-child { border-bottom: none; }

.agent-row-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.agent-row-status {
  font-size: 12px;
  font-family: var(--font-num);
  color: var(--text-2);
  white-space: nowrap;
}
.agent-row-counts { color: var(--text-2); }
.agent-row-failed { color: var(--red); }

/* Opportunity rows */
.scrape-opps-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* The Collect page's Best Arbs preview is a fixed five-column grid with no room for a badge,
   so a golden row is marked by the accent alone; the Opportunities page carries the label. */
.scrape-opp-row--golden { border-left: 3px solid var(--amber); }

.scrape-opp-row {
  display: grid;
  grid-template-columns: 68px 1fr auto auto 16px;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  transition: background .1s;
}
.scrape-opp-row:last-child { border-bottom: none; }
.scrape-opp-row:hover { background: var(--surface-2); }

.opp-profit {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--green);
  font-size: 14px;
  letter-spacing: -.01em;
}
.opp-match  { font-weight: 600; color: var(--text); font-size: 13px; }
.opp-market {
  font-size: 11px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.opp-books  { font-size: 12px; color: var(--text-2); }
.opp-arrow  { color: var(--text-3); font-size: 14px; }

/* Danger zone */
.collect-danger {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.collect-danger-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-right: 4px;
}

.clear-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.clear-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.clear-btn:disabled { opacity: .3; cursor: default; }

/* ============================================================
   VIEW DATA PAGE
   ============================================================ */

.view-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  max-width: 860px;
}

.view-data-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-num);
  color: var(--text-2);
  letter-spacing: .01em;
  transition: border-color .12s, color .12s;
}
.view-data-card:hover { border-color: var(--green); color: var(--text); }

/* ============================================================
   LOGIN
   ============================================================ */

.login-screen {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-card h1 {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.login-card label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 12px;
}

.login-card input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  transition: border-color .12s;
}
.login-card input:focus { outline: none; border-color: var(--green); }

.login-submit-btn {
  background: var(--green);
  border: none;
  border-radius: 6px;
  color: var(--bg);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  padding: 11px;
  margin-top: 22px;
  cursor: pointer;
  transition: opacity .15s;
}
.login-submit-btn:hover:not(:disabled) { opacity: .85; }
.login-submit-btn:disabled { opacity: .5; cursor: default; }

.login-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 6px;
}

/* ============================================================
   MOBILE
   ============================================================ */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 16px;
  cursor: pointer;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 19;
}

@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }

  aside {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 280px;
    min-width: 280px;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .6);
  }
  aside.open { transform: translateX(0); }

  .sidebar-backdrop.visible { display: block; }

  /* ✕ lives in the header as a normal flex item — no absolute positioning */
  .sidebar-close { display: flex; align-items: center; }

  main { padding: 68px 16px 20px; }
}

@media (max-width: 600px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .arb-summary { grid-template-columns: repeat(2, 1fr); }
  .arb-card, .arb-summary { max-width: 100%; }
  .table-scroll table { min-width: 560px; }
  .scrape-opp-row { grid-template-columns: 64px 1fr 18px; }
  .opp-market, .opp-books { display: none; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .dot-scraping { animation: none; opacity: .7; }
  .dashboard-card, .detail-action-btn, .market-tab,
  .scrape-run-btn, .login-submit-btn { transition: none; }
}

/* ============================================================
   TOURNAMENT DRIFT
   ============================================================ */

.drift-intro {
  max-width: 76ch;
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
}

/* Title left, controls right — the toolbar's flex gap alone leaves them crowding the h2. */
.toolbar .dash-filter-toggle { margin-left: auto; }

.drift-status {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}

.drift-asof { color: var(--text-2); font-size: 12px; }
.drift-asof strong { color: var(--text); font-family: var(--font-num); }
.drift-asof--running { color: var(--green); }

.drift-section { margin-bottom: 36px; }

.drift-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 16px;
  color: var(--text-2);
  font-size: 13px;
}

.drift-summary strong {
  color: var(--text);
  font-family: var(--font-num);
}

/* Cards, not table rows: a suspect carries a whole fixture list and a multi-line proposal,
   and tbody td's nowrap/ellipsis truncation turns both into one clipped line. */
.drift-cards { display: flex; flex-direction: column; gap: 12px; }

.drift-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.drift-card--high { border-left-color: var(--red); }

.drift-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.drift-card-target { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.drift-card-target strong { font-size: 14px; font-weight: 700; }
.drift-card-target span { color: var(--text-2); font-size: 13px; }
.drift-card-target span::before { content: '·'; color: var(--text-3); margin-right: 8px; }

.drift-confidence {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  /* Everything after the confidence chip sits against the right edge of the card head. */
  margin-right: auto;
}

.drift-confidence--high   { color: var(--red); }
.drift-confidence--medium { color: var(--text-2); }

.drift-card-meta { color: var(--text-3); font-size: 11px; white-space: nowrap; }

.drift-card-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
}

.drift-col { min-width: 0; display: flex; flex-direction: column; gap: 8px; }

.drift-col-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
}

.drift-fixture-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.drift-fixture { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }

.drift-fixture-name {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.drift-fixture-name:hover { color: var(--green); text-decoration: underline; }

.drift-fixture-meta { color: var(--text-3); font-size: 11px; }
/* Kept deliberately quiet: "this book used to price it" is already what the card's confidence
   chip means, so this is per-fixture corroboration, not a second alarm. */
.drift-fixture-badge {
  color: var(--text-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.drift-proposal { display: flex; flex-direction: column; gap: 6px; }

.drift-fix { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.drift-fix-ids { display: inline-flex; align-items: baseline; gap: 6px; }

.drift-fix code {
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--text-2);
}

.drift-fix code.drift-fix-new { color: var(--green); }

.drift-fix-label { color: var(--text-2); font-size: 12px; }
.drift-fix-proof { color: var(--text-3); font-size: 11px; }

/* How long this proposal has been standing, and the loudest thing in the column — a fix worked
   out this morning and one nobody has applied for nine days are the same row otherwise. */
.drift-proposal-age {
  align-self: flex-start;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 700;
}
.drift-proposal-age--ageing {
  border-color: rgba(245, 158, 11, .45);
  background: rgba(245, 158, 11, .12);
  color: var(--amber);
}

.drift-note { color: var(--text-2); font-size: 12px; }
.drift-note code { font-family: var(--font-num); color: var(--text-2); }
.drift-note--error { color: var(--red); }

@media (max-width: 900px) {
  .drift-card-cols { grid-template-columns: 1fr; gap: 16px; }
}

/* ============================================================
   UNAVAILABLE BOOKMAKERS (Match view)
   ============================================================ */

.unavailable-books { margin-top: 28px; max-width: 640px; }

.unavailable-books-note {
  max-width: 76ch;
  margin-bottom: 12px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

.unavailable-book-list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.unavailable-book {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-2);
}
.unavailable-book:last-child { border-bottom: none; }

.unavailable-book-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-size: 13px;
}

/* ============================================================
   NOTIFICATIONS (per-user settings)
   ============================================================ */

.notify-page {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 900px;
}

/* Card heading, sitting directly above the field labels it groups — which share its
   small-caps treatment, so it needs the gap to read as a heading rather than a third label. */
.notify-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 16px;
}

.notify-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

/* Label + toggle stacked like the sibling text inputs, so the row's baselines line up */
.notify-enable {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: flex-end;
}

/* The On/Off control is a `label` too, so .user-form-row label's column layout would
   otherwise stack its checkbox above its text. Padding matches the sibling input's, so the
   two controls sit on the same line. */
.notify-enable .dash-filter-toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}
.notify-enable .dash-filter-toggle input[type="checkbox"] { width: 15px; height: 15px; }

.notify-saved { color: var(--green); font-size: 12px; }

/* Auto-fill rather than a fixed count: the list is as long as the active bookmaker set and
   grows with it, and the page has no reason to scroll a box when it can use the width. */
.notify-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  padding: 10px 0;
}

.notify-book-excluded { text-decoration: line-through; opacity: .55; }
