/* ============================================================
   USA DIVING STAFF PLATFORM — UNIFIED DESIGN SYSTEM v2.0
   Brand: USA Diving Blue #171f69 | Red #e31937 | Pool #009ac7
   Font: Barlow Condensed (headlines) + Inter (UI)
   ============================================================ */

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

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  /* Brand primaries */
  --brand-blue:      #171f69;   /* PMS 275 */
  --brand-blue-700:  #1e2d8a;
  --brand-blue-800:  #131960;
  --brand-blue-900:  #0d1040;
  --brand-blue-950:  #080c2e;
  --brand-red:       #e31937;   /* PMS 186 */
  --brand-red-soft:  rgba(227,25,55,.12);
  --brand-pool:      #009ac7;   /* PMS 313 */
  --brand-sky:       #8fc3ea;   /* PMS 543 */
  --brand-gray:      #5f6062;   /* PMS 425 */

  /* Dark UI surfaces (sidebar / topbar) */
  --nav-bg:          #0d1040;
  --nav-border:      rgba(255,255,255,.07);
  --nav-ink:         #c8d0f0;
  --nav-muted:       rgba(200,208,240,.45);
  --nav-hover:       rgba(255,255,255,.06);
  --nav-active-bg:   rgba(143,195,234,.14);
  --nav-active-ink:  #8fc3ea;

  /* Content surfaces */
  --bg:              #f0f2f8;
  --surface:         #ffffff;
  --surface-2:       #f7f8fc;
  --line:            #e2e5ef;
  --line-2:          #f0f2f8;

  /* Ink */
  --ink:             #0d1117;
  --ink-2:           #2d3a4a;
  --ink-3:           #5a6a7e;
  --ink-4:           #94a3b8;

  /* Semantic status (qualification) */
  --status-direct:       #059669;
  --status-direct-bg:    #ecfdf5;
  --status-direct-border:#a7f3d0;
  --status-ewc:          #0369a1;
  --status-ewc-bg:       #eff6ff;
  --status-ewc-border:   #bae0f9;
  --status-replace:      #d97706;
  --status-replace-bg:   #fffbeb;
  --status-replace-border:#fde68a;
  --status-out:          #6b7280;
  --status-out-bg:       #f3f4f6;
  --status-flag:         #e31937;
  --status-flag-bg:      rgba(227,25,55,.08);

  /* Row highlights */
  --row-foreign:     rgba(227,25,55,.04);
  --row-dual:        rgba(0,154,199,.05);
  --row-decline:     rgba(107,114,128,.06);

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

  /* Spacing */
  --topbar-h:        52px;
  --sidebar-w:       240px;

  /* Shape */
  --radius-sm:       4px;
  --radius:          6px;
  --radius-md:       8px;
  --radius-lg:       12px;
  --radius-xl:       16px;

  /* Shadow */
  --shadow-xs:       0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:       0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:          0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-md:       0 4px 16px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.07);
  --shadow-lg:       0 8px 32px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.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(--font-ui); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }

/* ── Topbar ──────────────────────────────────────────────── */
.app-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  display: flex; align-items: center;
  padding: 0 16px 0 0;
  gap: 0;
}
.topbar-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-right: 1px solid var(--nav-border);
  min-width: var(--sidebar-w);
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-brand:hover { background: var(--nav-hover); }
.brand-mark {
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--brand-blue-700);
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.brand-mark-squiggle {
  width: 18px; height: 18px; fill: none;
  stroke: #fff; stroke-width: 2; stroke-linecap: round;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-org {
  font-family: var(--font-display); font-weight: 700;
  font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  color: #fff;
}
.brand-subtitle {
  font-size: 10.5px; font-weight: 500; color: var(--nav-muted);
  letter-spacing: .02em;
}
.topbar-nav {
  display: flex; align-items: center; gap: 2px;
  padding: 0 12px; flex: 1;
}
.topbar-nav-link {
  display: flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px; border-radius: var(--radius);
  font-size: 12.5px; font-weight: 500; color: var(--nav-muted);
  text-decoration: none; transition: all .15s; white-space: nowrap;
}
.topbar-nav-link:hover { background: var(--nav-hover); color: var(--nav-ink); }
.topbar-nav-link.active { background: var(--nav-active-bg); color: var(--nav-active-ink); }
.topbar-nav-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.topbar-actions {
  display: flex; align-items: center; gap: 6px;
  padding: 0 4px; margin-left: auto;
}
.topbar-btn {
  display: flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 10px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500; color: var(--nav-muted);
  background: transparent; border: 1px solid rgba(255,255,255,.1);
  cursor: pointer; transition: all .15s;
}
.topbar-btn:hover { background: var(--nav-hover); color: var(--nav-ink); border-color: rgba(255,255,255,.18); }
.topbar-btn.primary { background: var(--brand-red); color: #fff; border-color: transparent; }
.topbar-btn.primary:hover { background: #c91530; }
.override-badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 16px; min-width: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--brand-red); color: #fff; font-size: 10px; font-weight: 700;
}

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

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

