:root {
  --bg: #f4f6fb; --card: #fff; --text: #1d2433; --muted: #667085; --line: #e2e6ee;
  --accent: #1f4fd1; --accent-soft: #e3ebff; --head: #0f1e3d;
  --ok: #12805c; --ok-soft: #d8f3e7; --bad: #c0392b; --bad-soft: #fde4e2;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }

/* header */
.top { background: var(--head); color: #fff; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.brand { color: #fff; font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 4px; }
.top nav a { color: #cfe0ff; text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: .95rem; }
.top nav a:hover, .top nav a.on { background: rgba(255,255,255,.14); color: #fff; }
main.wrap { padding-top: 20px; padding-bottom: 24px; }
.foot { display: flex; justify-content: space-between; padding-top: 8px; padding-bottom: 32px; font-size: .9rem; }
.foot a { color: var(--muted); }

h1 { font-size: 1.6rem; margin: 0 0 12px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: #0b5c41; }
.flash.err { background: var(--bad-soft); color: #8e2219; }
.flash.info { background: var(--accent-soft); color: #173a99; }

/* forms */
label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 4px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #cdd3de; border-radius: 8px; font: inherit; background: #fff; color: inherit;
}
textarea { min-height: 120px; font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.field { margin-bottom: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.btn { display: inline-block; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #e7ebf3; color: var(--text); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 6px 12px; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline { display: inline; }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }
.strike { text-decoration: line-through; color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; background: #eef1f6; color: var(--muted); }
.pill.paid { background: var(--ok-soft); color: #0b5c41; }
.pill.unpaid { background: var(--bad-soft); color: #8e2219; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tabs a { padding: 8px 14px; border-radius: 8px; background: #e7ebf3; color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem; }
.tabs a.on { background: var(--accent); color: #fff; }

.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.points div { background: #f3f5fa; border-radius: 8px; padding: 8px 10px; font-size: .9rem; }
.points b { display: block; font-size: 1.1rem; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 0; }
.stats div { background: #f3f5fa; border-radius: 8px; padding: 8px 14px; }
.stats b { display: block; font-size: 1.3rem; }

/* bracket */
.bracket .region { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.bracket h3 { margin: 0 0 8px; font-size: 1.05rem; }
.rscroll { overflow-x: auto; }
.rgrid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; min-width: 640px; }
.rgrid.ff { min-width: 640px; }
.col { display: flex; flex-direction: column; }
.rname { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.games { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 6px; }
.game { border: 1px solid #d4dae6; border-radius: 8px; overflow: hidden; background: #fff; }
.slot { display: flex; gap: 6px; align-items: center; width: 100%; min-height: 32px; text-align: left; padding: 5px 8px; border: 0; border-bottom: 1px solid #edf0f5; background: transparent; font: inherit; font-size: .85rem; color: inherit; }
.slot:last-child { border-bottom: 0; }
button.slot { cursor: pointer; }
button.slot:hover { background: #f1f5ff; }
.slot.picked { background: var(--accent-soft); font-weight: 700; }
.slot.right { background: var(--ok-soft); color: #0b5c41; }
.slot.wrong { background: var(--bad-soft); color: #8e2219; text-decoration: line-through; }
.slot.out { color: #a0a7b4; text-decoration: line-through; }
.seed { display: inline-block; min-width: 18px; font-size: .75rem; color: var(--muted); font-weight: 600; }
.tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbd { color: #b4bac6; }
.champ { border: 2px solid #e2b400; background: #fff9e0; border-radius: 8px; padding: 10px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.champ.right { border-color: var(--ok); background: var(--ok-soft); }
.champ.wrong { border-color: var(--bad); background: var(--bad-soft); text-decoration: line-through; }
.counter { font-weight: 700; color: var(--bad); }
.counter.done { color: var(--ok); }
.stickybar { position: sticky; bottom: 0; background: rgba(244,246,251,.96); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 8px; }

/* reports + printing */
.printonly { display: none; }
@media print {
  body { background: #fff; font-size: 11px; }
  .top, .foot, .noprint, .tabs, .flash { display: none !important; }
  .printonly { display: block; }
  .card { border: 0; padding: 0; margin-bottom: 12px; }
  .tablewrap { overflow: visible; }
  th, td { padding: 3px 5px; }
  a { color: inherit; text-decoration: none; }
  .pill { background: none !important; padding: 0; color: inherit !important; }
}
.rgrid.two { grid-template-columns: repeat(2, minmax(150px, 1fr)); min-width: 320px; }
.pooltabs { margin-bottom: 12px; }
table.sortable th[data-dir="asc"]::after { content: " ▲"; font-size: .7em; }
table.sortable th[data-dir="desc"]::after { content: " ▼"; font-size: .7em; }
.slot .sc { margin-left: auto; padding-left: 8px; font-variant-numeric: tabular-nums; font-weight: 700; }
.slot.lost { color: #8a93a3; }
.slot.lost .sc { font-weight: 400; }
