/* ============================================================
   PSICOLOGA.CSS — Dashboard de Psicóloga (Mobile First)
   Centir · Centro de Psicología
   ============================================================ */

/* ════════════════════════════════════════════════════════════
   WELCOME SECTION
   ════════════════════════════════════════════════════════════ */
.psi-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  min-width: 0;
}

/* El div anónimo que contiene greeting + date en el template JS */
.psi-welcome > div:first-child {
  flex: 1;
  min-width: 0;  /* permite que el flex-item se encoja debajo del avatar */
  overflow: hidden;
}

.psi-greeting {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: var(--space-1);
  overflow-wrap: break-word;
  word-break: break-word;
  /* Nombre largo → recortar con ellipsis en vez de desbordar */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psi-date {
  font-size: 0.8125rem;
  color: var(--text-medium);
  /* Fecha larga → que envuelva en lugar de desbordar */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psi-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: var(--shadow-md);
}

/* ════════════════════════════════════════════════════════════
   MINI STATS — scroll horizontal en mobile, grid en desktop
   ════════════════════════════════════════════════════════════ */
.psi-mini-stats {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Negative margin para que las cards lleguen a los bordes del contenedor,
     pero sin producir overflow real (overflow-x:hidden de content-area lo contiene) */
  margin: 0 calc(-1 * var(--space-4)) var(--space-5);
  padding: 0 var(--space-4) var(--space-1);
  /* Asegura que el contenedor no crezca más allá del viewport */
  max-width: calc(100% + var(--space-4) * 2);
  box-sizing: content-box;
}

.psi-mini-stats::-webkit-scrollbar { display: none; }

.psi-mini-stat {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: var(--space-4) var(--space-4);
  text-align: center;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Scroll snap — ancho mínimo para que quepan ~2.3 cards en 375px */
  min-width: 140px;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.psi-mini-stat-value {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.psi-mini-stat-value--currency {
  font-size: 1.125rem;
  color: var(--primary-dark);
}

.psi-stat--cobrado   { color: #2d7a2a; }
.psi-stat--pendiente { color: #b45309; }
.psi-stat--comision  { color: #4f46e5; }

.psi-mini-stat-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.psi-mini-stat-sublabel {
  font-size: 0.5625rem;
  color: var(--text-xlight, var(--text-light));
  letter-spacing: 0.3px;
}

/* ════════════════════════════════════════════════════════════
   QUICK ACTIONS
   ════════════════════════════════════════════════════════════ */
.psi-quick-actions {
  display: grid;
  grid-template-columns: 1fr;   /* columna única en mobile */
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

@media (min-width: 480px) {
  .psi-quick-actions {
    grid-template-columns: 1fr 1fr;  /* dos columnas en pantallas medianas+ */
  }
}

.psi-action-btn {
  padding: var(--space-4) var(--space-3);
  font-size: 0.875rem;
  border-radius: var(--radius-lg);
  min-height: 52px;
}

.psi-action-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Botones de acción en el page-header de otras vistas (Pacientes, Historial) */
.psi-header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-3);
  font-size: 0.875rem;
  white-space: nowrap;
}
.psi-header-action-btn svg {
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   SECTIONS
   ════════════════════════════════════════════════════════════ */
.psi-section {
  margin-bottom: var(--space-6);
}

.psi-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: var(--space-2);
  min-width: 0;
}

.psi-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psi-section-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  background: var(--bg-alt);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

/* ════════════════════════════════════════════════════════════
   APPOINTMENT CARDS
   ════════════════════════════════════════════════════════════ */
.psi-appt-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ── Card — estructura 2 filas (mobile-first) ── */
.psi-appt-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  transition: var(--ease);
  min-width: 0;         /* el card nunca empuja el layout más allá del viewport */
  max-width: 100%;
  box-sizing: border-box;
}

.psi-appt-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
  transform: translateY(-1px);
}

/* Fila superior: hora | divider | nombre | valor */
.psi-appt-row-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  overflow: hidden; /* contiene el nombre del paciente si es muy largo */
}

/* Fila inferior: oficina+tags | botones */
.psi-appt-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  /* En mobile: sin indent — evita layout muy estrecho en 320–375px */
  padding-left: 0;
  min-width: 0;
}

.psi-appt-meta-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.psi-appt-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Etiqueta de texto en botones — oculta en mobile, visible en desktop */
.psi-btn-label {
  display: none;
}

.psi-appt-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
  flex-shrink: 0;
}

.psi-appt-hora {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.psi-appt-office {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.psi-appt-divider {
  width: 1px;
  height: 32px;
  background: var(--border-light);
  flex-shrink: 0;
}

/* Eliminado: .psi-appt-info ya no se usa — sustituido por las filas */

.psi-appt-patient {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
}

.psi-appt-initials {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--secondary-darker);
  flex-shrink: 0;
}

.psi-appt-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psi-appt-tags {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.psi-appt-tags .tag svg {
  width: 9px;
  height: 9px;
}

.psi-appt-valor {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;   /* empuja el valor a la derecha de la fila superior */
  max-width: 30%;      /* nunca ocupa más de 30% — protege el nombre del paciente */
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact card (upcoming) — sin padding extra, ya usa el compacto base */
.psi-appt-card--compact {
  padding: var(--space-3) var(--space-4);
}

/* Date label for upcoming groups */
.psi-date-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-medium);
  text-transform: capitalize;
  padding: var(--space-2) 0 var(--space-1);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-1);
}

/* Empty state */
.psi-empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-light);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border);
}

.psi-empty svg {
  width: 40px;
  height: 40px;
  stroke: var(--border);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin: 0 auto var(--space-3);
  display: block;
}

.psi-empty p {
  font-size: 0.875rem;
}

/* ════════════════════════════════════════════════════════════
   MODAL OVERLAY & CONTAINER
   ════════════════════════════════════════════════════════════ */
.psi-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 44, 61, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Padding mínimo + respeta safe-area iPhone (notch y home indicator) */
  padding: max(var(--space-4), env(safe-area-inset-top, var(--space-4)))
           max(var(--space-4), env(safe-area-inset-right, var(--space-4)))
           max(var(--space-4), env(safe-area-inset-bottom, var(--space-4)))
           max(var(--space-4), env(safe-area-inset-left, var(--space-4)));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: psiOverlayIn 0.2s ease;
  box-sizing: border-box;
}

@keyframes psiOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.psi-modal {
  width: 100%;
  max-width: 100%;  /* no desborda el overlay */
  max-height: 88dvh; /* dvh respeta la barra de URL del navegador mobile */
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--radius-2xl);
  display: flex;
  flex-direction: column;
  animation: psiSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

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

/* ── Modal handle (visual) ── */
.psi-modal::before {
  display: none;
}

/* ── Modal Header ── */
.psi-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  min-width: 0;
  gap: var(--space-3);
}

.psi-modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psi-modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  background: var(--bg);
  transition: var(--ease);
  flex-shrink: 0;
}