.sidebar-section { padding: 16px 12px; border-bottom: 1px solid var(--nav-border); }
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--nav-muted);
  margin-bottom: 10px; padding: 0 4px;
}

/* Filter fields */
.filter-field { margin-bottom: 10px; }
.filter-field:last-child { margin-bottom: 0; }
.filter-label {
  display: block; font-size: 10.5px; font-weight: 600;
  color: var(--nav-muted); letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 5px; padding: 0 2px;
}
.filter-field select,
.filter-field input[type="search"] {
  width: 100%; height: 32px; padding: 0 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius); color: var(--nav-ink);
  font-size: 12.5px; font-family: var(--font-ui);
  appearance: none; -webkit-appearance: none;
  transition: border-color .15s, background .15s;
}
.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--brand-sky);
  background: rgba(255,255,255,.09);
}
.filter-field select option { background: #1a2255; color: #fff; }

/* Flag chips */
.filter-flags { display: flex; flex-wrap: wrap; gap: 5px; }
.flag-chip {
  display: flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 8px; border-radius: 12px;
  font-size: 11px; font-weight: 500; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: var(--nav-muted); transition: all .12s;
}
.flag-chip input { display: none; }
.flag-chip:hover { background: rgba(255,255,255,.10); color: var(--nav-ink); }
.flag-chip.checked { background: var(--brand-red-soft); border-color: rgba(227,25,55,.3); color: #ff7a8a; }
.flag-mode-select {
  width: 100%; height: 26px; padding: 0 8px; margin-bottom: 8px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-sm); color: var(--nav-muted);
  font-size: 11px; appearance: none;
}

/* ── Main workspace ──────────────────────────────────────── */
.main-workspace {
  display: flex; flex-direction: column;
  min-height: calc(100vh - var(--topbar-h));
  overflow: hidden;
}

/* KPI row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px; padding: 14px 16px 0;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .15s;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); }
.kpi-card.accent-green { border-top: 2px solid var(--status-direct); }
.kpi-card.accent-blue  { border-top: 2px solid var(--brand-pool); }
.kpi-card.accent-red   { border-top: 2px solid var(--brand-red); }
.kpi-card.accent-amber { border-top: 2px solid var(--status-replace); }
.kpi-value {
  font-family: var(--font-display); font-weight: 700;
  font-size: 28px; letter-spacing: -.01em; line-height: 1;
  color: var(--ink);
}
.kpi-value.green { color: var(--status-direct); }
.kpi-value.blue  { color: var(--brand-pool); }
.kpi-value.red   { color: var(--brand-red); }
.kpi-value.amber { color: var(--status-replace); }
.kpi-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); margin-top: 4px;
}
.kpi-sub { font-size: 10.5px; color: var(--ink-4); margin-top: 2px; }

/* ── Workspace grid ──────────────────────────────────────── */
.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px; padding: 12px 16px 16px;
  flex: 1; min-height: 0; 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(--shadow-sm);
  overflow: hidden;
  max-height: calc(100vh - 190px);
  position: sticky; top: calc(var(--topbar-h) + 12px);
}
.panel-head {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--brand-blue);
  flex-shrink: 0;
}
.panel-head-title {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.85);
}
.btn-link {
  font-size: 11px; font-weight: 600; color: var(--brand-sky);
  background: none; border: none; cursor: pointer; padding: 2px 4px;
}
.btn-link:hover { color: #fff; }
.event-search-wrap { padding: 8px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.event-search {
  width: 100%; height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); font-size: 12.5px; color: var(--ink);
}
.event-search:focus { outline: none; border-color: var(--brand-pool); }
.event-list { overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.event-list::-webkit-scrollbar { width: 4px; }
.event-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }
.event-item {
  display: block; width: 100%;
  padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid transparent; background: transparent;
  text-align: left; cursor: pointer; transition: all .12s;
}
.event-item:hover { background: var(--surface-2); border-color: var(--line); }
.event-item.active { background: var(--brand-blue); border-color: var(--brand-blue-700); }
.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: 2px; }
.event-item.active .event-item-meta { color: rgba(255,255,255,.6); }
.event-item-badges { display: flex; gap: 4px; 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(--shadow-sm);
  overflow: hidden;
  max-height: calc(100vh - 190px);
}

