/* Shared dark sports-dashboard design tokens. */
:root {
  color-scheme: dark;
  --bg-app: #11161b;
  --bg-header: #0e1318;
  --bg-sidebar: #141a20;
  --bg-panel: #1b2229;
  --bg-panel-raised: #202931;
  --bg-hover: #29333d;
  --bg-selected: #26323b;
  --bg-input: #161e25;
  --text-primary: #f5f7fa;
  --text-secondary: #b8c0c8;
  --text-muted: #87939e;
  --text-disabled: #65717c;
  --border-subtle: #2a333b;
  --border-strong: #3a4651;
  --accent-primary: #119bea;
  --accent-primary-hover: #34aff4;
  --accent-teal: #00b9bb;
  --accent-teal-soft: #173e42;
  --success: #67d76c;
  --warning: #e3c64f;
  --danger: #ef626b;
  --header-height: 56px;
  --sidebar-width: 214px;
  --aside-width: 280px;
  --content-max-width: 1600px;
  --gutter: 14px;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-md: 14px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --radius-sm: 6px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --shadow-float: 0 12px 32px rgba(0, 0, 0, .25);
  --duration-fast: 140ms;
  --duration-normal: 220ms;
  --ease-ui: cubic-bezier(.2, .8, .2, 1);
}

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-primary-hover) !important;
  outline-offset: 2px;
}

/* Existing programme pages opt in to the compatibility layer with this class.
   The aliases keep their inline and dynamically generated content legible. */
body.program-dashboard {
  --navy: var(--text-primary);
  --navy2: var(--accent-primary-hover);
  --navy-light: #203741;
  --gold: var(--accent-primary-hover);
  --gold2: var(--accent-primary-hover);
  --gold-light: #18323e;
  --pink: var(--accent-primary);
  --pink-lt: #18323e;
  --pink-light: #18323e;
  --pink-mid: #244958;
  --blue-lt: #223540;
  --white: var(--bg-panel);
  --bg: var(--bg-app);
  --card-bg: var(--bg-panel);
  --gray: var(--border-subtle);
  --gray2: var(--text-muted);
  --gray3: var(--text-secondary);
  --gray-50: var(--bg-hover);
  --gray-100: var(--bg-app);
  --gray-200: var(--border-subtle);
  --gray-300: var(--border-strong);
  --gray-500: var(--text-muted);
  --gray-700: var(--text-secondary);
  --gray-900: var(--text-primary);
  --text: var(--text-primary);
  --border: var(--border-strong);
  --green: var(--success);
  --red: var(--danger);
  --shadow: 0 4px 18px rgba(0, 0, 0, .16);
  --shadow2: var(--shadow-float);
  --shadow-lg: var(--shadow-float);
  min-height: 100dvh;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--font-size-md);
  line-height: 1.45;
}

.program-dashboard :is(button, input, select, textarea) { font: inherit; }
.program-dashboard button { cursor: pointer; }
.program-dashboard :is(button, a, input, select) {
  transition: background-color var(--duration-fast) var(--ease-ui),
              border-color var(--duration-fast) var(--ease-ui),
              color var(--duration-fast) var(--ease-ui);
}
.program-dashboard :is(button, input, select):disabled { opacity: .55; cursor: not-allowed; }
.program-dashboard :is(.hstat-num, .stat-num, .td-amount, .amount, td, th) { font-variant-numeric: tabular-nums; }

/* Header, summary figures, and horizontal programme navigation. */
.program-dashboard :is(.site-header, .header, .app-header) {
  background: var(--bg-header);
  color: var(--text-primary);
  box-shadow: none;
  border-bottom: 1px solid var(--border-subtle);
}
.program-dashboard :is(.header-inner, .app-header) {
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding: 18px 28px;
  gap: 18px;
}
.program-dashboard .app-header { max-width: none; height: auto; min-height: 72px; }
.program-dashboard .header:not(:has(.header-inner)) { height: auto; min-height: 72px; padding: 18px 28px; gap: 18px; }
.program-dashboard :is(.header-left, .header-text) { min-width: 0; }
.program-dashboard :is(.header-text h1, .header-title) {
  color: var(--text-primary);
  font-size: clamp(17px, 1.5vw, 22px);
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1.2;
}
.program-dashboard :is(.header-text p, .header-sub) { color: var(--text-secondary); opacity: 1; font-size: 12px; margin-top: 5px; }
.program-dashboard :is(.header-stats, .stats-bar) { gap: 8px; }
.program-dashboard .header-stats { align-items: stretch; }
.program-dashboard :is(.hstat, .stat-item) {
  min-width: 94px;
  padding: 9px 13px;
  text-align: left;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}
