/* ================================================================
   USA DIVING — JUNIOR RESULTS AUDIT v3.0
   Full design overhaul. No shortcuts.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700;800&family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ──────────────────────────────────────────────────── */
:root {
  /* Brand */
  --blue-950:   #060920;
  --blue-900:   #0d1040;
  --blue-800:   #111650;
  --blue-700:   #171f69;   /* USA Diving Blue */
  --navy:       #171f69;   /* alias: --navy = USA Diving Blue */
  --blue-600:   #1e2d8a;
  --blue-500:   #2640b0;
  --red:        #e31937;   /* USA Diving Red  */
  --red-soft:   rgba(227,25,55,.1);
  --pool:       #009ac7;   /* PMS 313  */
  --pool-soft:  rgba(0,154,199,.1);
  --sky:        #8fc3ea;   /* PMS 543  */
  --sky-soft:   rgba(143,195,234,.12);

  /* Navigation (dark) */
  --nav:        #0a0e38;
  --nav-2:      rgba(255,255,255,.04);
  --nav-border: rgba(255,255,255,.08);
  --nav-ink:    #d4dcf5;
  --nav-muted:  rgba(212,220,245,.45);
  --nav-hover:  rgba(255,255,255,.055);
  --nav-active: rgba(143,195,234,.16);
  --nav-active-ink: #a8d4f0;

  /* Content */
  --bg:         #eaecf5;
  --surface:    #ffffff;
  --surface-2:  #f6f7fb;
  --surface-3:  #f0f2f8;
  --line:       #dde0ed;
  --line-2:     #eceef6;

  /* Ink */
  --ink:        #0c1120;
  --ink-2:      #263248;
  --ink-3:      #566170;
  --ink-4:      #8d9aaa;

  /* Qualification status */
  --q-direct:   #047857; --q-direct-bg: #ecfdf5;   --q-direct-b: #a7f3d0;
  --q-ewc:      #0369a1; --q-ewc-bg:   #eff6ff;    --q-ewc-b:   #bae0f9;
  --q-avg:      #7c3aed; --q-avg-bg:   #f5f3ff;    --q-avg-b:   #ddd6fe;
  --q-repl:     #c2410c; --q-repl-bg:  #fff7ed;    --q-repl-b:  #fed7aa;
  --q-nondis:   #b91c1c; --q-nondis-bg:rgba(227,25,55,.07);
  --q-out:      #64748b; --q-out-bg:   #f1f5f9;
  --q-decline:  #94a3b8; --q-decline-bg:#f8fafc;

  /* Row tints */
  --row-foreign: rgba(227,25,55,.028);
  --row-dual:    rgba(0,154,199,.033);
  --row-decline: rgba(148,163,184,.07);

  /* Type */
  --f-display: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  --f-ui:      'Inter', system-ui, sans-serif;
  --f-mono:    'JetBrains Mono', 'Consolas', monospace;

  /* Layout */
  --bar-h:     52px;
  --side-w:    224px;
  --radius-xs: 3px;
  --radius-sm: 5px;
  --radius:    7px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Shadow */
  --sh-xs: 0 1px 2px rgba(13,16,48,.06);
  --sh-sm: 0 1px 3px rgba(13,16,48,.09), 0 1px 2px rgba(13,16,48,.06);
  --sh:    0 2px 8px rgba(13,16,48,.09), 0 1px 3px rgba(13,16,48,.06);
  --sh-md: 0 4px 16px rgba(13,16,48,.10), 0 2px 6px rgba(13,16,48,.07);
  --sh-lg: 0 12px 40px rgba(13,16,48,.14), 0 4px 12px rgba(13,16,48,.08);
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--f-ui); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ── Topbar ───────────────────────────────────────────────────── */
.app-topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 300;
  height: var(--bar-h);
  background: var(--nav);
  border-bottom: 1px solid var(--nav-border);
  display: flex; align-items: center;
  /* Subtle gradient for depth */
  background-image: linear-gradient(180deg, rgba(255,255,255,.025) 0%, transparent 100%);
}

/* Brand / home link */
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--bar-h); padding: 0 16px;
  min-width: var(--side-w);
  border-right: 1px solid var(--nav-border);
  text-decoration: none; flex-shrink: 0;
  transition: background .15s;
  position: relative;
}
.topbar-brand:hover { background: var(--nav-hover); }
/* "Back" affordance on hover */
.topbar-brand::before {
  content: '←';
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--nav-muted); opacity: 0;
  transition: opacity .15s;
}
.topbar-brand:hover::before { opacity: .7; }
/* Official logo in topbar */
.topbar-logo {
  height: 32px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.topbar-app-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--nav-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
  padding-left: 12px;
  border-left: 1px solid var(--nav-border);
  margin-left: 2px;
}


.brand-mark {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  border: 1.5px solid rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
/* Legacy inner spans from original HTML */
.brand-mark span { display: block; background: var(--red); border-radius: 1px; }
.brand-mark span:first-child { width: 13px; height: 2.5px; margin-bottom: 2px; }
.brand-mark span:last-child  { width: 9px;  height: 2.5px; }
/* SVG version if used */
.brand-mark svg { width: 18px; height: 18px; }

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-org {
  font-family: var(--f-display); font-weight: 800;
  font-size: 13.5px; letter-spacing: .05em; text-transform: uppercase; color: #fff;
}
.brand-title, .brand-subtitle {
  font-size: 10px; font-weight: 500;
  color: var(--nav-muted); letter-spacing: .03em;
}

/* Stage nav */
.stage-nav {
  display: flex; align-items: center; gap: 2px;
  height: var(--bar-h); padding: 0 12px; flex: 1;
}
.stage-btn {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px; border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 500; color: var(--nav-muted);
  background: none; border: none; transition: all .15s; white-space: nowrap;
}
.stage-btn:hover { background: var(--nav-hover); color: var(--nav-ink); }
.stage-btn.active { background: var(--nav-active); color: var(--nav-active-ink); font-weight: 600; }
.stage-btn.has-data .stage-dot { opacity: 1; }
.stage-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .35; flex-shrink: 0; transition: opacity .15s;
}
.stage-btn.active .stage-dot { opacity: 1; }

