/* css/audio.css - Audio Transcription app */
:root {
  --audio-accent: var(--accent);
  --audio-accent-soft: var(--accent-soft);
  --radius-lg: 1.25rem;
  --radius-md: 0.9rem;
}

.audio-main {
  padding: 1.75rem 1rem 3rem;
  min-height: calc(100vh - 140px);
}

.container {
  max-width: 900px;
  margin: 0 auto;
}

/* ---------- Resume banner ---------- */
.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.4);
  margin-bottom: 1.5rem;
}

.resume-banner-text {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: #b45309;
}

.resume-banner-actions {
  display: flex;
  gap: 0.5rem;
}

/* ---------- Progress Steps ---------- */
.audio-progress {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 2.25rem;
  margin-bottom: 2.25rem;
  flex-wrap: wrap;
}

.audio-progress::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 50%;
  width: min(320px, 60%);
  height: 2px;
  background: var(--border-light);
  transform: translateX(-50%);
  z-index: 0;
}

.progress-step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  opacity: 0.45;
  transition: opacity 0.2s ease;
}

.progress-step.active,
.progress-step.completed {
  opacity: 1;
}

.progress-step .step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.progress-step.active .step-number {
  border-color: var(--audio-accent);
  background: var(--audio-accent-soft);
  color: var(--audio-accent);
  box-shadow: 0 0 0 4px var(--audio-accent-soft);
}

.progress-step.completed .step-number {
  border-color: var(--audio-accent);
  background: var(--audio-accent);
  color: #fff;
}

.progress-step .step-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Stage containers ---------- */
.stage-container {
  display: none;
  animation: audioFadeSlide 0.35s ease;
  padding: 0px;
}

.stage-container.active {
  display: block;
}

@keyframes audioFadeSlide {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.85rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-header h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.card-header h3 i {
  width: 34px;
  height: 34px;
  border-radius: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--audio-accent-soft);
  color: var(--audio-accent);
  font-size: 0.95rem;
}

.card-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.4rem;
}

/* ---------- Form elements ---------- */
.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}

.form-group input[type="text"],
.form-group select {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--audio-accent);
  box-shadow: 0 0 0 3px var(--audio-accent-soft);
}

.settings-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.4rem;
}

/* ---------- Source mode tabs ---------- */
.source-mode-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: var(--audio-accent-soft);
  margin-bottom: 1.4rem;
}

.source-mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.source-mode-tab.active {
  background: var(--audio-accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--audio-accent-soft);
}

/* ---------- Buttons ---------- */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--audio-accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--audio-accent);
  color: var(--audio-accent);
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.btn-large {
  width: 100%;
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
}

.btn-mini {
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.55rem;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mini:hover {
  border-color: var(--audio-accent);
  color: var(--audio-accent);
}

/* ---------- Upload panel ---------- */
.upload-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 1.1rem;
  color: var(--text-secondary);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--audio-accent);
  background: var(--audio-accent-soft);
  color: var(--audio-accent);
}

.upload-dropzone i {
  font-size: 2.1rem;
  margin-bottom: 0.6rem;
  display: block;
}

.upload-dropzone p {
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.upload-dropzone small {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.upload-file-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.95rem;
  border-radius: 0.65rem;
  background: var(--audio-accent-soft);
  font-size: 0.85rem;
  margin-bottom: 1.1rem;
}

/* ---------- Recording screen: circular hero + controls ---------- */

/* Circular red "start recording" button, shown in the Setup stage */
.record-start-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0 0.25rem;
}

.record-start-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #f87171, #dc2626);
  color: #fff;
  font-size: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.record-start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 14px 32px rgba(220, 38, 38, 0.55);
  filter: brightness(1.05);
}

.record-start-btn:active {
  transform: scale(0.96);
}

.record-start-caption {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Pulsing hero indicator on the recording stage */
.record-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0 1.5rem;
}