.program-dashboard :is(.hstat-num, .stat-num) { color: var(--accent-primary-hover); font-size: 19px; font-weight: 750; line-height: 1.1; }
.program-dashboard :is(.hstat-label, .stat-label) { color: var(--text-secondary); opacity: 1; font-size: 10px; font-weight: 650; letter-spacing: .06em; margin-top: 5px; }
.program-dashboard .stats-bar { max-width: 100%; overflow-x: auto; background: var(--bg-header); border: 0; border-bottom: 1px solid var(--border-subtle); padding: 0 28px 16px; }
.program-dashboard .stats-bar .stat-item { flex: 1 0 120px; }
.program-dashboard :is(.back-btn, #backBtn, .header-inner > a, .signout-btn, .sign-out-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-panel-raised);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.program-dashboard :is(.back-btn, #backBtn, .header-inner > a, .signout-btn, .sign-out-btn):hover { background: var(--bg-hover); color: var(--text-primary); }
.program-dashboard :is(.nav-tabs, .tabs) {
  background: var(--bg-header);
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
}
.program-dashboard :is(.nav-tabs-inner, .nav-inner, .tabs) { gap: 5px; padding: 8px 28px; }
.program-dashboard :is(.nav-tabs-inner, .nav-inner) { max-width: var(--content-max-width); margin-inline: auto; }
.program-dashboard :is(.nav-tab, .tab) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  margin: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.program-dashboard :is(.nav-tab, .tab):hover { background: var(--bg-hover); color: var(--text-primary); }
.program-dashboard :is(.nav-tab, .tab).active { background: var(--accent-primary); color: #07151e; font-weight: 750; }
.program-dashboard .nav-tabs-inner .signout-btn { margin-left: auto; }

/* Main content, filters and reusable raised panels. */
.program-dashboard :is(.main, .main-content, .content) { max-width: var(--content-max-width); min-width: 0; margin-inline: auto; padding: 24px 28px 40px; }
.program-dashboard :is(.filter-bar, .toolbar, .shortlist-info) {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 16px;
  margin-bottom: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .10);
}
.program-dashboard :is(.filter-group, .filter-group.search, .search-box, .toolbar input) { min-width: 0; }
.program-dashboard .filter-group { flex: 1 1 155px; }
.program-dashboard .filter-group.search, .program-dashboard .search-box, .program-dashboard .toolbar input { flex: 2 1 220px; }
.program-dashboard :is(.filter-group label, .modal-field label) { color: var(--text-secondary); font-size: 11px; font-weight: 650; letter-spacing: .05em; }
.program-dashboard :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  min-height: 39px;
  max-width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 13px;
}
.program-dashboard :is(input, textarea)::placeholder { color: var(--text-muted); opacity: 1; }
.program-dashboard :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--accent-primary); }
.program-dashboard :is(.results-count, .toolbar-count, .table-meta-left, .page-info, .shortlist-empty, .meta) { color: var(--text-secondary); }
.program-dashboard .filter-actions { flex-wrap: wrap; }

