/* MathLand Dashboard Styles */

:root {
  --primary: #4c97ff;
  --primary-dark: #3d89f0;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #333333;
  --text-secondary: #666666;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
}

.header-info {
  display: flex;
  gap: 16px;
  font-size: 14px;
}

.header-info span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-controls {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: white;
  color: var(--primary);
}

.btn-primary:hover {
  background: #f0f0f0;
}

.btn-secondary {
  background: rgba(255,255,255,0.2);
  color: white;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.3);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

/* Main layout */
.main {
  display: flex;
  height: calc(100vh - 56px);
}

.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

/* Student Grid */
.student-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* Student Tile - Compact */
.tile {
  background: var(--card-bg);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  font-size: 12px;
}

.tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tile-header {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  gap: 6px;
}

.tile-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Legacy connection-based status */
.tile-status.active { background: var(--success); }
.tile-status.stale { background: var(--warning); }
.tile-status.offline { background: var(--danger); }

/* 4-State Struggle Status (6.2) */
.tile-status.flow {
  background: var(--success);
  box-shadow: 0 0 4px var(--success);
}
.tile-status.idle {
  background: var(--warning);
  animation: pulse-warning 2s infinite;
}
.tile-status.stuck {
  background: var(--danger);
  animation: pulse-danger 1.5s infinite;
}
.tile-status.logic_error {
  background: #ff5722; /* Orange for logic errors */
  animation: pulse-error 1s infinite;
}

@keyframes pulse-warning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes pulse-danger {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(244, 67, 54, 0); }
}

@keyframes pulse-error {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.6); }
  50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(255, 87, 34, 0); }
}

.tile-last-seen {
  font-size: 11px;
  color: var(--text-secondary);
  margin-left: 8px;
}

.tile-project {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-project-id {
  font-size: 10px;
  color: #999;
}

/* Progress bar - Compact */
.progress-bar {
  height: 5px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 10px;
  color: var(--text-secondary);
  text-align: right;
  margin-bottom: 6px;
}

/* Variables Display */
.tile-variables {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  min-height: 20px;
}

.tile-var {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 5px;
  background: #e8f5e9;
  border-radius: 3px;
  font-size: 10px;
  font-family: 'Consolas', 'Monaco', monospace;
}

.tile-var-name {
  color: #388e3c;
  font-weight: 500;
}

.tile-var-value {
  color: #1b5e20;
  font-weight: 600;
}

.tile-var.negative .tile-var-value {
  color: #c62828;
}

.tile-var.position {
  background: #e3f2fd;
}

.tile-var.position .tile-var-name {
  color: #1565c0;
}

.tile-var.position .tile-var-value {
  color: #0d47a1;
}

/* Stats Row - Compact */
.tile-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 10px;
  color: var(--text-secondary);
}

.tile-stat {
  display: flex;
  align-items: center;
  gap: 2px;
}

.tile-stat-value {
  font-weight: 600;
  color: var(--text);
}

/* CT Score Display (6.3) */
.tile-ct {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.ct-total {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.ct-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 8px;
  font-family: 'Consolas', 'Monaco', monospace;
}

/* Guide step progress - Compact */
.tile-guide-progress {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  padding: 3px 6px;
  background: #e3f2fd;
  border-radius: 3px;
  font-size: 10px;
}

.guide-step-label {
  font-weight: 600;
  color: var(--primary);
}

.guide-completed {
  color: var(--text-secondary);
  font-size: 9px;
}

/* Signals/Alerts - Compact */
.tile-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 6px;
  min-height: 16px;
}

.signal {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 8px;
  background: #fff3e0;
  color: #e65100;
}

.signal.bug {
  background: #ffebee;
  color: #c62828;
}

/* Tile Actions - Compact */
.tile-actions {
  display: flex;
  gap: 4px;
}

.tile-btn {
  flex: 1;
  padding: 4px 6px;
  border: none;
  border-radius: 3px;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.2s;
}

.tile-btn.open {
  background: var(--primary);
  color: white;
}

.tile-btn.ping {
  background: #e3f2fd;
  color: var(--primary);
}

.tile-btn.hint {
  background: #fff8e1;
  color: #f57c00;
}

