/* ========================================
   VOCES.AI — Design System
   Premium dark mode with glassmorphism
   ======================================== */

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --surface-elevated: rgba(255, 255, 255, 0.12);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-strong: rgba(255, 255, 255, 0.2);

  --text-primary: #e8e8ed;
  --text-secondary: #9898a6;
  --text-muted: #5a5a6e;

  --accent: #7c5cfc;
  --accent-hover: #9178ff;
  --accent-glow: rgba(124, 92, 252, 0.25);
  --accent-soft: rgba(124, 92, 252, 0.1);

  --success: #2dd4a8;
  --warning: #f5a623;
  --danger: #f45b69;
  --danger-hover: #ff6b7a;
  --danger-dark: #800000;
  --danger-dark-hover: #990000;
  --info: #38bdf8;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   Reset & Base
   ======================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ========================================
   Navigation
   ======================================== */

#main-nav,
#interview-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

#interview-nav {
  justify-content: flex-start;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-logo {
  font-size: 1.5rem;
}

.nav-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  padding: 0.5rem;
}

.nav-icon-button svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* ========================================
   Main Layout
   ======================================== */

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

.admin-page #app {
  max-width: 1200px;
}

.view {
  animation: fadeIn 0.3s ease;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.view-header-sessions {
  flex-wrap: nowrap;
  gap: 1rem;
}

.view-header-invitations {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.invitations-config-row {
  gap: 0.5rem;
}

.invitations-config-select {
  min-width: 12rem;
  max-width: 18rem;
}

.invitations-content {
  margin-top: 0.5rem;
}

.view-header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.view-header-actions label {
  margin-right: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.view-header-actions .sessions-config-select {
  min-width: 10rem;
  max-width: 14rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  font-size: 0.875rem;
  border-radius: 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.view-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.view-total {
  margin: 0;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/**
 * Audio | Texto segmented control in the interview chat header.
 */
.interview-mode-segmented {
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  padding: 2px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border-strong, rgba(255, 255, 255, 0.12));
  gap: 0;
}

.interview-mode-segment {
  appearance: none;
  margin: 0;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.interview-mode-segment:hover:not(:disabled):not(.is-selected) {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.interview-mode-segment:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.interview-mode-segment:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.interview-mode-segment--audio.is-selected {
  color: var(--success);
  background: rgba(34, 197, 94, 0.18);
}

.interview-mode-segment--texto.is-selected {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.15);
}

.message-draft p {
  margin-bottom: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Cards & Glass
   ======================================== */

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.card.glass {
  background: var(--glass);
  backdrop-filter: blur(16px);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* Sessions table (admin interviews list) */
.sessions-th-inicio {
  min-width: 10rem;
}

.sessions-table tbody td:nth-child(3) {
  min-width: 10rem;
}

.sessions-th-actions,
.sessions-td-actions {
  width: 1%;
  padding: 0.35rem 0.5rem !important;
  vertical-align: middle;
  text-align: left;
}

.sessions-table-wrapper {
  overflow-x: auto;
  margin-bottom: 1rem;
}

.sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: auto;
}

/* Minimum widths so columns don’t collapse; actual width follows content. */
.sessions-col-select { min-width: 2.5rem; width: 1%; }
.sessions-col-estado { min-width: 6rem; }
.sessions-col-inicio { min-width: 8rem; }
.sessions-col-duracion { min-width: 4rem; }
.sessions-col-respuestas { min-width: 4rem; }
.sessions-col-feedback { min-width: 4rem; }
.sessions-col-actions { min-width: 6rem; width: 1%; }

.sessions-table th,
.sessions-table td {
  padding: 0.5rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--glass-border);
}

.sessions-table th {
  color: var(--text-secondary);
  font-weight: 500;
}

.sessions-table tbody tr:hover {
  background: var(--surface-hover);
}

.session-actions-cell {
  white-space: nowrap;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.25rem;
}

.session-actions-cell .btn-icon,
.session-actions-cell .btn-copy-id {
  flex-shrink: 0;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.session-actions-cell .btn-copy-id {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 600;
}

.sessions-selection-message {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.sessions-bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0;
}

.sessions-bulk-count {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-right: 0.5rem;
}

.sessions-bulk-summary {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.sessions-th-select,
.session-checkbox-cell {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}

.sessions-select-all-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.sessions-th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sessions-th-sortable:hover {
  color: var(--text-primary);
}

.sessions-th-sortable[data-sort-direction="asc"]::after {
  content: " ↑";
  opacity: 0.8;
}

.sessions-th-sortable[data-sort-direction="desc"]::after {
  content: " ↓";
  opacity: 0.8;
}

.config-card {
  cursor: pointer;
}

.config-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.config-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.config-card p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.config-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.toggle-knob {
  position: relative;
  width: 18px;
  height: 18px;
  margin-left: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition), background var(--transition);
}

.toggle-switch.is-on {
  background: rgba(124, 92, 252, 0.18);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(124, 92, 252, 0.18);
}

.toggle-switch.is-on .toggle-knob {
  transform: translateX(16px);
  background: var(--accent);
}

.config-card-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.config-card-actions-left {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}


/* ========================================
   Forms
   ======================================== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.form-group.required label::after {
  content: " *";
  color: var(--accent);
}

.form-group .checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-bottom: 0.375rem;
}

.form-group .checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/** Explanatory text below form fields: italic, lighter weight than body, no bold. */
.form-hint {
  display: block;
  margin-top: 0.25rem;
  font-style: italic;
  font-weight: 300;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.875rem;
  transition: var(--transition);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea {
  resize: vertical;
  min-height: 60px;
}

select {
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

#btn-end-interview.btn-danger {
  background: var(--danger-dark);
}

#btn-end-interview.btn-danger:hover {
  background: var(--danger-dark-hover);
}

/** Pause interview button: solid PAUSED color background, white icon (like end button). */
#btn-pause-interview {
  background: #b45309;
  color: white;
  border: none;
}

#btn-pause-interview:hover:not(:disabled) {
  background: #c96b0d;
  color: white;
}

/** Inline play in first Preparation message (label "Iniciar la entrevista: " + green control). */
.prep-welcome-start-row {
  margin-top: 0.75rem;
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.prep-permission-microcopy {
  display: block;
  flex-basis: 100%;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-prep-welcome-start {
  background: var(--success);
  color: #0b1612;
  border: none;
  flex-shrink: 0;
}

.btn-prep-welcome-start:hover:not(:disabled) {
  background: #22c29a;
  color: #0b1612;
}

.btn-prep-welcome-start.prep-play-cta--pulse {
  animation: pulse 1.5s infinite;
}

/** Pulse animation on the inline resume button in the paused banner (visible when the interview is paused). */
.interview-paused .btn-resume-banner {
  animation: pulse 1.5s infinite;
}

/** Generic pulse utility for buttons (e.g. Send when there is text). */
.btn-pulse {
  animation: pulse 1.5s infinite;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1rem;
}

.btn-icon {
  padding: 0.625rem;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

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

/* ========================================
   Chat Interface
   ======================================== */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 10rem);
  height: calc(100dvh - 10rem);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: var(--bg-secondary);
}

.chat-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(16px);
}

/** Title and pause/finish buttons on one row: title left, buttons right, vertically centered. */
.chat-header-top {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.chat-header-primary,
.chat-header-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.chat-header-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  min-width: 0;
  flex: 1;
}

.chat-header-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: 1.25rem;
  flex: 1;
}

.chat-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/**
 * Ended interview: header chrome (everything except the title) is hidden from InterviewApp.#syncHeaderChromeAsideTitle.
 * Class `interview-ended` on #interview-chat still drives footer and banners below.
 */

/**
 * Footer (#chat-form) is outside `.chat-header`; keep it hidden when the session has ended
 * (same class as header, set in InterviewApp.#syncModeUI).
 */
.interview-chat.interview-ended .chat-input-area {
  display: none !important;
}

.interview-chat.interview-ended .audio-degraded-banner {
  display: none !important;
}

.chat-title {
  font-weight: 600;
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.resume-url-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.resume-url-inline .resume-link {
  color: var(--accent);
  text-decoration: underline;
}

.resume-url-inline .resume-link:hover {
  text-decoration-thickness: 2px;
}

.chat-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.75rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
  /* Prevents scroll from propagating to the page when reaching top/bottom of the chat.
     Also blocks pull-to-refresh on mobile browsers. */
  overscroll-behavior: contain;
}

/* Audio degraded banner: shown when TTS/STT fall back to browser-only mode. */
.audio-degraded-banner {
  margin: 0.25rem 1.5rem 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.45);
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audio-degraded-banner.hidden {
  display: none !important;
}

.audio-degraded-banner strong {
  color: var(--warning);
}

/* Inline TTS degraded notice above assistant message. */
.message-tts-degraded-notice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--warning);
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
}

.message-tts-degraded-notice svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 4px;
}

