/* ==========================================================================
   ChampCourts Academy — Training & Learning Screens
   Uses existing design tokens from style.css
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────────────────
   ONBOARDING SCREEN
   ────────────────────────────────────────────────────────────────────────── */

.onboarding-welcome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-lg);
  margin: 0 16px 16px;
}
.onboarding-welcome__name {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 4px;
}
.onboarding-welcome__sub {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
  margin: 0;
}
.onboarding-progress-ring {
  position: relative;
  flex-shrink: 0;
}
.onboarding-progress-ring__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
}

.role-card {
  margin: 0 16px 16px;
  padding: 12px 16px;
  background: var(--color-gold-pale);
  border: 1px solid var(--color-gold-light);
  border-radius: var(--md-sys-shape-md);
}
.role-card__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
}
.role-card__row + .role-card__row {
  border-top: 1px solid var(--color-gold-light);
}
.role-card__label {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
}
.role-card__value {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
}

/* Checklist */
.checklist {
  margin: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  transition: opacity 0.2s;
}
.checklist__item--done {
  opacity: 0.65;
}
.checklist__check {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--md-sys-color-surface-container);
  border: 2px solid var(--md-sys-color-outline-variant);
}
.checklist__item--done .checklist__check {
  background: var(--color-success-bg);
  border-color: var(--color-success);
}
.checklist__num {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
}
.checklist__body {
  flex: 1;
  min-width: 0;
}
.checklist__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 2px;
}
.checklist__desc {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
  margin: 0;
}
.checklist__action {
  flex-shrink: 0;
}

.onboarding-complete {
  margin: 24px 16px;
  padding: 20px;
  background: var(--color-success-bg);
  border-radius: var(--md-sys-shape-lg);
  text-align: center;
}
.onboarding-complete__icon {
  font-size: 2rem;
}
.onboarding-complete__text {
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 8px 0 16px;
}

/* ──────────────────────────────────────────────────────────────────────────
   TRAINING HOME
   ────────────────────────────────────────────────────────────────────────── */

.training-hero {
  margin: 16px;
  padding: 20px;
  background: var(--color-navy);
  border-radius: var(--md-sys-shape-lg);
  color: var(--color-white);
}
.training-hero__level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--md-sys-shape-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  margin-bottom: 12px;
}
.level--bronze { background: rgba(205,127,50,0.25); }
.level--silver { background: rgba(192,192,192,0.25); }
.level--gold   { background: rgba(212,160,18,0.25); }
.training-hero__icon { font-size: 1rem; }
.training-hero__level-label { text-transform: uppercase; letter-spacing: 0.05em; }

.training-hero__stats {
  display: flex;
  gap: 24px;
  margin-bottom: 12px;
}
.training-hero__stat-num {
  display: block;
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
}
.training-hero__stat-label {
  font-size: var(--text-xs);
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.training-hero__progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--md-sys-shape-full);
  overflow: hidden;
  margin-bottom: 6px;
}
.training-hero__progress-fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: var(--md-sys-shape-full);
  transition: width 0.4s var(--md-sys-motion-emphasized-decel);
}
.training-hero__progress-label {
  font-size: var(--text-xs);
  opacity: 0.75;
  margin: 0;
}

/* Training sections */
.training-section {
  margin: 0 16px 20px;
}
.training-section__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.training-section__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 10px;
}
.training-section__header .training-section__title {
  margin-bottom: 0;
}

/* Generic training progress bar */
.training-progress-bar {
  height: 6px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-full);
  overflow: hidden;
}
.training-progress-bar__fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: var(--md-sys-shape-full);
  transition: width 0.4s var(--md-sys-motion-emphasized-decel);
}

/* ──────────────────────────────────────────────────────────────────────────
   FLASHCARD
   ────────────────────────────────────────────────────────────────────────── */

