/*
 * Bet Finder - the Proform page's look, copied from its own source
 * (proformracing.com: src/views/BetFinderView.vue, RaceGuideDatePicker.vue,
 * tailwind.config.js, read 27-09-2026). Everything is scoped under #bet-finder
 * and every class is bf- prefixed, so nothing here can collide with a Tailwind
 * utility (CLAUDE.md: never name a modifier after a positional utility).
 *
 * Restyle stage 7 (13-10-2026): the page is in the shared theme (rm-theme.css),
 * with its look unchanged. Every colour reads a --rm-* token, or one of the page
 * tokens below where the shared set has no colour within a shade: the Bet / Lay /
 * Trade fills, the winner rows, the returns' up / down figures, the modal scrim,
 * the greyed control on the band and the live "So far today" line. Each page
 * token has a light value and a dark value (dark is screen only, so print stays light).
 */
html[data-restyle] #bet-finder {
    /* Bet / Lay / Trade: the active fill and the text on it (dark: Bet fills white, Lay the light red) */
    --bf-bet: #06414F;
    --bf-on-bet: #ffffff;
    --bf-lay: #7a0704;
    --bf-on-lay: #ffffff;
    --bf-trade: #2db674;
    --bf-on-trade: #ffffff;
    /* the winning row in the list (Bet / Trade, and Lay) */
    --bf-first-bg: #dcfce7;
    --bf-first-lay-bg: #fee2e2;
    /* the returns table's profit / loss figures */
    --bf-up: #15803d;
    --bf-down: #b91c1c;
    /* the save / load modal's backdrop */
    --bf-scrim: rgba(6, 65, 79, 0.3);
    /* a control on the teal band that cannot be used yet */
    --bf-band-off: #6b7280;
    /* fast results, live: the "So far today" line and its (provisional) mark */
    --bf-tally-bg: #ecfdf5;
    --bf-tally-line: #a7f3d0;
    --bf-tally-text: #065f46;
    --bf-prov-text: #92400e;
    --bf-prov-line: #d97706;
}
@media screen {
html[data-restyle][data-theme="dark"] #bet-finder {
    --bf-bet: #ffffff;
    --bf-on-bet: #06414F;
    --bf-lay: #ff8a80;
    --bf-on-lay: #04323d;
    --bf-trade: #2db674;
    --bf-on-trade: #ffffff;
    --bf-first-bg: rgba(45, 182, 116, 0.22);
    --bf-first-lay-bg: rgba(255, 138, 128, 0.2);
    --bf-up: #6ccc9e;
    --bf-down: #ff8a80;
    --bf-scrim: rgba(0, 0, 0, 0.6);
    --bf-band-off: rgba(255, 255, 255, 0.4);
    --bf-tally-bg: rgba(45, 182, 116, 0.14);
    --bf-tally-line: rgba(45, 182, 116, 0.45);
    --bf-tally-text: #6ccc9e;
    --bf-prov-text: #fcc319;
    --bf-prov-line: #fcc319;
}
}
#bet-finder {
    --bf-accent: var(--bf-bet);              /* active colour: follows the tab */
    --bf-on-accent: var(--bf-on-bet);
    font-family: 'Manrope', sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--rm-text);
    padding: 20px;
    /* the full window width, as Proform's page (Simon, 13-10-2026; was capped at 1680px) */
    max-width: none;
    margin: 0;
    box-sizing: border-box;
}
#bet-finder *, #bet-finder *::before, #bet-finder *::after { box-sizing: border-box; font-family: inherit; }
#bet-finder.bf-L { --bf-accent: var(--bf-lay); --bf-on-accent: var(--bf-on-lay); }
#bet-finder.bf-T { --bf-accent: var(--bf-trade); --bf-on-accent: var(--bf-on-trade); }
#bet-finder button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
#bet-finder a { color: inherit; text-decoration: none; }
#bet-finder [hidden] { display: none !important; }
#bet-finder .bf-ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---- admin banner (ours, not Proform's) ---- */