.record-hero-ring {
  position: relative;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.record-hero-dot {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f87171, #dc2626);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 8px 20px rgba(220, 38, 38, 0.45);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.record-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.35);
  animation: record-pulse-ring 1.8s ease-out infinite;
}

.record-pulse.delay {
  animation-delay: 0.9s;
}

@keyframes record-pulse-ring {
  0% { transform: scale(0.7); opacity: 0.7; }
  100% { transform: scale(1.9); opacity: 0; }
}

.record-hero-ring.paused .record-hero-dot {
  background: linear-gradient(145deg, #facc15, #ca8a04);
  box-shadow: 0 8px 20px rgba(202, 138, 4, 0.4);
}

.record-hero-ring.paused .record-pulse {
  animation: none;
  opacity: 0;
}

.rec-timer {
  font-variant-numeric: tabular-nums;
  font-size: 1.9rem;
  font-weight: 700;
}

.rec-status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.waveform-canvas {
  width: 100%;
  height: 80px;
  border-radius: 0.75rem;
  background: var(--audio-accent-soft);
  margin-bottom: 1.4rem;
  display: block;
}

/* Circular pause / stop controls */
.recording-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 0.25rem 0 0.5rem;
}

.control-circle-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.control-secondary {
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.control-secondary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.control-stop {
  width: 68px;
  height: 68px;
  font-size: 1.3rem;
  background: linear-gradient(145deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.4);
}

.control-stop:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 28px rgba(220, 38, 38, 0.5);
  filter: brightness(1.05);
}

.control-stop:active,
.control-secondary:active {
  transform: scale(0.95);
}

.recording-controls-hint {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 1.6rem;
}

.live-transcript-feed h4 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  color: var(--text-secondary);
}

.live-transcript-text {
  max-height: 260px;
  overflow-y: auto;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-light);
  font-size: 0.88rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.transcript-placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

.transcript-segment {
  animation: audioFadeSlide 0.3s ease;
}

.transcript-interim {
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.75;
}

/* ---------- Processing ---------- */
.processing-card {
  text-align: center;
  padding: 3.25rem 1.75rem;
}

.processing-spinner {
  width: 46px;
  height: 46px;
  border: 4px solid var(--audio-accent-soft);
  border-top-color: var(--audio-accent);
  border-radius: 50%;
  margin: 0 auto 1.4rem;
  animation: audio-spin 0.8s linear infinite;
}

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

.processing-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.processing-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.4rem;
}

.processing-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--audio-accent-soft);
  overflow: hidden;
  max-width: 320px;
  margin: 0 auto;
}

.processing-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--audio-accent);
  transition: width 0.3s ease;
}

/* ---------- Result screen ---------- */
.result-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.result-header-row h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

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

