/* ═══════════════════════════════════════════
   AI Speech Evaluator — Design System
   Adapted from taverns-red (London Underground × Canadian Warmth)
   ═══════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────────────────────── */
:root {
  /* Core palette (taverns-red) */
  --red-primary: #C13B3B;
  --red-dark: #8B1A1A;
  --red-deep: #5C1111;
  --red-glow: #E8524250;

  /* Canadian warmth accents */
  --maple: #D4873F;
  --maple-light: #E8A55C;
  --amber: #F5C36A;
  --cream: #FFF8ED;

  /* Backgrounds */
  --bg-primary: #0C0A0F;
  --bg-secondary: #14111A;
  --bg-card: #1A1722;
  --bg-card-hover: #221E2D;
  --bg-input: #110E16;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(193, 59, 59, 0.3);

  /* Text */
  --text-primary: #F0ECF5;
  --text-secondary: #9B95A5;
  --text-muted: #6B6575;

  /* Semantic colors */
  --color-success: #34D399;
  --color-success-hover: #4AE8AD;
  --color-danger: #E85252;
  --color-danger-hover: #FF6B6B;
  --color-warning: #F5C36A;
  --color-warning-hover: #FFD68A;
  --color-info: #60A5FA;
  --color-recording: #E85252;
  --color-processing: #34D399;
  --color-delivering: #60A5FA;

  /* Typography */
  --font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Light Theme Overrides (#56) ────────────────────────────────── */
[data-theme="light"] {
  /* Backgrounds — warm off-whites */
  --bg-primary: #F8F6F3;
  --bg-secondary: #F0EDE8;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F5F3EF;
  --bg-input: #FFFFFF;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(193, 59, 59, 0.2);

  /* Text — dark on light */
  --text-primary: #1A1722;
  --text-secondary: #5A5465;
  --text-muted: #8B8598;

  /* Red glow — more subtle in light mode */
  --red-glow: #E8524218;
}

/* Light-mode overrides for hardcoded rgba backgrounds */
[data-theme="light"] .header,
[data-theme="light"] .panel {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
}

[data-theme="light"] .panel-header {
  background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .panel-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.22);
}

[data-theme="light"] body::before {
  opacity: 0.08;
}

[data-theme="light"] .audio-level {
  background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .video-preview {
  background: var(--bg-secondary);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-save {
  background: rgba(0, 0, 0, 0.04);
}

/* ─── Theme Toggle Button ────────────────────────────────────────── */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

/* ─── Reset & Base ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-weight: 400;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* subtle radial glow behind the app */
body::before {
  content: '';
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--red-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.25;
  animation: ambient-glow 8s ease-in-out infinite;
}

@keyframes ambient-glow {

  0%,
  100% {
    opacity: 0.2;
    transform: translateX(-50%) scale(1);
  }

  50% {
    opacity: 0.35;
    transform: translateX(-50%) scale(1.08);
  }
}

/* ─── Layout ─────────────────────────────────────────────────────── */
.app {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: rgba(26, 23, 34, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.header h1 span {
  background: linear-gradient(135deg, var(--red-primary), var(--maple-light));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ─── Status Bar ─────────────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-size: 0.95rem;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.status-indicator.idle {
  background: var(--text-muted);
}

.status-indicator.recording {
  background: var(--color-recording);
  box-shadow: 0 0 12px var(--red-glow), 0 0 24px rgba(232, 82, 82, 0.2);
  animation: pulse-glow 1.2s ease-in-out infinite;
}

.status-indicator.processing {
  background: var(--color-processing);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

.status-indicator.delivering {
  background: var(--color-delivering);
  animation: pulse-glow 1s ease-in-out infinite;
}

@keyframes pulse-glow {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

.status-text {
  flex: 1;
  font-weight: 500;
  color: var(--text-secondary);
}

.elapsed-time {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-recording);
  display: none;
}

.elapsed-time.visible {
  display: block;
}

/* ─── Audio Level Meter ──────────────────────────────────────────── */
.audio-level {
  display: none;
  width: 80px;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
}

.audio-level.visible {
  display: block;
}

.audio-level-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-success), var(--maple));
  border-radius: var(--radius-full);
  transition: width 0.05s linear, background 0.15s ease;
}

.audio-level-bar.hot {
  background: linear-gradient(90deg, var(--color-danger), #FF6B6B);
}

/* ─── Controls ───────────────────────────────────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
  color: var(--cream);
  box-shadow: 0 2px 12px rgba(193, 59, 59, 0.2);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(193, 59, 59, 0.35);
}

.btn-success {
  background: linear-gradient(135deg, #2BB87A, #1E9963);
  color: #fff;
  box-shadow: 0 2px 12px rgba(52, 211, 153, 0.2);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, var(--color-danger), #C13B3B);
  color: #fff;
  box-shadow: 0 2px 12px rgba(232, 82, 82, 0.2);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(232, 82, 82, 0.35);
}

.btn-warning {
  background: linear-gradient(135deg, var(--maple), var(--amber));
  color: var(--bg-primary);
  box-shadow: 0 2px 12px rgba(212, 135, 63, 0.2);
}

.btn-warning:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(212, 135, 63, 0.35);
}

.btn-save {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-save:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
  border-color: transparent;
  color: var(--cream);
}

/* Panic mute — always visually distinct */
.btn-panic {
  background: linear-gradient(135deg, var(--color-danger), #C13B3B);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 2px solid var(--color-danger-hover);
  margin-left: auto;
  box-shadow: 0 2px 16px rgba(232, 82, 82, 0.3);
}

.btn-panic:hover:not(:disabled) {
  box-shadow: 0 4px 24px rgba(232, 82, 82, 0.5);
  border-color: #FF8A8A;
}

.hidden {
  display: none !important;
}

/* ─── Speaking Indicator ─────────────────────────────────────────── */
.speaking-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: var(--space-md);
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-delivering);
}

.speaking-indicator.visible {
  display: flex;
}

.speaking-dots {
  display: flex;
  gap: 4px;
}

.speaking-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-delivering);
  animation: speakingBounce 1.4s ease-in-out infinite;
}

.speaking-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.speaking-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes speakingBounce {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  40% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ─── Processing Indicator ───────────────────────────────────────── */
.processing-indicator {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: var(--space-md);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-md);
  font-size: 1rem;
  color: var(--color-processing);
}

.processing-indicator.visible {
  display: flex;
}

/* ─── Content Panels ─────────────────────────────────────────────── */
.panel {
  background: rgba(26, 23, 34, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.panel:hover {
  border-color: var(--border-accent);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem var(--space-md);
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.panel-body {
  padding: var(--space-md);
  min-height: 120px;
  max-height: 400px;
  overflow-y: auto;
}

/* Custom scrollbar for panels */
.panel-body::-webkit-scrollbar {
  width: 6px;
}

.panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.panel-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ─── Transcript Area ────────────────────────────────────────────── */
#transcript-panel {
  display: none;
}

#transcript-panel.visible {
  display: block;
}

.transcript-content {
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.transcript-content .segment {
  margin-bottom: var(--space-sm);
}

.transcript-content .segment-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  margin-right: var(--space-sm);
}

.transcript-content .interim {
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Speaker Diarization Labels (#157) ─────────────────────────── */
.speaker-label {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.speaker-0 { color: #4fc3f7; background: rgba(79, 195, 247, 0.12); }
.speaker-1 { color: #aed581; background: rgba(174, 213, 129, 0.12); }
.speaker-2 { color: #ffb74d; background: rgba(255, 183, 77, 0.12); }
.speaker-3 { color: #f06292; background: rgba(240, 98, 146, 0.12); }
.speaker-4 { color: #ba68c8; background: rgba(186, 104, 200, 0.12); }
.speaker-5 { color: #4dd0e1; background: rgba(77, 208, 225, 0.12); }

.transcript-empty {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--space-xl) 0;
}

/* ─── Evaluation Area ────────────────────────────────────────────── */
#evaluation-panel {
  display: none;
}

#evaluation-panel.visible {
  display: block;
}

.evaluation-content {
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.evaluation-empty {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--space-xl) 0;
}

/* ─── Error Banner ───────────────────────────────────────────────── */
.error-banner {
  display: none;
  padding: 0.75rem var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.4;
}

.error-banner.visible {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.error-banner.recoverable {
  background: rgba(245, 195, 106, 0.1);
  border: 1px solid rgba(245, 195, 106, 0.3);
  color: var(--color-warning);
}

.error-banner.non-recoverable {
  background: rgba(232, 82, 82, 0.1);
  border: 1px solid rgba(232, 82, 82, 0.3);
  color: var(--color-danger);
}

.error-banner .error-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1;
}

.error-banner .error-message {
  flex: 1;
}

.error-banner .error-dismiss {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.error-banner .error-dismiss:hover {
  opacity: 1;
}

/* ─── Interruption Banner ────────────────────────────────────────── */
.interruption-banner {
  display: none;
  padding: 0.6rem var(--space-md);
  background: rgba(232, 82, 82, 0.08);
  border: 1px solid rgba(232, 82, 82, 0.3);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  font-size: 0.9rem;
  align-items: center;
  gap: var(--space-sm);
}

.interruption-banner.visible {
  display: flex;
}

/* ─── Saved Confirmation ─────────────────────────────────────────── */
.saved-confirmation {
  display: none;
  padding: 0.6rem var(--space-md);
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-md);
  color: var(--color-success);
  font-size: 0.9rem;
  align-items: center;
  gap: var(--space-sm);
}

.saved-confirmation.visible {
  display: flex;
}

/* ─── Consent Form ───────────────────────────────────────────────── */
.consent-form {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base);
}

.consent-form:hover {
  border-color: var(--border-accent);
}

.consent-form.visible {
  display: flex;
}

.consent-form-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.consent-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.consent-form label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.consent-form input[type="text"] {
  padding: var(--space-sm) 0.75rem;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.consent-form input[type="text"]:focus {
  border-color: var(--red-primary);
  box-shadow: 0 0 0 3px rgba(193, 59, 59, 0.15);
}

.consent-form .checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
}

.consent-form .checkbox-group input[type="checkbox"] {
  margin-top: 0.25rem;
  accent-color: var(--red-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.consent-form .checkbox-group label {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.4;
  cursor: pointer;
}

/* ─── Consent Status Display ─────────────────────────────────────── */
.consent-status {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--color-success);
}

.consent-status.visible {
  display: flex;
}

/* ─── Time Limit Control ─────────────────────────────────────────── */
.time-limit-control {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.time-limit-control.visible {
  display: flex;
}

.time-limit-control label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.time-limit-control input[type="number"] {
  width: 80px;
  padding: 0.35rem var(--space-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.time-limit-control input[type="number"]:focus {
  border-color: var(--red-primary);
  box-shadow: 0 0 0 3px rgba(193, 59, 59, 0.15);
}

.time-limit-control .time-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Duration Estimate Display ──────────────────────────────────── */
.duration-estimate {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.4rem 0.75rem;
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--color-info);
}

.duration-estimate.visible {
  display: flex;
}

/* ─── Revoke Consent Button ──────────────────────────────────────── */
.btn-revoke {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid rgba(232, 82, 82, 0.4);
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  font-weight: 600;
}

.btn-revoke:hover:not(:disabled) {
  background: rgba(232, 82, 82, 0.1);
  transform: none;
}

/* ─── Data Purged Banner ─────────────────────────────────────────── */
.purge-banner {
  display: none;
  padding: 0.6rem var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  align-items: center;
  gap: var(--space-sm);
}

.purge-banner.visible {
  display: flex;
}

.purge-banner.opt-out {
  background: rgba(232, 82, 82, 0.08);
  border: 1px solid rgba(232, 82, 82, 0.3);
  color: var(--color-danger);
}

.purge-banner.auto-purge {
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: var(--color-info);
}

/* ─── VAD Notification Banner ────────────────────────────────────── */
.vad-notification {
  display: none;
  padding: 0.6rem var(--space-md);
  background: rgba(245, 195, 106, 0.08);
  border: 1px solid rgba(245, 195, 106, 0.3);
  border-radius: var(--radius-md);
  color: var(--color-warning);
  font-size: 0.95rem;
  align-items: center;
  gap: 0.75rem;
}

.vad-notification.visible {
  display: flex;
}

.vad-notification .vad-notification-text {
  flex: 1;
  font-weight: 500;
}

.vad-notification .vad-notification-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.vad-notification .btn-vad-confirm {
  padding: 0.35rem 0.75rem;
  background: linear-gradient(135deg, var(--maple), var(--amber));
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vad-notification .btn-vad-confirm:hover {
  box-shadow: 0 2px 12px rgba(212, 135, 63, 0.3);
}

.vad-notification .btn-vad-dismiss {
  padding: 0.35rem 0.75rem;
  background: transparent;
  color: var(--color-warning);
  border: 1px solid rgba(245, 195, 106, 0.4);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.vad-notification .btn-vad-dismiss:hover {
  background: rgba(245, 195, 106, 0.08);
}

/* ─── Project Context Form ───────────────────────────────────────── */
.project-context-form {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base);
}

.project-context-form:hover {
  border-color: var(--border-accent);
}

.project-context-form.visible {
  display: flex;
}

.project-context-form-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.project-context-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.project-context-form label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.project-context-form input[type="text"],
.project-context-form select,
.project-context-form textarea {
  padding: var(--space-sm) 0.75rem;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.project-context-form input[type="text"]:focus,
.project-context-form select:focus,
.project-context-form textarea:focus {
  border-color: var(--red-primary);
  box-shadow: 0 0 0 3px rgba(193, 59, 59, 0.15);
}

.project-context-form select {
  cursor: pointer;
  appearance: auto;
}

.project-context-form textarea {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

/* ─── VAD Config Control ─────────────────────────────────────────── */
/* -- Analysis Tier Selector (#125) ---------------------------------------- */

.analysis-tier-config {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: 0.75rem var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base);
}

.analysis-tier-config:hover {
  border-color: var(--border-accent);
}

.analysis-tier-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.analysis-tier-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-tier-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.analysis-tier-option:hover {
  background: rgba(193, 59, 59, 0.04);
}

.analysis-tier-option input[type="radio"] {
  accent-color: var(--red-primary);
  margin: 0;
}

.tier-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 70px;
}

.tier-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  flex: 1;
}

.tier-cost {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.vad-config {
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
  padding: 0.75rem var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base);
}

.vad-config:hover {
  border-color: var(--border-accent);
}

.vad-config.visible {
  display: flex;
}

.vad-config-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.vad-config-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.vad-toggle-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.vad-toggle-group label {
  font-size: 0.9rem;
  color: var(--text-primary);
  cursor: pointer;
}

.vad-toggle-group input[type="checkbox"] {
  accent-color: var(--red-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.vad-slider-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.vad-slider-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.vad-slider-group input[type="range"] {
  flex: 1;
  min-width: 100px;
  accent-color: var(--red-primary);
  cursor: pointer;
}

.vad-slider-group .vad-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 2.5em;
  text-align: right;
}

/* ─── Video Preview (Phase 4) ────────────────────────────────────── */
.video-preview-container {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: var(--space-sm);
}

.video-preview-container.visible {
  display: flex;
}

.video-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.video-preview-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-video-toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1;
  transition: all var(--transition-fast);
}

.btn-video-toggle:hover {
  border-color: var(--red-primary);
  color: var(--text-primary);
}

.video-preview-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-camera-flip:active {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

.video-preview {
  width: 100%;
  max-width: 320px;
  height: auto;
  aspect-ratio: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: #000;
  object-fit: cover;
  transform: scaleX(-1); /* Mirror for front-facing camera self-view #49 */
  overflow: hidden;
  min-width: 160px;
  transition: max-width 0.2s ease;
}

.video-preview.expanded {
  max-width: 480px;
}

.video-preview-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.video-frame-stats {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.video-latency-warning {
  color: var(--maple);
  margin-left: var(--space-xs);
  cursor: help;
}

.video-quality-grade {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.15rem var(--space-sm);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.video-quality-grade.visible {
  display: inline-block;
}

.video-quality-grade.good {
  background: rgba(52, 211, 153, 0.15);
  color: var(--color-success);
}

.video-quality-grade.degraded {
  background: rgba(245, 195, 106, 0.15);
  color: var(--color-warning);
}

.video-quality-grade.poor {
  background: rgba(232, 82, 82, 0.15);
  color: var(--color-danger);
}

/* ─── Video FPS Config (Phase 4) ─────────────────────────────────── */
.video-fps-config {
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
  padding: 0.75rem var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base);
}

.video-fps-config:hover {
  border-color: var(--border-accent);
}

.video-fps-config.visible {
  display: flex;
}

.video-fps-config-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.1rem;
}

.video-fps-config-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.video-fps-slider-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}

.video-fps-slider-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.video-fps-slider-group input[type="range"] {
  flex: 1;
  min-width: 100px;
  accent-color: var(--red-primary);
  cursor: pointer;
}

.video-fps-slider-group .video-fps-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 3.5em;
  text-align: right;
}

/* ─── Video Consent Error (Phase 4) ──────────────────────────────── */
.video-consent-error {
  font-size: 0.8rem;
  color: var(--color-danger);
  display: none;
  padding: var(--space-xs) 0;
}

.video-consent-error.visible {
  display: block;
}

/* ── Privacy Notice (#128) ─────────────────────────────────────── */
.privacy-notice {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: var(--space-sm) 0 0;
  padding: var(--space-xs) var(--space-sm);
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid var(--text-muted);
  border-radius: 2px;
}

/* ── History Delete Button (#128) ──────────────────────────────── */
.history-delete-btn {
  background: transparent;
  color: var(--color-danger, #dc3545);
  border: 1px solid var(--color-danger, #dc3545);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.history-delete-btn:hover:not(:disabled) {
  background: var(--color-danger, #dc3545);
  color: var(--bg-card, #fff);
}

.history-delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Evidence Link (Phase 3) ────────────────────────────────────── */
.evidence-link {
  color: var(--red-primary);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  border-radius: 2px;
  padding: 0 2px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.evidence-link:hover {
  background: rgba(193, 59, 59, 0.12);
  color: var(--maple-light);
  text-decoration-style: solid;
}

/* Evidence quotes that couldn't be matched */
.evidence-no-match {
  color: var(--text-muted);
  font-style: italic;
}

/* ─── Segment Highlight (Phase 3) ────────────────────────────────── */
.segment-highlight {
  background: rgba(193, 59, 59, 0.15);
  border-left: 3px solid var(--red-primary);
  padding-left: var(--space-sm);
  border-radius: 2px;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
}

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app {
    padding: var(--space-md) var(--space-sm);
    gap: var(--space-md);
  }

  .header {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
  }

  .header h1 {
    font-size: 1.15rem;
  }

  .controls {
    gap: var(--space-sm);
  }

  .btn {
    padding: 0.5rem var(--space-md);
    font-size: 0.9rem;
  }

  .btn-panic {
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  /* #49: Full-width video on tablet/mobile */
  .video-preview {
    max-width: 100%;
  }

  .video-preview.expanded {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  .header h1 {
    font-size: 1rem;
  }

  /* #30: Stack status bar elements on mobile */
  .status-bar {
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.85rem;
  }

  .status-text {
    flex-basis: calc(100% - 2rem);
    min-width: 0;
  }

  .consent-status {
    font-size: 0.75rem;
    flex-basis: 100%;
    padding: 0;
  }

  .elapsed-time {
    font-size: 1.1rem;
  }

  .audio-level {
    width: 60px;
  }
}

/* ─── Upload Button & Progress ───────────────────────────────────────── */

.btn-upload {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.btn-upload:hover {
  border-color: var(--red-primary);
  color: var(--text-primary);
  background: hsla(0, 70%, 50%, 0.08);
}

.upload-progress {
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
}

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

.upload-progress-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.upload-progress-stage {
  font-size: 0.8rem;
  color: var(--red-primary);
  font-weight: 500;
}

.upload-progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg-body);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--red-primary), var(--red-glow));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.upload-progress-message {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-sm);
  margin-bottom: 0;
}

/* ─── Pipeline Stepper (#96) ─────────────────────────────────────── */
.upload-pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 12px 0 8px;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: 0.35;
  transition: opacity 0.3s ease;
}

.pipeline-step.active {
  opacity: 1;
}

.pipeline-step.completed {
  opacity: 0.7;
}

.pipeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.pipeline-step.active .pipeline-dot {
  background: var(--red-primary);
  box-shadow: 0 0 8px rgba(193, 59, 59, 0.5);
  animation: pipeline-pulse 1.5s ease-in-out infinite;
}

.pipeline-step.completed .pipeline-dot {
  background: var(--color-success, #34d399);
}

@keyframes pipeline-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(193, 59, 59, 0.3); }
  50% { box-shadow: 0 0 12px rgba(193, 59, 59, 0.7); }
}

.pipeline-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: inherit;
}

.pipeline-line {
  width: 24px;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 2px;
  margin-bottom: 16px; /* align with dots, not labels */
  transition: background 0.3s ease;
}

.pipeline-line.completed {
  background: var(--color-success, #34d399);
}

/* ─── Mode Tabs (#68) ────────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3px;
  margin-bottom: var(--space-sm);
}

.mode-tab {
  flex: 1;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mode-tab:hover {
  color: var(--text-primary);
  background: rgba(193, 59, 59, 0.06);
}

.mode-tab.active {
  color: var(--text-primary);
  background: rgba(193, 59, 59, 0.12);
  font-weight: 600;
}

/* ─── History Panel (#123) ───────────────────────────────────────── */

.history-panel .panel-body {
  padding: var(--space-sm) 0;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.history-item:hover {
  border-color: var(--border-accent);
}

.history-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  gap: 12px;
  transition: background var(--transition-fast);
}

.history-item-header:hover {
  background: rgba(193, 59, 59, 0.04);
}

.history-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.history-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.history-stat {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 2px 6px;
  background: var(--bg-body);
  border-radius: var(--radius-sm);
}

.history-tag {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 2px 6px;
  background: rgba(193, 59, 59, 0.08);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.history-pass {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.history-pass.pass-good {
  background: rgba(52, 211, 153, 0.15);
  color: var(--color-success);
}

.history-pass.pass-fair {
  background: rgba(245, 195, 106, 0.15);
  color: var(--color-warning);
}

.history-pass.pass-poor {
  background: rgba(232, 82, 82, 0.15);
  color: var(--color-danger);
}

.history-expand-icon {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform var(--transition-fast);
}

/* Expanded detail */
.history-item-detail {
  border-top: 1px solid var(--border-subtle);
  padding: 16px;
  background: var(--bg-body);
}

.history-detail-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-audio-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-play-btn {
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--red-primary), var(--red-glow));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-play-btn:hover {
  box-shadow: 0 2px 12px rgba(193, 59, 59, 0.3);
}

.history-eval-opening,
.history-eval-closing {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  padding: 0 4px;
}

.history-eval-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-eval-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--border-accent);
}

.history-eval-item.commendation {
  background: rgba(52, 211, 153, 0.06);
  border-left-color: var(--color-success);
}

.history-eval-item.recommendation {
  background: rgba(96, 165, 250, 0.06);
  border-left-color: var(--color-info);
}

.history-eval-item-header {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.history-eval-item-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.history-eval-evidence {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--border-subtle);
}

/* ── Category Scores (#144) ──────────────────────────────────────────────── */

.history-category-scores {
  margin: 12px 0 8px;
  padding: 12px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.category-scores-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Radar chart (#151) */
.category-radar-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.category-radar-svg {
  width: 220px;
  height: 220px;
}

.radar-ring {
  fill: none;
  stroke: var(--border-subtle, rgba(255, 255, 255, 0.08));
  stroke-width: 0.5;
}

.radar-axis {
  stroke: var(--border-subtle, rgba(255, 255, 255, 0.08));
  stroke-width: 0.5;
}

.radar-data {
  fill: rgba(200, 80, 80, 0.2);
  stroke: var(--red-primary, #c85050);
  stroke-width: 1.5;
}

.radar-dot {
  fill: var(--red-primary, #c85050);
}

.radar-label {
  font-size: 9px;
  fill: var(--text-secondary, #aaa);
  font-weight: 500;
}

.category-scores-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-score-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 85px;
  flex-shrink: 0;
}

.category-score-track {
  flex: 1;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
}

.category-score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.category-score-fill.score-good {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.category-score-fill.score-fair {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.category-score-fill.score-poor {
  background: linear-gradient(90deg, #f87171, #ef4444);
}

.category-score-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 24px;
  text-align: right;
}

.category-scores-rationale {
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.category-scores-rationale summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.category-scores-rationale summary:hover {
  color: var(--red-primary);
}

.rationale-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 6px;
  padding-left: 8px;
  border-left: 2px solid var(--border-subtle);
}

/* ── Improvement Plan (#145) ─────────────────────────────────────────────── */

#improvement-plan-panel {
  margin-bottom: 16px;
}

.improvement-plan-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.improvement-plan-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.improvement-plan-icon {
  font-size: 1.4rem;
}

.improvement-plan-title {
  flex: 1;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.improvement-plan-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red-primary);
}

.improvement-scores {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.category-score-row.focus-category {
  background: rgba(193, 59, 59, 0.06);
  border-radius: 4px;
  padding: 4px 6px;
  margin: -4px -6px;
}

.improvement-exercises {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.improvement-exercises-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.improvement-exercise {
  padding: 10px 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.exercise-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.exercise-duration {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 10px;
}

.exercise-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.improvement-plan-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 10px;
}

/* ── Habit Report (#147) ─────────────────────────────────────────────────── */

#habits-panel {
  margin-bottom: 16px;
}

.habit-report-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}

.habit-report-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.habit-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.habit-weakness {
  background: rgba(255, 183, 77, 0.08);
  border-left: 3px solid #ffb74d;
}

.habit-breakthrough {
  background: rgba(129, 199, 132, 0.08);
  border-left: 3px solid #81c784;
}

.habit-badge {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.habit-detail {
  flex: 1;
}

.habit-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.habit-avg {
  font-weight: 400;
  color: #ffb74d;
  font-size: 0.8rem;
  margin-left: 4px;
}

.habit-gain {
  font-weight: 700;
  color: #81c784;
  font-size: 0.8rem;
  margin-left: 4px;
}

.habit-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.habit-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 10px;
}

/* -- Goals (#153) --------------------------------------------------------- */

.goals-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.goals-header {
  margin-bottom: 12px;
}

.goals-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.goal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.goal-item.goal-met {
  background: rgba(129, 199, 132, 0.08);
  border-left: 3px solid #81c784;
}

.goal-item.goal-not-met {
  background: rgba(255, 183, 77, 0.08);
  border-left: 3px solid #ffb74d;
}

.goal-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.goal-detail {
  flex: 1;
  min-width: 0;
}

.goal-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.goal-bar-track {
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  margin: 6px 0 4px;
  overflow: hidden;
}

.goal-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.goal-bar-fill.goal-met { background: #81c784; }
.goal-bar-fill.goal-not-met { background: #ffb74d; }

.goal-current {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.goal-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s;
}

.goal-delete-btn:hover { color: var(--red-primary); }

.goal-add-form { margin-top: 12px; }

.goal-add-form summary {
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.goal-form-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.goal-form-fields select,
.goal-form-fields input {
  background: var(--bg-body);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 4px);
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: 0.8rem;
}

.goal-submit-btn {
  padding: 6px 14px;
  font-size: 0.8rem;
}

/* -- Comparative Analytics (#154) ----------------------------------------- */

.compare-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 4px;
}

.compare-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--red-primary, #c85050);
}

.compare-content {
  background: var(--bg-card);
  border: 1px solid var(--red-primary, #c85050);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.compare-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compare-clear-btn {
  padding: 4px 12px;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.compare-clear-btn:hover {
  border-color: var(--red-primary);
  color: var(--red-primary);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.compare-table th,
.compare-table td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}

.compare-table th {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.78rem;
}

.compare-table th small {
  font-weight: 400;
  color: var(--text-muted);
}

.compare-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
}

.delta-good { color: #81c784; font-weight: 600; }
.delta-bad { color: #e57373; font-weight: 600; }
.delta-neutral { color: var(--text-muted); }

/* ── Practice Mode (#146) ────────────────────────────────────────────────── */

.practice-mode-label {
  background: rgba(100, 181, 246, 0.08);
  border: 1px solid rgba(100, 181, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.history-links {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.history-link {
  font-size: 0.8rem;
  color: var(--red-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.history-link:hover {
  color: var(--maple-light);
  text-decoration: underline;
}

.history-no-eval,
.history-error {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
}

.history-loading-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 12px;
}

/* Empty state */
.history-empty {
  text-align: center;
  padding: 40px 20px;
}

.history-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.history-empty-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.history-empty-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Spinner */
.history-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.history-spinner-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--red-primary);
  animation: history-spin 0.8s linear infinite;
}

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

.history-load-more {
  width: 100%;
  margin-top: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.history-load-more:hover {
  border-color: var(--red-primary);
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .history-item-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .history-item-stats {
    flex-wrap: wrap;
    gap: 4px;
  }
}

/* ─── Collapsible Config Sections (#137) ─────────────────────────── */

.config-section {
  background: var(--bg-card, #1e1e1e);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  margin-bottom: 8px;
  overflow: hidden;
}

.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #aaa);
  cursor: pointer;
  user-select: none;
  list-style: none; /* remove default disclosure triangle */
}

.config-header::-webkit-details-marker {
  display: none;
}

.config-header::after {
  content: "▸";
  font-size: 0.9em;
  transition: transform 0.2s ease;
  color: var(--text-muted, #666);
}

.config-section[open] > .config-header::after {
  transform: rotate(90deg);
}

.config-body {
  padding: 0 18px 14px;
}

.config-summary-value {
  font-weight: 400;
  font-size: 0.85em;
  color: var(--text-muted, #666);
  text-transform: none;
  letter-spacing: normal;
}

/* ── Operator Notes (#164) ──────────────────────────────────────── */

.operator-notes-textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  background: var(--bg-card, #1a1a2e);
  border: 1px solid var(--border-default, #333);
  border-radius: 6px;
  color: var(--text-primary, #e6e6e6);
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.operator-notes-textarea:focus {
  border-color: var(--red-primary, #e63946);
  outline: none;
}

.operator-notes-textarea::placeholder {
  color: var(--text-secondary, #888);
  font-style: italic;
}

.operator-notes-counter {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-secondary, #888);
  margin-top: 4px;
}

/* ─── Feedback Style Options (#137) ─────────────────────────────── */

.feedback-style-config {
  display: flex;
  flex-direction: column;
}

.feedback-style-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feedback-style-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.feedback-style-option:hover {
  background: rgba(255, 255, 255, 0.04);
}

.feedback-style-option input[type="radio"] {
  accent-color: var(--red-primary, #e53935);
}

/* ─── Sticky Action Bar (#137) ──────────────────────────────────── */

.controls-sticky {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: var(--bg-card, #1e1e1e);
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom, 8px);
}

/* Add bottom padding so content isn't hidden behind sticky bar */
.app {
  padding-bottom: 80px;
}

/* Remove inner titles from sections now using details/summary */
.config-section .vad-config-title,
.config-section .analysis-tier-title {
  display: none;
}

/* ─── Evaluation Style Items (#135) ─────────────────────────────── */

.style-items-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.style-item-card {
  background: var(--bg-card, #1e1e1e);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-left: 3px solid var(--red-primary, #e53935);
  border-radius: 8px;
  padding: 14px 16px;
}

.style-item-header {
  font-size: 1.1em;
  margin-bottom: 8px;
}

.style-item-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.style-item-field:last-child {
  margin-bottom: 0;
}

.style-field-label {
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #aaa);
}

.style-field-value {
  color: var(--text-primary, #e0e0e0);
  line-height: 1.5;
}

.style-field-list {
  margin: 4px 0 0 0;
  padding-left: 1.2em;
  color: var(--text-primary, #e0e0e0);
  line-height: 1.6;
  font-size: 0.9em;
}

.style-items-fallback {
  background: var(--bg-card, #1e1e1e);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  padding: 12px;
  font-size: 0.85em;
  color: var(--text-secondary, #aaa);
  overflow-x: auto;
  white-space: pre-wrap;
}

.eval-section {
  margin: 12px 0;
  line-height: 1.6;
  color: var(--text-primary, #e0e0e0);
}

.eval-opening {
  font-style: italic;
  margin-bottom: 8px;
}

.eval-closing {
  font-style: italic;
  margin-top: 8px;
}

/* ─── Progress Chart Panel (#140) ───────────────────────────────── */

.progress-chart-panel {
  background: var(--bg-card, #1e1e1e);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.progress-header {
  margin-bottom: 12px;
}

.progress-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary, #aaa);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.progress-metrics {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.progress-metric {
  flex: 1 1 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.progress-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #666);
}

.sparkline {
  display: block;
  width: 100%;
  max-width: 200px;
  height: 40px;
}

.progress-metric-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
  display: flex;
  align-items: center;
  gap: 6px;
}

.trend-positive {
  color: #81c784;
  font-size: 0.8rem;
}

.trend-negative {
  color: #e57373;
  font-size: 0.8rem;
}

/* ─── Responsive: Tablet (≤768px) (#139) ────────────────────────── */
@media (max-width: 768px) {
  .app {
    padding: var(--space-md) var(--space-sm);
    gap: var(--space-md);
    padding-bottom: 90px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .panel {
    padding: 14px;
  }

  .config-header {
    padding: 12px 14px;
    min-height: 44px;
  }

  .config-body {
    padding: 0 14px 12px;
  }

  .controls-sticky {
    padding: 12px 14px;
  }

  /* Ensure 44px touch targets on all buttons */
  .btn, button, .mode-tab {
    min-height: 44px;
    min-width: 44px;
    font-size: 0.85rem;
  }

  /* Touch-friendly checkbox/radio targets */
  .consent-option, .analysis-tier-option, .feedback-style-option {
    min-height: 44px;
    padding: 10px 12px;
  }

  /* Evaluation style cards */
  .style-item-card {
    padding: 12px 14px;
  }
}

/* ─── Responsive: Phone (≤480px) (#139) ─────────────────────────── */
@media (max-width: 480px) {
  .app {
    padding: var(--space-sm) 8px;
    gap: var(--space-sm);
    padding-bottom: 100px;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .panel {
    padding: 10px;
    border-radius: 8px;
  }

  .panel-title {
    font-size: 0.85rem;
  }

  .config-section {
    border-radius: 8px;
    margin-bottom: 6px;
  }

  .config-header {
    padding: 10px 12px;
    font-size: 0.75rem;
  }

  .config-body {
    padding: 0 12px 10px;
  }

  .controls-sticky {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .controls-sticky .btn {
    flex: 1 1 auto;
    min-width: 120px;
    justify-content: center;
  }

  /* Smaller text in evaluation content on phone */
  .evaluation-content, .transcript-content {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* History cards */
  .history-entry {
    padding: 10px;
  }

  /* Mode tabs: full width on phone */
  .mode-tabs {
    flex-wrap: wrap;
  }

  .mode-tab {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }

  /* Footer */
  .footer {
    font-size: 0.7rem;
    padding: 8px;
  }
}

/* ─── Print Styles (PDF Export #71) ──────────────────────────────── */
@media print {
  body { background: #fff; color: #222; }
  .app { padding: 0; gap: 0.5rem; }
  .header, .controls, .mode-tabs, .footer, .status-bar,
  .upload-progress, .speaking-indicator, .btn-panic,
  .video-preview-container, .consent-form, .vad-config,
  .video-fps-config, .project-context-form, .consent-status,
  .time-limit-control, .vad-notification, .purge-banner { display: none !important; }
  .panel { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
  .panel-content { color: #333; }
}

/* ─── Coaching Cue Toast (#155) ──────────────────────────────────── */

#coaching-cue-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  width: min(90vw, 400px);
}

.coaching-cue-toast {
  background: var(--bg-card);
  border: 1px solid var(--red-primary);
  border-left: 4px solid var(--red-primary);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: "Outfit", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(-1rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: auto;
}

.coaching-cue-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Setup Wizard (#156) ────────────────────────────────────────── */

.setup-wizard-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10002;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.setup-wizard-overlay.visible {
  display: flex;
}

.setup-wizard-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg, 16px);
  padding: 2rem;
  width: min(90vw, 480px);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.setup-wizard-steps {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.setup-wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-subtle);
  transition: background 0.3s, transform 0.3s;
}

.setup-wizard-dot.active {
  background: var(--red-primary);
  transform: scale(1.3);
}

.setup-wizard-dot.completed {
  background: var(--color-success, #27ae60);
}

.setup-wizard-content {
  text-align: center;
}

.setup-wizard-content h2 {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
  margin: 0.5rem 0;
  color: var(--text-primary);
}

.setup-wizard-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0.5rem 0 1.5rem;
  line-height: 1.5;
}

.setup-wizard-icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.setup-wizard-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: "Outfit", sans-serif;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.setup-wizard-input:focus {
  border-color: var(--red-primary);
}

.setup-wizard-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  text-align: left;
  margin-bottom: 1.5rem;
  max-height: 280px;
  overflow-y: auto;
}

.setup-wizard-options.tier-options {
  grid-template-columns: 1fr;
}

.setup-wizard-option {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.setup-wizard-option:hover {
  border-color: var(--text-muted);
}

.setup-wizard-option.selected {
  border-color: var(--red-primary);
  background: rgba(193, 59, 59, 0.08);
}

.setup-wizard-option input[type="radio"] {
  display: none;
}

.setup-wizard-option-icon {
  font-size: 1.2rem;
}

.setup-wizard-option-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.setup-wizard-option-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.setup-wizard-option.tier {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.setup-wizard-nav {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.setup-wizard-btn {
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: "Outfit", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.setup-wizard-btn:active {
  transform: scale(0.97);
}

.setup-wizard-btn.primary {
  background: var(--red-primary);
  color: #fff;
}

.setup-wizard-btn.primary:hover {
  background: var(--red-dark, #a33030);
}

.setup-wizard-btn.secondary {
  background: var(--border-subtle);
  color: var(--text-primary);
}

.setup-wizard-btn.secondary:hover {
  background: var(--text-muted);
}

.setup-wizard-summary {
  background: var(--bg-surface, rgba(255,255,255,0.03));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.8;
}

.setup-wizard-summary strong {
  color: var(--text-primary);
}

@media (max-width: 480px) {
  .setup-wizard-options {
    grid-template-columns: 1fr;
  }
}

/* ─── SVG Icon System (#182) ──────────────────────────────────────────────── */

.btn svg,
.mode-tab svg {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.15em;
  margin-right: 0.3em;
  flex-shrink: 0;
}

.mode-tab svg {
  width: 1em;
  height: 1em;
}

/* ─── Advanced Settings (#180) ────────────────────────────────────────────── */

.advanced-settings {
  margin-bottom: 1rem;
}

.advanced-settings-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  list-style: none;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.advanced-settings-toggle:hover {
  color: var(--text-primary);
  border-color: var(--border-accent);
}

.advanced-settings-toggle::-webkit-details-marker {
  display: none;
}

.advanced-settings-toggle svg {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

.advanced-settings[open] .advanced-settings-toggle {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.advanced-settings-body {
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 0.75rem;
  background: var(--bg-secondary);
}

/* ─── Meeting Mode (#174, #175) ──────────────────────────────────────────── */

.meeting-mode-entry {
  padding: 0.75rem 1rem;
}

.meeting-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95em;
  color: var(--text-primary);
}

.meeting-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.meeting-panel-header {
  margin-bottom: 0.75rem;
}

.meeting-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.meeting-meta {
  display: flex;
  gap: 0.75rem;
}

.meeting-consent-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.meeting-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.85em;
}

.btn--danger {
  background: var(--red-primary, #c13b3b);
  color: #fff;
  border: none;
}

.btn--danger:hover {
  opacity: 0.9;
}

.meeting-slot-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.meeting-slot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input, var(--bg-card));
  transition: border-color 0.15s;
}

.meeting-slot--active {
  border-color: var(--red-primary, #c13b3b);
  background: rgba(193, 59, 59, 0.08);
}

.meeting-slot--completed {
  opacity: 0.6;
}

.meeting-slot--skipped {
  opacity: 0.4;
  text-decoration: line-through;
}

.meeting-slot-order {
  font-weight: 600;
  font-size: 0.85em;
  color: var(--text-secondary);
  min-width: 1.5em;
  text-align: right;
}

.meeting-slot-icon {
  font-size: 1em;
}

.meeting-slot-name,
.meeting-slot-title {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font-size: 0.9em;
  color: var(--text-primary);
  font-family: inherit;
}

.meeting-slot-name:focus,
.meeting-slot-title:focus {
  border-color: var(--border);
  background: var(--bg-input, var(--bg-card));
  outline: none;
}

.meeting-slot-title {
  font-size: 0.8em;
  color: var(--text-secondary);
}

.meeting-slot-status {
  font-size: 0.85em;
}

.meeting-slot-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  flex-shrink: 0;
}

.meeting-slot-active-label {
  font-size: 0.75em;
  font-weight: 600;
  color: var(--red-primary, #c13b3b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.8em;
  cursor: pointer;
  color: var(--text-secondary);
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-hover, rgba(0,0,0,0.05));
}

.btn-icon--danger:hover {
  color: var(--red-primary, #c13b3b);
}

@media (max-width: 480px) {
  .meeting-meta {
    flex-direction: column;
  }

  .meeting-meta .form-group {
    width: 100% !important;
  }

  .meeting-slot {
    flex-wrap: wrap;
  }

  .meeting-slot-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.25rem;
  }
}

/* ─── Mobile Sticky Bar Polish (#183) ─────────────────────────────────── */

@media (max-width: 480px) {
  .controls-sticky {
    flex-direction: column;
    gap: 0.4rem;
  }

  .controls-sticky .btn {
    width: 100%;
    min-width: unset;
    flex: unset;
  }

  .controls-sticky .btn-save,
  .controls-sticky .btn-revoke {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    min-height: 36px;
  }
}

/* Start button hero size */
#btn-start {
  font-size: 1.05rem;
  min-height: 48px;
}

@media (max-width: 480px) {
  #btn-start {
    font-size: 1.1rem;
    min-height: 52px;
  }
}

/* Mode tabs horizontal scroll instead of wrap */
.mode-tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mode-tabs::-webkit-scrollbar {
  display: none;
}

/* ─── Meeting History (#176) ─────────────────────────────────────────── */

.history-section-title {
  font-size: 1em;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text-primary);
}

.meeting-history-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.meeting-history-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  background: var(--bg-input, var(--bg-card));
}

.meeting-history-date {
  font-weight: 600;
  font-size: 0.9em;
}

.meeting-history-club {
  color: var(--text-secondary);
  font-size: 0.85em;
}

.meeting-history-count {
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 0.8em;
}

.meeting-history-expand {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8em;
  padding: 2px 4px;
}

.meeting-history-detail {
  padding: 0.5rem 0.75rem;
}

.meeting-eval-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9em;
  flex-wrap: wrap;
}

.meeting-eval-row:last-child {
  border-bottom: none;
}

.meeting-eval-row--skipped {
  opacity: 0.5;
}

.meeting-eval-meta {
  color: var(--text-secondary);
  font-size: 0.8em;
  margin-left: auto;
}

.meeting-eval-actions {
  flex-shrink: 0;
}