/* ---- date slider ---- */
#bet-finder .bf-dates { background: var(--rm-page); margin-bottom: 20px; position: sticky; top: 0; z-index: 20; }
#bet-finder .bf-dates-inner { background: var(--rm-band); color: var(--rm-on-band); padding: 8px; box-shadow: inset var(--rm-band-edge); }
#bet-finder .bf-dates-nav { display: flex; align-items: center; position: relative; }
#bet-finder .bf-dates-nav::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 80px; z-index: 10; pointer-events: none; background: linear-gradient(to left, var(--rm-band), transparent); }
#bet-finder .bf-cal { position: relative; font-size: 36px; line-height: 1; display: flex; }
#bet-finder .bf-cal .bf-ico { stroke-width: 0.75; }
#bet-finder .bf-cal input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
#bet-finder .bf-vr { background: var(--rm-on-band); width: 1px; height: 40px; border: 0; margin: 0 20px; flex: none; }
#bet-finder .bf-arrow { font-size: 20px; line-height: 1; flex: none; }
#bet-finder .bf-arrow .bf-ico { stroke-width: 0.9; }
#bet-finder .bf-arrow-prev { padding-right: 20px; }
#bet-finder .bf-arrow-next { position: absolute; right: 0; z-index: 20; padding-left: 20px; }
#bet-finder .bf-strip { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; padding-right: 60px; flex: 1; min-width: 0; }
#bet-finder .bf-strip::-webkit-scrollbar { display: none; }
#bet-finder .bf-date { text-transform: uppercase; white-space: nowrap; font-weight: 200; font-size: 13px; line-height: 16px; cursor: pointer; }
#bet-finder .bf-date.bf-on { font-weight: 700; }

/* ---- the shared button ---- */
#bet-finder .bf-btn {
    cursor: pointer; position: relative; font-size: 13px; line-height: 16px; display: block;
    border: 1px solid var(--rm-ctl-line); border-radius: 6px; padding: 8px 8px;
    text-align: center; color: var(--rm-text); font-weight: 700; background: var(--rm-btn-bg);
}
#bet-finder .bf-btn.bf-active { background: var(--bf-accent); color: var(--bf-on-accent); }
#bet-finder .bf-btn .bf-count { position: absolute; top: 4px; right: 4px; font-size: 9px; line-height: 9px; }
#bet-finder .bf-btn.bf-pad1 { padding-right: 12px; }
#bet-finder .bf-btn.bf-pad2 { padding-right: 16px; }
#bet-finder .bf-btn.bf-pad3 { padding-right: 20px; }
#bet-finder .bf-btn.bf-pad4 { padding-right: 24px; }
/* a button with no agreed RaceMetrics definition yet (ours, not Proform's) */
#bet-finder .bf-btn.bf-na { color: var(--rm-text-faint); border-style: dashed; cursor: not-allowed; font-weight: 600; }
#bet-finder .bf-btn.bf-na .bf-count { color: var(--rm-text-faint); }

/* ---- BET / LAY / TRADE ---- */
#bet-finder .bf-blt { padding: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: var(--rm-surface); }
#bet-finder .bf-blt .bf-btn { text-transform: uppercase; }
#bet-finder .bf-blt .bf-btn[data-blt="B"].bf-active { background: var(--bf-bet); color: var(--bf-on-bet); }
#bet-finder .bf-blt .bf-btn[data-blt="L"].bf-active { background: var(--bf-lay); color: var(--bf-on-lay); }
#bet-finder .bf-blt .bf-btn[data-blt="T"].bf-active { background: var(--bf-trade); color: var(--bf-on-trade); }