.tile-btn:hover {
  filter: brightness(0.95);
}

.tile-btn.disabled {
  background: #ccc;
  color: #666;
  cursor: not-allowed;
}

.tile-btn.disabled:hover {
  filter: none;
}

/* Triage Queue */
.triage-panel {
  width: 280px;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
}

.triage-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.triage-item {
  padding: 12px;
  background: #fafafa;
  border-radius: 6px;
  margin-bottom: 8px;
  border-left: 3px solid var(--danger);
}

.triage-item.stuck {
  border-left-color: var(--warning);
}

.triage-item.missing {
  border-left-color: #9c27b0;
}

.triage-item-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.triage-item-issue {
  font-size: 12px;
  color: var(--text-secondary);
}

.triage-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.triage-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  background: var(--primary);
  color: white;
}

.triage-btn.secondary {
  background: #e0e0e0;
  color: #666;
}

.triage-btn.secondary:hover {
  background: #d0d0d0;
}

/* Peer Help Triage Item (6.4) */
.triage-item.peer-help {
  border-left-color: #9c27b0;
  background: #f3e5f5;
}

.triage-peer-suggestion {
  font-size: 11px;
  color: #7b1fa2;
  margin-top: 6px;
  padding: 6px 8px;
  background: white;
  border-radius: 4px;
}

.triage-peer-suggestion strong {
  color: #4a148c;
}

.triage-peer-suggestion small {
  color: #9e9e9e;
}

/* Lobby Styles */
.lobby-container {
  max-width: 800px;
  margin: 40px auto;
  padding: 20px;
}

.lobby-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.lobby-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

.device-list {
  list-style: none;
}

.device-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.device-item:last-child {
  border-bottom: none;
}

.device-name {
  flex: 1;
  font-weight: 500;
}

.device-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.device-status.connected {
  color: var(--success);
}

.device-status.disconnected {
  color: var(--danger);
}

.rubric-list {
  list-style: none;
}

.rubric-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.rubric-item:hover {
  border-color: var(--primary);
}

.rubric-item.selected {
  border-color: var(--primary);
  background: #e3f2fd;
}

.rubric-item input {
  margin-right: 10px;
}

.lobby-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.lobby-actions .btn {
  padding: 12px 24px;
  font-size: 16px;
}

/* Student Detail Page */
.detail-container {
  display: flex;
  gap: 16px;
  padding: 16px;
}

.detail-left {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: min-content;
  gap: 12px;
  align-content: start;
  align-items: start;
}

/* Full-width items in detail-left grid */
.detail-left > .detail-header,
.detail-left > .detail-card:first-of-type {
  grid-column: 1 / -1;
}

.detail-right {
  width: 300px;
}

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

.detail-back {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
}

.detail-name {
  font-size: 18px;
  font-weight: 600;
}

.detail-card {
  background: var(--card-bg);
  border-radius: 6px;
  padding: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 0;
}

.detail-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
}

.timeline-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.timeline-content {
  font-size: 14px;
  margin-top: 4px;
}

/* Rubric Checklist */
.rubric-checklist {
  list-style: none;
}

.rubric-check-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.rubric-check-item:last-child {
  border-bottom: none;
}

.rubric-check-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 14px;
}

.rubric-check-icon.passed {
  background: #e8f5e9;
  color: var(--success);
}

.rubric-check-icon.failed {
  background: #fafafa;
  color: #bbb;
}

.rubric-check-label {
  flex: 1;
  font-size: 14px;
}

/* Summary Page */
.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.summary-table th,
.summary-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.summary-table th {
  background: #fafafa;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.summary-table tr:last-child td {
  border-bottom: none;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
}

.modal-field {
  margin-bottom: 16px;
}

.modal-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.modal-input,
.modal-textarea,
.modal-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}

.modal-textarea {
  min-height: 100px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Utilities */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: 16px;
}

.mb-4 {
  margin-bottom: 16px;
}

/* Toast animations */
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* =============================================
   MASTER-DETAIL LAYOUT (Stripe/Linear inspired)
   ============================================= */