/* Topbar action buttons */
.topbar-actions {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px; margin-left: auto;
}
.topbar-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 11px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; color: var(--nav-muted);
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  transition: all .15s;
}
.topbar-btn:hover { background: rgba(255,255,255,.10); color: var(--nav-ink); border-color: rgba(255,255,255,.16); }
.topbar-btn.topbar-btn-active {
  background: rgba(143,195,234,.18); color: var(--sky);
  border-color: rgba(143,195,234,.3);
}
.override-badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 16px; min-width: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
}
#exportBtn { background: var(--red); color: #fff; border-color: transparent; font-weight: 600; }
#exportBtn:hover { background: #c91530; }
#exportBtn svg { width: 12px; height: 12px; }

/* ── Layout ───────────────────────────────────────────────────── */
.app-body {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  padding-top: var(--bar-h);
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.control-sidebar {
  background: var(--nav);
  border-right: 1px solid var(--nav-border);
  display: flex; flex-direction: column;
  position: sticky; top: var(--bar-h);
  height: calc(100vh - var(--bar-h));
  overflow-y: auto; overflow-x: hidden;
}
.control-sidebar::-webkit-scrollbar { width: 3px; }
.control-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }

.sidebar-section { padding: 14px 12px; border-bottom: 1px solid var(--nav-border); }
.sidebar-section:last-child { border-bottom: none; flex: 1; }

.sidebar-section-title {
  font-size: 9px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--nav-muted);
  margin-bottom: 10px; padding: 0 3px;
  display: flex; align-items: center; gap: 6px;
}
.sidebar-section-title::after {
  content: ''; flex: 1; height: 1px; background: rgba(255,255,255,.07);
}

/* Filter fields */
.filter-field { margin-bottom: 8px; }
.filter-field:last-child { margin-bottom: 0; }

.filter-label {
  display: block; font-size: 9.5px; font-weight: 700;
  color: rgba(212,220,245,.4); letter-spacing: .07em;
  text-transform: uppercase; margin-bottom: 4px; padding: 0 3px;
}

.filter-field select {
  width: 100%; height: 30px; padding: 0 26px 0 9px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius-sm);
  color: var(--nav-ink); font-size: 12px; font-family: var(--f-ui);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='5' viewBox='0 0 9 5'%3E%3Cpath d='M0.5 0.5l4 4 4-4' stroke='%238fc3ea' stroke-opacity='.7' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color .15s, background-color .15s;
}
.filter-field select:focus {
  outline: none; border-color: rgba(143,195,234,.5);
  background-color: rgba(255,255,255,.10);
}
.filter-field select option { background: #111650; color: #d4dcf5; }

/* Search input in sidebar */
.filter-search-input,
.filter-field input[type="search"] {
  width: 100%; height: 30px; padding: 0 9px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius-sm);
  color: var(--nav-ink); font-size: 12px; font-family: var(--f-ui);
  transition: border-color .15s, background-color .15s;
}
.filter-search-input:focus,
.filter-field input[type="search"]:focus {
  outline: none; border-color: rgba(143,195,234,.5);
  background-color: rgba(255,255,255,.10);
}
.filter-search-input::placeholder,
.filter-field input::placeholder { color: var(--nav-muted); }

/* Flag chips */
.filter-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.synchro-toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 12px; color: var(--nav-ink); user-select: none;
}
.synchro-toggle input[type="checkbox"] {
  width: 14px; height: 14px; margin: 0; accent-color: var(--pool, #009ac7);
  cursor: pointer;
}
.flag-mode-select {
  width: 100%; height: 25px; padding: 0 8px; margin-bottom: 8px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-xs); color: var(--nav-muted);
  font-size: 10.5px; appearance: none; font-family: var(--f-ui);
}
.flag-chip {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 10.5px; font-weight: 500;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  color: var(--nav-muted); transition: all .12s; user-select: none;
}
.flag-chip input { display: none; }
.flag-chip:hover { background: rgba(255,255,255,.10); color: var(--nav-ink); }
.flag-chip.checked {
  background: rgba(227,25,55,.15); border-color: rgba(227,25,55,.3); color: #ff8fa0;
}

/* ── Main workspace ───────────────────────────────────────────── */
.main-workspace { display: flex; flex-direction: column; background: var(--bg); }

/* ── KPI row ──────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; padding: 14px 16px 0; flex-shrink: 0;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px 10px;
  box-shadow: var(--sh-xs);
  position: relative;
  transition: box-shadow .15s, transform .12s, border-top-color .15s;
}
.kpi-card.kpi-clickable { cursor: pointer; }
.kpi-card.kpi-clickable:hover { box-shadow: var(--sh-sm); transform: translateY(-1px); }
.kpi-card.kpi-active { box-shadow: 0 0 0 2px var(--pool), var(--sh-sm); }

.kpi-card.accent-green { border-top-color: var(--q-direct); }
.kpi-card.accent-blue  { border-top-color: var(--pool); }
.kpi-card.accent-red   { border-top-color: var(--red); }
.kpi-card.accent-amber { border-top-color: var(--q-repl); }
.kpi-card.accent-slate { border-top-color: #64748b; }
.kpi-card.accent-purple{ border-top-color: #7c3aed; }
.kpi-card.accent-navy  { border-top-color: var(--blue-700); }

.kpi-value {
  font-family: var(--f-display); font-weight: 800;
  font-size: 27px; line-height: 1; letter-spacing: -.01em; color: var(--ink);
}
.kpi-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 5px;
}
.kpi-sub { font-size: 10.5px; color: var(--ink-4); margin-top: 2px; line-height: 1.3; }
.kpi-active-dot {
  position: absolute; bottom: 8px; right: 8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--pool);
  box-shadow: 0 0 8px rgba(0,154,199,.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ── Workspace grid ───────────────────────────────────────────── */
