:root {
  --bg: #0b0f1a;
  --panel: #121826;
  --panel-2: #182033;
  --line: #243049;
  --text: #e9eef7;
  --muted: #8b97ad;
  --green: #22e07a;
  --green-dim: #1a3d2c;
  --red: #ff5c6c;
  --red-dim: #3d1d24;
  --gold: #f2c14e;
  --gold-dim: #3b3220;
  --gray-dim: #2a3245;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* header */
header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 4px 0 16px; }
@media (max-width: 480px) { header .spacer { flex-basis: 100%; height: 0; } }
header img { width: 44px; height: 44px; border-radius: 10px; }
header h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
header h1 small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
header .spacer { flex: 1; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--gray-dim); color: var(--muted); white-space: nowrap; }
.pill.on { background: var(--green-dim); color: var(--green); }
.pill.neg { background: var(--red-dim); color: var(--red); }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; }
.linkbtn:hover { color: var(--text); }

/* record */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }

/* layout */
.grid { display: grid; grid-template-columns: 420px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } .stats { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 480px) { .stat .v { font-size: 18px; } .stat { padding: 10px; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .count { font-size: 12px; color: var(--muted); font-weight: 500; }

/* form */
label.f { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .5px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.seg button.sel { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.seg.tier button.sel[data-v="live"] { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.tag.live { background: var(--red-dim); color: var(--red); }
.seg.tier button.sel[data-v="vip"] { border-color: var(--gold); color: var(--gold); background: var(--gold-dim); }
input[type=text], input[type=number], input[type=search], input[type=password], textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, textarea:focus { border-color: var(--green); }
textarea { resize: vertical; min-height: 60px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.chips button:hover { color: var(--text); border-color: var(--muted); }
.games { max-height: 168px; overflow: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; }
.games:empty { display: none; }
.game { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.game:last-child { border-bottom: 0; }
.game .when { flex-basis: 100%; font-size: 11px; color: var(--muted); }
.game button { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 8px; cursor: pointer; font-size: 13px; text-align: center; }
.game button:hover { border-color: var(--green); color: var(--green); }
.game .at { color: var(--muted); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--green); }
.hidden { display: none !important; }
.preview { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px dashed var(--line); font-size: 14px; }
.preview b { color: var(--text); }
.preview .dest { color: var(--muted); font-size: 12px; margin-top: 2px; }
.primary { width: 100%; margin-top: 14px; padding: 13px; border: 0; border-radius: 12px; background: var(--green); color: #04110a;
  font-weight: 700; font-size: 16px; cursor: pointer; }
.primary:disabled { opacity: .5; cursor: wait; }
.err { color: var(--red); font-size: 13px; margin-top: 8px; min-height: 1em; }

/* lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 12px; }
.item .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item .lbl { font-weight: 650; }
.item .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--gray-dim); color: var(--muted); margin-left: 6px; vertical-align: 1px; }
.tag.vip { background: var(--gold-dim); color: var(--gold); }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 6px; margin-top: 10px; }
.actions button { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 6px; cursor: pointer; font-weight: 600; }
.actions .w:hover { border-color: var(--green); color: var(--green); }
.actions .l:hover { border-color: var(--red); color: var(--red); }
.actions .p:hover, .actions .v:hover { border-color: var(--muted); }
.res { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.res.win { color: var(--green); } .res.loss { color: var(--red); } .res.push, .res.void { color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.ghost { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--muted); }

/* performance */
.statsCard { margin-bottom: 16px; }
.statsHead { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.statsHead h2 { margin: 0; }
.kpis { display: flex; gap: 6px; }
#curve { width: 100%; height: 120px; margin: 12px 0; background: var(--panel-2); border-radius: 10px; }
.tables { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .tables { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
td:first-child { text-transform: uppercase; font-weight: 600; }
.actions.q { grid-template-columns: 1.4fr 1fr 1fr auto; }
.qs { margin-top: 8px; }
.money { margin-top: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.res .money { margin-top: 2px; text-align: right; font-size: 13px; }
.slipPrev { width: 100%; margin-top: 8px; border-radius: 10px; border: 1px solid var(--line); }
.needs { border-color: var(--red) !important; }
.needs .meta::before { content: "⏰ needs result · "; color: var(--red); font-weight: 600; }
.editbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 0; }
.editbtn:hover { color: var(--text); }
input[type=datetime-local] { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color-scheme: dark; }
dialog form .f:first-of-type { margin-top: 14px; }

/* toast + confirm */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: min(560px, calc(100% - 32px));
  background: #0f2a1d; border: 1px solid var(--green); color: var(--text); padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); white-space: pre-line; z-index: 20; }
.toast.bad { background: #2a1217; border-color: var(--red); }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: 360px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog p { margin: 0 0 16px; }
dialog .btns { display: flex; gap: 8px; justify-content: flex-end; }
dialog .btns button { padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
dialog .btns .go { background: var(--green); color: #04110a; border: 0; font-weight: 700; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 340px; text-align: center; }
.login img { width: 72px; height: 72px; border-radius: 16px; }
.login input { text-align: center; font-size: 24px; letter-spacing: 8px; margin-top: 12px; }