.flashcard-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 160px;
  cursor: pointer;
  perspective: 800px;
  /* Use transform-style for 3D flip */
}
.flashcard__front,
.flashcard__back {
  position: absolute;
  inset: 0;
  min-height: 160px;
  padding: 20px;
  border-radius: var(--md-sys-shape-lg);
  border: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  backface-visibility: hidden;
  transition: transform 0.4s var(--md-sys-motion-emphasized);
}
.flashcard__front {
  background: var(--md-sys-color-surface-container-lowest);
  transform: rotateY(0deg);
}
.flashcard__back {
  background: var(--color-navy);
  color: var(--color-white);
  transform: rotateY(180deg);
}
.flashcard--flipped .flashcard__front {
  transform: rotateY(-180deg);
}
.flashcard--flipped .flashcard__back {
  transform: rotateY(0deg);
}
.flashcard__question {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 8px;
}
.flashcard__hint {
  font-size: var(--text-xs);
  color: var(--color-grey-400);
}
.flashcard__answer {
  font-size: var(--text-base);
  color: var(--color-white);
  margin: 0;
  line-height: 1.5;
}
/* Reserve space so the container doesn't collapse */
.flashcard {
  height: 160px;
}

/* Confidence meter */
.confidence-meter {
  padding: 12px 0;
}
.confidence-meter__label {
  font-size: var(--text-sm);
  color: var(--color-grey-500);
  text-align: center;
  margin: 0 0 10px;
}
.confidence-meter__buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.confidence-btn {
  width: 52px;
  height: 52px;
  border-radius: var(--md-sys-shape-full);
  border: 2px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-lowest);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.confidence-btn:hover,
.confidence-btn:focus-visible {
  border-color: var(--color-gold);
  background: var(--color-gold-pale);
  transform: scale(1.08);
}
.confidence-btn--selected {
  border-color: var(--color-gold);
  background: var(--color-gold-pale);
  box-shadow: 0 0 0 2px var(--color-gold);
}

/* ──────────────────────────────────────────────────────────────────────────
   MODULE GRID
   ────────────────────────────────────────────────────────────────────────── */

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) {
  .module-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.module-card {
  position: relative;
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  min-height: 100px;
}
.module-card:hover:not(.module-card--locked),
.module-card:focus-visible:not(.module-card--locked) {
  border-color: var(--color-gold);
  box-shadow: var(--md-sys-elevation-2);
  outline: none;
}
.module-card--done {
  background: var(--color-success-bg);
  border-color: var(--color-success);
}
.module-card--locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.module-card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: var(--md-sys-shape-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: var(--weight-semibold);
}
.module-card__badge--done {
  background: var(--color-success);
  color: var(--color-white);
}
.module-card__badge--lock {
  background: var(--md-sys-color-surface-container);
  color: var(--color-grey-500);
}
.module-card__tag {
  font-size: var(--text-xs);
  color: var(--color-gold-dark);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.module-card__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 4px;
  line-height: 1.3;
}
.module-card__duration {
  margin: 0;
}

/* Module tag pill */
.module-tag {
  display: inline-block;
  padding: 2px 8px;
  background: var(--md-sys-color-primary-container);
  color: var(--color-navy);
  border-radius: var(--md-sys-shape-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
}

/* Continue learning card */
.module-continue-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.module-continue-card:hover {
  box-shadow: var(--md-sys-elevation-2);
}
.module-continue-card__body {
  flex: 1;
  min-width: 0;
}
.module-continue-card__tag {
  font-size: var(--text-xs);
  color: var(--color-gold-dark);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
}
.module-continue-card__title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 2px 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-continue-card__bar {
  margin-top: 2px;
}

/* ──────────────────────────────────────────────────────────────────────────
   TEAM CHALLENGE + LEADERBOARD
   ────────────────────────────────────────────────────────────────────────── */

.team-challenge-card {
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
}
.team-challenge-card__desc {
  font-size: var(--text-sm);
  color: var(--color-grey-600);
  margin: 0 0 12px;
}
.team-challenge-card__scores {
  display: flex;
  align-items: center;
  gap: 16px;
}
.team-challenge-card__score {
  text-align: center;
}
.team-challenge-card__pts {
  display: block;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
}
.team-challenge-card__lbl {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
}
.team-challenge-card__vs {
  font-size: var(--text-sm);
  color: var(--color-grey-400);
  font-weight: var(--weight-semibold);
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.leaderboard-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-sm);
}
.leaderboard-list__item--me {
  background: var(--color-gold-pale);
  border-color: var(--color-gold-light);
  font-weight: var(--weight-semibold);
}
.leaderboard-list__rank {
  width: 28px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.leaderboard-list__name {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-navy);
}
.leaderboard-list__pts {
  font-size: var(--text-sm);
  color: var(--color-gold-dark);
  font-weight: var(--weight-semibold);
}

/* ──────────────────────────────────────────────────────────────────────────
   MODULE VIEWER
   ────────────────────────────────────────────────────────────────────────── */

.module-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
}
.module-meta__tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.module-body {
  padding: 0 16px;
}
.module-video-wrap {
  border-radius: var(--md-sys-shape-md);
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
}
.module-video {
  width: 100%;
  max-height: 240px;
  display: block;
}

