:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --border: #d8dee8;
  --primary: #116a5c;
  --primary-dark: #0d5147;
  --good: #087443;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 360px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }

.app-header { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--border); padding: 12px; }
.app-header h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.app-header p { margin: 3px 0 10px; color: var(--muted); font-size: 12px; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tab { border: 1px solid var(--border); background: #f9fafb; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

main { padding: 12px; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.lines-sticky-controls { position: sticky; top: 92px; z-index: 3; margin: -4px -4px 8px; padding: 4px; background: var(--bg); border-bottom: 1px solid rgba(216, 222, 232, .7); }
.toolbar { position: relative; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.primary { border: 0; background: var(--primary); color: #fff; padding: 8px 11px; border-radius: 6px; cursor: pointer; }
.primary:hover { background: var(--primary-dark); }
.primary:disabled { opacity: .65; cursor: wait; }
.ghost { margin-left: auto; border: 1px solid var(--border); background: #fff; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
#lines-hide-bet-placed.is-selected { border-color: var(--primary); outline: 2px solid rgba(17, 106, 92, .28); outline-offset: 2px; color: var(--primary); font-weight: 700; }
.small-button { border: 1px solid var(--border); background: #fff; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.small-button:hover { border-color: var(--primary); color: var(--primary); }
.small-button:disabled { opacity: .5; cursor: default; }
.small-button.danger:hover { border-color: #b42318; color: #b42318; }
.small-button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.small-button.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); color: #fff; }
.link-button { border: 0; background: transparent; color: var(--primary); padding: 0; font-size: 12px; cursor: pointer; }
.icon-button { border: 1px solid var(--border); background: #fff; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; }
.compact { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.compact input { width: 54px; }
input, select { border: 1px solid var(--border); border-radius: 6px; padding: 7px 8px; background: #fff; }
.status { min-height: 18px; margin: 6px 0; font-size: 13px; }
.meta { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.calc-panel { display: grid; gap: 10px; margin-bottom: 10px; }
.calc-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.calc-card h2 { margin: 0 0 10px; font-size: 14px; }
.calc-table {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}
.free-grid {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
}
.calc-label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.calc-card input { width: 100%; min-width: 0; font-family: var(--mono); text-align: right; }
.calc-card input[readonly] { background: #eef2f7; color: #475569; }
.money-field { position: relative; display: block; }
.money-field span {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.money-field input { padding-left: 20px; }
.calc-metrics { display: grid; gap: 8px; margin-top: 10px; }
.calc-metrics-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.calc-metrics > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid #eef1f5;
  border-radius: 6px;
  background: #f8fafc;
}
.calc-metrics span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.calc-metrics b { display: block; margin-top: 3px; font-family: var(--mono); font-size: 13px; }
.saved-filter-bar { display: grid; grid-template-columns: 1fr; gap: 7px; align-items: end; margin: 0 0 10px; padding: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.saved-filter-bar label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.saved-filter-bar select { width: 100%; min-width: 0; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 4; background: rgba(15, 23, 42, .26); }
.scope-drawer { position: fixed; top: 0; right: 0; z-index: 5; width: min(340px, 92vw); height: 100vh; padding: 14px; background: var(--panel); border-left: 1px solid var(--border); box-shadow: -12px 0 28px rgba(15, 23, 42, .16); transform: translateX(105%); transition: transform .18s ease; overflow: auto; }
.scope-drawer.is-open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.scope-menu { margin-bottom: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.scope-menu summary { font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; }
.filter-editor { display: grid; gap: 8px; padding-top: 9px; }
.filter-editor input { width: 100%; }
.filter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.inline-status { min-height: 17px; margin: 0; color: var(--good); font-size: 12px; font-weight: 700; }
.bulk-actions { display: flex; gap: 10px; padding-top: 9px; }
.select-list { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 9px; }
.select-pill { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 999px; padding: 7px 10px; font-size: 12px; cursor: pointer; }
.select-pill.is-selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.odds-range-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 9px; }
.odds-range-row label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.odds-range-row input { width: 100%; min-width: 0; }
.side-book-menu { position: static; }
.side-book-menu summary {
  list-style: none;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
}
.side-book-menu summary::-webkit-details-marker { display: none; }
.side-book-menu summary::after { content: "v"; margin-left: 6px; color: var(--muted); }
.side-book-menu[open] summary { border-color: var(--primary); color: var(--primary); }
.side-book-panel {
  position: absolute;
  z-index: 3;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  width: auto;
  max-width: none;
  max-height: 280px;
  overflow: auto;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, .14);
}
.side-book-panel .bulk-actions { padding-top: 0; }
.session-list { display: grid; gap: 6px; padding-top: 10px; }
.session-row { display: grid; grid-template-columns: minmax(90px, 1fr) auto; gap: 8px; align-items: center; padding: 6px 7px; background: #f8fafc; border: 1px solid #eef1f5; border-radius: 6px; font-size: 12px; }
.session-row small { grid-column: 1 / -1; color: var(--muted); }
.session-badge { border-radius: 999px; padding: 3px 7px; background: #e5e7eb; color: #374151; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.session-badge.active { background: #dcfce7; color: #166534; }
.session-badge.needs-login { background: #fee2e2; color: #991b1b; }
.session-badge.error { background: #ffedd5; color: #9a3412; }

.opportunity-list { display: flex; flex-direction: column; gap: 8px; }
.opp-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.opp-card--bet { background: #fff1f2; border-color: #fca5a5; }
.opp-card--related-bet { background: #fffbeb; border-color: #facc15; }
.opp-card--free-play { background: #f0fdf9; border-color: #99f6e4; }
.opp-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.opp-head h3 { margin: 0; font-size: 14px; }
.opp-head p { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.opp-head strong { font-family: var(--mono); font-size: 15px; }
.opp-head strong.arb { color: var(--good); }
.market-badge { display: inline-block; border: 1px solid #bfdbfe; border-radius: 4px; background: #eff6ff; color: #1d4ed8; padding: 2px 5px; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.sides { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 10px 0; }
.side-row { display: grid; grid-template-columns: minmax(70px, .8fr) minmax(82px, 1fr) minmax(90px, 1fr) 72px 82px; gap: 7px; align-items: end; padding: 7px; background: #f8fafc; border-radius: 6px; }
.side-row label { display: grid; gap: 2px; color: var(--muted); font-size: 10px; }
.side-row input, .side-row select { width: 100%; padding: 5px 6px; font-family: var(--mono); font-size: 12px; }
.side-outcome { font-family: var(--mono); font-size: 12px; align-self: center; }
.side-next-best {
  grid-column: 2 / -1;
  width: max-content;
  max-width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  text-align: left;
}
.side-next-best:hover { color: var(--primary); text-decoration: underline; }
.book-label { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 12px; font-weight: 700; }
.book-label-col { display: inline-flex; align-items: flex-start; gap: 6px; min-width: 0; }
.source-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.source-tag { display: inline-block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 3px; padding: 1px 5px; line-height: 1.6; }
.src-odds-api { background: #dbeafe; color: #1e40af; }
.src-bmr { background: #fef3c7; color: #92400e; }
.src-oddspapi { background: #cffafe; color: #155e75; }
.src-xtos { background: #ede9fe; color: #5b21b6; }
.src-betphoenix { background: #ffe4e6; color: #9f1239; }
.src-bookmaker-direct { background: #111827; color: #facc15; }
.src-betnow { background: #fff7ed; color: #c2410c; }
.src-sevenstacks { background: #e0f2fe; color: #075985; }
.src-local { background: #dcfce7; color: #166534; }
.side-age { display: inline-block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 3px; padding: 1px 5px; line-height: 1.6; background: #fee2e2; color: #991b1b; }
.book-logo-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  max-width: 58px;
  min-width: 30px;
  color: var(--text);
  text-align: center;
  vertical-align: top;
}
.book-logo {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 28px;
  height: 26px;
  padding: 0 5px;
  border-radius: 6px;
  background: #223044;
  color: #fff;
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 900;
  letter-spacing: .02em;
  line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18), 0 1px 2px rgba(15, 23, 42, .18);
  overflow: hidden;
}
.book-logo::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: rgba(255, 255, 255, .28);
}
.book-logo-name {
  display: block;
  width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logo-draftkings { background: linear-gradient(135deg, #f97316 0 32%, #16a34a 33%); }
.logo-fanduel { background: linear-gradient(135deg, #174ea6, #0b72d9); }
.logo-betmgm { background: linear-gradient(135deg, #111827, #b8860b); color: #f8e7a1; }
.logo-betrivers { background: linear-gradient(135deg, #f4c430 0 35%, #0f766e 36%); color: #082f49; }
.logo-caesars { background: linear-gradient(135deg, #fff7ed 0 38%, #b45309 39%); color: #7c2d12; }
.logo-espnbet { background: linear-gradient(135deg, #dc2626, #111827); }
.logo-fanatics { background: linear-gradient(135deg, #e11d48, #991b1b); }
.logo-bet365 { background: linear-gradient(135deg, #0b6b3a 0 70%, #f5c518 71%); color: #fff; }
.logo-hardrockbet { background: linear-gradient(135deg, #4f46e5, #111827); }
.logo-fliff { background: linear-gradient(135deg, #06b6d4, #0f766e); }
.logo-novig { background: linear-gradient(135deg, #6d28d9, #111827); }
.logo-pinnacle { background: linear-gradient(135deg, #111827, #475569); color: #facc15; }
.logo-betonline { background: linear-gradient(135deg, #0c5d8d, #ef4444); }
.logo-bookmaker { background: linear-gradient(135deg, #111827, #374151); color: #facc15; }
.logo-heritage { background: linear-gradient(135deg, #7f1d1d, #dc2626); }
.logo-justbet { background: linear-gradient(135deg, #115e59, #14b8a6); }
.logo-everygame { background: linear-gradient(135deg, #4c1d95, #7c3aed); }
.logo-betanything { background: linear-gradient(135deg, #7c2d12, #f59e0b); }
.logo-bet105 { background: linear-gradient(135deg, #365314, #84cc16); color: #f7fee7; }
.logo-bovada { background: linear-gradient(135deg, #111827, #dc2626); }
.logo-betus { background: linear-gradient(135deg, #0f172a, #2563eb); }
.logo-mybookieag { background: linear-gradient(135deg, #111827, #16a34a); }
.logo-bfagaming { background: linear-gradient(135deg, #0f766e, #134e4a); }
.logo-kbcsports { background: linear-gradient(135deg, #1d4ed8, #0f172a); }
.logo-snow77 { background: linear-gradient(135deg, #e0f2fe, #64748b); color: #0f172a; }
.logo-wagerattack { background: linear-gradient(135deg, #b45309, #7c2d12); }
.logo-primeplays { background: linear-gradient(135deg, #be123c, #312e81); }
.logo-7stacks { background: linear-gradient(135deg, #334155, #0f172a); color: #e2e8f0; }
.logo-eldorado { background: linear-gradient(135deg, #facc15, #92400e); color: #422006; }
.logo-dragon { background: linear-gradient(135deg, #991b1b, #f97316); }
details { border-top: 1px solid var(--border); padding-top: 7px; }
summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.ao-table { font-family: var(--mono); margin-top: 10px; }
.ao-header { display: grid; grid-template-columns: 1fr 68px 1fr; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-bottom: 6px; }
.ao-header > span:last-child { text-align: right; }
.ao-row { display: grid; grid-template-columns: 1fr 68px 1fr; gap: 6px; align-items: center; border-top: 1px solid #eef1f5; padding: 5px 0; }
.ao-label { font-size: 9px; font-weight: 800; text-transform: uppercase; text-align: center; color: var(--muted); line-height: 1.4; }
.ao-cell { font-size: 14px; font-weight: 800; }
.ao-left { text-align: right; }
.ao-right { text-align: left; }
.ao-hl { background: #1a3328; color: #fff; padding: 6px 10px; border-radius: 5px; text-align: center; }
.ao-best { color: var(--good); }
.ao-point { display: block; font-size: 10px; font-weight: 400; color: var(--muted); }
.ao-logo { display: flex; justify-content: center; align-items: flex-start; gap: 4px; flex-wrap: wrap; }

.opp-bet-notice { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; padding: 5px 9px; background: #ecfdf5; border: 1px solid #6ee7b7; border-radius: 6px; font-size: 12px; color: #065f46; }
.opp-bet-notice--related { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.opp-bet-flag { font-weight: 700; }
.opp-bet-staked { margin-left: auto; font-family: var(--mono); font-weight: 700; }
.card-actions { display: flex; justify-content: flex-end; margin: 6px 0 2px; }
.submit-bet-btn { font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 10; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop[hidden] { display: none; }
.modal-box { background: var(--panel); border-radius: 10px; padding: 16px; width: 100%; max-width: 340px; box-shadow: 0 20px 40px rgba(15, 23, 42, .28); }
.modal-title { margin: 0 0 12px; font-size: 15px; }
.modal-event { margin: 0 0 2px; font-weight: 700; font-size: 13px; }
.modal-market { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.modal-sides { display: grid; gap: 6px; margin-bottom: 12px; }
.modal-side { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(98px, .8fr) auto auto; gap: 8px; align-items: center; background: #f8fafc; padding: 8px; border-radius: 6px; font-size: 12px; }
.modal-outcome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-book-select { width: 100%; min-width: 0; font-size: 12px; padding: 4px 5px; }
.modal-price { font-family: var(--mono); font-weight: 700; }
.modal-stake { font-family: var(--mono); font-weight: 700; }
.modal-price-input { width: 64px; font-family: var(--mono); font-weight: 700; font-size: 13px; padding: 3px 5px; text-align: center; }
.modal-stake-input { width: 74px; font-family: var(--mono); font-weight: 700; font-size: 13px; padding: 3px 5px; text-align: right; }
.modal-scenarios { display: grid; gap: 3px; padding-top: 10px; border-top: 1px solid var(--border); margin-bottom: 14px; }
.modal-scenario { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 4px 0; }
.modal-scenario > span { color: var(--muted); }
.modal-pct { color: inherit; font-size: 11px; font-weight: 700; }
.is-pos { color: var(--good); }
.is-neg { color: #b42318; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.sub-tabs { display: flex; gap: 4px; }
.sub-tab { border: 1px solid var(--border); background: #f9fafb; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.sub-tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.bets-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.bets-toolbar-actions { display: flex; gap: 7px; align-items: center; margin-left: auto; }
.bets-toolbar-actions { display: flex; gap: 7px; align-items: center; margin-left: auto; }
.bets-list { display: flex; flex-direction: column; gap: 8px; }
.bets-empty { color: var(--muted); font-size: 13px; margin: 24px 0; text-align: center; }
.scan-panel { margin-bottom: 10px; }
.scan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.scan-head h2 { margin: 0; font-size: 14px; }
.scan-head span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.scan-drop {
  display: grid;
  place-items: center;
  min-height: 96px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  font-size: 12px;
}
.scan-drop:hover, .scan-drop:focus { border-color: var(--primary); outline: none; color: var(--primary); }
.scan-drop.has-img { border-style: solid; color: var(--text); }
.scan-drop img { display: block; max-width: 100%; max-height: 150px; border-radius: 6px; object-fit: contain; }
.scan-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 8px; }
.scan-review {
  margin-top: 8px;
  padding: 7px 8px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #92400e;
  font-size: 11px;
}
.scan-review-title { font-weight: 800; margin-bottom: 4px; }
.scan-low-field {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.35;
}
.scan-low-field span { color: #78350f; text-align: right; }
.scan-edit-list { display: grid; gap: 8px; margin-top: 8px; }
.scan-pair-option {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.scan-edit-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}
.scan-edit-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.scan-edit-head h3 { margin: 0; font-size: 13px; }
.scan-edit-head span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.scan-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.scan-edit-grid label {
  display: grid;
  gap: 3px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}
.scan-edit-grid input,
.scan-edit-grid select,
.scan-edit-grid textarea {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}
.scan-wide { grid-column: 1 / -1; }
.scan-flags {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.scan-flags label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
}
.scan-edit-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.bet-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.bet-card-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; margin-bottom: 8px; }
.bet-select {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.bet-event { margin: 0; font-weight: 700; font-size: 13px; }
.bet-meta { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.bet-status { flex-shrink: 0; border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.bet-status.pending { background: #fef3c7; color: #92400e; }
.bet-status.settled { background: #dcfce7; color: #166534; }
.bet-sides { display: grid; gap: 5px; }
.bet-side { display: grid; grid-template-columns: minmax(70px, auto) 1fr auto auto; gap: 8px; align-items: center; background: #f8fafc; padding: 7px; border-radius: 6px; font-size: 12px; }
.bet-side-book { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bet-side-outcome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.bet-side-price { font-family: var(--mono); font-weight: 700; text-align: right; }
.bet-side-stake { font-family: var(--mono); font-weight: 700; text-align: right; }
.bet-side-result { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 4px; border-radius: 4px; color: #fff; font-size: 10px; font-weight: 900; vertical-align: middle; }
.bet-side-result.won { background: #16a34a; }
.bet-side-result.lost { background: #dc2626; }
.bet-side-result.push { background: #64748b; }
.bet-settlement { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-top: 7px; padding: 7px; border-radius: 6px; background: #f0fdf4; color: #166534; font-size: 11px; }
.bet-settlement strong { font-family: var(--mono); font-size: 12px; }
.bet-card-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }

.bet-card.is-editing { border-color: var(--primary); }
.bet-edit-fields { display: grid; gap: 6px; margin-bottom: 8px; }
.bet-field-label { display: grid; gap: 3px; font-size: 11px; color: var(--muted); }
.bet-field-label input, .bet-field-label select { font-size: 12px; padding: 5px 7px; width: 100%; }
.bet-field-event { grid-column: 1 / -1; }
.bet-edit-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bet-side-edit { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 6px; align-items: end; background: #f8fafc; padding: 8px; border-radius: 6px; }
.bet-result-field { min-width: 78px; }
.bet-result-toggle { display: inline-flex; gap: 4px; height: 30px; align-items: center; }
.bet-result-btn { width: 24px; height: 24px; border: 1px solid var(--border); border-radius: 5px; background: #fff; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 900; line-height: 1; }
.bet-result-btn.win.is-selected { border-color: #16a34a; background: #16a34a; color: #fff; }
.bet-result-btn.loss.is-selected { border-color: #dc2626; background: #dc2626; color: #fff; }
.bet-result-btn.push.is-selected { border-color: #64748b; background: #64748b; color: #fff; }
.bet-result-btn.win:not(.is-selected):hover { border-color: #16a34a; color: #15803d; }
.bet-result-btn.loss:not(.is-selected):hover { border-color: #dc2626; color: #b91c1c; }
.bet-result-btn.push:not(.is-selected):hover { border-color: #64748b; color: #475569; }

.sister-panel { grid-column: 1 / -1; }
.sister-hint { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.sister-empty { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.sister-group { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; padding: 8px; background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; }
.sister-pills { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; align-items: center; }
.sister-pill { display: inline-flex; align-items: center; gap: 3px; background: var(--primary); color: #fff; border-radius: 999px; padding: 3px 6px 3px 9px; font-size: 11px; font-weight: 600; }
.sister-pill button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; opacity: .75; }
.sister-pill button:hover { opacity: 1; }
.sister-add-sel { font-size: 11px; padding: 3px 5px; }

.settings-grid { display: grid; gap: 10px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.panel h2 { margin: 0 0 10px; font-size: 14px; }
.panel label { display: grid; gap: 5px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.check-list { display: grid; gap: 8px; }
.check-list label { display: flex; gap: 7px; align-items: center; margin: 0; color: var(--text); }

/* ── Funds tab ─────────────────────────────────────────────────────────────── */
#tab-funds { display: none; }
#tab-funds.is-active { display: grid; gap: 10px; }
.funds-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 10px; }
.funds-fields label { margin-bottom: 0; }
.funds-fields input, .funds-fields select { width: 100%; padding: 6px 7px; border: 1px solid var(--border); border-radius: 6px; }
.funds-note-field { grid-column: 1 / -1; }
.funds-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.funds-preview { font-family: var(--mono); font-size: 12px; color: var(--good); }
.funds-hint { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.funds-empty { color: var(--muted); font-size: 13px; margin: 4px 0; }
.funds-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
.funds-filter-grid label { margin-bottom: 0; }
.funds-filter-grid input, .funds-filter-grid select { width: 100%; padding: 6px 7px; border: 1px solid var(--border); border-radius: 6px; }
.funds-filter-panel .small-button { margin-top: 10px; }

.funds-balance-grid { display: grid; gap: 8px; }
.funds-balance-card { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; background: #f8fafc; }
.funds-balance-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.funds-balance-head strong { font-size: 13px; }
.funds-balance-head span { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.funds-balance-card label { margin: 0; }
.funds-balance-input { width: 100%; font-family: var(--mono); }
.funds-balance-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.funds-balance-metrics span { display: grid; gap: 2px; min-width: 0; color: var(--muted); font-size: 10px; }
.funds-balance-metrics b { color: var(--text); font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.funds-balance-save { justify-self: end; }

.funds-list { display: grid; gap: 8px; }
.funds-row { border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; background: var(--panel); }
.funds-row-head { display: flex; align-items: center; gap: 8px; }
.funds-row-book { font-weight: 700; font-size: 13px; }
.funds-row-amount { font-family: var(--mono); font-size: 13px; font-weight: 700; margin-left: auto; }
.funds-row-head .funds-del-btn { margin-left: 8px; }
.funds-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 3px; padding: 2px 6px; }
.funds-badge.deposit { background: #dcfce7; color: #166534; }
.funds-badge.withdrawal { background: #fee2e2; color: #991b1b; }
.funds-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.funds-meta-pill { font-size: 11px; color: var(--text); background: #f1f5f9; border-radius: 4px; padding: 2px 6px; font-family: var(--mono); }
.funds-meta-note { font-size: 11px; color: var(--muted); font-style: italic; }
.funds-row-date { font-size: 11px; color: var(--muted); margin-left: auto; }

/* ── Settings: Books master list ───────────────────────────────────────────── */
.books-hint { margin: 0 0 10px; color: var(--muted); font-size: 11px; }
.books-list { display: grid; gap: 6px; }
.book-tools-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; margin-bottom: 4px; }
.book-add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; margin: 0; }
.book-add-row input { width: 100%; min-width: 0; padding: 5px 7px; font-size: 12px; }
.book-add-row .small-button { white-space: nowrap; padding: 6px 9px; }
.book-alpha-sort.is-on { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.book-row { display: grid; grid-template-columns: 44px minmax(82px, 1fr) minmax(72px, .7fr) minmax(112px, 1fr) minmax(76px, .7fr) minmax(82px, .7fr) 54px; gap: 5px; align-items: center; min-width: 0; padding: 5px 6px; background: #f8fafc; border: 1px solid #eef1f5; border-radius: 6px; }
.book-row.is-off { opacity: .58; }
.book-row-title { font-size: 12px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-row-title small { display: block; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.book-toggle { min-width: 44px; text-align: center; }
.book-toggle.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.book-row .small-button { padding: 4px 6px; font-size: 11px; }
.book-class-sel, .book-rule-base, .book-rule-baseball { width: 100%; min-width: 0; padding: 4px 5px; font-size: 11px; }
.book-rule-max-line { display: grid; grid-template-columns: auto minmax(38px, 1fr); align-items: center; gap: 4px; min-width: 0; font-size: 10px; color: var(--muted); white-space: nowrap; margin: 0; }
.book-rule-max-line-input { width: 100%; min-width: 0; padding: 4px 5px; font-size: 11px; }
.book-delete { justify-self: end; }
.book-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 11px; }
@media (max-width: 640px) {
  .book-tools-row { grid-template-columns: 1fr; }
  .book-alpha-sort { justify-self: start; }
  .book-row { grid-template-columns: 44px minmax(0, 1fr) 54px; }
  .book-class-sel, .book-rule-base, .book-rule-baseball, .book-rule-max-line { grid-column: 2 / -1; }
  .book-delete { grid-column: 3; grid-row: 1; }
}

/* ── Ops tab ───────────────────────────────────────────────────────────────── */
.ops-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.ops-total { background: #f8fafc; border: 1px solid #eef1f5; border-radius: 6px; padding: 8px; }
.ops-total .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ops-total .v { font-family: var(--mono); font-size: 15px; font-weight: 800; }
.ops-list { display: grid; gap: 8px; }
.ops-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--panel); }
.ops-card-unused { border-color: #f59e0b; }
.ops-card-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.ops-book { font-size: 14px; font-weight: 800; }
.ops-role { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ops-action { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px; padding: 3px 8px; background: #e5e7eb; color: #374151; white-space: nowrap; }
.ops-action-bonus { background: #fef3c7; color: #92400e; }
.ops-action-confirm { background: #fee2e2; color: #991b1b; }
.ops-action-pending, .ops-action-monitor { background: #dbeafe; color: #1e40af; }
.ops-action-needs { background: #ede9fe; color: #5b21b6; }
.ops-action-ready { background: #dcfce7; color: #166534; }
.ops-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.ops-stat { background: #f8fafc; border-radius: 6px; padding: 6px 7px; }
.ops-stat .k { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ops-stat .v { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.ops-stat .v.pos, .ops-campaign-stats b.pos { color: var(--good); }
.ops-stat .v.neg, .ops-campaign-stats b.neg { color: #b42318; }
.ops-campaigns { display: grid; gap: 6px; margin-top: 8px; }
.ops-campaign { border: 1px dashed var(--border); border-radius: 6px; padding: 8px; }
.ops-campaign-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ops-campaign-name { font-size: 12px; font-weight: 600; }
.ops-campaign-status { font-size: 9px; font-weight: 800; text-transform: uppercase; border-radius: 3px; padding: 2px 5px; background: #e5e7eb; color: #374151; white-space: nowrap; }
.ops-campaign-status.active { background: #dbeafe; color: #1e40af; }
.ops-campaign-status.rollover_complete { background: #dcfce7; color: #166534; }
.ops-campaign-status.withdrawn { background: #dcfce7; color: #166534; }
.ops-campaign-status.zeroed, .ops-campaign-status.expired { background: #fee2e2; color: #991b1b; }
.ops-campaign-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.ops-campaign-stats b { font-family: var(--mono); color: var(--text); }
.ops-rollover-line { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
.ops-progress { height: 5px; border-radius: 999px; background: #e5e7eb; overflow: hidden; margin-top: 3px; }
.ops-progress span { display: block; height: 100%; background: var(--primary); }
.ops-campaign-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 7px; }
.ops-rule-label { font-size: 10px; color: var(--muted); }
.ops-campaign-actions { display: inline-flex; gap: 6px; }
.ops-edit-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.ops-edit-grid label { display: grid; gap: 3px; margin: 0; font-size: 11px; color: var(--muted); }
.ops-edit-fp-label, .ops-edit-note-label { grid-column: 1 / -1; }
.ops-edit-fp-label { display: flex; align-items: center; gap: 6px; color: var(--text); }
.ops-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
@media (max-width: 480px) {
  .ops-stats { grid-template-columns: repeat(2, 1fr); }
  .ops-summary { grid-template-columns: 1fr; }
}

@media (min-width: 720px) {
  .funds-fields { grid-template-columns: repeat(4, 1fr); }
  .funds-filter-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .funds-balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
  body { min-width: 720px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid .panel:last-child { grid-column: 1 / -1; }
}

@media (max-width: 430px) {
  .side-row { grid-template-columns: 1fr 1fr; }
  .side-row .book-label { grid-column: 1 / -1; }
  .side-next-best { grid-column: 1 / -1; }
}
