:root {
  --bg: #0c0e11; --panel: #14171c; --panel-2: #1a1e24; --line: #262b33; --line-2: #323844;
  --text: #eceef1; --muted: #8d95a1; --accent: #c6ff3d; --accent-ink: #0c0e11; --accent-soft: rgba(198,255,61,.12);
  --gold: #f5c84c; --danger: #ff6b6b; --live: #5cc8ff;
  --radius: 12px; --font: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif; --display: 'Space Grotesk', var(--font);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.01em; margin: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-bottom: 80px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .err { color: var(--danger); }
.row { display: flex; gap: 10px; align-items: center; } .row.end { justify-content: flex-end; } .wrap-row { flex-wrap: wrap; }

/* top bar */
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 14px var(--display); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-family: var(--display); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--muted); font-size: 12px; }
.top-right { display: flex; gap: 12px; align-items: center; }
.save-status { color: var(--muted); font-size: 12px; }

/* nav */
.cat-nav { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 65px; z-index: 19; }
.nav-inner { display: flex; gap: 6px; overflow-x: auto; padding-top: 10px; padding-bottom: 10px; scrollbar-width: none; }
.nav-inner::-webkit-scrollbar { display: none; }
.cat-nav a { white-space: nowrap; padding: 7px 14px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: 14px; border: 1px solid transparent; }
.cat-nav a:hover { color: var(--text); background: var(--panel); }
.cat-nav a.on { color: var(--accent-ink); background: var(--accent); }
.cat-nav .count { font-size: 12px; opacity: .7; margin-left: 2px; }

/* buttons */
.btn { font: 600 14px var(--font); border-radius: 9px; padding: 9px 16px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255,107,107,.4); }
.btn.tiny { padding: 4px 10px; font-size: 12px; }
.file-btn input { display: none; }
input, select { font: 14px var(--font); background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, .btn:focus-visible, [role=button]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.inline { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
label.inline input[type=number] { width: 64px; }

/* hero + cards */
.hero { padding: 44px 0 28px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; color: var(--accent); margin: 0 0 8px; font-weight: 600; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.05; }
.lede { color: var(--muted); font-size: 17px; margin: 12px 0 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card h3 { font-size: 18px; }
.card .big { font: 700 36px var(--display); margin: 10px 0 0; }
.card .big small { font-size: 14px; color: var(--muted); font-weight: 500; }
.card p { margin: 0; }
.champ { color: var(--gold); font-weight: 600; margin-top: 8px !important; }
.pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid var(--line-2); color: var(--muted); }
.pill.live { color: var(--live); border-color: rgba(92,200,255,.35); }
.pill.done { color: var(--gold); border-color: rgba(245,200,76,.4); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.panel h2 { font-size: 17px; margin-bottom: 4px; }
.panel p { margin: 4px 0 12px; }
.import { display: grid; gap: 4px; }
.summary { margin: 12px 0 0; padding-left: 18px; }
.adminbar .hint { margin: 10px 0 0; }
.warn-line { color: var(--gold); font-size: 13px; margin: 12px 0 0 !important; }
details.warn { margin-top: 10px; font-size: 13px; color: var(--muted); }
details.warn summary { cursor: pointer; color: var(--gold); }
details.warn ul { margin: 6px 0 0; padding-left: 18px; }

/* category */
.cat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 32px 0 18px; }
.cat-head h1 { font-size: clamp(26px, 4vw, 38px); }
.champion-banner { display: flex; gap: 14px; align-items: center; background: linear-gradient(90deg, rgba(245,200,76,.14), transparent); border: 1px solid rgba(245,200,76,.35); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; }
.champion-banner .trophy { font-size: 28px; color: var(--gold); }
.champion-banner div { display: flex; flex-direction: column; }
.champion-banner small { text-transform: uppercase; letter-spacing: .1em; color: var(--gold); font-size: 11px; font-weight: 600; }
.champion-banner strong { font: 700 22px var(--display); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--text); border-color: var(--accent); }
.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); margin-top: 16px; }
.empty p { margin: 0 0 14px; }

