:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --accent: #facc15;
  --danger: #f87171;
  --success: #4ade80;
  --void: #94a3b8;
  --pending: #fbbf24;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; }
.dashboard-brand { display: flex; align-items: center; gap: 0.65rem; }
.dashboard-logo { display: block; width: 64px; height: 64px; flex: none; border-radius: 50%; }
.dashboard-header h1 { margin: 0; font-size: 1.3rem; letter-spacing: -0.02em; }
.dashboard-account { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-dim); }
.dashboard-account button, .login-panel button, .bets-sort-toggle {
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  background: var(--surface-light);
  color: var(--text);
  cursor: pointer;
}
.login-panel { width: 100%; max-width: 420px; margin: 3rem auto; padding: 1.25rem; background: var(--surface); border-radius: 12px; display: flex; flex-direction: column; gap: 0.75rem; }
.login-logo { display: block; width: 144px; height: 144px; margin: 0 auto; border-radius: 50%; }
.login-panel h1, .login-panel p { margin: 0; }
.login-panel p, .login-panel label { color: var(--text-dim); font-size: 0.9rem; }
.login-panel label { display: flex; flex-direction: column; gap: 0.3rem; }
.login-panel input { background: var(--bg); color: var(--text); border: 1px solid var(--surface-light); border-radius: 6px; padding: 0.7rem; font: inherit; }
.login-panel button[type="submit"] { background: var(--accent); color: var(--bg); font-weight: 700; }
.bets-sort-toggle { margin: 0 0.5rem 0.5rem 0; font-size: 0.85rem; }