.message {
  max-width: 80%;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  line-height: 1.65;
  animation: messageIn 0.3s ease;
}

.message-assistant {
  align-self: flex-start;
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border-strong);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
  /* Slightly smaller than participant bubbles for transcript density */
  font-size: 0.8125rem;
}

/** Interviewer (assistant) bubbles: modestly larger on desktop; keep compact on phones (max-width: 640px). */
@media (min-width: 641px) {
  .message-assistant {
    font-size: 0.9375rem;
  }
}

/**
 * Markdown links in chat: assistant bubbles use a bright cool tone on dark glass for contrast;
 * user bubbles (accent fill) use near-white links. Applies to `addMessage` HTML (no .message-bubble)
 * and prep welcome (`.message-bubble`).
 */
.message-assistant a {
  color: var(--info);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(56, 189, 248, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.message-assistant a:hover {
  color: #7dd3fc;
  text-decoration-color: rgba(125, 211, 252, 0.9);
}

.message-user a {
  color: #f0f9ff;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.message-user a:hover {
  color: #ffffff;
  text-decoration-color: rgba(255, 255, 255, 0.95);
}

/**
 * Markdown **bold** in interview bubbles: darker violet, same weight as body (no extra bold).
 */
.message-assistant strong {
  color: #a78bfa;
  font-weight: 400;
}

.message-assistant a strong {
  color: #a78bfa;
  font-weight: 400;
}

.message-user strong {
  color: #ddd6fe;
  font-weight: 400;
}

.message-user a strong {
  color: #ddd6fe;
  font-weight: 400;
}

.message-user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-pending {
  opacity: 0.8;
  border: 1px dashed var(--glass-border);
}

.message-draft {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.message-draft-empty {
  min-height: 1.5em;
}

/* Status line (header or Live dock): violet ok states, amber when paused, red on errors. */
.interview-status {
  align-self: center;
  font-size: 0.75rem;
  font-weight: 400;
  font-style: italic;
  color: var(--accent);
  margin-top: 0;
  padding-left: 0;
  min-height: 1.25rem;
}

.interview-status.hidden {
  display: none;
}

.interview-status.interview-status--error {
  color: var(--danger);
}

.interview-status.interview-status--paused {
  color: #d97706;
  font-style: italic;
}

.interview-status.interview-status--finished {
  color: var(--text-muted);
  font-style: italic;
}

/* Motion comes from the particle orb (VoiceStatusParticleOrb); keep text steady. */
.interview-status:not(.hidden):not(.interview-status--error):not(.interview-status--paused):not(.interview-status--finished) {
  animation: none;
}

.interview-status-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  width: 100%;
}

.interview-status-text {
  display: block;
  max-width: 100%;
}

/** One third of the horizontal space of the status row; square via aspect-ratio */
.interview-status-orb-canvas {
  display: block;
  flex-shrink: 0;
  width: 33.333%;
  max-width: 33.333%;
  aspect-ratio: 1 / 1;
  height: auto;
  box-sizing: border-box;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.btn-link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-size: inherit;
  font-family: inherit;
}

.btn-link:hover {
  color: white;
}

.message-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  /* min() ensures the form never exceeds its container width on small screens */
  min-width: min(250px, 100%);
}

.message-edit-form textarea {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  min-height: 60px;
}

.message-edit-form .form-actions {
  margin-top: 0;
  justify-content: flex-end;
}

/** Rich banner when interview has ended (same layout as paused banner, red scheme: light red bg, dark red text). */
.interview-ended-banner {
  margin: 0.75rem 0 0;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(200, 70, 70, 0.2);
  border: 1px solid rgba(180, 50, 50, 0.45);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.interview-ended-main {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #fff;
}

.interview-ended-thanks {
  margin: 0.25rem 0 0;
  color: var(--text-secondary);
}

/** Post-interview feedback form (modal body or inline fallback). */
.feedback-form-container {
  margin: 1rem 0 0;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#feedback-modal .feedback-modal-content {
  box-sizing: border-box;
  max-width: min(28rem, calc(100vw - 1.5rem));
  width: 100%;
  overflow-x: hidden;
}

#feedback-modal .feedback-modal-body {
  overflow-x: hidden;
  min-width: 0;
}

#feedback-modal .feedback-form-container {
  margin-top: 0;
  box-sizing: border-box;
  max-width: 100%;
}