/* Tab bar */
.results-tabs {
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0 12px; gap: 0;
  background: var(--surface-2);
  flex-shrink: 0;
}
.tab-btn {
  display: flex; align-items: center; gap: 5px;
  height: 38px; padding: 0 12px;
  font-size: 12.5px; font-weight: 500;
  color: var(--ink-3); background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--brand-blue); border-bottom-color: var(--brand-blue); font-weight: 600; }
.tab-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.btn-sm {
  height: 26px; padding: 0 10px; border-radius: var(--radius-sm);
  font-size: 11.5px; font-weight: 500; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); transition: all .12s;
}
.btn-sm:hover { background: var(--line-2); border-color: #d1d5db; }

/* Results context bar */
.results-context {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface); flex-shrink: 0;
}
.context-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.context-sub { font-size: 11.5px; color: var(--ink-4); }
.context-stats { display: flex; gap: 12px; margin-left: auto; }
.context-stat { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-3); }
.context-stat strong { color: var(--ink-2); font-weight: 600; }
.threshold-badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 11px;
  background: var(--status-ewc-bg); border: 1px solid var(--status-ewc-border);
  font-size: 11px; font-weight: 600; color: var(--status-ewc);
}

/* Table */
.results-scroll { overflow-y: auto; overflow-x: auto; flex: 1; }
.results-scroll::-webkit-scrollbar { height: 6px; width: 6px; }
.results-scroll::-webkit-scrollbar-track { background: transparent; }
.results-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.results-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.results-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--brand-blue); color: rgba(255,255,255,.8);
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  padding: 8px 10px; text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--brand-blue-700);
}
.results-table thead th:first-child { padding-left: 14px; }
.results-table tbody tr {
  border-bottom: 1px solid var(--line-2);
  transition: background .1s;
}
.results-table tbody tr:hover { background: var(--surface-2); }
.results-table tbody tr.row-foreign { background: var(--row-foreign); }
.results-table tbody tr.row-dual    { background: var(--row-dual); }
.results-table tbody tr.row-decline { background: var(--row-decline); opacity: .75; }
.results-table td {
  padding: 7px 10px; vertical-align: middle;
  color: var(--ink-2);
}
.results-table td:first-child { padding-left: 14px; }
.results-table td.mono { font-family: var(--font-mono); font-size: 12px; }

/* Athlete cell */
.athlete-cell { display: flex; flex-direction: column; gap: 1px; }
.athlete-name { font-weight: 600; color: var(--ink); font-size: 13px; }
.athlete-id { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-4); }
.athlete-event-note { font-size: 10.5px; color: var(--ink-4); }

/* Status badges */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 7px; border-radius: 10px;
  font-size: 10.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.status-qualifier   { background: var(--status-direct-bg); color: var(--status-direct); border-color: var(--status-direct-border); }
.status-ewc         { background: var(--status-ewc-bg);    color: var(--status-ewc);    border-color: var(--status-ewc-border); }
.status-replacement { background: var(--status-replace-bg); color: var(--status-replace); border-color: var(--status-replace-border); }
.status-average     { background: var(--status-ewc-bg); color: var(--status-ewc); border-color: var(--status-ewc-border); }
.status-out         { background: var(--status-out-bg); color: var(--status-out); }
.status-non-displacing { background: var(--status-flag-bg); color: var(--status-flag); }
.status-decline     { background: var(--status-out-bg); color: var(--status-out); text-decoration: line-through; }