/* Simple Markdown rendering */
.module-text .md-h1 { font-size: var(--text-2xl); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 20px 0 8px; }
.module-text .md-h2 { font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 16px 0 6px; }
.module-text .md-h3 { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 14px 0 4px; }
.module-text .md-p  { font-size: var(--text-base); line-height: 1.6; color: var(--color-dark-text); margin: 0 0 12px; }
.module-text .md-ul { padding-left: 20px; margin: 0 0 12px; }
.module-text .md-li { font-size: var(--text-base); line-height: 1.6; color: var(--color-dark-text); margin-bottom: 4px; }
.module-text .md-code { font-family: var(--font-mono); background: var(--md-sys-color-surface-container); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.module-text .md-hr { border: none; border-top: 1px solid var(--md-sys-color-outline-variant); margin: 20px 0; }

/* Tables */
.module-text .md-table-wrap { overflow-x: auto; margin: 1rem 0; -webkit-overflow-scrolling: touch; }
.module-text .md-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.module-text .md-table th,
.module-text .md-table td { padding: 0.5rem 0.75rem; border: 1px solid var(--md-sys-color-outline-variant, #e0e0e0); text-align: left; }
.module-text .md-table th { background: var(--md-sys-color-surface-container, #f5f5f5); font-weight: 600; color: var(--color-navy); }
.module-text .md-table tr:nth-child(even) { background: var(--md-sys-color-surface-container-low, #fafafa); }

/* Images */
.module-text .md-figure { margin: 1rem 0; text-align: center; }
.module-text .md-img { max-width: 100%; height: auto; border-radius: 8px; }
.module-text .md-figcaption { font-size: 0.85rem; color: var(--color-grey-500, #666); margin-top: 0.5rem; }

/* Blockquotes */
.module-text .md-blockquote { border-left: 3px solid var(--color-gold, #D4A012); padding: 0.5rem 1rem; margin: 1rem 0; background: var(--md-sys-color-surface-container-low, #fafafa); font-style: italic; color: var(--color-grey-500, #555); }

/* Links */
.module-text .md-link { color: var(--color-navy, #1A365D); text-decoration: underline; }
.module-text .md-link:hover { color: var(--color-gold, #D4A012); }

.module-confidence {
  margin: 20px 16px;
  padding: 16px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-md);
  text-align: center;
}
.module-confidence__label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 12px;
}

.module-actions {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ──────────────────────────────────────────────────────────────────────────
   QUIZ
   ────────────────────────────────────────────────────────────────────────── */

.quiz-progress {
  padding: 16px 16px 0;
}
.quiz-progress__bar {
  height: 6px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-full);
  overflow: hidden;
  margin-bottom: 6px;
}
.quiz-progress__fill {
  height: 100%;
  background: var(--color-gold);
  border-radius: var(--md-sys-shape-full);
  transition: width 0.4s var(--md-sys-motion-emphasized-decel);
}
.quiz-progress__label {
  display: block;
  text-align: right;
}

.quiz-question-card {
  margin: 16px;
}
.quiz-question-card__text {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 20px;
  line-height: 1.5;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 2px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.quiz-option:hover:not(:disabled),
.quiz-option:focus-visible:not(:disabled) {
  border-color: var(--color-gold);
  background: var(--color-gold-pale);
  outline: none;
}
.quiz-option--selected {
  border-color: var(--color-navy);
  background: var(--md-sys-color-primary-container);
}
.quiz-option--correct {
  border-color: var(--color-success) !important;
  background: var(--color-success-bg) !important;
}
.quiz-option--incorrect {
  border-color: var(--color-error) !important;
  background: var(--color-error-bg) !important;
}
.quiz-option__letter {
  width: 28px;
  height: 28px;
  border-radius: var(--md-sys-shape-full);
  background: var(--md-sys-color-surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  flex-shrink: 0;
}
.quiz-option__text {
  font-size: var(--text-sm);
  color: var(--color-dark-text);
  line-height: 1.4;
}

.quiz-feedback {
  padding: 12px;
  border-radius: var(--md-sys-shape-md);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.quiz-feedback--correct { background: var(--color-success-bg); border: 1px solid var(--color-success); }
.quiz-feedback--incorrect { background: var(--color-error-bg); border: 1px solid var(--color-error); }
.quiz-feedback__icon { font-size: 1.1rem; }
.quiz-feedback__text { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-dark-text); }
.quiz-feedback__explanation { font-size: var(--text-sm); color: var(--color-grey-600); margin: 0; }

.quiz-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Results */
.quiz-results {
  margin: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.quiz-badge-anim {
  font-size: 4rem;
  animation: badgePop 0.6s var(--md-sys-motion-emphasized-decel) both;
}
@keyframes badgePop {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  70%  { transform: scale(1.2) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.quiz-results__score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 6px solid currentColor;
}
.quiz-results__score-circle--pass  { color: var(--color-success); background: var(--color-success-bg); }
.quiz-results__score-circle--avg   { color: var(--color-warning); background: var(--color-warning-bg); }
.quiz-results__score-circle--fail  { color: var(--color-error); background: var(--color-error-bg); }
.quiz-results__pct { font-size: var(--text-2xl); font-weight: var(--weight-semibold); line-height: 1; }
.quiz-results__label { font-size: var(--text-xs); color: var(--color-grey-500); }

.quiz-results__meta {
  display: flex;
  gap: 24px;
}
.quiz-results__stat { text-align: center; }
.quiz-results__stat-num { display: block; font-size: var(--text-xl); font-weight: var(--weight-semibold); color: var(--color-navy); }
.quiz-results__stat-label { font-size: var(--text-xs); color: var(--color-grey-500); }

.quiz-results__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.quiz-mistakes {
  width: 100%;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  overflow: hidden;
}
.quiz-mistakes__toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--md-sys-color-surface-container-low);
  border: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  cursor: pointer;
}
.quiz-mistakes__list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.quiz-mistake-item { font-size: var(--text-sm); }
.quiz-mistake-item__q { font-weight: var(--weight-semibold); color: var(--color-navy); margin: 0 0 4px; }
.quiz-mistake-item__wrong, .quiz-mistake-item__right { margin: 0 0 2px; }
.quiz-mistake-item__exp { margin: 4px 0 0; }

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

/* ──────────────────────────────────────────────────────────────────────────
   AI TUTOR
   ────────────────────────────────────────────────────────────────────────── */

.tutor-shell {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 56px - 64px); /* subtract header + bottom nav */
}
@media (min-width: 768px) {
  .tutor-shell {
    height: calc(100dvh - 56px);
  }
}

.tutor-suggestions {
  padding: 8px 12px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.tutor-suggestions__list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.tutor-suggestions__list::-webkit-scrollbar { display: none; }
.tutor-suggestion-chip {
  flex-shrink: 0;
  padding: 6px 12px;
  background: var(--md-sys-color-surface-container);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-full);
  font-size: var(--text-xs);
  color: var(--color-navy);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.tutor-suggestion-chip:hover {
  background: var(--color-gold-pale);
  border-color: var(--color-gold-light);
}

.tutor-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tutor-empty {
  padding: 20px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-grey-500);
}

.tutor-bubble {
  max-width: 85%;
  padding: 12px 14px;
  border-radius: var(--md-sys-shape-lg);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.tutor-bubble--user {
  align-self: flex-end;
  background: var(--color-navy);
  color: var(--color-white);
  border-bottom-right-radius: var(--md-sys-shape-xs);
}
.tutor-bubble--champ {
  align-self: flex-start;
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-bottom-left-radius: var(--md-sys-shape-xs);
}
.tutor-bubble__text { margin: 0 0 8px; white-space: pre-wrap; }
.tutor-bubble--user .tutor-bubble__text { margin-bottom: 0; }

.tutor-bubble__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.tutor-bubble__sources-label {
  font-size: var(--text-xs);
  color: var(--color-grey-500);
  width: 100%;
}
.tutor-source-chip {
  padding: 2px 8px;
  background: var(--md-sys-color-primary-container);
  color: var(--color-navy);
  border-radius: var(--md-sys-shape-full);
  font-size: var(--text-xs);
}

.tutor-bubble__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.tutor-action-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--md-sys-shape-full);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: transparent;
  color: var(--color-grey-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.tutor-action-btn:hover { background: var(--md-sys-color-surface-container); color: var(--color-navy); }
.tutor-action-btn--active { background: var(--color-gold-pale); color: var(--color-gold-dark); border-color: var(--color-gold-light); }
.tutor-action-btn--flag { color: var(--color-grey-400); }
.tutor-action-btn--flag.tutor-action-btn--active { color: var(--color-error); background: var(--color-error-bg); border-color: var(--color-error); }

/* Typing indicator */
.tutor-bubble--typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 18px;
  min-width: 60px;
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-grey-400);
  animation: typingBounce 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 100% { transform: translateY(0); }
  40%       { transform: translateY(-6px); }
}

.tutor-input-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-lowest);
}
.tutor-input-bar__input {
  flex: 1;
  border-radius: var(--md-sys-shape-full);
}
.tutor-input-bar__send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--md-sys-shape-full);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ──────────────────────────────────────────────────────────────────────────
   CASE STUDIES
   ────────────────────────────────────────────────────────────────────────── */

.cases-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.case-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.case-card:hover { box-shadow: var(--md-sys-elevation-2); }
.case-card__body { flex: 1; min-width: 0; }
.case-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.case-card__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 0; }
.case-card__badge { flex-shrink: 0; padding: 2px 8px; border-radius: var(--md-sys-shape-full); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.case-badge--high   { background: var(--color-success-bg); color: var(--color-success); }
.case-badge--medium { background: var(--color-warning-bg); color: var(--color-warning); }
.case-badge--low    { background: var(--color-error-bg);   color: var(--color-error); }
.case-card__desc { font-size: var(--text-xs); color: var(--color-grey-500); margin: 0 0 6px; }
.case-card__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.case-card__cta { flex-shrink: 0; }

.case-scenario {
  margin: 16px;
  padding: 12px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-md);
}
.case-scenario__text { font-size: var(--text-sm); color: var(--color-navy); font-weight: var(--weight-semibold); margin: 0 0 4px; }

.case-audio {
  margin: 16px;
}
.case-audio__player {
  width: 100%;
  border-radius: var(--md-sys-shape-md);
}

.case-scoring {
  margin: 16px;
  padding: 16px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
}
.case-scoring__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  margin: 0 0 6px;
}
.case-sliders { margin: 16px 0; display: flex; flex-direction: column; gap: 14px; }
.case-slider-row { display: flex; align-items: center; gap: 10px; }
.case-slider-row__label { font-size: var(--text-xs); color: var(--color-grey-600); min-width: 120px; }
.case-slider { flex: 1; accent-color: var(--color-navy); cursor: pointer; }
.case-slider-row__val { min-width: 20px; text-align: right; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-navy); }

.case-comparison {
  margin: 16px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-md);
}
.case-comparison__title { font-size: var(--text-base); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 0 0 12px; }
.case-comparison__table { display: grid; grid-template-columns: 1fr auto auto auto; gap: 0; font-size: var(--text-sm); }
.case-comparison__header { display: contents; font-weight: var(--weight-semibold); font-size: var(--text-xs); color: var(--color-grey-500); text-transform: uppercase; }
.case-comparison__header span, .case-comparison__row span { padding: 6px 8px; border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.case-comparison__row { display: contents; }
.case-comparison__user { color: var(--color-navy); font-weight: var(--weight-semibold); }
.case-comparison__ai { color: var(--color-grey-600); }
.delta { font-weight: var(--weight-semibold); }
.delta--close { color: var(--color-success); }
.delta--high  { color: var(--color-warning); }
.delta--low   { color: var(--color-error); }
.case-coaching-note { margin-top: 14px; padding: 10px 12px; background: var(--md-sys-color-primary-container); border-radius: var(--md-sys-shape-sm); }
.case-coaching-note__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-navy); text-transform: uppercase; margin-bottom: 4px; }
.case-coaching-note__text { font-size: var(--text-sm); color: var(--color-navy); margin: 0; }

/* ──────────────────────────────────────────────────────────────────────────
   SOPs
   ────────────────────────────────────────────────────────────────────────── */

.sops-category { margin: 0 16px 20px; }
.sops-category__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-grey-500); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; }
.sops-list { display: flex; flex-direction: column; gap: 8px; }

.sop-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.sop-card:hover { box-shadow: var(--md-sys-elevation-2); }
.sop-card__body { flex: 1; min-width: 0; }
.sop-card__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 0 0 4px; }
.sop-card__meta { display: flex; gap: 8px; align-items: center; }
.sop-card__arrow { color: var(--color-grey-400); flex-shrink: 0; }
.sop-offline-badge { display: inline-block; padding: 1px 7px; background: var(--color-success-bg); color: var(--color-success); border-radius: var(--md-sys-shape-full); font-size: var(--text-xs); font-weight: var(--weight-semibold); }

/* SOP Step view */
.sop-progress-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 16px 16px 4px;
  flex-wrap: wrap;
}
.sop-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--md-sys-color-outline-variant);
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, transform 0.15s;
}
.sop-dot--done    { background: var(--color-success); }
.sop-dot--active  { background: var(--color-navy); transform: scale(1.3); }
.sop-step-counter { display: block; text-align: center; padding: 0 16px 8px; }