.psi-modal-close:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.psi-modal-close svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── Modal Body ── */
.psi-modal-body {
  padding: var(--space-4) var(--space-4);
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden; /* previene que inputs/selects desborden el modal */
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  box-sizing: border-box;
}

/* ── Modal Footer ── */
.psi-modal-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.psi-modal-footer .btn {
  flex: 1;
}

/* ── Color swatches (selector de paleta de terapeuta) ───────── */
.color-swatch {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  outline: none;
}
.color-swatch:hover {
  transform: scale(1.15);
}
.color-swatch.selected {
  border-color: var(--text, #1a1a2e);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}

/* ════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ════════════════════════════════════════════════════════════ */
.psi-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.psi-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  min-width: 0;
  max-width: 100%;
}

.psi-form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.psi-required {
  color: var(--danger);
  margin-left: 2px;
}

.psi-form-input {
  width: 100%;
  max-width: 100%;       /* nunca desborda el modal */
  box-sizing: border-box;
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  /* 1rem (16px) — evita zoom automático en iOS al enfocar inputs */
  font-size: 1rem;
  color: var(--text);
  transition: var(--ease);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.psi-form-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(156, 195, 192, 0.2);
}

.psi-form-input::placeholder {
  color: var(--text-light);
}

select.psi-form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239e9eaf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

input[type="date"].psi-form-input {
  color-scheme: light;
}

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

/* ════════════════════════════════════════════════════════════
   VERIFICACIÓN DE SESIONES — Popup & Bell badge
   ════════════════════════════════════════════════════════════ */

/* ── Overlay y backdrop ─────────────────────────────────────── */
.verif-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.verif-overlay--visible { opacity: 1; }

.verif-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 44, 61, 0.5);
  backdrop-filter: blur(4px);
}

/* ── Modal ──────────────────────────────────────────────────── */
.verif-modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--space-6);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.3s cubic-bezier(.34, 1.56, .64, 1);
}

.verif-overlay--visible .verif-modal { transform: translateY(0) scale(1); }

.verif-modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--bg);
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ease);
}
.verif-modal-close:hover { background: var(--border); color: var(--text); }
.verif-modal-close svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none; stroke-width: 2.5;
  stroke-linecap: round;
}

/* ── Progreso ("1 de 3 sesiones") ───────────────────────────── */
.verif-progress {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: var(--space-3);
}

/* ── Header ─────────────────────────────────────────────────── */
.verif-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.verif-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--primary-lighter);
  color: var(--primary-darker);
}
.verif-icon svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.verif-icon--bell      { background: #fef3c7; color: #b45309; }
.verif-icon--success   { background: #dcfce7; color: #16a34a; }
.verif-icon--reschedule{ background: #ede9fe; color: #6d28d9; }
.verif-icon--danger    { background: #ffe4e6; color: #e11d48; }

.verif-patient-avatar {
  width: 52px; height: 52px;
  border-radius: var(--radius-full);
  background: var(--primary-lighter);
  color: var(--primary-darker);
  font-size: 1.125rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.verif-greeting {
  font-size: 0.8125rem;
  color: var(--text-medium);
  margin: 0 0 var(--space-1);
}
.verif-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin: 0 0 var(--space-1);
}
.verif-subtitle {
  font-size: 0.875rem;
  color: var(--text-medium);
  line-height: 1.4;
  margin: 0;
}
.verif-patient-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--primary-darker);
  margin: var(--space-1) 0;
}
.verif-session-meta {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin: 0;
}
.verif-question {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-3);
}
.verif-valor {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 var(--space-4);
}

/* ── Lista de pendientes ────────────────────────────────────── */
.verif-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.verif-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.verif-list-item:hover {
  background: var(--primary-lighter);
  border-color: var(--primary);
  transform: translateX(3px);
}

.verif-list-avatar {
  width: 38px; height: 38px;
  border-radius: var(--radius-full);
  background: var(--primary-lighter);
  color: var(--primary-darker);
  font-size: 0.875rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.verif-list-info { flex: 1; min-width: 0; }
.verif-list-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.verif-list-meta {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}
.verif-list-arrow {
  width: 16px; height: 16px;
  stroke: var(--text-light); fill: none; stroke-width: 2;
  stroke-linecap: round; flex-shrink: 0;
}

/* ── Opciones de acción ─────────────────────────────────────── */
.verif-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.verif-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
  background: var(--bg);
  transition: transform 0.12s ease, background 0.15s, border-color 0.15s;
}
.verif-option:hover { transform: translateX(4px); }

.verif-option--success  { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.verif-option--success:hover  { background: #dcfce7; border-color: #86efac; }
.verif-option--success  .verif-option-icon { background: #dcfce7; color: #16a34a; }

.verif-option--cancel   { background: #fff1f2; border-color: #fecdd3; color: #881337; }
.verif-option--cancel:hover   { background: #ffe4e6; border-color: #fda4af; }
.verif-option--cancel   .verif-option-icon { background: #ffe4e6; color: #e11d48; }

.verif-option--reschedule { background: #f5f3ff; border-color: #ddd6fe; color: #3b0764; }
.verif-option--reschedule:hover { background: #ede9fe; border-color: #c4b5fd; }
.verif-option--reschedule .verif-option-icon { background: #ede9fe; color: #6d28d9; }

.verif-option--pending  { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.verif-option--pending:hover  { background: #fef3c7; border-color: #fcd34d; }
.verif-option--pending  .verif-option-icon { background: #fef3c7; color: #d97706; }

.verif-option-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.verif-option-icon svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.verif-option-text { flex: 1; }
.verif-option-label { font-weight: 600; font-size: 0.9375rem; }
.verif-option-sub   { font-size: 0.75rem; opacity: 0.75; margin-top: 2px; }

/* ── Footer ─────────────────────────────────────────────────── */
.verif-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.verif-btn-dismiss { color: var(--text-light); font-size: 0.875rem; }
.verif-btn-back    {
  color: var(--text-medium);
  font-size: 0.875rem;
  display: inline-flex; align-items: center; gap: 4px;
  margin-right: auto;
}
.verif-btn-back svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* Variante destructiva (cancelar cita) — sobreescribe btn-primary */
.verif-btn-danger.btn-primary {
  background: #e11d48;
  border-color: #e11d48;
  color: #fff;
}
.verif-btn-danger.btn-primary:hover {
  background: #be123c;
  border-color: #be123c;
}

/* ── Formulario reprogramar ─────────────────────────────────── */
.verif-reschedule-form { margin-bottom: var(--space-5); }

/* ── Campana: badge con contador ────────────────────────────── */
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 17px; height: 17px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 2px solid var(--surface);
  pointer-events: none;
  line-height: 1;
}

/* ── Badge "En curso" en tarjetas de cita ───────────────────── */
.psi-appt-card--en-curso {
  border-left: 3px solid var(--primary-dark);
}

.psi-en-curso-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--primary-darker);
  background: var(--primary-lighter);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}

.psi-en-curso-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-dark);
  animation: enCursoPulse 1.4s ease-in-out infinite;
}

@keyframes enCursoPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.75); }
}

.psi-form-error {
  font-size: 0.8125rem;
  color: var(--danger);
  background: var(--danger-light);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid rgba(240, 128, 128, 0.3);
}

/* ════════════════════════════════════════════════════════════
   ETIQUETAS (OBJECTIVE TAGS) — multi-select chips
   ════════════════════════════════════════════════════════════ */
.pac-etiquetas-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 4px;
}

.pac-etiqueta-chip {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-medium);
  cursor: pointer;
  transition: var(--ease);
  line-height: 1.4;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.pac-etiqueta-chip:hover {
  border-color: var(--primary-light);
  background: var(--surface);
  color: var(--text);
}

.pac-etiqueta-chip.selected {
  background: var(--primary-lighter);
  border-color: var(--primary-dark);
  color: var(--primary-darker);
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   CHECKBOX LABEL
   ════════════════════════════════════════════════════════════ */
.psi-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--text-medium);
  cursor: pointer;
  user-select: none;
}

.psi-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-dark);
  cursor: pointer;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   CATEGORY SELECTOR
   ════════════════════════════════════════════════════════════ */
.psi-category-selector {
  display: grid;
  /* 3 columnas equitativas — en modales de 280px+ cada columna ≥80px */
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
}

.psi-cat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  /* Padding horizontal mínimo para no derramarse */
  padding: var(--space-3) var(--space-1);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 0.75rem;  /* reducido de 0.8125rem para caber en 3 cols en 280px */
  font-weight: 500;
  color: var(--text-medium);
  cursor: pointer;
  transition: var(--ease);
  min-height: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.psi-cat-btn:hover {
  border-color: var(--primary-light);
  background: var(--surface);
}

.psi-cat-btn.active {
  border-color: var(--secondary);
  background: var(--secondary-lighter);
  color: var(--secondary-dark);
  font-weight: 600;
}

.psi-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.psi-cat-dot--centir   { background: var(--tag-centir-text); }
.psi-cat-dot--referido { background: var(--tag-referido-text); }
.psi-cat-dot--privado  { background: var(--tag-privado-text); }

/* ════════════════════════════════════════════════════════════
   MODALIDAD SELECTOR
   ════════════════════════════════════════════════════════════ */
.psi-modalidad-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.psi-mod-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-medium);
  cursor: pointer;
  transition: var(--ease);
  min-height: 56px;
}