.workspace {
  display: grid;
  grid-template-columns: 265px 1fr;
  gap: 12px; padding: 12px 16px 20px;
  flex: 1; align-items: start;
}

/* ── Event Panel ──────────────────────────────────────────────── */
.event-panel {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  max-height: calc(100vh - 192px);
  position: sticky; top: calc(var(--bar-h) + 12px);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-600));
  flex-shrink: 0;
}
.panel-head-title {
  font-family: var(--f-display); font-size: 11px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.7);
}
.btn-link {
  font-size: 11px; font-weight: 600; color: var(--sky);
  background: none; border: none;
  padding: 2px 7px; border-radius: var(--radius-xs);
  transition: all .12s;
}
.btn-link:hover { background: rgba(255,255,255,.12); color: #fff; }

.event-search-wrap { padding: 7px 8px; border-bottom: 1px solid var(--line-2); flex-shrink: 0; }
.event-search {
  width: 100%; height: 28px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 12px; color: var(--ink);
  font-family: var(--f-ui); transition: border-color .15s;
}
.event-search:focus { outline: none; border-color: var(--pool); background: var(--surface); }

.event-list {
  overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 1px;
}
.event-list::-webkit-scrollbar { width: 3px; }
.event-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.event-item {
  display: block; width: 100%; padding: 8px 10px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; text-align: left; transition: all .1s;
}
.event-item:hover { background: var(--surface-2); border-color: var(--line); }
.event-item.active {
  background: linear-gradient(135deg, var(--blue-700), var(--blue-600));
  border-color: var(--blue-600);
  box-shadow: var(--sh-xs);
}
.event-item-name {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.3;
}
.event-item.active .event-item-name { color: #fff; }
.event-item-meta { display: block; font-size: 10.5px; color: var(--ink-4); margin-top: 1px; }
.event-item.active .event-item-meta { color: rgba(255,255,255,.5); }
.event-item-badges { display: flex; gap: 3px; margin-top: 5px; flex-wrap: wrap; }

/* ── Results Panel ────────────────────────────────────────────── */
.results-panel {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  max-height: calc(100vh - 192px);
  min-height: 400px;
}
/* Review queue sits above table-wrap and scrolls with it */
#rv-queue-wrap {
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 40vh;
  border-bottom: 1px solid var(--line);
}

/* Context bar — navy, bold, informative */
.results-context {
  display: flex; align-items: stretch; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue-700) 0%, var(--blue-600) 100%);
  border-bottom: 1px solid rgba(0,0,0,.15);
  min-height: 52px; flex-wrap: wrap;
}
.context-title-block {
  display: flex; flex-direction: column; justify-content: center;
  gap: 2px; padding: 10px 16px; flex: 1; min-width: 0;
  border-right: 1px solid rgba(255,255,255,.1);
}
.context-title-block strong {
  font-family: var(--f-display); font-size: 15px; font-weight: 800;
  letter-spacing: .02em; text-transform: uppercase; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1;
}
.context-title-block span { font-size: 10.5px; color: rgba(255,255,255,.5); line-height: 1; }
.context-stat {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 14px; border-right: 1px solid rgba(255,255,255,.1); flex-shrink: 0;
  min-width: 64px;
}
.context-stat:last-child { border-right: none; }
.context-stat-value {
  font-family: var(--f-display); font-size: 18px; font-weight: 800;
  line-height: 1; color: #fff; letter-spacing: -.01em;
}
.context-stat-label {
  font-size: 9px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: rgba(255,255,255,.45); margin-top: 3px;
}

