/* WRCCA World Ranking — admin panel. Same tokens as the public site, light and dark.
   Barlow Condensed for headings, big figures and normal buttons; Inter for everything else. Mobile first. */
:root {
  --bg: #f4f4f2; --surface: #ffffff; --surface-2: #f8f8f6; --chip: #efefec;
  --ink: #1a1a1a; --text: #34363a; --muted: #6c6f76; --faint: #9a9da3; --line: #e7e7e3; --line-2: #d8d8d3;
  --lime: #d0f93b; --lime-soft: #f0fbc4;
  --ok: #138a4a; --ok-soft: #e2f4e9; --warn: #8a5a00; --warn-soft: #fbf0d9; --bad: #c8412b; --bad-soft: #fbe7e3;
  --btn-bg: #1a1a1a; --btn-fg: #ffffff;
  --shadow-1: 0 1px 2px rgba(20, 20, 18, 0.05), 0 1px 1px rgba(20, 20, 18, 0.03);
  --shadow-2: 0 1px 2px rgba(20, 20, 18, 0.06), 0 12px 32px -12px rgba(20, 20, 18, 0.18);
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --side-w: 264px; --r: 4px;
  --gold: #e9d79b; --silver: #d9d9d9; --bronze: #e4c1a0;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1011; --surface: #17181a; --surface-2: #1d1e21; --chip: #232528;
  --ink: #f3f3f1; --text: #d3d4d7; --muted: #9a9da4; --faint: #6f727a; --line: #26282b; --line-2: #34373b;
  --lime-soft: rgba(208, 249, 59, 0.12);
  --ok: #4ade80; --ok-soft: rgba(74, 222, 128, 0.12); --warn: #f4c46a; --warn-soft: rgba(244, 196, 106, 0.12); --bad: #ff7a66; --bad-soft: rgba(255, 122, 102, 0.12);
  --btn-bg: #d0f93b; --btn-fg: #1a1a1a;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r); }
svg { display: block; }
::selection { background: var(--ink); color: var(--surface); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 300ms; }

/* shell */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(86vw, var(--side-w)); background: var(--surface); box-shadow: 1px 0 0 var(--line);
  display: flex; flex-direction: column; padding: 16px 12px 12px; overflow-y: auto; transform: translateX(-102%); transition: transform 360ms var(--ease-out); }
.nav-open .side { transform: none; box-shadow: var(--shadow-2); }
.scrim { position: fixed; inset: 0; z-index: 39; background: rgba(10, 10, 10, 0.4); opacity: 0; pointer-events: none; transition: opacity 280ms ease; }
.nav-open .scrim { opacity: 1; pointer-events: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 18px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand .wl { width: 46px; height: auto; aspect-ratio: 815 / 452; flex: none; }
.brand span { display: grid; min-width: 0; padding-left: 12px; border-left: 1px solid var(--line); }
.brand b { font: 600 12.5px/1.25 var(--sans); }
.brand small { font: 500 12px/1.3 var(--sans); color: var(--muted); }
.side-label { margin: 14px 10px 6px; font: 600 11px/1 var(--sans); letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 100px; color: var(--text); text-decoration: none; font-weight: 500;
  position: relative; transition: background-color 160ms ease, color 160ms ease; }
.side-nav a svg, .theme-row svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
.side-nav a span:first-of-type { flex: 1; }
.side-nav a.on { background: var(--chip); color: var(--ink); font-weight: 600; }
.side-nav a.on svg { color: var(--ink); }
.side-nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 var(--r) var(--r) 0; background: var(--ink); }
.count { font: 600 11px/1 var(--sans); min-width: 24px; text-align: center; padding: 4px 7px; border-radius: 100px; background: var(--ink); color: var(--surface); font-variant-numeric: tabular-nums; }
.count.zero { background: var(--chip); color: var(--muted); }
.count.live { background: var(--lime); color: #1a1a1a; }
.side-foot { margin-top: auto; padding-top: 16px; display: grid; gap: 8px; }
.theme-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r); background: none; cursor: pointer;
  font: 500 14px/1 var(--sans); color: var(--text); text-align: left; border-top: 1px solid var(--line); border-radius: 0; padding-top: 16px; }
.theme-row span:first-of-type { flex: 1; }
.switch { width: 36px; height: 21px; border-radius: 100px; background: var(--line-2); position: relative; transition: background-color 220ms ease; }
.switch span { position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 260ms var(--ease-out); }
[data-theme="dark"] .switch { background: var(--lime); }
[data-theme="dark"] .switch span { transform: translateX(15px); background: #1a1a1a; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.me-t { flex: 1; display: grid; min-width: 0; }
.me-t b { font: 600 13px/1.25 var(--sans); color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.me-t small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me form { margin: 0; }
.icon-btn { width: 38px; height: 38px; flex: none; border-radius: 100px; border: 0; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center;
  transition: background-color 160ms ease, transform 140ms var(--ease-out); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--chip); } .side-nav a:not(.on):hover { background: var(--surface-2); color: var(--ink); } .theme-row:hover { color: var(--ink); } }