.psi-mod-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.psi-mod-btn:hover {
  border-color: var(--primary-light);
  background: var(--surface);
}

.psi-mod-btn.active {
  border-color: var(--primary);
  background: var(--primary-lighter);
  color: var(--primary-darker);
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════════
   DURACIÓN SELECTOR
   ════════════════════════════════════════════════════════════ */
.psi-duracion-selector {
  display: flex;
  gap: var(--space-2);
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-md);
  /* Nunca más ancho que su contenedor; scroll si aun así sobra */
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-sizing: border-box;
}

.psi-duracion-selector::-webkit-scrollbar { display: none; }

.psi-dur-btn {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-medium);
  cursor: pointer;
  transition: var(--ease);
  border: none;
  background: transparent;
  min-height: 44px;
  min-width: 60px;  /* reducido de 64 para caber en 320px */
  flex-shrink: 0;
  white-space: nowrap;
}

.psi-dur-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.psi-dur-btn.active {
  background: var(--surface);
  color: var(--secondary-dark);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ════════════════════════════════════════════════════════════
   CONSULTORIO SECTION
   ════════════════════════════════════════════════════════════ */
.psi-consultorio-section {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid var(--border-light);
}

.psi-office-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.psi-office-item {
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  padding: var(--space-4) var(--space-3);
  background: var(--surface);
  cursor: pointer;
  transition: var(--ease);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

.psi-office-item:hover:not(.psi-office-item--occupied) {
  border-color: var(--primary);
  background: var(--primary-lighter);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.psi-office-item.selected {
  border-color: var(--primary-dark);
  background: var(--primary-lighter);
  box-shadow: 0 0 0 3px rgba(156, 195, 192, 0.25);
}

.psi-office-item--occupied {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--bg);
  border-style: dashed;
}

.psi-office-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
}

.psi-office-item--occupied .psi-office-icon {
  background: var(--danger-light);
}

.psi-office-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary-dark);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.psi-office-item--occupied .psi-office-icon svg {
  stroke: var(--danger);
}

.psi-office-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.psi-office-status {
  display: flex;
  align-items: center;
  justify-content: center;
}

.psi-office-available {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.625rem;
  font-weight: 600;
  color: #3d7a3a;
}

.psi-office-available svg {
  width: 10px;
  height: 10px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.psi-office-occupied {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--danger);
}

.psi-office-selected-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: var(--primary-dark);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
}

.psi-office-selected-badge svg {
  width: 10px;
  height: 10px;
  stroke: white;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ════════════════════════════════════════════════════════════
   PATIENT SEARCH DROPDOWN
   ════════════════════════════════════════════════════════════ */
.psi-patient-search-wrap {
  position: relative;
}

.psi-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  stroke: var(--text-light);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  z-index: 1;
}

.psi-patient-search {
  padding-left: 36px !important;
}

.psi-patient-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 210;
  max-height: 240px;
  overflow-y: auto;
}

.psi-patient-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: var(--ease);
  border-bottom: 1px solid var(--border-light);
}

.psi-patient-option:last-child {
  border-bottom: none;
}

.psi-patient-option:hover {
  background: var(--primary-lighter);
}

.psi-patient-option-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--secondary-darker);
  flex-shrink: 0;
}

.psi-patient-option-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.psi-patient-option-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ════════════════════════════════════════════════════════════
   VALOR INPUT
   ════════════════════════════════════════════════════════════ */
.psi-valor-wrap {
  position: relative;
}

.psi-valor-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-medium);
  pointer-events: none;
}

.psi-valor-input {
  padding-left: 26px !important;
}

/* ════════════════════════════════════════════════════════════
   PAY BUTTON & PAID STATE
   ════════════════════════════════════════════════════════════ */
/* .psi-appt-right reemplazado por .psi-appt-actions (ver arriba) */

.psi-pay-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--ease);
}

.psi-pay-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.psi-pay-btn:hover {
  border-color: #3d7a3a;
  color: #3d7a3a;
  background: #f0faf0;
}

.psi-pay-btn--paid {
  border-color: #3d7a3a;
  background: #f0faf0;
  color: #3d7a3a;
}

/* El estado "Pagado" debe ser siempre legible, sin importar el tamaño de pantalla */
.psi-pay-btn--paid .psi-btn-label {
  display: inline;
}

.psi-pay-btn--paid:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-light);
}

.psi-appt-card--paid {
  border-left: 3px solid #3d7a3a;
}

/* ── Share button ──────────────────────────────────────────── */
.psi-share-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--ease);
}

