/* Instructor cohort analytics panel (js/cohort-dashboard.js). */
.cohort-panel {
  --cohort-accent: var(--product-accent, #2563eb);
  --color-warning: var(--warn, #d97706);
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3vh 1rem;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.55);
}
.cohort-panel[hidden] { display: none; }
body.cohort-open { overflow: hidden; }

.cohort-sheet {
  width: min(1100px, 100%);
  background: var(--card, #fff);
  color: var(--ink, inherit);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 12px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  padding: 1.25rem;
  animation: cohort-in 0.18s var(--ease-out, ease-out);
}
@keyframes cohort-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.cohort-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.cohort-head h2 { margin: 0; color: var(--heading, inherit); font-size: 1.35rem; }
.cohort-actions { display: flex; gap: 0.5rem; }
.cohort-close { min-width: 2.5rem; }

.cohort-nav-btn {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  padding: inherit;
}
.cohort-nav-btn[hidden] { display: none; }
.cohort-snav-btn {
  text-align: left;
  color: var(--chrome-ink, inherit);
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.94rem;
  font-weight: 600;
}
.cohort-snav-btn:hover { background: color-mix(in srgb, var(--chrome-ink, #000) 10%, transparent); }

/* KPI strip */
.cohort-kpis { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.cohort-kpi {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--line, #e5e7eb);
  border-left: 4px solid var(--cohort-accent);
  border-radius: var(--radius, 10px);
}
.cohort-kpi-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted, #64748b); }
.cohort-kpi-value { font-size: 1.75rem; line-height: 1.1; color: var(--heading, inherit); }
.cohort-kpi-sub { font-size: 0.8rem; color: var(--muted, #64748b); }

.cohort-section { margin-bottom: 1.25rem; }
.cohort-section h3 { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--heading, inherit); }
.cohort-section h3 small { font-weight: 400; color: var(--muted, #64748b); font-size: 0.8rem; }

/* Chart */
.cohort-chart { position: relative; width: 100%; height: 280px; max-height: 280px; }
.cohort-chart canvas { max-height: 280px; }
@media (max-width: 600px) { .cohort-chart { height: 220px; } }

/* Tables */
.cohort-table-wrap { overflow-x: auto; }
.cohort-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.cohort-table th, .cohort-table td { padding: 0.5rem 0.65rem; text-align: left; border-bottom: 1px solid var(--line, #e5e7eb); }
.cohort-table thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted, #64748b); }
.cohort-table tbody tr:nth-child(even) { background: var(--surface-2, rgba(148, 163, 184, 0.08)); }
.cohort-table--risk .cohort-risk-row td:first-child { border-left: 4px solid var(--color-warning); }
.cohort-empty { text-align: center; color: var(--muted, #64748b); font-style: italic; }

.cohort-rank { display: inline-block; min-width: 2.2rem; padding: 0.1rem 0.45rem; border-radius: 999px; font-weight: 600; text-align: center; }
.cohort-rank--gold { background: #fde68a; color: #78350f; }
.cohort-rank--silver { background: #e5e7eb; color: #374151; }
.cohort-rank--bronze { background: #fed7aa; color: #7c2d12; }

/* Loading / error */
.cohort-loading, .cohort-error { display: flex; align-items: center; gap: 0.6rem; padding: 2rem 0; justify-content: center; color: var(--muted, #64748b); }
.cohort-error { color: var(--bad, #b91c1c); flex-wrap: wrap; }
.cohort-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid var(--line, #e5e7eb);
  border-top-color: var(--cohort-accent);
  border-radius: 50%;
  animation: cohort-spin 0.8s linear infinite;
}
@keyframes cohort-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .cohort-sheet { animation: none; }
  .cohort-spinner { animation: none; border-top-color: var(--line, #e5e7eb); border-left-color: var(--cohort-accent); }
}