.theme-m .moon { display: none; }
[data-theme="dark"] .theme-m .moon { display: block; }
[data-theme="dark"] .theme-m .sun { display: none; }

.main-col { min-width: 0; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; height: 60px; padding: 0 10px;
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
  box-shadow: 0 1px 0 var(--line); }
.brand-m { color: var(--ink); }
.brand-m .wl { width: 40px; height: auto; aspect-ratio: 815 / 452; }
.top-search { display: none; position: relative; align-items: center; flex: 1; max-width: 460px; margin: 0; }
.top-search svg { position: absolute; left: 12px; width: 15px; height: 15px; fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-linecap: round; }
.top-search input[type=search] { width: 100%; padding-left: 36px; background: var(--surface); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-actions .btn span { display: none; }
.top-actions .btn { padding: 0 11px; }
.top-actions .btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
main { padding: 20px 14px 64px; max-width: 1360px; }
@media (min-width: 640px) {
  .top-search { display: flex; }
  .brand-m { display: none; }
  .top-actions .btn span { display: inline; }
  .top-actions .btn { padding: 0 16px; }
  main { padding: 26px 20px 72px; }
}
@media (min-width: 1100px) {
  .side { transform: none; width: var(--side-w); padding: 22px 14px 14px; }
  .scrim, .close-nav, .menu, .theme-m { display: none; }
  .main-col { margin-left: var(--side-w); }
  .top { height: 68px; padding: 0 32px; }
  main { padding: 30px 32px 80px; }
}

/* type */
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
h1 { font: 700 34px/0.95 var(--display); text-transform: uppercase; margin: 0; color: var(--ink); }
h2 { font: 700 22px/1.05 var(--display); text-transform: uppercase; letter-spacing: 0; margin: 0 0 12px; color: var(--ink); }
h3 { font: 600 14px/1.3 var(--sans); margin: 0 0 6px; color: var(--ink); }
.lede { color: var(--muted); margin: 8px 0 0; max-width: 74ch; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
code { font-size: 12px; background: var(--chip); padding: 1px 5px; border-radius: var(--r); }
b, strong { color: var(--ink); }
@media (min-width: 768px) { h1 { font-size: 44px; } .head { margin-bottom: 24px; } }

/* surfaces */
.panel { background: var(--surface); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-1), 0 0 0 1px var(--line); min-width: 0; }
@media (min-width: 768px) { .panel { padding: 20px 22px; } }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: minmax(0, 1fr); }
.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid { gap: 16px; } }
@media (min-width: 1200px) { .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { display: grid; gap: 10px; align-content: start; text-decoration: none; color: inherit; transition: box-shadow 200ms ease, transform 200ms var(--ease-out); }
.stat .st-top { display: flex; justify-content: space-between; align-items: start; gap: 8px; font: 500 13px/1.3 var(--sans); color: var(--muted); }
.stat .st-top svg { width: 14px; height: 14px; fill: none; stroke: var(--faint); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.stat .st-num { display: flex; align-items: center; gap: 12px; }
.stat .st-ic { width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center; background: var(--chip); color: var(--ink); flex: none; }
.stat .st-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.stat .st-ic.hot { background: var(--lime); color: #1a1a1a; }
.stat b { font: 700 40px/0.9 var(--display); font-variant-numeric: tabular-nums; color: var(--ink); }
.stat small { font-size: 12.5px; color: var(--muted); }
@media (hover: hover) and (pointer: fine) { a.stat:hover { box-shadow: var(--shadow-2), 0 0 0 1px var(--line-2); transform: translateY(-1px); } }
@media (min-width: 768px) { .stat b { font-size: 48px; } }

/* messages */
.msgs { display: grid; gap: 8px; margin-bottom: 18px; }
.msg { padding: 11px 16px; border-radius: var(--r); background: var(--ok-soft); color: var(--ok); font-weight: 500; animation: msg-in 280ms var(--ease-out); }
.msg.error { background: var(--bad-soft); color: var(--bad); }
.msg.info { background: var(--lime-soft); color: var(--ink); }
@keyframes msg-in { from { opacity: 0; transform: translateY(-4px); } }

/* tabs: underline with counts */
.tabs { display: flex; gap: 22px; margin: 0 -14px 16px; padding: 0 14px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; padding: 10px 0 12px; color: var(--muted); font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap;
  display: inline-flex; gap: 7px; align-items: baseline; transition: color 180ms ease; }
.tabs a .n { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tabs a.on { color: var(--ink); font-weight: 600; }
.tabs a.on .n { color: var(--ink); }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }
@media (hover: hover) and (pointer: fine) { .tabs a:not(.on):hover { color: var(--ink); } }
@media (min-width: 640px) { .tabs { margin: 0 0 18px; padding: 0; gap: 28px; } }

/* forms */
form.filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: end; margin-bottom: 16px; }
form.filters > label.f:first-of-type { grid-column: 1 / -1; }
form.filters .btn { justify-self: start; }
@media (min-width: 768px) { form.filters { display: flex; flex-wrap: wrap; } form.filters > label.f:first-of-type { min-width: 260px; } }
label.f { display: grid; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=search], input[type=number], input[type=url], input[type=password], input:not([type]), select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 12px; height: 40px; min-width: 0; width: 100%;
  transition: border-color 160ms ease, box-shadow 160ms ease; }
@media (min-width: 768px) { input[type=text], input[type=search], input[type=number], input[type=url], select { width: auto; } .top-search input, .form input, .form textarea { width: 100%; } }
textarea { height: auto; padding: 10px 12px; min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
input[type=checkbox] { accent-color: var(--ink); width: 16px; height: 16px; }
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: 600 13px/1 var(--sans); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 100px; padding: 9px 14px; margin-right: 10px; cursor: pointer; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 100px;
  font: 700 15px/1 var(--display); text-transform: uppercase; letter-spacing: 0; text-decoration: none;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: transform 140ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
.btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .btn:hover { border-color: var(--ink); } }
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn.good { background: var(--lime); color: #1a1a1a; border-color: var(--lime); }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
@media (hover: hover) and (pointer: fine) { .btn.primary:hover { opacity: 0.88; } .btn.good:hover { background: #c3ef24; } .btn.bad:hover { border-color: var(--bad); } }
.btn.small { height: 34px; padding: 0 13px; font: 600 12.5px/1 var(--sans); text-transform: none; letter-spacing: 0; }
.top-actions .btn.small { height: 38px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }

/* tables */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font: 600 11px/1.2 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 11px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
@media (hover: hover) and (pointer: fine) { table tr:hover td { background: var(--surface-2); } }
td.n, th.n { text-align: right; }
td.date { white-space: nowrap; }
.panel.flush { padding: 4px 6px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 8px 8px; }
.panel-head h2 { margin: 0; font-size: 20px; }
@media (max-width: 767px) {
  .hide-m { display: none; }
  /* tables marked .stack become one card per row on phones */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack tr:has(th) { display: none; }
  table.stack tr { position: relative; padding: 14px 12px 14px 48px; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { padding: 3px 0; border: 0; }
  table.stack td.chk { position: absolute; left: 14px; top: 16px; padding: 0; }
  table.stack.plain tr { padding-left: 12px; }
  table.stack tr:hover td { background: none; }
}

/* people */
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .pn { display: grid; min-width: 0; }
.person .pn a, .person .pn b { font-weight: 600; color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .pn small { font-size: 12px; color: var(--muted); }
.av { --s: 34px; flex: none; width: var(--s); height: var(--s); border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--chip);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 8%, transparent); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.ph { font: 600 12px/1 var(--sans); color: var(--muted); }
.av.sm { --s: 32px; }
.av.lg { --s: 56px; }
.av.lg.ph { font-size: 17px; }
.av.xl { --s: 112px; }
.av.xl.ph { font-size: 32px; }

/* labels */
.chip { display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px/1 var(--sans); padding: 5px 9px; border-radius: 100px; background: var(--chip); color: var(--muted);
  white-space: nowrap; border: 1px solid transparent; }
.chip.yes, .chip.no, .chip.flag, .chip.dot { background: transparent; padding-left: 0; padding-right: 0; }
.chip.yes::before, .chip.no::before, .chip.flag::before, .chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.chip.yes { color: var(--ok); }
.chip.no { color: var(--bad); }
.chip.flag { color: var(--warn); }
.chip.dot { color: var(--muted); }
.chip.W2000, .chip.C1000 { background: var(--ink); color: var(--surface); }
.chip.N500, .chip.N250, .chip.N100 { background: transparent; border-color: var(--ink); color: var(--ink); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pager a { font-weight: 600; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font: 700 24px/1.1 var(--display); text-transform: uppercase; margin-bottom: 6px; }
pre.log { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 12px; overflow-x: auto; white-space: pre-wrap; margin: 10px 0 0; max-height: 280px; color: var(--text); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; } }

/* flags (flag-icons, MIT) */
.natc { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.flag { width: 18px; height: 13px; flex: none; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }

/* buttons, tabs and pills that are not upper case are capitalised */
.btn.small, .tabs a, .chip, .count.live, .linkbtn, input[type=file]::file-selector-button { text-transform: capitalize; }
.aliases .chip { text-transform: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