.psi-share-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.psi-share-btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--primary-lighter);
}

/* ── Acciones secundarias: reprogramar / cancelar ─────────── */
/* Botones icon-only para no saturar la tarjeta de cita        */
.psi-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-light);
  cursor: pointer;
  transition: var(--ease);
  flex-shrink: 0;
}

.psi-icon-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.psi-icon-btn--reschedule:hover {
  border-color: #c4b5fd;
  color: #6d28d9;
  background: #f5f3ff;
}

.psi-icon-btn--cancel:hover {
  border-color: #fecdd3;
  color: #e11d48;
  background: #fff1f2;
}

/* ════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ════════════════════════════════════════════════════════════ */
.psi-toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: white;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-xl);
  z-index: 300;
  white-space: nowrap;
  max-width: 90vw;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
}

.psi-toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.psi-toast--success {
  background: #2d6e4e;
}

.psi-toast svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE-FIRST UPGRADES
   ════════════════════════════════════════════════════════════ */

/* Toast sobre el bottom nav en mobile (incluye safe-area del home indicator) */
@media (max-width: 899px) {
  .psi-toast {
    bottom: calc(var(--bottom-nav-height) + var(--space-3) + env(safe-area-inset-bottom, 0px));
  }
}

/* A partir de 480px: form row en 2 columnas */
@media (min-width: 480px) {
  .psi-form-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET (600px+)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {

  .psi-greeting {
    font-size: 1.625rem;
  }

  .psi-avatar {
    width: 60px;
    height: 60px;
    font-size: 1.25rem;
  }

  /* A partir de 600px hay espacio suficiente para alinear la fila
     inferior con el nombre del paciente en la fila superior */
  .psi-appt-row-bottom {
    padding-left: calc(52px + 1px + var(--space-3) * 2);
  }

  /* Stats: grid auto-fit en tablet (abandona scroll horizontal).
     Se adapta a 2/3 columnas según el ancho disponible y aloja 5 cards
     sin huecos rotos. */
  .psi-mini-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    overflow: visible;
    margin: 0 0 var(--space-5);
    padding: 0;
  }

  .psi-mini-stat {
    min-width: 0;
    flex-shrink: 1;
    scroll-snap-align: unset;
    padding: var(--space-5) var(--space-4);
  }

  .psi-mini-stat-value {
    font-size: 1.75rem;
  }

  .psi-mini-stat-label {
    font-size: 0.6875rem;
  }

  .psi-quick-actions {
    gap: var(--space-4);
  }

  .psi-action-btn {
    padding: var(--space-4) var(--space-5);
  }

  /* Modal: padding completo en tablet+ */
  .psi-modal-header {
    padding: var(--space-2) var(--space-6) var(--space-4);
  }

  .psi-modal-body {
    padding: var(--space-5) var(--space-6);
  }

  .psi-modal-footer {
    padding: var(--space-4) var(--space-6) var(--space-6);
  }

  .psi-modal {
    width: 92%;
    max-width: 520px;
    margin: 0 auto;
  }

  .psi-modal--large {
    max-width: 600px;
  }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — DESKTOP (900px+)
   ════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {

  /* Stats: 5 columnas en desktop (incluye Comisión mes Centir) */
  .psi-mini-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    overflow: visible;
    margin: 0 0 var(--space-6);
    padding: 0;
  }

  .psi-mini-stat {
    min-width: 0;
    scroll-snap-align: unset;
  }

  /* Office grid: 3 cols en desktop */
  .psi-office-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .psi-welcome {
    margin-bottom: var(--space-6);
  }

  .psi-greeting {
    font-size: 1.875rem;
  }

  .psi-avatar {
    width: 68px;
    height: 68px;
    font-size: 1.375rem;
  }

  .psi-mini-stat-value {
    font-size: 2rem;
  }

  .psi-quick-actions {
    margin-bottom: var(--space-8);
  }

  /* Two-column layout: today + upcoming side by side */
  .psi-sections-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
    align-items: start;
  }

  /* Cards de cita en desktop: ajuste de padding y mostrar labels en botones */
  .psi-appt-card {
    padding: var(--space-4);
  }

  .psi-appt-row-bottom {
    padding-left: calc(52px + 1px + var(--space-3) * 2);
  }

  /* Mostrar etiquetas de texto en botones de cita */
  .psi-btn-label {
    display: inline;
  }

  .psi-modal {
    max-width: 540px;
  }

  .psi-modal--large {
    max-width: 620px;
  }
}

/* ── Campo de teléfono con código de área ────────────────────── */
.psi-phone-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.psi-phone-row .psi-form-input {
  flex: 1;
  min-width: 0;
}

/* ── Custom phone country picker ─────────────────────────────── */
.psi-phone-picker {
  position: relative;
  flex-shrink: 0;
}

.psi-phone-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 100%;
  padding: 0 10px 0 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  transition: var(--ease);
  box-sizing: border-box;
  min-height: 48px;
}

.psi-phone-trigger:hover {
  border-color: var(--primary);
  background: var(--surface);
}

.psi-phone-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(156, 195, 192, 0.2);
}

.psi-phone-trigger-flag {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.psi-phone-trigger-code {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.psi-phone-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-light);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.psi-phone-trigger[aria-expanded="true"] .psi-phone-chevron {
  transform: rotate(180deg);
}

/* ── Dropdown panel ── */
.psi-phone-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 350;
  width: 290px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: psiPanelIn 0.15s ease;
}

@keyframes psiPanelIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.psi-phone-panel.open {
  display: flex;
}

.psi-phone-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}

.psi-phone-search-wrap svg {
  width: 15px;
  height: 15px;
  color: var(--text-light);
  flex-shrink: 0;
}

.psi-phone-search {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
}

.psi-phone-search::placeholder {
  color: var(--text-light);
}

.psi-phone-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  max-height: 228px;
  -webkit-overflow-scrolling: touch;
}

.psi-phone-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.psi-phone-opt:hover {
  background: var(--bg);
}

.psi-phone-opt--selected,
.psi-phone-opt[aria-selected="true"] {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}

.psi-phone-opt--hidden {
  display: none;
}

.psi-phone-opt-flag {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.psi-phone-opt-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.psi-phone-opt--selected .psi-phone-opt-name,
.psi-phone-opt[aria-selected="true"] .psi-phone-opt-name {
  color: var(--primary-darker);
  font-weight: 600;
}

.psi-phone-opt-code {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-light);
  flex-shrink: 0;
}

.psi-phone-opt--selected .psi-phone-opt-code,
.psi-phone-opt[aria-selected="true"] .psi-phone-opt-code {
  color: var(--primary-darker);
}

/* Mobile: el panel no desborda el viewport */
@media (max-width: 480px) {
  .psi-phone-panel {
    width: min(290px, calc(100vw - 48px));
  }
}

/* ════════════════════════════════════════════════════════════
   PATIENT CARDS — vista mobile de Mis Pacientes
   ════════════════════════════════════════════════════════════ */