/* ---- two columns ---- */
#bet-finder .bf-cols { margin-top: 20px; }
#bet-finder .bf-card { background: var(--rm-surface); box-shadow: var(--rm-shadow); display: flex; flex-direction: column; }
#bet-finder .bf-card + .bf-card { margin-top: 20px; }
#bet-finder .bf-title { padding: 20px; text-transform: uppercase; font-weight: 700; color: var(--rm-text); display: flex; border-bottom: 1px solid var(--rm-line); align-items: center; }
#bet-finder .bf-title.bf-split { justify-content: space-between; }
#bet-finder .bf-busy { opacity: .5; pointer-events: none; }

/* race picker */
#bet-finder .bf-racepick { margin: 20px 20px 0; }
#bet-finder .bf-trigger { cursor: pointer; font-size: 13px; line-height: 16px; display: flex; width: 100%; border: 1px solid var(--rm-ctl-line); border-radius: 6px; padding: 8px; text-align: center; font-weight: 700; background: var(--bf-accent); color: var(--bf-on-accent); gap: 8px; align-items: center; }
#bet-finder .bf-trigger .bf-grow { flex-grow: 1; }
#bet-finder .bf-trigger .bf-dim { opacity: .15; }
#bet-finder .bf-racemore { margin-top: 8px; font-size: 12px; text-align: center; }
#bet-finder .bf-racepanel h2 { margin: 20px 0; font-size: 16px; font-weight: 400; }
#bet-finder .bf-racetabs { display: flex; margin-bottom: 20px; }
#bet-finder .bf-racetabs button { background: var(--rm-zebra); flex-grow: 1; padding: 8px; }
#bet-finder .bf-racetabs button:not(:first-of-type) { border-left: 1px solid var(--rm-surface); }
#bet-finder .bf-racetabs button.bf-active { background: var(--bf-accent); color: var(--bf-on-accent); }
#bet-finder .bf-course { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; font-size: 12px; line-height: 16px; align-items: start; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--rm-zebra); }
#bet-finder .bf-course > button { text-align: left; }
#bet-finder .bf-course ul { grid-column: span 2 / span 2; display: flex; gap: 8px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
#bet-finder .bf-course .bf-active { color: var(--bf-accent); font-weight: 700; }

/* rating rank */
#bet-finder .bf-ranks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 12px; background: var(--rm-recess); margin-top: 20px; }
#bet-finder .bf-simple { margin: 20px; }
#bet-finder .bf-simple-label { display: block; margin-bottom: 12px; color: var(--rm-text); }
#bet-finder .bf-wrap { display: flex; flex-wrap: wrap; gap: 12px; }

/* advanced accordion */
#bet-finder .bf-action { color: var(--rm-action); text-transform: uppercase; font-size: 13px; line-height: 16px; font-weight: 700; }
#bet-finder .bf-action.bf-active { color: var(--rm-tertiary); }
#bet-finder .bf-action.bf-disabled { color: var(--rm-text-faint); cursor: not-allowed; }
#bet-finder .bf-acc-body-wrap { padding: 20px; }
#bet-finder .bf-acc { border: 1px solid var(--rm-line); border-radius: 6px; }
#bet-finder .bf-acc:not(:last-child) { margin-bottom: 12px; }
#bet-finder .bf-acc-trigger { color: var(--rm-text); padding: 0 20px; display: flex; cursor: pointer; width: 100%; text-align: left; }
#bet-finder .bf-acc-trigger > span { margin: 8px 0; }
#bet-finder .bf-acc-trigger > span:first-child { border-right: 1px solid var(--rm-line); padding-right: 8px; margin-right: 16px; width: 96px; font-weight: 700; flex: none; }
#bet-finder .bf-acc-trigger > span:last-child { flex-grow: 1; text-align: right; color: var(--rm-action); }
#bet-finder .bf-acc-body { padding: 20px; display: flex; flex-wrap: wrap; gap: 12px; }

