/* ============================================================================
   Game Day Lineup Screen - Compact Table Layout
   ============================================================================ */

.screen-game-day-lineup {
  max-width: none;
  margin: 0 auto;
}

.lineup-container {
  padding: var(--space-2);
}

.loading-state {
  text-align: center;
  padding: var(--space-6);
}

/* ============================================================================
   GroupMe Sync Warning Banner
   ============================================================================ */
.groupme-warning {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-2) 0;
  border-radius: var(--radius-md);
  font-size: 0.85em;
  line-height: 1.4;
}

.groupme-warning-icon { font-size: 1.2em; flex-shrink: 0; }
.groupme-warning-warning { background: #fff3cd; border: 1px solid #ffc107; color: #856404; }
.groupme-warning-error { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }

.btn-groupme-refresh {
  display: inline-block;
  padding: 2px 10px;
  margin-left: var(--space-2);
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.6);
  color: inherit;
  font-size: 0.9em;
  cursor: pointer;
  white-space: nowrap;
}
.btn-groupme-refresh:hover { background: rgba(255,255,255,0.9); }
.btn-groupme-refresh:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================================
   Controls Row (formation + roster size + actions inline)
   ============================================================================ */
.lineup-controls-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  flex-wrap: wrap;
}

.formation-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
}
.formation-label {
  color: var(--gray-600);
  white-space: nowrap;
}
.formation-label strong {
  color: var(--gray-800);
}
.formation-vs {
  color: var(--gray-400);
  font-style: italic;
  font-size: 0.8em;
}
#opponent-formation-select {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-300);
  background: white;
  font-size: 0.9em;
  max-width: 90px;
}

.roster-size-selector {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.roster-size-selector label {
  font-weight: 600;
  font-size: 0.85em;
  color: var(--gray-600);
}

.roster-size-toggle {
  display: flex;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.btn-roster-size {
  padding: 3px 10px;
  border: none;
  background: white;
  font-size: 0.8em;
  font-weight: 500;
  cursor: pointer;
  color: var(--gray-600);
}
.btn-roster-size + .btn-roster-size { border-left: 1px solid var(--gray-300); }
.btn-roster-size.active {
  background: var(--primary-color, #2563eb);
  color: white;
  font-weight: 600;
}
.btn-roster-size:hover:not(.active) { background: var(--gray-100); }

.lineup-actions-inline {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}

/* ============================================================================
   Select Mode Banner
   ============================================================================ */
.select-mode-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: var(--radius-sm);
  margin: var(--space-2) 0;
  font-size: 0.85em;
  color: #92400e;
  font-weight: 500;
}

.pitch-slot.slot-selecting {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.25);
  animation: pulse-select 1.2s ease-in-out infinite;
}
@keyframes pulse-select {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
}

.roster-selecting .rt-player-row {
  cursor: pointer;
}
.roster-selecting .rt-player-row:hover {
  background: #fef3c7 !important;
}

/* ============================================================================
   Overlay Toggle Dropdown
   ============================================================================ */
.overlay-toggles {
  display: flex;
  align-items: center;
}
.overlay-select {
  padding: 4px 8px;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: var(--radius-sm, 4px);
  background: white;
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  color: var(--gray-700, #374151);
}
.overlay-select:focus {
  outline: 2px solid #4338ca;
  outline-offset: 1px;
}

/* ============================================================================
   Pitch + Overlay Container
   ============================================================================ */
.pitch-overlay-container {
  position: relative;
  margin-top: var(--space-2);
}

.pitch-fullsize-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-3);
  padding: 4px var(--space-2);
  font-size: 0.85em;
  font-weight: 600;
  color: var(--gray-700);
}
.header-sep { color: var(--gray-300); }

/* Pitch + Bench side-by-side layout */
.pitch-and-bench {
  display: flex;
  gap: 0;
  align-items: stretch;
}

/* Full-size Pitch Wrapper */
.pitch-fullsize-wrapper {
  flex: 1;
  min-width: 0;
  border: 2px solid #16a34a;
  border-radius: var(--radius-md);
  background: rgba(22, 163, 74, 0.03);
  padding: var(--space-1);
}

