:root {
  /* Navy base */
  --bg-primary:    #0b1828;
  --bg-card:       #112338;
  --bg-card-hover: #19314d;
  --bg-input:      #0b1828;

  /* Borders */
  --border:        #1e3d5c;
  --border-hover:  #2d5f8a;

  /* Text */
  --text-primary:   #e4eef8;
  --text-secondary: #7aabcf;
  --text-muted:     #5e96bc;

  /* CHC blue accent (Detego-inspired) */
  --accent:       #2590d8;
  --accent-hover: #1a7abf;
  --accent-dim:   #0e2e47;

  /* Gold — Detego yellow, toned for dark UI */
  --gold:         #f0c140;
  --gold-dim:     #3a2c08;

  /* Status colors */
  --green:      #34d399;
  --green-bg:   #0a2e1f;
  --orange:     #fb923c;
  --orange-bg:  #2d1508;
  --red:        #f87171;
  --red-bg:     #2d0d0d;
  --yellow:     #fbbf24;
  --yellow-bg:  #2d2008;
  --purple:     #a78bfa;
}

/* ---- LIGHT MODE ---- */
[data-theme="light"] {
  --bg-primary:     #f0f5fb;
  --bg-card:        #ffffff;
  --bg-card-hover:  #e8f2fb;
  --bg-input:       #ffffff;
  --border:         #c8dcea;
  --border-hover:   #94b8d4;
  --text-primary:   #1a3a5c;
  --text-secondary: #3d6a8a;
  --text-muted:     #3d6a8a;
  --accent:         #1a7abf;
  --accent-hover:   #1568a8;
  --accent-dim:     #daeef8;
  --gold:           #b07d0a;
  --gold-dim:       #fef3c7;
  --green:      #15803d;
  --green-bg:   #dcfce7;
  --orange:     #c2410c;
  --orange-bg:  #ffedd5;
  --red:        #dc2626;
  --red-bg:     #fee2e2;
  --yellow:     #b45309;
  --yellow-bg:  #fef3c7;
  --purple:     #7c3aed;
}