.sop-step-card {
  margin: 16px;
  padding: 20px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-lg);
  min-height: 200px;
}
.sop-step-card__number {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-gold-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.sop-step-card__instruction {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-navy);
  line-height: 1.5;
  margin: 0 0 16px;
}
.sop-step-card__photo-wrap { border-radius: var(--md-sys-shape-md); overflow: hidden; margin-bottom: 16px; }
.sop-step-card__photo { width: 100%; display: block; }
.sop-step-card__warning {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  border-radius: var(--md-sys-shape-sm);
  font-size: var(--text-sm);
  color: var(--color-dark-text);
  margin-bottom: 12px;
}
.sop-step-card__note { margin: 0; }

.sop-nav {
  display: flex;
  gap: 10px;
  padding: 0 16px 16px;
}
.sop-nav .btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* ──────────────────────────────────────────────────────────────────────────
   ADMIN KNOWLEDGE MANAGER
   ────────────────────────────────────────────────────────────────────────── */

.training-admin-tabs {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container-lowest);
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
}
.training-admin-tabs::-webkit-scrollbar { display: none; }
.tadmin-tab {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-grey-600);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tadmin-tab:hover { color: var(--color-navy); }
.tadmin-tab--active { color: var(--color-navy); border-bottom-color: var(--color-navy); font-weight: var(--weight-semibold); }