.pitch-fullsize {
  padding-bottom: 150%;
  max-height: none;
}

/* Fit to screen: fullscreen mode — everything in viewport, zero scroll */
.lineup-fit-screen {
  position: fixed !important;
  inset: 0;
  z-index: 9000;
  background: var(--bg-color, #fff);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0 !important;
  max-width: none !important;
}
.lineup-fit-screen .screen-header {
  display: none;
}
.lineup-fit-screen .lineup-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2px 4px;
  overflow: hidden;
}
.lineup-fit-screen #lineup-content {
  flex: 1;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}
.lineup-fit-screen .groupme-warning { display: none !important; }
.lineup-fit-screen .lineup-controls-row {
  flex-shrink: 0;
  padding: 2px 0;
  gap: 4px;
  font-size: 0.75em;
}
.lineup-fit-screen .select-mode-banner { flex-shrink: 0; }
.lineup-fit-screen .pitch-overlay-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.lineup-fit-screen .pitch-fullsize-header {
  flex-shrink: 0;
  padding: 1px 4px;
  font-size: 0.7em;
}
.lineup-fit-screen .pitch-and-bench {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.lineup-fit-screen .pitch-pool-area {
  overflow: hidden;
}
.lineup-fit-screen .pool-list {
  overflow-y: auto;
  min-height: 0;
}
.lineup-fit-screen .pitch-fullsize-wrapper {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 2px;
}
.lineup-fit-screen .pitch-fullsize {
  padding-bottom: 0 !important;
  height: 100% !important;
}
.lineup-fit-screen .pitch-bench-area {
  overflow: hidden;
}
.lineup-fit-screen .bench-seats {
  overflow: hidden !important;
}
.lineup-fit-screen .zone-chip {
  min-width: 32px;
  padding: 1px;
}
.lineup-fit-screen .zone-chip .chip-circle {
  width: 22px;
  height: 22px;
  font-size: 0.5em;
}
.lineup-fit-screen .zone-chip .chip-name {
  font-size: 0.4em;
  max-width: 40px;
}
.lineup-fit-screen .bench-seat {
  min-height: 24px;
  padding: 1px;
  flex: 0 0 auto;
}
.lineup-fit-screen .bench-seat .zone-chip .chip-circle {
  width: 20px;
  height: 20px;
}
.lineup-fit-screen .pitch-player-chip .chip-circle {
  width: 24px;
  height: 24px;
  font-size: 0.5em;
}
.lineup-fit-screen .pitch-player-chip .chip-name {
  font-size: 0.4em;
}
.lineup-fit-screen .pitch-player-chip .chip-badge {
  display: none;
}
.lineup-fit-screen .policy-bar { display: none; }
.lineup-fit-screen .roster-overlay-panel {
  max-height: 100%;
}

/* ============================================================================
   Player Pool, Bench
   ============================================================================ */

/* Player Pool — scrollable list on the left side */
.pitch-pool-area {
  display: none;
}
.pool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  flex-shrink: 0;
  gap: 4px;
}
.pool-label {
  font-size: 0.65em;
  font-weight: 700;
  color: var(--gray-500, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pool-sort-select {
  font-size: 0.6em;
  padding: 1px 2px;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 3px;
  background: white;
  color: var(--gray-600, #4b5563);
  cursor: pointer;
  flex-shrink: 0;
}
.pool-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

/* Pool row — compact colored text row */
.pool-row {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  cursor: pointer;
  user-select: none;
  border-radius: 3px;
  font-size: 0.85em;
  line-height: 1.3;
  transition: background 0.12s;
  white-space: nowrap;
  overflow: hidden;
}
.pool-row:hover { background: var(--gray-200, #e5e7eb); }
.pool-row.dragging, .pool-row.touch-dragging { opacity: 0.4; }

.pool-rsvp {
  font-size: 0.8em;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}
.pool-rsvp.rsvp-yes { color: #16a34a; }
.pool-rsvp.rsvp-no { color: #dc2626; }
.pool-rsvp.rsvp-unknown { color: #9ca3af; }
.pool-jersey {
  font-size: 0.75em;
  color: var(--gray-400, #9ca3af);
  flex-shrink: 0;
  min-width: 20px;
}
.pool-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--gray-800, #1f2937);
  min-width: 0;
}

.pool-prac {
  font-size: 0.75em;
  color: var(--gray-400, #9ca3af);
  flex-shrink: 0;
  min-width: 14px;
  text-align: right;
}

/* Eligibility colors on pool rows */
.pool-row.eligibility-priority { background: #fef9e7; border-left: 3px solid #fbbf24; }
.pool-row.eligibility-eligible { background: #ecfdf5; border-left: 3px solid #34d399; }
.pool-row.eligibility-bench { background: #eff6ff; border-left: 3px solid #60a5fa; }
.pool-row.eligibility-ineligible { background: #fef2f2; border-left: 3px solid #f87171; opacity: 0.6; }

/* Bench — brown sideline running down the right side of the pitch */
.pitch-bench-area {
  width: 80px;
  flex-shrink: 0;
  background: linear-gradient(90deg, #8B6914 0%, #6B4F10 100%);
  border: 2px solid #5a4210;
  border-left: none;
  border-radius: 0 var(--radius-md, 6px) var(--radius-md, 6px) 0;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0;
}
.bench-label {
  font-size: 0.55em;
  font-weight: 600;
  color: #fef3c7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  text-align: center;
  margin-bottom: 2px;
}

.bench-seats {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  padding: 1px 0;
  width: 100%;
  align-items: center;
}

.bench-seat {
  flex: 0 0 auto;
  min-height: 38px;
  width: 68px;
  text-align: center;
  border-radius: 4px;
  padding: 2px;
  background: rgba(0,0,0,0.15);
  border: 1px dashed rgba(255,255,255,0.3);
}

.bench-seat-filled {
  border-style: solid;
  border-color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.25);
}
.bench-seat-empty {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6em;
  color: rgba(255,255,255,0.3);
}

/* Zone Chip (used in bench) */
.zone-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 2px;
  border-radius: 6px;
  transition: transform 0.15s;
  min-width: 55px;
}
.zone-chip:hover { transform: scale(1.08); }
.zone-chip.dragging,
.zone-chip.touch-dragging { opacity: 0.5; transform: scale(1.1); }

.zone-chip .chip-circle {
  width: 28px;
  height: 28px;
}
.zone-chip .chip-name {
  font-size: 0.55em;
  color: var(--gray-800, #1f2937);
  white-space: nowrap;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Chip colors for bench zone chips */
.pitch-bench-area .zone-chip .chip-name { color: #fef3c7; }
.chip-dimmed { opacity: 0.5; }

/* Ghost formation positions (faded guides on pitch) */
.pitch-ghost-pos {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.45em;
  color: rgba(255,255,255,0.25);
  pointer-events: none;
  z-index: 1;
}

/* Lineup toast notification */
.lineup-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #ef4444;
  color: white;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 9999;
  animation: toastSlideUp 0.3s ease;
}
@keyframes toastSlideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Zone roster badge additions */
.rt-zone-unavailable { background: #e5e7eb; color: #6b7280; }
.rt-btn-roster-add { color: #065f46; font-weight: 600; }
.rt-btn-roster-add:hover { background: #d1fae5; }

/* ============================================================================
   Roster Overlay Panel (floats over pitch)
   ============================================================================ */
.roster-overlay-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
  overflow: hidden;
}

.overlay-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  background: var(--gray-50, #f9fafb);
  flex-shrink: 0;
}

/* Overlay zone counts bar */
.overlay-zone-counts {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.82em;
  font-weight: 600;
}
.ozc-item {
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.ozc-starting { background: #d1fae5; color: #065f46; }
.ozc-bench { background: #dbeafe; color: #1e40af; }
.ozc-roster { background: #fef3c7; color: #92400e; }

.overlay-tabs {
  display: flex;
  gap: 0;
}

.overlay-close-btn {
  background: none;
  border: none;
  font-size: 1.1em;
  cursor: pointer;
  color: var(--gray-500, #6b7280);
  padding: 4px 8px;
  border-radius: var(--radius-sm, 4px);
  line-height: 1;
}
.overlay-close-btn:hover {
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-800, #1f2937);
}

.overlay-panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
}

/* Overlay Table */
.overlay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8em;
}

.overlay-table thead th {
  padding: 6px 6px;
  text-align: left;
  font-weight: 600;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-500, #6b7280);
  border-bottom: 2px solid var(--gray-200, #e5e7eb);
  background: var(--gray-50, #f9fafb);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

.overlay-table thead th.sortable-col {
  cursor: pointer;
  user-select: none;
}
.overlay-table thead th.sortable-col:hover {
  color: var(--gray-800, #1f2937);
  background: var(--gray-100, #f3f4f6);
}

/* Overlay table column widths */
.ot-col-name { min-width: 100px; }
.ot-col-zone { width: 34px; text-align: center; }
.ot-col-rsvp { width: 38px; text-align: center; }
.ot-col-elig { width: 32px; text-align: center; }
.ot-col-prac { width: 44px; text-align: center; }
.ot-col-proj { width: 44px; text-align: center; }
.ot-col-train { width: 28px; min-width: 28px; text-align: center; font-size: 11px; padding: 2px !important; }
.ot-col-train input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: #28a745; margin: 0; }
.train-rsvp { background: #d4edda; }
.train-yes { background: #c3e6cb; }
.ot-col-actions { width: 60px; text-align: center; }

.lineup-zone {
  transition: border-color 0.2s, background-color 0.2s;
}
.lineup-zone.drag-over {
  border-color: var(--primary-color);
  background-color: rgba(34, 102, 204, 0.05);
}

.pitch {
  position: relative;
  width: 100%;
  padding-bottom: 150%;
  background: #2d8a4e;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid #1a5c33;
}

.pitch-markings {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.pitch-center-line {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 50%;
  height: 2px;
  background: rgba(255, 255, 255, 0.35);
}
.pitch-center-circle {
  position: absolute;
  width: 15%;
  padding-bottom: 15%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.pitch-box {
  position: absolute;
  left: 25%;
  right: 25%;
  height: 12%;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.pitch-box-top { top: 0; border-top: none; }
.pitch-box-bottom { bottom: 0; border-bottom: none; }

/* Six-yard box */
.pitch-six-yard {
  position: absolute;
  left: 35%;
  right: 35%;
  height: 5%;
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.pitch-six-yard-top { top: 0; border-top: none; }
.pitch-six-yard-bottom { bottom: 0; border-bottom: none; }

/* Goal markings */
.pitch-goal {
  position: absolute;
  left: 40%;
  right: 40%;
  height: 1.5%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.4);
}
.pitch-goal-top { top: 0; border-top: none; border-radius: 0 0 3px 3px; }
.pitch-goal-bottom { bottom: 0; border-bottom: none; border-radius: 3px 3px 0 0; }

.pitch-players {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Pitch Player Chip — free-form positioned */
.pitch-player-chip {
  pointer-events: auto;
  cursor: grab;
  text-align: center;
  user-select: none;
  z-index: 10;
  transition: transform 0.15s ease;
}
.pitch-player-chip:hover { transform: translate(-50%, -50%) scale(1.1); z-index: 20; }
.pitch-player-chip.dragging,
.pitch-player-chip.touch-dragging { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2); z-index: 30; }

.chip-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: white;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6em;
  font-weight: 700;
  margin: 0 auto;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.chip-name {
  font-size: 0.55em;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  margin-top: 1px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-badge {
  font-size: 0.45em;
  color: rgba(255,255,255,0.8);
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 0 3px;
  margin-top: 1px;
  display: inline-block;
}

/* Eligibility colors on chips */
.eligibility-priority .chip-circle { border-color: #fbbf24; background: #fef3c7; color: #92400e; }
.eligibility-eligible .chip-circle { border-color: #34d399; background: #d1fae5; color: #065f46; }
.eligibility-bench .chip-circle { border-color: #60a5fa; background: #dbeafe; color: #1e40af; }
.eligibility-ineligible .chip-circle { border-color: #f87171; background: #fee2e2; color: #991b1b; }

/* ============================================================================
   Policy Bar (compact)
   ============================================================================ */
.policy-bar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  margin: var(--space-2) 0;
  flex-wrap: wrap;
  justify-content: center;
}
.policy-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px var(--space-2);
  background: white;
  border-radius: var(--radius-sm);
  min-width: 80px;
}
.policy-label {
  font-size: 0.6em;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.policy-value {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--gray-800);
}

/* ============================================================================
   Roster Table — Full-width, compact rows, ALL players visible
   ============================================================================ */
.roster-table-wrapper {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: white;
  margin-top: var(--space-2);
}

.roster-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.rt-counts {
  font-size: 0.8em;
  font-weight: 500;
  color: var(--gray-600);
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.rt-sep { color: var(--gray-300); }

.roster-sort-controls {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 0.8em;
}
.roster-sort-controls label {
  color: var(--gray-500);
  font-weight: 500;
}
.roster-sort-controls select {
  padding: 2px 6px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.95em;
}
.btn-sort-dir {
  background: none;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  cursor: pointer;
  font-size: 1em;
  line-height: 1;
}
.btn-sort-dir:hover { background: var(--gray-100); }

/* Table itself */
.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
}

.roster-table thead th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  border-bottom: 2px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 5;
}

/* Column widths */
.rt-col-zone { width: 36px; text-align: center; }
.rt-col-name { min-width: 120px; }
.rt-col-rsvp { width: 44px; text-align: center; }
.rt-col-elig { width: 36px; text-align: center; }
.rt-col-prac { width: 48px; text-align: center; }
.rt-col-roster { width: 60px; text-align: center; }
.rt-col-actions { width: 70px; text-align: center; }

/* Section headers */
.rt-section-header td {
  padding: 6px 10px 4px;
  font-weight: 700;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: 2px solid var(--gray-200);
}
.rt-section-header:first-child td { border-top: none; }

.rt-section-starting { color: #166534; background: #f0fdf4; }
.rt-section-bench { color: #1e40af; background: #eff6ff; }
.rt-section-roster { color: var(--gray-600); background: var(--gray-50); }

.rt-empty { text-align: center; color: var(--gray-400); padding: 8px; font-style: italic; }

/* Player rows — compact ~30px each */
.rt-player-row {
  transition: background 0.1s;
  cursor: grab;
  user-select: none;
}
.rt-player-row:hover { background: var(--gray-50); }
.rt-player-row.dragging { opacity: 0.5; }

.rt-player-row td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  white-space: nowrap;
}

/* Eligibility colors on rows (left border) */
.rt-player-row.eligibility-priority { border-left: 3px solid #f59e0b; }
.rt-player-row.eligibility-eligible { border-left: 3px solid #10b981; }
.rt-player-row.eligibility-bench { border-left: 3px solid #3b82f6; }
.rt-player-row.eligibility-ineligible { border-left: 3px solid #ef4444; }

/* Zone badge */
.rt-zone-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.85em;
}
.rt-zone-starting { background: #dcfce7; }
.rt-zone-bench { background: #dbeafe; }
.rt-zone-roster { background: var(--gray-100); color: var(--gray-400); }

/* Name column */
.rt-name { font-weight: 600; font-size: 0.95em; }
.rt-jersey { color: var(--gray-400); font-size: 0.85em; font-weight: 400; }

/* Inline tags */
.rt-tag {
  font-size: 0.65em;
  padding: 1px 5px;
  border-radius: 6px;
  white-space: nowrap;
  vertical-align: middle;
  margin-left: 3px;
}
.rt-tag-roster { background: #fef3c7; color: #92400e; }
.rt-tag-gm { background: #dbeafe; color: #1e40af; }
.rt-tag-official { background: #dcfce7; color: #166534; }
.rt-tag-team { background: #e0f2fe; color: #0c4a6e; }
.rt-tag-none { background: var(--gray-100); color: var(--gray-400); }
.rt-tag-unlinked { background: #fce7f3; color: #9d174d; }

/* RSVP dot */
.rsvp-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 700;
}
.rsvp-dot.rsvp-yes { background: #dcfce7; color: #166534; }
.rsvp-dot.rsvp-no { background: #fee2e2; color: #991b1b; }
.rsvp-dot.rsvp-maybe { background: #fef3c7; color: #92400e; }
.rsvp-dot.rsvp-pending { background: var(--gray-100); color: var(--gray-400); }

/* Action buttons */
.rt-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.9em;
  transition: background 0.1s;
}
.rt-btn:hover { background: var(--gray-200); }
.rt-btn-start:hover { background: #dcfce7; }
.rt-btn-bench:hover { background: #dbeafe; }
.rt-btn-remove:hover { background: #fee2e2; }

/* Unmatched row */
.rt-unmatched { background: #fffbeb; }
.rt-unmatched:hover { background: #fef3c7 !important; }
.rt-btn-link { color: #4338ca; }
.rt-btn-link:hover { background: #eef2ff; }

/* Zone count badge (used in pitch header) */
.zone-count {
  font-size: 0.8em;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--gray-200);
  color: var(--gray-600);
}

/* ============================================================================
   Attendance Popup (double-click a player)
   ============================================================================ */
.attendance-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.attendance-popup {
  background: white;
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.attendance-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  border-bottom: 1px solid var(--gray-200);
}
.attendance-popup-header h3 { margin: 0; font-size: 1.1em; }

.attendance-close-btn {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: var(--gray-500);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.attendance-close-btn:hover { background: var(--gray-100); color: var(--gray-800); }

.attendance-popup-body {
  padding: var(--space-3);
  overflow-y: auto;
  flex: 1;
}

.attendance-summary {
  font-weight: 600;
  font-size: 0.95em;
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--gray-200);
}

.attendance-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.attendance-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.attendance-row:hover { background: var(--gray-50); }

.attendance-toggle {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.attendance-toggle input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #16a34a;
}

.attendance-session-info { flex: 1; min-width: 0; }
.attendance-session-title {
  font-size: 0.85em;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attendance-session-date { font-size: 0.75em; color: var(--gray-500); }
.attendance-loading { text-align: center; color: var(--gray-500); padding: var(--space-3); }

/* ============================================================================
   Link Popup
   ============================================================================ */
.link-popup {
  background: white;
  border-radius: var(--radius-lg, 12px);
  width: min(420px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.link-popup-header {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.link-popup-header h3 { margin: 0; font-size: 1em; }
.link-popup-header .attendance-close-btn { margin-left: auto; }
.link-popup-subtitle { font-size: 0.8em; color: var(--gray-500, #6b7280); margin: 2px 0 0; }
.link-popup-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.link-popup-search {
  padding: 8px 16px;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
}
.link-search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 6px;
  font-size: 0.9em;
  outline: none;
  box-sizing: border-box;
}
.link-search-input:focus { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.2); }

.link-popup-list { overflow-y: auto; max-height: 50vh; padding: 8px 0; }
.link-candidate {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
}
.link-candidate:hover { background: #f0f4ff; }
.link-candidate-loading { opacity: 0.5; pointer-events: none; }
.link-candidate-name { font-weight: 500; font-size: 0.9em; flex: 1; }
.link-candidate-teams { font-size: 0.75em; color: var(--gray-500, #6b7280); display: flex; flex-wrap: wrap; gap: 4px; }
.link-team-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--gray-100, #f3f4f6);
  border: 1px solid var(--gray-200, #e5e7eb);
  font-size: 0.85em;
}
.link-empty { text-align: center; color: var(--gray-400, #9ca3af); padding: 20px; font-size: 0.85em; }

/* ============================================================================
   Roster Reference Popup
   ============================================================================ */
.roster-popup { width: min(500px, 92vw); }
.roster-popup-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200, #e5e7eb);
  padding: 0 16px;
  overflow-x: auto;
}
.roster-popup-tab {
  padding: 8px 14px;
  border: none;
  background: none;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--gray-500, #6b7280);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.roster-popup-tab:hover { color: var(--gray-700, #374151); }
.roster-popup-tab.active {
  color: #4338ca;
  border-bottom-color: #4338ca;
}
.roster-popup-panels { overflow-y: auto; max-height: 55vh; }
.roster-popup-panel.hidden { display: none; }
.roster-popup-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.roster-popup-table thead th {
  text-align: left;
  padding: 8px 16px;
  font-size: 0.8em;
  color: var(--gray-500, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  position: sticky;
  top: 0;
  background: white;
}
.roster-popup-table tbody td {
  padding: 6px 16px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
}

/* Link button on unmatched rows */
.btn-link-player {
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #6366f1;
  background: #eef2ff;
  color: #4338ca;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-link-player:hover { background: #c7d2fe; }

/* ============================================================================
   Mobile Responsive
   ============================================================================ */
@media (max-width: 600px) {
  .lineup-controls-row { gap: var(--space-2); }
  .overlay-toggles { order: 10; width: 100%; justify-content: center; }
  .roster-overlay-panel {
    width: 100% !important;
    border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
    top: 0 !important;
  }
  .ot-col-proj, .ot-col-prac { display: none; }
  .overlay-table thead .ot-col-proj,
  .overlay-table thead .ot-col-prac { display: none; }
}

/* ============================================================================
   Desktop: Landscape pitch (goals left/right, bench below)
   ============================================================================ */
@media (min-width: 768px) {
  .pitch-fullsize {
    padding-bottom: 65% !important;
  }

  /* In landscape, pool and bench stay on sides, pitch is wider */
  .pitch-pool-area {
    display: none;
  }

  /* Rotate pitch markings: goals on left/right */
  .pitch-center-line {
    left: 50% !important;
    right: auto !important;
    top: 5% !important;
    bottom: 5%;
    width: 2px !important;
    height: auto !important;
  }
  .pitch-center-circle {
    width: 20% !important;
    padding-bottom: 20% !important;
  }
  .pitch-box {
    left: auto !important;
    right: auto !important;
    top: 20% !important;
    bottom: 20% !important;
    height: auto !important;
    width: 12% !important;
    border: 2px solid rgba(255,255,255,0.35) !important;
  }
  .pitch-box-top {
    left: 0 !important;
    border-top: 2px solid rgba(255,255,255,0.35) !important;
    border-left: none !important;
    border-bottom: 2px solid rgba(255,255,255,0.35) !important;
  }
  .pitch-box-bottom {
    right: 0 !important;
    border-top: 2px solid rgba(255,255,255,0.35) !important;
    border-right: none !important;
    border-bottom: 2px solid rgba(255,255,255,0.35) !important;
  }
  .pitch-six-yard {
    left: auto !important;
    right: auto !important;
    top: 32% !important;
    bottom: 32% !important;
    height: auto !important;
    width: 5% !important;
    border: 2px solid rgba(255,255,255,0.35) !important;
  }
  .pitch-six-yard-top {
    left: 0 !important;
    border-left: none !important;
    border-top: 2px solid rgba(255,255,255,0.35) !important;
    border-bottom: 2px solid rgba(255,255,255,0.35) !important;
  }
  .pitch-six-yard-bottom {
    right: 0 !important;
    border-right: none !important;
    border-top: 2px solid rgba(255,255,255,0.35) !important;
    border-bottom: 2px solid rgba(255,255,255,0.35) !important;
  }
  .pitch-goal {
    left: auto !important;
    right: auto !important;
    top: 38% !important;
    bottom: 38% !important;
    height: auto !important;
    width: 1.5% !important;
  }
  .pitch-goal-top {
    left: 0 !important;
    border-left: none !important;
    border-radius: 0 3px 3px 0 !important;
  }
  .pitch-goal-bottom {
    right: 0 !important;
    border-right: none !important;
    border-radius: 3px 0 0 3px !important;
  }
}
}