/* Flag pills */
.flag-pills { display: flex; gap: 3px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center;
  height: 18px; padding: 0 6px; border-radius: 9px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
}
.pill-foreign  { background: rgba(227,25,55,.1); color: var(--brand-red); }
.pill-dual     { background: rgba(0,154,199,.1); color: var(--brand-pool); }
.pill-hps      { background: rgba(23,31,105,.1); color: var(--brand-blue); }
.pill-webpoint { background: rgba(217,119,6,.1); color: #d97706; }
.pill-preq     { background: rgba(5,150,105,.1); color: var(--status-direct); }
.pill-nondis   { background: rgba(227,25,55,.08); color: var(--brand-red); }
.pill-bump     { background: rgba(5,150,105,.12); color: var(--status-direct); }

/* Mini badge (event list) */
.mini-badge {
  display: inline-flex; align-items: center;
  height: 17px; padding: 0 6px; border-radius: var(--radius-sm);
  font-size: 10px; font-weight: 700;
}
.mini-badge.green { background: var(--status-direct-bg); color: var(--status-direct); }
.mini-badge.blue  { background: var(--status-ewc-bg); color: var(--status-ewc); }
.mini-badge.gray  { background: var(--status-out-bg); color: var(--status-out); }

/* ── Stage nav (top bar) ─────────────────────────────────── */
.stage-nav { display: flex; align-items: center; height: var(--topbar-h); gap: 2px; }
.stage-btn {
  display: flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  font-size: 12.5px; font-weight: 500; color: var(--nav-muted);
  background: none; border: none; cursor: pointer; transition: all .15s;
}
.stage-btn:hover { background: var(--nav-hover); color: var(--nav-ink); }
.stage-btn.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 600; }
.stage-dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; opacity: .6; }

