/* ── Admin Pages ──
   Page-specific styles: messages, conversation detail, audio playback,
   latency timeline, diagnoses, debug panel, feedback, ratings,
   simulation evaluation, extraction viewer, audit mode, login.
   Split from admin.css (Phase 4, Step B4). */

/* Messages */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}

.message-card {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-primary);
  border: 1px solid var(--border-color-light);
  box-shadow: var(--shadow-sm);
}

.message-card.user {
  border-left: 4px solid var(--color-primary);
}

.message-card.assistant {
  border-left: 4px solid var(--color-info);
}

.message-card.system {
  border-left: 4px solid var(--color-warning);
  background: var(--bg-secondary);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.message-text {
  white-space: pre-wrap;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.message-error {
  margin-top: 8px;
  color: var(--color-error);
  font-size: 0.85rem;
}

.message-card.system-notice {
  border-left: 4px solid var(--text-tertiary);
  background: transparent;
  opacity: 0.75;
}

.message-card.system-notice .message-text {
  font-style: italic;
  color: var(--text-tertiary);
}

.notice-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-size: 0.65rem;
  font-variant: small-caps;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Provider/model attribution badge — visible only in the
   global-admin transcript view (gated in _message_list.html). Same
   visual weight as .notice-badge so it sits in the message-meta
   row without dominating; the slightly different background hue
   keeps it distinguishable from the "system" notice marker.
   Production-readiness audit 2026-05-27. */
.llm-provider-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary, var(--bg-secondary));
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.3px;
}

.failed-text {
  color: var(--text-tertiary);
  font-style: italic;
}

.failed-text .error-detail {
  color: var(--color-error);
  font-size: 0.85rem;
}

.details-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* JSON Block */
.json-block {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color-light);
  padding: 16px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* GP Summary Block (prose, not monospace) */
.summary-block {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color-light);
  padding: 16px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.6;
}

/* Structured GP Summary — footnote references */
sup.turn-ref {
  font-size: 0.7em;
  color: var(--color-primary);
  cursor: pointer;
  margin: 0 1px;
  font-weight: 600;
}

sup.turn-ref:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

.turn-ref-tooltip {
  max-width: 300px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 10px 12px;
  font-size: 0.85rem;
  line-height: 1.4;
  z-index: 1000;
}