/* results */
#bet-finder .bf-results-card { margin-top: 20px; }
#bet-finder .bf-results-title { justify-content: space-between; background: var(--rm-surface); }
#bet-finder .bf-actions .bf-action { margin-left: 20px; }
#bet-finder .bf-actions .bf-action span { display: none; }
#bet-finder .bf-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; justify-content: space-between; }
#bet-finder .bf-list { flex: 1; overflow: auto; color: var(--rm-text); }
#bet-finder .bf-list::-webkit-scrollbar { width: 22px; }
#bet-finder .bf-list::-webkit-scrollbar-track { background: var(--rm-rule); border-bottom-right-radius: 6px; }
#bet-finder .bf-list::-webkit-scrollbar-thumb { background: var(--rm-text); }
#bet-finder .bf-item { display: flex; flex-wrap: wrap; }
#bet-finder .bf-list > .bf-item:nth-child(even) { background: var(--rm-zebra); }
#bet-finder .bf-list > .bf-item.bf-first { background: var(--bf-first-bg); }
#bet-finder.bf-L .bf-list > .bf-item.bf-first { background: var(--bf-first-lay-bg); }
#bet-finder .bf-data { display: flex; padding: 8px; gap: 12px; width: 100%; }
#bet-finder .bf-icon { color: var(--rm-action); }
#bet-finder .bf-detail { flex-grow: 1; font-size: 13px; line-height: 16px; cursor: pointer; min-width: 0; }
#bet-finder .bf-detail > span { display: block; }
#bet-finder .bf-detail > span + span { display: flex; align-items: center; margin-top: 2px; }
#bet-finder .bf-detail a:hover { text-decoration: underline; }
#bet-finder .bf-silk { width: 24px; height: auto; display: inline-block; margin-right: 8px; transition: transform .15s; position: relative; z-index: 0; flex: none; }
#bet-finder .bf-silk:hover { transform: scale(2.5); z-index: 5; }
#bet-finder .bf-pos { min-width: 40px; text-align: center; }
#bet-finder .bf-pos .bf-won { font-weight: 700; }
#bet-finder .bf-stats { font-size: 12px; line-height: 16px; min-width: 96px; }
#bet-finder .bf-stats > span { display: block; }
#bet-finder .bf-chev { display: flex; align-items: flex-start; }
#bet-finder .bf-sel { width: 100%; font-size: 12px; line-height: 16px; padding: 8px; display: none; }
#bet-finder .bf-sel.bf-open { display: block; }
#bet-finder .bf-sel ul { margin: 0; padding: 0 0 0 16px; }
#bet-finder .bf-empty { display: block; width: 100%; padding: 20px; text-align: center; }
#bet-finder .bf-loading { display: flex; justify-content: center; padding: 40px 20px; }
#bet-finder .bf-spin { width: 30px; height: 30px; border: 3px solid var(--rm-line); border-top-color: var(--rm-text); border-radius: 50%; animation: bf-spin .8s linear infinite; }
@keyframes bf-spin { to { transform: rotate(360deg); } }
#bet-finder .bf-note { font-size: 11px; color: var(--rm-text-dim); padding: 6px 20px; border-top: 1px solid var(--rm-zebra); }
/* fast results, live: the "So far today" line (the qualifiers hub's .qhfr-tally look, from
   qualifiers-fast-result.js) and the position slot beside a horse (.frb-slot, fast-results-badges.js) */
#bet-finder .bf-fr-tally { flex: none; margin: 8px 12px 6px; }
/* the line's colours are qualifiers-fast-result.js's own (light), held here as page tokens so dark follows */
#bet-finder .qhfr-tally { color: var(--bf-tally-text); background: var(--bf-tally-bg); border-color: var(--bf-tally-line); }
#bet-finder .qhfr-prov { color: var(--bf-prov-text); border-bottom-color: var(--bf-prov-line); }
#bet-finder .bf-detail .frb-slot { margin-right: 2px; }