/* ── Override drawer ─────────────────────────────────────── */
.override-drawer {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0; z-index: 90;
  width: 380px; background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.drawer-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  background: var(--brand-blue);
}
.drawer-header h2 { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: #fff; letter-spacing: .03em; }
.drawer-header p { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 2px; }
.drawer-header-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.btn-ghost {
  height: 26px; padding: 0 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 500; cursor: pointer;
  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:hover { background: rgba(255,255,255,.18); color: #fff; }
.btn-ghost.btn-danger { border-color: rgba(227,25,55,.4); }
.btn-ghost.btn-danger:hover { background: var(--brand-red); color: #fff; border-color: transparent; }
.drawer-form { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field span { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.form-field input, .form-field select {
  height: 32px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 13px; color: var(--ink);
}
.form-field input:focus, .form-field select:focus { outline: none; border-color: var(--brand-pool); }
.btn-primary {
  height: 34px; padding: 0 14px; border-radius: var(--radius);
  background: var(--brand-blue); color: #fff;
  font-size: 13px; font-weight: 600; border: none; cursor: pointer;
  transition: background .15s; align-self: flex-start;
}
.btn-primary:hover { background: var(--brand-blue-700); }

/* ── Responsive ──────────────────────────────────────────── */
@media screen and (max-width: 900px) {
  :root { --sidebar-w: 200px; }
  .kpi-row { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .workspace { grid-template-columns: 220px 1fr; gap: 8px; padding: 8px 10px 12px; }
}
@media screen and (max-width: 680px) {
  .app-body { grid-template-columns: 1fr; }
  .control-sidebar { position: relative; top: auto; height: auto; max-height: none; }
  .workspace { grid-template-columns: 1fr; }
  .event-panel { max-height: 260px; }
  .topbar-nav { display: none; }
}

/* ============================================================
   v2.1 VISUAL REFRESH — premium polish layer
   Token + shared-component upgrades only. No selectors renamed,
   no layout/grid changes — every app stays functionally intact.
   ============================================================ */
:root {
  /* Softer, navy-tinted elevation */
  --shadow-xs: 0 1px 2px rgba(13,28,68,.06);
  --shadow-sm: 0 1px 2px rgba(13,28,68,.06), 0 1px 3px rgba(13,28,68,.05);
  --shadow:    0 6px 22px rgba(13,28,68,.08);
  --shadow-md: 0 12px 34px rgba(13,28,68,.11);
  --shadow-lg: 0 24px 64px rgba(7,16,48,.20);
  /* Slightly cooler, calmer surfaces */
  --bg:        #eaeff7;
  --surface-2: #f5f8fc;
  --line:      #e2e8f3;
  --line-2:    #eef2f9;
  --focus-ring: 0 0 0 3px rgba(0,154,199,.18);
}

/* Page background — faint pool-blue light source */
body {
  background:
    radial-gradient(1200px 460px at 88% -8%, rgba(0,154,199,.06), transparent 62%),
    var(--bg);
}

/* Dark nav surfaces — richer vertical gradient + crisper edge */
.app-topbar { background: linear-gradient(180deg,#11164e,#0b0f38); box-shadow: 0 1px 0 rgba(255,255,255,.05), 0 6px 22px rgba(5,12,40,.20); }
.control-sidebar { background: linear-gradient(180deg,#0f1450,#0a0e36); }

/* Inputs — consistent pool focus ring + smooth transitions */
.filter-field select, .filter-field input[type="search"],
.event-search, .form-field input, .form-field select {
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.filter-field select:focus, .filter-field input:focus,
.event-search:focus, .form-field input:focus, .form-field select:focus {
  box-shadow: var(--focus-ring);
}

/* Buttons — subtle hover lift + cohesive elevation */
.btn-primary, .btn-sm, .topbar-btn, .btn-ghost {
  transition: transform .12s, box-shadow .15s, background .15s, border-color .15s, color .15s;
}
.btn-primary { box-shadow: var(--shadow-sm); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow); background: var(--brand-blue-700); }
.btn-primary:active { transform: translateY(0); }
.btn-sm:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* Keyboard focus indicator, matching usad-overlays.css's proven pattern for
   .usad-modal-btn -- extended here since none of these had ANY focus-visible
   rule and were falling back to whatever the browser happens to do by
   default. :focus-visible only fires for keyboard navigation in every
   current browser, so this changes nothing for a mouse or touch user. */
.btn-primary:focus-visible, .btn-sm:focus-visible, .btn-ghost:focus-visible,
.btn-link:focus-visible, .topbar-btn:focus-visible, .topbar-nav-link:focus-visible,
button:focus-visible, a.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,154,199,.32);
}

/* Skip-navigation link (WCAG 2.4.1). Off-screen (not display:none, which
   would remove it from the tab order) until a keyboard user tabs to it, at
   which point it snaps into view at the top of the page so they can jump
   past the header/nav straight to content. A mouse user never sees this. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 10000;
  background: var(--brand-blue, #171f69); color: #fff;
  padding: 10px 18px; border-radius: 0 0 6px 0;
  font-family: var(--font-ui, 'Inter', sans-serif); font-weight: 600; font-size: 14px;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}
.topbar-btn.primary:hover { box-shadow: 0 5px 16px rgba(227,25,55,.38); }

/* KPI cards — softer rounding, lift on hover */
.kpi-card { border-radius: var(--radius-lg); transition: box-shadow .15s, transform .12s, border-color .15s; }
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* Table + panel headers — navy gradient depth */
.results-table thead th { background: linear-gradient(180deg,#1e2d8a,#171f69); }
.panel-head { background: linear-gradient(180deg,#1e2d8a,#171f69); }
.drawer-header { background: linear-gradient(180deg,#1e2d8a,#171f69); }

/* Event-list active state — gradient instead of flat */
.event-item.active { background: linear-gradient(180deg,#1e2d8a,#171f69); }

/* Tabs — slightly bolder active underline */
.tab-btn.active { border-bottom-width: 2.5px; }

/* Status + flag chips — fully pill-rounded for a cleaner read */
.status-badge { border-radius: 999px; }

/* Threshold badge + context strip polish */
.threshold-badge { box-shadow: var(--shadow-xs); }

/* ── High Performance two-view switcher (Standards Studio ⇄ Athlete Evaluation) ── */
.hp-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 18px;
  padding: 3px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
}
.hp-view-tab {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.hp-view-tab:hover { color: #fff; background: rgba(255,255,255,.08); }
.hp-view-tab.active {
  background: var(--brand-pool, #009AC7);
  color: #fff;
}
@media (max-width: 900px) { .hp-view-switch { display: none; } }