/** Darker scrim + panel so feedback modal content is easier to read. */
#feedback-modal .modal-overlay {
  background: rgba(0, 0, 0, 0.78);
}

#feedback-modal .feedback-modal-content.card.glass {
  background: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
  border-color: rgba(255, 255, 255, 0.16);
}

@supports not (background: color-mix(in srgb, white, black)) {
  #feedback-modal .feedback-modal-content.card.glass {
    background: rgba(18, 18, 26, 0.94);
  }
}

.feedback-form-field-prompt {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.feedback-form-field-prompt:not(:first-child) {
  margin-top: 0.75rem;
}

.feedback-form-demographic-field {
  margin-bottom: 0.75rem;
}

.feedback-form-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.feedback-form-experience-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.feedback-form-rating-btn {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.feedback-form-rating-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}

.feedback-form-rating-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.feedback-form-rating-btn.selected:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.feedback-form-textarea {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
  font-family: inherit;
  resize: vertical;
}

.feedback-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.5rem;
}

.feedback-form-error {
  margin: 0.5rem 0 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.feedback-thanks {
  margin: 1rem 0 0;
  color: var(--success);
  font-weight: 500;
}

/** Admin session detail: participant área / rol (session fields). */
.session-participant-demographics {
  margin: 1rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.session-demographics-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.session-participant-area-role {
  margin: 0;
  font-size: 0.9rem;
}

/** Admin session detail: feedback section. */
.session-feedback-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.session-feedback-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.feedback-experience-rating {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.feedback-content-text {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
}

.feedback-created-at {
  display: block;
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 0.25rem;
}

.feedback-none {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/** Simple closing line (e.g. in admin session modal). */
.interview-ended-line {
  color: var(--danger-dark);
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  padding: 0;
  text-align: left;
}

/** Status line when interview is paused (same color as PAUSADO badge). */
.interview-status-line-paused {
  color: #b45309;
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  padding: 0;
  text-align: left;
}

/** Rich banner shown in the participant chat when the interview is paused. */
.interview-paused-banner {
  margin: 0.75rem 0 0;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(245, 166, 35, 0.15);
  border: 1px solid rgba(245, 166, 35, 0.4);
  color: #b45309;
  font-size: 0.9rem;
}

.interview-paused-main {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.interview-paused-countdown {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  color: #92400e;
}

.interview-paused-resume-row {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.btn-resume-banner {
  position: relative;
  background: var(--success);
  color: #0b1612;
}

.btn-resume-banner:hover {
  background: #22c29a; /* Slightly darker green variation */
}

.interview-paused-resume-row .btn-copy {
  flex-shrink: 0;
}

.interview-paused-spacer {
  height: 0.75rem;
}

.interview-paused-reminder {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/** Rich banner when interview is resumed (same layout as paused banner, green scheme). */
.interview-resumed-banner {
  margin: 0.75rem 0 0;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(34, 194, 154, 0.15);
  border: 1px solid rgba(34, 194, 154, 0.4);
  color: var(--success);
  font-size: 0.9rem;
}

.interview-resumed-main {
  font-weight: 600;
  margin: 0;
}

/** Status line when interview is resumed (same color as ACTIVA badge). */
.interview-status-line-active {
  color: var(--success);
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
  padding: 0;
  text-align: left;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }



}

/* Config form: voice speed row */
.speech-rate-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.speech-rate-row input[type="range"] {
  width: 8rem;
  accent-color: var(--accent);
}

/* Input Mode Switch */
.input-controls-container {
  background: var(--bg-tertiary);
  padding: 0.5rem 1.5rem 0;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: center;
}

.input-mode-switch {
  display: flex;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border-strong);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.mode-option {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition);
}

.mode-option:hover:not(.active):not(:disabled) {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.mode-option.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(124, 92, 252, 0.35);
  border: 1px solid rgba(124, 92, 252, 0.4);
}

.mode-option:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-input-area {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 1rem 1.5rem;
  /* env() resolves to 0px on desktop/Android — no visual impact there */
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--glass-border-strong);
  background: var(--bg-tertiary);
}

.interview-speed-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  white-space: nowrap;
  padding: 0.35rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.interview-speed-control input[type="range"] {
  width: 4.25rem;
  accent-color: var(--accent);
}

.interview-speed-value {
  min-width: 2.2rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
}

/** Voice speed in “Ajustes de audio” modal (desktop / non-touch narrow). Touch interview uses #header-speed-inline instead. */
.audio-settings-body .interview-speed-control--modal {
  width: 100%;
  box-sizing: border-box;
}

.audio-settings-body .interview-speed-control--modal input[type="range"] {
  flex: 1;
  min-width: 0;
  width: auto;
  max-width: none;
}

.interview-status-bar {
  min-height: 1.25rem;
  display: flex;
  align-items: center;
}

.interview-status-bar .interview-status {
  font-size: 0.75rem;
  min-height: 1.25rem;
}

/** Modo texto: no Live particle orb; footer row left of the input when session is active */
.interview-status--orb-hidden .interview-status-orb-canvas {
  display: none !important;
}

.interview-status--orb-hidden .interview-status-inner {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.interview-chat.interview-status-in-footer:not(.interview-live-voice-active) .chat-header-secondary {
  display: none;
}

.chat-footer-composer {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

/**
 * Text mode: column width = word "Entrevista" (11ch at label font size) + horizontal padding.
 * Longest label "Entrevista pausada" wraps to two lines; copy is horizontally centered in that measure.
 */
.interview-status-footer-mount {
  --interview-status-footer-pad-x: 0.375rem;
  font-size: 0.75rem;
  box-sizing: border-box;
  flex: 0 0 calc(11ch + 2 * var(--interview-status-footer-pad-x));
  width: calc(11ch + 2 * var(--interview-status-footer-pad-x));
  min-width: calc(11ch + 2 * var(--interview-status-footer-pad-x));
  max-width: calc(11ch + 2 * var(--interview-status-footer-pad-x));
  padding-inline: var(--interview-status-footer-pad-x);
  display: flex;
  align-items: center;
  justify-content: center;
}

.interview-status-footer-mount.hidden {
  display: none !important;
}

.interview-status-footer-mount .interview-status-inner {
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  width: 100%;
  min-width: 0;
}

.interview-status-footer-mount .interview-status {
  margin-top: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.interview-status-footer-mount .interview-status-text {
  flex: 1;
  min-width: 0;
  display: block;
  text-align: center;
  line-height: 1.35;
  word-break: normal;
  overflow-wrap: break-word;
}

#interview-status-wrapper[data-text-state='esperando'] .interview-status:not(.interview-status--error):not(.interview-status--paused):not(.interview-status--finished) .interview-status-text {
  color: #3b82f6;
}

#interview-status-wrapper[data-text-state='pensando'] .interview-status:not(.interview-status--error):not(.interview-status--paused):not(.interview-status--finished) .interview-status-text {
  color: #8b5cf6;
}

#interview-status-wrapper[data-text-state='escribiendo'] .interview-status:not(.interview-status--error):not(.interview-status--paused):not(.interview-status--finished) .interview-status-text {
  color: #22c55e;
}

#interview-status-wrapper[data-text-state='pausado'] .interview-status:not(.interview-status--error):not(.interview-status--paused):not(.interview-status--finished) .interview-status-text {
  color: #d97706;
}

@keyframes interview-footer-status-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.42;
  }
}

.interview-chat.interview-status-in-footer .interview-status:not(.hidden):not(.interview-status--error):not(.interview-status--finished) .interview-status-text {
  animation: interview-footer-status-blink 1.25s ease-in-out infinite;
}

.chat-footer-composer .chat-input-row {
  flex: 1;
  min-width: 0;
}

.chat-input-row {
  display: flex;
  align-items: stretch;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.chat-input-row #btn-send {
  align-self: flex-end;
}

.btn-block {
  width: 100%;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(124, 92, 252, 0.7);
  }

  70% {
    box-shadow: 0 0 0 16px rgba(124, 92, 252, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(124, 92, 252, 0);
  }
}

.chat-input-area textarea {
  flex: 1;
  min-height: 3.5rem;
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border-strong);
  color: var(--text-primary);
  resize: none;
}