/* Por defecto (desktop): tabla visible, cards ocultas */
.pac-list-table { display: block; }
.pac-card-list  { display: none; }

.pac-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.pac-card:active {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

/* ── Header: avatar + nombre + valor ─────────────────────────── */
.pac-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.pac-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary-darker);
  flex-shrink: 0;
}

.pac-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.pac-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pac-card-badges {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.pac-card-valor {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Badges de estado */
.pac-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
}

.pac-badge--active {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.pac-badge--inactive {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

/* ── Meta: última cita + pago ────────────────────────────────── */
.pac-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--border-light);
  gap: 1px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.pac-card-meta-item {
  background: var(--surface);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pac-card-meta-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pac-card-meta-value {
  font-size: 0.8125rem;
  color: var(--text);
  font-weight: 500;
}

/* ── Footer: acciones de contacto ────────────────────────────── */
.pac-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.pac-card-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.pac-card-action {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.pac-card-action--call {
  color: #3d7a3a;
  background: #f0faf0;
  border: 1px solid #c8e6c9;
}

.pac-card-action--call:hover,
.pac-card-action--call:active {
  background: #d1fae5;
}

.pac-card-action--call svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pac-card-action--wa {
  color: #25d366;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.pac-card-action--wa:hover,
.pac-card-action--wa:active {
  background: #dcfce7;
}

.pac-card-action--wa svg {
  width: 17px;
  height: 17px;
}

/* Botón de edición en la tarjeta de paciente */
.pac-card-action--edit {
  color: #6d28d9;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  cursor: pointer;
  font: inherit;
}

.pac-card-action--edit:hover,
.pac-card-action--edit:active {
  background: #ede9fe;
}

.pac-card-action--edit svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Botón de edición en la tabla desktop */
.pac-table-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-light);
  cursor: pointer;
  transition: var(--ease);
}

.pac-table-edit-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pac-table-edit-btn:hover {
  border-color: #c4b5fd;
  color: #6d28d9;
  background: #f5f3ff;
}

.pac-card-email {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  color: var(--text-medium);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pac-card-email:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ── Responsive show/hide ────────────────────────────────────── */
@media (max-width: 899px) {
  .pac-list-table    { display: none; }
  .pac-card-list     { display: flex; flex-direction: column; gap: var(--space-3); }
  .dir-search-wrap   { max-width: 100%; }
}

/* ============================================================
   ALERTA: CITAS SIN COBRAR
   ════════════════════════════════════════════════════════════ */

.alerta-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 40, 50, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.25s;
}
.alerta-overlay.visible { opacity: 1; }

.alerta-modal {
  background: var(--surface);
  border-radius: var(--radius-2xl);
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(12px);
  transition: transform 0.25s;
}
.alerta-overlay.visible .alerta-modal { transform: translateY(0); }

/* Header */
.alerta-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.alerta-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fef3c7;
  color: #92400e;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.alerta-header-icon svg {
  width: 20px; height: 20px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.alerta-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
}
.alerta-subtitle {
  font-size: 0.8125rem;
  color: var(--text-medium);
  margin: 0;
}

.alerta-close {
  margin-left: auto;
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light);
  transition: background var(--ease), color var(--ease);
  flex-shrink: 0;
}
.alerta-close:hover { background: var(--border-light); color: var(--danger); }
.alerta-close svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round;
}

/* Body / rows */
.alerta-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

.alerta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--ease);
}
.alerta-row:last-child { border-bottom: none; }
.alerta-row:hover { background: var(--bg); }

.alerta-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.alerta-row-paciente {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alerta-row-fecha {
  font-size: 0.75rem;
  color: var(--text-light);
}
.alerta-row-valor {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-medium);
  white-space: nowrap;
}

.alerta-btn-pagar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: #eef6f5;
  color: #3d7a3a;
  border: 1px solid #b8d9b6;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter var(--ease), transform var(--ease);
  flex-shrink: 0;
}
.alerta-btn-pagar:hover:not(:disabled) { filter: brightness(0.93); transform: scale(1.03); }
.alerta-btn-pagar:disabled { opacity: 0.5; cursor: default; }
.alerta-btn-pagar svg {
  width: 11px; height: 11px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
}

/* Footer */
.alerta-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

.alerta-btn-cerrar {
  padding: 8px 20px;
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--text-medium);
  border: 1px solid var(--border-light);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.alerta-btn-cerrar:hover { background: var(--border-light); color: var(--text); }

/* ════════════════════════════════════════════════════════════
   SHARE — Botón en tarjeta de cita
   ════════════════════════════════════════════════════════════ */
.psi-share-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-light);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--ease);
  flex-shrink: 0;
}
.psi-share-btn:hover {
  border-color: #25d366;
  color: #128c4e;
  background: #f0fff5;
}
.psi-share-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   SHARE — Overlay (bottom sheet en móvil, modal en desktop)
   ════════════════════════════════════════════════════════════ */
.psi-share-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(30, 30, 48, 0.52);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.psi-share-overlay.visible {
  opacity: 1;
}

/* Bottom sheet card */
.psi-share-card {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 520px;
  padding: var(--space-4) var(--space-5) var(--space-6);
  box-shadow: 0 -12px 48px rgba(30, 30, 48, 0.18);
  transform: translateY(32px);
  transition: transform 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.psi-share-overlay.visible .psi-share-card {
  transform: translateY(0);
}

/* Handle bar */
.psi-share-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto var(--space-5);
}