.transcript-view-toggle {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.transcript-toggle-btn {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.transcript-toggle-btn.active {
  background: var(--audio-accent);
  border-color: var(--audio-accent);
  color: #fff;
}

.transcript-textarea {
  width: 100%;
  min-height: 340px;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.7;
  resize: vertical;
  margin-bottom: 1.2rem;
}

.transcript-textarea:focus {
  outline: none;
  border-color: var(--audio-accent);
  box-shadow: 0 0 0 3px var(--audio-accent-soft);
}

.result-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: nowrap;
}

.result-actions button {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

/* ---------- History entries (drawer content) ---------- */
.audio-history-item {
  position: relative;
  padding: 0.9rem 2.6rem 0.9rem 1rem;
  border-radius: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  margin-bottom: 0.65rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.audio-history-item:hover {
  border-color: var(--audio-accent);
  transform: translateX(-3px);
}

.audio-history-item .ahi-title {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
  padding-right: 0.25rem;
}

.audio-history-item .ahi-meta {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.ahi-delete-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.6rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.ahi-delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ---------- History drawer ----------
   Slides in from the left on mobile (thumb-reachable, matches most tool
   pages) and from the right on desktop (keeps it out of the way of the
   nav/back button and lands under the cursor, near the history icon). */
.history-drawer {
  position: fixed;
  top: 0;
  left: -400px;
  width: 400px;
  max-width: 88vw;
  height: 100vh; height: 100dvh;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border-light);
  z-index: 1000;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-hover);
}

.history-drawer.active {
  left: 0;
}

@media (min-width: 769px) {
  .history-drawer {
    left: auto;
    right: -400px;
    border-right: none;
    border-left: 1px solid var(--border-light);
  }
  .history-drawer.active {
    left: auto;
    right: 0;
  }
}

.drawer-header {
  padding: 1.4rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.drawer-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.drawer-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.3rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.drawer-close-btn:hover {
  background: var(--audio-accent-soft);
  color: var(--audio-accent);
}

.history-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 2.2rem;
  margin-bottom: 0.7rem;
  display: block;
  color: var(--border-light);
}

@media (max-width: 480px) {
  .history-drawer { width: 320px; }
}

@media (max-width: 560px) {
  .result-actions button span {
    display: none;
  }
  .result-actions button i {
    margin: 0;
  }
  .result-actions button {
    padding: 0.5rem 0.5rem;
    border-radius: 50px;
    width: auto;
    height: auto;
  }

  .glass-card {
    padding: 1rem;
  }
}

/* =========================================================================
   AUDIO UPGRADE: a deliberate mobile pass — the sections below were never
   individually tuned for narrow phones (they held up by luck, being simple
   flex/stacked layouts), plus styling for the new mic-device picker, upload
   waveform preview, and previous-session hint.
   ========================================================================= */
@media (max-width: 480px) {
  .audio-main {
    padding: 1.1rem 0.7rem 2.5rem;
    /* iOS safe-area so the bottom recording controls never sit under a
       home-indicator/notch. */
    padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
  }

  .audio-progress {
    gap: 1.1rem;
  }

  .progress-step .step-number {
    width: 26px;
    height: 26px;
    font-size: 0.78rem;
  }

  .progress-step .step-label {
    font-size: 0.62rem;
  }

  .card-header h3 {
    font-size: 1.05rem;
  }

  .source-mode-tab {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }

  .record-start-btn {
    width: 76px;
    height: 76px;
    font-size: 1.5rem;
  }

  .record-hero-ring {
    width: 76px;
    height: 76px;
  }

  .record-hero-dot {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
  }

  .rec-timer {
    font-size: 1.6rem;
  }

  /* Bigger, easier-to-hit circular controls on touch, with room to wrap
     instead of crowding on the narrowest phones. */
  .recording-controls {
    gap: 1.1rem;
    flex-wrap: wrap;
  }

  .control-circle-btn {
    width: 52px;
    height: 52px;
  }

  .control-stop {
    width: 62px;
    height: 62px;
  }

  .live-transcript-text {
    max-height: 200px;
    padding: 0.85rem;
    font-size: 0.85rem;
  }

  .processing-card {
    padding: 2.25rem 1.1rem;
  }
}

/* ---------- Microphone device picker (item 3: noise handling + devices) ---------- */
.mic-device-group select {
  cursor: pointer;
}

.mic-device-group label i {
  color: var(--audio-accent);
  margin-right: 0.2rem;
}

/* ---------- Previous-session quick-compare ---------- */
#audioPrevSessionHint:not(:empty) {
  display: flex !important;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
}

#audioPrevSessionHint a {
  color: var(--audio-accent);
  font-weight: 700;
  text-decoration: none;
}

#audioPrevSessionHint a:hover {
  text-decoration: underline;
}

