/* ============================================================
   RACK HUB — Design Language v3 "Broadsheet x Pool Hall"
   Shared by every panel. Page <style> blocks should only add
   page-specific rules — never redefine :root tokens.
   ------------------------------------------------------------
   Brass  = you / your next action (one filled button per view)
   Baize  = something is happening at the table right now
   Ivory  = selected / structure
   Caps   = status badges only
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* ── v3 tokens ── */
  --ink0: #0B0B0A;      /* page */
  --ink1: #131311;      /* raised: cards, sheets, sidebar */
  --ink2: #1B1B18;      /* controls */
  --ink3: #26251F;      /* hover / selected */
  --rule: #26251F;      /* hairline */
  --rule2: #3A3930;     /* strong rule */
  --t1: #F3EFE6;        /* ivory text   16.9:1 */
  --t2: #B2AC9F;        /* secondary     9.0:1 */
  --t3: #8A857A;        /* tertiary      5.3:1 */
  --brass: #D4A64A;
  --brass-hi: #EBC572;
  --brass-t: rgba(212,166,74,.12);
  --brass-l: rgba(212,166,74,.5);
  --baize: #0E372A;
  --baize2: #12472F;
  --baize-l: #246048;
  --baize-tx: #A3D2BA;
  --live: #FF5147;
  --win: #4CC487;
  --win-t: rgba(76,196,135,.13);
  --loss: #EF5E58;
  --loss-t: rgba(239,94,88,.13);
  --info: #86B0F2;
  --info-t: rgba(134,176,242,.13);
  --warn: #E9A43E;
  --warn-t: rgba(233,164,62,.13);
  --race: #72D7EA;       /* tournament race-to */
  --race-t: rgba(76,201,224,.13);
  --ease: cubic-bezier(.2,.8,.2,1);
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-num: 'Oswald', 'Arial Narrow', sans-serif;

  /* ── legacy aliases (older pages still reference these names) ── */
  --bg: var(--ink0);
  --bg-elevated: var(--ink1);
  --surface: var(--ink1);
  --surface2: var(--ink2);
  --surface-hover: var(--ink2);
  --card: var(--ink1);
  --card-alt: var(--ink0);
  --border: var(--rule);
  --border-subtle: var(--rule);
  --border-strong: var(--rule2);
  --border-gold: var(--brass-l);
  --gold-border: var(--brass-l);
  --text: var(--t1);
  --white: var(--t1);
  --text-secondary: var(--t2);
  --text2: var(--t2);
  --text-muted: var(--t3);
  --text3: var(--t3);
  --gold: var(--brass);
  --gold-light: var(--brass-hi);
  --gold-bright: var(--brass-hi);
  --gold-dim: var(--brass-t);
  --gold-glow: rgba(212,166,74,.18);
  --cyan: var(--brass);
  --cyan-dim: var(--brass-t);
  --green: var(--win);
  --green-dim: var(--win-t);
  --red: var(--loss);
  --red-dim: var(--loss-t);
  --orange: var(--warn);
  --orange-dim: var(--warn-t);
  --purple: #B79BFF;
  --purple-dim: rgba(167,123,255,.14);
  --blue: var(--info);
  --blue-dim: var(--info-t);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --glass-bg: var(--ink1);
  --glass-border: var(--rule);
  --glass-blur: none;
}

/* ═══════════ BASE ═══════════ */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  background: var(--ink0);
  color: var(--t1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-hi); }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: rgba(212,166,74,.3); color: var(--t1); }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4a4940; }

/* ═══════════ TYPE ═══════════ */
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
.page-title, .login-card h1, .modal h3 { font-family: var(--font-num); font-weight: 500; letter-spacing: .005em; }
.page-title { font-size: 26px; line-height: 1.15; margin: 0 0 4px; color: var(--t1); }
.page-sub { font-size: 13.5px; color: var(--t3); margin: 0 0 24px; }
.card-title, .section-title { font-family: var(--font-ui); font-size: 15px; font-weight: 600; color: var(--t1); letter-spacing: -.01em; margin: 0 0 12px; }
.num, .tabnum { font-variant-numeric: tabular-nums; }
.muted, .text-muted { color: var(--t3) !important; }