/* Appointment summary box */
.psi-share-summary {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.psi-share-summary-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--text);
}
.psi-share-summary-row svg {
  width: 15px;
  height: 15px;
  stroke: var(--primary-dark);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Two-column action buttons */
.psi-share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.psi-share-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  border-radius: var(--radius-xl);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  transition: var(--ease);
  border: 1.5px solid transparent;
}
.psi-share-action-btn svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.psi-share-action-btn--whatsapp {
  background: #f0fff6;
  color: #128c4e;
  border-color: #c3f0d4;
}
.psi-share-action-btn--whatsapp:hover {
  background: #dcfce7;
  border-color: #25d366;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.2);
}
.psi-share-action-btn--calendar {
  background: var(--primary-lighter, #eef6f5);
  color: var(--primary-darker, #2d6660);
  border-color: var(--primary-light, #9cc3c0);
}
.psi-share-action-btn--calendar:hover {
  background: var(--primary-light, #9cc3c0);
  border-color: var(--primary-dark, #5a8a87);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(90, 138, 135, 0.2);
}

/* Cancel link */
.psi-share-cancel {
  display: block;
  width: 100%;
  padding: var(--space-3);
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border-radius: var(--radius-lg);
  transition: var(--ease);
  text-align: center;
}
.psi-share-cancel:hover {
  background: var(--bg);
  color: var(--text);
}

/* Desktop: centrar como modal */
@media (min-width: 640px) {
  .psi-share-overlay {
    align-items: center;
    padding: var(--space-6);
  }
  .psi-share-card {
    border-radius: 20px;
    max-width: 420px;
  }
}

/* ════════════════════════════════════════════════════════════
   WIZARD DE CITA — Step indicator
   ════════════════════════════════════════════════════════════ */
.cita-wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: var(--space-4) var(--space-6) 0;
  flex-shrink: 0;
}

.cita-step-dot {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-light);
  transition: background 0.25s, border-color 0.25s, color 0.25s;
  flex-shrink: 0;
  user-select: none;
}

.cita-step-dot.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.cita-step-dot.done {
  background: var(--primary-lighter);
  border-color: var(--primary);
  color: var(--primary-darker);
}

.cita-step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  max-width: 56px;
  transition: background 0.3s;
}

.cita-step-line.done {
  background: var(--primary);
}

/* ── Step panels (visibles solo cuando .active) ── */
.cita-step-panel {
  display: none;
  flex-direction: column;
  gap: var(--space-4);
  animation: psiSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cita-step-panel.active {
  display: flex;
}

/* ── Fecha/Hora side-by-side en el paso 2 ── */
.cita-datetime-row {
  grid-template-columns: 1fr 1fr !important;
  gap: var(--space-3) !important;
}

/* ════════════════════════════════════════════════════════════
   PATIENT CHIP — Paciente seleccionado en el wizard
   ════════════════════════════════════════════════════════════ */
.cita-pac-selected {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--primary-lighter);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-lg);
  animation: psiSlideUp 0.2s ease;
}

.cita-pac-selected-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cita-pac-selected-info {
  flex: 1;
  min-width: 0;
}

.cita-pac-selected-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--primary-darker);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cita-pac-selected-tag {
  font-size: 0.6875rem;
  color: var(--primary-dark);
  margin-top: 2px;
}

.cita-pac-clear-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: var(--surface);
  border: none;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.cita-pac-clear-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.cita-pac-clear-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
}

/* ── Botón "Registrar nuevo paciente" ── */
.cita-nuevo-pac-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
  color: var(--text-medium);
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  width: 100%;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.cita-nuevo-pac-btn:hover {
  border-color: var(--primary);
  color: var(--primary-darker);
  background: var(--primary-lighter);
}

.cita-nuevo-pac-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   MODALIDAD CARDS — Tarjetas grandes con icono (paso 2)
   ════════════════════════════════════════════════════════════ */
.psi-mod-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.psi-mod-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-3);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  min-height: 108px;
  width: 100%;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.psi-mod-card:hover {
  border-color: var(--primary-light);
  background: var(--surface);
  transform: translateY(-2px);
}

.psi-mod-card.active {
  border-color: var(--primary);
  background: var(--primary-lighter);
}

.psi-mod-card:active {
  transform: scale(0.97);
}

.psi-mod-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.psi-mod-card.active .psi-mod-card-icon {
  background: var(--primary);
}

.psi-mod-card-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--text-medium);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s;
}

.psi-mod-card.active .psi-mod-card-icon svg {
  stroke: #fff;
}

.psi-mod-card-label {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.psi-mod-card.active .psi-mod-card-label {
  color: var(--primary-darker);
}

.psi-mod-card-sub {
  font-size: 0.75rem;
  color: var(--text-light);
  line-height: 1.3;
}

/* ════════════════════════════════════════════════════════════
   RESUMEN DE CITA — Confirmación en paso 3
   ════════════════════════════════════════════════════════════ */
.cita-resumen {
  background: var(--bg);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.cita-resumen-header {
  padding: var(--space-3) var(--space-4);
  background: var(--primary-lighter);
  border-bottom: 1px solid rgba(156, 195, 192, 0.3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.cita-resumen-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cita-resumen-pac-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary-darker);
}

.cita-resumen-pac-tag {
  font-size: 0.6875rem;
  color: var(--primary-dark);
  margin-top: 1px;
}

.cita-resumen-rows {
  padding: var(--space-1) 0;
}

.cita-resumen-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.cita-resumen-row:last-child {
  border-bottom: none;
}

.cita-resumen-row-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cita-resumen-row-icon svg {
  width: 15px;
  height: 15px;
  stroke: var(--text-medium);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cita-resumen-row-label {
  font-size: 0.6875rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 2px;
}

.cita-resumen-row-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

/* ════════════════════════════════════════════════════════════
   WIZARD FOOTER — Botones de navegación por paso
   ════════════════════════════════════════════════════════════ */
.cita-wizard-footer {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  padding-bottom: max(var(--space-5), env(safe-area-inset-bottom, var(--space-5)));
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

.cita-wizard-footer .btn {
  flex: 1;
}

.cita-wizard-footer .cita-btn-back {
  flex: 0 0 auto;
  min-width: 88px;
}

/* ── Desktop: wizard como dialog centrado ── */
@media (min-width: 900px) {
  .cita-mod-cards {
    gap: var(--space-4);
  }
  .psi-mod-card {
    padding: var(--space-6) var(--space-4);
  }
}

/* ════════════════════════════════════════════════════════════
   FASE 5 — TOOLBAR STICKY (Pacientes & Historial)
   ════════════════════════════════════════════════════════════ */
.pac-toolbar-sticky {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  padding: var(--space-3) 0 var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ── Chips de filtro ── */
.pac-chips-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.pac-chips-row::-webkit-scrollbar { display: none; }

.pac-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text-medium);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  min-height: 34px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.pac-chip:hover {
  border-color: var(--primary-light);
  color: var(--text);
}

.pac-chip.active {
  background: var(--primary-lighter);
  border-color: var(--primary);
  color: var(--primary-darker);
  font-weight: 600;
}

.pac-chips-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 var(--space-1);
}

/* ════════════════════════════════════════════════════════════
   FASE 5 — SWIPE ITEMS (Mis Pacientes)
   ════════════════════════════════════════════════════════════ */
.pac-swipe-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  /* El overflow:hidden recorta los paneles de acción */
}

/* Paneles de acción detrás de la card */
.pac-swipe-act {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
}

.pac-swipe-act--left {
  left: 0;
  width: 88px;
  justify-content: center;
  background: var(--primary);
}

.pac-swipe-act--right {
  right: 0;
  width: 148px;
  justify-content: center;
  gap: var(--space-1);
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

/* Botones de acción en los paneles */
.pac-swipe-act-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  min-width: 48px;
  min-height: 56px;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.pac-swipe-act-btn:active { opacity: 0.75; }

.pac-swipe-act-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Detalle */
.pac-swipe-act-btn--detail {
  color: #fff;
}
.pac-swipe-act-btn--detail svg { stroke: #fff; }

/* Llamar */
.pac-swipe-act-btn--call {
  color: #3d7a3a;
}
.pac-swipe-act-btn--call svg { stroke: currentColor; }

/* WhatsApp */
.pac-swipe-act-btn--wa {
  color: #25d366;
}
.pac-swipe-act-btn--wa svg { fill: currentColor; stroke: none; }

/* Sin teléfono */
.pac-swipe-act-btn--notel {
  color: var(--text-light);
  font-size: 0.625rem;
  text-align: center;
  pointer-events: none;
}
.pac-swipe-act-btn--notel svg { stroke: var(--text-light); }

/* Card encima de los paneles — se desliza con JS */
.pac-swipe-item .pac-card {
  position: relative;
  z-index: 1;
  will-change: transform;
  /* box-shadow da sensación de "elevado" al deslizar */
}

.pac-swipe-item.swipe-l .pac-card,
.pac-swipe-item.swipe-r .pac-card {
  box-shadow: var(--shadow-md);
}

/* ── Detalle expandible ── */
.pac-card-detail {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  animation: psiSlideUp 0.18s ease;
}

.pac-detail-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--text-medium);
}

.pac-detail-row svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-light);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
  margin-top: 2px;
}