[data-theme="light"] body {
  background: linear-gradient(to right, #e8f2fb 0%, #f5f9ff 100%);
}
[data-theme="light"] .nav {
  background: linear-gradient(135deg, #1a6aaa 0%, #2590d8 100%);
  box-shadow: 0 1px 0 rgba(0,0,0,0.1), 0 2px 12px rgba(37,144,216,0.3);
}
[data-theme="light"] .nav-brand { color: #fff; }
[data-theme="light"] .nav-brand-text { color: #fff; }
[data-theme="light"] .nav-brand-text span { color: #d0edff; }
[data-theme="light"] .nav-brand small { color: rgba(255,255,255,0.7); }
[data-theme="light"] .nav-logo-robot { background: none; }
[data-theme="light"] .nav-link { color: rgba(255,255,255,0.85); }
[data-theme="light"] .nav-link:hover { background: rgba(255,255,255,0.15); color: #fff; }
[data-theme="light"] .nav-link.active { background: rgba(255,255,255,0.25); color: #fff; }
[data-theme="light"] .persona-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f7fd 100%);
  border-color: rgba(37,144,216,0.25);
  box-shadow: 6px 6px 20px rgba(0,0,0,0.08);
}
[data-theme="light"] .persona-card:hover {
  background: linear-gradient(135deg, #f0f7fd 0%, #daeef8 100%);
  border-color: rgba(37,144,216,0.5);
  box-shadow: 8px 8px 24px rgba(0,0,0,0.12);
}
[data-theme="light"] .call-header {
  background: linear-gradient(135deg, #daeef8 0%, #f0f7fd 100%);
}
[data-theme="light"] .score-total-card {
  background: linear-gradient(160deg, #daeef8 0%, #f0f7fd 100%);
}
[data-theme="light"] .call-status.idle {
  background: var(--bg-primary);
  color: var(--text-muted);
}
[data-theme="light"] .theme-toggle {
  border-color: rgba(255,255,255,0.5);
  color: rgba(255,255,255,0.9);
}
[data-theme="light"] .theme-toggle:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* ---- THEME TOGGLE BUTTON ---- */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.theme-toggle:hover { background: var(--bg-card-hover); color: var(--text-primary); }

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

/* Accessibility utilities */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.sr-skip {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  font-weight: 600;
}
.sr-skip:focus { top: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(to right, #0b1828 0%, #030810 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- NAV ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  border-bottom: 1px solid transparent;
  background: linear-gradient(135deg, #0e3060 0%, #0b1828 100%);
  box-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,0.4);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.nav-logo-header {
  height: 68px;
  width: auto;
  margin: -12px 0;
}
.nav-logo-robot {
  height: 36px;
  width: 36px;
  object-fit: cover;
  object-position: 50% 20%;
  border-radius: 8px;
  flex-shrink: 0;
}
.nav-brand-text {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  max-width: 120px;
  color: #e5e5e5;
}
.nav-brand-bubble {
  background: #e5e5e5;
  border-radius: 100px;
  padding: 5px 14px 3px;
  position: relative;
}
.nav-brand-bubble::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 8px solid #e5e5e5;
}
.nav-brand-wordmark {
  display: block;
  height: 24px;
  width: auto;
  object-fit: cover;
  object-position: 50% 30%;
}
.nav-brand-text span {
  color: var(--accent);
}
.nav-brand small {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-top: -2px;
}
.nav-links { display: flex; gap: 0.25rem; }
.nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-link:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-link.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---- VIEWS ---- */
.view { display: none; padding: 2rem; max-width: 1200px; margin: 0 auto; }
.view.active { display: block; }

/* ---- HERO LOGO ---- */
.hero-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 2.5rem;
  padding-top: 2rem;
}
.hero-float {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.3s ease;
}
.hero-float:hover {
  transform: translateY(-4px);
}
.hero-robot-float {
  width: 220px;
  height: auto;
  display: block;
  margin-bottom: -8px;
}
.hero-wordmark-pill {
  background: #e5e5e5;
  border-radius: 100px;
  padding: 6px 20px;
  position: relative;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}
.hero-wordmark-pill::after {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-bottom: 17px solid #e5e5e5;
}
.hero-wordmark-crop {
  overflow: hidden;
  border-radius: 80px;
}
.hero-wordmark-img {
  display: block;
  width: 210px;
  height: 40px;
  object-fit: cover;
  object-position: 50% 86%;
}

/* ---- PERSONA SELECT ---- */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
  text-align: center;
}
.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.9rem;
  text-align: center;
}
.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.persona-card {
  background: linear-gradient(135deg, #0e3060 0%, #0b1828 100%);
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 14px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: 6px 6px 20px rgba(0,0,0,0.5);
}
.persona-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.persona-card:hover {
  border-color: rgba(255,255,255,0.65);
  background: linear-gradient(135deg, #1a3f78 0%, #0e2040 100%);
  transform: translateY(-2px);
  box-shadow: 8px 8px 24px rgba(0,0,0,0.6);
}
.persona-card:hover::before { opacity: 1; }
.persona-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.2rem; letter-spacing: -0.01em; }
.persona-title { color: var(--gold); font-size: 0.82rem; margin-bottom: 0.75rem; }
.persona-desc { color: var(--text-secondary); font-size: 0.83rem; line-height: 1.55; margin-bottom: 1rem; }
.persona-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tag {
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.tag-quadrant { background: var(--accent-dim); color: var(--accent); }
.tag-difficulty-easy       { background: var(--green-bg);  color: var(--green);  }
.tag-difficulty-medium     { background: var(--yellow-bg); color: var(--yellow); }
.tag-difficulty-hard       { background: var(--orange-bg); color: var(--orange); }
.tag-difficulty-very-hard  { background: var(--red-bg);    color: var(--red);    }

/* ---- PRACTICE VIEW ---- */
.practice-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  min-height: calc(100vh - 120px);
}
@media (max-width: 900px) {
  .practice-layout { grid-template-columns: 1fr; }
}

.call-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.call-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #0f2a42 0%, #112338 100%);
}
.call-lead-name  { font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }
.call-lead-title { color: var(--text-secondary); font-size: 0.78rem; margin-top: 0.1rem; }
.call-stats { display: flex; gap: 1.5rem; align-items: center; }
.call-stat { text-align: center; }
.call-stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
.call-stat-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.call-status {
  padding: 0.55rem 1.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.01em;
}
.call-status.idle        { background: var(--bg-primary); color: var(--text-muted); }
.call-status.connecting  { background: var(--yellow-bg);  color: var(--yellow); }
.call-status.connected   { background: var(--green-bg);   color: var(--green); }
.call-status.speaking    { background: var(--accent-dim); color: var(--accent); }
.call-status.error       { background: var(--red-bg);     color: var(--red); }

.call-transcript {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  min-height: 300px;
  max-height: 500px;
}
.msg { padding: 0.6rem 0; font-size: 0.84rem; line-height: 1.55; }
.msg + .msg { border-top: 1px solid var(--border); }
.msg-label {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.15rem;
}
.msg-agent .msg-label { color: var(--accent); }
.msg-lead .msg-label  { color: var(--gold); }
.msg-system { color: var(--text-muted); font-style: italic; font-size: 0.8rem; }

.call-controls {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
}

/* Text input fallback */
.text-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.5rem 1rem;
}
.text-input {
  flex: 1;
  padding: 0.6rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.text-input:focus { border-color: var(--accent); }
.text-input::placeholder { color: var(--text-muted); }

.btn {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, #2590d8 0%, #1a7abf 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,144,216,0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #2080c8 0%, #1568a8 100%);
  box-shadow: 0 4px 14px rgba(37,144,216,0.35);
}
.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: linear-gradient(135deg, #c01f1f 0%, #991616 100%); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  flex: 0;
  white-space: nowrap;
}
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--text-primary); }

/* ---- SCORING SIDEBAR ---- */
.scoring-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.score-total-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  text-align: center;
  background: linear-gradient(160deg, #0f2a42 0%, #112338 100%);
}
.score-total-value {
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.3rem;
  color: var(--gold);
  letter-spacing: -0.03em;
}
.score-total-label {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.score-categories {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
}
.score-category { margin-bottom: 1rem; }
.score-category:last-child { margin-bottom: 0; }
.score-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.score-cat-name  { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); }
.score-cat-value { font-size: 0.78rem; font-weight: 700; color: var(--gold); }
.score-bar-bg {
  height: 5px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease, background-color 0.6s ease;
  width: 0%;
}

.score-techniques {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
}
.score-techniques h4 {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.technique-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.technique-item.used { color: var(--green); }
.technique-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.technique-item.used .technique-dot { background: var(--green); }

/* ---- SCORECARD MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 700px;
  width: 100%;
  padding: 2rem;
  position: relative;
  margin-top: 2rem;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--text-primary); }
.modal h2 {
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.scorecard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.scorecard-item {
  background: var(--bg-primary);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid var(--border);
}
.scorecard-item h4 { font-size: 0.8rem; margin-bottom: 0.3rem; color: var(--text-secondary); }
.scorecard-item .score {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: var(--gold);
  letter-spacing: -0.02em;
}
.scorecard-item p { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.45; }
.scorecard-section { margin-bottom: 1.5rem; }
.scorecard-section h3 {
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.scorecard-list { list-style: none; padding: 0; }
.scorecard-list li {
  padding: 0.4rem 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.scorecard-list li::before { margin-right: 0.5rem; font-size: 0.8rem; }
.highlight-list li::before { content: '+'; color: var(--green);  font-weight: bold; }
.improve-list   li::before { content: '>'; color: var(--orange); font-weight: bold; }

.overall-feedback {
  background: var(--bg-primary);
  border-radius: 10px;
  padding: 1.25rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent);
}
.scorecard-feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 0.5rem;
}
.scorecard-feedback-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- HISTORY VIEW ---- */
.history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}
.history-item:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.history-left  { display: flex; flex-direction: column; gap: 0.25rem; }
.history-lead  { font-weight: 600; }
.history-date  { font-size: 0.78rem; color: var(--text-muted); }
.history-right { display: flex; align-items: center; gap: 1.5rem; }
.history-score { font-size: 1.5rem; font-weight: 800; color: var(--gold); }
.history-duration { font-size: 0.78rem; color: var(--text-muted); }
.history-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* ---- SCORE COLORS ---- */
.score-excellent { color: var(--green); }
.score-good      { color: var(--accent); }
.score-average   { color: var(--yellow); }
.score-poor      { color: var(--orange); }
.score-bad       { color: var(--red); }

.bar-excellent { background: var(--green); }
.bar-good      { background: var(--accent); }
.bar-average   { background: var(--yellow); }
.bar-poor      { background: var(--orange); }
.bar-bad       { background: var(--red); }

/* ---- AUDIO VISUALIZER ---- */
.visualizer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  height: 32px;
  padding: 0 1.5rem;
}
.visualizer .bar {
  width: 3px;
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  transition: height 0.1s;
}

/* ============================================================
   COURSE COMPLETE MODAL
   ============================================================ */
.course-complete-modal {
  text-align: center;
  max-width: 520px;
}
.cc-icon {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
}
.cc-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.cc-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}
.cc-summary {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1.25rem;
}
.cc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.cc-stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}
.cc-stat-value.pass { color: var(--green); }
.cc-stat-value.fail { color: var(--red); }
.cc-stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.cc-failed-list {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  text-align: left;
  max-height: 160px;
  overflow-y: auto;
}
.cc-failed-list:empty { display: none; }
.cc-failed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.88rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.cc-failed-item:last-child { border-bottom: none; }
.cc-failed-score {
  font-weight: 600;
  color: var(--red);
  font-size: 0.82rem;
}
.cc-all-passed {
  font-size: 0.9rem;
  color: var(--green);
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.cc-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.cc-actions .btn { flex: 1; min-width: 120px; }
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   TERMS OF USE MODAL
   ============================================================ */
.tos-modal {
  text-align: center;
  max-width: 540px;
  width: 100%;
}
.tos-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}
.tos-modal h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}
.tos-org {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}
.tos-body {
  text-align: left;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
  background: var(--bg-primary);
  scroll-behavior: smooth;
}
.tos-body:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.tos-body p { margin-bottom: 1rem; }
.tos-body p:last-child { margin-bottom: 0; }
.tos-body strong { color: var(--text-primary); }
.tos-last-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
  font-style: italic;
}
.tos-accept-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
}
.tos-required {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--red);
}
.nav-link-tos {
  font-size: 0.8rem;
  opacity: 0.75;
}

