/* Sports bet history (sports-history.js): the "My bets" list in the terminal and the bet history
   page. Real-money bets carry a solid accent edge and chip; demo bets a dashed, muted one. */
.sh-list { display: grid; gap: 10px; min-width: 0; color: var(--ink); font-size: 14px; }
.sh-list :where(button) { font: inherit; color: inherit; }
.sh-list :where(p, strong) { margin: 0; }
.sh-list [hidden] { display: none !important; }

.sh-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.sh-tab { min-height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-tab.is-current { background: var(--raised, var(--surface)); color: var(--ink); box-shadow: 0 1px 2px color-mix(in srgb, var(--ink) 18%, transparent); }
.sh-items { display: grid; gap: 8px; min-width: 0; }

.sh-bet { position: relative; min-width: 0; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 12px; background: var(--surface); overflow: hidden; }
.sh-bet::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.sh-bet.is-demo::before { width: 0; border-left: 3px dashed color-mix(in srgb, var(--muted) 70%, transparent); }
.sh-bet-toggle { display: grid; gap: 6px; width: 100%; padding: 11px 12px 11px 15px; border: 0; background: transparent; text-align: start; cursor: pointer; }
.sh-bet-toggle:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.sh-bet-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sh-bet-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sh-wallet { flex: 0 0 auto; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 850; letter-spacing: .03em; text-transform: uppercase; line-height: 1.6; }
.sh-wallet.is-main { background: var(--accent); color: var(--theme-on-accent, #fff); }
.sh-wallet.is-demo { border: 1px dashed color-mix(in srgb, var(--muted) 80%, transparent); color: var(--muted); }
.sh-bet-where { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.sh-status { flex: 0 0 auto; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 850; background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--muted); }
.sh-status.is-won { color: var(--theme-success-ink, var(--positive)); background: var(--theme-success-bg, color-mix(in srgb, var(--positive) 14%, transparent)); }
.sh-status.is-cashed-out { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.sh-status.is-lost { color: var(--theme-error-ink, var(--danger)); background: var(--theme-error-bg, color-mix(in srgb, var(--danger) 14%, transparent)); }
.sh-status.is-credit-pending { color: var(--theme-warning-ink, var(--accent)); background: var(--theme-warning-bg, color-mix(in srgb, var(--accent) 14%, transparent)); }
.sh-bet-event { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.sh-bet-pick { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; min-width: 0; font-size: 13px; }
.sh-bet-market { color: var(--muted); }
.sh-bet-choice { overflow-wrap: anywhere; }
.sh-bet-odds { color: var(--accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.sh-bet-sums { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.sh-bet-sums > span { display: grid; gap: 1px; min-width: 0; }
.sh-bet-sums small { color: var(--muted); font-size: 11px; }
.sh-bet-sums b { font-size: 13px; font-weight: 800; }
.sh-bet-return { text-align: end; }
.sh-bet.is-won .sh-bet-return b { color: var(--theme-success-ink, var(--positive)); }
.sh-bet.is-lost .sh-bet-return b { color: var(--muted); }
.sh-bet-details { display: grid; gap: 6px; padding: 10px 12px 12px 15px; border-top: 1px dashed color-mix(in srgb, var(--line) 80%, transparent); font-size: 12.5px; }
.sh-express-legs { display: grid; gap: 8px; margin: 0 0 4px; padding: 0; list-style: none; }
.sh-express-leg { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 3px 8px; }
.sh-express-fixture { overflow-wrap: anywhere; }
.sh-express-leg .sh-bet-pick { grid-column: 1 / -1; }
.sh-detail { display: flex; justify-content: space-between; gap: 12px; min-width: 0; }
.sh-detail > span:first-child { color: var(--muted); flex: 0 0 auto; }
.sh-detail > span:last-child { min-width: 0; text-align: end; overflow-wrap: anywhere; }
.sh-bet-open { justify-self: start; display: inline-flex; align-items: center; min-height: 36px; margin-top: 2px; padding: 0 12px; border: 1px solid var(--accent); border-radius: 10px; color: var(--accent); font-weight: 800; text-decoration: none; }
.sh-bet-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sh-bet-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; user-select: all; }
.sh-cash-out { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 11px 15px; }
.sh-cash-out-change { color: var(--muted); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sh-cash-out > .sh-cash-out-change { flex-basis: 100%; }
.sh-bet .sh-cash-out-change.is-up { color: var(--theme-success-ink, var(--positive)); }
.sh-bet .sh-cash-out-change.is-down { color: var(--theme-error-ink, var(--danger)); }
.sh-cash-out-button, .sh-cash-out-cancel { min-height: 44px; padding: 4px 12px; border: 1px solid var(--accent); border-radius: 9px; font-weight: 800; cursor: pointer; }
.sh-cash-out-button { flex: 1 1 auto; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.sh-cash-out-cancel { border-color: var(--line); color: var(--muted); background: var(--surface); }
.sh-cash-out-button:disabled { opacity: .68; cursor: default; }
.sh-cash-out :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sh-cash-out-notice { padding: 8px 12px; border-radius: 10px; color: var(--theme-success-ink, var(--positive)); background: var(--theme-success-bg, color-mix(in srgb, var(--positive) 12%, var(--surface))); }
.sh-cash-out-notice.is-error { color: var(--theme-error-ink, var(--danger)); background: var(--theme-error-bg, color-mix(in srgb, var(--danger) 12%, var(--surface))); }

.sh-summary { display: grid; gap: 6px; }
.sh-summary-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 4%, transparent); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sh-summary-row > strong { margin-inline-start: auto; }
.sh-summary-row .is-up { color: var(--theme-success-ink, var(--positive)); }
.sh-summary-row .is-down { color: var(--theme-error-ink, var(--danger)); }

.sh-empty { display: grid; gap: 6px; justify-items: center; padding: 22px 12px; border-radius: 12px; text-align: center; background: color-mix(in srgb, var(--ink) 4%, transparent); }
.sh-empty p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.sh-empty.is-loading { color: var(--muted); }
.sh-more { justify-self: center; min-height: 40px; padding: 0 18px; border: 1px solid var(--accent); border-radius: 10px; background: transparent; color: var(--accent); font-weight: 800; cursor: pointer; }
.sh-note { color: var(--muted); font-size: 12px; text-align: center; }
.sh-list.is-compact .sh-bet-toggle { padding-block: 10px; }
.is-compact-open .sh-bet-toggle { gap: 2px; }
.is-compact-open .sh-bet-event { white-space: normal; overflow-wrap: anywhere; }
.sh-compact-choice { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.is-compact-open .sh-cash-out { align-items: center; column-gap: 10px; }
.sh-cash-out-quote { flex: 1 1 auto; display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 7px; min-width: 0; }
.sh-cash-out-price { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sh-price-unavailable { color: var(--muted); font-size: 12px; }
.is-compact-open .sh-cash-out-button { flex: 0 1 auto; margin-inline-start: auto; max-width: 100%; padding-inline: 10px; }

/* ---------- Bet history page (/bets/history) and its button on the Ставки page ---------- */
/* While the page is open it takes over Ставки (the terminal, tiles and game pages stay in the page). */
#lobby-sports.has-sports-history.has-sports-history > :not(.lobby-section-heading, .sports-history-page) { display: none !important; }
#lobby-sports.has-sports-history.has-sports-history > .sports-history-page:not([hidden]) { display: grid !important; }
/* The button sits above the Ставки page (tiles, game and event pages); the terminal has its own in its header. */
.sports-history-bar { display: flex; justify-content: flex-end; min-width: 0; margin: 0 0 12px; }
.sports-history-bar:not(:has(> .sports-history-link:not([hidden]))) { display: none; }
.sports-history-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--ink); font-size: 14px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.sports-history-link[hidden] { display: none !important; }
.sports-history-link svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent); }
.sports-history-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) { .sports-history-link:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); } }
.sports-history-page { display: grid; gap: 14px; width: 100%; max-width: 860px; min-width: 0; margin-inline: auto; padding-bottom: 24px; }
.sports-history-page[hidden] { display: none !important; }
.sh-page-back { justify-self: start; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 750; cursor: pointer; }
.sh-page-head { display: grid; gap: 4px; }
.sh-page-title { margin: 0; font-size: 24px; font-weight: 850; letter-spacing: -.3px; }
.sh-page-lead { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.sh-page-list { min-width: 0; }
.sh-page-list .sh-tabs { max-width: 420px; }
.sh-page-list .sh-items { grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); align-items: start; }
@media (max-width: 560px) {
  .sports-history-link { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .sh-page-title { font-size: 21px; }
  .sh-page-list .sh-tabs { max-width: none; }
}
/* Terminal header: Bet history next to the balance; an icon-only button on narrow layouts. */
.sports-terminal .st-head-history { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sports-terminal .st-head-history .st-icon { width: 18px; height: 18px; color: var(--accent); }
.sports-terminal .st-head-history .st-icon svg { width: 100%; height: 100%; display: block; }
.sports-terminal[data-size="narrow"] .st-head .st-head-history { display: inline-flex; min-width: 40px; padding: 0 10px; justify-content: center; }
.sports-terminal[data-size="narrow"] .st-head-history-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sports-terminal .st-history-all { justify-self: stretch; }