.pac-detail-row a {
  color: var(--primary-darker);
  text-decoration: none;
}

.pac-detail-row a:hover { text-decoration: underline; }

.pac-detail-row--notes {
  align-items: flex-start;
  color: var(--text-light);
  font-size: 0.8125rem;
  font-style: italic;
}

/* ── Botón "Cargar más" ── */
.pac-load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-4);
  margin-top: var(--space-3);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-medium);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 48px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pac-load-more-btn:hover {
  border-color: var(--primary);
  color: var(--primary-darker);
  background: var(--primary-lighter);
}

/* ─── Ocultar swipe panels en desktop ─── */
@media (min-width: 900px) {
  .pac-swipe-act { display: none; }
  .pac-swipe-item { overflow: visible; border-radius: 0; }
  .pac-swipe-item .pac-card { will-change: auto; transform: none !important; }
}

/* ════════════════════════════════════════════════════════════
   FASE 5 — CARDS DE HISTORIAL (mobile)
   ════════════════════════════════════════════════════════════ */

/* Por defecto (desktop): tabla visible, cards ocultas */
.hst-card-list { display: none; }

.hst-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.hst-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
}

.hst-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--secondary-darker);
  flex-shrink: 0;
}

.hst-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hst-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hst-card-datetime {
  font-size: 0.75rem;
  color: var(--text-light);
}

.hst-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  flex-wrap: wrap;
}

.hst-card-espacio {
  font-size: 0.8125rem;
  color: var(--text-light);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hst-card-valor {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.hst-card-comision {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Comisión en la tabla desktop */
.hst-comision {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: #4f46e5;
  font-weight: 600;
  white-space: nowrap;
}

.hst-comision-pct {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 0 6px;
  border-radius: var(--radius-full);
}

/* Mobile: tabla oculta, cards visibles */
@media (max-width: 899px) {
  .hst-card-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }
  /* La tabla del historial ya usa pac-list-table → display:none en mobile */
}

/* ============================================================
   PHASE 6 — Directorio (mobile-first)
   ============================================================ */

/* ── Sección expandible ─────────────────────────────────────── */
.dir-section {
  margin-bottom: var(--space-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.dir-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.dir-section-toggle:active {
  background: var(--bg-hover, rgba(0,0,0,.04));
}

.dir-section-toggle-label {
  flex: 1;
  min-width: 0;
}

.dir-section-toggle-count {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-light);
  background: var(--bg-muted, rgba(0,0,0,.06));
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.dir-section-toggle-arrow {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: var(--text-light);
  stroke-width: 2;
  fill: none;
  transition: transform 0.2s ease;
}
.dir-section-toggle-arrow.open {
  transform: rotate(180deg);
}

/* ── Contenido colapsable ────────────────────────────────────── */
.dir-section-content {
  display: none;
  padding: 0 var(--space-4) var(--space-4);
}
.dir-section-content.open {
  display: block;
}

/* ── Columna de cards ────────────────────────────────────────── */
.dir-cards-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Card individual ─────────────────────────────────────────── */
.dir-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.dir-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
}

.dir-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
}

.dir-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dir-card-name-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.dir-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.dir-card-title {
  font-size: 0.8125rem;
  color: var(--text-light);
}

.dir-card-esp {
  font-size: 0.75rem;
  color: var(--text-light);
  font-style: italic;
}

/* ── Email secundario ────────────────────────────────────────── */
.dir-card-email-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-2);
}
.dir-card-email-row svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-light);
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}
.dir-email-link {
  font-size: 0.8125rem;
  color: var(--text-light);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dir-email-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ── Role badges ─────────────────────────────────────────────── */
.dir-role-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}
.dir-role-badge--admin {
  background: rgba(var(--primary-rgb, 90,138,135), .12);
  color: var(--primary-dark);
}
.dir-role-badge--dev {
  background: rgba(120,100,180,.12);
  color: #5a3fa0;
}
.dir-role-badge--terapeuta {
  background: rgba(var(--primary-rgb, 90,138,135), .08);
  color: var(--primary);
}

/* ── CTAs de contacto ────────────────────────────────────────── */
.dir-card-ctas {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-light);
}

.dir-cta {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: filter 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.dir-cta svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.dir-cta:active {
  opacity: 0.8;
}

.dir-cta--call {
  background: var(--primary, #5a8a87);
  color: #fff;
}
.dir-cta--call svg {
  stroke: #fff;
  stroke-width: 2;
  fill: none;
}

.dir-cta--wa {
  background: #25d366;
  color: #fff;
}
.dir-cta--wa svg {
  fill: #fff;
  stroke: none;
}

.dir-cta--email {
  background: var(--surface);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.dir-cta--email svg {
  stroke: var(--primary);
  stroke-width: 2;
  fill: none;
}

/* ── Desktop: multi-columna ──────────────────────────────────── */
@media (min-width: 900px) {
  .dir-section-toggle:hover {
    background: var(--bg-hover, rgba(0,0,0,.04));
  }

  .dir-cards-col {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-4);
  }
}

/* ============================================================
   PHASE 7 — Editar Perfil (mobile-first accordion)
   ============================================================ */

/* ── Wrapper accordion ───────────────────────────────────────── */
.pf-accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* ── Sección ─────────────────────────────────────────────────── */
.pf-section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}

.pf-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.pf-section-toggle:active {
  background: var(--bg-hover, rgba(0,0,0,.04));
}

.pf-section-toggle-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.pf-section-toggle-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary);
  stroke-width: 2;
  fill: none;
}

.pf-section-toggle-label {
  flex: 1;
}

.pf-section-toggle-arrow {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: var(--text-light);
  stroke-width: 2;
  fill: none;
  transition: transform 0.2s ease;
}
.pf-section-toggle-arrow.open {
  transform: rotate(180deg);
}

/* ── Contenido ───────────────────────────────────────────────── */
.pf-section-content {
  display: none;
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-light);
}
.pf-section-content.open {
  display: block;
}

.pf-section-desc {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin: var(--space-3) 0 var(--space-4);
}

/* ── Campos ──────────────────────────────────────────────────── */
.pf-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-4);
}