/* ---------- Mode tabs + Coach mode ---------- */
.audio-mode-tabs { margin-bottom: 0.9rem; }
.source-mode-tab:disabled { opacity: 0.45; cursor: not-allowed; }
.coach-setup-panel { margin: -0.3rem 0 1.2rem; padding: 0.85rem 1rem; border-radius: var(--radius-md); background: var(--audio-accent-soft); }
.coach-setup-panel .settings-hint { margin: 0 0 0.6rem; }
.coach-consent, .coach-speak { display: flex; gap: 0.55rem; align-items: flex-start; font-size: 0.85rem; color: var(--text-primary); cursor: pointer; line-height: 1.4; }
.coach-consent input, .coach-speak input { margin-top: 0.2rem; accent-color: var(--audio-accent); flex-shrink: 0; }
.coach-speak input:disabled + * , .coach-speak:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }
.coach-live-panel { margin: 1rem 0; display: flex; flex-direction: column; gap: 0.8rem; }
.coach-speaker-row { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.coach-speaker-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); }
.coach-speaker-toggle { display: inline-flex; border: 1px solid var(--border-light); border-radius: 2rem; padding: 3px; background: var(--surface); }
.coach-speaker-toggle button { border: none; background: none; padding: 0.45rem 0.9rem; border-radius: 2rem; font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; min-height: 36px; }
.coach-speaker-toggle button.active { background: var(--audio-accent); color: #fff; }
.coach-suggestions { border: 1px solid var(--border-light); border-radius: var(--radius-md); padding: 0.8rem 0.95rem; background: var(--surface); }
.coach-suggestions-head { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); display: flex; gap: 0.4rem; align-items: center; }
.coach-suggestions-head i { color: var(--audio-accent); }
.coach-disclaimer { font-size: 0.72rem; color: var(--text-secondary); margin: 0.15rem 0 0.6rem; font-style: italic; }
.coach-suggestion { display: flex; gap: 0.6rem; align-items: flex-start; justify-content: space-between; padding: 0.55rem 0.7rem; border-radius: 0.6rem; background: var(--audio-accent-soft); margin-bottom: 0.45rem; font-size: 0.88rem; color: var(--text-primary); }
.coach-suggestion .btn-mini { flex-shrink: 0; }
.coach-empty { font-size: 0.8rem; color: var(--text-secondary); margin: 0 0 0.5rem; }
.speaker-chip { display: inline-block; margin: 0.45rem 0.35rem 0.15rem 0; padding: 0.1rem 0.55rem; border-radius: 1rem; border: 1px solid var(--audio-accent); background: var(--audio-accent-soft); color: var(--audio-accent); font: inherit; font-size: 0.7rem; font-weight: 700; cursor: pointer; }
.speaker-chip.speaker-patient { border-color: #d97706; background: rgba(217, 119, 6, 0.12); color: #b45309; }
.speaker-chip.speaker-pending { border-style: dashed; border-color: var(--border-light); background: transparent; color: var(--text-secondary); cursor: default; font-weight: 600; }
.live-transcript-text .speaker-chip:first-child { margin-top: 0; }
.transcript-pending { color: var(--text-secondary); font-style: italic; opacity: 0.8; }
.transcript-pending.failed { color: #b45309; }
/* =====================================================================
   Audio page layout (restructure): mode switch → one card (big mic →
   live transcript). Recording happens inside the same card. Every class
   here is au-* so nothing leaks into / collides with the Motion page.
   ===================================================================== */
.au-source-switch { display: flex; gap: 0.4rem; padding: 0.3rem; border-radius: 999px; background: var(--audio-accent-soft); margin-bottom: 1rem; }
.au-source-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.65rem 0.75rem; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; transition: background 0.2s, color 0.2s; }
.au-source-tab.active { background: var(--audio-accent); color: #fff; box-shadow: 0 4px 14px var(--audio-accent-soft); }
.au-source-tab:disabled { opacity: 0.5; cursor: not-allowed; }

.au-card { padding: 1.1rem 1.1rem 1.2rem; }
.au-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.4rem; }
.au-card-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.au-mode-chip { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--audio-accent-soft); color: var(--audio-accent); }
.au-mode-chip[hidden] { display: none; }
.au-card-tools { display: flex; gap: 0.4rem; }
.au-tool-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-light); background: var(--surface, var(--card-bg)); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.au-tool-btn:hover { color: var(--audio-accent); border-color: var(--audio-accent); }
.au-tool-btn.active { background: var(--audio-accent); border-color: var(--audio-accent); color: #fff; }
.au-tool-btn[hidden] { display: none; }
.au-tool-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.au-card .coach-setup-panel { margin: 0.4rem 0 0.2rem; }
.au-card .coach-consent { font-size: 0.8rem; }

.au-mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 1.4rem 0 1.1rem; }
.au-big-mic { width: 104px; height: 104px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; font-size: 2.1rem;
  background: linear-gradient(145deg, #f87171, #dc2626); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 30px rgba(220, 38, 38, 0.42), 0 0 0 10px rgba(220, 38, 38, 0.08); transition: transform 0.15s, box-shadow 0.15s; }
.au-big-mic:hover { transform: scale(1.04); box-shadow: 0 16px 36px rgba(220, 38, 38, 0.5), 0 0 0 12px rgba(220, 38, 38, 0.1); }
.au-big-mic:active { transform: scale(0.96); }
.au-mic-caption { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }

.au-stage { padding: 0; }
.au-rec-head { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 0.8rem 0 0.4rem; }
.au-rec-head .rec-timer { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.au-rec-head .rec-status-text { text-align: left; }
.au-rec-ring { transform: scale(0.8); margin: 0; }
.au-controls { gap: 1rem; margin-top: 0.4rem; }
.au-cancel-btn { background: var(--surface, var(--card-bg)); color: #dc2626; border: 1.5px solid rgba(220, 38, 38, 0.45); }
.au-cancel-btn:hover { background: rgba(220, 38, 38, 0.08); }

.au-live-feed { margin-top: 1rem; }

/* Processing / result replace the card and the switch */
.audio-main[data-stage="3"] .au-source-switch, .audio-main[data-stage="4"] .au-source-switch,
.audio-main[data-stage="3"] #auCard, .audio-main[data-stage="4"] #auCard { display: none; }

/* Session details modal */
.au-modal { position: fixed; inset: 0; z-index: 10040; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 30, 0.45); backdrop-filter: blur(3px); }
.au-modal[hidden] { display: none; }
.au-modal .au-modal-box.glass-card { backdrop-filter: none; -webkit-backdrop-filter: none; }
.au-modal-box { width: min(460px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 1.1rem 1.2rem; margin: 0; background: var(--surface) !important; box-shadow: 0 24px 60px rgba(0,0,0,0.25); }
.au-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.au-modal-head h3 { margin: 0; font-size: 1.02rem; display: flex; gap: 0.45rem; align-items: center; }
.au-modal-head h3 i { color: var(--audio-accent); }
.au-modal-close { border: 0; background: transparent; font-size: 1.5rem; line-height: 1; color: var(--text-secondary); cursor: pointer; }
.au-modal-done { width: 100%; margin-top: 0.4rem; }
/* Collapsible live transcript (collapsed by default) */
.au-feed-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; min-height: 44px; padding: 0.35rem 0.2rem; border: none; background: none; font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--text-secondary); cursor: pointer; border-radius: 0.6rem; }
.au-feed-toggle span { display: inline-flex; align-items: center; gap: 0.45rem; }
.au-feed-toggle:focus-visible { outline: 2px solid var(--audio-accent, var(--accent)); outline-offset: 2px; }
.au-feed-chevron { font-size: 0.75rem; transition: transform 0.2s ease; }
.au-live-feed:not(.collapsed) .au-feed-chevron { transform: rotate(180deg); }
.au-live-feed.collapsed .live-transcript-text { display: none; }
.au-live-feed.collapsed { padding-bottom: 0.2rem; }
.resume-banner-actions { flex-wrap: wrap; }
.resume-banner-actions .btn-primary i { margin-right: 0.35rem; }
@media (prefers-reduced-motion: reduce) { .au-feed-chevron { transition: none; } }