/* ============================================================
   NAME PROMPT MODAL
   ============================================================ */
.name-prompt-modal {
  text-align: center;
  max-width: 480px;
}
.name-prompt-lock {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}
.name-prompt-modal h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}
.name-prompt-body {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.name-prompt-body strong {
  color: var(--text-primary);
}
.name-prompt-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  margin-bottom: 1rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}
.name-prompt-input:focus {
  border-color: var(--accent);
}
.name-prompt-submit {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
}

/* ============================================================
   CERTIFICATE OVERLAY + ENVELOPE ANIMATION
   ============================================================ */
.cert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 30, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.cert-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 760px;
}

/* --- Envelope --- */
.cert-envelope {
  perspective: 800px;
  width: 320px;
  height: 200px;
}
.envelope-body {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: envelopeFlip 0.9s ease-in-out 1.2s forwards;
}
@keyframes envelopeFlip {
  0%   { transform: rotateY(0deg) scale(1); }
  40%  { transform: rotateY(90deg) scale(0.9); }
  100% { transform: rotateY(180deg) scale(0.85); opacity: 0; }
}
.envelope-front {
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, #1a3a6b, #0e2347);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  backface-visibility: hidden;
}
.envelope-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(160deg, #1e4480, #0e2347);
  border-radius: 12px 12px 0 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.envelope-congrats {
  font-family: 'Great Vibes', cursive;
  font-size: 2.4rem;
  color: #f0c140;
  text-shadow: 0 2px 12px rgba(240,193,64,0.5);
  position: relative;
  z-index: 1;
}
.envelope-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}