.pf-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pf-field--full {
  grid-column: 1 / -1;
}

.pf-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pf-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.625rem var(--space-3);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
.pf-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ── Bio rich-text editor ────────────────────────────────────── */
.pf-bio-wrap {
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.15s;
}
.pf-bio-wrap:focus-within {
  border-color: var(--primary);
}

.pf-bio-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-alt, #f7f7f8);
}

.pf-bio-tb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--text-medium);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.pf-bio-tb-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}
.pf-bio-tb-btn.is-active {
  background: var(--primary-xlight, rgba(99, 91, 255, 0.12));
  color: var(--primary-dark);
}
.pf-bio-tb-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.pf-bio-tb-sep {
  width: 1px;
  height: 20px;
  background: var(--border-light);
  margin: 0 4px;
  flex-shrink: 0;
}

.pf-bio-editor {
  min-height: 160px;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.625rem var(--space-3);
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text);
  outline: none;
  word-break: break-word;
}
.pf-bio-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-xlight, #b0b0b8);
  pointer-events: none;
  display: block;
}
.pf-bio-editor ul {
  padding-left: 1.4em;
  margin: 0.3em 0;
}
.pf-bio-editor li {
  margin: 0.15em 0;
}

@media (max-width: 599px) {
  .pf-bio-tb-btn {
    width: 38px;
    height: 38px;
  }
  .pf-bio-editor {
    min-height: 140px;
  }
}

/* ── Foto ────────────────────────────────────────────────────── */
.pf-foto-wrap {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin: var(--space-4) 0;
}

.pf-foto-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-muted, rgba(0,0,0,.06));
}

.pf-foto-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pf-foto-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.pf-foto-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pf-foto-btns-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pf-foto-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pf-foto-hint {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* ── Actions footer ──────────────────────────────────────────── */
.pf-section-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-2);
}

/* ── Modalidad cards ─────────────────────────────────────────── */
.pf-mod-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.pf-mod-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-3) var(--space-2);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-light);
  text-align: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.pf-mod-card input[type="radio"] { display: none; }
.pf-mod-card svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-light);
  stroke-width: 1.5;
  fill: none;
  transition: stroke 0.15s;
}
.pf-mod-card.selected {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: rgba(var(--primary-rgb, 90,138,135), .06);
}
.pf-mod-card.selected svg {
  stroke: var(--primary);
}

/* ── Cert chips ──────────────────────────────────────────────── */
.pf-certs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-3) 0;
  min-height: 36px;
}

.pf-certs-empty {
  font-size: 0.8125rem;
  color: var(--text-light);
  font-style: italic;
  padding: var(--space-2) 0;
}

.pf-cert-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  background: rgba(var(--primary-rgb, 90,138,135), .1);
  border: 1px solid rgba(var(--primary-rgb, 90,138,135), .25);
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--primary-dark);
  max-width: 100%;
}

.pf-cert-chip-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.pf-cert-chip-del {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-dark);
  padding: 2px;
  border-radius: 50%;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.pf-cert-chip-del:hover {
  opacity: 1;
  background: rgba(var(--primary-rgb, 90,138,135), .2);
}

.pf-cert-add-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-3);
}

.pf-cert-add-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: unset;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Desktop overrides ───────────────────────────────────────── */
@media (min-width: 900px) {
  .pf-section-toggle:hover {
    background: var(--bg-hover, rgba(0,0,0,.04));
  }

  .pf-accordion {
    max-width: 700px;
  }

  .pf-mod-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .pf-cert-chip-text {
    max-width: 400px;
  }
}

/* ════════════════════════════════════════════════════════════
   PWA — INSTALL UI
   ════════════════════════════════════════════════════════════ */

/* Botón en el sidebar */
.sidebar-install-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: calc(100% - var(--space-4) * 2);
  margin: 0 var(--space-4) var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--primary-lighter);
  border: 1.5px solid rgba(156, 195, 192, 0.4);
  border-radius: var(--radius-md);
  color: var(--primary-darker);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
}
.sidebar-install-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}
.sidebar-install-btn svg {
  width: 16px; height: 16px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* Banner flotante sobre el bottom-nav */
.pwa-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-3) + env(safe-area-inset-bottom, 0px));
  left: var(--space-4);
  right: var(--space-4);
  z-index: 150;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  animation: pwaSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pwaSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.pwa-banner-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, #eef6f5, #f0edf5);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  flex-shrink: 0;
  overflow: hidden;
}
.pwa-banner-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pwa-banner-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pwa-banner-body strong {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}
.pwa-banner-body span {
  font-size: 0.75rem;
  color: var(--text-medium);
}
.pwa-banner-cta {
  padding: 8px 16px;
  background: var(--primary-dark);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--ease);
}
.pwa-banner-cta:hover { background: var(--primary-darker); }
.pwa-banner-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-light);
  flex-shrink: 0;
  transition: var(--ease);
}
.pwa-banner-close:hover { background: var(--bg); color: var(--text); }
.pwa-banner-close svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round;
}

/* Diálogo de instrucciones iOS */
.pwa-ios-dialog {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(44, 44, 61, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: psiOverlayIn 0.2s ease;
}
.pwa-ios-dialog-card {
  background: var(--surface);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  padding: var(--space-6) var(--space-6) calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 480px;
  position: relative;
  animation: pwaSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}
.pwa-ios-close {
  position: absolute;
  top: var(--space-4); right: var(--space-4);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border-radius: var(--radius-full);
  color: var(--text-light);
  transition: var(--ease);
}
.pwa-ios-close:hover { background: var(--border); color: var(--text); }
.pwa-ios-close svg {
  width: 14px; height: 14px;
  stroke: currentColor; fill: none;
  stroke-width: 2.5; stroke-linecap: round;
}
/* Preview del ícono en el home screen */
.pwa-ios-app-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 auto var(--space-5);
}
.pwa-ios-app-icon {
  width: 76px; height: 76px;
  border-radius: 18px;
  background: linear-gradient(145deg, #eef6f5, #f0edf5);
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 16px rgba(151, 135, 163, 0.18), 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
}
.pwa-ios-app-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pwa-ios-app-icon-fallback {
  width: 100%; height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-darker);
}
.pwa-ios-app-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
}
.pwa-ios-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.pwa-ios-subtitle {
  font-size: 0.875rem;
  color: var(--text-medium);
  margin-bottom: var(--space-5);
  line-height: 1.5;
}
.pwa-ios-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  text-align: left;
}
.pwa-ios-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: 0.9375rem;
  color: var(--text-medium);
  line-height: 1.5;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}
.pwa-ios-step strong { color: var(--text); }
.pwa-ios-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--primary-dark);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.pwa-ios-share-svg {
  width: 15px; height: 15px;
  stroke: var(--primary-darker);
  fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle;
  display: inline-block;
  margin: 0 2px;
}

/* En desktop no mostramos el banner (ya tienen instalación de Chrome) */
@media (min-width: 900px) {
  .pwa-banner { display: none !important; }
}