/* Design System Variables */
:root {
  /* Extended Colors for Master-Detail */
  --bg-primary-md: #ffffff;
  --bg-secondary-md: #f9fafb;
  --bg-tertiary-md: #f3f4f6;
  --bg-sidebar: #1a1d21;
  --bg-sidebar-hover: #2d3139;
  --bg-sidebar-active: #363b44;

  --text-primary-md: #111827;
  --text-secondary-md: #6b7280;
  --text-tertiary-md: #9ca3af;
  --text-inverse: #ffffff;
  --text-sidebar: #9ca3af;
  --text-sidebar-active: #ffffff;

  --border-light: #e5e7eb;
  --border-medium: #d1d5db;

  /* Status Colors */
  --status-success: #10b981;
  --status-success-bg: #ecfdf5;
  --status-warning-md: #f59e0b;
  --status-warning-bg: #fffbeb;
  --status-danger-md: #ef4444;
  --status-danger-bg: #fef2f2;
  --status-info: #3b82f6;
  --status-info-bg: #eff6ff;

  /* Accent */
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm-md: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);

  /* Typography */
  --font-size-xs: 11px;
  --font-size-sm-md: 13px;
  --font-size-base-md: 14px;
  --font-size-lg-md: 16px;
  --font-size-xl-md: 20px;
  --font-size-2xl: 24px;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
}