.turn-ref-tooltip-quote {
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.turn-ref-tooltip-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.turn-ref-tooltip-link {
  font-size: 0.8rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.turn-ref-tooltip-link:hover {
  text-decoration: underline;
}

@keyframes turn-highlight-flash {
  0% { background-color: var(--color-primary-bg); }
  100% { background-color: transparent; }
}

.message-card.turn-highlight {
  animation: turn-highlight-flash 2s ease-out;
}

/* Differential Diagnosis */
.differential-content {
  padding: 12px 0;
}

.differential-meta {
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-info);
}

.differential-meta small {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.differential-meta .duration {
  font-weight: 600;
  color: var(--color-info);
}

.clinical-summary {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.red-flags {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.red-flags ul {
  margin: 8px 0 0 20px;
  padding: 0;
}

.diagnosis-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
}

.diagnosis-item summary {
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  list-style: none;
}

.diagnosis-item summary::-webkit-details-marker {
  display: none;
}

.diagnosis-item summary::before {
  content: "▶";
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: transform 0.2s;
}

.diagnosis-item[open] summary::before {
  transform: rotate(90deg);
}

.diagnosis-item .rank {
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.diagnosis-item .name {
  flex: 1;
}

/* Likelihood Badge */
.likelihood-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.likelihood-badge.likelihood-high {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.likelihood-badge.likelihood-medium {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.likelihood-badge.likelihood-low {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.diagnosis-details {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color-light);
  background: var(--bg-secondary);
}

.diagnosis-details p {
  margin: 8px 0;
}

/* Investigations */
.investigations-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.investigation-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 8px;
}

.investigation-item p {
  margin: 6px 0 0;
}

/* Urgency Badge */
.urgency-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 8px;
}

.urgency-badge.urgency-routine {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.urgency-badge.urgency-soon {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.urgency-badge.urgency-urgent {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.limitations {
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 16px;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

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

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto 16px;
  line-height: 1.5;
}

/* HTMX Indicators (extends base.css — admin uses inline not inline-block) */
.htmx-request .htmx-indicator {
  display: inline;
}

.htmx-request.htmx-indicator {
  display: inline;
}

/* Error Message */
.error-message {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
  color: var(--color-error);
  padding: 12px;
  border-radius: var(--radius-md);
}

/* Extraction Details */
details.extraction {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color-light);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

details.extraction summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  list-style: none;
}

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

.summary-meta {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Mobile Menu */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: background 0.2s ease;
}

.hamburger-btn:hover {
  background: var(--bg-tertiary);
}

.hamburger-btn svg {
  display: block;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay-scrim);
  z-index: 299;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.mobile-menu-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  max-width: 80vw;
  height: 100vh;
  background: var(--bg-primary);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  transition: right 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.mobile-menu.open {
  right: 0;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.mobile-menu-title {
  font-weight: 700;
  font-size: 1rem;
}

.mobile-menu-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.mobile-menu-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.mobile-menu-links {
  padding: 12px 0;
}

.mobile-menu-links a {
  display: block;
  padding: 14px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.mobile-menu-links a:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.mobile-menu-links a.active {
  background: var(--color-primary-bg);
  color: var(--color-primary-dark);
  border-left-color: var(--color-primary);
}

/* POST-only shortcuts render as a <form><button>; make them look exactly
   like the sibling <a> menu items (issue 663). */
.mobile-nav-form {
  margin: 0;
}

.mobile-nav-form-button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 20px;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.2s ease;
}

.mobile-nav-form-button:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.mobile-nav-form-button.active {
  background: var(--color-primary-bg);
  color: var(--color-primary-dark);
  border-left-color: var(--color-primary);
}

.mobile-menu-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 12px 20px;
}

.mobile-menu-section-label {
  display: block;
  padding: 8px 20px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  font-weight: 600;
}

/* Desktop dev nav links - subtle visual distinction */
.admin-link.admin-link-dev {
  color: var(--text-tertiary);
}

.admin-link.admin-link-dev:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.admin-link.admin-link-dev.active {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Issue 1736: clinic dashboard bridge — accent it so the doctor's
   primary surface is the obvious entry point from the team console.
   Spec 2026-08-02 D2: it is a SURFACE SWITCH, not a console destination, so it
   sits before the registry-driven items behind a divider rather than competing
   with them. `nowrap` because the swirl + label wrapped onto two lines once the
   nav row stopped wrapping, which made the header tall again for one link. */
.admin-link-clinic {
  color: var(--color-primary-dark);
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  padding-right: 14px;
  border-right: 1px solid var(--border-color);
}

/* Audri swirl prefixing the clinic bridge link (base `.audri-mark` in
   base.css); inherits the link's color so it tints with the link. */
.admin-clinic-mark {
  color: inherit;
  font-size: 1.1em;
  vertical-align: -0.15em;
}

.admin-link-clinic:hover {
  background: var(--color-primary-bg);
  color: var(--color-primary-dark);
}

.mobile-menu-actions {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
}

.mobile-menu-actions button {
  width: 100%;
}

.mobile-menu-user {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 0;
  margin-bottom: 12px;
  text-align: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

/* Mobile Responsive.

   900px, not 768px (spec 2026-08-02 D2). The console header needs roughly
   1150px to lay its brand + nav + account cluster out comfortably; between
   768 and 900 the old breakpoint left a desktop nav with no room, which used
   to show up as extra wrapped rows and now shows up as a scrolling nav. The
   off-canvas menu is simply the better presentation below ~900. */
@media (max-width: 900px) {
  .hamburger-btn {
    display: block;
  }

  .mobile-menu,
  .mobile-menu-overlay {
    display: block;
  }

  .admin-links {
    display: none;
  }

  .admin-actions {
    display: none;
  }

  /* Hide the header-level practice switcher on mobile;
     the mobile slide-out menu has its own copy. It is inside .admin-actions
     now, so this also covers the pre-2026-08-02 direct-child markup. */
  .admin-header .admin-nav > .practice-switcher,
  .admin-header .admin-nav > .practice-badge {
    display: none;
  }

  .admin-nav {
    justify-content: space-between;
  }
}

@media (max-width: 720px) {
  .filter-actions {
    margin-left: 0;
  }
}

/* Voice/Modality Indicators */
.modality-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* .modality-icon lives in shared-components.css — reused by the clinician
   summary transcript header. */

.audio-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-success);
}

/* Audio Playback */
.audio-playback-section {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border-color-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: all 0.2s ease;
}

.audio-playback-section.is-stuck {
  /* Break out of container to span full width */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  border-radius: 0;
  padding: 10px 20px;
  margin-bottom: 0;
  border: none;
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@supports (backdrop-filter: blur(8px)) {
  .audio-playback-section {
    backdrop-filter: blur(8px);
    background: var(--bg-primary);
    opacity: 0.98;
  }
}

.audio-playback-section h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-playback-section.is-stuck h2 {
  display: none;
}

@media (max-width: 768px) {
  .audio-playback-section {
    padding: 16px;
  }

  .audio-playback-section.is-stuck {
    padding: 8px 12px;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .audio-playback-section h2 {
    font-size: 1rem;
    margin-bottom: 10px;
  }
}

.audio-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.audio-playback-section.is-stuck .audio-controls {
  gap: 8px;
  margin-bottom: 0;
  flex: 1;
}

@media (max-width: 768px) {
  .audio-controls {
    gap: 8px;
    margin-bottom: 12px;
  }

  .audio-playback-section.is-stuck .audio-controls {
    gap: 6px;
  }
}

.audio-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--color-primary);
  color: var(--text-on-primary);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.audio-playback-section.is-stuck .audio-btn {
  padding: 6px 12px;
  font-size: 0.85rem;
}

@media (max-width: 768px) {
  .audio-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    gap: 4px;
  }

  .audio-playback-section.is-stuck .audio-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  .audio-btn svg {
    width: 14px;
    height: 14px;
  }

  .audio-playback-section.is-stuck .audio-btn svg {
    width: 12px;
    height: 12px;
  }
}

.audio-btn:hover:not(:disabled) {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

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

.audio-btn.secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.audio-btn.secondary:hover:not(:disabled) {
  background: var(--border-color);
}

.audio-btn.playing {
  background: var(--color-error);
}

/* Playback Speed */
.playback-speed {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.audio-playback-section.is-stuck .playback-speed {
  gap: 6px;
  font-size: 0.8rem;
}

.playback-speed label {
  color: var(--text-secondary);
}

.playback-speed select {
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 0.85rem;
  color: var(--text-primary);
}

.audio-playback-section.is-stuck .playback-speed select {
  padding: 4px 8px;
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  .playback-speed {
    font-size: 0.8rem;
    gap: 6px;
  }

  .audio-playback-section.is-stuck .playback-speed {
    font-size: 0.75rem;
    gap: 4px;
  }

  .playback-speed select {
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  .audio-playback-section.is-stuck .playback-speed select {
    padding: 4px 6px;
    font-size: 0.75rem;
  }
}

/* Waveform */
.waveform-container {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
  min-height: 80px;
}

/* Playback Progress */
.playback-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-bar-container {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: pointer;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.1s linear;
}

/* Latency Timeline */
.latency-timeline {
  margin: 20px 0;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.latency-timeline h3 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.latency-bar {
  display: flex;
  align-items: center;
  margin: 8px 0;
  gap: 2px;
  height: 24px;
}

.latency-bar .stt {
  height: 100%;
  background: var(--color-success);
  min-width: 2px;
  border-radius: 2px 0 0 2px;
}

.latency-bar .llm {
  height: 100%;
  background: var(--color-info);
  min-width: 2px;
}

.latency-bar .tts {
  height: 100%;
  background: var(--color-warning);
  min-width: 2px;
  border-radius: 0 2px 2px 0;
}

.latency-bar .total {
  margin-left: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.latency-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.75rem;
}

.latency-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.latency-legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.latency-legend-item .dot.stt {
  background: var(--color-success);
}
.latency-legend-item .dot.llm {
  background: var(--color-info);
}
.latency-legend-item .dot.tts {
  background: var(--color-warning);
}

/* Message Playback States */
.message-card.playing {
  background: var(--color-primary-bg);
  border-left-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-bg);
}

/* Transient notice shown when message audio fails to load (e.g. still
   uploading — HTTP 202 — when the conversation is opened mid-call). */
.audio-load-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: 440px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  line-height: 1.4;
}

.audio-load-notice-warn {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
  border-color: var(--color-warning-border);
}

.message-card .play-audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.message-card .play-audio-btn:hover {
  background: var(--color-primary-bg);
}

.message-card .download-audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  color: var(--color-primary-dark);
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.message-card .download-audio-btn:hover {
  background: var(--color-primary-bg);
}

.message-latency {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.message-latency span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Transcription Confidence */
.message-latency .low-confidence {
  color: var(--color-error);
}

.message-latency .medium-confidence {
  color: var(--color-warning);
}

.message-latency .high-confidence {
  color: var(--color-success);
}

/* Per-word transcription confidence highlighting */
.word-confidence {
  padding: 0 1px;
  border-radius: 2px;
  position: relative;
  cursor: default;
}

/* Instant CSS tooltip — no delay unlike native title attr */
.word-confidence::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.word-confidence:hover::after,
.word-confidence.tooltip-visible::after {
  opacity: 1;
}

.word-confidence-medium {
  background-color: var(--color-warning-bg);
  border-bottom: 2px solid var(--color-warning);
}

.word-confidence-low {
  background-color: var(--color-error-bg);
  border-bottom: 2px solid var(--color-error);
}

.no-audio-message {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* Modality Badge */
.modality-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.modality-badge.voice {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.modality-badge.chat {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* Collapsible Sections */
.collapsible {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color-light);
  margin-bottom: 16px;
  overflow: hidden;
}

.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: background 0.2s ease;
}

.collapsible-header:hover {
  background: var(--bg-tertiary);
}

.collapsible-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collapsible-toggle {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  transition: transform 0.2s ease;
}

.collapsible.open .collapsible-toggle {
  transform: rotate(180deg);
}

.collapsible-content {
  display: none;
  padding: 0 20px 20px;
  max-height: 600px;
  overflow-y: auto;
}

.collapsible.open .collapsible-content {
  display: block;
}

.collapsible-content pre {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  margin: 12px 0 0;
  border: 1px solid var(--border-color-light);
}

/* Debug Panel */
.debug-panel {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color-light);
  box-shadow: var(--shadow-sm);
  margin-top: 24px;
  margin-bottom: 24px;
}

.debug-panel h2 {
  font-size: 1.2rem;
  padding: 20px;
  margin: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tab Badges (extends .tab-btn from admin-components.css) */
.tab-badge {
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

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

/* Rating Badges */
.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
}

.rating-positive,
.rating-good {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.rating-negative,
.rating-too_early,
.rating-too_late {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.rating-neutral {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

/* Feedback Text */
.feedback-text {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.feedback-text:hover {
  white-space: normal;
  overflow: visible;
}

/* Feedback Section */
.feedback-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.feedback-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ── Simulation Evaluation ── */

/* Action bar for back-links and buttons */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.action-bar-start,
.action-bar-end {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Section spacing between major blocks */
.section {
  margin-bottom: 24px;
}

/* Chat transcript bubbles */
.transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transcript-row {
  display: flex;
}

.transcript-row--assistant {
  justify-content: flex-start;
}

.transcript-row--user {
  justify-content: flex-end;
}

.transcript-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 10px;
}

.transcript-bubble--assistant {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.transcript-bubble--user {
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary);
}

.transcript-role {
  margin-bottom: 4px;
}

.transcript-text {
  white-space: pre-wrap;
}

/* Large stat value for summary cards */
.stat-hero {
  font-size: 1.3rem;
  font-weight: 600;
}

/* Prompt diff display */
.prompt-diff {
  white-space: pre-wrap;
  max-height: 420px;
  overflow: auto;
}

/* Collapsible JSON/prompt viewers */
.expandable-content {
  white-space: pre-wrap;
  max-height: 360px;
  overflow: auto;
  margin-top: 8px;
}


/* ── Extraction Viewer (from extractions.html) ── */

        .extraction-card {
            background: var(--bg-primary);
            border-radius: var(--radius-lg);
            border: 1px solid var(--border-color-light);
            padding: 0;
            box-shadow: var(--shadow-sm);
            margin-bottom: 16px;
            overflow: hidden;
        }

        .extraction-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border-color-light);
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .extraction-header:hover {
            background: var(--bg-tertiary);
        }

        .extraction-header-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .extraction-header-right {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .toggle-icon {
            width: 20px;
            height: 20px;
            color: var(--text-tertiary);
            transition: transform 0.2s ease;
        }

        .extraction-card.open .toggle-icon {
            transform: rotate(180deg);
        }

        .extraction-content {
            display: none;
            padding: 20px;
        }

        .extraction-card.open .extraction-content {
            display: block;
        }

        .view-tabs {
            display: flex;
            gap: 8px;
            margin-bottom: 16px;
        }

        .view-tab {
            padding: 8px 16px;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            background: var(--bg-primary);
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .view-tab:hover {
            background: var(--bg-secondary);
        }

        .view-tab.active {
            background: var(--color-primary-bg);
            color: var(--color-primary-dark);
            border-color: var(--color-primary);
        }

        .view-content {
            display: none;
        }

        .view-content.active {
            display: block;
        }

        .diff-container {
            background: var(--bg-secondary);
            border-radius: var(--radius-md);
            padding: 16px;
            max-height: 600px;
            overflow-y: auto;
        }

        .diff-loading {
            color: var(--text-tertiary);
            font-style: italic;
            text-align: center;
            padding: 20px;
        }

        .no-diff {
            color: var(--text-secondary);
            font-style: italic;
            padding: 12px;
            text-align: center;
            background: var(--bg-secondary);
            border-radius: var(--radius-md);
        }

        /* jsondiffpatch custom styling */
        .jsondiffpatch-delta {
            font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
            font-size: 0.8rem;
        }

        .jsondiffpatch-added .jsondiffpatch-property-name,
        .jsondiffpatch-added .jsondiffpatch-value pre,
        .jsondiffpatch-modified .jsondiffpatch-right-value pre,
        .jsondiffpatch-textdiff-added {
            background: rgba(34, 197, 94, 0.2);
        }

        .jsondiffpatch-deleted .jsondiffpatch-property-name,
        .jsondiffpatch-deleted .jsondiffpatch-value pre,
        .jsondiffpatch-modified .jsondiffpatch-left-value pre,
        .jsondiffpatch-textdiff-deleted {
            background: rgba(239, 68, 68, 0.2);
        }

        .jsondiffpatch-unchanged {
            color: var(--text-tertiary);
        }

        .diff-count-badge {
            background: var(--color-primary-bg);
            color: var(--color-primary-dark);
            padding: 2px 8px;
            border-radius: var(--radius-full);
            font-size: 0.75rem;
            font-weight: 600;
        }

/* ── Audit Mode (from partials/tables/sessions.html) ── */

.audit-content {
  padding: 16px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.audit-section {
  margin-bottom: 12px;
}

.audit-section:last-child {
  margin-bottom: 0;
}

.diagnoses-compact {
  margin-top: 8px;
}

.diagnosis-item-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 4px 0;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

.dx-rank {
  font-weight: bold;
  color: var(--text-secondary);
  min-width: 24px;
}

.dx-name {
  flex: 1;
}

.reviewed-badge {
  color: var(--color-success);
  font-size: 0.875rem;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.btn-icon:hover {
  background: var(--bg-secondary);
}

.audit-details {
  display: none;
}

.loading-state,
.error-state {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ── Audio Debug Sessions (from audio_sessions.html) ── */

        .audio-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 2px 8px;
            border-radius: var(--radius-full);
            font-size: 0.75rem;
            font-weight: 600;
        }

        .audio-badge.available {
            background: var(--color-success-bg);
            color: var(--color-success);
        }

        .audio-badge.unavailable {
            background: var(--bg-tertiary);
            color: var(--text-tertiary);
        }

        .duration-cell {
            font-variant-numeric: tabular-nums;
        }

        .status-cell {
            text-transform: capitalize;
        }

        .status-cell.completed {
            color: var(--color-success);
        }

        .status-cell.recording {
            color: var(--color-warning);
        }

        .status-cell.unknown {
            color: var(--text-tertiary);
        }

        .action-link {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.85rem;
            color: var(--color-primary-dark);
            text-decoration: none;
        }

        .action-link:hover {
            text-decoration: underline;
        }

/* ── Differential Pending (from differential_pending.html) ── */

    .differential-loading {
        background: var(--bg-secondary);
        border: 2px dashed var(--border-color);
        border-radius: var(--radius-md);
        padding: 40px 20px;
        text-align: center;
        min-height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .differential-loading .loading-content {
        max-width: 400px;
    }

    .differential-loading .loading-text {
        color: var(--text-secondary);
        line-height: 1.6;
    }

    .differential-loading .loading-text strong {
        color: var(--text-primary);
        font-size: 1.05rem;
    }

/* ── Login Page (from login.html) ── */

.login-card label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.login-card .form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 16px;
}

.login-note {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 12px;
}

/* The public-demo offer, OUTSIDE the sign-in card.

   Deliberately not a third control inside the card: a clinician arriving with
   credentials should meet exactly one primary action, and a demo link sitting
   under the password field competes with it. Separated by the card boundary it
   reads as what it is — the other door, for the visitor who has no account. */
.login-demo {
  margin-top: var(--space-lg);
  text-align: center;
}

.login-demo-lead {
  margin: 0 0 var(--space-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* The note under the button belongs to this block, so it loses the standalone
   note's top margin (the button already supplies the separation). */
.login-demo .login-note {
  margin-top: var(--space-sm);
}

.bulk-actions {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.col-checkbox {
  width: 40px;
}

/* ── Conversation Detail Page Styles ──
   Extracted from partials/conversation/_styles.html (Phase 4, Step B1).
   Covers: extraction messages, system prompts, JSON diffs,
   waveform/audio debug, VAD timeline, gap analysis, replay testing,
   and transcription confidence indicators. */

    /* Extraction message styles */
    .extraction-message {
        border-left: 4px solid var(--color-warning) !important;
    }

    .extraction-message.collapsed .extraction-content-wrapper {
        display: none;
    }

    .extraction-message .extraction-toggle {
        cursor: pointer;
        user-select: none;
    }

    .extraction-message .toggle-chevron {
        transition: transform 0.2s ease;
        vertical-align: middle;
        margin-right: 4px;
    }

    .extraction-message:not(.collapsed) .toggle-chevron {
        transform: rotate(180deg);
    }

    .extraction-message .extraction-hint {
        color: var(--text-tertiary);
        font-style: italic;
        font-size: 0.75rem;
    }

    .extraction-message:not(.collapsed) .extraction-hint {
        display: none;
    }

    /* System prompt messages - collapsible, collapsed by default */
    .system-prompt-message {
        border-left: 4px solid var(--color-info) !important;
    }

    /* Reasoner internal guidance notes — collapsible, compact (spec
       2026-06-09; operator feedback 2026-06-11: the previous block-divs-
       inside-.message-text shape inherited pre-wrap and rendered template
       indentation as huge padding). Reuses the .system-prompt-toggle /
       .toggle-chevron / .system-prompt-hint interaction styles. */
    .guidance-note-message {
        border-left: 4px solid var(--color-warning) !important;
    }

    .guidance-note-message.collapsed .guidance-note-content {
        display: none;
    }

    .guidance-note-message:not(.collapsed) .toggle-chevron {
        transform: rotate(180deg);
    }

    .guidance-note-message:not(.collapsed) .system-prompt-hint {
        display: none;
    }

    .guidance-note-content {
        font-size: 0.85rem;
    }

    .guidance-note-section-label {
        color: var(--text-tertiary);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin: 8px 0 4px;
    }

    .guidance-note-block {
        white-space: pre-wrap;
        word-wrap: break-word;
        font-size: 0.8rem;
        line-height: 1.45;
        margin: 0;
        padding: 8px 10px;
        background: var(--bg-secondary);
        border-radius: 6px;
    }

    .guidance-note-forensics {
        margin: 0;
        display: grid;
        grid-template-columns: max-content 1fr;
        gap: 2px 12px;
    }

    .guidance-note-forensics dt {
        color: var(--text-tertiary);
        font-size: 0.78rem;
    }

    .guidance-note-forensics dd {
        margin: 0;
        font-size: 0.82rem;
        color: var(--text-primary);
    }

    .system-prompt-message.collapsed .system-prompt-content {
        display: none;
    }

    .system-prompt-message .system-prompt-toggle {
        cursor: pointer;
        user-select: none;
    }

    .system-prompt-message .toggle-chevron {
        transition: transform 0.2s ease;
        vertical-align: middle;
        margin-right: 4px;
    }

    .system-prompt-message:not(.collapsed) .toggle-chevron {
        transform: rotate(180deg);
    }

    .system-prompt-message .system-prompt-hint {
        color: var(--text-tertiary);
        font-style: italic;
        font-size: 0.75rem;
    }

    .system-prompt-message:not(.collapsed) .system-prompt-hint {
        display: none;
    }

    .system-prompt-text {
        white-space: pre-wrap;
        word-wrap: break-word;
        font-size: 0.8rem;
        line-height: 1.5;
        max-height: 400px;
        overflow-y: auto;
        margin: 0;
        padding: 12px;
        background: var(--bg-secondary);
        border-radius: 4px;
    }

    .extraction-content-wrapper {
        padding: 12px 0 0;
    }

    .extraction-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 12px;
    }

    .extraction-tab {
        padding: 6px 14px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        background: var(--bg-primary);
        color: var(--text-secondary);
        cursor: pointer;
        font-size: 0.8rem;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .extraction-tab:hover {
        background: var(--bg-secondary);
    }

    .extraction-tab.active {
        background: var(--color-primary-bg);
        color: var(--color-primary-dark);
        border-color: var(--color-primary);
    }

    .extraction-tab-content {
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        padding: 12px;
        max-height: 500px;
        overflow-y: auto;
    }

    .diff-loading {
        color: var(--text-tertiary);
        font-style: italic;
        text-align: center;
        padding: 20px;
    }

    /* jsondiffpatch custom styling */
    .jsondiffpatch-delta {
        font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
        font-size: 0.8rem;
    }

    .jsondiffpatch-added .jsondiffpatch-property-name,
    .jsondiffpatch-added .jsondiffpatch-value pre,
    .jsondiffpatch-modified .jsondiffpatch-right-value pre,
    .jsondiffpatch-textdiff-added {
        background: rgba(34, 197, 94, 0.2);
    }

    .jsondiffpatch-deleted .jsondiffpatch-property-name,
    .jsondiffpatch-deleted .jsondiffpatch-value pre,
    .jsondiffpatch-modified .jsondiffpatch-left-value pre,
    .jsondiffpatch-textdiff-deleted {
        background: rgba(239, 68, 68, 0.2);
    }

    .no-diff-message {
        color: var(--text-secondary);
        font-style: italic;
        text-align: center;
        padding: 20px;
    }

    /* Waveform styles */
    .waveform-section {
        margin-top: 24px;
        padding: 16px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color-light);
        border-radius: var(--radius-lg);
    }

    .waveform-section h3 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 16px 0;
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .waveform-duration {
        font-weight: 400;
        color: var(--text-tertiary);
        font-size: 0.85rem;
    }

    .waveform-container {
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        padding: 12px;
        margin-bottom: 12px;
        min-height: 128px;
        position: relative;
    }

    #waveform {
        width: 100%;
        min-height: 100px;
    }

    #waveform-timeline {
        width: 100%;
        height: 20px;
    }

    .waveform-controls {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .waveform-time {
        font-family: "SFMono-Regular", Consolas, monospace;
        font-size: 0.9rem;
        color: var(--text-secondary);
        padding: 0 12px;
        display: flex;
        gap: 4px;
    }

    .waveform-zoom {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
    }

    .waveform-zoom label {
        font-size: 0.85rem;
        color: var(--text-tertiary);
    }

    .waveform-zoom input[type="range"] {
        width: 100px;
        cursor: pointer;
    }

    .waveform-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100px;
        color: var(--text-tertiary);
        font-size: 0.9rem;
    }

    .waveform-loading .spinner {
        width: 20px;
        height: 20px;
        border: 2px solid var(--border-color);
        border-top-color: var(--color-primary);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        margin-right: 10px;
    }

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

    /* VAD Timeline Styles (au-sfr.3) */
    .vad-timeline-section {
        margin-top: 16px;
        padding: 16px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color-light);
        border-radius: var(--radius-lg);
    }

    .vad-timeline-section h4 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 12px 0;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .vad-summary-panel {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
        margin-bottom: 16px;
        padding: 12px;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
    }

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

    .vad-stat-value {
        font-size: 1.2rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .vad-stat-label {
        font-size: 0.75rem;
        color: var(--text-tertiary);
        margin-top: 2px;
    }

    .vad-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        margin-bottom: 12px;
        font-size: 0.8rem;
        color: var(--text-secondary);
    }

    .vad-legend-item {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .vad-legend-dot {
        width: 12px;
        height: 12px;
        border-radius: 2px;
    }

    .vad-legend-dot.speech-start {
        background: #22c55e; /* dark-mode-ok */
    }

    .vad-legend-dot.speech-end {
        background: #ef4444; /* dark-mode-ok */
    }

    .vad-legend-dot.confidence {
        background: #eab308; /* dark-mode-ok */
    }

    .vad-legend-dot.audio-level {
        background: #6b7280; /* dark-mode-ok */
    }

    .vad-issues-list {
        margin-top: 12px;
        padding: 12px;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        border-left: 3px solid var(--color-warning);
    }

    .vad-issues-list h5 {
        margin: 0 0 8px 0;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .vad-issue-item {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        padding: 6px 0;
        font-size: 0.8rem;
        border-bottom: 1px solid var(--border-color-light);
    }

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

    .vad-issue-badge {
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 0.7rem;
        font-weight: 500;
        text-transform: uppercase;
    }

    .vad-issue-badge.warning {
        background: rgba(234, 179, 8, 0.2);
        color: #ca8a04; /* dark-mode-ok */
    }

    .vad-issue-badge.info {
        background: rgba(59, 130, 246, 0.2);
        color: #2563eb; /* dark-mode-ok */
    }

    .vad-issue-timestamp {
        font-family: "SFMono-Regular", Consolas, monospace;
        font-size: 0.75rem;
        color: var(--text-tertiary);
    }

    /* Gap Analysis Styles (au-sfr.4) */
    .gap-analysis-section {
        margin-top: 16px;
        padding: 16px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color-light);
        border-radius: var(--radius-lg);
    }

    .gap-analysis-section h4 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 12px 0;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .gap-health-indicator {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 12px;
        border-radius: var(--radius-full);
        font-size: 0.8rem;
        font-weight: 500;
    }

    .gap-health-indicator.healthy {
        background: rgba(34, 197, 94, 0.15);
        color: #16a34a; /* dark-mode-ok */
    }

    .gap-health-indicator.warning {
        background: rgba(234, 179, 8, 0.15);
        color: #ca8a04; /* dark-mode-ok */
    }

    .gap-health-indicator.critical {
        background: rgba(239, 68, 68, 0.15);
        color: #dc2626; /* dark-mode-ok */
    }

    .gap-coverage-bar {
        height: 24px;
        background: var(--bg-tertiary);
        border-radius: var(--radius-md);
        overflow: hidden;
        margin: 12px 0;
        position: relative;
    }

    .gap-coverage-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--color-primary), var(--color-primary-dark));
        transition: width 0.3s ease;
    }

    .gap-coverage-label {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .gap-stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
        margin-bottom: 16px;
    }

    .gap-stat-card {
        padding: 12px;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        text-align: center;
    }

    .gap-stat-value {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .gap-stat-label {
        font-size: 0.75rem;
        color: var(--text-tertiary);
        margin-top: 4px;
    }

    .gap-turns-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.8rem;
        margin-top: 12px;
    }

    .gap-turns-table th,
    .gap-turns-table td {
        padding: 8px 12px;
        text-align: left;
        border-bottom: 1px solid var(--border-color-light);
    }

    .gap-turns-table th {
        font-weight: 600;
        color: var(--text-secondary);
        background: var(--bg-secondary);
    }

    .gap-turns-table td {
        color: var(--text-primary);
    }

    .gap-turns-table .gap-cell {
        font-family: "SFMono-Regular", Consolas, monospace;
    }

    .gap-turns-table .gap-warning {
        color: var(--color-warning);
    }

    /* Replay Testing UI Styles (au-sfr.5) */
    .replay-testing-section {
        margin-top: 16px;
        padding: 16px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color-light);
        border-radius: var(--radius-lg);
    }

    .replay-testing-section h4 {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 12px 0;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .replay-config-panel {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
        padding: 16px;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        margin-bottom: 16px;
    }

    .replay-config-item {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .replay-config-item label {
        font-size: 0.8rem;
        font-weight: 500;
        color: var(--text-secondary);
    }

    .replay-config-item input[type="range"] {
        width: 100%;
    }

    .replay-config-value {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-primary);
        font-family: "SFMono-Regular", Consolas, monospace;
    }

    .replay-controls {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 16px;
    }

    .replay-progress {
        display: none;
        align-items: center;
        gap: 8px;
        padding: 8px 16px;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
        font-size: 0.85rem;
        color: var(--text-secondary);
    }

    .replay-progress.active {
        display: flex;
    }

    .replay-progress .spinner {
        width: 16px;
        height: 16px;
        border: 2px solid var(--border-color);
        border-top-color: var(--color-primary);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

    .replay-results {
        display: none;
        padding: 16px;
        background: var(--bg-secondary);
        border-radius: var(--radius-md);
    }

    .replay-results.visible {
        display: block;
    }

    .replay-results h5 {
        margin: 0 0 12px 0;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .replay-comparison {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-bottom: 16px;
    }

    .replay-comparison-item {
        padding: 12px;
        background: var(--bg-primary);
        border-radius: var(--radius-md);
        text-align: center;
    }

    .replay-comparison-label {
        font-size: 0.75rem;
        color: var(--text-tertiary);
        margin-bottom: 4px;
    }

    .replay-comparison-value {
        font-size: 1.4rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .replay-diff-summary {
        padding: 12px;
        background: var(--bg-primary);
        border-radius: var(--radius-md);
        font-size: 0.85rem;
    }

    .replay-diff-row {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border-bottom: 1px solid var(--border-color-light);
    }

    .replay-diff-row:last-child {
        border-bottom: none;
    }

    .replay-diff-label {
        color: var(--text-secondary);
    }

    .replay-diff-value {
        font-weight: 500;
        font-family: "SFMono-Regular", Consolas, monospace;
    }

    .replay-diff-value.positive {
        color: #22c55e; /* dark-mode-ok */
    }

    .replay-diff-value.negative {
        color: #ef4444; /* dark-mode-ok */
    }

    .replay-diff-value.neutral {
        color: var(--text-secondary);
    }

    /* Transcription confidence level styles */
    .low-confidence {
        color: #dc2626; /* dark-mode-ok */
        background: rgba(239, 68, 68, 0.1);
        padding: 2px 6px;
        border-radius: 4px;
    }

    .medium-confidence {
        color: #ca8a04; /* dark-mode-ok */
        background: rgba(234, 179, 8, 0.1);
        padding: 2px 6px;
        border-radius: 4px;
    }

    .high-confidence {
        color: #16a34a; /* dark-mode-ok */
        background: rgba(34, 197, 94, 0.1);
        padding: 2px 6px;
        border-radius: 4px;
    }

/* ── Debug panel body (Phase 4, Step B2) ── */

.debug-panel-body {
  padding: 0 20px 20px;
}

/* ── Replay error (Phase 4, Step B2) ── */

.replay-error {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

/* ── GP Dashboard & Summary Views (Stream F) ── */

/* Summary View */
.summary-view {
  max-width: 800px;
}

.summary-card {
  position: relative;
}

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

.summary-header h2 {
  margin: 0;
}

.summary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-disclaimer {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
}

.summary-text {
  margin-bottom: 16px;
}

.summary-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  padding-top: 12px;
  border-top: 1px solid var(--border-color-light);
}

.summary-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Transcript View */
.transcript-view {
  max-width: 800px;
}

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

.transcript-header h2 {
  margin: 0;
}

.transcript-duration {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.transcript-back {
  margin-bottom: 16px;
}

.transcript-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  max-width: 85%;
}

.message-bubble.message-patient {
  background: var(--color-primary-bg);
  border: 1px solid var(--color-primary);
  align-self: flex-end;
}

.message-bubble.message-bot {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  align-self: flex-start;
}

.message-role {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.message-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}

.message-time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* GP Dashboard */
.gp-dashboard {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* GP Patient Detail */
.gp-patient-detail {
  max-width: 800px;
}

/* Print Styles for Summary View */
@media print {
  .admin-header,
  .admin-nav,
  .mobile-menu,
  .mobile-menu-overlay,
  .no-print,
  .hamburger-btn,
  .summary-actions,
  .breadcrumbs {
    display: none !important;
  }

  .admin-shell {
    display: block;
  }

  .admin-main {
    padding: 0;
    margin: 0;
  }

  .admin-container {
    max-width: 100%;
    padding: 0;
  }

  .summary-view {
    max-width: 100%;
  }

  .detail-card {
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 24px;
  }

  .summary-disclaimer {
    border: 2px solid #000;
    color: #000;
    background: #f5f5f5;
  }

  .summary-text {
    font-size: 11pt;
    line-height: 1.5;
  }

  .meta-grid {
    border-bottom: 1px solid #ccc;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
}

/* ---- Conversions funnel (admin/conversions.html) ---- */
.conv-funnel {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.conv-stage {
  flex: 1 1 0;
  min-width: 96px;
  padding: var(--space-4);
  background: var(--surface-card, var(--color-primary-bg));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: center;
}

.conv-stage-count {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.conv-stage-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.conv-stage-rate {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: var(--space-1);
}

.conv-yes {
  color: var(--color-success);
  font-weight: 700;
}

.conv-no {
  color: var(--text-tertiary);
}

.conv-pending {
  color: var(--color-warning-text);
  font-size: 0.8rem;
}

/* ── Practice detail: clinic logo preview ──
   Clinic wordmarks are commonly dark strokes on a TRANSPARENT background,
   so the bare preview <img> vanished into the dark admin theme (2026-07-05
   audit — same failure class as the walk-in QR). Mirror the intake header's
   always-light logo chip (--surface-logo-chip) so the preview reads in both
   themes. */
.practice-logo-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-logo-chip);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.practice-logo-preview img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

/* ── Demo practices (spec 2026-07-12 D11, issue 1842; UX overhaul spec 2026-08-01)
   The siloed /admin/demos listing and the per-demo handover home. ── */

/* Listing: the row's name is the way in, so it reads as a link, not as bold
   text next to a button that happens to navigate. */
.demo-row-name {
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.demo-row-name:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.demo-row-sub {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-tertiary);
}

/* Funnel chips: OFF is the default (muted outline) so the eye lands on what
   HAS happened. `is-part` is the half-way state (tour started, not finished). */
.demo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.demo-chip {
  padding: 2px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.demo-chip.is-on {
  border-color: var(--color-success);
  background: var(--color-success-bg);
  color: var(--color-success);
}

.demo-chip.is-part {
  border-color: var(--color-warning-border);
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

/* Budget: the number stays (it is the exact answer) with a meter under it for
   the at-a-glance read. */
.demo-budget-text {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.demo-budget-bar {
  display: block;
  width: 100%;
  max-width: 7rem;
  height: 5px;
  margin-top: 5px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  overflow: hidden;
}

.demo-budget-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
}

.demo-budget-fill.is-full {
  background: var(--color-warning);
}

.demo-table-actions-head {
  text-align: right;
}

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.demo-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
}

.demo-empty p {
  max-width: 34rem;
  margin: 0 auto var(--space-3);
}

/* ── Detail page ── */
.demo-provisioned-note {
  border-color: var(--color-success);
}

.demo-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.demo-phone-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.demo-phone-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.demo-inline-form {
  max-width: 26rem;
}

/* Manage: one card per action, each with its own input + explanation, rather
   than a row of unlabelled pills whose effect you have to remember. */
.demo-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}

.demo-manage-action {
  padding: var(--space-3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

/* `.demo-manage-title` is the label look for an action that heads a BUTTON
   rather than a field — a <label> with no control is invalid, and pointing one
   at nothing is exactly the a11y defect the old handover card shipped. */
.demo-manage-action label,
.demo-manage-title {
  display: block;
  margin: 0 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.demo-manage-action .copy-field-hint {
  margin-bottom: 0;
}

@media (min-width: 768px) and (max-width: 900px) {
  /* In the tablet band the table still IS a table, and the engagement chips
     are the first thing to cost more width than they return — the name,
     budget and expiry still answer "which demo, how far, how long". Below
     768px the rows become cards and the chips fit again, so this is a band,
     not a floor. */
  .demo-table .demo-chips {
    display: none;
  }
}

@media (max-width: 767px) {
  /* Row-as-card. Five columns cannot fit a 390px phone, and a horizontally
     scrolling table hides the row's ACTIONS off-screen — the two things you
     came to press. Each row becomes a labelled block instead: the `data-label`
     attributes on the cells carry the header text the collapsed <thead> can no
     longer supply. */
  .demo-table,
  .demo-table tbody,
  .demo-table tr,
  .demo-table td {
    display: block;
    width: 100%;
  }

  /* Undo the shared scroll container for THIS table: `.table-wrapper` sets a
     680px min-width on its table (and the mobile shell adds
     `white-space: nowrap` to cells + bleed margins) so the table scrolls
     horizontally. Cards must not — that would push the row's actions
     off-screen, which is the failure mode this block exists to remove. */
  .table-wrapper .demo-table {
    min-width: 0;
  }

  .table-wrapper:has(.demo-table) {
    overflow-x: visible;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
  }

  .demo-table thead {
    display: none;
  }

  .demo-table tr {
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
  }

  .demo-table td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 5px 0;
    border: none;
    white-space: normal;
  }

  .demo-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-tertiary);
  }

  /* Cells that are content, not a label/value pair: the row's name block, the
     action bar, and the full-width empty state (which has no `data-label` at
     all and would otherwise draw an empty ::before box). */
  .demo-table td[data-label="Prospect"],
  .demo-table td.demo-actions,
  .demo-table td:not([data-label]) {
    display: block;
  }

  .demo-table td[data-label="Prospect"]::before,
  .demo-table td.demo-actions::before,
  .demo-table td:not([data-label])::before {
    content: none;
  }

  .demo-table td.demo-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: var(--space-2);
  }

  .demo-table .demo-chips {
    justify-content: flex-end;
  }

  .demo-table .demo-budget-bar {
    display: none;
  }
}

/* Touch floor at phone width. The demo surfaces are the ones an Audri staffer
   reaches for on a phone mid-conversation with a prospect ("what's the link
   again?"), which is what surfaced this — but a page's PRIMARY action being
   `btn-sm`-sized on a phone is a console-wide issue, so the page-heading rule
   is deliberately not demo-scoped. Dense in-table controls keep their scale. */
@media (max-width: 767px) {
  .page-heading .btn,
  .demo-actions .btn,
  .demo-section-head .btn,
  .demo-manage-action .btn,
  .demo-inline-form .btn,
  .demo-empty .btn {
    min-height: var(--touch-target-min);
  }
}
