/* ============================================================
   ROSTER QUALITY PAGE
   ============================================================ */

.rqa-page-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

.rqa-page-title {
  text-align: center;
  margin-bottom: 12px;
}

/* ── Projection badge ─────────────────────────────────────── */
.rqa-projection-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.40);
  color: #92400E;
  font-family: Inter, Arial, sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  margin: 8px 0 16px;
}
.rqa-projection-badge::before {
  content: '⚠';
  font-size: 11px;
}

/* ── Filters ──────────────────────────────────────────────── */
.rqa-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0 8px;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  color: #64748B;
}

.rqa-filters form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.rqa-filters label {
  color: #64748B;
  font-size: 13px;
  white-space: nowrap;
}

.rqa-filters select {
  padding: 5px 10px;
  border: 1.5px solid #CBD5E1;
  border-radius: 6px;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  color: #111827;
  background: #ffffff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.rqa-filters select:focus {
  border-color: #1E3A8A;
  box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.10);
}

/* ── Summary Table ────────────────────────────────────────── */
.rqa-table-container {
  max-height: 720px;
  overflow-y: auto;
  margin-bottom: 32px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 0;
}

.rqa-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
}

.rqa-table th,
.rqa-table td {
  border: 1px solid #ddd;
  padding: 7px 10px;
  text-align: center;
  white-space: nowrap;
}

.rqa-table th {
  background: #111;
  color: #fff;
  user-select: none;
}

.rqa-table th[data-sort] {
  cursor: pointer;
}

.rqa-table th.sorted-asc::after  { content: " ▲"; font-size: 0.7em; opacity: 0.6; }
.rqa-table th.sorted-desc::after { content: " ▼"; font-size: 0.7em; opacity: 0.6; }

/* Primary metric column highlight */
.rqa-table th.col-rqi,
.rqa-table td.col-rqi {
  background: rgba(30, 58, 138, 0.06);
  font-weight: 600;
}
.rqa-table th.col-rqi {
  background: #1a2e5e;
}

.rqa-table tbody tr {
  cursor: pointer;
  transition: background 0.10s;
}
.rqa-table tbody tr:hover {
  background: rgba(30, 58, 138, 0.05);
}
.rqa-table tbody tr.row-highlighted {
  background: rgba(245, 158, 11, 0.12);
  outline: 2px solid #F59E0B;
  outline-offset: -2px;
}

.rqa-team-cell {
  text-align: left !important;
}

/* ── Section titles ───────────────────────────────────────── */
.rqa-section {
  margin-top: 48px;
}

.rqa-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.rqa-section-title {
  font-family: Inter, Arial, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #1E3A8A;
  margin: 0;
}

/* ── Bar toggle button ────────────────────────────────────── */
.rqa-toggle-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: 1.5px solid #CBD5E1;
  background: #F9FAFB;
  font-family: Inter, Arial, sans-serif;
  font-size: 12px;
  cursor: pointer;
  color: #1E3A8A;
  font-weight: 500;
  transition: all 0.15s;
  margin-left: auto;
}
.rqa-toggle-btn:hover {
  border-color: #1E3A8A;
  background: #EFF6FF;
}

/* ── Scrollable chart wrapper (bar + pos charts) ──────────── */
.rqa-chart-scroll-wrapper {
  width: 100%;
  max-height: 700px;
  overflow-y: auto;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #F9FAFB;
}

.rqa-scroll-hint {
  font-family: Inter, Arial, sans-serif;
  font-size: 11px;
  color: #94A3B8;
  margin-left: auto;
  white-space: nowrap;
}

/* ── Position group filter row ────────────────────────────── */
.rqa-pos-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  color: #64748B;
}

.rqa-pos-controls select {
  padding: 5px 10px;
  border: 1.5px solid #CBD5E1;
  border-radius: 6px;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  color: #111827;
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.rqa-pos-controls select:focus {
  border-color: #1E3A8A;
}

/* .rqa-pos-chart-container removed — now handled by .rqa-chart-scroll-wrapper */

/* ── Metrics explainer button ─────────────────────────────── */
.rqa-explainer-open-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1.5px solid #CBD5E1;
  background: #F9FAFB;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
  cursor: pointer;
  color: #1E3A8A;
  font-weight: 500;
  transition: all 0.15s;
}
.rqa-explainer-open-btn:hover {
  border-color: #1E3A8A;
  background: #EFF6FF;
}

