:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0b1220;
  --accent: #ea580c;
  --accent-soft: #fff1e8;
  --in: #0d9488;
  --out: #94a3b8;
  --casino: #ea580c;
  --pos: #15803d;
  --neg: #b91c1c;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.topbar { background: var(--brand); color: #fff; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.brand { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand-sub { color: #94a3b8; font-weight: 400; font-size: 12px; margin-left: 4px; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav .linklike { color: #cbd5e1; padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.nav a:hover, .nav .linklike:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255,255,255,.12); }

main { padding: 24px 20px 40px; }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 32px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.center { text-align: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 18px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

form label { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 12px; }
form label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
label.check input { width: auto; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #fdba74; border-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button, .button { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.button:hover { text-decoration: none; background: #f8fafc; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #c2410c; }
.linklike { background: none; border: 0; padding: 0; font-weight: 400; color: #1d4ed8; cursor: pointer; }
.linklike.danger { color: var(--neg); }
form.inline { display: inline; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { margin: 0; width: auto; min-width: 220px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.login { max-width: 380px; margin: 60px auto; }
.login h1 { font-size: 20px; margin: 0 0 16px; }
.login button { width: 100%; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 8px; }
.table td { border-bottom: 1px solid #f1f5f9; padding: 8px 8px; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 5px 8px; }
.table th.r { text-align: right; }

.status { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #f1f5f9; }
.s-done { background: #ecfdf5; color: #047857; }
.s-failed { background: #fef2f2; color: #b91c1c; }
.s-running, .s-queued { background: #eff6ff; color: #1d4ed8; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: #f1f5f9; color: var(--ink-2); white-space: nowrap; }
.tier-whale { background: #0b1220; color: #fdba74; }
.tier-vip { background: var(--accent); color: #fff; }
.tier-regular { background: #e0f2fe; color: #075985; }
.tier-low { background: #f1f5f9; color: var(--muted); }
.tier-none { background: #f1f5f9; color: var(--muted); }
.muted-badge { font-weight: 500; font-size: 11px; color: var(--muted); }
.dir { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.dir.in { background: #ccfbf1; color: #0f766e; }
.dir.out { background: #fff1e8; color: #c2410c; }

.report-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin: 4px 0 18px; }
.report-head h1 { margin: 2px 0 2px; font-size: 26px; letter-spacing: -.3px; }
.eyebrow { text-transform: uppercase; letter-spacing: .8px; font-size: 11px; color: var(--accent); font-weight: 700; }
.subtitle { color: var(--ink-2); word-break: break-all; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.summary-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.summary-top p { margin: 0; font-size: 15px; color: var(--ink-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi.accent { background: var(--accent-soft); border-color: #fed7aa; }
.kpi-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.kpi-sub { font-size: 12px; color: var(--muted); }

.chart svg { width: 100%; height: auto; max-height: 300px; display: block; }
.chart .grid { stroke: #eef2f6; stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.bar-in { fill: var(--in); }
.bar-out { fill: var(--out); }
.bar-casino { fill: var(--casino); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend-item i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend-item i.bar-in { background: var(--in); }
.legend-item i.bar-out { background: var(--out); }
.legend-item i.bar-casino { background: var(--casino); }
.heat { fill: #f1f5f9; }
.heat.l1 { fill: #fed7aa; }
.heat.l2 { fill: #fdba74; }
.heat.l3 { fill: #fb923c; }
.heat.l4 { fill: #ea580c; }

.share { margin-bottom: 14px; }
.share-row { display: grid; grid-template-columns: minmax(160px, 34%) 1fr 70px; align-items: center; gap: 12px; padding: 4px 0; }
.share-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-track { width: 100%; height: 10px; display: block; }
.share-bg { fill: #f1f5f9; }
.share-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

details.casino { border-top: 1px solid var(--line); padding: 10px 0; }
details.casino summary { cursor: pointer; }
.notes ul { margin: 10px 0 6px; padding-left: 18px; color: var(--ink-2); }

.spinner { width: 34px; height: 34px; border: 3px solid #fed7aa; border-top-color: var(--accent); border-radius: 50%; margin: 10px auto 6px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12px; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; font-size: 11.5px; }
  .topbar, .no-print, .nav, .foot form { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #e5e7eb; break-inside: avoid; padding: 12px 14px; margin-bottom: 10px; }
  .page-break { break-before: page; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  a { color: var(--ink); }
  .kpi-value { font-size: 18px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.cal.l0 { fill: #f1f5f9; }
.cal.other { fill: #cbd5e1; }
.cal.dep.l1 { fill: #fed7aa; } .cal.dep.l2 { fill: #fdba74; } .cal.dep.l3 { fill: #fb923c; } .cal.dep.l4 { fill: #ea580c; }
.cal.wd.l1 { fill: #99f6e4; } .cal.wd.l2 { fill: #5eead4; } .cal.wd.l3 { fill: #14b8a6; } .cal.wd.l4 { fill: #0f766e; }
.legend-item i.cal-dep { background: #fb923c; }
.legend-item i.cal-wd { background: #14b8a6; }
.legend-item i.cal-other { background: #cbd5e1; }
.heat.wd.l1 { fill: #99f6e4; } .heat.wd.l2 { fill: #5eead4; } .heat.wd.l3 { fill: #14b8a6; } .heat.wd.l4 { fill: #0f766e; }
.tabs3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1000px) { .tabs3 { grid-template-columns: 1fr; } }
.tabs3 h3 { font-size: 13px; margin: 0 0 6px; color: var(--ink-2); }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #f1f5f9; }
.pill.k-payout { background: #ccfbf1; color: #0f766e; }
.pill.k-new_player { background: #fff1e8; color: #c2410c; }
.pill.k-player_moved { background: #fee2e2; color: #b91c1c; }
.pill.k-churn { background: #e0e7ff; color: #3730a3; }
.pill.k-share { background: #fef9c3; color: #854d0e; }