.chat-input-area textarea::placeholder {
  color: var(--text-secondary);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 1.5rem;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typingBounce {

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

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================
   Empty States
   ======================================== */

.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ========================================
   Modal
   ======================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-messages .message-timestamp {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.6875rem;
  opacity: 0.75;
}

.modal-messages .interview-ended-line .message-timestamp {
  margin-top: 0.25rem;
}

.processing-interrupted-banner {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(244, 91, 105, 0.12);
  border: 1px solid rgba(244, 91, 105, 0.45);
  color: var(--text-secondary);
}

.processing-interrupted-banner strong {
  color: var(--danger);
  display: block;
  margin-bottom: 0.25rem;
}

.processing-interrupted-banner p {
  margin: 0;
  font-size: 0.875rem;
}

.processing-steps-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.processing-steps-list li {
  margin-bottom: 0.5rem;
}

.processing-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0;
}

.processing-step-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.processing-step-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  position: relative;
}

.processing-step-icon--completed {
  border-radius: 999px;
  border: 1px solid var(--success);
  background: rgba(45, 212, 168, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--success);
}

.processing-step-icon--completed::after {
  content: "✓";
}

.processing-step-icon--in_progress {
  border-radius: 999px;
  border: 2px solid var(--info);
  border-top-color: transparent;
  box-sizing: border-box;
  animation: spin 0.8s linear infinite;
}