/* Master-Detail Dashboard Layout */
.dashboard-md {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* =============================================
   LEFT SIDEBAR (Master View - Class Roster)
   ============================================= */
.sidebar-md {
  width: 280px;
  min-width: 280px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.sidebar-md.collapsed {
  width: 72px;
  min-width: 72px;
}

.sidebar-header-md {
  padding: var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title-md {
  color: var(--text-inverse);
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-md.collapsed .sidebar-title-md {
  display: none;
}

.collapse-btn {
  background: none;
  border: none;
  color: var(--text-sidebar);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}

.collapse-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-inverse);
}

/* Class Stats Row */
.class-stats-md {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  gap: var(--space-lg);
}

.sidebar-md.collapsed .class-stats-md {
  flex-direction: column;
  padding: var(--space-md);
  gap: var(--space-sm);
}

.stat-item-md {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.stat-dot-md {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.stat-dot-md.success { background: var(--status-success); }
.stat-dot-md.warning { background: var(--status-warning-md); }
.stat-dot-md.danger { background: var(--status-danger-md); }

.stat-count-md {
  color: var(--text-inverse);
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-medium);
}

.sidebar-md.collapsed .stat-count-md {
  font-size: var(--font-size-xs);
}

/* Student List in Sidebar */
.student-list-md {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
}

.student-list-md::-webkit-scrollbar {
  width: 6px;
}

.student-list-md::-webkit-scrollbar-track {
  background: transparent;
}

.student-list-md::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

.student-item-md {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 2px;
}

.student-item-md:hover {
  background: var(--bg-sidebar-hover);
}

.student-item-md.active {
  background: var(--bg-sidebar-active);
}

.student-status-md {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.student-status-md.success {
  background: var(--status-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}
.student-status-md.warning {
  background: var(--status-warning-md);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  animation: pulse-warning 2s infinite;
}
.student-status-md.danger {
  background: var(--status-danger-md);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
  animation: pulse-danger 1s infinite;
}

.student-info-md {
  flex: 1;
  min-width: 0;
}

.sidebar-md.collapsed .student-info-md {
  display: none;
}

.student-name-md {
  color: var(--text-inverse);
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-meta-md {
  color: var(--text-sidebar);
  font-size: var(--font-size-xs);
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.student-alert-badge-md {
  background: var(--status-danger-md);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: var(--font-weight-semibold);
}

/* =============================================
   TRIAGE ITEMS (Enhanced Sidebar Cards)
   ============================================= */
.triage-item-md {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  overflow: hidden;
}

.triage-item-md:hover {
  background: rgba(255,255,255,0.1);
}

.triage-item-md.active {
  background: rgba(255,255,255,0.15);
  border-left-color: var(--primary-md) !important;
}

/* Triage status backgrounds */
.triage-item-md.stuck {
  background: rgba(239, 68, 68, 0.15);
  border-left-color: #ef4444;
}
.triage-item-md.stuck:hover {
  background: rgba(239, 68, 68, 0.25);
}

.triage-item-md.idle {
  background: rgba(245, 158, 11, 0.12);
  border-left-color: #f59e0b;
}
.triage-item-md.idle:hover {
  background: rgba(245, 158, 11, 0.2);
}

.triage-item-md.offline {
  background: rgba(107, 114, 128, 0.15);
  border-left-color: #6b7280;
}
.triage-item-md.offline:hover {
  background: rgba(107, 114, 128, 0.25);
}

.triage-item-md.active:not(.active) {
  background: rgba(16, 185, 129, 0.08);
  border-left-color: #10b981;
}
.triage-item-md.active:not(.active):hover {
  background: rgba(16, 185, 129, 0.15);
}

/* Triage item header */
.triage-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 4px 10px;
  cursor: pointer;
}

.triage-status-icon-md {
  font-size: 14px;
  flex-shrink: 0;
}

.triage-item-md.stuck .triage-status-icon-md {
  color: #ef4444;
}
.triage-item-md.idle .triage-status-icon-md {
  color: #f59e0b;
}
.triage-item-md.offline .triage-status-icon-md {
  color: #6b7280;
}
.triage-item-md.active .triage-status-icon-md {
  color: #10b981;
}

.triage-name-md {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-inverse);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.triage-time-md {
  font-size: 11px;
  color: var(--text-sidebar);
  flex-shrink: 0;
}

.triage-time-md.danger {
  color: #ef4444;
  font-weight: 600;
}

/* Triage item body */
.triage-item-body {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 6px 10px;
  cursor: pointer;
}

.triage-context-icon-md {
  font-size: 12px;
  opacity: 0.7;
  flex-shrink: 0;
}

.triage-context-md {
  font-size: 11px;
  color: var(--text-sidebar);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Triage item footer */
.triage-item-footer {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 4px 8px 6px 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
  position: relative;
}

.triage-hint-btn,
.triage-menu-btn {
  background: none;
  border: none;
  color: var(--text-sidebar);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.15s;
}

.triage-hint-btn:hover,
.triage-menu-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-inverse);
}

.triage-item-md.stuck .triage-hint-btn:hover {
  background: rgba(239, 68, 68, 0.3);
}

/* Triage menu dropdown */
.triage-menu-dropdown {
  display: none;
  position: absolute;
  right: 8px;
  bottom: 100%;
  background: var(--bg-primary-md);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  min-width: 120px;
  z-index: 100;
  overflow: hidden;
}

.triage-menu-dropdown.show {
  display: block;
}

.triage-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-primary-md);
  transition: background 0.15s;
}

.triage-menu-item:hover {
  background: var(--bg-secondary-md);
}

.triage-menu-item.danger {
  color: #ef4444;
}

.triage-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Hide triage details when sidebar is collapsed */
.sidebar-md.collapsed .triage-item-body,
.sidebar-md.collapsed .triage-item-footer,
.sidebar-md.collapsed .triage-name-md,
.sidebar-md.collapsed .triage-time-md {
  display: none;
}

.sidebar-md.collapsed .triage-item-header {
  padding: 10px;
  justify-content: center;
}

.sidebar-md.collapsed .triage-status-icon-md {
  font-size: 18px;
}

/* =============================================
   CLASS OVERVIEW (No Student Selected)
   ============================================= */
.class-overview-md {
  padding: var(--space-xl);
  max-width: 1000px;
  margin: 0 auto;
}

.overview-header-md {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.overview-header-md h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary-md);
  margin-bottom: 8px;
}

.overview-subtitle-md {
  color: var(--text-secondary-md);
  font-size: 14px;
}

.overview-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
  .overview-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.overview-stat-card {
  background: var(--bg-primary-md);
  border-radius: var(--radius-lg-md);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  border: 1px solid var(--border-light);
  transition: transform 0.15s, box-shadow 0.15s;
}

.overview-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.overview-stat-card.stuck {
  border-left: 4px solid #ef4444;
}
.overview-stat-card.idle {
  border-left: 4px solid #f59e0b;
}
.overview-stat-card.active {
  border-left: 4px solid #10b981;
}
.overview-stat-card.offline {
  border-left: 4px solid #6b7280;
}

.overview-stat-icon {
  font-size: 32px;
  opacity: 0.8;
}

.overview-stat-card.stuck .overview-stat-icon { color: #ef4444; }
.overview-stat-card.idle .overview-stat-icon { color: #f59e0b; }
.overview-stat-card.active .overview-stat-icon { color: #10b981; }
.overview-stat-card.offline .overview-stat-icon { color: #6b7280; }

.overview-stat-content {
  flex: 1;
}

.overview-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary-md);
  line-height: 1;
}

.overview-stat-label {
  font-size: 12px;
  color: var(--text-secondary-md);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.overview-attention-section {
  background: var(--bg-primary-md);
  border-radius: var(--radius-lg-md);
  padding: var(--space-lg);
  border: 1px solid var(--border-light);
}

.overview-attention-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary-md);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 8px;
}

.overview-attention-section h3::before {
  content: '⚠️';
}

.overview-attention-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.overview-empty {
  color: var(--text-secondary-md);
  font-size: 14px;
  text-align: center;
  padding: var(--space-lg);
}

.attention-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.attention-item:hover {
  background: var(--bg-secondary-md);
}

.attention-item.stuck {
  background: rgba(239, 68, 68, 0.08);
  border-left-color: #ef4444;
}
.attention-item.stuck:hover {
  background: rgba(239, 68, 68, 0.15);
}

.attention-item.idle {
  background: rgba(245, 158, 11, 0.08);
  border-left-color: #f59e0b;
}
.attention-item.idle:hover {
  background: rgba(245, 158, 11, 0.15);
}

.attention-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.attention-name {
  font-weight: 500;
  color: var(--text-primary-md);
  min-width: 100px;
}

.attention-reason {
  color: var(--text-secondary-md);
  font-size: 13px;
  flex: 1;
}

/* =============================================
   MAIN CONTENT (Detail View)
   ============================================= */
.main-content-md {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-secondary-md);
}

/* Top Bar */
.top-bar-md {
  background: var(--bg-primary-md);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-md) var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.breadcrumb-md {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-secondary-md);
  font-size: var(--font-size-sm-md);
}

.breadcrumb-link-md {
  color: var(--text-secondary-md);
  text-decoration: none;
}

.breadcrumb-link-md:hover {
  color: var(--accent-primary);
}

.breadcrumb-separator-md {
  color: var(--text-tertiary-md);
}

.breadcrumb-current-md {
  color: var(--text-primary-md);
  font-weight: var(--font-weight-medium);
}

.top-bar-actions-md {
  display: flex;
  gap: var(--space-sm);
}

/* Session Timer */
.session-timer-md {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary-md);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm-md);
  color: var(--text-secondary-md);
}

