/* CRL 2027 — admin & referee portal (admin/index.html). Builds on site.css tokens. */
:root {
  --series-1: #3987e5; /* chart categorical slot 1 (dark step) */
  --series-2: #d95926; /* chart categorical slot 2 (dark step) */
  --text-muted: #94a3b8;
}

.adm-card { border: 1px solid var(--line); border-radius: 1rem; background: rgba(11, 17, 32, 0.9); padding: 1.1rem; min-width: 0; }
@media (min-width: 640px) { .adm-card { padding: 1.4rem; } }
.adm-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1rem; margin-bottom: 1.1rem; }
.adm-title { font-family: "Space Grotesk", sans-serif; font-size: 1.6rem; font-weight: 700; color: #fff; line-height: 1.2; }
.adm-sub { font-family: "Space Grotesk", sans-serif; font-weight: 600; color: #fff; margin: 1.4rem 0 0.6rem; }
.chart-title { font-family: "Space Grotesk", sans-serif; font-weight: 600; color: #fff; font-size: 1rem; margin-bottom: 0.9rem; }
.chart-sub { font-family: Inter, sans-serif; font-weight: 400; font-size: 0.8rem; color: var(--text-muted); margin-left: 0.35rem; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.82rem; }
.btn-danger, .btn-primary.btn-danger { background: #dc2626; box-shadow: none; }
.btn-ghost.danger, .mini-btn.danger { color: #fca5a5; }
.btn-primary:disabled, .btn-ghost:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.link-btn { color: #7dd3fc; font-size: 0.8rem; text-decoration: underline; text-underline-offset: 2px; }
.icon-btn { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 0.6rem; color: #cbd5e1; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); }
.mini-btn { padding: 0.3rem 0.6rem; border-radius: 0.5rem; font-size: 0.78rem; font-weight: 600; color: #e2e8f0; border: 1px solid rgba(255, 255, 255, 0.12); }
.mini-btn:hover { background: rgba(255, 255, 255, 0.07); }
.mini-btn:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible, .sort-btn:focus-visible, .result-item:focus-visible, .adm-tabs [role="tab"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Header: tabs + connection pill */
.adm-tabs { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; margin: 0 -0.25rem; }
.adm-tabs::-webkit-scrollbar { display: none; }
.adm-tabs [role="tab"] { white-space: nowrap; padding: 0.65rem 0.85rem; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; }
.adm-tabs [role="tab"]:hover { color: #fff; }
.adm-tabs [role="tab"][aria-selected="true"] { color: #fff; border-bottom-color: var(--orange); }
.net-pill { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.65rem; border-radius: 9999px; border: 1px solid; white-space: nowrap; }
.net-pill::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 9999px; background: currentColor; }
.net-pill.on { color: #6ee7b7; border-color: rgba(110, 231, 183, 0.3); }
.net-pill.wait { color: #fcd34d; border-color: rgba(252, 211, 77, 0.35); }
.net-pill.off { color: #fca5a5; border-color: rgba(252, 165, 165, 0.4); }
.offline-banner { background: rgba(220, 38, 38, 0.14); border-bottom: 1px solid rgba(252, 165, 165, 0.3); color: #fecaca; text-align: center; font-size: 0.875rem; font-weight: 500; padding: 0.55rem 1rem; }
.offline-banner.warn { background: rgba(251, 182, 22, 0.12); border-color: rgba(251, 182, 22, 0.3); color: #fde68a; }

/* Filters + tables */
.filter-bar { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(11, 17, 32, 0.7); margin-bottom: 1rem; }
.filter-bar .field label { font-size: 0.72rem; }
.filter-bar .field input, .filter-bar .field select { padding: 0.5rem 0.65rem; font-size: 0.875rem; }
.filter-bar .btn-ghost { padding: 0.5rem 0.75rem; }
@media (min-width: 640px) { .filter-bar .grow-2 { grid-column: span 2; } }
.sel-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; font-size: 0.85rem; color: #bae6fd; background: rgba(41, 169, 224, 0.1); border: 1px solid rgba(41, 169, 224, 0.25); border-radius: 0.75rem; padding: 0.5rem 0.85rem; margin-bottom: 0.75rem; }
.sel-bar.hidden { display: none; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 0.9rem; background: rgba(7, 11, 20, 0.5); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.adm-table th { position: sticky; top: 0; z-index: 1; background: #0d1528; text-align: left; font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #94a3b8; padding: 0.65rem 0.75rem; white-space: nowrap; }
.adm-table td { padding: 0.65rem 0.75rem; border-top: 1px solid var(--line); vertical-align: top; color: #cbd5e1; }
.adm-table.compact td, .adm-table.compact th { padding: 0.45rem 0.65rem; }
.adm-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.adm-table tr.top td { background: rgba(247, 148, 29, 0.05); }
.adm-table input[type="checkbox"] { accent-color: var(--orange); width: 1rem; height: 1rem; }
.adm-table .empty { text-align: center; color: #64748b; padding: 2rem 1rem; }
.sort-btn { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.sort-btn:hover { color: #fff; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; }

.badge { display: inline-flex; align-items: center; padding: 0.1rem 0.5rem; border-radius: 9999px; font-size: 0.72rem; font-weight: 600; border: 1px solid; white-space: nowrap; }
.badge-pending { color: #fcd34d; border-color: rgba(252, 211, 77, 0.35); background: rgba(252, 211, 77, 0.08); }
.badge-verified { color: #6ee7b7; border-color: rgba(110, 231, 183, 0.35); background: rgba(110, 231, 183, 0.08); }
.badge-rejected { color: #fca5a5; border-color: rgba(252, 165, 165, 0.35); background: rgba(252, 165, 165, 0.08); }
.badge-admin { color: #fdba74; border-color: rgba(253, 186, 116, 0.35); }
.badge-ref { color: #7dd3fc; border-color: rgba(125, 211, 252, 0.35); }

/* Modal + confirm + toasts */
.adm-modal { padding: 0; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 1.1rem; background: #0b1120; color: #cbd5e1; width: min(40rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 2rem); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8); }
.adm-modal.wide { width: min(64rem, calc(100vw - 1.5rem)); }
.adm-modal::backdrop { background: rgba(2, 6, 15, 0.72); backdrop-filter: blur(3px); }
.adm-modal[open] { display: flex; flex-direction: column; }
.adm-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line); }
.adm-modal-body { padding: 1.1rem; overflow-y: auto; }
@media (min-width: 640px) { .adm-modal-body { padding: 1.4rem; } }
.adm-confirm { width: min(26rem, calc(100vw - 1.5rem)); }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.6rem; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.kv { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.kv dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; }
.kv dd { color: #f1f5f9; font-size: 0.9rem; margin-top: 0.1rem; }
.receipt-thumb img { max-height: 16rem; max-width: 100%; border-radius: 0.75rem; border: 1px solid var(--line); background: #fff; }
.toasts { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; left: 1rem; display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; pointer-events: none; }
.toast { max-width: 26rem; pointer-events: auto; padding: 0.7rem 1rem; border-radius: 0.75rem; font-size: 0.875rem; font-weight: 500; color: #fff; background: #14532d; border: 1px solid rgba(110, 231, 183, 0.35); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.7); animation: toastIn 0.25s ease; transition: opacity 0.4s, transform 0.4s; }
.toast-error { background: #7f1d1d; border-color: rgba(252, 165, 165, 0.4); }
.toast-warn { background: #713f12; border-color: rgba(252, 211, 77, 0.4); }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* Analytics */
.kpis { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.kpi { border: 1px solid var(--line); border-radius: 1rem; background: rgba(11, 17, 32, 0.9); padding: 1rem 1.1rem; }
.kpi-label { font-size: 0.78rem; color: var(--text-muted); }
.kpi-value { font-family: "Space Grotesk", sans-serif; font-size: 2rem; font-weight: 700; color: #fff; line-height: 1.15; margin-top: 0.2rem; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 0.75rem; color: #64748b; }
.hbars { display: grid; gap: 0.15rem; }
.hbar { position: relative; display: grid; grid-template-columns: minmax(7rem, 38%) 1fr 2.6rem; align-items: center; gap: 0.75rem; padding: 0.3rem 0.35rem; border-radius: 0.5rem; font-size: 0.82rem; outline: none; }
.hbar:hover, .hbar:focus-visible { background: rgba(255, 255, 255, 0.04); }
.hbar-label { color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 0.7rem; }
.hbar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 1rem; font-size: 0.8rem; color: #cbd5e1; margin-bottom: 0.6rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.sw { width: 0.7rem; height: 0.7rem; border-radius: 3px; display: inline-block; }
.sw-1 { background: var(--series-1); }
.sw-2 { background: var(--series-2); }
.stack { display: flex; gap: 2px; height: 1.1rem; }
.stack-seg { position: relative; height: 100%; outline: none; min-width: 2px; }
.stack-seg:first-child { border-radius: 4px 0 0 4px; }
.stack-seg:last-child { border-radius: 0 4px 4px 0; }
.seg-1 { background: var(--series-1); }
.seg-2 { background: var(--series-2); }
.stack-seg:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; z-index: 20; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  white-space: nowrap; background: #f1f5f9; color: #0b1120; font-size: 0.75rem; font-weight: 600; padding: 0.3rem 0.55rem; border-radius: 0.4rem; pointer-events: none;
}

/* Live scoring */
.result-list { display: grid; gap: 0.35rem; max-height: 22rem; overflow-y: auto; }
.result-item { width: 100%; text-align: left; padding: 0.55rem 0.7rem; border-radius: 0.7rem; border: 1px solid var(--line); background: rgba(7, 11, 20, 0.55); }
.result-item:hover, .result-item.active { border-color: rgba(247, 148, 29, 0.5); background: rgba(247, 148, 29, 0.07); }
.scanner { position: relative; }
.scanner video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 0.9rem; background: #000; }
.scanner-frame { position: absolute; inset: 15% 15% auto; aspect-ratio: 1; border: 3px solid var(--orange); border-radius: 1rem; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35); pointer-events: none; }
.scanner-msg { margin-top: 0.5rem; text-align: center; font-size: 0.8rem; color: #cbd5e1; }
.empty-state { text-align: center; padding: 3rem 1.5rem; }
.team-card { border-color: rgba(247, 148, 29, 0.3); background: radial-gradient(ellipse at top right, rgba(247, 148, 29, 0.12), transparent 60%), rgba(11, 17, 32, 0.9); }
.sheet-grid { display: grid; gap: 0.85rem; }
@media (min-width: 900px) { .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sheet-item { border: 1px solid var(--line); border-radius: 0.85rem; padding: 0.75rem 0.85rem; background: rgba(7, 11, 20, 0.5); min-width: 0; }
.sheet-item > label, .sheet-item > legend { display: block; font-size: 0.85rem; font-weight: 600; color: #f1f5f9; margin-bottom: 0.55rem; padding: 0; }
fieldset.sheet-item > legend { float: left; width: 100%; }
fieldset.sheet-item > legend + * { clear: both; }
.pick { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pick label { cursor: pointer; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.6rem; padding: 0.45rem 0.8rem; border-radius: 0.6rem; border: 1px solid rgba(255, 255, 255, 0.12); font-size: 0.85rem; color: #cbd5e1; background: rgba(11, 17, 32, 0.8); }
.pick span b { color: #fff; font-weight: 700; }
.pick input:checked + span { border-color: var(--orange); background: rgba(247, 148, 29, 0.16); color: #fff; }
.pick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 0.65rem; overflow: hidden; }
.stepper button { width: 2.8rem; font-size: 1.2rem; color: #fff; background: rgba(255, 255, 255, 0.05); }
.stepper button:hover { background: rgba(255, 255, 255, 0.12); }
.stepper input { width: 4rem; text-align: center; background: transparent; color: #fff; font-weight: 700; font-size: 1.05rem; border: 0; padding: 0.55rem 0; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.num-input, .sheet-item input[type="text"] { width: 8rem; border-radius: 0.6rem; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(11, 17, 32, 0.8); color: #fff; font-weight: 600; padding: 0.55rem 0.7rem; font-size: 1rem; }
.sheet-item input[type="text"] { width: 100%; font-weight: 400; }
.num-input:focus, .stepper input:focus, .sheet-item input[type="text"]:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.total-bar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.1rem -0.25rem -0.25rem; padding: 0.9rem 1rem; border-radius: 0.9rem; border: 1px solid rgba(247, 148, 29, 0.35); background: #111a2e; box-shadow: 0 -10px 30px -12px rgba(0, 0, 0, 0.7); }
.attention { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; padding: 0.9rem 1rem; border-radius: 0.9rem; border: 1px solid rgba(251, 182, 22, 0.4); background: rgba(251, 182, 22, 0.08); }

/* Leaderboard */
.podium { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.podium-card { display: flex; align-items: center; gap: 0.85rem; padding: 0.9rem 1rem; border-radius: 1rem; border: 1px solid var(--line); background: rgba(11, 17, 32, 0.9); min-width: 0; }
.podium-rank { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; flex-shrink: 0; border-radius: 9999px; font: 700 1.1rem "Space Grotesk", sans-serif; color: #0b1120; }
.p1 .podium-rank { background: #fbbf24; }
.p2 .podium-rank { background: #cbd5e1; }
.p3 .podium-rank { background: #d97706; }
.p1 { border-color: rgba(251, 191, 36, 0.45); }

/* Master data */
.switch-row { display: flex; gap: 0.85rem; align-items: flex-start; cursor: pointer; }
.switch-row input { appearance: none; flex-shrink: 0; width: 2.9rem; height: 1.6rem; margin-top: 0.15rem; border-radius: 9999px; background: #334155; position: relative; cursor: pointer; transition: background 0.2s; }
.switch-row input::after { content: ""; position: absolute; top: 0.2rem; left: 0.2rem; width: 1.2rem; height: 1.2rem; border-radius: 9999px; background: #fff; transition: transform 0.2s; }
.switch-row input:checked { background: #16a34a; }
.switch-row input:checked::after { transform: translateX(1.3rem); }
.switch-row input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.qr-empty { width: 180px; height: 180px; display: grid; place-items: center; border: 1px dashed rgba(255, 255, 255, 0.2); border-radius: 0.9rem; color: #64748b; font-size: 0.85rem; }
#ms-qr img { width: 180px; height: 180px; object-fit: contain; background: #fff; border-radius: 0.9rem; padding: 0.4rem; }

/* Check-in desk */
.ci-card { border-radius: 1rem; padding: 1.1rem 1.2rem; border: 2px solid; color: #fff; }
.ci-ok { background: #064e3b; border-color: #34d399; }
.ci-warn { background: #7c2d12; border-color: #fb923c; }
.ci-bad { background: #7f1d1d; border-color: #f87171; }
.ci-info { background: #1e293b; border-color: #64748b; }
.ci-head { font-family: "Space Grotesk", sans-serif; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.ci-team { font-size: 1.1rem; font-weight: 600; margin-top: 0.35rem; }
.ci-card .btn-ghost { border-color: rgba(255, 255, 255, 0.4); color: #fff; }
.member-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.7rem; border-radius: 9999px; background: rgba(0, 0, 0, 0.25); font-size: 0.85rem; cursor: pointer; }
.member-chip input { accent-color: #34d399; width: 1rem; height: 1rem; }
.result-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.7rem 0.85rem; border-radius: 0.8rem; border: 1px solid var(--line); background: rgba(7, 11, 20, 0.55); }

/* Attendance */
.att-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.att-card { display: grid; gap: 0.55rem; text-align: left; padding: 0.9rem 1rem; border-radius: 1rem; border: 1px solid var(--line); background: rgba(11, 17, 32, 0.9); }
.att-card:hover { border-color: rgba(255, 255, 255, 0.18); }
.att-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.att-bar { display: block; height: 0.6rem; border-radius: 9999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.att-bar > span { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.opp-select { width: 100%; border-radius: 0.6rem; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(11, 17, 32, 0.8); color: #fff; padding: 0.6rem 0.7rem; font-size: 0.95rem; }
.opp-select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.opp-select:disabled { opacity: 0.6; }

/* Leaderboard → Public live page control */
.live-admin { display: grid; gap: 0.5rem; }
.live-admin-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; padding: 0.55rem 0.75rem; border: 1px solid var(--line); border-radius: 0.75rem; background: rgba(7, 11, 20, 0.5); }
.live-seg button[aria-pressed="true"].lv-hidden { background: #475569; color: #fff; }
.live-seg button[aria-pressed="true"].lv-live { background: #dc2626; color: #fff; }
.live-seg button[aria-pressed="true"].lv-final { background: #16a34a; color: #fff; }
.live-seg button:disabled { cursor: not-allowed; opacity: 0.7; }