.processing-step-icon--pending {
  border-radius: 4px;
  border: 1px solid var(--text-muted);
  box-sizing: border-box;
}

/* Interview input (not a pipeline step): microphone emoji, violet */
.processing-step-icon--input {
  font-size: 0.875rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.processing-step-icon--input::before {
  content: "🎙️";
}

.processing-step-icon--error {
  border-radius: 999px;
  border: 1px solid var(--danger);
  background: rgba(244, 91, 105, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--danger);
}

.processing-step-icon--error::after {
  content: "✕";
}

.processing-step-label {
  font-size: 0.875rem;
}

.processing-step-label--completed {
  color: var(--success);
}

.processing-step-label--in_progress {
  color: var(--info);
}

.processing-step-label--pending {
  color: var(--text-muted);
}

.processing-step-label--input {
  color: #7c3aed;
}

.processing-step-label--error {
  color: var(--danger);
}

.processing-step-time {
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.processing-step-output-button {
  flex-shrink: 0;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.modal-body {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--glass-border);
  margin-top: 1rem;
}

/* Config modal: align to top; form body scrolls. Save/Cancel are in the header. */
#config-modal.modal {
  align-items: flex-start;
  padding-top: 2rem;
  padding-bottom: 2rem;
  overflow-y: auto;
}

#config-modal .modal-content-lg {
  display: flex;
  flex-direction: column;
  height: 90vh;
  max-height: 90vh;
  overflow: hidden;
  margin: auto 0;
}