.timer-icon-md {
  color: var(--status-success);
}

/* =============================================
   STUDENT HEADER
   ============================================= */
.student-header-md {
  background: var(--bg-primary-md);
  padding: var(--space-xl);
  border-bottom: 1px solid var(--border-light);
}

.header-top-md {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.header-info-md {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.student-avatar-md {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--font-size-xl-md);
  font-weight: var(--font-weight-bold);
}

.header-text-md h1 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-xs);
}

.project-info-md {
  color: var(--text-secondary-md);
  font-size: var(--font-size-sm-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.project-link-md {
  color: var(--accent-primary);
  text-decoration: none;
}

.project-link-md:hover {
  text-decoration: underline;
}

/* Current State Badge */
.state-badge-md {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-medium);
}

.state-badge-md.debugging {
  background: var(--status-warning-bg);
  color: #b45309;
  border: 1px solid #fcd34d;
}

.state-badge-md.stuck {
  background: var(--status-danger-bg);
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.state-badge-md.active {
  background: var(--status-success-bg);
  color: #047857;
  border: 1px solid #6ee7b7;
}

.state-badge-icon-md {
  font-size: 14px;
}

/* Alert Banner */
.alert-banner-md {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  margin-top: var(--space-lg);
}

.alert-content-md {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.alert-icon-md {
  font-size: 20px;
}

.alert-text-md {
  font-size: var(--font-size-sm-md);
  color: #92400e;
}

.alert-text-md strong {
  font-weight: var(--font-weight-semibold);
}

/* =============================================
   CONTENT GRID
   ============================================= */
.content-area-md {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-xl);
}

.content-grid-md {
  display: grid;
  grid-template-columns: 1fr 1fr 320px;
  gap: var(--space-xl);
  max-width: 1600px;
}

/* =============================================
   CARDS
   ============================================= */
.card-md {
  background: var(--bg-primary-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.card-header-md {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-md {
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-title-icon-md {
  font-size: 16px;
}

.card-body-md {
  padding: var(--space-lg);
}

.card-action-md {
  font-size: var(--font-size-xs);
  color: var(--accent-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: var(--font-weight-medium);
}

.card-action-md:hover {
  text-decoration: underline;
}

/* =============================================
   VARIABLES CARD
   ============================================= */
.variable-list-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.variable-item-md {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary-md);
  border-radius: var(--radius-sm);
}

.variable-name-md {
  font-size: var(--font-size-sm-md);
  color: var(--text-secondary-md);
  font-family: 'SF Mono', Monaco, 'Consolas', monospace;
}

.variable-value-md {
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary-md);
  font-family: 'SF Mono', Monaco, 'Consolas', monospace;
}

.variable-value-md.boolean-true {
  color: var(--status-success);
}

.variable-value-md.boolean-false {
  color: var(--status-danger-md);
}

/* =============================================
   CONCEPTS CHECKLIST
   ============================================= */
.concept-list-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.concept-item-md {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
}

.concept-check-md {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.concept-check-md.active {
  background: var(--status-success);
  color: white;
}

.concept-check-md.inactive {
  background: var(--bg-tertiary-md);
  color: var(--text-tertiary-md);
}

.concept-label-md {
  font-size: var(--font-size-sm-md);
  color: var(--text-primary-md);
}

.concept-label-md.inactive {
  color: var(--text-tertiary-md);
}

.concept-count-md {
  margin-left: auto;
  font-size: var(--font-size-xs);
  color: var(--text-tertiary-md);
  background: var(--bg-tertiary-md);
  padding: 2px 8px;
  border-radius: 10px;
}

/* =============================================
   MASTERY / QUIZ STATS
   ============================================= */
.mastery-container-md {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.mastery-donut-md {
  position: relative;
  width: 100px;
  height: 100px;
}

.mastery-donut-md svg {
  transform: rotate(-90deg);
}

.mastery-donut-bg-md {
  fill: none;
  stroke: var(--bg-tertiary-md);
  stroke-width: 10;
}

.mastery-donut-fill-md {
  fill: none;
  stroke: var(--status-warning-md);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 251.2;
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 0.5s ease;
}

.mastery-donut-fill-md.good {
  stroke: var(--status-success);
}

.mastery-donut-fill-md.warning {
  stroke: var(--status-warning-md);
}

.mastery-donut-fill-md.danger {
  stroke: var(--status-danger-md);
}

.mastery-donut-label-md {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.mastery-value-md {
  font-size: var(--font-size-xl-md);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary-md);
}

.mastery-label-md {
  font-size: var(--font-size-xs);
  color: var(--text-secondary-md);
}

.mastery-stats-md {
  flex: 1;
}

.mastery-stat-row-md {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-light);
}

.mastery-stat-row-md:last-child {
  border-bottom: none;
}

.mastery-stat-label-md {
  font-size: var(--font-size-sm-md);
  color: var(--text-secondary-md);
}

.mastery-stat-value-md {
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-semibold);
}

/* Bottleneck Card */
.bottleneck-card-md {
  background: linear-gradient(135deg, #fef2f2, #fef7ed);
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.bottleneck-header-md {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.bottleneck-icon-md {
  font-size: 18px;
}

.bottleneck-title-md {
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-semibold);
  color: #991b1b;
}

.bottleneck-question-md {
  background: white;
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.bottleneck-q-header-md {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.bottleneck-q-num-md {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--status-danger-md);
  background: var(--status-danger-bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.bottleneck-attempts-md {
  font-size: var(--font-size-xs);
  color: var(--text-secondary-md);
}

.bottleneck-q-text-md {
  font-size: var(--font-size-sm-md);
  color: var(--text-primary-md);
  margin-bottom: var(--space-sm);
}

.bottleneck-tag-md {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-size-xs);
  color: #b45309;
  background: #fef3c7;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

/* =============================================
   PROGRESS CHECKLIST
   ============================================= */
.progress-list-md {
  display: flex;
  flex-direction: column;
}

.progress-item-md {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-light);
}

.progress-item-md:last-child {
  border-bottom: none;
}

.progress-item-md.completed {
  opacity: 0.5;
}

.progress-item-md.current {
  background: var(--status-info-bg);
  margin: 0 calc(-1 * var(--space-lg));
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  border-bottom: none;
}

.progress-check-md {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 2px;
}

.progress-check-md.done {
  background: var(--status-success);
  color: white;
}

.progress-check-md.current {
  background: var(--status-info);
  color: white;
}

.progress-check-md.pending {
  background: white;
  border: 2px solid var(--border-medium);
  color: var(--text-tertiary-md);
}

.progress-content-md {
  flex: 1;
}

.progress-title-md {
  font-size: var(--font-size-sm-md);
  color: var(--text-primary-md);
  font-weight: var(--font-weight-medium);
}

.progress-item-md.completed .progress-title-md {
  text-decoration: line-through;
}

.progress-item-md.current .progress-title-md {
  color: var(--status-info);
  font-weight: var(--font-weight-semibold);
}

.progress-desc-md {
  font-size: var(--font-size-xs);
  color: var(--text-secondary-md);
  margin-top: var(--space-xs);
}

/* Completed Summary */
.progress-completed-summary-md {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  cursor: pointer;
}

.progress-completed-summary-md:hover {
  background: var(--border-light);
}

.progress-completed-count-md {
  font-size: var(--font-size-xs);
  color: var(--status-success);
  font-weight: var(--font-weight-semibold);
}

.progress-completed-text-md {
  font-size: var(--font-size-xs);
  color: var(--text-secondary-md);
}

.progress-completed-expand-md {
  margin-left: auto;
  color: var(--text-tertiary-md);
  font-size: 12px;
}

/* Intervention Tools */
.intervention-tools-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

/* =============================================
   BUTTONS (Master-Detail)
   ============================================= */
.btn-md {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
}

.btn-md-primary {
  background: var(--accent-primary);
  color: white;
}

.btn-md-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md-md);
}

.btn-md-secondary {
  background: white;
  color: var(--text-primary-md);
  border: 1px solid var(--border-medium);
}

.btn-md-secondary:hover {
  background: var(--bg-secondary-md);
  border-color: var(--border-medium);
}

.btn-md-warning {
  background: var(--status-warning-md);
  color: white;
}

.btn-md-warning:hover {
  background: #d97706;
}

.btn-md-danger {
  background: #ef4444;
  color: white;
  border: none;
}

.btn-md-danger:hover {
  background: #dc2626;
}

.btn-md-icon {
  padding: var(--space-sm);
}

.btn-md-full {
  width: 100%;
}

.btn-md-lg {
  padding: var(--space-lg) var(--space-xl);
  font-size: var(--font-size-base-md);
}

/* =============================================
   UTILITY CLASSES (Master-Detail)
   ============================================= */
.text-secondary-md {
  color: var(--text-secondary-md);
}

.text-success-md {
  color: var(--status-success);
}

.text-warning-md {
  color: var(--status-warning-md);
}

.text-danger-md {
  color: var(--status-danger-md);
}

.mt-lg-md {
  margin-top: var(--space-lg);
}

.mb-lg-md {
  margin-bottom: var(--space-lg);
}

/* =============================================
   TRIAGE CARDS (High-Efficiency Student Cards)
   ============================================= */

/* Card States */
.triage-card {
  background: var(--bg-primary-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--status-success);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.triage-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md-md);
}

/* Stuck State - Red */
.triage-card.stuck {
  background: #fef2f2;
  border-left-color: #ef4444;
  border-color: #fecaca;
}

.triage-card.stuck:hover {
  background: #fee2e2;
}

/* Idle State - Amber */
.triage-card.idle {
  background: #fffbeb;
  border-left-color: #f59e0b;
  border-color: #fde68a;
}

.triage-card.idle:hover {
  background: #fef3c7;
}

/* Active State - Green */
.triage-card.active {
  background: #ffffff;
  border-left-color: #10b981;
  border-color: #d1fae5;
}

.triage-card.active:hover {
  background: #f0fdf4;
}

/* Offline State - Grey */
.triage-card.offline {
  background: #f9fafb;
  border-left-color: #9ca3af;
  border-color: #e5e7eb;
  opacity: 0.7;
}

/* Header Row */
.triage-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.triage-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.triage-card.stuck .triage-status-icon {
  background: #fecaca;
  color: #dc2626;
  animation: pulse-alert 1.5s ease-in-out infinite;
}

.triage-card.idle .triage-status-icon {
  background: #fde68a;
  color: #b45309;
}

.triage-card.active .triage-status-icon {
  background: #d1fae5;
  color: #059669;
}

.triage-card.offline .triage-status-icon {
  background: #e5e7eb;
  color: #6b7280;
}

@keyframes pulse-alert {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.triage-student-name {
  flex: 1;
  font-size: var(--font-size-lg-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.triage-time {
  font-size: var(--font-size-sm-md);
  font-weight: var(--font-weight-medium);
  padding: 2px 8px;
  border-radius: 12px;
  flex-shrink: 0;
}

.triage-card.stuck .triage-time {
  background: #fecaca;
  color: #dc2626;
}

.triage-card.idle .triage-time {
  background: #fde68a;
  color: #b45309;
}

.triage-card.active .triage-time {
  background: #d1fae5;
  color: #059669;
}

.triage-card.offline .triage-time {
  background: #e5e7eb;
  color: #6b7280;
}

/* Body Row - Context */
.triage-card-body {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  font-size: var(--font-size-sm-md);
  color: var(--text-secondary-md);
  min-height: 24px;
}

.triage-card.stuck .triage-card-body {
  color: #b91c1c;
  font-weight: var(--font-weight-medium);
}

.triage-context-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.triage-context-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer Row - Quick Action */
.triage-card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: var(--space-sm);
  border-top: 1px solid transparent;
}

.triage-card:hover .triage-card-footer {
  border-top-color: var(--border-light);
}

.triage-quick-action {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-tertiary-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.15s;
  opacity: 0;
}

.triage-card:hover .triage-quick-action {
  opacity: 1;
}

.triage-quick-action:hover {
  background: var(--bg-tertiary-md);
  color: var(--accent-primary);
  transform: scale(1.1);
}

.triage-card.stuck .triage-quick-action:hover {
  background: #fecaca;
  color: #dc2626;
}

/* Grid Layout for Triage Cards */
.triage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
}

/* Compact variant for smaller screens */
@media (max-width: 768px) {
  .triage-card {
    padding: var(--space-md);
  }

  .triage-student-name {
    font-size: var(--font-size-base-md);
  }

  .triage-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================
   SPRITES PANEL
   ============================================= */
.sprites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.sprite-card {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.sprite-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.sprite-card.stage {
  background: #e3f2fd;
  border-color: #90caf9;
}

.sprite-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(76, 151, 255, 0.3);
}

.sprite-thumbnail {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.sprite-thumbnail img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.sprite-placeholder {
  font-size: 28px;
  color: #bbb;
}

.sprite-name {
  font-size: 11px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.sprite-meta {
  font-size: 10px;
  color: #888;
  text-align: center;
}

/* Enhanced Code View Headers with Sprites */
.sprite-header-enhanced {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #333;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: #e0e0e0;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
}

.sprite-header-thumb {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
  background: white;
  flex-shrink: 0;
}

.sprite-section.highlight {
  animation: highlight-pulse 0.5s ease-out;
}

@keyframes highlight-pulse {
  0% { background: #fff3e0; }
  100% { background: transparent; }
}

/* =============================================
   PROJECT EMBED PREVIEW
   ============================================= */
.embed-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 75%; /* 4:3 aspect ratio for Scratch projects */
  background: #f0f0f0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.embed-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.embed-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 6px 8px;
  background: #f5f5f5;
  border-radius: 4px;
}

.embed-controls a:hover {
  text-decoration: underline;
}

#project-embed-placeholder {
  background: #fafafa;
  border: 2px dashed #e0e0e0;
  border-radius: 8px;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
