:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e4e7ec;
  --line-strong: #cfd4dc;
  --text: #1a1f2b;
  --muted: #6b7280;
  --faint: #9aa3b2;
  --accent: #2456e6;
  --accent-bg: #eaf0ff;
  --fit: #15803d;
  --fit-bg: #e3f6ea;
  --fit-line: #9ad3b0;
  --low: #b42318;
  --low-bg: #fdeceb;
  --low-line: #f0b3ad;
  --warn: #b7791f;
  --warn-bg: #fdf3dc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
pre, code { font: 12.5px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.spacer { flex: 1; }
.wrap { max-width: 1760px; margin: 0 auto; padding: 0 20px; }

/* header */
header.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #2456e6, #6d8cff); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; letter-spacing: -0.5px; }
.title { font-weight: 650; font-size: 16px; letter-spacing: -0.2px; line-height: 1.2; }
.sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 8px; align-items: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f7f8fa; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d49c7; }
.btn.ghost { background: transparent; }
.btn .count { background: var(--fit); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; display: inline-grid; place-items: center; }
.btn .count:empty { display: none; }
.btn.tiny { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.link { border: none; background: none; color: var(--accent); padding: 0 4px; height: auto; font-weight: 500; }
.btn.link:hover { text-decoration: underline; background: none; }

.bk-bar { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0 20px 10px; font-size: 12.5px; }
.bk-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.bk-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.bk-chip.ok .dot { background: var(--fit); }
.bk-chip.error .dot, .bk-chip.blocked .dot { background: var(--low); }
.bk-chip.init .dot { background: var(--warn); }
.bk-chip b { color: var(--text); font-weight: 600; }

/* main */
main { padding: 18px 20px 48px; }
.empty { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; text-align: center; box-shadow: var(--shadow); }
.empty h2 { margin: 0 0 6px; font-size: 18px; }
.empty p { color: var(--muted); margin: 0 0 14px; }
.empty pre { display: inline-block; text-align: left; background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 0; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; }
.grid th { position: sticky; top: 0; background: var(--card); text-align: center; font-weight: 600; font-size: 12px; color: var(--muted); letter-spacing: 0.02em; text-transform: uppercase; padding: 11px 10px 9px; border-bottom: 1px solid var(--line); z-index: 1; }
.grid th.tipcol { text-align: left; min-width: 300px; }
.grid th .bkname { display: inline-flex; align-items: center; gap: 6px; text-transform: none; font-size: 12.5px; color: var(--text); }
.grid th .bkname i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.grid td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tr:last-child td { border-bottom: none; }
.grid tr:hover td { background: #fafbfc; }
.grid tr.expired td { opacity: 0.55; }
.grid tr.disabled td { opacity: 0.45; }

td.tip { min-width: 300px; max-width: 360px; }
.tip .match { font-weight: 600; font-size: 14px; letter-spacing: -0.1px; }
.tip .meta { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tip .meta .src { display: inline-flex; align-items: center; gap: 4px; }
.tip .markets { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.tip .mk { font-size: 13px; }
.tip .mk b { font-weight: 600; }
.tip .mk .min { color: var(--muted); }
.tip .err { color: var(--warn); font-size: 12px; margin-top: 4px; }
.tip .tools { margin-top: 6px; display: flex; gap: 10px; opacity: 0; transition: opacity .15s; }
.grid tr:hover .tip .tools { opacity: 1; }
.ttl { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; font-weight: 500; background: #eef0f3; color: var(--muted); }
.ttl.soon { background: var(--warn-bg); color: var(--warn); }
.ttl.over { background: var(--low-bg); color: var(--low); }

td.cell { text-align: center; min-width: 112px; }
.chips { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.chip { display: block; text-decoration: none; border-radius: 8px; padding: 5px 8px; border: 1px solid var(--line-strong); background: #fff; color: var(--muted); font-size: 12.5px; line-height: 1.25; box-shadow: 0 1px 0 rgba(16,24,40,0.06); }
a.chip { cursor: pointer; }
a.chip:hover { text-decoration: none; filter: brightness(0.97); box-shadow: 0 2px 6px rgba(16,24,40,0.14); transform: translateY(-1px); }
a.chip:active { transform: none; }
.chip .odds { display: block; font-weight: 700; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.chip .odds small { font-weight: 500; font-size: 11.5px; margin-left: 3px; }
.chip .lbl { display: block; font-size: 11px; color: var(--muted); }
.chip .near { display: block; font-size: 11px; color: var(--faint); }
.chip.fit { background: var(--fit-bg); border-color: var(--fit-line); }
.chip.fit .odds { color: var(--fit); }
.chip.low { background: var(--low-bg); border-color: var(--low-line); }
.chip.low .odds { color: var(--low); }
.chip.none .odds { color: var(--faint); font-weight: 500; }
.chip.msg { background: transparent; border-style: dashed; border-color: var(--line); color: var(--faint); font-size: 12px; padding: 8px 6px; box-shadow: none; }
.cell .ev { margin-top: 6px; font-size: 11.5px; color: var(--muted); display: flex; gap: 5px; justify-content: center; align-items: center; flex-wrap: wrap; }
.cell .ev .warn { color: var(--warn); font-weight: 600; }
.evbtn { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; color: var(--accent); font-weight: 500; font-size: 12px; text-decoration: none; }
.evbtn:hover { background: var(--accent-bg); text-decoration: none; border-color: #b9c8f5; }
.evbtn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.evbtn svg { flex: none; }
.btn.tiny.bind { color: var(--muted); font-weight: 500; }
.btn.tiny.bind.on { color: var(--accent); border-color: #b9c8f5; }
.stale { opacity: 0.55; }
.legend { margin: 12px 4px 0; font-size: 12px; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; border: 1px solid var(--line); }
.sw.fit { background: var(--fit-bg); border-color: var(--fit-line); }
.sw.low { background: var(--low-bg); border-color: var(--low-line); }
.sw.none { background: #f7f8fa; }

/* modals */
.modal { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 20; overflow: auto; }
.modal-box { background: var(--card); border-radius: 12px; width: min(860px, 100%); padding: 20px 22px 18px; box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.x { border: none; background: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.x:hover { background: #f1f3f6; color: var(--text); }
textarea, input { width: 100%; background: #fff; color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 10px; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; }
textarea:focus, input:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.modal-actions { display: flex; gap: 12px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.radio { color: var(--muted); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.preview { margin-top: 10px; font-size: 13px; }
.preview .row { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.preview .row.bad { color: var(--low); }
.preview .row .m { color: var(--fit); font-weight: 500; }
.bind-list { max-height: 50vh; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.bind-list .item { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; font-size: 13px; }
.bind-list .item:last-child { border-bottom: none; }
.bind-list .item:hover { background: #f7f8fa; }
.bind-list .item .when { color: var(--muted); font-size: 12px; min-width: 105px; }
.bind-list .item .lg { color: var(--muted); font-size: 12px; }

/* alerts */
.tg-box { background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.tg-box b { color: var(--text); font-weight: 600; }
.tg-box .chats { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.tg-box .chat { border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-size: 12px; background: #fff; }
.tg-box .chat.on { border-color: var(--fit-line); background: var(--fit-bg); color: var(--fit); }
.alerts-list { max-height: 50vh; overflow: auto; margin-top: 12px; border-top: 1px solid var(--line); }
.alerts-list .item { padding: 8px 4px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; font-size: 13px; }
.alerts-list .item .when { color: var(--muted); font-size: 12px; min-width: 100px; font-variant-numeric: tabular-nums; }
.alerts-list .item.unfit { color: var(--low); }
.alerts-list .item.fit { color: var(--fit); }
.alerts-list .item a { margin-left: 6px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 30; max-width: 380px; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--fit); border-radius: 10px; padding: 10px 12px; font-size: 13px; box-shadow: 0 10px 30px rgba(16, 24, 40, 0.18); animation: toast-in .2s ease-out; }
.toast.unfit { border-left-color: var(--low); }
.toast a { display: block; margin-top: 4px; font-size: 12px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 720px) {
  .top-inner { height: auto; padding: 10px 0; flex-wrap: wrap; }
  .actions { width: 100%; justify-content: flex-end; }
  main { padding: 12px 8px 40px; }
  .wrap { padding: 0 8px; }
}
