/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:   #B4975A;
  --gold:    #B4975A;
  --dark:    #1a1a1a;
  --mid:     #2d3561;
  --light:   #f5f5f5;
  --border:  #d1d5db;
  --text:    #1f2937;
  --muted:   #6b7280;
  --error:   #dc2626;
  --success: #16a34a;
  --radius:  8px;
  --shadow:  0 2px 8px rgba(0,0,0,.1);
}

body {
  font-family: 'Open Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--light);
  line-height: 1.5;
}

h1, h2, h3 { font-family: 'Roboto', 'Open Sans', sans-serif; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.8rem; margin-bottom: .75rem; }
h2 { font-size: 1.35rem; margin: 1.5rem 0 .5rem; color: var(--gold); }
h3 { font-size: 1.05rem; margin: .75rem 0 .25rem; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--dark);
  color: #fff;
  padding: .65rem 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
  border-bottom: 2px solid var(--gold);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-logo { display: flex; align-items: center; line-height: 0; }
.site-logo img { display: block; }
.site-header nav a { color: #c8b99a; margin-left: 1.25rem; font-size: .9rem; font-family: 'Roboto', sans-serif; }
.site-header nav a:hover { color: var(--gold); text-decoration: none; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer { background: var(--dark); color: #9ca3af; padding: 1rem 0; margin-top: 3rem; text-align: center; font-size: .85rem; border-top: 2px solid var(--gold); }

/* ── Main content ──────────────────────────────────────────────────────────── */
main.container { padding-top: 1.5rem; padding-bottom: 3rem; }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-success { background: #dcfce7; color: var(--success); border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: var(--error);   border: 1px solid #fca5a5; }
.alert ul { margin: .25rem 0 0 1rem; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f0f0f0; text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: #9a7b47; border-color: #9a7b47; }
.btn-danger  { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; text-decoration: none; }

/* ── Delete entry modal ─────────────────────────────────────────────────────── */
.delete-modal {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  padding: 2rem;
  max-width: 440px;
  width: 90%;
}
.delete-modal::backdrop { background: rgba(0,0,0,.45); }
.delete-modal-title { font-size: 1.2rem; margin-bottom: .6rem; color: var(--error); }
.delete-modal-body  { font-size: .93rem; color: var(--text); line-height: 1.5; }
.delete-modal-actions { display: flex; gap: .65rem; justify-content: flex-end; margin-top: 1.25rem; }
.btn-lg { padding: .7rem 1.6rem; font-size: 1rem; }
.btn-sm { padding: .25rem .6rem; font-size: .8rem; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-row { margin-bottom: .75rem; }
.form-row label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .9rem; }
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="tel"] {
  width: 100%; max-width: 420px;
  padding: .45rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
}
.form-row input:focus { outline: 2px solid var(--green); border-color: var(--green); }
.form-row small { display: block; color: var(--muted); font-size: .8rem; margin-top: .2rem; }

/* ── Home ───────────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 2.5rem 1rem; }
.hero h1 { font-size: 2.4rem; margin-bottom: .5rem; }
.hero .subtitle { color: var(--muted); font-size: 1.1rem; margin-bottom: 1rem; }
.hero .btn-lg { margin-top: .75rem; }
.deadline-line { margin: .4rem 0 .75rem; font-size: 1rem; }
.deadline-banner { background: #fffbeb; border: 1px solid #fcd34d; border-radius: var(--radius); padding: .6rem 1rem; margin-bottom: 1.25rem; font-size: .95rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ── Predict page instructions ──────────────────────────────────────────────── */
.instructions-card {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}
.instructions-title {
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 .85rem;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
}
.instructions-list {
  margin: 0 0 1rem 1.15rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  font-size: .92rem;
  color: var(--text);
}
.instructions-list li { line-height: 1.5; }
.instructions-callout {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: .7rem .9rem;
  font-size: .88rem;
  color: #7c2d12;
  line-height: 1.5;
}
.instructions-callout-icon { font-size: 1.05rem; flex-shrink: 0; margin-top: .05rem; }
.instructions-callout--info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a5f; }

.ko-update-note {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: .65rem .9rem;
  font-size: .88rem;
  color: #1e40af;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-top: 2rem; }
@media (max-width: 640px) { .info-grid { grid-template-columns: 1fr; } }
.info-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.info-card h3 { color: var(--gold); margin-bottom: .5rem; }
.info-card ol { padding-left: 1.2rem; }
.info-card ol li { margin-bottom: .35rem; }

/* ── Confirmation page ──────────────────────────────────────────────────────── */
.confirm-wrap { max-width: 580px; margin: 0 auto; }
.confirm-hero { text-align: center; padding: 2rem 1rem 1.5rem; }
.confirm-icon { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.confirm-hero h1 { font-size: 2rem; margin-bottom: .4rem; }
.confirm-hero p  { font-size: 1.05rem; color: var(--muted); }
.confirm-hero strong { color: var(--text); }
.confirm-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem 1.75rem; }
.confirm-card-title { font-size: 1rem; color: var(--gold); margin: 0 0 1rem; text-transform: uppercase; letter-spacing: .04em; font-family: 'Roboto', sans-serif; }
.confirm-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
.confirm-steps li { display: flex; gap: .85rem; align-items: flex-start; font-size: .95rem; line-height: 1.5; color: var(--text); }
.confirm-step-num { flex-shrink: 0; width: 1.6rem; height: 1.6rem; background: var(--gold); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; margin-top: .05rem; }
.score-table { width: 100%; font-size: .9rem; }
.score-table td { padding: .2rem .3rem; }
.score-table th { padding: .4rem .3rem; font-size: .85rem; color: var(--muted); }

/* ── Prediction form ────────────────────────────────────────────────────────── */
.hint { color: var(--muted); font-size: .9rem; margin-bottom: .75rem; }

.group-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.group-header {
  background: var(--gold);
  color: #fff;
  padding: .5rem 1rem;
}
.group-header h3 { margin: 0; font-size: 1rem; }
.group-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
}
@media (max-width: 700px) { .group-body { grid-template-columns: 1fr; } }

/* Group table */
.group-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.group-table th { background: var(--light); padding: .3rem .4rem; text-align: center; font-size: .8rem; border-bottom: 2px solid var(--border); }
.group-table td { padding: .3rem .4rem; text-align: center; border-bottom: 1px solid #eee; }
.group-table td:first-child { text-align: left; }
.group-table tr:last-child td { border-bottom: none; }
.group-table tr.qualify-auto td { background: #fdf6e6; }
.group-table tr.qualify-third td { background: #fff8e1; }
.qualifier-line { font-size: .78rem; color: var(--muted); margin-top: .4rem; }
.grp-rank { font-size: .7em; color: var(--muted); font-weight: 400; }

/* Third-place ranking table */
#thirds-table tr.qualify-third td { background: #fff8e1; }
#thirds-table tr.no-qualify td { background: #fafafa; color: var(--muted); }
#thirds-table tr.qualify-cutoff td { border-bottom: 2px dashed var(--gold); }
#thirds-table td.pos { font-weight: 700; width: 2rem; text-align: center; }
#thirds-table td.grp { text-align: center; font-weight: 600; color: var(--gold); }
.thirds-empty { text-align: center; color: var(--muted); font-style: italic; padding: 1rem !important; }
.table-wrap { overflow-x: auto; }
.flag-code { font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; }

/* Match input rows */
.match-list { display: flex; flex-direction: column; gap: .5rem; }
.match-row {
  display: grid;
  grid-template-columns: 1fr 2.5rem .7rem 2.5rem 1fr;
  align-items: center;
  gap: .3rem;
  font-size: .9rem;
}
.team-name { white-space: nowrap; }
.team-name.home { text-align: right; }
.team-name.away { text-align: left; }
.score-input {
  width: 2.4rem; text-align: center;
  padding: .35rem .25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .9rem;
  -moz-appearance: textfield;
}
.score-input::-webkit-inner-spin-button,
.score-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.score-input.small { width: 3rem; }
.vs { text-align: center; color: var(--muted); font-size: .8rem; }

/* ── Knockout bracket ───────────────────────────────────────────────────────── */
.knockout-round {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.knockout-round h3 {
  background: var(--gold);
  color: #fff;
  margin: 0;
  padding: .5rem 1rem;
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Grid of match cards inside each round */
.ko-matches-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  padding: .75rem;
}
#round-QF   .ko-matches-grid { grid-template-columns: 1fr 1fr; }
#round-SF   .ko-matches-grid { grid-template-columns: 1fr 1fr; }
#round-FINAL .ko-matches-grid {
  grid-template-columns: minmax(0, 460px);
  justify-content: center;
}
@media (max-width: 600px) {
  .ko-matches-grid,
  #round-QF .ko-matches-grid,
  #round-SF .ko-matches-grid { grid-template-columns: 1fr; }
}

/* Individual match card */
.knockout-match {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .75rem;
  background: var(--light);
}

/* The two team choices sit side-by-side and fill the card width */
.ko-winner-radios {
  display: flex;
  gap: .4rem;
}
.ko-radio-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  cursor: pointer;
  padding: .35rem .5rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: .88rem;
  transition: border-color .15s, background .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.ko-radio-label:hover { border-color: var(--green); background: #fdf6e6; }
.ko-radio-label input[type="radio"] { accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
.ko-radio-label:has(input:checked) { border-color: var(--green); background: #faefd8; font-weight: 600; }
.ko-tbd { color: var(--muted); font-style: italic; font-size: .82rem; text-align: center; display: block; }
.knockout-match.ko-missing { outline: 2px solid var(--error); background: #fee2e2; }

/* ── Submit section ─────────────────────────────────────────────────────────── */
.submit-section { margin: 2rem 0; padding: 1.5rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); text-align: center; }
.submit-section p { margin-bottom: 1rem; color: var(--muted); }

/* ── Admin ──────────────────────────────────────────────────────────────────── */
.auth-wrap { max-width: 380px; margin: 3rem auto; }
.auth-form .form-row { margin-bottom: 1rem; }
.auth-form button { margin-top: .5rem; width: 100%; }

.stat-cards { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.stat-card { flex: 1; min-width: 140px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; text-align: center; }
.stat-num  { font-size: 2rem; font-weight: 700; color: var(--gold); }
.stat-label{ font-size: .85rem; color: var(--muted); }

.admin-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }

.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.data-table th { background: var(--gold); color: #fff; padding: .5rem .75rem; text-align: left; font-size: .85rem; }
.data-table td { padding: .45rem .75rem; border-bottom: 1px solid #eee; font-size: .9rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f9fafb; }

.leaderboard .row-gold   td { background: #fffef5; }
.leaderboard .row-silver td { background: #f9fafb; }
.leaderboard-full .row-gold   td { background: #fffef5; }
.leaderboard-full .row-silver td { background: #f9fafb; }

/* ── Public leaderboard table ─────────────────────────────────────────────── */
table.leaderboard {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
table.leaderboard th {
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .55rem .75rem;
}
table.leaderboard th:first-child { width: 56px; text-align: center; }
table.leaderboard th:nth-child(2) { width: 52px; text-align: center; }
table.leaderboard th:last-child   { width: 80px; text-align: right; padding-right: 1.1rem; }
table.leaderboard td              { padding: .55rem .75rem; font-size: .92rem; }
table.leaderboard td:last-child   { text-align: right; padding-right: 1.1rem; font-size: 1rem; }
table.leaderboard tr:hover td     { background: rgba(180,151,90,.06) !important; }
table.leaderboard .row-gold   td:first-child { border-left: 4px solid #B8972E; }
table.leaderboard .row-silver td:first-child { border-left: 4px solid #94a3b8; }
table.leaderboard .row-last   td:first-child { border-left: 4px solid #dc2626; }

/* Position cell */
.lb-pos-cell { text-align: center !important; }
.lb-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 800;
  line-height: 1;
}
.lb-medal--gold   { background: #B8972E; color: #fff; box-shadow: 0 1px 4px rgba(184,151,46,.45); }
.lb-medal--silver { background: #94a3b8; color: #fff; box-shadow: 0 1px 4px rgba(148,163,184,.45); }
.lb-medal--bronze { background: #c97c4a; color: #fff; box-shadow: 0 1px 4px rgba(201,124,74,.45); }
.lb-medal--prize  { background: #fdf6e6; color: #7a6130; border: 1.5px solid var(--gold); font-size: .75rem; }
.lb-pos-num       { font-size: .9rem; font-weight: 600; color: var(--muted); }

/* ── Full leaderboard (with stage breakdown) ─────────────────────────────── */
.leaderboard-full { font-size: .85rem; }
.leaderboard-full th { white-space: nowrap; }
.lb-stage { text-align: center !important; font-size: .82rem; color: var(--muted); min-width: 2.8rem; }
.lb-stage strong { color: var(--text); }
.lb-zero  { color: #ccc; }
.lb-max   { text-align: center !important; font-size: .82rem; color: var(--mid); font-weight: 600; }
.lb-max-head { color: var(--mid); }
.lb-move  { text-align: center !important; width: 3rem; white-space: nowrap; }
.move-up   { color: var(--success); font-size: .78rem; font-weight: 700; }
.move-down { color: var(--error);   font-size: .78rem; font-weight: 700; }
.move-none { color: var(--muted);   font-size: .9rem; }
.move-new  { color: var(--muted);   font-size: 1rem; }

/* ── Head-to-Head ───────────────────────────────────────────────────────── */
.h2h-form { margin-bottom: 1.5rem; }
.h2h-selects { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.h2h-select { flex: 1; min-width: 220px; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; }
.h2h-vs { font-weight: 700; color: var(--muted); flex-shrink: 0; }

.h2h-header { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1rem; align-items: center; margin-bottom: 1.5rem; }
.h2h-card { background: #fff; border: 2px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; text-align: center; }
.h2h-card-a { border-color: var(--mid); }
.h2h-card-b { border-color: var(--gold); }
.h2h-card-name { font-weight: 700; font-size: 1rem; }
.h2h-card-pts  { color: var(--gold); font-size: 1.4rem; font-weight: 700; }
.h2h-summary   { text-align: center; }
.h2h-agree-stat  { font-size: 1.8rem; font-weight: 700; color: var(--mid); }
.h2h-agree-label { font-size: .78rem; color: var(--muted); }

.h2h-group-section  { margin-bottom: 1.5rem; }
.h2h-group-header   { background: var(--mid); color: #fff; padding: .3rem .75rem; font-weight: 700; font-size: .85rem; border-radius: var(--radius) var(--radius) 0 0; }
.h2h-table tr.h2h-agree td { background: #f0fdf4; }
.h2h-score { font-weight: 600; }
.muted-text { color: var(--muted); font-size: .85rem; }

.h2h-ko-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.h2h-ko-panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.h2h-ko-title { background: var(--mid); color: #fff; padding: .35rem .75rem; font-size: .8rem; font-weight: 700; }
.h2h-ko-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.h2h-ko-table th { background: var(--light); padding: .25rem .5rem; text-align: center; border-bottom: 1px solid var(--border); font-size: .75rem; }
.h2h-ko-table th:first-child { text-align: left; }
.h2h-ko-table td { padding: .25rem .5rem; border-bottom: 1px solid #f0f0f0; }
.h2h-ko-table tr:last-child td { border-bottom: none; }
.h2h-ko-table tr.h2h-actual-winner td { background: #f0fdf4; font-weight: 600; }
.h2h-ko-table tr.h2h-ko-agree td { background: #eff6ff; }
.h2h-tick { text-align: center !important; color: var(--success); font-weight: 700; }

/* ── Stats avg alongside result ─────────────────────────────────────────── */
.smc-result-avg { font-size: .75rem; color: var(--muted); white-space: nowrap; padding: 0 .4rem; }

/* ── Stats picks popover ─────────────────────────────────────────────────── */
.picks-trigger { cursor: pointer; }
.picks-trigger:hover { background: rgba(0,0,0,.04); }
.picks-trigger.picks-active { background: rgba(192,155,75,.15); }
.picks-popover { position: absolute; z-index: 200; min-width: 180px; max-width: 300px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.picks-popover-inner { padding: .6rem .75rem; }
.picks-popover-title { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: .4rem; border-bottom: 1px solid var(--border); padding-bottom: .3rem; }
.picks-popover-body { display: flex; flex-direction: column; gap: .2rem; max-height: 260px; overflow-y: auto; }
.picks-name { font-size: .875rem; color: var(--text); text-decoration: none; padding: .15rem 0; }
.picks-name:hover { color: var(--gold); }
.picks-loading { font-size: .875rem; color: var(--muted); font-style: italic; }
.picks-empty { font-size: .875rem; color: var(--muted); }

.results-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: .9rem; }
.results-table th { padding: .35rem .5rem; background: var(--light); border-bottom: 2px solid var(--border); }
.results-table td { padding: .35rem .5rem; border-bottom: 1px solid #eee; }

/* ── Results page header ─────────────────────────────────────────────────── */
.results-page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: .25rem; }
.results-page-header h1 { margin: 0; }

/* ── Admin results grid ──────────────────────────────────────────────────── */
.results-groups-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; margin-bottom: 1.5rem; }
@media (max-width: 820px) { .results-groups-grid { grid-template-columns: 1fr; } }

/* ── Group standing blocks ────────────────────────────────────────────────── */
.res-standing-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.res-standing-header {
  background: var(--gold);
  color: #fff;
  font-weight: 700;
  font-size: .88rem;
  padding: .45rem .85rem;
  letter-spacing: .03em;
}
.res-standing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
}
.res-standing-table th {
  background: #f8fafc;
  padding: .28rem .35rem;
  text-align: center;
  font-size: .7rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.res-standing-table th.rst-team { text-align: left; }
.res-standing-table td {
  padding: .3rem .35rem;
  text-align: center;
  border-bottom: 1px solid #f3f3f3;
  vertical-align: middle;
}
.res-standing-table tr:last-child td { border-bottom: none; }
.res-standing-table td.rst-team { text-align: left; font-weight: 500; }
.res-standing-table tr.rst-qualify td { background: #fdf6e6; }
.res-standing-table tr.rst-third   td { background: #fff8e1; }
.res-standing-key {
  font-size: .7rem;
  color: var(--muted);
  padding: .35rem .7rem;
  background: #fafafa;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.rst-key-auto, .rst-key-third {
  display: inline-block;
  width: .65rem;
  height: .65rem;
  border-radius: 2px;
  flex-shrink: 0;
}
.rst-key-auto  { background: #fdf6e6; border: 1px solid #e8d9a0; }
.rst-key-third { background: #fff8e1; border: 1px solid #e8d9a0; }

/* Group header progress badge */
.group-header { display: flex; align-items: center; justify-content: space-between; }
.group-header h3 { margin: 0; }
.group-progress-badge { background: rgba(255,255,255,.25); color: #fff; font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 20px; white-space: nowrap; }

/* ── Result match rows (group stage entry) ───────────────────────────────── */
.result-match-list { padding: .35rem .6rem .5rem; }

.result-match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
  padding: .4rem .35rem;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 4px;
  transition: background .15s;
}
.result-match-row:last-child { border-bottom: none; }
.result-match-row.has-result { background: #f6fef9; }

.result-home { text-align: right; font-size: .88rem; line-height: 1.3; color: var(--text); }
.result-away { text-align: left;  font-size: .88rem; line-height: 1.3; color: var(--text); }

.result-score-wrap { display: flex; align-items: center; gap: .3rem; flex-shrink: 0; }

.result-score-input {
  width: 2.9rem; height: 2.4rem;
  text-align: center;
  padding: .3rem .2rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mid);
  background: #fff;
  -moz-appearance: textfield;
  transition: border-color .15s, background .15s;
}
.result-score-input::-webkit-inner-spin-button,
.result-score-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.result-score-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180,151,90,.15); }
.result-score-input:not(:placeholder-shown) { border-color: var(--gold); background: #fdf9f0; }

.result-dash { color: var(--muted); font-weight: 700; font-size: .9rem; }

/* ── Knockout results grid ───────────────────────────────────────────────── */
/* ── Group match result rows ──────────────────────────────────────────────── */
.res-group-block {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .6rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.res-group-summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  cursor: pointer;
  background: #f8fafc;
  list-style: none;
  user-select: none;
  border-bottom: 1px solid transparent;
}
.res-group-summary::-webkit-details-marker { display: none; }
.res-group-summary::before {
  content: '▶';
  font-size: .6rem;
  color: var(--muted);
  transition: transform .15s;
  flex-shrink: 0;
}
details[open].res-group-block > .res-group-summary {
  border-bottom-color: var(--border);
}
details[open].res-group-block > .res-group-summary::before { transform: rotate(90deg); }
.res-group-name { font-weight: 700; color: var(--mid); font-size: .9rem; }
.res-group-progress {
  margin-left: auto;
  font-size: .75rem;
  color: var(--muted);
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: .1rem .55rem;
}

.res-match-list { display: flex; flex-direction: column; }
.res-match-row {
  display: grid;
  grid-template-columns: 2.4rem 1fr 5.5rem 1fr 5.5rem;
  align-items: center;
  padding: .48rem 1rem;
  border-top: 1px solid #f5f5f5;
  gap: .4rem;
  transition: background .1s;
}
.res-match-row:hover { background: #fafafa; }
.res-match--played  { border-left: 3px solid #86efac; }
.res-match--pending { border-left: 3px solid #e5e7eb; }
.res-match-num { font-size: .7rem; color: #bbb; text-align: right; font-variant-numeric: tabular-nums; }
.res-team { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-home { text-align: right; }
.res-away { text-align: left; }
.res-winner { font-weight: 700; color: var(--text); }
.res-loser  { color: #adb5bd; }
.res-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  white-space: nowrap;
}
.res-score strong { font-size: .95rem; color: var(--mid); font-variant-numeric: tabular-nums; }
.res-score-sep { color: var(--muted); font-weight: 400; font-size: .8rem; }
.res-vs { font-size: .78rem; color: #ccc; font-style: italic; }
.res-match-date { font-size: .71rem; color: var(--muted); text-align: right; white-space: nowrap; }
@media (max-width: 540px) {
  .res-match-row { grid-template-columns: 2rem 1fr 4.5rem 1fr; }
  .res-match-date { display: none; }
}

/* ── KO fixture cards ─────────────────────────────────────────────────────── */
.kof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.kof-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  transition: box-shadow .15s;
}
.kof-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.kof-card--played { border-color: #86efac; }
.kof-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem .85rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.kof-card--played .kof-card-header { background: #f0fdf4; border-bottom-color: #bbf7d0; }
.kof-card-num { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kof-card-date { font-size: .72rem; color: var(--muted); }
.kof-matchup {
  display: flex;
  align-items: center;
  padding: .8rem .85rem;
  gap: .5rem;
  flex: 1;
}
.kof-team {
  flex: 1;
  font-size: .88rem;
  font-weight: 500;
  line-height: 1.3;
}
.kof-team--home { text-align: right; }
.kof-team--away { text-align: left; }
.kof-team--winner { font-weight: 700; color: var(--text); }
.kof-team--loser  { color: #adb5bd; font-weight: 400; }
.kof-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.8rem;
  flex-shrink: 0;
}
.kof-vs { font-size: .78rem; color: #ccc; font-style: italic; }
.kof-ft-badge {
  font-size: .68rem;
  font-weight: 700;
  background: #dcfce7;
  color: #15803d;
  border-radius: 4px;
  padding: .18rem .4rem;
  letter-spacing: .04em;
}
.kof-winner-row {
  padding: .38rem .85rem;
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
  font-size: .76rem;
  font-weight: 600;
  color: #15803d;
  text-align: center;
}

/* keep old names so admin results page is unaffected */
.ko-result-card { background: var(--light); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .65rem; display: flex; flex-direction: column; gap: .35rem; }
.ko-result-teams { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.ko-result-home { flex: 1; text-align: right; font-weight: 500; }
.ko-result-away { flex: 1; text-align: left; }
.ko-result-vs   { color: var(--muted); font-size: .78rem; white-space: nowrap; flex-shrink: 0; }
.ko-winner-select { width: 100%; font-size: .85rem; padding: .3rem .5rem; border: 1.5px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; }
.ko-winner-select:focus { outline: none; border-color: var(--gold); }

.total-pts { font-size: 1.1rem; margin-bottom: 1rem; }

/* ── Entry detail header + rename ───────────────────────────────────────── */
.entry-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.rename-form { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.rename-input { padding: .4rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; width: 200px; }
.rename-input:focus { outline: 2px solid var(--gold); border-color: var(--gold); }

/* ── Round navigation (results page) ─────────────────────────────────────── */
.round-nav {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.round-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .45rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: .82rem;
  transition: border-color .15s, background .15s, color .15s;
  min-width: 80px;
  text-align: center;
}
.round-nav-item:hover { border-color: var(--gold); color: var(--dark); }
.round-nav-item.active { border-color: var(--gold); background: var(--gold); color: #fff; }
.round-nav-item.complete { border-color: #16a34a; color: #16a34a; }
.round-nav-item.complete.active { background: #16a34a; border-color: #16a34a; color: #fff; }
.round-nav-item.partial { border-color: #d97706; color: #92400e; }

.rni-label { font-weight: 600; line-height: 1.2; }
.rni-count  { font-size: .7rem; opacity: .75; margin-top: .1rem; }
.round-nav-item.active .rni-count,
.round-nav-item.complete .rni-count { opacity: .8; }

/* ── Group stage results table ───────────────────────────────────────────── */
.res-table-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
.res-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.res-table th {
  background: var(--mid);
  color: #fff;
  padding: .35rem .5rem;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
.res-table .col-date  { width: 5rem; }
.res-table .col-num   { width: 2.5rem; text-align: center; }
.res-table .col-grp   { width: 2.5rem; text-align: center; }
.res-table .col-home  { text-align: right; }
.res-table .col-score { width: 8rem; text-align: center; }
.res-table .col-away  { text-align: left; }

/* Date separator rows */
.res-date-row td {
  background: var(--light);
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .3rem .5rem;
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* Match data rows */
.res-row td {
  padding: .3rem .5rem;
  border-bottom: 1px solid #f3f3f3;
  vertical-align: middle;
}
.res-row:last-child td { border-bottom: none; }
.res-row.has-result { background: #f6fef9; }
.res-row.has-result td { border-bottom-color: #d1fae5; }

.res-table .col-date { color: var(--muted); font-size: .8rem; }
.res-table .col-num  { color: var(--muted); font-size: .78rem; text-align: center; }
.res-table .col-grp  { font-weight: 700; color: var(--mid); text-align: center; }
.res-table .col-home { text-align: right; font-weight: 500; }
.res-table .col-away { text-align: left;  font-weight: 500; }

.ko-result-card.has-winner  { background: #f0fdf4; border-color: #86efac; }
.ko-result-meta    { font-size: .72rem; color: var(--muted); margin-bottom: .2rem; }
.ko-result-stadium { display: block; font-size: .68rem; color: #bbb; font-style: italic; margin-top: .1rem; }

/* ── Prediction stats page ───────────────────────────────────────────────── */
.stats-group-section { margin-bottom: 2.25rem; }

.stats-group-header {
  background: var(--mid);
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .35rem .85rem;
  border-radius: 6px 6px 0 0;
}

.stats-match-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}
@media (max-width: 800px) { .stats-match-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stats-match-grid { grid-template-columns: 1fr; } }

/* Each match card */
.smc {
  padding: .85rem .9rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .45rem;
  background: #fff;
}
.smc:nth-child(3n) { border-right: none; }
.smc:nth-last-child(-n+3) { border-bottom: none; }

/* Meta row */
.smc-meta {
  font-size: .68rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.smc-meta-sep { opacity: .4; }

/* Teams */
.smc-teams {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .1rem;
}
.smc-team { display: flex; align-items: baseline; gap: .18rem; }
.smc-team-home { justify-content: flex-end; flex: 1; }
.smc-team-away { justify-content: flex-start; flex: 1; }
.smc-name { font-size: .92rem; font-weight: 700; color: var(--dark); }
.smc-code { font-size: .62rem; font-weight: 700; color: var(--gold); letter-spacing: .02em; }
.smc-versus { font-size: .72rem; color: var(--muted); flex-shrink: 0; padding: 0 .1rem; }

/* Average */
.smc-avg {
  font-size: .72rem;
  color: var(--muted);
  text-align: center;
}
.smc-avg strong { color: var(--dark); }

/* Distribution */
.smc-dist { display: flex; flex-direction: column; gap: .18rem; flex: 1; }
.smc-dist-row {
  display: grid;
  grid-template-columns: 2rem 1fr 2.2rem 1.5rem;
  align-items: center;
  gap: .35rem;
}
.smc-dist-score {
  font-size: .75rem;
  font-weight: 600;
  color: var(--mid);
  text-align: center;
  white-space: nowrap;
}
.smc-bar-wrap {
  background: #eeeeee;
  border-radius: 3px;
  height: .7rem;
  overflow: hidden;
}
.smc-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  min-width: 2px;
}
.smc-dist-pct {
  font-size: .7rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.smc-dist-n {
  font-size: .65rem;
  color: #bbb;
  text-align: right;
}
/* Actual result row highlights green */
.smc-dist-row.is-actual .smc-dist-score { color: #15803d; font-weight: 700; }
.smc-dist-row.is-actual .smc-bar        { background: #16a34a; }
.smc-dist-row.is-actual .smc-dist-pct   { color: #15803d; font-weight: 600; }
.smc-dist-more { font-size: .65rem; color: #bbb; margin-top: .05rem; }

/* Result accuracy bar at the bottom */
.smc-result-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding-top: .45rem;
  border-top: 1px solid #f0f0f0;
  margin-top: auto;
}
.smc-result-score {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--mid);
  white-space: nowrap;
  min-width: 2.5rem;
  text-align: center;
}
.smc-acc-group {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;
}
.smc-acc-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.smc-acc-pct {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}
.smc-acc-pct.good { color: #16a34a; }
.smc-acc-label {
  font-size: .62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: .1rem;
}
.smc-acc-divider {
  width: 1px;
  height: 2rem;
  background: var(--border);
  flex-shrink: 0;
}
.smc-empty { font-size: .8rem; color: var(--muted); font-style: italic; margin: 0; }

/* ── Dashboard settings ──────────────────────────────────────────────────── */
.settings-row { display: flex; align-items: baseline; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }
.settings-row:last-of-type { border-bottom: none; }
.settings-label { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.settings-hint { font-size: .82rem; color: var(--muted); }

/* ── Public leaderboard meta bar ────────────────────────────────────────── */
.lb-message { background:#fffbf0; border-left:4px solid var(--gold); border-radius:var(--radius); padding:.75rem 1rem; margin-bottom:1.25rem; }
.lb-message p { margin:0; line-height:1.6; white-space:pre-wrap; }
.lb-meta-bar { display:flex; gap:.75rem; align-items:center; flex-wrap:wrap; margin-bottom:.6rem; padding-bottom:.6rem; border-bottom:1px solid var(--border); }
.lb-meta-bar .hint { font-size:.83rem; }
.lb-name-link { color: var(--text); font-weight:600; }
.lb-name-link:hover { color: var(--gold); text-decoration:none; }

/* ── Leaderboard fun facts / winner picks ───────────────────────────────── */
.lb-fun-facts { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:1rem 1.25rem; margin-top:1.5rem; }
.lb-fun-facts-header { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:.85rem; font-weight:600; font-size:.95rem; }
.winner-picks { display:flex; flex-direction:column; gap:.55rem; }
.winner-pick-row { display:grid; grid-template-columns: 90px 1fr 38px 26px; align-items:center; gap:.6rem; font-size:.88rem; }
.winner-pick-name { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.winner-pick-track { height:10px; background:#e2e8f0; border-radius:99px; overflow:hidden; }
.winner-pick-fill { height:100%; background:var(--gold); border-radius:99px; }
.winner-pick-top .winner-pick-fill { background:var(--gold); }
.winner-pick-pct { font-weight:700; text-align:right; font-size:.85rem; }
.winner-pick-n { color:var(--muted); font-size:.78rem; text-align:right; }

/* ── Admin entry notes ───────────────────────────────────────────────────── */
.entry-note { display:block; font-size:.75rem; color:var(--muted); margin-bottom:.25rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:160px; cursor:help; }

/* ── Public stats page ───────────────────────────────────────────────────── */
.stats-grid { display:grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: auto; gap:1.25rem; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stats-grid { grid-template-columns: 1fr; } }
.stat-block { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:1.1rem 1.25rem; }
.stat-block-title { font-size:1.05rem; font-weight:700; margin:0 0 .15rem; }
.stat-block-sub { font-size:.8rem; color:var(--muted); margin:0 0 .9rem; }
.stat-facts { display:grid; grid-template-columns:1fr 1fr 1fr; gap:.75rem .5rem; margin-top:.25rem; }
.stat-fact { text-align:center; }
.stat-fact-num { display:block; font-size:1.5rem; font-weight:700; color:var(--gold); line-height:1.1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.stat-fact--scoreline .stat-fact-num { font-size:1.2rem; letter-spacing:-.01em; }
.stat-fact-label { display:block; font-size:.72rem; color:var(--muted); margin-top:.2rem; }
.stat-fact--wide { grid-column: 1 / -1; }
.bold-pick-pill { background:var(--surface); border:1px solid var(--border); border-radius:99px; padding:.25rem .75rem; font-size:.82rem; font-weight:600; display:inline-flex; align-items:center; gap:.35rem; }
.bold-pick-count { background:var(--gold); color:#fff; border-radius:99px; font-size:.7rem; padding:.05rem .4rem; font-weight:700; }

/* ── Public results page: KO result cards ───────────────────────────────── */
.ko-result-winner { text-align:center; font-size:.8rem; padding:.3rem .5rem; color:var(--muted); }
.ko-result-winner:not(.ko-result-pending) { color:var(--success); font-weight:700; }
.ko-result-pending { font-style:italic; }
.ko-winner { font-weight:700; color:var(--mid); }

/* ── Public entry view ──────────────────────────────────────────────────── */
.entry-rank-col { text-align:center; }

/* ── Leaderboard hidden state ────────────────────────────────────────────── */
.leaderboard-hidden { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.leaderboard-hidden-icon { font-size: 3rem; line-height: 1; }
.leaderboard-hidden h2 { color: var(--gold); }
.leaderboard-hidden p { font-size: 1rem; margin-top: .5rem; }

/* ── Round Progression ──────────────────────────────────────────────────── */
.progression-round { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .75rem; background: #fff; overflow: hidden; }
.progression-header { background: var(--gold); color: #fff; padding: .5rem 1rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .4rem; }
.prog-title { font-weight: 600; font-size: .95rem; }
.prog-score { font-size: .82rem; opacity: .9; }
.progression-cols { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .progression-cols { grid-template-columns: 1fr; } }
.prog-col { padding: .65rem 1rem; }
.prog-col + .prog-col { border-left: 1px solid var(--border); }
.prog-col-title { font-weight: 700; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; }
.prog-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .1rem .4rem; }
.prog-team { font-size: .84rem; padding: .1rem 0; display: flex; align-items: center; gap: .2rem; }
.prog-team.hit     { color: var(--success); font-weight: 600; }
.prog-team.miss    { color: #bbb; text-decoration: line-through; }
.prog-team.unmarked{ color: var(--text); }
.prog-tick { font-size: .72rem; flex-shrink: 0; }

/* ── Collapsible detail sections ────────────────────────────────────────── */
.detail-section { margin: 1.5rem 0; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; overflow: hidden; }
.detail-section > summary { padding: .6rem 1rem; cursor: pointer; background: var(--light); list-style: none; display: flex; align-items: center; gap: .5rem; user-select: none; }
.detail-section > summary::-webkit-details-marker { display: none; }
.detail-section > summary::before { content: '▶'; font-size: .7rem; color: var(--muted); transition: transform .15s; }
details[open].detail-section > summary::before { transform: rotate(90deg); }
.detail-section > summary h2 { margin: 0; font-size: 1.1rem; }
.detail-section > *:not(summary) { padding: 0 1rem 1rem; }

/* ── Entries management ──────────────────────────────────────────────────── */
.entries-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.entries-filter-tabs { display: flex; gap: .25rem; }
.filter-tab {
  padding: .35rem .85rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: .85rem;
  color: var(--text);
  background: #fff;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.filter-tab:hover { border-color: var(--gold); text-decoration: none; }
.filter-tab.active { background: var(--gold); color: #fff; border-color: var(--gold); font-weight: 600; }
.tab-count { background: rgba(255,255,255,.3); color: inherit; border-radius: 10px; padding: 0 .4rem; font-size: .78rem; margin-left: .3rem; }
.filter-tab:not(.active) .tab-count { background: var(--light); color: var(--muted); }

.entries-search-form { display: flex; align-items: center; gap: .4rem; flex: 1; max-width: 360px; }
.entries-search { flex: 1; padding: .4rem .65rem; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .9rem; }
.entries-search:focus { outline: none; border-color: var(--gold); }

.btn-gold { background: var(--gold); color: #fff; border: none; }
.btn-gold:hover { background: #a0854c; color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.status-badge { display: inline-block; padding: .15rem .55rem; border-radius: 12px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-approved { background: #fdf6e6; color: #7a6130; border: 1px solid #e0c97a; }
.badge-pending  { background: #f3f4f6; color: var(--muted); border: 1px solid var(--border); }

.entries-table .cb-col { text-align: center; width: 3rem; }
.entries-table .entry-email { font-size: .82rem; color: var(--muted); }
.entries-table .entry-phone { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.entries-table input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--gold); cursor: pointer; }
.entries-table .entry-notes-col { max-width: 200px; }
.entry-note { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; max-width: 200px; cursor: help; }

.table-wrap { overflow-x: auto; }
.muted-text { color: var(--muted); padding: 1rem 0; }
.fifa-rank { font-size: .75em; color: var(--muted); font-weight: 400; }

/* ── Entry stage breakdown bar (entry detail page) ─────────────────────── */
.entry-stage-breakdown {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.esb-card {
  flex: 1;
  min-width: 80px;
  padding: .7rem .6rem .55rem;
  text-align: center;
  border-right: 1px solid var(--border);
  background: #fafafa;
}
.esb-card:last-child { border-right: none; }
.esb-card--has-pts { background: #fff; }
.esb-pts {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}
.esb-card--has-pts .esb-pts { color: var(--gold); }
.esb-label {
  font-size: .7rem;
  color: var(--muted);
  margin-top: .25rem;
  line-height: 1.3;
  font-weight: 600;
}
.esb-max {
  font-size: .62rem;
  color: #bbb;
  margin-top: .1rem;
}
@media (max-width: 700px) {
  .esb-card { min-width: 70px; padding: .55rem .4rem; }
  .esb-pts  { font-size: 1.3rem; }
}
@media (max-width: 500px) {
  /* Switch to 4-column grid so cards never cause horizontal overflow */
  .entry-stage-breakdown {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }
  .esb-card {
    min-width: 0;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }
  .esb-card:last-child { border-right: 1px solid var(--border); }
  .esb-pts { font-size: 1.2rem; }
  .esb-label { font-size: .65rem; }
}
/* Stack entry header vertically on mobile */
@media (max-width: 500px) {
  .entry-detail-header { flex-direction: column; }
  .entry-detail-header .btn { align-self: flex-start; }
}

/* ── KO Progression stats (admin stats page) ────────────────────────────── */
.ko-prog-section { margin-bottom: 2.5rem; }

.ko-prog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .85rem;
}
@media (max-width: 900px) { .ko-prog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .ko-prog-grid { grid-template-columns: 1fr; } }

.ko-prog-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ko-prog-panel--champion { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.ko-prog-panel-title {
  background: var(--mid);
  color: #fff;
  padding: .38rem .85rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.ko-prog-panel--champion .ko-prog-panel-title {
  background: var(--gold);
  font-size: .78rem;
}

.ko-prog-list {
  padding: .55rem .75rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.ko-prog-row {
  display: grid;
  grid-template-columns: 3.8rem 1fr 2.4rem 1.6rem;
  align-items: center;
  gap: .35rem;
}
.ko-prog-team {
  font-size: .8rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ko-prog-bar-wrap {
  background: #eeeeee;
  border-radius: 3px;
  height: .55rem;
  overflow: hidden;
}
.ko-prog-bar {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  min-width: 2px;
}
.ko-prog-pct {
  font-size: .7rem;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.ko-prog-n {
  font-size: .65rem;
  color: #bbb;
  text-align: right;
}
/* Actual winner row — green highlight */
.ko-prog-row.is-winner .ko-prog-team { color: #15803d; }
.ko-prog-row.is-winner .ko-prog-bar  { background: #16a34a; }
.ko-prog-row.is-winner .ko-prog-pct  { color: #15803d; font-weight: 600; }
.ko-prog-row.is-winner .ko-prog-n    { color: #86efac; }

/* ── 3rd-place ranking table (results entry page) ───────────────────────── */
.thirds-rank-table td   { text-align: center; font-size: .88rem; }
.thirds-rank-table th   { text-align: center; }
.thirds-rank-table tr.thirds-qualifies td { background: #fdf6e6; }
.thirds-rank-table tr.thirds-out      td  { background: #fafafa; color: var(--muted); }
.thirds-rank-table tr.thirds-cutoff   td  { border-bottom: 2px solid var(--gold); }

/* ── Leaderboard legend ─────────────────────────────────────────────────── */
.lb-legend {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: .5rem;
  padding: .35rem .5rem;
}
.lb-legend-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .75rem;
  color: var(--muted);
}
.lb-legend-item::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1rem;
  border-radius: 2px;
  flex-shrink: 0;
}
.lb-legend-prize::before { background: var(--gold); }
.lb-legend-spoon::before { background: #dc2626; }

/* ── Leaderboard search ─────────────────────────────────────────────────── */
.lb-search-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .85rem;
  margin-top: .5rem;
}
.lb-search {
  padding: .38rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: .875rem;
  width: 100%;
  max-width: 240px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.lb-search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180,151,90,.15); }
.lb-search-count { font-size: .82rem; color: var(--muted); }

/* ── Leaderboard prize zone ─────────────────────────────────────────────── */
.prize-badge {
  font-size: .65rem;
  margin-left: .2rem;
  vertical-align: middle;
  opacity: .7;
}
.lb-prize-divider td {
  padding: .3rem .5rem;
  text-align: center;
  border-top: 2px dashed var(--gold);
  border-bottom: 2px dashed var(--gold);
  background: #fffbf0;
}
.lb-prize-divider-label {
  font-size: .72rem;
  color: #a07a30;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Deleted entries tab ────────────────────────────────────────────────── */
.filter-tab-deleted:not(.active) {
  border-color: #fca5a5;
  color: #b91c1c;
}
.filter-tab-deleted:not(.active) .tab-count { background: #fee2e2; color: #b91c1c; }
.filter-tab-deleted.active { background: #dc2626; border-color: #dc2626; }

/* ── Restore / success button variant ──────────────────────────────────── */
.btn-outline-success {
  background: transparent;
  border: 1.5px solid #16a34a;
  color: #16a34a;
}
.btn-outline-success:hover { background: #f0fdf4; text-decoration: none; }

/* ── Mobile fixes ────────────────────────────────────────────────────────── */

/* Entry detail action buttons — 2-column grid on mobile */
.entry-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
}
@media (max-width: 560px) {
  .entry-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .entry-actions .btn-danger { grid-column: 1 / -1; }
}

/* KO radio labels — allow text wrap on narrow screens */
@media (max-width: 600px) {
  .ko-radio-label {
    white-space: normal;
    text-align: center;
    font-size: .78rem;
    line-height: 1.25;
    padding: .3rem .35rem;
  }
}

/* Scrollable wrapper for wide tables on mobile */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