/* Upload tab */
.tadmin-upload { display: flex; flex-direction: column; gap: 0; }
.upload-zone--training {
  border: 2px dashed var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  background: var(--md-sys-color-surface-container-lowest);
  transition: border-color 0.2s, background 0.2s;
}
.upload-zone--training:hover,
.upload-zone--training.upload-zone--dragover {
  border-color: var(--color-navy);
  background: var(--md-sys-color-primary-container);
}
.tadmin-voice-row { display: flex; align-items: center; gap: 10px; }
.ta-files-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.ta-file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-sm);
  font-size: var(--text-sm);
}
.ta-file-chip__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tadmin-ingest-result {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border-radius: var(--md-sys-shape-md);
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
  margin-top: 12px;
}
.tadmin-ingest-result--error { background: var(--color-error-bg); border-color: var(--color-error); }
.tadmin-ingest-result__icon { font-size: 1.3rem; flex-shrink: 0; }

/* Review queue */
.tadmin-review__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.review-queue { display: flex; flex-direction: column; gap: 12px; }
.review-item {
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
}
.review-item__header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.review-item__source { font-size: var(--text-xs); color: var(--color-grey-500); background: var(--md-sys-color-surface-container); padding: 2px 8px; border-radius: var(--md-sys-shape-full); }
.review-item__source--call { color: var(--color-info); background: var(--color-info-bg); }
.review-item__preview { font-size: var(--text-sm); color: var(--color-dark-text); margin: 0 0 12px; line-height: 1.5; }
.review-item__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.review-item__verify { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success); }
.review-item__verify:hover { background: var(--color-success); color: var(--color-white); }
.review-item__reject { color: var(--color-error); border-color: var(--color-error); }
.review-item__reject:hover { background: var(--color-error); color: var(--color-white); }
.review-item__edit-area { margin-top: 10px; }