/* control bar + selected filters */
/* below lg the dock is fixed like Proform's; --bf-bottom lifts it above the site's own
   mobile tab bar (.rmnav-bbar), measured by the page script */
#bet-finder .bf-controls-dock { position: fixed; left: 0; right: 0; bottom: var(--bf-bottom, 0px); z-index: 20; }
#bet-finder .bf-selected { background: var(--rm-zebra); padding: 20px 20px 24px; display: flex; flex-direction: column; }
#bet-finder .bf-selected h2 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; font-size: 16px; font-weight: 400; }
#bet-finder .bf-selected h2 > span { font-weight: 700; color: var(--rm-text); }
#bet-finder .bf-selected h2 > div { display: flex; gap: 12px; }
#bet-finder .bf-returns { background: var(--rm-surface); border-top: 1px solid var(--rm-zebra); padding: 10px 20px; max-height: 45vh; overflow: auto; }
#bet-finder .bf-returns h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; font-size: 14px; font-weight: 400; }
#bet-finder .bf-returns h2 > span { font-weight: 700; color: var(--rm-text); }
#bet-finder .bf-returns h2 > div { display: flex; gap: 8px; flex-wrap: wrap; }
#bet-finder .bf-returns-t { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
#bet-finder .bf-returns-t th, #bet-finder .bf-returns-t td { padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--rm-zebra); white-space: nowrap; }
#bet-finder .bf-returns-t th:first-child, #bet-finder .bf-returns-t td:first-child { text-align: left; }
#bet-finder .bf-returns-t th { font-size: 11px; text-transform: uppercase; color: var(--rm-text-dim); font-weight: 600; }
#bet-finder .bf-returns-t .bf-up { color: var(--bf-up); font-weight: 600; }
#bet-finder .bf-returns-t .bf-down { color: var(--bf-down); font-weight: 600; }
#bet-finder .bf-returns-msg { font-size: 11px; color: var(--rm-text-dim); margin: 6px 0 0; }
#bet-finder .bf-chips { display: flex; gap: 8px; flex-wrap: wrap; }
#bet-finder .bf-chips button { display: inline-flex; align-items: center; }
#bet-finder .bf-chips .bf-chip-name { font-size: 13px; line-height: 16px; }
#bet-finder .bf-chips .bf-chip-name b { font-weight: 700; }
#bet-finder .bf-chips .bf-chip-name small { font-size: 9px; line-height: 12px; }
#bet-finder .bf-chips .bf-ico { margin-left: 4px; font-size: 14px; color: var(--rm-action); }
#bet-finder .bf-controls { background: var(--rm-band); color: var(--rm-on-band); box-shadow: inset var(--rm-band-edge); position: relative; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); text-align: center; padding: 12px; font-size: 12px; line-height: 16px; }
#bet-finder .bf-controls button { padding: 8px 0; text-transform: uppercase; }
#bet-finder .bf-controls button .bf-ico { display: block; margin: 0 auto 2px; font-size: 16px; }
#bet-finder .bf-controls .bf-big { font-size: 20px; line-height: 28px; font-weight: 700; display: block; }
#bet-finder .bf-controls .bf-disabled { color: var(--bf-band-off); cursor: not-allowed; }
#bet-finder .bf-controls .bf-word { display: none; }
#bet-finder .bf-spacer { height: calc(110px + var(--bf-bottom, 0px)); }

/* modal (save / load) */
#bet-finder .bf-modal { position: fixed; inset: 0; background: var(--bf-scrim); z-index: 60; display: flex; align-items: center; justify-content: center; }
#bet-finder .bf-modal-box { background: var(--rm-surface); color: var(--rm-text); border-radius: 6px; padding: 24px; width: min(90vw, 420px); box-shadow: var(--rm-pop-shadow); }
#bet-finder .bf-modal-box h3 { margin: 0 0 12px; font-size: 16px; }
#bet-finder .bf-modal-box input { width: 100%; padding: 8px; background: var(--rm-field); color: var(--rm-text); border: 1px solid var(--rm-ctl-line); border-radius: 6px; font-size: 14px; }
#bet-finder .bf-modal-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
#bet-finder .bf-saved { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
#bet-finder .bf-saved li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--rm-zebra); font-size: 13px; }