.bankroll-bar {
  background: linear-gradient(135deg, #263a51, var(--surface) 70%);
  border: 1px solid #40536a;
  border-radius: 16px;
  padding: 1.25rem;
}
.bankroll-label { color: #cbd5e1; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.bankroll-figure { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.bankroll-stats { display: flex; gap: 1rem 2rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid #40536a; }
.bankroll-stat { display: flex; flex-direction: column; gap: 0.2rem; }
.bankroll-stat span { color: #cbd5e1; font-size: 0.75rem; }
.bankroll-stat strong { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.bankroll-exposure { color: var(--pending); font-size: 0.8rem; margin-top: 0.85rem; }

.drafts-banner.hidden { display: none; }
.drafts-banner-heading { font-weight: 600; margin-bottom: 0.5rem; }
.drafts-banner-list { display: flex; flex-direction: column; gap: 0.4rem; }
.drafts-banner button {
  width: 100%;
  background: var(--pending);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.dashboard-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dashboard-actions button, .upload-btn {
  background: var(--surface-light);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
}
.dashboard-actions .dashboard-action-primary { background: var(--accent); color: var(--bg); font-weight: 700; }
.dashboard-more { position: relative; }
.dashboard-more summary {
  display: flex;
  align-items: center;
  min-height: 100%;
  background: var(--surface-light);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
}
.dashboard-more summary::-webkit-details-marker { display: none; }
.dashboard-more summary::after { content: ' ▾'; margin-left: 0.35rem; }
.dashboard-more-actions {
  position: absolute;
  z-index: 4;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 12rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--surface-light);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.dashboard-more-actions button { display: block; width: 100%; text-align: left; background: transparent; }
.dashboard-more-actions button:hover, .dashboard-more-actions button:focus-visible { background: var(--surface-light); }
.upload-btn { display: inline-block; }

/* Keep a growing ledger bounded, with scroll anchors on larger screens. */
.bets-table-wrapper {
  overflow: auto;
  max-height: 60vh;
  border-radius: 10px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.bets-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.bets-table th, .bets-table td { padding: 0.6rem 0.75rem; text-align: left; font-size: 0.85rem; white-space: nowrap; }
.bets-table th { color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--surface-light); }
.bets-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.bets-table th:first-child, .bets-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.25);
}
.bets-table thead th:first-child { z-index: 2; }
.bets-table-row { cursor: pointer; border-bottom: 1px solid var(--surface-light); }
.bets-table-row:hover { background: var(--surface-light); }
.bets-table-row:hover td:first-child { background: var(--surface-light); }
.bets-table-row td button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.bets-table-empty { color: var(--text-dim); padding: 1rem; text-align: center; background: var(--surface); border-radius: 10px; }

.result-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.result-won { background: var(--success); color: var(--bg); }
.result-lost { background: var(--danger); color: var(--bg); }
.result-void { background: var(--void); color: var(--bg); }
.result-pending { background: var(--pending); color: var(--bg); }
.result-draft { background: var(--surface-light); color: var(--text); }

.adjustment-type { color: var(--accent); font-weight: 600; }
.bets-table-row-clickable { cursor: pointer; }

.profit-positive { color: var(--success); font-weight: 600; }
.profit-negative { color: var(--danger); font-weight: 600; }

.bet-detail-container:empty { display: none; }
.bet-detail {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.bet-detail-title { font-weight: 700; font-size: 1.05rem; }
.bet-detail-meta, .bet-detail-attribution { color: var(--text-dim); font-size: 0.85rem; }
.bet-detail-screenshot-link { color: var(--accent, #4d8dff); font-size: 0.85rem; text-decoration: none; width: fit-content; }
.bet-detail-screenshot-link:hover { text-decoration: underline; }
.bet-detail-legs { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; display: flex; flex-direction: column; gap: 0.3rem; }

.bet-detail-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.bet-detail-table th, .bet-detail-table td { padding: 0.4rem 0.5rem; text-align: left; border-bottom: 1px solid var(--surface-light); }
.bet-detail-table th { color: var(--text-dim); font-weight: 600; }

.bet-detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
.bet-detail-actions button {
  background: var(--surface-light);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.bet-detail-actions .bet-detail-delete { background: var(--danger); color: var(--bg); }

.bet-detail-manual-result { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--text-dim); }
.manual-result-buttons { display: inline-flex; gap: 0.25rem; }
.manual-result-btn {
  border: none;
  border-radius: 5px;
  width: 1.6rem;
  height: 1.6rem;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
}
.manual-result-won { background: var(--success); color: var(--bg); }
.manual-result-lost { background: var(--danger); color: var(--bg); }
.manual-result-void { background: var(--void); color: var(--bg); }

.leg-score-source { color: var(--text-dim); font-size: 0.75rem; }

.bet-detail-audit-toggle {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
  margin-top: 0.4rem;
}
.bet-detail-audit.hidden { display: none; }
.bet-detail-audit { font-size: 0.8rem; color: var(--text-dim); }
.bet-detail-audit-list { margin: 0.3rem 0 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.2rem; }

.settings-panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.settings-panel h3 { margin: 0.5rem 0 0; font-size: 0.95rem; }
.settings-members-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.settings-member-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}
.settings-member-name { flex: 1; font-size: 0.9rem; }
.settings-member-inactive { color: var(--text-dim); font-style: italic; }
.settings-member-row button {
  background: var(--surface-light);
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.leaderboard-container { min-width: 0; overflow-x: auto; }
.leaderboard-container:empty { display: none; }
.leaderboard-heading { font-size: 1rem; margin: 0 0 0.5rem; }
.leaderboard-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 10px; overflow: hidden; }
.leaderboard-table th, .leaderboard-table td { padding: 0.5rem 0.7rem; text-align: left; font-size: 0.85rem; }
.leaderboard-table th { color: var(--text-dim); font-weight: 600; border-bottom: 1px solid var(--surface-light); }
.leaderboard-table tr:not(:last-child) td { border-bottom: 1px solid var(--surface-light); }
.leaderboard-member { display: flex; align-items: center; gap: 0.6rem; }
.leaderboard-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; object-fit: cover; background: var(--bg); }

.season-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.season-tabs.hidden { display: none; }
.season-tab {
  background: var(--surface);
  color: var(--text-dim);
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.season-tab.active { background: var(--accent); color: var(--bg); font-weight: 600; }
.season-tab-new { background: transparent; border: 1px dashed var(--surface-light); }

.wizard {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.wizard-cancel {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
}
.wizard-progress { font-weight: 600; }
.wizard-progress-bar { width: 100%; height: 0.45rem; accent-color: var(--accent); }
.wizard-preview { display: flex; flex-direction: column; gap: 0.5rem; }
.wizard-preview h3 { margin: 0; font-size: 0.95rem; }
.wizard-preview-bet { padding: 0.75rem; background: var(--bg); border: 1px solid var(--surface-light); border-radius: 8px; font-size: 0.85rem; }
.wizard-preview-bet ul { margin: 0.4rem 0 0; padding-left: 1.15rem; color: var(--text-dim); }
.wizard-preview-bet li + li { margin-top: 0.2rem; }
.wizard-preview .confirm-error { margin: 0; }
.wizard-prompt { color: var(--text-dim); font-size: 0.9rem; }
.wizard-member-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.wizard-member-buttons button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.wizard-back {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
}

.upload-panel {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  padding: 1rem;
  z-index: 10;
}
.upload-panel.hidden { display: none; }
.upload-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}
.upload-status { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.upload-work-area { display: flex; flex-direction: column; gap: 0.75rem; max-width: 640px; margin: 0 auto; }

.toast { padding: 0.6rem 0.9rem; border-radius: 8px; font-size: 0.85rem; background: var(--surface); }
.toast-error { background: var(--danger); color: var(--bg); }

.weekly-slip-note { color: var(--text-dim); font-size: 0.85rem; margin: 0; }

.bet-card {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.75rem;
}
.bet-card-title { font-weight: 600; margin-bottom: 0.5rem; }
.bet-card-warning { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.5rem; }
.bet-card-legs { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; }
.bet-card-legs li { margin-bottom: 0.25rem; }
.bet-card-result { margin-top: 0.5rem; font-weight: 600; }
.bet-card-result-won { color: var(--success); }
.bet-card-result-lost { color: var(--danger); }
.bet-card-result-void { color: var(--text-dim); }
.bet-card button { margin-top: 0.5rem; }

.confirm-prompt { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.confirm-prompt button, .confirm-form button {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.confirm-prompt button:disabled { background: var(--surface-light); color: var(--text-dim); cursor: not-allowed; }

.confirm-form {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.confirm-meta-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.confirm-field { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--text-dim); gap: 0.25rem; }
.confirm-field input, .confirm-field select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--surface-light);
  border-radius: 6px;
  padding: 0.4rem;
}

/* Compound selectors so these beat the generic .confirm-field rules above regardless of order. */
.confirm-field.confirm-field-checkbox { flex-direction: row; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text); padding: 0.4rem 0; }
.confirm-field.confirm-field-checkbox input { width: 1.3rem; height: 1.3rem; padding: 0; margin: 0; accent-color: var(--accent); }

.confirm-leg-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
  border-top: 1px solid var(--surface-light);
  padding-top: 0.5rem;
}
.confirm-leg-remove {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  height: fit-content;
}
.confirm-leg-add {
  align-self: flex-start;
  background: var(--surface-light);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.confirm-error { color: var(--danger); font-size: 0.85rem; }
.confirm-actions { display: flex; gap: 0.5rem; }
.confirm-actions button[type="button"] { background: var(--surface-light); color: var(--text); }

.analyse-container:empty { display: none; }
.analyse-intro { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 0.75rem; }
.analyse-panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}
.analyse-panel h3 { margin: 0 0 0.25rem; font-size: 0.95rem; }
.analyse-panel-desc { color: var(--text-dim); font-size: 0.8rem; margin: 0 0 0.6rem; }
.analyse-panel-empty { color: var(--text-dim); font-size: 0.8rem; margin: 0; }
.analyse-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.analyse-table th, .analyse-table td { padding: 0.4rem 0.5rem; text-align: left; border-bottom: 1px solid var(--surface-light); }
.analyse-table th { color: var(--text-dim); font-weight: 600; }

.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.share-modal {
  background: var(--surface);
  border-radius: 10px;
  padding: 1rem;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.share-modal h3 { margin: 0; font-size: 1rem; }
.share-modal-hint { color: var(--text-dim); font-size: 0.8rem; margin: 0; }
.share-modal-textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--surface-light);
  border-radius: 8px;
  padding: 0.6rem;
  font-family: inherit;
  font-size: 0.9rem;
  white-space: pre-wrap;
}
.share-modal-status { color: var(--success); font-size: 0.8rem; min-height: 1.1em; }
.share-modal-actions { display: flex; gap: 0.5rem; }
.share-modal-actions button { flex: 1; padding: 0.6rem; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.share-modal-actions button:first-child { background: var(--accent); color: var(--bg); }
.share-modal-actions button:last-child { background: var(--surface-light); color: var(--text); }

.build-tag { text-align: center; color: var(--text-dim); font-size: 0.7rem; padding: 0 0 1rem; opacity: 0.7; }

.bets-filters-toggle {
  background: var(--surface-light);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
}
.bets-filters {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}
.bets-filters.hidden { display: none; }
.bets-filter { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.75rem; color: var(--text-dim); }
.bets-filter-range { display: flex; gap: 0.25rem; }
.bets-filter input, .bets-filter select {
  width: 100%;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--surface-light);
  border-radius: 6px;
  padding: 0.35rem;
  font-size: 0.85rem;
}
.bets-filters-clear {
  align-self: end;
  background: none;
  border: 1px solid var(--surface-light);
  color: var(--text-dim);
  border-radius: 6px;
  padding: 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
}
/* Pinned to the bottom of the scroll box, mirroring the sticky header, so totals stay visible. */
.bets-table tfoot { position: sticky; bottom: 0; z-index: 2; }
.bets-table tfoot td { background: var(--surface); font-weight: 600; }
.bets-table tfoot tr:first-child td { border-top: 2px solid var(--surface-light); }
.bets-table tfoot tr:last-child td { font-weight: 400; color: var(--text-dim); }

.leaderboard-breakdown { display: block; color: var(--text-dim); font-size: 0.7rem; font-weight: 400; }

.picks-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
@media (min-width: 700px) {
  .picks-summary { grid-template-columns: repeat(4, 1fr); }
}
.picks-summary-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--surface);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.picks-summary-tile strong { color: var(--text); font-size: 0.95rem; }
.picks-summary-tile strong.profit-positive { color: var(--success); }
.picks-summary-tile strong.profit-negative { color: var(--danger); }
.analyse-panel .bets-filter { max-width: 200px; margin-bottom: 0.5rem; }
/* The pick cell wraps, so the columns fit a phone without the sticky first column the ledger needs. */
.bets-table.picks-table th:first-child { left: auto; box-shadow: none; }
.bets-table.picks-table td:first-child { position: static; box-shadow: none; white-space: normal; min-width: 7rem; }
.picks-panel .analyse-table td:not(:first-child) { white-space: nowrap; }
@media (max-width: 480px) {
  .leaderboard-table th, .leaderboard-table td { padding: 0.4rem 0.25rem; font-size: 0.75rem; }
  .leaderboard-member { gap: 0.35rem; }
  .leaderboard-avatar { width: 30px; height: 30px; }
  .picks-panel .analyse-table th, .picks-panel .analyse-table td { padding: 0.4rem 0.3rem; font-size: 0.8rem; }
  .bets-table.picks-table th, .bets-table.picks-table td { padding: 0.5rem 0.3rem; font-size: 0.8rem; }
  .bets-table.picks-table th { white-space: normal; }
  .bets-table.picks-table th:first-child, .bets-table.picks-table td:first-child { padding-left: 0.6rem; }
  .picks-table .result-badge { padding-left: 0.4rem; padding-right: 0.4rem; }
}

@media (max-width: 600px) {
  .dashboard-actions button { min-height: 44px; }
  .dashboard-more { flex-basis: 100%; }
  .dashboard-more summary { min-height: 44px; width: fit-content; }
  .dashboard-more-actions { left: 0; right: auto; }
  .bankroll-stats { gap: 0.85rem 1.5rem; }
  .bets-table-wrapper { max-height: 65vh; }
  .bets-table-wrapper > .ledger-table,
  .bets-table-wrapper > .ledger-table > tbody,
  .bets-table-wrapper > .ledger-table > tfoot { display: block; background: transparent; }
  .bets-table-wrapper > .ledger-table > thead { display: none; }
  .bets-table-wrapper > .ledger-table > tbody > tr,
  .bets-table-wrapper > .ledger-table > tfoot > tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 12px;
    margin-bottom: 0.6rem;
    padding: 0.9rem;
  }
  .bets-table-wrapper > .ledger-table > tbody > tr > td,
  .bets-table-wrapper > .ledger-table > tfoot > tr > td {
    position: static;
    min-width: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    white-space: normal;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
  }
  .bets-table-wrapper > .ledger-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label);
    display: block;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 400;
    margin-bottom: 0.2rem;
  }
  .bets-table-wrapper > .ledger-table > tbody > tr > td:nth-child(3) { grid-column: 1 / -1; font-weight: 700; font-size: 1rem; }
  .bets-table-wrapper > .ledger-table > tbody > tr > td:last-child { grid-column: 1 / -1; }
  .bets-table-wrapper > .ledger-table td:empty { display: none; }
  .bets-table-wrapper > .ledger-table > tfoot { position: static; }
  .bets-table-wrapper > .ledger-table > tfoot > tr > td { border: 0; }
  .bets-table-wrapper > .ledger-table > tfoot > tr > td:first-child { grid-column: 1 / -1; font-weight: 700; }
  .bets-table-wrapper > .ledger-table > tbody button { min-height: 44px; padding: 0.5rem 1rem; }
  .bets-table-row-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
}