/* ═══════════ BUTTONS ═══════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 10px; border: 0;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; letter-spacing: -.005em;
  text-transform: none; white-space: nowrap; cursor: pointer; text-decoration: none;
  background: var(--ink2); color: var(--t1); box-shadow: inset 0 0 0 1px var(--rule2);
  transition: background .15s, box-shadow .15s, transform .12s var(--ease), color .15s;
}
.btn:hover { background: var(--ink3); color: var(--t1); }
.btn:active { transform: scale(.98); }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary, .btn-gold { background: var(--brass); color: #17130A; box-shadow: none; }
.btn-primary:hover, .btn-gold:hover { background: var(--brass-hi); color: #17130A; }
.btn-ghost, .btn-outline { background: transparent; color: var(--t1); box-shadow: inset 0 0 0 1px var(--rule2); }
.btn-ghost:hover, .btn-outline:hover { background: var(--ink2); color: var(--t1); }
.btn-green { background: var(--win-t); color: var(--win); box-shadow: inset 0 0 0 1px rgba(76,196,135,.35); }
.btn-green:hover { background: rgba(76,196,135,.22); color: var(--win); }
.btn-red, .btn-danger { background: transparent; color: var(--loss); box-shadow: inset 0 0 0 1px rgba(239,94,88,.45); }
.btn-red:hover, .btn-danger:hover { background: var(--loss-t); color: var(--loss); }
.btn-sm { min-height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }

/* ═══════════ FORMS ═══════════ */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  background: var(--ink2); color: var(--t1);
  border: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--rule2);
  font-size: 15px; outline: none; text-transform: none;
  transition: box-shadow .15s;
}
textarea { min-height: 96px; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--t3); }
input:focus, select:focus, textarea:focus { box-shadow: inset 0 0 0 1.5px var(--brass); }
select {
  -webkit-appearance: none; appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%238A857A' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brass); vertical-align: middle; }
.field { margin-bottom: 14px; }
.field label, .login-card label, .modal .field label {
  display: block; margin-bottom: 6px;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--t2);
  text-transform: none; letter-spacing: 0;
}
.form-error { color: var(--loss); font-size: 13px; margin-bottom: 10px; }

/* ═══════════ SURFACES ═══════════ */
.card {
  background: var(--ink1); border: 1px solid var(--rule); border-radius: 14px;
  padding: 20px; margin-bottom: 16px; overflow-x: auto;
}
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-header .card-title { margin: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.glass { background: var(--ink1); border: 1px solid var(--rule); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; margin-bottom: 24px; border-top: 1px solid var(--rule2); border-bottom: 1px solid var(--rule); }
.stat-card { background: transparent; border: 0; border-left: 1px solid var(--rule); border-radius: 0; padding: 14px 18px; text-align: left; }
.stat-grid > .stat-card:first-child { border-left: 0; padding-left: 0; }
.stat-card .label { font-family: var(--font-ui); font-size: 12.5px; font-weight: 500; color: var(--t3); text-transform: none; letter-spacing: 0; margin-bottom: 4px; }
.stat-card .value { font-family: var(--font-num); font-size: 30px; font-weight: 500; line-height: 1.1; color: var(--t1); font-variant-numeric: tabular-nums; }
.stat-card .value.gold, .stat-card .value.cyan { color: var(--brass); }
.stat-card .value.green { color: var(--win); }
.stat-card .value.purple { color: var(--purple); }

/* ═══════════ BADGES — the only uppercase in the product ═══════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 4px;
  font-family: var(--font-num); font-size: 11px; font-weight: 500; line-height: 1;
  letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
  background: var(--ink3); color: var(--t2); border: 0;
}
.badge-live, .badge-in_progress { background: var(--loss-t); color: #FF8F86; }
.badge-live::before, .badge-in_progress::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live); animation: rh-pulse 1.6s infinite; }
.badge-active { background: var(--win-t); color: var(--win); }
.badge-scheduled, .badge-upcoming, .badge-registration { background: var(--info-t); color: var(--info); }
.badge-completed, .badge-ended, .badge-archived { background: var(--ink3); color: var(--t2); }
.badge-postponed, .badge-setup, .badge-pending { background: var(--warn-t); color: var(--warn); }
.badge-offline { background: transparent; color: var(--t3); box-shadow: inset 0 0 0 1px var(--rule2); }
.badge-admin, .badge-you { background: var(--brass-t); color: var(--brass); }
.badge-cancelled { background: transparent; color: var(--t3); box-shadow: inset 0 0 0 1px var(--rule2); }
@keyframes rh-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,81,71,.55); } 70% { box-shadow: 0 0 0 6px rgba(255,81,71,0); } 100% { box-shadow: 0 0 0 0 rgba(255,81,71,0); } }

/* ═══════════ TABLES ═══════════ */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule2);
  font-family: var(--font-ui); font-size: 12px; font-weight: 500; color: var(--t3);
  text-transform: none; letter-spacing: 0; white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--rule); font-size: 14px; color: var(--t2); vertical-align: middle; }