/* Case study candidates */
.case-candidates { display: flex; flex-direction: column; gap: 12px; }
.case-candidate-card {
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  box-shadow: var(--md-sys-elevation-1);
}
.case-candidate-card__top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.case-candidate-card__score {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: var(--md-sys-shape-sm);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: 1.4;
}
.case-candidate-card__info { flex: 1; min-width: 0; }
.case-candidate-card__title { font-weight: var(--weight-semibold); color: var(--color-navy); }
.case-candidate-card__meta { margin-top: 2px; }
.case-candidate-card__preview { color: var(--color-grey-600); margin: 0 0 8px; line-height: 1.5; }
.case-candidate-card__strengths { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.case-candidate-card__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Flags */
.flags-list { display: flex; flex-direction: column; gap: 12px; }
.flag-item {
  padding: 14px;
  background: var(--md-sys-color-surface-container-lowest);
  border-left: 3px solid var(--color-error);
  border-radius: 0 var(--md-sys-shape-md) var(--md-sys-shape-md) 0;
  box-shadow: var(--md-sys-elevation-1);
}
.flag-item__q { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 0 0 6px; }
.flag-item__a { font-size: var(--text-sm); color: var(--color-grey-600); margin: 0 0 8px; }
.flag-item__meta { display: flex; gap: 12px; margin-bottom: 10px; }
.flag-item__actions { display: flex; gap: 8px; }

/* Struggling employees */
.struggling-list { display: flex; flex-direction: column; gap: 10px; }
.struggling-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  border-radius: var(--md-sys-shape-md);
}
.struggling-card__info { flex: 1; min-width: 0; }
.struggling-card__name { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 0 0 2px; }
.struggling-card__issue { margin: 0 0 2px; }
.struggling-card__actions { display: flex; gap: 8px; flex-direction: column; flex-shrink: 0; }

/* Analytics */
.analytics-bars { display: flex; flex-direction: column; gap: 8px; }
.analytics-bar-row { display: flex; align-items: center; gap: 10px; }
.analytics-bar-row__label { font-size: var(--text-xs); color: var(--color-grey-600); min-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.analytics-bar-track { flex: 1; height: 8px; background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-full); overflow: hidden; }
.analytics-bar-fill { height: 100%; background: var(--color-navy); border-radius: var(--md-sys-shape-full); transition: width 0.5s var(--md-sys-motion-emphasized-decel); }
.analytics-bar-row__val { min-width: 36px; text-align: right; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-navy); }

.weaknesses-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.weaknesses-list__item { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); }
.weaknesses-list__rank { font-weight: var(--weight-semibold); color: var(--color-grey-500); width: 20px; }
.weaknesses-list__topic { flex: 1; font-weight: var(--weight-semibold); color: var(--color-navy); }

/* Health */
.health-list { display: flex; flex-direction: column; gap: 8px; }
.health-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning);
  border-radius: var(--md-sys-shape-md);
}
.health-item__info { flex: 1; min-width: 0; }
.health-item__title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-navy); margin: 0 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