#config-modal #config-form {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Config modal: Save/Cancel in header so they are always visible. */
.config-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Config modal — larger variant */
.modal-content-lg {
  max-width: 860px;
  max-height: 90vh;
}

/* Config modal tab navigation */
.config-modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--glass-border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.config-modal-tabs::-webkit-scrollbar {
  display: none;
}

.config-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.config-tab-btn:hover {
  color: var(--text-primary);
}

.config-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Config modal tab panels */
.config-tab-panel {
  display: block;
}

.config-tab-panel.hidden {
  display: none;
}

/* Inline form error */
.form-error {
  background: rgba(var(--danger-rgb, 220, 53, 69), 0.1);
  color: var(--danger, #dc3545);
  border: 1px solid rgba(var(--danger-rgb, 220, 53, 69), 0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}

/* Invitations tab */
.invitations-add-guest-modal-body .form-group {
  margin-bottom: 0;
}
.invitations-guest-modal-textarea {
  width: 100%;
  min-width: 100%;
  resize: vertical;
  box-sizing: border-box;
}
.invitations-th-actions {
  min-width: 8.5rem;
  white-space: nowrap;
  text-align: right;
}
.invitations-email-template {
  margin-top: 0.5rem;
}
.invitations-email-template .invitations-email-tab-intro {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.invitations-email-template .form-label {
  display: block;
  margin-top: 0.5rem;
}
.invitations-email-template .form-label:first-child {
  margin-top: 0;
}
.invitations-email-template .form-hint,
.invitations-link-hint {
  display: block;
  margin-top: 0.25rem;
}
.invitations-bulk-actions-wrap {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
}
.invitations-bulk-actions-wrap.hidden {
  display: none !important;
}
.invitations-actions-header {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  justify-content: flex-end;
}
.invitations-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  height: 50vh;
  max-height: 50vh;
  margin-top: 0.75rem;
  box-sizing: border-box;
}
.invitations-empty-hint {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.invitations-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.invitations-table th,
.invitations-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}
.invitations-table th {
  font-weight: 600;
  color: var(--text-secondary);
}
.invitations-th-sortable {
  cursor: pointer;
  user-select: none;
}
.invitations-th-sortable:hover {
  color: var(--text-primary);
}
.invitations-th-sortable[data-sort-direction="asc"]::after {
  content: " ↑";
  opacity: 0.8;
}
.invitations-th-sortable[data-sort-direction="desc"]::after {
  content: " ↓";
  opacity: 0.8;
}
.invitations-th-select,
.invitations-td-check {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}
.invitations-select-all-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.invitations-td-status {
  cursor: help;
}
.invitations-td-actions {
  white-space: nowrap;
  text-align: right;
}
.invitations-td-actions .btn {
  margin-right: 0.25rem;
}
.btn-delete-guest-action {
  color: var(--danger);
}
.btn-delete-guest-action:hover {
  color: var(--danger);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.copy-feedback-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: var(--surface-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.copy-feedback-toast.hidden {
  display: none;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ========================================
   Session Cards
   ======================================== */

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-active {
  background: rgba(45, 212, 168, 0.15);
  color: var(--success);
}

.status-paused {
  background: rgba(251, 191, 36, 0.15);
  color: #b45309;
}

.status-completed {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.status-processing {
  background: rgba(251, 191, 36, 0.15);
  color: #b45309;
  font-weight: 700;
  animation: pulse 1.5s infinite;
}

.status-processed {
  background: rgba(45, 212, 168, 0.15);
  color: var(--success);
}

/** Resume session link in list: same green as ACTIVA badge. */
.btn-resume-session {
  background: transparent;
  color: var(--success);
}
.btn-resume-session:hover {
  background: rgba(45, 212, 168, 0.15);
  color: var(--success);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 640px) {
  #main-nav {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }

  #app {
    padding: 1rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .message {
    max-width: 90%;
  }

  input[type="text"],
  input[type="email"],
  input[type="number"],
  textarea,
  select {
    font-size: 1rem; /* prevents iOS auto-zoom (requires >= 16px) */
  }

  .chat-container {
    height: calc(100vh - 12rem);
    height: calc(100dvh - 12rem);
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* H3: two-row chat input — textarea full width on top, toolbar + send on bottom */
  .chat-header-top {
    gap: 0.6rem;
  }

  .chat-header {
    padding: 0.75rem 1rem;
  }

  .chat-header-secondary {
    align-items: stretch;
    flex-direction: column;
  }

  /**
   * Two rows: title uses full width on the first row; audio / mode / pause / end on the second.
   * Avoids cramped single-line header on narrow phones.
   */
  .chat-header-primary {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .chat-header-primary .chat-header-title-row {
    min-width: 0;
    width: 100%;
    flex: none;
  }

  .chat-header-primary .header-action-buttons {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    flex-shrink: 0;
  }

  .chat-header-actions {
    justify-content: flex-start;
  }

  /** Pause/End: icon-only on mobile (icons are clear); labels kept for accessibility via aria-label. */
  .header-action-buttons .btn-label {
    display: none;
  }

  .header-action-buttons {
    justify-content: flex-end;
  }

  .chat-input-row {
    gap: 0.5rem;
  }

  /* H3: reduce generous desktop padding on welcome card */
  .interview-welcome-card {
    padding: 1.75rem 1.25rem;
  }
}

/* ========================================
   Touch device overrides (pointer: coarse)
   Targets phones and tablets using touch input.
   On desktop (pointer: fine / mouse), none of these rules apply.
   ======================================== */

/* Hide button text labels by default; reveal on touch devices only */
.btn-label {
  display: none;
}

@media (pointer: coarse) {
  /* Show text labels on Pause/End buttons so users know what they do without hover */
  .btn-label {
    display: inline;
    font-size: 0.75rem;
  }

  /* Minimum 44×44px touch targets (Apple HIG / Material Design recommendation) */
  .btn-icon {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-sm {
    min-height: 44px;
  }

  /* Audio settings modal becomes a bottom sheet for easier thumb reach */
  .modal-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    /* Respect iPhone home bar */
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    transform: none;
    margin: 0;
  }
}

/* ========================================
   Interview Page – mobile-only (body.interview-mobile)
   ======================================== */

body.interview-mobile .interview-welcome-actions #btn-audio-settings {
  display: none;
}

body.interview-mobile #audio-settings-modal {
  display: none;
}

/** Mobile interview: gear opens unusable modal — hide it; show inline speed in header (see #header-speed-inline). */
body.interview-mobile .header-action-buttons #btn-header-audio-settings {
  display: none !important;
}

/** Inline speed is for touch/narrow only; desktop uses the audio settings modal. */
body:not(.interview-mobile) .header-speed-inline {
  display: none !important;
}

.header-speed-inline {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.interview-speed-control--header-inline {
  max-width: 100%;
}

.interview-speed-control--header-inline input[type="range"] {
  width: 5.25rem;
  min-height: 2.75rem;
}

/* ========================================
   Interview Page (Participants)
   ======================================== */

.interview-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  /* svh = small viewport height, avoids layout jump when mobile browser chrome hides */
  min-height: 100svh;
}

.interview-welcome-card {
  max-width: 560px;
  width: 100%;
  text-align: center;
  padding: 3rem 2.5rem;
}

.interview-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.interview-welcome-text {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 2rem;
  text-align: left;
  white-space: pre-line;
}

.interview-welcome-selectors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
}

.interview-welcome-combo {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
}

.interview-welcome-combo label {
  font-weight: 500;
  margin: 0;
}

.interview-welcome-combo-select {
  width: auto;
  min-width: 5em;
}

.interview-welcome-actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
}

.interview-welcome-footnote {
  margin: 0 auto 0 0;
  font-size: 0.875rem;
  font-style: italic;
  color: var(--text-secondary);
  text-align: left;
  white-space: nowrap;
}

.interview-welcome-footnote a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.interview-welcome-footnote a:hover,
.interview-welcome-footnote a:focus-visible {
  color: var(--accent);
}

.info-page {
  align-items: flex-start;
  padding: 2rem 1rem 3rem;
}

.info-card {
  width: min(880px, 100%);
  padding: 2.5rem;
}

.info-card h1 {
  margin-bottom: 0.75rem;
}

.info-content {
  color: var(--text-secondary);
}

.info-content h1,
.info-content h2,
.info-content h3,
.info-content h4,
.info-content h5,
.info-content h6 {
  color: var(--text-primary);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.info-content h1 {
  font-size: 2rem;
}

.info-content h2 {
  font-size: 1.4rem;
}

.info-content h3 {
  font-size: 1.1rem;
}

.info-content p,
.info-content ul,
.info-content ol {
  margin: 0 0 1rem;
}

.info-content ul,
.info-content ol {
  padding-left: 1.5rem;
}

.info-content li + li {
  margin-top: 0.45rem;
}

.info-content hr {
  border: 0;
  border-top: 1px solid var(--glass-border);
  margin: 1.5rem 0;
}

#btn-audio-settings {
  background: var(--surface-elevated);
}

#btn-audio-settings:hover:not(:disabled) {
  background: var(--surface-hover);
}

.audio-settings-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.audio-settings-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.audio-settings-row label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.audio-settings-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.audio-settings-controls select {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: #fff;
}

.audio-settings-controls select option {
  background: var(--bg-primary);
  color: #fff;
}

.audio-settings-status {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  min-height: 1.25rem;
}

.audio-level-meter {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.audio-level-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  transition: width 80ms linear;
}

.interview-page .chat-container {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  height: calc(100vh - 4rem);
  height: calc(100dvh - 4rem);
}


