:root {
  --bg: #0f1216; --panel: #171b21; --panel2: #1e232b; --line: #2a313b;
  --text: #e6e9ee; --muted: #8b95a3; --accent: #3fb68b; --home: #4c9aff; --away: #f2994a;
  --hot: #ff5d5d; --ai: #e879f9; --warm: #f2c94c; --cold: #56ccf2; --value: #3fb68b; --info: #a78bfa;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f8; --panel: #ffffff; --panel2: #f0f2f5; --line: #dde2e8;
    --text: #1b2028; --muted: #677282; --accent: #1f9d6f; --home: #2f7de1; --away: #d97a22;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; font-size: 16px; margin-right: 8px; }
.tabs { display: flex; background: var(--panel2); border-radius: 8px; padding: 2px; }
.tabs button, #notifyBtn { background: none; border: 0; color: var(--muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.tabs button.on { background: var(--accent); color: #fff; }
#notifyBtn { background: var(--panel2); }
#notifyBtn.on { color: var(--warm); }
.chk { color: var(--muted); display: flex; gap: 6px; align-items: center; }
#search { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 6px 10px; min-width: 160px; font: inherit; }
.statuswrap { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.status { color: var(--muted); font-size: 12px; text-align: right; }
.activity { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; font-size: 11px; }
.act { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); white-space: nowrap; }
.act i { font-style: normal; display: inline-block; width: 1em; text-align: center; }
.act.busy { color: var(--text); border-color: var(--accent); }
.act.busy i { animation: actspin 0.9s linear infinite; color: var(--accent); }
.act.fresh i { color: var(--accent); }
.act.fail { border-color: var(--hot); }
.act.fail i { color: var(--hot); }
.act.stale { opacity: .6; }
@keyframes actspin { to { transform: rotate(360deg); } }
.status .err { color: var(--hot); }
main { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 12px; padding: 12px 16px; align-items: start; }
.list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 4px; }
.league { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin: 8px 2px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: center; }
.card:hover { border-color: var(--muted); }
.card.sel { border-color: var(--accent); }
.min { font-weight: 700; color: var(--accent); font-size: 13px; text-align: center; }
.min.pre { color: var(--muted); font-weight: 400; font-size: 12px; }
.teams div { display: flex; justify-content: space-between; gap: 8px; }
.teams .sc { font-weight: 700; }
.mini { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-size: 11px; color: var(--muted); min-width: 78px; }
.pbar { height: 4px; width: 70px; background: var(--away); border-radius: 2px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--home); }
.badges { display: flex; gap: 3px; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; color: #111; font-weight: 600; }
.b-hot { background: var(--hot); } .b-warm { background: var(--warm); } .b-cold { background: var(--cold); } .b-value { background: var(--value); } .b-info { background: var(--info); } .b-ai { background: var(--ai); }
.star { cursor: pointer; color: var(--muted); }
.star.on { color: var(--warm); }

.detail { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-height: 300px; }
.empty { color: var(--muted); text-align: center; padding: 80px 0; }
.scoreline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; text-align: center; }
.scoreline img { width: 40px; height: 40px; object-fit: contain; }
.scoreline .big { font-size: 34px; font-weight: 800; letter-spacing: 2px; }
.scoreline .tn { font-weight: 600; }
.sub { color: var(--muted); text-align: center; font-size: 12px; margin-top: 4px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.press { display: flex; height: 22px; border-radius: 6px; overflow: hidden; font-size: 12px; font-weight: 700; color: #fff; }
.press .h { background: var(--home); display: flex; align-items: center; padding-left: 8px; }
.press .a { background: var(--away); display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; flex: 1; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: center; font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td:first-child, th:first-child { text-align: left; }
.stats td:nth-child(1), .stats td:nth-child(3) { width: 25%; font-weight: 600; }
.stats td:nth-child(2) { color: var(--muted); }
.mk input { width: 64px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 3px 5px; text-align: center; font: inherit; }
.pos { color: var(--value); font-weight: 700; }
.neg { color: var(--muted); }
.sig { border-left: 4px solid; padding: 8px 10px; margin-bottom: 6px; background: var(--panel2); border-radius: 0 8px 8px 0; }
.sig b { display: block; }
.sig small { color: var(--muted); }
.s-hot { border-color: var(--hot); } .s-warm { border-color: var(--warm); } .s-cold { border-color: var(--cold); } .s-value { border-color: var(--value); } .s-info { border-color: var(--info); } .s-ai { border-color: var(--ai); }
.aibtn { margin-left: 8px; background: var(--ai); color: #111; border: 0; border-radius: 6px; padding: 4px 10px; font: inherit; font-weight: 600; cursor: pointer; text-transform: none; letter-spacing: 0; }
.aibtn:disabled { opacity: .6; cursor: wait; }
.ai { background: var(--panel2); border-left: 4px solid var(--ai); border-radius: 0 8px 8px 0; padding: 4px 12px 8px; }
.err { color: var(--hot); }
.events { font-size: 12px; max-height: 220px; overflow: auto; }
.events div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.ev-h { color: var(--home); } .ev-a { color: var(--away); }
svg.chart { width: 100%; height: 160px; background: var(--panel2); border-radius: 8px; }
.note { color: var(--muted); font-size: 12px; }
footer { color: var(--muted); font-size: 11px; text-align: center; padding: 8px 16px 16px; }

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; }
  .list { max-height: 45vh; }
  .grid2 { grid-template-columns: 1fr; }
  .status { margin-left: 0; text-align: left; width: 100%; }
}
.nostat { font-size: 10px; color: var(--muted); opacity: .7; }

/* ---------- учёт ставок ---------- */
#openBets:not(:empty) { background: var(--warm); color: #111; border-radius: 8px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.betbtn { background: none; border: 1px solid var(--line); color: var(--accent); border-radius: 5px; width: 26px; height: 24px; cursor: pointer; font: inherit; font-weight: 700; padding: 0; }
.betbtn:hover { background: var(--accent); color: #fff; }
.sig .betbtn, .ai .betbtn { float: right; margin-left: 8px; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 18px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin-top: 0; }
dialog label { display: block; margin: 10px 0 0; color: var(--muted); font-size: 12px; }
dialog input { display: block; width: 100%; margin-top: 4px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 7px 9px; font: inherit; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dlg-match { font-weight: 600; }
.dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg-btns button, .bv-btn { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 7px 14px; font: inherit; cursor: pointer; }
.dlg-btns .primary, .bv-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.betsview { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.bv-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.bv-panel h3 { margin-top: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { background: var(--panel2); border-radius: 10px; padding: 10px 12px; }
.kpi small { color: var(--muted); display: block; font-size: 11px; }
.kpi b { font-size: 20px; font-variant-numeric: tabular-nums; }
.bv-settings { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.bv-settings label { color: var(--muted); font-size: 12px; }
.bv-settings input { display: block; width: 110px; margin-top: 3px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 8px; font: inherit; }
.bv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.bv-scroll { overflow-x: auto; }
.st { font-size: 11px; padding: 2px 8px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.st-open { background: var(--panel2); color: var(--muted); } .st-won { background: var(--value); color: #111; }
.st-lost { background: var(--hot); color: #111; } .st-void { background: var(--line); color: var(--text); }
.bacts button { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 5px; padding: 1px 7px; cursor: pointer; margin: 1px; }
.bv-filter { display: flex; gap: 6px; margin-bottom: 8px; }
table.bl td { font-size: 13px; }
table.bl td:first-child { white-space: nowrap; color: var(--muted); }
svg.bank { width: 100%; height: 180px; background: var(--panel2); border-radius: 8px; }
[hidden] { display: none !important; }
.hsec td { text-align: left !important; font-weight: 600; color: var(--muted); background: var(--panel2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- вилки ---------- */
.arb-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.arb-pct { font-size: 22px; font-weight: 800; color: var(--value); }
.leagues { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; margin: 10px 0; max-height: 320px; overflow: auto; }
.leagues label { font-size: 13px; color: var(--text); }
table.calc input { width: 120px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 8px; font: inherit; }
.calc-st { text-align: left !important; color: var(--muted); font-size: 13px; }
.lineup { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 13px; }
.lineup span { background: var(--panel2); border-radius: 6px; padding: 2px 8px; }
table.h2h td { font-size: 12px; padding: 3px 6px; }

/* ---------- экспрессы ---------- */
.arb-pct.neg-ev { color: var(--hot); }
#expressView select { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 8px; font: inherit; display: block; margin-top: 3px; }
.sig small.track { display: block; margin-top: 3px; }
.sig small.err { display: block; }
table.tennis td, table.tennis th { font-size: 15px; }
.b-tbrk, .b-ttb, .b-tdec, .b-tback, .b-dstr, .b-ddiv { background: var(--warm); } .s-tbrk, .s-ttb, .s-tdec, .s-tback, .s-dstr, .s-ddiv { border-color: var(--warm); }

.b-safe { background: #1e9e5a; } .s-safe { border-color: #1e9e5a; }
.b-tfav { background: var(--warm); } .s-tfav { border-color: var(--warm); }
.b-hpull { background: var(--hot, #e0533d); } .s-hpull { border-color: var(--hot, #e0533d); }

.notifywrap { position: relative; }
.notifymenu { position: absolute; right: 0; top: 110%; z-index: 20; min-width: 300px; max-width: calc(100vw - 32px); background: var(--panel, #fff);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.15);
  display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.notifymenu label { display: flex; gap: 6px; align-items: baseline; cursor: pointer; }
.notifymenu label small { color: var(--muted); }
.notifymenu hr { border: 0; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }

.muted-sig { margin: 6px 0; color: var(--muted); font-size: 12px; }
.muted-sig summary { cursor: pointer; }

.loginpage { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); }
.loginbox { display: flex; flex-direction: column; gap: 12px; width: min(340px, calc(100vw - 32px)); padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; text-align: center; }
.loginbox h1 { font-size: 20px; margin: 0; }
.loginbox img { align-self: center; border-radius: 14px; }
.loginbox label { display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--muted); }
.loginbox input { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
.loginbox button { font: inherit; padding: 10px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }

/* ---------- кнопки и телефон ---------- */
.mback { display: none; }
.bkbtn { display: inline-block; margin-left: 4px; padding: 2px 7px; border: 1px solid var(--accent); border-radius: 6px; color: var(--accent); text-decoration: none; font-size: 12px; white-space: nowrap; }
.notifymenu .col { flex-direction: column; align-items: stretch; gap: 4px; }
.notifymenu .col input { font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
@media (max-width: 760px) {
  header { padding: 8px 10px; gap: 6px; }
  .brand { font-size: 15px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; padding: 8px 12px; }
  #search { flex: 1 1 100%; font-size: 16px; padding: 7px 10px; }
  .chk { font-size: 12px; }
  .brand { flex: 1 1 auto; }
  #viewTabs, #sportTabs { flex: 1 1 100%; }
  #stateTabs { flex: 0 0 auto; }
  #search { order: 10; }
  .notifywrap { order: 11; }
  .statuswrap { order: 12; flex: 1 1 0; width: auto; min-width: 0; }
  .card { grid-template-columns: 40px 1fr; row-gap: 4px; }
  .card .mini { grid-column: 1 / -1; display: flex; flex-direction: row; flex-wrap: wrap; min-width: 0; align-items: center; justify-content: flex-end; gap: 6px; }
  .badges { flex-wrap: wrap; }
  .statuswrap { margin-left: 0; align-items: flex-start; }
  .activity { justify-content: flex-start; }
  .status { display: none; text-align: left; }
  body.show-status .status { display: block; }
  main { padding: 8px; gap: 8px; }
  .list { max-height: none; overflow: visible; padding-right: 0; }
  body:not(.m-detail) #detail { display: none; }
  body.m-detail #list { display: none; }
  .detail { padding: 12px; border-radius: 10px; }
  .mback { display: block; margin: -4px 0 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); color: var(--text); font: inherit; }
  .betbtn { min-width: 36px; min-height: 32px; }
  .bkbtn { padding: 6px 9px; }
  table { font-size: 13px; }
  .mk input { width: 64px; font-size: 16px; }
  .notifymenu { position: fixed; left: 8px !important; right: 8px !important; top: 56px; min-width: 0; }
  .betsview { padding: 8px; }
  footer { padding: 8px; }
}
