/* ==============================================
   Parent Dashboard Styles (F-049)
   SF-049.1: Report Card View
   SF-049.2: Multi-Child Selector
   SF-049.3: Parent Header & Context
   ============================================== */

/* ==================== */
/* LOADING & ERROR STATES */
/* ==================== */

.pd-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  gap: var(--space-md);
  color: var(--text-muted);
  min-height: 300px;
}

.pd-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pd-spin 0.8s linear infinite;
}

@keyframes pd-spin {
  to { transform: rotate(360deg); }
}

.pd-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  gap: var(--space-md);
  color: var(--text-muted);
}

.pd-error-icon {
  color: var(--error);
  opacity: 0.7;
}

.pd-error h2 {
  font-size: var(--font-lg);
  color: var(--text-primary);
  margin: 0;
}

.pd-error p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.5;
  margin: 0;
}

.pd-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: var(--font-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pd-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ==================== */
/* PARENT HEADER (SF-049.3) */
/* ==================== */

#pd-header {
  margin-bottom: var(--space-lg);
}

.pd-header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.pd-header-left {
  flex: 1;
  min-width: 0;
}

.pd-title {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
}

.pd-subtitle {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin: 0;
}

.pd-header-right {
  flex-shrink: 0;
}

.pd-invite-compact {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.pd-invite-label-sm {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.pd-invite-code-sm {
  font-family: var(--font-mono);
  font-size: var(--font-base);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

.pd-btn-copy-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: 0;
}

.pd-btn-copy-sm:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pd-btn-copy-sm.copied {
  color: var(--success);
  border-color: var(--success);
}

/* ==================== */
/* NO CHILDREN STATE */
/* ==================== */

.pd-no-children {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  margin-top: var(--space-lg);
}

.pd-invite-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  gap: var(--space-md);
}

.pd-invite-label {
  font-size: var(--font-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pd-invite-code {
  font-family: var(--font-mono);
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 6px;
}

.pd-btn-copy {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  color: var(--accent);
  font-weight: 500;
  font-size: var(--font-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pd-btn-copy:hover {
  background: var(--accent);
  color: white;
}

.pd-btn-copy.copied {
  border-color: var(--success);
  color: var(--success);
}

.pd-steps {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.pd-steps h3 {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-md);
}

.pd-steps ol {
  margin: 0;
  padding-left: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.pd-steps li {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.pd-steps strong {
  color: var(--text-primary);
}

/* ==================== */
/* CHILD SELECTOR (SF-049.2) */
/* ==================== */

#pd-child-selector {
  margin-bottom: var(--space-lg);
}

.pd-selector-pills {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.pd-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.pd-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pd-pill.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.pd-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pd-pill-dot.active {
  background: var(--success);
}

.pd-pill-dot.inactive {
  background: var(--text-muted);
  opacity: 0.5;
}

.pd-pill.selected .pd-pill-dot.active {
  background: #86efac;
}

.pd-pill.selected .pd-pill-dot.inactive {
  background: rgba(255, 255, 255, 0.4);
}

.pd-pill-add {
  border-style: dashed;
  color: var(--text-muted);
}

.pd-pill-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ==================== */
/* CHILD HERO CARD */
/* ==================== */

.pd-child-hero {
  padding: 24px;
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-lg);
  position: relative;
  overflow: hidden;

  /* Glassmorphism base */
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* On track — green glass tint */
.pd-hero--on-track {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.85) 0%, rgba(220, 252, 231, 0.7) 50%, rgba(240, 253, 244, 0.85) 100%);
  border-color: rgba(34, 197, 94, 0.2);
  box-shadow:
    0 2px 8px rgba(34, 197, 94, 0.08),
    0 8px 32px rgba(34, 197, 94, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Slightly behind — amber glass tint */
.pd-hero--slightly-behind {
  background: linear-gradient(135deg, rgba(255, 251, 235, 0.85) 0%, rgba(254, 243, 199, 0.7) 50%, rgba(255, 251, 235, 0.85) 100%);
  border-color: rgba(234, 179, 8, 0.2);
  box-shadow:
    0 2px 8px rgba(234, 179, 8, 0.08),
    0 8px 32px rgba(234, 179, 8, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Behind — red glass tint */
.pd-hero--behind {
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.85) 0%, rgba(254, 226, 226, 0.7) 50%, rgba(254, 242, 242, 0.85) 100%);
  border-color: rgba(239, 68, 68, 0.2);
  box-shadow:
    0 2px 8px rgba(239, 68, 68, 0.08),
    0 8px 32px rgba(239, 68, 68, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Not started — neutral glass */
.pd-hero--not-started {
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.85) 0%, rgba(241, 245, 249, 0.7) 50%, rgba(248, 250, 252, 0.85) 100%);
  border-color: rgba(0, 0, 0, 0.06);
}

/* Dark mode */
[data-theme="dark"] .pd-child-hero {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .pd-hero--on-track {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(34, 197, 94, 0.05) 100%);
  border-color: rgba(34, 197, 94, 0.2);
}

[data-theme="dark"] .pd-hero--slightly-behind {
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.1) 0%, rgba(234, 179, 8, 0.05) 100%);
  border-color: rgba(234, 179, 8, 0.2);
}

[data-theme="dark"] .pd-hero--behind {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
  border-color: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .pd-hero--not-started {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.08);
}

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

.pd-hero-name h2 {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--space-xs);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.pd-status-badge {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.pd-status-badge.on-track {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.pd-status-badge.slightly-behind {
  background: rgba(234, 179, 8, 0.15);
  color: var(--warning);
}

.pd-status-badge.behind {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.pd-status-badge.not-started {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.pd-hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.pd-last-seen {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.pd-countdown {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  font-weight: 500;
}

.pd-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.pd-stat {
  text-align: center;
  padding: var(--space-md);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .pd-stat {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.pd-stat-value {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.pd-stat-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==================== */
/* EMPTY CHILD STATE */
/* ==================== */

.pd-empty-child {
  padding: var(--space-xl);
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.pd-empty-child p {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ==================== */
/* SUBJECT CARDS (SF-049.1) */
/* ==================== */

.pd-subjects {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.pd-subject-card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--subject-color, var(--accent));
}

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

.pd-subject-name-block {
  flex: 1;
  min-width: 0;
}

.pd-subject-name {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.pd-subject-level {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}

.pd-subject-score-block {
  text-align: right;
  flex-shrink: 0;
}

.pd-subject-score {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--subject-color, var(--accent));
}

.pd-subject-coverage {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==================== */
/* MILESTONE TRAIL */
/* ==================== */

.pd-milestones {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: var(--space-md) 0;
  overflow-x: auto;
  margin-bottom: var(--space-md);
}

.pd-ms-item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.pd-ms-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.pd-ms-dot.completed {
  background: var(--subject-color, var(--accent));
  color: white;
}

.pd-ms-dot.current {
  background: var(--subject-color, var(--accent));
  color: white;
  box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 5px var(--subject-color, var(--accent));
}

.pd-ms-dot.future {
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.pd-ms-line {
  width: 16px;
  height: 2px;
  flex-shrink: 0;
}

.pd-ms-line.completed {
  background: var(--subject-color, var(--accent));
}

.pd-ms-line.future {
  background: var(--border);
}

/* ==================== */
/* VERTICAL MILESTONE TRAIL (Shield Icons) */
/* ==================== */

.pd-milestones-vertical {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: var(--space-md) var(--space-sm);
  margin-bottom: var(--space-md);
}

.pd-msv-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.pd-msv-row.current {
  padding: 6px 12px;
}

.pd-msv-shield {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  transition: all var(--transition-fast);
}

.pd-msv-row.current .pd-msv-shield {
  opacity: 1;
  filter: none;
}

.pd-msv-row.current .pd-msv-shield svg path {
  fill: var(--subject-color, var(--accent));
  stroke: var(--subject-color, var(--accent));
}

.pd-msv-row.current .pd-msv-shield svg text {
  fill: white !important;
}

.pd-msv-row.future .pd-msv-shield {
  opacity: 0.35;
  filter: grayscale(0.6);
}

.pd-msv-row.completed .pd-msv-shield {
  opacity: 1;
}

.pd-msv-line {
  width: 2px;
  height: 16px;
  margin-left: 19px;
  border-radius: 1px;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.pd-msv-line.completed {
  background: var(--subject-color, var(--accent));
  width: 3px;
}

.pd-msv-line.future {
  background: var(--border);
}

.pd-msv-line--progress {
  background: linear-gradient(
    to top,
    var(--subject-color, var(--accent)) var(--line-progress, 0%),
    var(--border) var(--line-progress, 0%)
  );
  width: 3px;
}

.pd-msv-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.pd-msv-name {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pd-msv-row.current .pd-msv-name {
  font-size: var(--font-base);
  font-weight: 700;
  color: var(--subject-color, var(--accent));
}

.pd-msv-row.future .pd-msv-name {
  color: var(--text-muted);
  font-weight: 400;
}

/* Badge removed — current level uses visual highlight only (mobile-friendly) */

/* ==================== */
/* DETAIL VIEW TABS     */
/* ==================== */

.sp-detail-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 0;
  margin-bottom: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sp-detail-tabs::-webkit-scrollbar {
  display: none;
}

.sp-detail-tab {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card, white);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.sp-detail-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--tab-color, var(--accent));
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sp-detail-tab:hover {
  border-color: var(--tab-color, var(--accent));
  color: var(--text-primary);
}

.sp-detail-tab.active {
  border-color: var(--tab-color, var(--accent));
  color: var(--text-primary);
  font-weight: 600;
}

.sp-detail-tab.active::before {
  opacity: 1;
}

[data-theme="dark"] .sp-detail-tab {
  background: var(--bg-card, #1e293b);
}

/* ==================== */
/* TRAIL + HEATMAP LAYOUT */
/* ==================== */

.sp-trail-heatmap {
  display: flex;
  gap: var(--space-md);
  align-items: stretch;
  padding: var(--space-sm) 0;
}

.sp-trail-heatmap .pd-milestones-vertical {
  flex-shrink: 0;
  width: auto;
}

/* ==================== */
/* UNIT HEATMAP         */
/* ==================== */

.sp-heatmap-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s ease, transform 0.2s ease;
  min-width: 0;
}

/* Treemap container — SVG fills the space, zero gaps */
.sp-treemap {
  flex: 1;
  min-height: 160px;
  border-radius: 6px;
  overflow: hidden;
}

/* Back button for topic drill-down */
.sp-hm-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 4px;
}
.sp-hm-back:hover {
  color: var(--text-primary);
}
.sp-hm-back svg { flex-shrink: 0; }

/* Treemap hover tooltip */
.sp-tm-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  line-height: 1.4;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.15s;
  max-width: 220px;
}
.sp-tm-tooltip.visible { opacity: 1; }
.sp-tm-tooltip-name {
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 2px;
}
.sp-tm-tooltip-detail {
  color: #94a3b8;
}
[data-theme="light"] .sp-tm-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
[data-theme="light"] .sp-tm-tooltip-name { color: #0f172a; }
[data-theme="light"] .sp-tm-tooltip-detail { color: #475569; }

/* Help button */
.sp-help-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  color: var(--text-secondary, #94a3b8);
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  flex-shrink: 0;
}
.sp-help-btn:hover {
  color: var(--text-primary, #e2e8f0);
  background: rgba(148, 163, 184, 0.15);
}
[data-theme="light"] .sp-help-btn:hover {
  color: #334155;
  background: rgba(148, 163, 184, 0.12);
}

/* Help popup */
.sp-help-popup {
  position: absolute;
  top: 60px;
  right: 12px;
  z-index: 50;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 14px 16px;
  width: 220px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: sp-help-in 0.15s ease-out;
}
@keyframes sp-help-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.sp-help-title {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 10px;
}
.sp-help-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 6px;
}
.sp-help-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.sp-help-swatch--big {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 2px dashed #94a3b8;
  background: transparent;
}
.sp-help-row--icons {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  gap: 10px;
  justify-content: space-between;
}
.sp-help-row--icons span {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
}
.sp-help-goal {
  font-size: 12px;
  color: #22c55e;
  font-weight: 600;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  line-height: 1.4;
}
.sp-help-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 8px;
  font-style: italic;
}

/* Light mode help popup */
[data-theme="light"] .sp-help-popup {
  background: rgba(255, 255, 255, 0.97);
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .sp-help-title { color: #0f172a; }
[data-theme="light"] .sp-help-row { color: #475569; }
[data-theme="light"] .sp-help-hint { color: #94a3b8; }

/* Mobile: keep treemap, reduce min-height */
@media (max-width: 640px) {
  .sp-trail-heatmap {
    gap: var(--space-sm);
  }

  .sp-treemap {
    min-height: 120px;
  }
}

.sp-detail-card {
  position: relative;
  overflow: hidden;
  border-left: none !important;
}

.sp-detail-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--subject-color);
}

#sp-detail-content {
  animation: sp-detail-in 0.2s ease;
}

@keyframes sp-detail-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==================== */
/* LEVEL PROGRESS BAR */
/* ==================== */

.pd-level-bar {
  margin-bottom: var(--space-md);
}

.pd-level-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
  font-size: var(--font-xs);
  color: var(--text-muted);
}

.pd-level-bar-track {
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.pd-level-bar-fill {
  height: 100%;
  background: var(--subject-color, var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

/* ==================== */
/* SUBJECT STATS ROW */
/* ==================== */

.pd-subject-stats {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.pd-mini-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pd-mini-value {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
}

.pd-mini-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ==================== */
/* TOPIC BREAKDOWN */
/* ==================== */

.pd-no-topics {
  padding: var(--space-md);
  text-align: center;
  font-size: var(--font-sm);
  color: var(--text-muted);
}

.pd-topic-details {
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.pd-topic-details summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  font-weight: 500;
  padding: var(--space-sm) 0;
  transition: color var(--transition-fast);
}

.pd-topic-details summary::-webkit-details-marker {
  display: none;
}

.pd-topic-details summary:hover {
  color: var(--accent);
}

.pd-topic-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  max-height: 300px;
  overflow-y: auto;
}

.pd-topic-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
}

.pd-topic-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.pd-topic-acc {
  font-weight: 600;
  color: var(--text-secondary);
}

.pd-topic-q {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* Mastery level coloring for topic rows */
.pd-topic-row.mastered {
  border-left: 3px solid var(--success);
}

.pd-topic-row.mastered .pd-topic-acc {
  color: var(--success);
}

.pd-topic-row.confident {
  border-left: 3px solid var(--accent);
}

.pd-topic-row.learning {
  border-left: 3px solid var(--warning);
}

.pd-topic-row.learning .pd-topic-acc {
  color: var(--warning);
}

.pd-topic-row.not_started {
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}

/* ==================== */
/* RESPONSIVE */
/* ==================== */

@media (max-width: 600px) {
  .pd-header-main {
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
  }

  .pd-invite-compact {
    width: 100%;
    justify-content: center;
  }

  .pd-hero-top {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .pd-hero-meta {
    align-items: flex-start;
  }

  .pd-hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .pd-selector-pills {
    padding: var(--space-xs);
  }

  .pd-pill {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-xs);
  }

  .pd-subject-header {
    flex-wrap: wrap;
  }

  .pd-subject-stats {
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  .pd-milestones {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }

  .pd-ms-line {
    display: none;
  }

  .pd-child-hero {
    padding: var(--space-md);
  }

  .pd-subject-card {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .pd-hero-stats {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  .pd-stat {
    padding: var(--space-sm);
  }

  .pd-stat-value {
    font-size: var(--font-base);
  }
}

/* ==============================================
   Student Progress Redesign (F-082)
   Tab bar, phase banner, unit breakdown, actions
   ============================================== */

/* ==================== */
/* TAB BAR */
/* ==================== */

.sp-tab-bar {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.sp-tab-bar::-webkit-scrollbar {
  display: none;
}

.sp-tab-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--font-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}

.sp-tab-pill:hover {
  border-color: var(--pill-color, var(--accent));
  color: var(--pill-color, var(--accent));
}

.sp-tab-pill.selected {
  background: var(--pill-color, var(--accent));
  border-color: var(--pill-color, var(--accent));
  color: white;
}

/* ==================== */
/* PHASE + PACE BANNER */
/* ==================== */

.sp-phase-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-lg);
}

.sp-phase-name {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
}

.sp-phase-focus {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.sp-phase-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.sp-pace-badge {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 600;
  white-space: nowrap;
}

.sp-pace-badge.on-track {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.sp-pace-badge.slightly-behind {
  background: rgba(234, 179, 8, 0.15);
  color: var(--warning);
}

.sp-pace-badge.behind {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.sp-pace-rate {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* ==================== */
/* SUBJECT SUMMARY CARDS (Overview) */
/* ==================== */

/* ==========================================================================
   SUBJECT CAROUSEL — glassmorphism matching homepage subjects-scroll
   ========================================================================== */

.sp-subject-carousel-wrap {
  position: relative;
  margin: var(--space-sm) 0 0;
  padding: 0;
  overflow: visible;
}

/* Fade edges */
.sp-subject-carousel-wrap::before,
.sp-subject-carousel-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  pointer-events: none;
  z-index: 2;
}

.sp-subject-carousel-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-primary) 0%, transparent 100%);
  opacity: 0;
}

.sp-subject-carousel-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--bg-primary) 0%, transparent 100%);
  opacity: 1;
}

.sp-subject-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 12px 0 16px;
}

.sp-subject-carousel::-webkit-scrollbar {
  display: none;
}

/* Card — glassmorphism (hardcoded, page doesn't load design-system.css) */
.sp-subject-card {
  flex: 0 0 auto;
  width: 240px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;

  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Color accent bar — top */
.sp-subject-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--subject-color);
}

/* Subject colour tint wash */
.sp-subject-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--subject-color);
  opacity: 0.04;
  pointer-events: none;
  border-radius: inherit;
  transition: opacity 0.2s ease;
}

/* Hover — lift + grow like homepage */
.sp-subject-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.1),
    0 16px 48px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.12);
}

.sp-subject-card:hover::after {
  opacity: 0.07;
}

/* Dark mode glass */
[data-theme="dark"] .sp-subject-card {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 24px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .sp-subject-card:hover {
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.3),
    0 16px 48px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .sp-subject-card::after {
  opacity: 0.06;
}

.sp-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-bottom: 2px;
}

.sp-card-name {
  font-size: var(--font-base, 15px);
  font-weight: 600;
  color: var(--text-primary);
}

.sp-card-level {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: var(--space-12, 12px);
}

.sp-card-score {
  font-size: var(--font-xl, 20px);
  font-weight: 700;
  color: var(--subject-color, var(--accent));
  line-height: 1;
}

.sp-card-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-12, 12px);
}

.sp-card-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sp-card-bar-val {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

.sp-card-projection {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-md);
  line-height: 1.3;
  margin-top: auto;
}

.sp-card-projection.on-track {
  background: rgba(22, 163, 74, 0.1);
  color: #166534;
}

.sp-card-projection.slightly-behind {
  background: rgba(217, 119, 6, 0.1);
  color: #92400e;
}

.sp-card-projection.behind {
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
}

[data-theme="dark"] .sp-card-projection.on-track {
  background: rgba(22, 163, 74, 0.15);
  color: #86efac;
}

[data-theme="dark"] .sp-card-projection.slightly-behind {
  background: rgba(217, 119, 6, 0.15);
  color: #fcd34d;
}

[data-theme="dark"] .sp-card-projection.behind {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
}

/* Legacy vertical (keep for subject tab) */
.sp-subject-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.sp-bar-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.sp-bar-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 16px;
}

.sp-bar-icon svg { width: 14px; height: 14px; }
.sp-card-bar .sp-bar-icon svg { width: 16px; height: 16px; }
.sp-card-bar .sp-bar-icon { width: 18px; }
.sp-card-bar .sp-bar-track { height: 5px; }
.sp-bar-icon--learn { color: #2563eb; }
.sp-bar-icon--revise { color: #a855f7; }
.sp-bar-icon--test { color: #eab308; }

.sp-bar-label {
  font-size: var(--font-xs);
  color: var(--text-muted);
  width: 44px;
  flex-shrink: 0;
}

.sp-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sp-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
  min-width: 2px;
}

.sp-bar-fill--learn { background: #2563eb; }
.sp-bar-fill--revise { background: #a855f7; }
.sp-bar-fill--test { background: #eab308; }

.sp-bar-value {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  font-weight: 500;
  width: 48px;
  text-align: right;
  flex-shrink: 0;
}

/* Learn / Revise / Test branded stats */
.sp-lrt-stats {
  justify-content: space-around;
}

.sp-lrt-stats--header {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
  border: none;
  padding: 0;
  margin: 0;
}

.sp-lrt-icon {
  display: flex;
  margin-bottom: 2px;
}

.sp-lrt-stat--learn .sp-lrt-icon { color: #2563eb; }
.sp-lrt-stat--revise .sp-lrt-icon { color: #a855f7; }
.sp-lrt-stat--test .sp-lrt-icon { color: #eab308; }

.sp-lrt-stat--learn .pd-mini-value { color: #2563eb; }
.sp-lrt-stat--revise .pd-mini-value { color: #a855f7; }
.sp-lrt-stat--test .pd-mini-value { color: #eab308; }

.sp-subj-projection {
  font-size: var(--font-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  margin-top: var(--space-xs);
}

.sp-subj-projection.on-track,
.sp-subj-projection.complete {
  color: var(--success);
  background: rgba(34, 197, 94, 0.08);
}

.sp-subj-projection.behind {
  color: var(--error);
  background: rgba(239, 68, 68, 0.08);
}

.sp-subj-projection.unknown {
  color: var(--text-muted);
  background: var(--bg-hover);
}

/* ==================== */
/* TIME PROJECTION (Subject tab) */
/* ==================== */

.sp-time-projection {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  margin-bottom: var(--space-lg);
}

.sp-time-projection.on-track,
.sp-time-projection.complete {
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
}

.sp-time-projection.behind {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.sp-time-projection.unknown {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.sp-time-projection svg {
  flex-shrink: 0;
}

/* ==================== */
/* SECTION TITLES */
/* ==================== */

.sp-section-title {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-md);
}

/* ==================== */
/* UNIT BREAKDOWN */
/* ==================== */

.sp-units-section {
  margin-bottom: var(--space-lg);
}

.sp-unit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  overflow: hidden;
}

.sp-unit-card.green { border-left: 3px solid var(--success); }
.sp-unit-card.amber { border-left: 3px solid var(--warning); }
.sp-unit-card.red { border-left: 3px solid var(--error); }
.sp-unit-card.gray { border-left: 3px solid var(--border); }

.sp-unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sp-unit-header:hover {
  background: var(--bg-hover);
}

.sp-unit-name {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.sp-unit-meta {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.sp-unit-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.sp-unit-pct {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.sp-unit-chevron {
  color: var(--text-muted);
  transition: transform var(--transition-fast);
  display: flex;
}

.sp-unit-card.expanded .sp-unit-chevron {
  transform: rotate(180deg);
}

.sp-unit-bar {
  height: 3px;
  background: var(--bg-hover);
}

.sp-unit-bar-fill {
  height: 100%;
  transition: width 0.5s ease;
}

.sp-unit-bar-fill.green { background: var(--success); }
.sp-unit-bar-fill.amber { background: var(--warning); }
.sp-unit-bar-fill.red { background: var(--error); }
.sp-unit-bar-fill.gray { background: var(--border); }

.sp-unit-topics {
  display: none;
  padding: 0 var(--space-md) var(--space-sm);
}

.sp-unit-card.expanded .sp-unit-topics {
  display: block;
}

.sp-topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  margin-top: var(--space-xs);
  font-size: var(--font-sm);
}

.sp-topic-row:nth-child(odd) {
  background: var(--bg-primary);
}

.sp-topic-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.sp-topic-status {
  flex-shrink: 0;
  font-size: var(--font-xs);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.sp-topic-status.strong {
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
}

.sp-topic-status.ok {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
}

.sp-topic-status.weak {
  color: var(--error);
  background: rgba(239, 68, 68, 0.12);
}

.sp-topic-status.viewed {
  color: var(--text-muted);
  background: var(--bg-hover);
}

.sp-topic-status.not-started {
  color: var(--text-muted);
  background: transparent;
}

/* ==================== */
/* ACTION ITEMS */
/* ==================== */

.sp-actions-section {
  margin-bottom: var(--space-lg);
}

.sp-action-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xs);
}

.sp-action-item.weak {
  border-left: 3px solid var(--error);
}

.sp-action-item.not-started {
  border-left: 3px solid var(--warning);
}

.sp-action-icon {
  flex-shrink: 0;
  display: flex;
}

.sp-action-item.weak .sp-action-icon { color: var(--error); }
.sp-action-item.not-started .sp-action-icon { color: var(--warning); }

.sp-action-info {
  flex: 1;
  min-width: 0;
}

.sp-action-topic {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sp-action-detail {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

.sp-action-link {
  flex-shrink: 0;
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sp-action-link:hover {
  background: var(--accent);
  color: white;
}

/* ==================== */
/* F-082 COACHING CARD  */
/* ==================== */

.sp-coaching-card {
  background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 50%, #fefce8 100%);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.06);
}

[data-theme="dark"] .sp-coaching-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(34, 197, 94, 0.06) 50%, rgba(234, 179, 8, 0.05) 100%);
  border-color: rgba(99, 102, 241, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sp-insight-phase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.sp-insight-phase-left {
  flex: 1;
}

.sp-insight-phase-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.sp-coaching-quote {
  font-style: italic;
  color: var(--text-secondary);
  font-size: var(--font-sm);
  line-height: 1.5;
  padding: var(--space-sm) var(--space-md);
  border-left: 3px solid var(--accent);
  background: rgba(59, 130, 246, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sp-coaching-quote-mark {
  font-size: var(--font-xl);
  color: var(--accent);
  line-height: 1;
  vertical-align: text-top;
  margin-right: 2px;
}

.sp-coaching-quote-text {
  color: var(--text-secondary);
}

.sp-coaching-quote-author {
  color: var(--text-muted);
  font-size: var(--font-xs);
  font-style: normal;
}

.sp-coaching-title {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.sp-coaching-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.sp-coaching-action {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  line-height: 1.5;
  color: var(--text-secondary);
}

.sp-coaching-action-icon {
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
}

.sp-coaching-action-icon svg {
  width: 18px;
  height: 18px;
}

.sp-coaching-action-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.sp-coaching-insights {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
  border-top: 1px solid var(--border);
}

.sp-coaching-insight {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  font-size: var(--font-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

.sp-coaching-insight-icon {
  flex-shrink: 0;
  color: var(--accent);
  margin-top: 1px;
}

.sp-coaching-insight-icon svg {
  width: 14px;
  height: 14px;
}

.sp-coaching-tip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: rgba(234, 179, 8, 0.08);
  border-radius: var(--radius-md);
  font-size: var(--font-xs);
  color: var(--text-secondary);
  line-height: 1.4;
}

.sp-coaching-tip-icon {
  flex-shrink: 0;
  color: #eab308;
  margin-top: 1px;
}

.sp-coaching-tip-icon svg {
  width: 14px;
  height: 14px;
}

/* ==================== */
/* F-082 RESPONSIVE */
/* ==================== */

@media (max-width: 600px) {
  .sp-phase-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
  }

  .sp-phase-right {
    flex-direction: row;
    align-items: center;
    gap: var(--space-sm);
  }

  .sp-tab-bar {
    padding: var(--space-xs);
  }

  .sp-tab-pill {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-xs);
  }

  .sp-subject-card {
    width: 200px;
    padding: var(--space-12, 12px);
  }

  .sp-bar-label {
    width: 40px;
  }

  .sp-coaching-card {
    padding: var(--space-md);
  }

  .sp-coaching-title {
    font-size: var(--font-base);
  }

  .sp-insight-phase {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .sp-insight-phase-right {
    flex-direction: row;
    align-items: center;
    gap: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .sp-subj-score {
    font-size: var(--font-lg);
  }

  .sp-action-item {
    flex-wrap: wrap;
  }

  .sp-action-link {
    width: 100%;
    text-align: center;
    margin-top: var(--space-xs);
  }

  /* Hide all level names on mobile — shields only */
  .pd-msv-info {
    display: none;
  }
}

/* ==============================================
   F-084: Year-Aware Progress Components
   ============================================== */

/* Year filter dropdown */
.sp-year-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 8px;
}
.sp-year-filter__label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  font-weight: 600;
}
.sp-year-filter__select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-primary);
  font-size: var(--font-sm);
  min-width: 160px;
}
[data-theme="dark"] .sp-year-filter__select {
  background: var(--surface-2, #334155);
  color: var(--text-primary, #e2e8f0);
  border-color: var(--border, #475569);
}

/* Dual mastery bars */
.sp-dual-mastery {
  padding: 12px 16px;
  background: var(--bg-secondary, #f8fafc);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
[data-theme="dark"] .sp-dual-mastery {
  background: var(--surface-2, #1e293b);
}
.sp-dual-mastery__row {
  margin-bottom: 8px;
}
.sp-dual-mastery__row:last-child { margin-bottom: 0; }
.sp-dual-mastery__row--primary .sp-dual-mastery__title { color: var(--accent, #3b82f6); }
.sp-dual-mastery__row--secondary .sp-dual-mastery__title { color: #22c55e; }
.sp-dual-mastery__row--active { background: rgba(59,130,246,0.06); border-radius: 6px; padding: 8px; margin: -4px -8px 4px; }
.sp-dual-mastery__row--secondary.sp-dual-mastery__row--active { background: rgba(34,197,94,0.06); }
.sp-dual-mastery__title {
  font-size: var(--font-sm);
  font-weight: 600;
}
.sp-dual-mastery__value {
  float: right;
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-primary);
}
.sp-dual-mastery__bar {
  height: 6px;
  background: var(--border, #e2e8f0);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}
.sp-dual-mastery__fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.sp-dual-mastery__fill--year { background: var(--accent, #3b82f6); }
.sp-dual-mastery__fill--gcse { background: #22c55e; }

/* Journey timeline */
.sp-journey-timeline {
  margin-top: 16px;
  padding: 12px 0;
}
.sp-journey-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.sp-journey-cards {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.sp-journey-card {
  min-width: 180px;
  padding: 12px 16px;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}
[data-theme="dark"] .sp-journey-card {
  background: var(--surface-2, #1e293b);
}
.sp-journey-card__year {
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--accent, #3b82f6);
}
.sp-journey-card__score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 4px 0;
}
.sp-journey-card__detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.sp-journey-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: var(--font-sm);
  color: var(--text-secondary);
  background: var(--bg-secondary, #f8fafc);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}
[data-theme="dark"] .sp-journey-empty {
  background: var(--surface-2, #1e293b);
}

/* ==============================================
   F-085: Connect to Child & Link Notifications
   ============================================== */

.pd-btn-connect {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 28px;
  background: var(--accent, #3b82f6);
  color: #fff;
  border: none;
  border-radius: var(--radius-md, 8px);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms, transform 100ms;
}
.pd-btn-connect:hover {
  background: var(--accent-hover, #2563eb);
}
.pd-btn-connect:active {
  transform: scale(0.97);
}

.pd-btn-add-child {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: transparent;
  color: var(--accent, #3b82f6);
  border: 1px solid var(--accent, #3b82f6);
  border-radius: var(--radius-sm, 6px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms;
}
.pd-btn-add-child:hover {
  background: rgba(59, 130, 246, 0.08);
}

/* Pending link request notification banner */
.pd-link-notification {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md, 8px);
  padding: 16px 20px;
  margin-bottom: 0;
  box-sizing: border-box;
}
[data-theme="dark"] .pd-link-notification {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
}

.pd-link-notification__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pd-link-notification__text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.pd-link-notification__code-row {
  display: flex;
}

.pd-link-notification__actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.pd-link-notification__status {
  font-size: 0.82rem;
  min-height: 1.2em;
}

.pd-btn-accept {
  padding: 6px 16px;
  background: var(--color-success, #16a34a);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm, 6px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms;
}
.pd-btn-accept:hover:not(:disabled) {
  background: #15803d;
}
.pd-btn-accept:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pd-btn-decline {
  padding: 6px 16px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 200ms;
}
.pd-btn-decline:hover:not(:disabled) {
  background: rgba(220, 38, 38, 0.06);
  color: var(--color-error, #dc2626);
  border-color: var(--color-error, #dc2626);
}

/* No children empty state */
.pd-no-children {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
  padding: var(--space-2xl, 48px) var(--space-lg, 24px);
  gap: var(--space-xl, 32px);
  max-width: 500px;
  margin: 0 auto;
}

.pd-invite-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pd-invite-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pd-steps {
  text-align: left;
}
.pd-steps h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.pd-steps ol {
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pd-steps li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Header layout for children connected state */
.pd-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pd-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