/* ── Metrics explainer modal ──────────────────────────────── */
.rqa-explainer-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 580px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  font-family: Inter, Arial, sans-serif;
}
.rqa-explainer-panel.active { display: block; }

.rqa-explainer-body {
  padding: 24px 24px 20px;
}

.rqa-explainer-title {
  font-size: 16px;
  font-weight: 700;
  color: #1E3A8A;
  margin: 0 0 20px;
  padding-right: 24px;
}

.rqa-explainer-metric {
  border-top: 1px solid #F1F5F9;
  padding: 14px 0 10px;
}

.rqa-explainer-metric-name {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}

.rqa-explainer-metric p {
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
  margin: 0 0 8px;
}

.rqa-explainer-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.rqa-explainer-scale span {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.rqa-scale-good  { background: rgba(16, 185, 129, 0.12); color: #065F46; }
.rqa-scale-mid   { background: rgba(245, 158, 11, 0.12);  color: #92400E; }
.rqa-scale-poor  { background: rgba(239, 68, 68, 0.12);   color: #991B1B; }
.rqa-scale-note  { background: rgba(30, 58, 138, 0.08);   color: #1E3A8A; }

.rqa-explainer-footer {
  border-top: 1px solid #F1F5F9;
  margin-top: 16px;
  padding-top: 12px;
  font-size: 11px;
  color: #94A3B8;
  line-height: 1.5;
}

/* ── Detail modal overlay ─────────────────────────────────── */
.rqa-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 900;
}
.rqa-overlay.active { display: block; }

.rqa-detail-panel {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  width: 440px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  font-family: Inter, Arial, sans-serif;
  font-size: 13px;
}
.rqa-detail-panel.active { display: block; }

.rqa-detail-close-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 16px;
  color: #94A3B8;
  cursor: pointer;
  line-height: 1;
}
.rqa-detail-close-btn:hover { color: #1E3A8A; }

.rqa-detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid #F1F5F9;
}

.rqa-detail-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
}

.rqa-detail-team {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.rqa-detail-conf {
  font-size: 12px;
  color: #64748B;
  margin-top: 2px;
}

/* ── Detail metric cards ──────────────────────────────────── */
.rqa-detail-metrics {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #F1F5F9;
}

.rqa-detail-metric {
  flex: 1;
  padding: 14px 12px;
  text-align: center;
  border-right: 1px solid #F1F5F9;
}
.rqa-detail-metric:last-child { border-right: none; }

.rqa-detail-metric.rqa-primary {
  background: rgba(30, 58, 138, 0.04);
}

.rqa-metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  margin-bottom: 4px;
}

.rqa-metric-value {
  font-size: 20px;
  font-weight: 700;
  color: #1E3A8A;
  line-height: 1.1;
}

.rqa-metric-rank {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 3px;
}

/* ── Detail sub-sections ──────────────────────────────────── */
.rqa-detail-sub {
  padding: 12px 20px;
  border-bottom: 1px solid #F1F5F9;
}
.rqa-detail-sub:last-child { border-bottom: none; }

.rqa-detail-sub b {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
  margin-bottom: 8px;
}

.rqa-breakdown-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.rqa-breakdown-row span {
  font-size: 12px;
  color: #374151;
}
.rqa-breakdown-row span b {
  display: inline;
  text-transform: none;
  letter-spacing: 0;
  color: #1E3A8A;
  font-size: 13px;
}

/* ── Position group table in detail panel ─────────────────── */
.rqa-pos-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}
.rqa-pos-table th,
.rqa-pos-table td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid #F1F5F9;
}
.rqa-pos-table th {
  color: #64748B;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: transparent;
}
.rqa-pos-table td:not(:first-child) {
  text-align: center;
  font-weight: 600;
  color: #1E3A8A;
}