/* Tab bar */
.results-toolbar {
  display: flex; align-items: stretch; flex-shrink: 0;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  min-height: 38px;
}
.view-tabs { display: flex; align-items: center; flex: 1; padding: 0 4px; }
.tab-btn {
  display: flex; align-items: center; gap: 5px;
  height: 38px; padding: 0 12px;
  font-size: 12px; font-weight: 500; color: var(--ink-4);
  background: none; border: none; border-bottom: 2px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.tab-btn:hover { color: var(--ink-2); }
.tab-btn.active {
  color: var(--blue-700); border-bottom-color: var(--blue-700); font-weight: 600;
}
.toolbar-actions {
  display: flex; align-items: center; gap: 5px;
  padding: 0 10px; border-left: 1px solid var(--line);
}
.row-count {
  font-size: 11px; color: var(--ink-4); white-space: nowrap;
  font-family: var(--f-mono); padding: 0 4px;
}
.btn-ghost, .btn-sm {
  height: 25px; padding: 0 9px; border-radius: var(--radius-xs);
  font-size: 11px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink-3); transition: all .12s; white-space: nowrap;
}
.btn-ghost:hover, .btn-sm:hover { background: var(--surface-3); border-color: #cdd0df; }
.btn-ghost.btn-danger { color: var(--red); border-color: rgba(227,25,55,.2); }
.btn-ghost.btn-danger:hover { background: var(--red); color: #fff; border-color: transparent; }

/* ── Table ────────────────────────────────────────────────────── */
.table-wrap { overflow: auto; flex: 1; }
.table-wrap::-webkit-scrollbar { height: 5px; width: 5px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.table-wrap table {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
}
.table-wrap thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--blue-700);
  color: rgba(255,255,255,.65);
  font-family: var(--f-display); font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 8px 10px; text-align: left; white-space: nowrap;
  border-right: 1px solid var(--blue-600);
  border-bottom: 2px solid rgba(0,0,0,.2);
}
.table-wrap thead th:first-child { padding-left: 16px; }
.table-wrap thead th:last-child { border-right: none; }
.table-wrap thead th:hover { color: rgba(255,255,255,.9); }

.table-wrap tbody tr {
  border-bottom: 1px solid var(--line-2);
  transition: background .08s;
}
.table-wrap tbody tr:last-child { border-bottom: none; }
.table-wrap tbody tr:hover { background: var(--surface-2) !important; }
.table-wrap tbody td { padding: 8px 10px; vertical-align: middle; color: var(--ink-2); }
.table-wrap tbody td:first-child { padding-left: 16px; }
.table-wrap td.mono { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }

/* Row highlight tints */
.row-foreign { background: var(--row-foreign) !important; }
.row-dual    { background: var(--row-dual) !important; }
.row-decline { background: var(--row-decline) !important; opacity: .7; }

/* Specific cell classes */
.td-team  { white-space: nowrap; color: var(--ink-3); font-size: 12px; }
.td-score { font-weight: 700; font-family: var(--f-mono); font-size: 13px; color: var(--ink); }
.td-status { white-space: nowrap; min-width: 0; }

/* Athlete cell */
.athlete-main {
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.athlete-name { font-weight: 600; color: var(--ink); font-size: 13px; line-height: 1.2; }
.athlete-id   { font-family: var(--f-mono); font-size: 10px; color: var(--ink-4); }
.athlete-event { font-size: 10.5px; color: var(--ink-4); margin-top: 1px; }

/* Rank/eligible cell */
.mono[data-elig] { font-size: 11px; }

/* ── Status badges ────────────────────────────────────────────── */
.status {
  display: inline-flex; align-items: center;
  height: 20px; padding: 0 8px; border-radius: 10px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; letter-spacing: .01em;
}
.status.status-qualifier    { background: var(--q-direct-bg); color: var(--q-direct); border-color: var(--q-direct-b); }
.status.status-ewc          { background: var(--q-ewc-bg);    color: var(--q-ewc);    border-color: var(--q-ewc-b); }
.status.status-average      { background: var(--q-avg-bg);    color: var(--q-avg);    border-color: var(--q-avg-b); }
.status.status-replacement  { background: var(--q-repl-bg);   color: var(--q-repl);   border-color: var(--q-repl-b); }
.status.status-out          { background: var(--q-out-bg);    color: var(--q-out); }
.status.status-non-qual     { background: var(--q-out-bg);    color: var(--q-out); }
.status.status-non-displacing { background: var(--q-nondis-bg); color: var(--q-nondis); }
.status.status-decline      { background: var(--q-decline-bg); color: var(--q-decline); text-decoration: line-through; }

/* ── Flag pills ───────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center;
  height: 17px; padding: 0 6px; border-radius: 8px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .03em; white-space: nowrap;
  border: 1px solid transparent;
}
.pill-foreign  { background: rgba(227,25,55,.09);  color: #c0102a; border-color: rgba(227,25,55,.2); }
.pill-dual     { background: rgba(0,154,199,.1);   color: #0077a0; border-color: rgba(0,154,199,.2); }
.pill-hps      { background: rgba(23,31,105,.08);  color: var(--blue-700); border-color: rgba(23,31,105,.15); }
.pill-webpoint { background: rgba(217,119,6,.1);   color: #b45309; border-color: rgba(217,119,6,.2); }
.pill-ymca     { background: rgba(5,150,105,.09);  color: #047857; border-color: rgba(5,150,105,.2); }
.pill-preq     { background: rgba(5,150,105,.09);  color: #047857; border-color: rgba(5,150,105,.2); }
.pill-nondis   { background: rgba(227,25,55,.08);  color: #c0102a; border-color: rgba(227,25,55,.18); }
.pill-bump     { background: rgba(5,150,105,.1);   color: #047857; border-color: rgba(5,150,105,.2); }
.pill-decline  { background: rgba(148,163,184,.1); color: #64748b; }
.pill-review   { background: rgba(245,158,11,.1);  color: #b45309; border-color: rgba(245,158,11,.2); }
.pill-petition { background: rgba(88,28,135,.1);   color: #5b1fa8; border-color: rgba(88,28,135,.2); }
.pill-open-spot{ background: rgba(239,68,68,.1);   color: #dc2626; border-color: rgba(239,68,68,.2); }

/* Mini badges */
.mini-badge {
  display: inline-flex; align-items: center;
  height: 16px; padding: 0 6px; border-radius: 4px;
  font-size: 9.5px; font-weight: 700; border: 1px solid transparent;
}
.mini-badge.green { background: var(--q-direct-bg); color: var(--q-direct); border-color: var(--q-direct-b); }
.mini-badge.blue  { background: var(--q-ewc-bg);    color: var(--q-ewc);    border-color: var(--q-ewc-b); }
.mini-badge.amber { background: var(--q-repl-bg);   color: var(--q-repl);   border-color: var(--q-repl-b); }
.mini-badge.gray, .mini-badge.slate { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
.mini-badge.red   { background: rgba(227,25,55,.08); color: var(--red); border-color: rgba(227,25,55,.2); }

/* Inline bump note */
.table-wrap td div[style*="font-size:10.5px"] { display: none; } /* hide ugly inline style version */

/* ── Empty state ──────────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 64px 20px; text-align: center; gap: 8px;
}
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--ink-3); }
.empty-state-sub   { font-size: 13px; color: var(--ink-4); }

/* ── Override drawer ──────────────────────────────────────────── */
.override-drawer {
  position: fixed; top: var(--bar-h); right: 0; bottom: 0; z-index: 290;
  width: 340px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--sh-lg);
  display: flex; flex-direction: column;
  overflow-y: auto;
  /* Slide-in animation */
  animation: drawer-in .2s ease;
}
@keyframes drawer-in {
  from { transform: translateX(20px); opacity: .8; }
  to   { transform: translateX(0);    opacity: 1; }
}
.override-drawer[hidden] { display: none; }

.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 14px 16px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue-700), var(--blue-600));
}
.drawer-header h2 {
  font-family: var(--f-display); font-size: 15px; font-weight: 800;
  color: #fff; letter-spacing: .04em; text-transform: uppercase; line-height: 1;
}
.drawer-header p { font-size: 10.5px; color: rgba(255,255,255,.5); margin-top: 4px; }
.drawer-header-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-ghost.btn-sm {
  height: 24px; padding: 0 8px; border-radius: var(--radius-xs);
  font-size: 10.5px; font-weight: 500;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8); transition: all .12s;
}
.btn-ghost.btn-sm:hover { background: rgba(255,255,255,.18); color: #fff; }
.btn-ghost.btn-sm.btn-danger { border-color: rgba(227,25,55,.3); }
.btn-ghost.btn-sm.btn-danger:hover { background: var(--red); border-color: transparent; color: #fff; }

.drawer-form {
  padding: 14px 16px; display: flex; flex-direction: column;
  gap: 10px; border-bottom: 1px solid var(--line);
}
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field-wide { grid-column: 1 / -1; }
.form-field > span, .form-field > label > span {
  font-size: 9.5px; font-weight: 700; color: var(--ink-4);
  text-transform: uppercase; letter-spacing: .07em;
}
.form-field input, .form-field select {
  height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; color: var(--ink); font-family: var(--f-ui);
  transition: border-color .15s;
}
.form-field input:focus, .form-field select:focus {
  outline: none; border-color: var(--pool); background: var(--surface);
}
.btn-primary {
  height: 34px; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--blue-700); color: #fff;
  font-size: 13px; font-weight: 600; border: none;
  align-self: flex-start; transition: background .15s;
  box-shadow: 0 2px 8px rgba(23,31,105,.3);
}
.btn-primary:hover { background: var(--blue-600); }

.drawer-summary { padding: 12px 16px; display: flex; gap: 6px; flex-wrap: wrap; }
.drawer-summary-pill {
  display: inline-flex; align-items: center;
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}
.drawer-log { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.log-item { 
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.log-item.inactive { opacity: .5; }
.log-item-label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.log-item-sub   { font-size: 11px; color: var(--ink-4); margin-top: 1px; }
.log-item-actions { display: flex; gap: 4px; flex-shrink: 0; margin-top: 1px; }

/* ── Row action buttons ───────────────────────────────────────── */
.row-actions { display: flex; gap: 3px; }
.row-act-btn {
  height: 21px; padding: 0 7px; border-radius: var(--radius-xs);
  font-size: 10px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-4); transition: all .1s; white-space: nowrap;
}
.row-act-btn:hover { background: var(--blue-700); color: #fff; border-color: var(--blue-700); }

/* ── KPI detail ───────────────────────────────────────────────── */
.kdi-header   { font-family: var(--f-display); font-size: 13px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ink); margin-bottom: 8px; }
.kdi-title    { font-family: var(--f-display); font-size: 14px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; color: var(--ink); }
.kdi-athlete  { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.kdi-name     { font-weight: 600; font-size: 13px; color: var(--ink); }
.kdi-id       { font-family: var(--f-mono); font-size: 10px; color: var(--ink-4); }
.kdi-team     { font-size: 11.5px; color: var(--ink-3); }
.kdi-event-row{ display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.kdi-event    { font-size: 11.5px; color: var(--ink-2); }
.kdi-badge    { height: 17px; padding: 0 6px; border-radius: 8px; font-size: 10px; font-weight: 700; background: var(--q-direct-bg); color: var(--q-direct); }
.kdi-bump     { font-size: 10px; font-weight: 700; color: var(--q-direct); }
.kpi-detail-grid { display: flex; flex-direction: column; gap: 1px; }

/* ── Responsive ───────────────────────────────────────────────── */
@media screen and (max-width: 1100px) {
  .workspace { grid-template-columns: 240px 1fr; }
}
@media screen and (max-width: 900px) {
  :root { --side-w: 200px; }
  .kpi-row { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; padding: 10px 12px 0; }
  .workspace { grid-template-columns: 1fr; gap: 10px; padding: 10px 12px 16px; }
  .event-panel { max-height: 200px; position: static; }
  .results-panel { max-height: none; min-height: 300px; }
  .context-stat { padding: 8px 10px; min-width: 52px; }
}
@media screen and (max-width: 680px) {
  :root { --bar-h: 48px; }
  .app-body { grid-template-columns: 1fr; }
  .control-sidebar { position: relative; top: auto; height: auto; max-height: 55vh; }
  .stage-nav { padding: 0 4px; gap: 0; }
  .stage-btn { padding: 0 8px; font-size: 11.5px; }
  .topbar-brand { min-width: 0; padding: 0 10px; }
  .override-drawer { width: 100%; }
}


/* ================================================================
   WORKBENCH — Qualified / Needs Review / Displaced views
   ================================================================ */

/* Queue pill buttons */
.wb-queues {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 12px 0; flex-shrink: 0;
}
.wb-queue-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-4);
  margin-right: 4px; white-space: nowrap;
}
.wb-queue {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-3); transition: all .12s; white-space: nowrap;
}
.wb-queue:hover { background: var(--surface-3); color: var(--ink-2); }
.wb-queue.active {
  background: var(--blue-700); border-color: var(--blue-700);
  color: #fff; font-weight: 600;
  box-shadow: 0 2px 6px rgba(23,31,105,.25);
}
.wb-queue span {
  display: inline-flex; align-items: center; justify-content: center;
  height: 16px; min-width: 16px; padding: 0 4px; border-radius: 8px;
  font-size: 10px; font-weight: 700;
  background: rgba(255,255,255,.2); color: inherit;
}
.wb-queue:not(.active) span {
  background: var(--line); color: var(--ink-3);
}

/* Toolbar (status filter + sort) */
.wb-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); flex-shrink: 0;
}
.wb-filter-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  white-space: nowrap;
}
.wb-filter-label select {
  height: 26px; padding: 0 22px 0 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='5' viewBox='0 0 9 5'%3E%3Cpath d='M0.5 0.5l4 4 4-4' stroke='%23566170' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 7px center;
  font-size: 11.5px; color: var(--ink-2); font-family: var(--f-ui);
  appearance: none; -webkit-appearance: none;
  transition: border-color .15s;
}
.wb-filter-label select:focus {
  outline: none; border-color: var(--pool);
}
#wbClearFilters {
  margin-left: auto; font-size: 11px; color: var(--ink-4);
}
#wbClearFilters:hover { color: var(--red); border-color: rgba(227,25,55,.25); }