@media (min-width: 375px) {
    #bet-finder .bf-controls .bf-word { display: inline; }
}
@media (min-width: 640px) {
    #bet-finder .bf-actions .bf-action span { display: inline; }
    #bet-finder .bf-controls button .bf-ico { display: inline-block; margin: 0 8px 0 0; }
}
@media (min-width: 1024px) {
    #bet-finder .bf-dates { top: 0; }
    #bet-finder .bf-dates-inner { border-radius: 6px; padding: 24px; }
    #bet-finder .bf-btn { display: inline-block; }
    #bet-finder .bf-card { border-radius: 6px; }
    #bet-finder .bf-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: stretch; }
    #bet-finder .bf-results-card { margin-top: 0; position: sticky; top: 110px; max-height: calc(100vh - 120px); align-self: start; min-height: 400px; }
    #bet-finder .bf-results-card.bf-tall { height: calc(100vh - 120px); }
    #bet-finder .bf-results-title { border-top-left-radius: 6px; border-top-right-radius: 6px; }
    #bet-finder .bf-actions .bf-action span { display: none; }
    #bet-finder .bf-ranks { border-radius: 6px; margin-left: 20px; margin-right: 20px; }
    #bet-finder .bf-controls-dock { position: sticky; bottom: 0; }
    #bet-finder .bf-controls { border-radius: 6px; }
    #bet-finder .bf-controls button:not(:last-child) { border-right: 1px solid var(--rm-on-band); }
    #bet-finder .bf-controls .bf-word { display: none; }
    #bet-finder .bf-selected { border-top-left-radius: 6px; border-top-right-radius: 6px; }
    #bet-finder .bf-spacer { display: none; }
}
@media (min-width: 1280px) {
    #bet-finder .bf-btn { padding-left: 20px; padding-right: 20px; }
    #bet-finder .bf-btn.bf-pad1 { padding-right: 20px; }
    #bet-finder .bf-btn.bf-pad2 { padding-right: 24px; }
    #bet-finder .bf-btn.bf-pad3 { padding-right: 28px; }
    #bet-finder .bf-btn.bf-pad4 { padding-right: 32px; }
    #bet-finder .bf-trigger { padding-left: 20px; padding-right: 20px; }
    #bet-finder .bf-controls { font-size: 13px; }
    #bet-finder .bf-controls .bf-word { display: inline; }
}
@media (min-width: 1400px) {
    #bet-finder { padding: 40px; }
    #bet-finder .bf-cols { gap: 40px; margin-top: 40px; }
    #bet-finder .bf-card + .bf-card { margin-top: 40px; }
}
@media (min-width: 1536px) {
    #bet-finder .bf-data { padding: 20px; }
    #bet-finder .bf-sel { padding: 20px; }
    #bet-finder .bf-detail { font-size: 14px; line-height: 20px; }
}
@media (min-width: 1750px) {
    #bet-finder .bf-actions .bf-action span { display: inline; }
}
@media print {
    #rmx-header, #rm-nav-bar, #bet-finder .bf-dates, #bet-finder .bf-blt, #bet-finder .bf-filters-col, #bet-finder .bf-controls-dock, #bet-finder .bf-actions { display: none !important; }
    #bet-finder .bf-cols { display: block; }
    #bet-finder .bf-results-card { position: static; max-height: none; height: auto; box-shadow: none; }
    #bet-finder .bf-list { overflow: visible; }
    #bet-finder .bf-item { border-bottom: 1px solid var(--rm-line); }
    #bet-finder .bf-print-date { display: block !important; }
}