/* matches */
.match { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.match .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--panel-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.match .slotin { font-size: 12px; padding: 3px 7px; width: 120px; text-transform: none; letter-spacing: 0; background: var(--bg); }
.slot { padding: 8px 10px; display: flex; flex-direction: column; border-top: 1px solid var(--line); min-height: 44px; justify-content: center; }
.meta + .slot { border-top: 0; }
.match.bye .slot:first-child { border-top: 0; }
.slot .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot.win { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.slot.win .nm::after { content: ' ✓'; color: var(--accent); }
.slot.lose { opacity: .45; }
.slot.clickable { cursor: pointer; }
.slot.clickable:hover { background: rgba(255,255,255,.04); }
.slot.win.clickable:hover { background: rgba(198,255,61,.18); }
.tbd { color: var(--muted); font-style: italic; font-size: 13px; }
.byeslot { color: var(--muted); font-size: 12px; font-style: italic; }
.match.bye { opacity: .7; }

/* bracket */
.bracket-scroll { overflow-x: auto; padding-bottom: 12px; margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.bracket { display: flex; gap: 28px; min-width: max-content; }
.round { display: flex; flex-direction: column; width: 230px; }
.round h4 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 12px; position: sticky; top: 0; }
.round-body { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 12px; }
.round:last-child .match { border-color: rgba(245,200,76,.45); }

/* fixtures */
.fix-round { margin-bottom: 28px; }
.fix-round h3 { font-size: 18px; margin-bottom: 12px; display: flex; gap: 10px; align-items: baseline; }
.fix-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.byes { margin-top: 10px; }

/* entrants */
.ent-tools { margin-bottom: 12px; }
.ent-tools input { width: 100%; max-width: 360px; }
.add-form { margin-bottom: 14px; }
.add-form input { flex: 1 1 160px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.ents { width: 100%; border-collapse: collapse; font-size: 14px; }
.ents th, .ents td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ents th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; background: var(--panel); }
.ents tr:last-child td { border-bottom: 0; }
.ents .num { color: var(--muted); width: 40px; }
.ents .sub { color: var(--muted); font-size: 13px; }
.ents .ph { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.ents tr.removed td { opacity: .4; text-decoration: line-through; }
.ents tr.removed td.actions { opacity: 1; text-decoration: none; }
.ents .actions { text-align: right; }

/* dialog + toast */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; padding: 24px; width: min(380px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { font-size: 20px; } dialog input { width: 100%; margin: 6px 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top { padding: 12px 16px; }
  .cat-nav { top: 61px; }
  .brand-text small { display: none; }
  .hero { padding: 28px 0 20px; }
  .cat-head { flex-direction: column; align-items: flex-start; padding-top: 22px; }
  .bracket-scroll { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .round { width: 200px; }
  .fix-grid { grid-template-columns: 1fr; }
}
@media print {
  .top, .cat-nav, .adminbar, .tabs, .toast, .import { display: none !important; }
  body { background: #fff; color: #000; }
  .match, .card { border-color: #999; background: #fff; }
  .bracket-scroll { overflow: visible; }
}

/* ---------- scheduling ---------- */
.row.between { justify-content: space-between; }
.sched-bar { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.sched-bar input[type=number] { width: 64px; }
.timebox { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; }
.timebox .time { color: var(--text); font-weight: 600; }
.timein { font-size: 12px; padding: 2px 6px; background: var(--bg); color-scheme: dark; }
.moved-tag { font-size: 10.5px; color: var(--gold); background: rgba(245,200,76,.12); border-radius: 6px; padding: 1px 6px; text-transform: none; letter-spacing: 0; font-weight: 600; white-space: nowrap; }
.match.moved { border-color: rgba(245,200,76,.45); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 4px; font-weight: 700; }
.cat-nav a.on .badge { background: var(--accent-ink); color: var(--accent); }
textarea { width: 100%; font: 14px var(--font); background: var(--panel-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px; margin: 6px 0 10px; resize: vertical; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; margin-top: 8px; flex-wrap: wrap; }
#chgPreview { margin-top: 6px; }
.calls.hot { border-color: rgba(255,107,107,.55); background: linear-gradient(180deg, rgba(255,107,107,.08), var(--panel)); }
.call { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.call-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.call-head .btn { margin-left: auto; }
.when { font-size: 12px; font-weight: 700; color: var(--gold); background: rgba(245,200,76,.12); border-radius: 6px; padding: 2px 8px; }
.when.urgent { color: #fff; background: var(--danger); }
.person { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 4px 0; font-size: 14px; }
.person strong { min-width: 140px; }
.contact { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.contact a { color: var(--text); border: 1px solid var(--line-2); border-radius: 7px; padding: 2px 8px; font-size: 12.5px; white-space: nowrap; }
.contact a.wa { color: #4ade80; border-color: rgba(74,222,128,.35); }
.contact a:hover { border-color: var(--muted); }
details.change { border-top: 1px solid var(--line); padding: 10px 0; }
details.change summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
details.change.done { opacity: .6; }
details.change .note { margin: 6px 0; font-style: italic; }
details.change .notify { margin: 8px 0; }
.warnbox { border-color: rgba(245,200,76,.4); }
.warnbox ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.chips { margin: 8px 0 16px; }
.chip { font: 500 13px var(--font); border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.timeline { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.hour { background: var(--panel-2); color: var(--muted); font: 600 12px var(--display); letter-spacing: .08em; text-transform: uppercase; padding: 6px 14px; border-top: 1px solid var(--line); }
.hour:first-child { border-top: 0; }
.tl-row { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.tl-time { font-weight: 600; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; }
.tl-time small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.tl-body { display: flex; flex-direction: column; min-width: 0; gap: 2px; align-items: flex-start; }
.tl-game { font-size: 12px; color: var(--muted); }
.tl-vs { font-weight: 500; }
.tl-row.played { opacity: .5; }
.tl-row.past:not(.played) .tl-time { color: var(--gold); }
@media (max-width: 640px) {
  .tl-row { grid-template-columns: 92px 1fr; }
  .tl-state { grid-column: 2; }
  .person strong { min-width: 0; width: 100%; }
}
.daysel { font-size: 12px; padding: 2px 4px; background: var(--bg); text-transform: none; }
.dayhead { background: var(--accent); color: var(--accent-ink); font: 700 13px var(--display); letter-spacing: .04em; padding: 8px 14px; }
.tl-time .daysel { margin-bottom: 4px; width: fit-content; }
.seed { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 4px; margin-right: 6px; border-radius: 5px; background: var(--gold); color: #1a1400; font: 700 11px var(--font); vertical-align: 1px; }
.ents .seed { margin: 0; }
.pnote { display: block; font-size: 11.5px; color: var(--gold); font-style: italic; white-space: normal; }
.mnote { border-top: 1px solid var(--line); padding: 5px 8px; }
.notein { width: 100%; font-size: 12px; padding: 4px 8px; background: var(--bg); border-color: var(--line); }
.notein::placeholder { color: var(--muted); opacity: .7; }
.notecell { min-width: 200px; }
.tl-body .mnote { border: 0; padding: 4px 0 0; width: 100%; max-width: 360px; }
details.rules { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
details.rules summary { cursor: pointer; font-weight: 600; }
details.rules ul { margin: 10px 0 4px; padding-left: 18px; font-size: 14px; color: var(--text); }
details.rules li { margin: 3px 0; }
.byetag { display: inline-grid; place-items: center; height: 18px; padding: 0 5px; margin-right: 6px; border-radius: 5px; background: var(--live); color: #001a26; font: 700 10px var(--font); vertical-align: 1px; letter-spacing: .04em; }
.movesel { font-size: 12px; padding: 3px 6px; margin-right: 4px; }