/* Tab count badge */
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  height: 16px; min-width: 16px; padding: 0 4px; border-radius: 8px;
  font-size: 10px; font-weight: 700;
  background: var(--line); color: var(--ink-3); margin-left: 3px;
}
.tab-btn.active .tab-count {
  background: rgba(23,31,105,.12); color: var(--blue-700);
}

/* Workbench table cells */
.wb-note {
  font-size: 10.5px; color: var(--ink-4); margin-top: 3px; line-height: 1.4;
}
.wb-impact {
  font-size: 12px; color: var(--ink-2); line-height: 1.5;
}
.wb-actions {
  display: flex; flex-direction: column; gap: 4px; min-width: 120px;
}
.wb-actions .row-act-btn {
  width: 100%; text-align: center;
  height: 24px; font-size: 10.5px;
}
/* High-risk rows */
.wb-risk-high { background: rgba(227,25,55,.025) !important; }
.wb-risk-high:hover { background: rgba(227,25,55,.04) !important; }

/* Priority pills use existing pill system */
/* Override "High" pill to be red */
.wb-toolbar + table tbody tr.wb-risk-high td:first-child .pill { 
  background: rgba(227,25,55,.1); color: #c0102a; border-color: rgba(227,25,55,.2); 
}

/* Event cell in workbench */
.table-wrap td strong { font-weight: 600; color: var(--ink); font-size: 12.5px; }

