/* ============================================
   ADMIN PORTAL — Full Dark Theme
   Consistent with Rural Premium public site
   Replaces admin-theme-overrides.css
   ============================================ */

/* ============================================
   1. ADMIN LAYOUT
   ============================================ */
.control-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary, #1a1a2e);
  color: var(--text-primary, #f5f0e8);
}
/* Lock the html/body to viewport height when the admin layout is in use, so
   the only vertical scroller is .content-wrapper inside .control-container.
   Otherwise app.css's `html, body { overflow-y: auto }` produces a second
   outer scrollbar in addition to the inner one. */
html:has(.control-container),
body:has(.control-container) {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}

/* ============================================
   2. COMPACT ADMIN BAR — everything in one row
   ============================================ */
.admin-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: var(--bg-surface, #16213e);
  border-bottom: 1px solid var(--border-color, rgba(184, 150, 90, 0.2));
  position: sticky;
  top: 0;
  z-index: 999;
  flex-shrink: 0;
  height: 28px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  /* Keep horizontal swipe but hide the visible scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.admin-bar::-webkit-scrollbar { display: none; }
/* Inline selects */
.ab-select {
  padding: 2px 4px;
  font-size: 0.75rem;
  border: 1px solid var(--border-color, rgba(184, 150, 90, 0.2));
  border-radius: 3px;
  background: var(--bg-elevated, #0f3460);
  color: var(--text-primary, #f5f0e8);
  cursor: pointer;
  max-width: 160px;
  height: 24px;
}
.ab-select-wide { max-width: 240px; }
.ab-select:focus {
  outline: none;
  border-color: var(--accent-gold, #b8965a);
}
.ab-select option {
  background: var(--bg-surface, #16213e);
  color: var(--text-primary, #f5f0e8);
}
.ab-qr {
  padding: 1px 6px;
  font-size: 0.7rem;
  background: var(--bg-elevated, #0f3460);
  border: 1px solid var(--border-color, rgba(184, 150, 90, 0.2));
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-primary, #f5f0e8);
  height: 24px;
}
.ab-stat {
  font-size: 0.7rem;
  color: var(--accent-gold, #b8965a);
  font-weight: 600;
  white-space: nowrap;
}
.ab-spacer { flex: 1; }
.ab-lights {
  display: flex;
  align-items: center;
  height: 28px;
  overflow: visible;
}
.ab-lights > * {
  transform: scale(0.5);
  transform-origin: center;
}
.ab-btn {
  padding: 1px 6px;
  border: 1px solid var(--border-color, rgba(184, 150, 90, 0.2));
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  height: 20px;
  display: inline-flex;
  align-items: center;
}
.ab-msg {
  background: var(--bg-elevated, #0f3460);
  color: var(--text-primary, #f5f0e8);
}
.ab-msg:hover {
  background: var(--accent-gold, #b8965a);
  color: var(--bg-primary, #1a1a2e);
}
.ab-logout {
  background: transparent;
  color: var(--text-muted, rgba(245, 240, 232, 0.6));
}
.ab-logout:hover {
  background: #c62828;
  color: #fff;
  border-color: #c62828;
}
.ab-user {
  font-size: 0.7rem;
  color: var(--text-secondary, rgba(245, 240, 232, 0.85));
  white-space: nowrap;
}.admin-bar .menu-button {
  min-width: 28px !important;
  height: 24px !important;
  padding: 0 4px !important;
}

/* ============================================
   4. TAB BAR — ultra-compact, includes user controls
   ============================================ */
.tab-control {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px;
  background: var(--bg-elevated, #0f3460);
  border-bottom: 1px solid var(--border-color, rgba(184, 150, 90, 0.2));
  position: sticky;
  top: 28px;
  z-index: 997;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  height: 36px;
  /* Hide the bar visually — overflow-x stays so the row can still scroll on touch */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.tab-control::-webkit-scrollbar { display: none; }
.tab-button {
  padding: 6px 12px;
  border: none;
  background: transparent;
  /* Raised from rgba(245,240,232,0.6) for WCAG AA contrast on the elevated bar */
  color: var(--text-secondary, #d4cdbe);
  font-family: var(--font-family-body, 'Roboto', sans-serif);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.1s;
  white-space: nowrap;
  min-height: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
}
.tab-button:hover {
  color: var(--text-primary, #f5f0e8);
  background: rgba(245, 240, 232, 0.08);
}
.tab-button.active {
  /* Dark navy on gold — WCAG AA contrast 5.65:1
     (white on gold was only 2.78:1, failing AA). */
  color: #1a1a2e;
  font-weight: 700;
  background: var(--accent-gold, #b8965a);
  border-bottom-color: var(--accent-gold, #b8965a);
  border-radius: 3px 3px 0 0;
}
.tab-spacer { flex: 1; }
.tab-info {
  font-size: 0.6rem;
  color: var(--text-muted, rgba(245, 240, 232, 0.5));
  white-space: nowrap;
  margin-right: 4px;
}

/* Bootstrap's form text carries its own near-black (#212529), which is
   invisible on the admin's dark cards - 1.11:1 on Merge Competitors, where
   the "Search Competitors:" label simply was not there.

   There is already a rule for this, but it is scoped to .control-container,
   the AdminHome shell. The standalone routes (Merge, Import, Send
   Notification) render outside that shell and never got it. Scoped to the
   content area instead, with the portal excluded - it does not use
   Bootstrap form classes and styles its own labels. */
.content .form-label:not(.cp-app *),
.content .form-text:not(.cp-app *),
.content .form-check-label:not(.cp-app *),
.content legend:not(.cp-app *) {
  color: var(--text-primary, #f5f0e8);
}

/* ============================================
   5. MAIN CONTENT AREA
   ============================================ */
.content-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.main-content {
  padding: 8px;
}
.main-content .container-fluid {
  overflow: visible !important;
}

/* ============================================
   6. SIDEBAR MENU
   ============================================ */
.sidebar-menu {
  background: var(--bg-primary, #1a1a2e) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
/* Compact the sidebar header so the menu starts higher */
.sidebar-header-modern {
  padding: 10px 14px !important;
}
.sidebar-header-modern h2 {
  font-size: 1.1rem !important;
}.control-container .card,
.clip-dialog .card {
  background: var(--bg-surface, #16213e) !important;
  border: 1px solid var(--border-color, rgba(184, 150, 90, 0.2)) !important;
  color: var(--text-primary, #f5f0e8) !important;
}.control-container .card-header,
.clip-dialog .card-header {
  background: var(--bg-elevated, #0f3460) !important;
  border-bottom: 1px solid var(--border-color, rgba(184, 150, 90, 0.2)) !important;
  color: var(--text-primary, #f5f0e8) !important;
}.control-container .card-body,
.clip-dialog .card-body {
  color: var(--text-primary, #f5f0e8) !important;
  padding: 8px !important;
}
.main-content .card {
  margin-bottom: 4px !important;
}
.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5 {
  margin-bottom: 4px !important;
  margin-top: 0 !important;
}.control-container table.table,
.clip-dialog table.table {
  color: var(--text-primary, #f5f0e8) !important;
}.control-container table.table th,
.clip-dialog table.table th {
  background: var(--bg-elevated, #0f3460) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
}.control-container table.table td,
.clip-dialog table.table td {
  color: var(--text-primary, #f5f0e8) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
}.control-container label,
.control-container .form-label,
.control-container .form-check-label,
.clip-dialog label,
.clip-dialog .form-label,
.clip-dialog .form-check-label {
  color: var(--text-primary, #f5f0e8) !important;
}.control-container .form-control-plaintext,
.clip-dialog .form-control-plaintext {
  color: var(--text-secondary, rgba(245, 240, 232, 0.85)) !important;
}.control-container input.form-control,
.control-container select.form-control,
.control-container textarea.form-control,
.clip-dialog input.form-control {
  background: rgba(245, 240, 232, 0.08) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
}.control-container input.form-control:focus,
.control-container select.form-control:focus,
.clip-dialog input.form-control:focus {
  border-color: var(--accent-gold, #b8965a) !important;
  background: rgba(245, 240, 232, 0.12) !important;
}

/* ============================================
   11. BUTTONS
   ============================================ */
/* Use darker base colors so white text passes WCAG AA (>=4.5:1) at small font
   sizes. Bootstrap defaults (#0d6efd / #198754 / #dc3545) only hit ~3.97:1 with
   white text and fail AA on small buttons. */
.btn-primary {
  background-color: #0a58ca !important;  /* contrast 5.13:1 with white */
  border-color: #0a58ca !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}
.btn-primary:hover {
  background-color: #084298 !important;
  border-color: #084298 !important;
  color: #ffffff !important;
}
.btn-success {
  background-color: #146c43 !important;  /* contrast 5.31:1 with white */
  border-color: #146c43 !important;
  color: #ffffff !important;
}
.btn-success:hover {
  background-color: #0f5132 !important;
  border-color: #0f5132 !important;
  color: #ffffff !important;
}
.btn-danger {
  background-color: #b02a37 !important;  /* contrast 5.20:1 with white */
  border-color: #b02a37 !important;
  color: #ffffff !important;
}
.btn-danger:hover {
  background-color: #842029 !important;
  border-color: #842029 !important;
  color: #ffffff !important;
}
.btn-warning {
  color: #000 !important;
}.control-container .btn-secondary,
.clip-dialog .btn-secondary {
  background-color: rgba(245, 240, 232, 0.1) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
.btn-outline-success {
  color: #4ade80 !important;
  border-color: #4ade80 !important;
}
.btn-outline-success:hover {
  background-color: #4ade80 !important;
  color: #1a1a2e !important;
}
.btn-info {
  background-color: #0a58ca !important;  /* contrast 5.13:1 with white */
  border-color: #0a58ca !important;
  color: #fff !important;
}

/* ============================================
   12. BADGES
   ============================================ */
.badge.bg-warning,
.badge-mini.bg-warning,
.bg-warning {
  color: #212529 !important;
}
.badge.bg-success,
.badge-mini.bg-success {
  color: #fff !important;
}
/* bg-info is cyan (#0dcaf0) — too light for white text (1.96 contrast).
   Force dark text for AA compliance (~14:1). */
.badge.bg-info,
.badge-mini.bg-info,
.bg-info {
  color: #1a1a2e !important;
}
/* Bootstrap utility bg-danger / bg-success / bg-primary backgrounds — match
   the darker button colors so badges/pill text passes AA on small fonts. */
.badge.bg-danger,
.badge-mini.bg-danger,
.bg-danger {
  background-color: #b02a37 !important;
  color: #ffffff !important;
}
.badge.bg-success,
.badge-mini.bg-success,
.bg-success {
  background-color: #146c43 !important;
  color: #ffffff !important;
}
.badge.bg-primary,
.badge-mini.bg-primary,
.bg-primary {
  background-color: #0a58ca !important;
  color: #ffffff !important;
}
.badge.bg-primary,
.badge-mini.bg-primary {
  color: #fff !important;
}
.badge {
  font-size: 11px !important;
}.control-container .alert-info,
.clip-dialog .alert-info {
  background: rgba(96, 165, 250, 0.1) !important;
  border-color: rgba(96, 165, 250, 0.3) !important;
  color: #93c5fd !important;
}.control-container .alert-info h2,
.control-container .alert-info h3,
.control-container .alert-info h4,
.clip-dialog .alert-info h2,
.clip-dialog .alert-info h3,
.clip-dialog .alert-info h4 {
  color: #93c5fd !important;
}.control-container .alert-warning,
.clip-dialog .alert-warning {
  background: rgba(251, 191, 36, 0.1) !important;
  border-color: rgba(251, 191, 36, 0.3) !important;
  color: #fbbf24 !important;
}.control-container .alert-danger,
.clip-dialog .alert-danger {
  background: rgba(248, 113, 113, 0.1) !important;
  border-color: rgba(248, 113, 113, 0.3) !important;
  color: #f87171 !important;
}.control-container .alert-success,
.clip-dialog .alert-success {
  background: rgba(74, 222, 128, 0.1) !important;
  border-color: rgba(74, 222, 128, 0.3) !important;
  color: #4ade80 !important;
}

/* ============================================
   14. NAV TABS (Profile tabs etc.)
   ============================================ */
.nav-tabs .nav-link {
  color: var(--text-muted, rgba(245, 240, 232, 0.6)) !important;
  border-color: transparent !important;
}
.nav-tabs .nav-link:hover {
  color: var(--text-primary, #f5f0e8) !important;
}
.nav-tabs .nav-link.active {
  background: var(--accent-gold, #b8965a) !important;
  color: #fff !important;
  border-color: var(--accent-gold, #b8965a) !important;
}

/* ============================================
   18. TRAFFIC LIGHTS (Ready Lights)
   ============================================ */
.traffic-light.red {
  background-color: #CC0000 !important;
}
.traffic-light.green {
  background-color: #1B7A1B !important;
}

/* ============================================
   19. COMPETITOR TILES (Results grid — white bg cards)
   ============================================ */
/* ============================================
   19. RESULTS SCORING AREA
   The results entry uses white/light bg containers for the scoring grid.
   All text inside must be dark. Keep white bg for scoring UX.
   ============================================ */
.competitor-tile {
  color: #212529 !important;
  background: #f9f9f9 !important;
}
/* State-based tile colors — override the default white */
.competitor-tile.tile-published {
  background: #e8f5e9 !important;
  border-color: #66bb6a !important;
}
.competitor-tile.tile-pending {
  background: #fff8e1 !important;
  border-color: #ffb300 !important;
}
.competitor-tile.tile-dq {
  background: #ffebee !important;
  border-color: #ef5350 !important;
}
.competitor-tile.tile-dnc {
  background: #fce4ec !important;
  border-color: #ec407a !important;
}.competitor-tile *,
.competitor-tile .competitor-name,
.competitor-tile input,
.competitor-tile select,
.competitor-tile span,
.competitor-tile label {
  color: #212529 !important;
}
/* The score itself was rendering at about 1.03:1 - the number a judge
   actually reads was invisible on the tile.

   The cause is admin-responsive.css's
     .control-container .card span:not(.badge) { color: var(--text-primary) !important }
   which paints every span inside any card with the dark theme's near-white,
   including spans sitting on tiles that are deliberately light. That
   selector is 0-3-1, so it also beat the page's own
   .published-points !important (0-1-0). These are 0-4-0 to clear it
   without touching a rule the rest of the admin relies on. */
.control-container .competitor-tile .published-points:not(.badge) {
  color: #1b5e20 !important;   /* 6.4:1 on #e8f5e9 */
}
.control-container .competitor-tile .unpublished-points:not(.badge) {
  color: #96500a !important;   /* 4.6:1 on #fff8e1 */
}
.control-container .competitor-tile .status:not(.badge),
.control-container .competitor-tile .disqualified:not(.badge),
.control-container .competitor-tile .did-not-complete:not(.badge) {
  color: #b3261e !important;
}
/* Results entry — ensure all stands fit on page */
.results-grid,
.results-container,
.stand-columns {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 2px !important;
}
.stand-column {
  min-width: 130px !important;
  flex: 1 1 0 !important;
}
/* The scoring table area — white bg with dark text */
.scoring-area,
.scoring-table,
.result-entry-container,
table.scoring-table {
  background: #fff !important;
  color: #212529 !important;
}
.scoring-area *,
.result-entry-container *,
table.scoring-table * {
  color: #212529 !important;
}
/* Scoring inputs */
.scoring-area input,
.scoring-area select,
.result-entry-container input,
.result-entry-container select {
  color: #212529 !important;
  background: #fff !important;
}
/* "Raw", "Calculated" labels, DNC/DISQ buttons — make visible on light
   scoring tiles. Exclude EditResults scoring grid spans (.total-number,
   .total-hidden, .calc-display) which now have their own dark theme colors. */
.scoring-label,
.points-label,
td label {
  color: #333 !important;
}
.competitor-tile td span:not(.calc-display):not(.total-number):not(.total-hidden) {
  color: #333 !important;
}
/* Stand header names in results */
.stand-header-name,
.competitor-header {
  color: var(--text-primary, #f5f0e8) !important;
}
/* Any container that looks like it has the scoring white bg */
[class*="result-entry"] {
  color: #212529 !important;
}
[class*="result-entry"] * {
  color: inherit !important;
}

/* ============================================
   20. LIST GROUP ITEMS
   ============================================ */
/* List group items — force dark bg everywhere */
.list-group-item,
.list-group > .list-group-item,
.card-body .list-group-item,
div.list-group-item {
  background: var(--bg-surface, #16213e) !important;
  background-color: var(--bg-surface, #16213e) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
.list-group-item *:not(.badge):not(.badge-mini):not(.btn) {
  color: var(--text-primary, #f5f0e8) !important;
}
/* Class cards in classes tab */
.class-card-compact {
  background: var(--bg-surface, #16213e) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
}
.session-header-compact,
.session-header-compact h4 {
  background: var(--bg-elevated, #0f3460) !important;
  color: var(--text-primary, #f5f0e8) !important;
  font-family: 'Roboto', sans-serif !important;
}

/* ============================================
   21. CLASS CARDS
   ============================================ */
.class-card-compact,
.class-card-compact *:not(.badge):not(.badge-mini) {
  color: var(--text-primary, #f5f0e8) !important;
}
.class-name-compact {
  color: var(--text-primary, #f5f0e8) !important;
}

/* ============================================
   22a. COMPETITION CARDS
   ============================================ */
.card .competition-card,
.card .card-body .competition-card {
  position: relative;
}
.card .competition-card .badge,
.card .competition-card .badge-mini {
  position: relative !important;
  display: inline-block !important;
  margin-right: 4px !important;
  margin-bottom: 4px !important;
}

/* ============================================
   22b. REVIEW PHOTOS — tiles need dark text on white bg
   ============================================ */
.photo-review-card,
.photo-card,
.competitor-photo-card {
  background: #ffffff !important;
  color: #212529 !important;
}
.photo-review-card *,
.photo-card *,
.competitor-photo-card * {
  color: #212529 !important;
}

/* ============================================
   22. NESTED CARDS (subscription info etc.)
   ============================================ */
.card .card {
  background: rgba(245, 240, 232, 0.05) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
  color: var(--text-primary, #f5f0e8) !important;
}

/* ============================================
   23. TEXT UTILITIES
   ============================================ */
.text-muted {
  color: rgba(245, 240, 232, 0.7) !important;
}
/* Headings in admin — use Roboto not Bebas Neue to avoid ALL CAPS clipping */
.control-container h3,
.control-container h4,
.control-container h5,
.control-container h6 {
  color: var(--text-primary, #f5f0e8) !important;
  font-family: 'Roboto', sans-serif !important;
  font-weight: 600 !important;
}.control-container p,
.clip-dialog p {
  color: var(--text-primary, #f5f0e8);
}

/* ============================================
   23b. ENTRIES TAB — entry rows with light bg need dark text
   ============================================ */
.entry-item-compact,
.entry-item-compact * {
  color: #212529 !important;
}
.entry-item-compact .badge,
.entry-item-compact .badge-mini {
  color: unset;
}
.entry-item-compact .badge.bg-success,
.entry-item-compact .badge-mini.bg-success {
  color: #fff !important;
}
.entry-item-compact .badge.bg-warning,
.entry-item-compact .badge-mini.bg-warning {
  color: #212529 !important;
}

/* ============================================
   23c. STAND ALLOCATIONS — full width, no double scroll
   ============================================ */
.stand-allocation-grid,
.stand-allocations {
  overflow-x: auto !important;
  overflow-y: visible !important;
  width: 100% !important;
}
.stand-allocation-grid .card {
  background: var(--bg-surface, #16213e) !important;
  min-width: 0 !important;
}
/* Stand column headers */
.stand-allocations h3,
.stand-allocations h5 {
  color: var(--text-primary, #f5f0e8) !important;
  font-family: 'Roboto', sans-serif !important;
}.stand-allocations .card-body .card {
  background: var(--bg-surface, #16213e) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border-color: var(--border-color, rgba(184, 150, 90, 0.2)) !important;
}

/* ============================================
   24. SCROLLBAR STYLING
   ============================================ */
.content-wrapper::-webkit-scrollbar {
  width: 8px;
}
.content-wrapper::-webkit-scrollbar-track {
  background: var(--bg-primary, #1a1a2e);
}
.content-wrapper::-webkit-scrollbar-thumb {
  background: rgba(184, 150, 90, 0.3);
  border-radius: 4px;
}
.content-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(184, 150, 90, 0.5);
}

/* ============================================
   25a. PHOTO REVIEW CARDS — white bg with dark text
   ============================================ */
.photo-review-card,
.photo-card,
[class*="photo-card"],
[class*="photo-review"] {
  color: #212529 !important;
}
.photo-review-card *,
.photo-card *,
[class*="photo-card"] *,
[class*="photo-review"] * {
  color: #212529 !important;
}

/* ============================================
   25b. GENERIC WHITE-BG CONTAINERS — ensure dark text
   ============================================ */
.bg-white,
.bg-light,
[class*="bg-white"],
[class*="bg-light"] {
  color: #212529 !important;
}
.bg-white *:not(.badge):not(.btn),
.bg-light *:not(.badge):not(.btn) {
  color: inherit !important;
}

/* ============================================
   26. RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .ab-select { max-width: 130px; font-size: 0.7rem; }
  .ab-select-wide { max-width: 180px; }
  .ab-lights { display: none; }
  .ab-info { display: none; }
}
@media (max-width: 768px) {
  /* Both bars are single-row strips on desktop, with a fixed height and
     vertical overflow hidden so they never grow. Allowing them to wrap here
     without also releasing that height meant the wrapped rows were laid out
     inside a 28px / 36px box and clipped: on a phone the competition picker
     was sliced in half, the menu button lost its bottom, and the second row
     of tabs was invisible. Wrapping and a fixed height cannot both apply. */
  .admin-bar {
    flex-wrap: wrap;
    gap: 3px;
    height: auto;
    min-height: 28px;
    overflow-x: visible;
    overflow-y: visible;
    padding: 4px 6px;
  }
  .ab-select { max-width: 100%; flex: 1 1 45%; }
  .ab-select-wide { max-width: 100%; }

  /* The bar is a deliberately compact desktop strip: 24px selects, 20px
     buttons, 10px labels. That is unusable with a thumb, and a 16px floor
     on the selects is also what stops iOS zooming the page on focus. */
  .admin-bar .ab-select {
    /* height:auto matters more than it looks. The base rules pin these to a
       fixed height (24px selects, 20px buttons) for the compact desktop
       strip. Raising min-height stretches the border box, but Safari still
       lays a <select>'s text out against `height` - so on an actual iPhone
       the box grew and the text stayed clipped in the middle of it, while
       Chromium at the same width looked perfect. Clearing the height is what
       fixes it; min-height alone is not enough. */
    height: auto;
    min-height: 40px;
    font-size: max(16px, 0.875rem);
    padding: 4px 8px;
    /* A select's min-content width is set by its longest option, so without
       this they refuse to shrink and each takes a whole row - five rows of
       chrome before any content. */
    min-width: 0;
  }
  /* Msg and Logout sit in the tab strip, not the admin bar. */
  .admin-bar .ab-btn,
  .tab-control .ab-btn,
  .admin-bar .ab-qr {
    height: auto;
    min-height: 36px;
    min-width: 44px;
    font-size: 0.8rem;
    padding: 4px 10px;
  }
  /* The base rule pins this to 28x24 with !important, which is too small
     to hit reliably with a thumb - and it is the only way into the menu. */
  .admin-bar .menu-button {
    min-width: 44px !important;
    height: 40px !important;
    padding: 0 8px !important;
  }
  .tab-info,
  .admin-bar .tab-info { font-size: 0.75rem; }

  /* A floor for every control on an admin page, not just the ones I happened
     to open. The admin is full of 16-26px compact controls that are fine with
     a mouse and are thumb targets at this width. min-height only, so anything
     already larger is untouched, and 16px on text inputs is what stops iOS
     zooming the page on focus.

     Scoped to the whole content area rather than .main-content because the
     standalone admin routes (Send Notification, Import, Merge) render outside
     the AdminHome shell. The portal is excluded - it sets its own 44px
     targets and should not be second-guessed here. */
  .content select:not(.cp-app *),
  .content input:not([type=checkbox]):not([type=radio]):not([type=range]):not(.cp-app *),
  .content textarea:not(.cp-app *),
  .content .btn:not(.cp-app *) {
    min-height: 36px;
  }
  .content select:not(.cp-app *),
  .content input:not([type=checkbox]):not([type=radio]):not([type=range]):not(.cp-app *),
  .content textarea:not(.cp-app *) {
    font-size: max(16px, 0.875rem);
    /* See the note on .admin-bar .ab-select: a page-level fixed height plus a
       raised min-height clips the text in Safari even though the box grows.
       Only the text fields get this - buttons are left alone, since some of
       them use an explicit height for alignment. */
    height: auto;
  }
  .content input[type=checkbox]:not(.cp-app *),
  .content input[type=radio]:not(.cp-app *) {
    min-width: 20px;
    min-height: 20px;
  }
  .ab-user { font-size: 0.8rem; }
  .tab-control {
    flex-wrap: wrap;
    gap: 2px;
    top: auto;
    position: relative;
    height: auto;
    min-height: 36px;
    overflow-x: visible;
    padding: 3px 4px;
  }
  .tab-button {
    flex: 1 1 calc(50% - 2px);
    font-size: 0.7rem;
    padding: 3px 6px;
    text-align: center;
  }
}

/* ============================================
   30. DOOR LIST — competitor name text visibility
   ============================================ */
.custom-grid-text,
.custom-grid-text b {
  color: #f5f0e8 !important;
}

/* ============================================
   31. ENTRIES PAGE — white-bg containers need dark text
   ============================================ */
.header-card,
.header-card * {
  color: #ffffff !important;
}
.stats-card,
.stats-card * {
  color: #212529 !important;
}
.stats-card .btn {
  color: inherit !important;
}
.entries-container,
.entries-header,
.entries-count,
.search-section,
.search-container {
  color: #212529 !important;
}

/* ============================================
   32. BUTTON CONSISTENCY — compact across the admin portal
   Override mobile-first.css touch-target min-heights (44px)
   ============================================ */
/* Default Bootstrap buttons in admin pages — compact */
.main-content .btn,
.admin-bar .btn,
.tab-control .btn {
  padding: 3px 10px !important;
  font-size: 0.78rem !important;
  font-weight: 500;
  line-height: 1.4 !important;
  height: 26px !important;
  min-height: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  white-space: nowrap;
  border-radius: 4px;
}
/* btn-sm even more compact */
.main-content .btn-sm,
.admin-bar .btn-sm {
  padding: 2px 8px !important;
  font-size: 0.72rem !important;
  height: 24px !important;
  min-height: 0 !important;
  border-radius: 3px;
}
/* btn-lg — only slightly larger */
.main-content .btn-lg {
  padding: 4px 12px !important;
  font-size: 0.85rem !important;
  height: 30px !important;
  min-height: 0 !important;
}
/* Icons inside buttons */
.main-content .btn i,
.main-content .btn .fas,
.main-content .btn .far {
  font-size: 0.75rem;
  margin-right: 2px;
}
.main-content .btn-sm i,
.main-content .btn-sm .fas,
.main-content .btn-sm .far {
  font-size: 0.7rem;
}

/* Ensure buttons on the same row align vertically */
.d-flex.gap-2,
.d-flex.flex-wrap.gap-2,
.d-flex.gap-1 {
  align-items: center;
}
/* Also fix any card containers that have overflow set */
.main-content .card {
  overflow: visible !important;
}
.main-content .card-body {
  overflow: visible !important;
}

/* ============================================
   35. CLASSES PAGE — buttons handled by global rules above
   ============================================ */

/* ============================================
   36. TAB BAR — active tab styling improvement
   ============================================ */
.tab-button.active {
  /* Dark navy on gold — WCAG AA contrast 5.65:1 */
  color: #1a1a2e;
  font-weight: 700;
  background: var(--accent-gold, #b8965a);
  border-radius: 6px 6px 0 0;
  border-bottom-color: var(--accent-gold, #b8965a);
}

/* ============================================
   32. SESSION MODAL — date/time text on dark card headers
   ============================================ */
.card-header .text-muted {
  color: rgba(245, 240, 232, 0.7) !important;
}
/* EditResults scoring grid is now fully dark-themed via its own local CSS in
   EditResults.razor — no overrides needed here. The competitor-tile (used in
   the Results.razor parent grid) is still intentionally light-themed for the
   scoring UX, so we keep its dark text override. */
.competitor-tile,
.competitor-tile * {
  color: #1a1a2e !important;
}.main-content .form-group,
.clip-dialog .form-group {
  margin-bottom: 0.5rem !important;
}.main-content .form-group label,
.main-content label.form-label,
.clip-dialog .form-group label,
.clip-dialog label.form-label {
  font-size: 0.8rem !important;
  font-weight: 500;
  margin-bottom: 2px !important;
  color: var(--text-primary, #f5f0e8) !important;
  display: block;
}

/* ============================================
   40. PRINT CARDS DIALOG — dark theme
   ============================================ */
.print-cards-dialog .print-cards-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.print-cards-dialog .print-cards-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #f5f0e8);
}
.print-cards-dialog .print-cards-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted, rgba(245, 240, 232, 0.7));
}
.print-cards-dialog .print-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 12px;
}
.print-cards-dialog .print-card {
  background: var(--bg-elevated, #0f3460) !important;
  border: 1px solid rgba(184, 150, 90, 0.25);
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
}
.print-cards-dialog .print-card-label {
  color: #fff;
  padding: 6px 8px;
  border-radius: 3px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.78rem;
  text-align: center;
}
.print-cards-dialog .print-card-label-blue {
  background: #1e6fb8;
}
.print-cards-dialog .print-card-label-green {
  background: #1e8449;
}
.print-cards-dialog .print-card-label-red {
  background: #b03a48;
}
.print-cards-dialog .print-card-label-grey {
  background: #5a6168;
}
.print-cards-dialog .print-card-field-label {
  font-size: 0.75rem;
  color: var(--text-muted, rgba(245, 240, 232, 0.7));
  margin-bottom: 4px;
  display: block;
}
.print-cards-dialog .print-card-help {
  font-size: 0.72rem;
  color: var(--text-muted, rgba(245, 240, 232, 0.6));
  margin-bottom: 8px;
  flex-grow: 1;
}
.print-cards-dialog .print-card .btn {
  margin-top: auto;
}

/* Consolidated modal title header layout — used by Venues.razor and any new
   header that wants the standard title-with-close-button pattern. */
.modal-title-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100%;
  font-weight: 600;
}
/* Bootstrap .img-thumbnail wraps images in a white box — make transparent
   on dark theme so just the image shows. */
.img-thumbnail {
  background-color: transparent !important;
  border-color: rgba(184, 150, 90, 0.3) !important;
  padding: 2px !important;
}

/* Bootstrap .btn-light is white-on-light by default — convert to dark theme */
.btn-light {
  background-color: rgba(245, 240, 232, 0.1) !important;
  border-color: rgba(184, 150, 90, 0.3) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
.btn-light:hover {
  background-color: rgba(245, 240, 232, 0.18) !important;
  color: var(--text-primary, #f5f0e8) !important;
}.audit-log-select {
  background-color: var(--bg-elevated, #0f3460) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border: 1px solid rgba(184, 150, 90, 0.3) !important;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.78rem;
}.audit-log-select option {
  background-color: var(--bg-elevated, #0f3460);
  color: var(--text-primary, #f5f0e8);
}

/* AuditLog page header */
.audit-log-header {
  background: var(--bg-elevated, #0f3460);
  padding: 8px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(184, 150, 90, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.enter-comp-modal .ec-modal-title {
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary, #f5f0e8);
}
.enter-comp-modal .ec-modal-body {
  padding: 12px;
}
/* Single-row control bar with date/time, options, and create-new button */
.enter-comp-modal .ec-control-bar {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
  background: var(--bg-elevated, #0f3460);
  border: 1px solid rgba(184, 150, 90, 0.2);
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.enter-comp-modal .ec-section {
  flex: 0 0 auto;
}
.enter-comp-modal .ec-section-right {
  margin-left: auto;
}.clip-dialog .enter-comp-modal .ec-section-label,
.enter-comp-modal .ec-section-label {
  font-size: 0.65rem;
  color: var(--accent-gold, #b8965a) !important;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.enter-comp-modal .ec-checkbox-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.enter-comp-modal .ec-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.enter-comp-modal .ec-checkbox-row label {
  margin: 0;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-primary, #f5f0e8);
}
.enter-comp-modal .ec-helper {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--text-muted, rgba(245, 240, 232, 0.6));
}
.enter-comp-modal .ec-new-btn {
  font-weight: 600;
  white-space: nowrap;
}

/* Search row */
.enter-comp-modal .ec-search-row {
  margin-bottom: 8px;
}
.enter-comp-modal .ec-search-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary, #f5f0e8);
  margin-bottom: 4px;
}

/* Override the .section-card legacy styling inside this modal so the
   competitor list isn't pushed down by oversized headers. */
.enter-comp-modal .section-card {
  margin-top: 0 !important;
  padding: 8px 10px !important;
  max-height: 480px !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.enter-comp-modal .section-header {
  margin-bottom: 6px !important;
  padding-bottom: 4px !important;
  flex: 0 0 auto !important;
}
.enter-comp-modal .section-header h5 {
  font-size: 0.85rem !important;
}
.audit-log-header-left,
.audit-log-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.audit-log-header h5 {
  color: var(--text-primary, #f5f0e8);
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* ============================================
   43. ENTER COMPETITOR DIALOG header
   ============================================ */
.enter-competitor-header {
  width: 100%;
}
.enter-competitor-header .ech-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.enter-competitor-header .ech-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #f5f0e8);
}
.enter-competitor-header .ech-subtitle {
  margin: 2px 0 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, rgba(245, 240, 232, 0.7));
}
.enter-competitor-header .ech-options {
  background: rgba(184, 150, 90, 0.08);
  border: 1px solid rgba(184, 150, 90, 0.18);
  padding: 8px 10px;
  border-radius: 4px;
  margin-top: 6px;
}
.enter-competitor-header .ech-options-row {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.enter-competitor-header .ech-section {
  flex: 0 0 auto;
}
.enter-competitor-header .ech-section-label {
  font-size: 0.65rem;
  color: var(--accent-gold, #b8965a);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.enter-competitor-header .ech-checkbox-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.enter-competitor-header .ech-checkbox-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.enter-competitor-header .ech-checkbox-row label {
  margin: 0;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text-primary, #f5f0e8);
}
.enter-competitor-header .ech-helper {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--text-muted, rgba(245, 240, 232, 0.6));
}
.enter-competitor-header .ech-info {
  flex: 1 1 200px;
  align-self: center;
}
.enter-competitor-header .ech-info p {
  margin: 0;
  color: var(--text-muted, rgba(245, 240, 232, 0.7));
  font-size: 0.72rem;
  font-style: italic;
}

/* ============================================
   44. EditEntries page — dark theme overrides for legacy white cards
   ============================================ */
.stats-card,
.search-section,
.entries-container,
.auth-card {
  background: var(--bg-elevated, #0f3460) !important;
  border: 1px solid rgba(184, 150, 90, 0.18) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
/* Recolor common text elements only — don't touch buttons, badges, or any
   element with a deliberate semantic color (.text-success, .text-danger, etc). */
.stats-card h1, .stats-card h2, .stats-card h3, .stats-card h4, .stats-card h5,
.stats-card p, .stats-card span, .stats-card label, .stats-card div,
.search-section h1, .search-section h2, .search-section h3, .search-section h4, .search-section h5,
.search-section p, .search-section span, .search-section label, .search-section div,
.entries-container h1, .entries-container h2, .entries-container h3, .entries-container h4, .entries-container h5,
.entries-container p, .entries-container span, .entries-container label, .entries-container div,
.auth-card h1, .auth-card h2, .auth-card h3, .auth-card h4, .auth-card h5,
.auth-card p, .auth-card span, .auth-card label, .auth-card div {
  color: var(--text-primary, #f5f0e8);
}
/* But preserve semantic Bootstrap text utility classes inside these cards */
.stats-card .text-success, .search-section .text-success,
.entries-container .text-success, .auth-card .text-success { color: #28a745 !important; }
.stats-card .text-danger, .search-section .text-danger,
.entries-container .text-danger, .auth-card .text-danger { color: #dc3545 !important; }
.stats-card .text-warning, .search-section .text-warning,
.entries-container .text-warning, .auth-card .text-warning { color: var(--accent-gold, #b8965a) !important; }
.stats-card .text-info, .search-section .text-info,
.entries-container .text-info, .auth-card .text-info { color: #17a2b8 !important; }
.stats-card .text-muted, .search-section .text-muted,
.entries-container .text-muted, .auth-card .text-muted { color: var(--text-muted, rgba(245, 240, 232, 0.6)) !important; }
.stats-divider,
.stats-max,
.stats-label {
  color: var(--text-muted, rgba(245, 240, 232, 0.7)) !important;
}
.stats-number {
  background: linear-gradient(135deg, var(--accent-gold, #b8965a) 0%, #d4a76a 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
}
.entries-header {
  background: linear-gradient(135deg, rgba(184, 150, 90, 0.15) 0%, rgba(184, 150, 90, 0.05) 100%) !important;
  border-bottom: 1px solid rgba(184, 150, 90, 0.25) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
.search-icon {
  color: var(--text-muted, rgba(245, 240, 232, 0.5)) !important;
}

/* ============================================
   45. AddEntry / Modern Card overrides — dark theme
   ============================================ */
.main-card {
  background: var(--bg-elevated, #0f3460) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border: 1px solid rgba(184, 150, 90, 0.2) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}
.card-header-modern {
  background: linear-gradient(135deg, rgba(184, 150, 90, 0.25) 0%, rgba(184, 150, 90, 0.1) 100%) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border-bottom: 1px solid rgba(184, 150, 90, 0.3) !important;
}
.header-icon {
  background: rgba(184, 150, 90, 0.25) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
.card-body-modern {
  background: var(--bg-surface, #16213e) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
.section-card {
  background: var(--bg-elevated, #0f3460) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border: 1px solid rgba(184, 150, 90, 0.18) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}
.section-header {
  border-bottom: 2px solid rgba(184, 150, 90, 0.2) !important;
}
.section-header h5 {
  color: var(--text-primary, #f5f0e8) !important;
}
.combined-row {
  background: var(--bg-elevated, #0f3460) !important;
  border: 1px solid rgba(184, 150, 90, 0.2) !important;
  color: var(--text-primary, #f5f0e8) !important;
}
.checkbox-label {
  color: var(--text-primary, #f5f0e8) !important;
}
.btn-compact,
.btn-compact-default {
  background: var(--bg-elevated, #0f3460) !important;
  color: var(--text-primary, #f5f0e8) !important;
  border-color: rgba(184, 150, 90, 0.3) !important;
}
.btn-compact-default:hover:not(:disabled) {
  background: rgba(184, 150, 90, 0.15) !important;
}

/* ============================================
   46. ACCESSIBILITY & FEEDBACK — focus ring, form controls, spinner
   ============================================ */
/* Visible keyboard focus ring on every interactive control (design system §4) */
:focus-visible {
  outline: 2px solid var(--border-strong, #3A4A7A);
  outline-offset: 2px;
}

/* Checkboxes / radios legible on dark surfaces */
input[type="checkbox"],
input[type="radio"] {
  accent-color: #B8965A;
}

/* Small inline spinner for busy buttons (export/print/PDF) */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spinner-rotate 0.7s linear infinite;
}
@keyframes btn-spinner-rotate {
  to { transform: rotate(360deg); }
}