td strong, td b { color: var(--t1); }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: var(--ink2); }

/* ═══════════ ADMIN SHELL (admin, league-admin, handicap-admin) ═══════════ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  display: flex; flex-direction: column; background: #0E0E0C; border-right: 1px solid var(--rule);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; border-bottom: 1px solid var(--rule); color: var(--t1); }
.sidebar-brand img { height: 40px; width: auto; }
.sidebar-brand h2 { font-family: var(--font-num); font-size: 16px; font-weight: 500; letter-spacing: .12em; color: var(--t1); text-transform: uppercase; margin: 0; }
.sidebar-brand h2 span { color: var(--brass); }
.sidebar-brand small { display: block; margin-top: 2px; font-family: var(--font-ui); font-size: 12px; color: var(--t3); letter-spacing: 0; text-transform: none; }
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px; border-radius: 9px;
  color: var(--t2); font-size: 14px; font-weight: 500; cursor: pointer; border: 0;
  transition: background .15s, color .15s; text-decoration: none;
}
.nav-item:hover { background: var(--ink2); color: var(--t1); }
.nav-item.active { background: var(--ink2); color: var(--t1); font-weight: 600; box-shadow: inset 2px 0 0 var(--brass); }
.nav-item .icon { width: 22px; display: inline-flex; justify-content: center; font-size: 16px; filter: grayscale(1) brightness(1.2); opacity: .8; }
.nav-item.active .icon { filter: none; opacity: 1; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid var(--rule); }
.sidebar-foot .user-name { font-size: 13px; color: var(--t2); }
.sidebar-foot .league-name { font-size: 12px; color: var(--brass); margin-bottom: 2px; }
.sidebar-foot .logout-btn { margin-top: 6px; padding: 0; font-size: 13px; font-weight: 500; color: var(--loss); text-transform: none; letter-spacing: 0; }
.sidebar-foot .home-link { display: block; margin: 0 0 10px; font-size: 13px; color: var(--t2); }
.sidebar-foot .home-link:hover { color: var(--t1); }
.main { flex: 1; min-width: 0; margin-left: 240px; padding: 32px 40px 48px; min-height: 100vh; }
.main > * { max-width: 1240px; }

.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 101; height: 56px;
  align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 0 12px;
  background: rgba(11,11,10,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.mobile-header a, .mobile-header h2 { color: var(--t1); }
.hamburger { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; color: var(--t1); border-radius: 10px; }
.hamburger:hover { background: var(--ink2); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 99; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); width: 272px; z-index: 110; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
  .sidebar-overlay { z-index: 105; }
  .sidebar.open { transform: translateX(0); box-shadow: 24px 0 48px rgba(0,0,0,.5); }
  .sidebar-overlay.open { display: block; }
  .mobile-header { display: flex; }
  .main { margin-left: 0; padding: 72px 16px 32px; }
  .page-title { font-size: 22px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat-grid > .stat-card:nth-child(2n+1) { border-left: 0; padding-left: 0; }
  .stat-card { border-top: 1px solid var(--rule); }
  .card { padding: 16px; }
}

/* ═══════════ TOP BAR (tournaments, matchspotter, killer, streams) ═══════════ */
.rh-topbar, .header, .app-bar, .top-bar, .stream-header {
  position: sticky; top: 0; z-index: 50; min-height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px;
  background: rgba(11,11,10,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.rh-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--t1); font-family: var(--font-num); font-size: 16px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.rh-brand img { height: 34px; width: auto; }
.rh-brand span { color: var(--brass); }
.rh-back { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 10px; border-radius: 9px; color: var(--t2); font-size: 14px; font-weight: 500; }
.rh-back:hover { background: var(--ink2); color: var(--t1); }

/* ═══════════ TABS ═══════════ */
.tab-bar { display: flex; gap: 22px; margin-bottom: 20px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab, .tab-btn {
  position: relative; flex: none; min-height: 44px; padding: 0; display: inline-flex; align-items: center;
  font-family: var(--font-ui); font-size: 14px; font-weight: 500; color: var(--t3);
  text-transform: none; letter-spacing: 0; border: 0; background: none; cursor: pointer; white-space: nowrap;
}
.tab:hover, .tab-btn:hover { color: var(--t1); }
.tab.active, .tab-btn.active { color: var(--t1); font-weight: 600; }
.tab.active::after, .tab-btn.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--t1); }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 0; background: transparent; box-shadow: inset 0 0 0 1px var(--rule2); color: var(--t2); font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.chip:hover { color: var(--t1); }
.chip.active, .chip.on { background: var(--t1); color: var(--ink0); box-shadow: none; }