/* Path cell pill alignment */
.table-wrap td:first-child .pill { white-space: nowrap; }

/* Workbench empty state */
.table-wrap .empty-state { padding: 48px 20px; }


/* DISPLACEMENT CARDS */
.disp-event-list{display:flex;flex-direction:column;gap:0;padding:8px}
.disp-card{border:1px solid var(--line);border-radius:var(--radius-md);overflow:hidden;margin-bottom:6px;background:var(--surface);box-shadow:var(--sh-xs);transition:box-shadow .15s}
.disp-card.disp-card-open{box-shadow:var(--sh-sm)}
.disp-card-header{display:flex;align-items:center;justify-content:space-between;width:100%;padding:11px 14px;background:var(--surface-2);border:none;border-bottom:1px solid transparent;text-align:left;cursor:pointer;gap:12px;transition:background .12s}
.disp-card.disp-card-open .disp-card-header{background:var(--blue-700);border-bottom-color:var(--blue-600)}
.disp-card-header:hover{background:var(--surface-3)}
.disp-card.disp-card-open .disp-card-header:hover{background:var(--blue-600)}
.disp-card-left{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}
.disp-card-event{font-size:13px;font-weight:600;color:var(--ink);line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.disp-card.disp-card-open .disp-card-event{color:#fff}
.disp-card-meta{font-size:10.5px;color:var(--ink-4)}
.disp-card.disp-card-open .disp-card-meta{color:rgba(255,255,255,.5)}
.disp-card-right{display:flex;align-items:center;gap:8px;flex-shrink:0}
.disp-cause-summary{font-size:11px;color:var(--ink-3);white-space:nowrap}
.disp-card.disp-card-open .disp-cause-summary{color:rgba(255,255,255,.6)}
.disp-net{display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:10px;font-size:10.5px;font-weight:700;white-space:nowrap}
.disp-net-gain{background:var(--q-direct-bg);color:var(--q-direct);border:1px solid var(--q-direct-b)}
.disp-net-neutral{background:var(--q-out-bg);color:var(--q-out)}
.disp-card.disp-card-open .disp-net-gain{background:rgba(74,222,128,.15);color:#4ade80;border-color:rgba(74,222,128,.3)}
.disp-card.disp-card-open .disp-net-neutral{background:rgba(255,255,255,.1);color:rgba(255,255,255,.6)}
.disp-chevron{font-size:11px;color:var(--ink-4);line-height:1}
.disp-card.disp-card-open .disp-chevron{color:rgba(255,255,255,.6)}
.disp-card-body{padding:0}
.disp-table{width:100%;border-collapse:collapse;font-size:12.5px}
.disp-table th{background:var(--surface-2);color:var(--ink-4);font-size:9.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;padding:7px 12px;text-align:left;white-space:nowrap;border-bottom:1px solid var(--line)}
.disp-table th:first-child,.disp-table td:first-child{padding-left:16px}
.disp-table td{padding:8px 12px;vertical-align:middle;border-bottom:1px solid var(--line-2);color:var(--ink-2)}
.disp-table tr:last-child td{border-bottom:none}
.disp-row-cause{background:rgba(227,25,55,.02)}
.disp-row-cause:hover{background:rgba(227,25,55,.05)!important}
.disp-row-benefit{background:rgba(5,150,105,.02)}
.disp-row-benefit:hover{background:rgba(5,150,105,.05)!important}
.disp-row-silent td{padding:7px 16px;background:var(--surface-2)}
.disp-silent-note{font-size:11px;color:var(--ink-4);font-style:italic}
.disp-effect{font-size:11.5px;color:var(--ink-3);line-height:1.4}
.disp-empty{padding:20px 16px;font-size:12.5px;color:var(--ink-4);font-style:italic}
#syncIndicator .sync-label{font-size:10.5px}


/* ================================================================
   FLAG TOGGLES — redesigned sidebar filter
   ================================================================ */
.flag-mode-toggle {
  display: flex; align-items: center; gap: 4px; margin-bottom: 8px;
}
.flag-mode-btn {
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 10.5px; font-weight: 600;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09);
  color: var(--nav-muted); transition: all .12s;
}
.flag-mode-btn:hover { background: rgba(255,255,255,.10); color: var(--nav-ink); }
.flag-mode-btn.active {
  background: rgba(143,195,234,.2); border-color: rgba(143,195,234,.35);
  color: var(--sky);
}
.flag-clear-btn {
  height: 22px; padding: 0 8px; border-radius: 11px; margin-left: auto;
  font-size: 10px; font-weight: 600;
  background: rgba(227,25,55,.12); border: 1px solid rgba(227,25,55,.2);
  color: #ff8fa0; transition: all .12s;
}
.flag-clear-btn:hover { background: rgba(227,25,55,.2); color: #ffb3be; }

.flag-toggle-grid {
  display: flex; flex-direction: column; gap: 2px;
}
.flag-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 28px; padding: 0 9px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; text-align: left; transition: all .12s;
}
.flag-toggle:hover { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.08); }
.flag-toggle.active {
  background: rgba(143,195,234,.14); border-color: rgba(143,195,234,.25);
}
.flag-toggle.zero { opacity: .4; }
.flag-toggle.zero:hover { opacity: .7; }
.flag-toggle-label { font-size: 12px; font-weight: 500; color: var(--nav-ink); }
.flag-toggle.active .flag-toggle-label { color: var(--sky); font-weight: 600; }
.flag-toggle-count {
  display: inline-flex; align-items: center; justify-content: center;
  height: 16px; min-width: 20px; padding: 0 5px; border-radius: 8px;
  font-size: 10px; font-weight: 700;
  background: rgba(255,255,255,.1); color: var(--nav-muted);
}
.flag-toggle.active .flag-toggle-count {
  background: rgba(143,195,234,.25); color: var(--sky);
}

/* ================================================================
   FLAG ROSTER VIEW
   ================================================================ */
.roster-search-bar {
  padding: 10px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.roster-search {
  width: 100%; height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 12.5px; color: var(--ink);
  font-family: var(--f-ui);
}
.roster-search:focus { outline: none; border-color: var(--pool); }

.roster-category { margin-bottom: 0; border-bottom: 1px solid var(--line-2); }
.roster-category:last-child { border-bottom: none; }

.roster-cat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 8px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.roster-cat-icon { font-size: 14px; flex-shrink: 0; }
.roster-cat-label {
  font-family: var(--f-display); font-size: 13px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; color: var(--ink);
}
.roster-cat-count {
  display: inline-flex; align-items: center; justify-content: center;
  height: 18px; min-width: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--blue-700); color: #fff;
  font-size: 10.5px; font-weight: 700;
}
.roster-cat-note { font-size: 11px; color: var(--ink-4); margin-left: 4px; }

.roster-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.roster-table th {
  background: var(--surface-2); color: var(--ink-4);
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line);
}
.roster-table th:first-child,.roster-table td:first-child { padding-left: 16px; }
.roster-table td { padding: 8px 12px; vertical-align: middle; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
.roster-table tr:last-child td { border-bottom: none; }
.roster-table tr:hover td { background: var(--surface-2); }

.roster-no-results { font-size: 11px; color: var(--ink-4); font-style: italic; }
.roster-stages { font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.roster-zones { font-size: 10.5px; color: var(--ink-4); margin-top: 1px; }
.roster-missing { font-size: 11px; color: var(--brand-red); font-style: italic; }
.roster-approval { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px; font-size: 10.5px; font-weight: 600; background: var(--q-direct-bg); color: var(--q-direct); border: 1px solid var(--q-direct-b); }

/* Ghost badge in status column */
.status.status-ghost {
  background: rgba(23,31,105,.07); color: var(--blue-700);
  border: 1px dashed rgba(23,31,105,.2);
  font-style: italic;
}


/* ── Ghost badge ──────────────────────────────────────── */
.status.status-ghost {
  background: rgba(23,31,105,.07); color: var(--blue-700);
  border: 1px dashed rgba(23,31,105,.25); font-style: italic;
}

/* ── Flag filter overhaul ─────────────────────────────── */
.flag-mode-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 0 2px; margin-bottom: 8px;
}
.flag-mode-lbl {
  font-size: 9.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--nav-muted); flex-shrink: 0;
}
.flag-mode-pills { display: flex; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid rgba(255,255,255,.1); }
.fmp {
  height: 22px; padding: 0 10px;
  font-size: 10.5px; font-weight: 600; color: var(--nav-muted);
  background: rgba(255,255,255,.04); border: none; transition: all .12s;
}
.fmp:first-child { border-right: 1px solid rgba(255,255,255,.1); }
.fmp.on { background: var(--blue-600); color: #fff; }
.fmp:hover:not(.on) { background: rgba(255,255,255,.09); color: var(--nav-ink); }
.flag-clear-all {
  margin-left: auto; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 10px; font-weight: 700;
  background: rgba(227,25,55,.12); border: 1px solid rgba(227,25,55,.22);
  color: #ff8fa0; transition: all .12s;
}
.flag-clear-all:hover { background: rgba(227,25,55,.22); color: #ffbfc8; }

.ftog-grid { display: flex; flex-direction: column; gap: 1px; }
.ftog {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; height: 30px; padding: 0 10px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; text-align: left; transition: all .1s;
}
.ftog:hover { background: rgba(255,255,255,.055); border-color: rgba(255,255,255,.08); }
.ftog.on {
  background: rgba(143,195,234,.13);
  border-color: rgba(143,195,234,.22);
}
.ftog.zero { opacity: .38; }
.ftog.zero:hover { opacity: .65; }
.ftog-lbl { font-size: 12px; font-weight: 500; color: var(--nav-ink); letter-spacing: .01em; }
.ftog.on .ftog-lbl { color: var(--sky); font-weight: 600; }
.ftog-n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 16px; padding: 0 5px; border-radius: 8px;
  font-size: 10px; font-weight: 700;
  background: rgba(255,255,255,.07); color: var(--nav-muted);
}
.ftog.on .ftog-n { background: rgba(143,195,234,.22); color: var(--sky); }

/* ── Layout: fix horizontal overflow ─────────────────── */
html, body { overflow-x: hidden; }
.app-body { min-width: 0; overflow-x: hidden; }
.main-workspace { min-width: 0; overflow-x: hidden; }
.workspace { min-width: 0; }
.results-panel { min-width: 0; }
.table-wrap { overflow-x: auto; overflow-y: auto; }
.table-wrap table { min-width: 700px; } /* tables scroll internally */
.wb-toolbar { flex-wrap: wrap; gap: 6px; }
.wb-toolbar .wb-filter-label { flex-shrink: 0; }

/* ── Workbench layout improvements ───────────────────── */
.disp-card-event { white-space: normal; } /* allow wrapping on narrow screens */
.table-wrap .wb-actions { min-width: 100px; }

/* ── Flag Roster ─────────────────────────────────────── */
.roster-bar {
  padding: 10px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0;
  background: var(--surface-2);
}
.roster-search-input {
  width: 100%; height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 12.5px; color: var(--ink); font-family: var(--f-ui);
}
.roster-search-input:focus { outline: none; border-color: var(--pool); }
.roster-cat { border-bottom: 1px solid var(--line-2); }
.roster-cat:last-child { border-bottom: none; }
.roster-cat-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px 8px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.rc-icon { font-size: 15px; flex-shrink: 0; }
.rc-lbl {
  font-family: var(--f-display); font-size: 13px; font-weight: 800;
  letter-spacing: .03em; text-transform: uppercase; color: var(--ink);
}
.rc-count {
  height: 18px; min-width: 20px; padding: 0 5px; border-radius: 9px;
  background: var(--blue-700); color: #fff;
  font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.rc-note { font-size: 11px; color: var(--ink-4); }
.roster-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.roster-tbl th {
  background: var(--surface-2); color: var(--ink-4);
  font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--line);
}
.roster-tbl th:first-child,.roster-tbl td:first-child { padding-left: 16px; }
.roster-tbl td { padding: 8px 12px; vertical-align: middle; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
.roster-tbl tr:last-child td { border-bottom: none; }
.roster-tbl tr:hover td { background: var(--surface-2); }
.roster-no-results { font-size: 11px; color: var(--ink-4); font-style: italic; }
.roster-stages { font-size: 11.5px; color: var(--ink-2); font-weight: 500; }
.roster-zones { font-size: 10.5px; color: var(--ink-4); }
.roster-missing { font-size: 11px; color: var(--red); font-style: italic; }
.rc-approval {
  display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px;
  font-size: 10.5px; font-weight: 600;
  background: var(--q-direct-bg); color: var(--q-direct); border: 1px solid var(--q-direct-b);
}

/* ── Sticky event header in qualifier views ───────────────────── */
.qv-event-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

/* qv-sort-bar: no sticky positioning — flows inline within its view container */

.stage-content { display: contents; }
/* ── Season context notes (multi-season reports) ──────────────────────────
   The audit spans 2013–2026 and the format changed several times. These
   banners state the rules in force for the selected season so a historical
   result is not read under current assumptions. Colours stay inside the
   brand palette; note that red on blue is never used. */
.rpt-season-notes{
  display:flex; flex-wrap:wrap; gap:6px;
  padding:8px 0 2px;
  border-top:1px solid rgba(23,31,105,.10);
  margin-top:6px;
}
.rpt-season-note{
  display:inline-flex; align-items:flex-start; gap:6px;
  font:500 11.5px/1.45 'Inter',system-ui,sans-serif;
  padding:5px 10px; border-radius:6px;
  max-width:100%;
}
.rpt-season-note b{ font-weight:800; flex:0 0 auto; }
.rpt-note-info  { background:#EAF4FB; color:#0F4C68; }
.rpt-note-rule  { background:#F1F3F9; color:#171F69; }
.rpt-note-caveat{ background:#FFF4E5; color:#7A4A00; }
.rpt-note-warn  { background:#FDECEF; color:#8B0C22; }

@media print{
  .rpt-season-notes{ break-inside:avoid; page-break-inside:avoid; }
  .rpt-season-note{ border:1px solid #bbb; background:#fff !important; color:#000 !important; }
}

/* Dive-count caveat inside the live reports view (not the printed doc).
   Amber on white — never red on blue. */
.rpt-note-divecount{
  background:#FFF4E5;
  border-left:3px solid #B26A00;
  color:#5A3600;
  padding:8px 10px;
  border-radius:4px;
  font-size:12px;
  line-height:1.5;
}