/* --- Certificate paper --- */
.cert-paper {
  width: 100%;
  max-width: 760px;
  opacity: 0;
  transform: translateY(40px);
  animation: certRise 0.7s ease-out 2.3s forwards;
}
@keyframes certRise {
  to { opacity: 1; transform: translateY(0); }
}
.cert-border-outer {
  background: #fffef8;
  border: 3px solid #8b6914;
  border-radius: 4px;
  padding: 6px;
}
.cert-border-inner {
  border: 1.5px solid #c4a44a;
  padding: 36px 48px 28px;
  position: relative;
  background: #fffef8;
}
/* Corner ornaments */
.cert-border-inner::before,
.cert-border-inner::after {
  content: '✦';
  position: absolute;
  font-size: 1.1rem;
  color: #8b6914;
  line-height: 1;
}
.cert-border-inner::before { top: 8px; left: 12px; }
.cert-border-inner::after  { bottom: 8px; right: 12px; }

/* Header */
.cert-header {
  text-align: center;
  margin-bottom: 1.5rem;
}
.cert-org {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: #5a420a;
  margin-bottom: 1rem;
}
.cert-seal {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.cert-chc-logo {
  width: 260px;
  height: auto;
  opacity: 0.92;
}
.cert-title-line {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #1a3a6b;
  letter-spacing: 0.05em;
}

/* Body */
.cert-body {
  text-align: center;
  margin-bottom: 2rem;
}
.cert-certifies {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 1rem;
  color: #5a4a2a;
  margin: 0 0 0.25rem;
}
.cert-name {
  font-family: 'Great Vibes', cursive;
  font-size: 3rem;
  color: #1a3a6b;
  margin: 0.1rem 0 0.5rem;
  line-height: 1.2;
}
.cert-has-completed {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 1rem;
  color: #5a4a2a;
  margin: 0 0 0.25rem;
}
.cert-program {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #1a3a6b;
  letter-spacing: 0.06em;
  margin: 0 0 0.75rem;
}
.cert-description {
  font-family: 'IM Fell English', serif;
  font-size: 0.85rem;
  color: #7a6a4a;
  line-height: 1.7;
  margin: 0;
}

/* Footer */
.cert-footer {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #d4b86a;
}
.cert-sig-block,
.cert-date-block {
  text-align: center;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 90px;
}
.cert-sig-name {
  font-family: 'Great Vibes', cursive;
  font-size: 2rem;
  color: #1a3a6b;
  line-height: 1.2;
  margin-bottom: 0;
}
.cert-date-value {
  font-family: 'IM Fell English', serif;
  font-size: 0.95rem;
  color: #1a3a6b;
  margin-bottom: 0.25rem;
}
.cert-sig-line {
  height: 1px;
  background: #8b6914;
  margin-bottom: 0.35rem;
}
.cert-sig-title {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #5a4a2a;
  text-transform: uppercase;
  min-height: 2.2rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.cert-powered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: #5a4a2a;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 1rem;
  opacity: 0.85;
}
.cert-powered-robot {
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: 0.85;
}

/* Actions */
.cert-actions {
  display: flex;
  gap: 0.75rem;
  opacity: 0;
  animation: certRise 0.4s ease-out 3s forwards;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  @page {
    size: 11in 8.5in landscape;
    margin: 0;
  }
  body > *:not(.cert-overlay) { display: none !important; }
  .cert-overlay {
    position: fixed !important;
    inset: 0 !important;
    background: none !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .cert-scene { gap: 0; width: 100%; height: 100%; justify-content: center; }
  .cert-envelope, .cert-actions { display: none !important; }
  .cert-paper {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    width: 10.5in !important;
    max-width: 10.5in !important;
    height: 8in !important;
    box-sizing: border-box !important;
  }
  .cert-border-outer {
    height: 100% !important;
    border-color: #8b6914 !important;
  }
  .cert-border-inner {
    height: 100% !important;
    border-color: #c4a44a !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
  }
}

/* ============================================================
   FEEDBACK
   ============================================================ */
.call-feedback-row {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 0;
}
.btn-feedback-inline {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.btn-feedback-inline:hover { color: var(--orange); border-color: var(--orange); }
.btn-feedback-scoring {
  width: 100%;
  margin-top: 1rem;
}
.card-flag-btn {
  margin-top: 0.75rem;
  width: 100%;
}
.feedback-modal {
  max-width: 500px;
  width: 100%;
}
.feedback-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -0.75rem 0 1.25rem;
  font-style: italic;
}
.feedback-type-row, .feedback-rating-row {
  margin-bottom: 1rem;
}
.feedback-type-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.feedback-type-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.feedback-type-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.feedback-type-btn:hover { border-color: var(--accent); color: var(--accent); }
.feedback-type-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.feedback-rating-btns { display: flex; gap: 0.75rem; }
.feedback-rating-btn {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1.4rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.feedback-rating-btn:hover { transform: scale(1.1); }
.feedback-rating-btn.active-up   { border-color: var(--green); }
.feedback-rating-btn.active-down { border-color: var(--red); }
.feedback-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.feedback-textarea:focus { border-color: var(--accent); }
.feedback-char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin: 0.25rem 0 1rem;
}
.feedback-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.feedback-success {
  text-align: center;
  color: var(--green);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

/* Floating feedback button */
.fab-feedback {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,144,216,0.4);
  transition: background 0.2s, transform 0.15s;
}
.fab-feedback:hover { background: var(--accent-hover); transform: translateY(-2px); }
.fab-feedback-label { font-size: 0.82rem; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-copy {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 1.25rem;
}
.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text-secondary); }
.footer-version {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.6;
  font-family: monospace;
}

/* ---- MOBILE ---- */
@media (max-width: 640px) {
  .view { padding: 1rem; }
  .nav  { padding: 0.5rem 0.75rem; }
  .nav-brand-text { font-size: 1rem; }
  .nav-link { font-size: 0.8rem; padding: 0.3rem 0.5rem; }
  .nav-link-tos { display: none; } /* hide Terms/Privacy from nav on mobile — available in footer */
  .persona-grid { grid-template-columns: 1fr; }
  .scorecard-grid { grid-template-columns: 1fr; }
  .call-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .call-stats  { align-self: flex-end; }
  .modal { padding: 1.25rem; margin-top: 0.25rem; }
  .cc-actions { flex-direction: column; }
  .cc-actions .btn { width: 100%; }
  .cert-actions { flex-direction: column; width: 100%; max-width: 300px; }
  .tos-body { max-height: 240px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .fab-feedback { bottom: 4.5rem; right: 1rem; }
  .feedback-actions { flex-direction: column; }
  .feedback-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .hero-logo-wrap { display: none; } /* hide large hero on very small screens */
  .call-controls { flex-wrap: wrap; gap: 0.5rem; }
  .call-controls .btn { flex: 1; min-width: 100px; }
}