.program-dashboard :is(.btn, .btn-primary, .btn-secondary, .btn-pink, .btn-navy, .btn-outline, .btn-select-all, .btn-view, .view-btn, .btn-shortlist, .page-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-panel-raised);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}
.program-dashboard :is(.btn, .btn-primary, .btn-secondary, .btn-pink, .btn-navy, .btn-outline, .btn-select-all, .btn-view, .view-btn, .btn-shortlist, .page-btn):hover { background: var(--bg-hover); color: var(--text-primary); opacity: 1; transform: none; }
.program-dashboard :is(.btn-primary, .btn-pink) { background: var(--accent-primary); border-color: var(--accent-primary); color: #07151e; }
.program-dashboard :is(.btn-primary, .btn-pink):hover { background: var(--accent-primary-hover); border-color: var(--accent-primary-hover); color: #07151e; }
.program-dashboard :is(.btn-shortlist.active, .page-btn.active) { background: var(--accent-teal-soft); border-color: var(--accent-teal); color: #d6faf9; }
.program-dashboard .star-btn { min-width: 38px; min-height: 38px; color: var(--warning); }
.program-dashboard .star-btn:hover { background: var(--bg-hover); border-radius: var(--radius-sm); transform: none; }

/* Data surfaces. Each existing table wrapper scrolls independently on narrow screens. */
.program-dashboard :is(.table-wrap, .chart-card, .report-card, .shortlist-card) {
  min-width: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .10);
}
.program-dashboard .table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.program-dashboard .table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.program-dashboard .table-wrap table { min-width: 850px; }
.program-dashboard table { width: 100%; background: var(--bg-panel); color: var(--text-primary); border-collapse: collapse; }
.program-dashboard :is(thead th, .report-table th, .budget-table th) {
  background: var(--bg-panel-raised);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-strong);
  padding: 12px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}
.program-dashboard thead th:hover { background: var(--bg-hover); }
.program-dashboard :is(tbody tr, tbody td, .report-table td, .budget-table td) { border-color: var(--border-subtle); }
.program-dashboard td { padding: 12px 14px; color: var(--text-primary); font-size: 13px; line-height: 1.4; }
.program-dashboard :is(tbody tr:hover, tbody tr:hover td, .report-table tr:hover td) { background: var(--bg-hover); }
.program-dashboard :is(tbody tr.shortlisted, tbody tr.shortlisted td, tbody tr.shortlisted:hover, tbody tr.shortlisted:hover td) { background: #1b3536; }
.program-dashboard :is(tbody tr.has-medical, tbody tr.has-medical td) { background: #353222; }
.program-dashboard :is(tbody tr.has-medical:hover, tbody tr.has-medical:hover td) { background: #403b27; }
.program-dashboard :is(.td-name, .shortlist-header h2, .shortlist-info h3, .shortlist-card h4) { color: var(--text-primary); }
.program-dashboard :is(.td-amount, .amount) { color: var(--success); }
.program-dashboard .table-meta { border-color: var(--border-subtle); }
.program-dashboard .table-meta-left strong { color: var(--text-primary); }
.program-dashboard .pagination { flex-wrap: wrap; }
.program-dashboard #pagination button[style] { background: var(--bg-panel-raised) !important; color: var(--text-primary) !important; border-color: var(--border-strong) !important; min-height: 38px; }
.program-dashboard #pagination button[style*="background:var(--pink)"] { background: var(--accent-primary) !important; color: #07151e !important; border-color: var(--accent-primary) !important; }
/* These spans are information, not controls.  File links and status selects
   deliberately keep their interactive styling. */
.program-dashboard :is(span.shortlist-count-badge, span.badge, span.sport-badge, span.user-badge, span.file-chip, span.status-select) {
  display: inline;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #bce9fb;
  font-weight: 650;
  white-space: normal;
}
/* Sport colours and shortlist status padding/radius are set inline by the
   existing renderers; override only those inline decorative properties. */
.program-dashboard span.sport-badge { background: transparent !important; }
.program-dashboard span.status-select { padding: 0 !important; border-radius: 0 !important; cursor: auto; }
.program-dashboard :is(span.badge-gray, span.file-chip) { margin-inline-start: .25em; }
.program-dashboard :is(span.badge-green, span.badge-tiny, span.status-Approved) { color: #a9e9ac; }
.program-dashboard :is(span.badge-medical, span.badge-orange, span.status-Pending) { color: #f3d393; }
.program-dashboard :is(span.badge-red, span.status-Declined) { color: #ffb3b9; }
.program-dashboard :is(a.file-link, a.file-chip, a.modal-file-btn) { background: #203a48; color: #b7e7ff; border: 1px solid #305b6c; text-decoration: none; }
.program-dashboard :is(a.file-link, a.file-chip, a.modal-file-btn):hover { background: #285365; color: #fff; }
.program-dashboard span.file-chip { background: transparent; border: 0; color: #bce9fb; }
.program-dashboard select.status-select { min-height: 34px; color: var(--text-primary); background: var(--bg-input); border-color: var(--border-strong); }
.program-dashboard select:is(.status-approved, .status-Approved) { color: #a9e9ac; background: #223b2d; border-color: #507b58; }
.program-dashboard select:is(.status-pending, .status-Pending) { color: #f3d393; background: #453923; border-color: #8a7540; }
.program-dashboard select:is(.status-review, .status-Under-Review) { color: #b7e7ff; background: #203a48; border-color: #3f7184; }
.program-dashboard select:is(.status-declined, .status-Declined) { color: #ffb3b9; background: #452b30; border-color: #8d4c54; }

/* Charts, reports and shortlist cards retain their original layout and data. */
.program-dashboard :is(.charts-grid, .reports-grid, .shortlist-grid) { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.program-dashboard :is(.chart-card, .report-card, .shortlist-card) { padding: 20px; }
.program-dashboard :is(.chart-card h3, .report-card h3) { color: var(--text-primary); font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; border-color: var(--border-subtle); }
.program-dashboard .chart-card h3::before { content: ""; display: inline-block; width: 3px; height: 14px; margin-right: 9px; border-radius: 2px; background: var(--accent-primary); vertical-align: -2px; }
.program-dashboard .chart-card canvas { max-width: 100%; }
.program-dashboard .report-card { overflow-x: auto; }
.program-dashboard .report-card h3 span { width: auto; height: auto; padding: 0; border: 0; border-radius: 0; background: transparent; color: #a7eeec; }
.program-dashboard .total-row td { background: #203640 !important; color: var(--text-primary); }
.program-dashboard .shortlist-card { border-left: 3px solid var(--accent-teal); }
.program-dashboard .shortlist-actions, .program-dashboard .shortlist-export-bar { flex-wrap: wrap; }

/* Dialogs: preserve the existing .open toggles and independent scrolling. */
.program-dashboard :is(.modal-overlay, .export-modal-overlay) { background: rgba(4, 9, 13, .78); padding: 16px; }
.program-dashboard :is(.modal, .export-modal) {
  max-width: 780px;
  max-height: min(90vh, 850px);
  overflow: auto;
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}
.program-dashboard .export-modal { max-width: 480px; }
.program-dashboard .modal-header { background: var(--bg-panel-raised); color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.program-dashboard :is(.modal-avatar, .modal-header-avatar) { background: #244451; color: #bce9fb; }
.program-dashboard .modal-close { min-width: 40px; min-height: 40px; background: var(--bg-hover); color: var(--text-primary); border-radius: var(--radius-sm); }
.program-dashboard .modal-close:hover { background: var(--border-strong); }
.program-dashboard :is(.modal-body, .modal-field p, .modal-field span) { color: var(--text-primary); }
.program-dashboard .modal-field { min-width: 0; overflow-wrap: anywhere; }
.program-dashboard .modal-section { background: transparent; border-color: var(--border-subtle); }
.program-dashboard :is(.modal-section-title, .modal-section h4) { color: #8bd7ff; background: transparent; border: 0; border-radius: 0; padding: 0; }
.program-dashboard .modal-text-block { background: var(--bg-input); color: var(--text-primary); }
.program-dashboard .modal-footer { background: var(--bg-panel); border-color: var(--border-subtle); }
.program-dashboard :is(.modal-body th[style*="background"], .modal-body div[style*="background:#f8fafc"]) { background: var(--bg-panel-raised) !important; color: var(--text-primary); }
.program-dashboard :is(.modal-body [style*="color:#15803d"], td [style*="color:#15803d"], td [style*="color:#2e7d32"]) { color: var(--success) !important; }
.program-dashboard .export-modal h3 { color: var(--text-primary); }
.program-dashboard .export-modal p, .program-dashboard .export-option-desc { color: var(--text-secondary); }
.program-dashboard .export-option { display: block; width: 100%; background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-strong); text-align: left; }
.program-dashboard .export-option:hover { border-color: var(--accent-primary); background: var(--bg-hover); }
.program-dashboard .export-option.selected { background: var(--accent-teal-soft); border-color: var(--accent-teal); color: var(--text-primary); }
.program-dashboard :is(.export-option-title, .export-option-desc) { display: block; }
.program-dashboard .export-option-title { color: var(--text-primary); }
.program-dashboard .alert-box { background: #453923; border-color: #8a7540; color: #f3d393; }
.program-dashboard .toast { background: var(--bg-panel-raised); border: 1px solid var(--border-strong); color: var(--text-primary); }

@media (max-width: 1000px) {
  .program-dashboard :is(.header-inner, .header:not(:has(.header-inner))) { flex-wrap: wrap; }
  .program-dashboard .header-text, .program-dashboard .header-left { flex: 1 1 240px; }
  .program-dashboard .header-stats { display: flex; flex: 1 0 100%; order: 3; margin: 0; overflow-x: auto; }
  .program-dashboard .header-right { margin-left: auto; }
  .program-dashboard .header-stats :is(.hstat, .stat-item) { flex: 1 0 105px; }
}
@media (max-width: 767px) {
  .program-dashboard :is(.site-header, .header, .app-header) { position: relative; }
  .program-dashboard :is(.header-inner, .app-header, .header:not(:has(.header-inner))) { padding: 14px 12px; gap: 10px; }
  .program-dashboard .header-left { gap: 8px; }
  .program-dashboard .header-stats { padding-bottom: 3px; }
  .program-dashboard .stats-bar { overflow-x: auto; padding: 0 12px 12px; }
  .program-dashboard :is(.nav-tabs, .tabs, .nav-tabs-inner, .nav-inner) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .program-dashboard :is(.nav-tabs-inner, .nav-inner, .tabs) { width: 100%; padding: 7px 12px; }
  .program-dashboard :is(.nav-tab, .tab, .signout-btn, .sign-out-btn, .back-btn, #backBtn, .header-inner > a) { min-height: 44px; }
  .program-dashboard :is(.main, .main-content, .content) { padding: 16px 12px 32px; }
  .program-dashboard :is(.filter-bar, .toolbar, .shortlist-info) { padding: 12px; }
  .program-dashboard :is(.filter-group, .filter-group.search, .search-box, .toolbar input, .toolbar select) { flex: 1 1 100%; width: 100%; }
  .program-dashboard :is(button, select, input:not([type="checkbox"]):not([type="radio"])) { min-height: 44px; }
  .program-dashboard .filter-actions { width: 100%; }
  .program-dashboard .filter-actions .btn { flex: 1; }
  .program-dashboard :is(.charts-grid, .reports-grid, .shortlist-grid) { grid-template-columns: minmax(0, 1fr); }
  .program-dashboard .modal-grid { grid-template-columns: minmax(0, 1fr); }
  .program-dashboard :is(.modal-body, .modal-header) { padding: 18px 16px; }
  .program-dashboard .modal-header { padding-right: 58px; }
  .program-dashboard .modal-header:has(.modal-header-text) { padding-right: 16px; }
  .program-dashboard .modal-close { min-width: 44px; min-height: 44px; }
  .program-dashboard .export-modal { padding: 20px 16px; }
  .program-dashboard .export-options { grid-template-columns: minmax(0, 1fr); }
  .program-dashboard .shortlist-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media print {
  body.program-dashboard { color-scheme: light; background: white; color: black; }
  .program-dashboard :is(.table-wrap, .chart-card, .report-card, .shortlist-card, table, tbody tr, tbody td) { background: white !important; color: black !important; box-shadow: none; }
  .program-dashboard :is(thead th, .report-table th, .total-row td) { background: #eee !important; color: black !important; }
  .program-dashboard :is(td, th) { border-color: #ccc; }
  .program-dashboard :is(td, th) :is(span.badge, span.sport-badge, span.file-chip, span.status-select) { color: #000 !important; }
  .program-dashboard .report-card h3, .program-dashboard .report-card h3 span { color: #000; }
}