/* ═══════════ MODALS ═══════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(0,0,0,.62);
}
.modal, .modal-content {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: var(--ink1); border: 1px solid var(--rule2); border-radius: 18px; padding: 24px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55); animation: rh-rise .28s var(--ease);
}
.modal h3 { font-size: 22px; color: var(--t1); margin: 0 0 18px; text-transform: none; letter-spacing: .005em; }
.modal .field { margin-bottom: 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
@keyframes rh-rise { from { transform: translateY(16px); opacity: .3; } to { transform: none; opacity: 1; } }
@media (max-width: 600px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal, .modal-content { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); }
  .modal .actions { flex-direction: column-reverse; }
  .modal .actions .btn { width: 100%; }
}

/* ═══════════ TOASTS ═══════════ */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2000;
  display: flex; align-items: center; gap: 10px; max-width: min(440px, calc(100vw - 32px)); min-height: 48px; padding: 12px 16px;
  border-radius: 12px; background: var(--t1); color: var(--ink0); font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: rh-toast .25s var(--ease);
}
.toast-success { background: var(--t1); color: var(--ink0); border: 0; }
.toast-success::before { content: "✓"; color: #2F7A52; font-weight: 700; }
.toast-error { background: #3A1614; color: #FFB4AE; border: 1px solid rgba(239,94,88,.4); }
@keyframes rh-toast { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ═══════════ EMPTY / LOADING ═══════════ */
.empty-state, .empty { padding: 44px 20px; text-align: center; color: var(--t3); font-size: 14px; }
.empty-state .icon, .empty .icon { font-size: 30px; margin-bottom: 10px; opacity: .5; filter: grayscale(1); }
.empty-state p { margin: 0; }
.skeleton, .sk { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--ink2) 0, var(--ink3) 50%, var(--ink2) 100%); background-size: 200% 100%; animation: rh-shim 1.4s infinite linear; }
@keyframes rh-shim { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ═══════════ LOGIN ═══════════ */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  width: 100%; max-width: 400px; padding: 32px 28px;
  background: var(--ink1); border: 1px solid var(--rule); border-radius: 18px;
}
.login-card h1 { font-size: 28px; color: var(--t1); margin: 0 0 4px; text-transform: none; }
.login-card .sub { font-family: var(--font-ui); font-size: 14px; color: var(--t3); letter-spacing: 0; margin: 0 0 24px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; }
.login-logo { display: block; height: 88px; width: auto; margin: 0 auto 18px; }
.login-err { display: none; padding: 11px 14px; margin-bottom: 16px; border-radius: 10px; background: var(--loss-t); color: #FFA49E; font-size: 13.5px; }
.login-home { display: block; margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--t2); }
.login-home:hover { color: var(--t1); }

/* ═══════════ HANDICAP / BRACKET CHIPS ═══════════ */
.hc { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 20px; padding: 0 5px; border-radius: 4px; font-family: var(--font-num); font-size: 11.5px; font-weight: 500; letter-spacing: .03em; white-space: nowrap; }
.hc-h { background: rgba(239,94,88,.14); color: #FF968F; }
.hc-r { background: var(--race-t); color: var(--race); }
.hc-w { background: var(--brass-t); color: var(--brass); }

/* ═══════════ UTILITIES ═══════════ */
.gold, .brass { color: var(--brass) !important; }
.green { color: var(--win) !important; }
.red { color: var(--loss) !important; }
.animate-in { animation: slideIn .3s var(--ease); }
.hide-mobile { }
@media (max-width: 600px) { .hide-mobile { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* phones: let wide admin tables scroll inside their card instead of crushing columns */
@media (max-width: 768px) { .card td, .card th { white-space: nowrap; } }

/* ═══════════ ALERTS ═══════════ */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.alert-ok { background: var(--win-t); color: #8FDDB4; }
.alert-warn { background: var(--warn-t); color: #F3C57F; }
.alert-err { background: var(--loss-t); color: #FFA49E; }
.alert-info { background: var(--info-t); color: #B5CEF7; }

/* ═══════════ SCORING WIRE (shared with the public app) ═══════════ */
.wire { position: relative; display: flex; align-items: center; gap: 4px; height: 22px; }
.wire::before { content: ""; position: absolute; left: -8px; right: -8px; top: 50%; height: 1px; background: var(--rule2); }
.baize .wire::before { background: var(--baize-l); }
.wire .sp { flex: 1; }
.bead { position: relative; width: 16px; height: 16px; border-radius: 50%; flex: none; }
.bead.h { background: radial-gradient(circle at 35% 30%, #F4D894, #CC9A34 58%, #8A6516); }
.bead.a { background: radial-gradient(circle at 35% 30%, #FFFDF7, #D6CEBB 58%, #958C79); }
.bead.o { background: var(--ink0); box-shadow: inset 0 0 0 1.5px var(--rule2); }
.baize { background: var(--baize); color: var(--t1); }

/* ── Area switcher (one Rack Hub sign-in) ─────────────────────────────── */
.rh-areas:empty { display: none; }
.rh-areas-h { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--t3); padding: 0 12px 6px; }
.rh-area { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; color: var(--t2); font: 500 14px var(--font-ui); text-decoration: none; cursor: pointer; }
.rh-area:hover { color: var(--t1); background: var(--ink2); }
.rh-area.on { color: var(--t1); box-shadow: inset 2px 0 0 var(--brass, #D4A64A); }
.rh-area small { display: block; font-size: 12px; color: var(--t3); font-weight: 400; margin-top: 1px; }
.rh-out { color: var(--t3); border-top: 1px solid var(--rule); border-radius: 0; margin-top: 4px; padding-top: 11px; }
.sidebar .rh-areas { margin: 12px 8px 0; padding-top: 12px; border-top: 1px solid var(--rule); }
.rh-areas-wrap { position: relative; }
.rh-areas-pop { display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 300; min-width: 220px; padding: 10px 6px 6px; background: var(--ink1); border: 1px solid var(--rule2); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.rh-areas-wrap.open .rh-areas-pop { display: block; }
.rh-areas-wrap.open .rh-areas-pop:empty { display: none; }

/* ── Phone width fitting (pager.js; swipe pages are switched off) ─────────────────────────────── */
@media (max-width: 767.98px) {
  html[data-rh-noscroll], html[data-rh-noscroll] body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  [data-rh-paged] { overflow: hidden !important; column-fill: auto; box-sizing: border-box; overscroll-behavior: contain; }
  [data-rh-paged][data-rh-multi] { padding-bottom: 48px !important; }
  [data-rh-paged] * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  [data-rh-paged] :is(h1, h2, h3, h4, .page-title, .sec-head, .eyebrow, thead, .head, .sh, .fr-set, .pagehead, .lu-cols, .card-title) { break-after: avoid; }
  [data-rh-paged] :is(tr, li, .fixture-card, .opt, .tile, .frame-row, .mf-row, .stat-card, .stat, .alert, .field, .btn, .chip, .badge, .rh-row, .row, .lp-row, .lu-row, img, svg) { break-inside: avoid; }
  [data-rh-paged] .card { overflow: visible; }
  [data-rh-paged] :is(.sticky, [class*="sticky"]) { position: static !important; }

  /* Wide admin tables become label / value cards so they fit the width */
  [data-rh-stack][data-rh-paged] :is(div, section, article) { overflow: visible !important; max-height: none !important; }
  [data-rh-stack] table[data-rh-fits] td, [data-rh-stack] table[data-rh-fits] th { white-space: normal !important; padding: 9px 5px !important; font-size: 13px; }
  [data-rh-stack] table[data-rh-fits] th { font-size: 11px; line-height: 1.25; }
  [data-rh-stack] table[data-rh-fits] :is(td, th):first-child { padding-left: 0 !important; }
  [data-rh-stack] table[data-rh-fits] :is(td, th):last-child { padding-right: 0 !important; }
  [data-rh-stack] table[data-rh-fits] .btn-sm { padding: 0 9px; min-height: 32px; }
  [data-rh-stack] table[data-rh-stacked], [data-rh-stack] table[data-rh-stacked] tbody { display: block; width: 100%; }
  [data-rh-stack] table[data-rh-stacked] thead { display: none; }
  [data-rh-stack] table[data-rh-stacked] tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 12px; align-items: end; padding: 10px 0; border-bottom: 1px solid var(--rule); break-inside: avoid; background: none !important; }
  [data-rh-stack] table[data-rh-stacked] td { display: block; padding: 0 !important; border: 0 !important; white-space: normal !important; text-align: left !important; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
  [data-rh-stack] table[data-rh-stacked] td .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  [data-rh-stack] table[data-rh-stacked] td::before { content: attr(data-label); display: block; color: var(--t3); font-size: 11.5px; font-weight: 500; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  [data-rh-stack] table[data-rh-stacked] td[data-label=""]::before { display: none; }
  [data-rh-stack] table[data-rh-stacked] td:first-child { grid-column: 1 / -1; grid-row: 1; font-size: 15px; font-weight: 600; color: var(--t1); padding-right: 96px !important; align-self: center; }
  [data-rh-stack] table[data-rh-stacked] td:first-child::before { display: none; }
  [data-rh-stack] table[data-rh-stacked] td[data-label=""]:last-child:not(:first-child) { grid-column: 1 / -1; grid-row: 1; justify-self: end; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 60%; }
  [data-rh-stack] table[data-rh-stacked] td:empty { display: none; }
  [data-rh-stack] .card:has(> table[data-rh-stacked]) { padding-top: 4px; padding-bottom: 4px; }
}
@media (max-width: 359.98px) {
  [data-rh-stack] table[data-rh-fits] td, [data-rh-stack] table[data-rh-fits] th { padding: 8px 3px !important; font-size: 12.5px; }
  [data-rh-stack] table[data-rh-fits] th { font-size: 10.5px; }
  [data-rh-stack] table[data-rh-fits] .btn-sm { padding: 0 7px; font-size: 12.5px; }
  [data-rh-stack] .card { padding-left: 12px; padding-right: 12px; }
}
.rh-pgbar { position: fixed; left: 50%; transform: translateX(-50%); z-index: 90; height: 40px; display: flex; align-items: center; gap: 2px; padding: 0 4px; border-radius: 999px; background: rgba(27,27,24,.94); border: 1px solid var(--rule2); box-shadow: 0 6px 20px rgba(0,0,0,.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.rh-pgbar[hidden] { display: none; }
.rh-pgbar button { width: 44px; height: 38px; border: 0; background: none; color: var(--t1); font-size: 22px; line-height: 1; border-radius: 999px; cursor: pointer; }
.rh-pgbar button:disabled { color: var(--t3); opacity: .45; cursor: default; }
.rh-pgbar .n { min-width: 52px; text-align: center; font: 500 14px var(--font-num); color: var(--t2); letter-spacing: .04em; }
@media (min-width: 768px) { .rh-pgbar { display: none !important; } }
