:root {
  --teal: #065f46; /* darker teal primary */
  --teal-hover: #064e3b; /* darker hover */
  --teal-glow: rgba(6, 95, 70, 0.15);
  --teal-light: #0d9488; /* accent teal */
  --slate-dark: #090d16;
  --slate-panel: rgba(15, 23, 42, 0.55);
  --border-light: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(13, 148, 136, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #64748b;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--slate-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(13, 148, 136, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(13, 148, 136, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Pantalla de Login ─── */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 20px;
}

.login-card {
  background: var(--slate-panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.brand {
  text-align: center;
  margin-bottom: 30px;
}

.brand-logo {
  font-size: 40px;
  margin-bottom: 8px;
}

.brand-title {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--teal-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #fff;
  transition: all 0.2s;
}

.form-control option {
  background-color: var(--slate-dark);
  color: #fff;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.btn-submit {
  width: 100%;
  background: var(--teal);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-submit:hover {
  background: var(--teal-hover);
  box-shadow: 0 4px 15px var(--teal-glow);
}

.error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  color: #f87171;
  padding: 12px;
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
  text-align: center;
}

.back-to-pro {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.back-to-pro:hover {
  color: var(--teal-light);
}

/* ─── Panel de Control (Dashboard) ─── */
.app-container {
  display: none;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-logo {
  font-weight: 700;
  font-size: 20px;
  color: var(--teal-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.patient-name-lbl {
  font-weight: 500;
  font-size: 14px;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.main-content {
  flex: 1;
  padding: 24px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

/* Recordatorio de Cita Próxima */
.reminder-banner {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.2) 0%, rgba(20, 184, 166, 0.15) 100%);
  border: 1px solid var(--teal);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: none;
  align-items: center;
  gap: 16px;
}

.reminder-icon {
  font-size: 28px;
}

.reminder-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--teal-light);
  margin-bottom: 2px;
}

.reminder-desc {
  font-size: 13px;
  color: var(--text-main);
}

.portal-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .portal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  header {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: center !important;
    text-align: center !important;
    padding: 12px 16px !important;
  }
  .user-badge {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .btn-logout {
    width: 100% !important;
    text-align: center !important;
  }
}

@media (max-width: 400px) {
  .login-card {
    padding: 24px 16px !important;
  }
  .brand-title {
    font-size: 20px !important;
  }
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid var(--teal);
  padding-left: 10px;
}

.card {
  background: var(--slate-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Lista de Citas */
.appointment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.appointment-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.appointment-info h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.appointment-info p {
  font-size: 13px;
  color: var(--text-muted);
}

.appointment-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.status-pendiente { background: rgba(217, 119, 6, 0.15); color: #fbbf24; }
.status-confirmada { background: rgba(22, 163, 74, 0.15); color: #4ade80; }
.status-solicitada { background: rgba(37, 99, 235, 0.15); color: #60a5fa; }
.status-cancelada { background: rgba(220, 38, 38, 0.15); color: #f87171; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

/* Chat de Soporte */
.chat-box {
  display: flex;
  flex-direction: column;
  height: 400px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  padding-right: 6px;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 2px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  font-family: 'Inter', sans-serif;
}

.bubble-sent {
  align-self: flex-end;
  background: var(--teal);
  color: #fff;
  border-bottom-right-radius: 2px;
}

.bubble-received {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
}

.bubble-time {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  text-align: right;
}

.chat-input-area {
  display: flex;
  gap: 8px;
}

.btn-send {
  background: var(--teal);
  border: none;
  color: #fff;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.2s;
}

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

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #10b981;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #ef4444;
}

/* ─── Calendario Semanal ─── */
.cal-month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.cal-nav-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.cal-nav-btn:hover { background: rgba(255,255,255,0.1); border-color: var(--teal); }
.cal-month-label {
  font-weight: 700;
  font-size: 16px;
  color: var(--teal-light);
}
.cal-days-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  background: rgba(255,255,255,0.02);
  min-height: 44px;
}
.cal-day:hover { border-color: var(--teal); background: rgba(13,148,136,0.1); }
.cal-day.other-month { opacity: 0.25; pointer-events: none; }
.cal-day.past { opacity: 0.3; pointer-events: none; }
.cal-day.today { border-color: var(--teal); background: rgba(13,148,136,0.15); }
.cal-day.available { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.08); }
.cal-day.available:hover { border-color: #10b981; background: rgba(16,185,129,0.2); }
.cal-day.selected { border-color: #10b981; background: rgba(16,185,129,0.25); box-shadow: 0 0 0 2px rgba(16,185,129,0.3); }
.cal-day .cal-day-dot {
  width: 5px; height: 5px; border-radius: 50%; background: #10b981;
  margin-top: 3px;
}
/* Día con bloqueo completo del doctor — visual rojo prominente */
.cal-day.bloqueado {
  border-color: rgba(239,68,68,0.55) !important;
  background: rgba(239,68,68,0.12) !important;
  color: #f87171 !important;
  cursor: not-allowed !important;
  pointer-events: auto !important;
  position: relative;
}
.cal-day.bloqueado::after {
  content: '\1F6AB';
  display: block;
  font-size: 11px;
  margin-top: 2px;
  line-height: 1;
}
.cal-day.bloqueado:hover {
  border-color: rgba(239,68,68,0.75) !important;
  background: rgba(239,68,68,0.2) !important;
}
/* Día con bloqueo parcial (solo algunas horas) — tono ambar/naranja */
.cal-day.bloqueado-parcial {
  border-color: rgba(251,146,60,0.55) !important;
  background: rgba(251,146,60,0.09) !important;
}
.cal-day.bloqueado-parcial::after {
  content: '\26A0';
  display: block;
  font-size: 10px;
  margin-top: 2px;
  color: #fb923c;
  line-height: 1;
}
.cal-time-btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,0.03);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.cal-time-btn:hover { border-color: var(--teal); background: rgba(13,148,136,0.15); }
.cal-time-btn.selected { border-color: #10b981; background: rgba(16,185,129,0.2); color: #10b981; font-weight:600; }
/* Slot ocupado por una cita existente */
.cal-time-btn.slot-ocupado {
  opacity: 0.5; cursor: not-allowed;
  border-color: rgba(100,116,139,0.4);
  background: rgba(100,116,139,0.08);
  color: #94a3b8; font-size:12px;
  text-decoration: line-through;
}
/* Slot bloqueado por el doctor — rojo fuerte */
.cal-time-btn.slot-bloqueado {
  cursor: not-allowed;
  border-color: rgba(239,68,68,0.5);
  background: rgba(239,68,68,0.12);
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
  position: relative;
}
.cal-time-btn.slot-bloqueado::before {
  content: '\1F6AB ';
  font-size: 11px;
}

/* ── Tarjetas de Cita (panel botón estilo calendario) ── */
.apt-card {
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  background: rgba(255,255,255,0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
}
.apt-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  border-color: rgba(13,148,136,0.5);
}
.apt-card--confirmada { border-color: rgba(16,185,129,0.35); }
.apt-card--cancelada { opacity: .6; }

.apt-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border-light);
}
.apt-date-block {
  display: flex;
  align-items: center;
  gap: 6px;
}
.apt-day-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--teal-light);
  line-height: 1;
}
.apt-date-right {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.apt-month { font-size: 11px; font-weight: 700; color: var(--teal); letter-spacing: .06em; }
.apt-year  { font-size: 11px; color: var(--text-muted); }

.apt-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.apt-badge.status-confirmada  { background: rgba(16,185,129,.18); color: #34d399; }
.apt-badge.status-solicitada  { background: rgba(251,191,36,.18); color: #fbbf24; }
.apt-badge.status-pendiente   { background: rgba(251,191,36,.18); color: #fbbf24; }
.apt-badge.status-cancelada   { background: rgba(239,68,68,.18);  color: #f87171; }

.apt-card__body {
  padding: 10px 14px;
  flex: 1;
}
.apt-dia-semana { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.apt-hora { font-size: 16px; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.apt-trat { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.apt-card__footer {
  padding: 8px 14px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.apt-cancel-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239,68,68,.45);
  background: rgba(239,68,68,.08);
  color: #f87171;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.apt-cancel-btn:hover { background: rgba(239,68,68,.2); border-color: #ef4444; }
.apt-no-cancel-msg { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* ─────────────────────────────────────────────
   ✍️  Consentimientos — tarjetas
   ───────────────────────────────────────────── */
.consent-item {
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  background: rgba(255,255,255,0.025);
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.consent-item:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.consent-item.consent-pending {
  border-color: rgba(251,191,36,.35);
  background: rgba(251,191,36,.04);
}
.consent-item.consent-signed {
  border-color: rgba(16,185,129,.3);
  background: rgba(16,185,129,.03);
}

.consent-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
}
.consent-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: .04em;
}
.badge-pending {
  background: rgba(251,191,36,.18);
  color: #fbbf24;
}
.badge-signed {
  background: rgba(16,185,129,.18);
  color: #34d399;
}
.consent-date {
  font-size: 11px;
  color: var(--text-muted);
}

.consent-item__body {
  padding: 12px 14px 14px;
}
.consent-texto {
  font-size: 13px;
  color: var(--text-main);
  line-height: 1.6;
  font-family: 'Inter', sans-serif;
  max-height: 120px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.consent-texto::-webkit-scrollbar { width: 3px; }
.consent-texto::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.btn-firmar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(135deg, var(--teal), #0284c7);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 14px rgba(13,148,136,.35);
}
.btn-firmar:hover {
  opacity: .9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(13,148,136,.5);
}
.btn-firmar:active { transform: translateY(0); }

.consent-firma-preview {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.firma-img {
  max-width: 200px;
  max-height: 60px;
  border-radius: 6px;
  border: 1px solid rgba(16,185,129,.3);
  background: rgba(255,255,255,.05);
  object-fit: contain;
  padding: 4px;
}

/* ─────────────────────────────────────────────
   ✍️  Modal de Firma Digital
   ───────────────────────────────────────────── */
.firma-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9,13,22,.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.firma-modal-card {
  background: rgba(15,23,42,.97);
  border: 1px solid rgba(13,148,136,.4);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 660px;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 0 1px rgba(13,148,136,.1);
  animation: modalFadeIn .25s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.firma-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.firma-modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--teal-light);
}
.firma-modal-close {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.25);
  color: #f87171;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.firma-modal-close:hover { background: rgba(239,68,68,.3); }

.firma-modal-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-family: 'Inter', sans-serif;
}

.firma-canvas-wrap {
  border: 2px dashed rgba(13,148,136,.5);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255,255,255,.03);
  cursor: crosshair;
  touch-action: none;
}
.firma-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.firma-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-end;
}

.btn-firma-clear {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,.04);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-firma-clear:hover {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.4);
  color: #f87171;
}

.btn-firma-save {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--teal), #0284c7);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(13,148,136,.4);
  transition: opacity .2s, box-shadow .2s;
}
.btn-firma-save:hover { opacity: .88; box-shadow: 0 6px 20px rgba(13,148,136,.6); }
.btn-firma-save:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 480px) {
  .firma-modal-card {
    padding: 20px 16px 18px;
  }
  .firma-modal-actions {
    flex-direction: column;
  }
  .btn-firma-clear,
  .btn-firma-save {
    width: 100%;
    text-align: center;
  }
}

/* ─────────────────────────────────────────────────────────────
   📋  Consent Card Compacta — cabecera con badges + toggle
   ───────────────────────────────────────────────────────────── */
.consent-card-compact {
  padding-bottom: 0;
}

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

.consent-badges-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Botón toggle desplegable */
.btn-consent-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,.04);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: 'Outfit', sans-serif;
  margin-bottom: 0;
}
.btn-consent-toggle:hover:not(:disabled) {
  background: rgba(13,148,136,.12);
  border-color: rgba(13,148,136,.5);
}
.btn-consent-toggle:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn-consent-toggle--open {
  border-color: rgba(13,148,136,.55);
  background: rgba(13,148,136,.08);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.consent-toggle-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform .25s ease;
  flex-shrink: 0;
}

/* Dropdown colapsable */
.consent-dropdown {
  overflow: hidden;
  max-height: 0;
  transition: max-height .3s cubic-bezier(.4,0,.2,1);
  border: 1.5px solid transparent;
  border-top: none;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}
.consent-dropdown--open {
  max-height: 480px;
  border-color: rgba(13,148,136,.35);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(13,148,136,.3) transparent;
}
.consent-dropdown--open::-webkit-scrollbar { width: 4px; }
.consent-dropdown--open::-webkit-scrollbar-thumb {
  background: rgba(13,148,136,.3);
  border-radius: 2px;
}

.consent-dropdown-list {
  display: flex;
  flex-direction: column;
}

/* Fila de documento en el dropdown */
.consent-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: background .15s;
  font-family: 'Outfit', sans-serif;
}
.consent-row:last-child { border-bottom: none; }
.consent-row:hover {
  background: rgba(13,148,136,.1);
}
.consent-row--pending:hover {
  background: rgba(251,191,36,.08);
}

.consent-row__icon {
  font-size: 18px;
  flex-shrink: 0;
}
.consent-row__title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}
.consent-row__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.consent-row__date {
  font-size: 11px;
  color: var(--text-muted);
}
.consent-row__chevron {
  font-size: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1;
}

/* ─────────────────────────────────────────────────────────────
   📄  Modal Emergente — Ver documento y firmar
   ───────────────────────────────────────────────────────────── */
.consent-view-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9,13,22,.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9500;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.consent-view-card {
  background: rgba(13,20,38,.98);
  border: 1px solid rgba(13,148,136,.4);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,.8), 0 0 0 1px rgba(13,148,136,.08);
  animation: modalFadeIn .22s ease;
  overflow: hidden;
}

.consent-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.consent-view-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--teal-light);
  line-height: 1.3;
  margin-bottom: 4px;
}
.consent-view-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
}

.consent-view-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(13,148,136,.3) transparent;
}
.consent-view-body::-webkit-scrollbar { width: 5px; }
.consent-view-body::-webkit-scrollbar-thumb {
  background: rgba(13,148,136,.3);
  border-radius: 3px;
}

.consent-full-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  white-space: pre-wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.consent-firma-pad-wrap {
  margin-top: 4px;
}

.consent-firma-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #34d399;
  margin-bottom: 8px;
}
.firma-img-lg {
  display: block;
  max-width: 280px;
  max-height: 90px;
  border-radius: 8px;
  border: 1px solid rgba(16,185,129,.35);
  background: rgba(255,255,255,.04);
  object-fit: contain;
  padding: 6px;
}

.consent-view-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: rgba(9,13,22,.5);
}

.btn-consent-cerrar {
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,.05);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: 'Outfit', sans-serif;
}
.btn-consent-cerrar:hover {
  background: rgba(255,255,255,.1);
  color: var(--text-main);
}

@media (max-width: 600px) {
  .consent-view-card {
    max-height: 95vh;
    border-radius: var(--radius-md);
  }
  .consent-view-header,
  .consent-view-body,
  .consent-view-footer {
    padding-left: 16px;
    padding-right: 16px;
  }
  .consent-view-footer {
    flex-direction: column;
  }
  .btn-consent-cerrar,
  .btn-firma-clear,
  .btn-firma-save {
    width: 100%;
    text-align: center;
  }
  .consent-header-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
.btn-primary {
  background: var(--teal);
  color: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-primary:hover {
  background: var(--teal-hover);
  border-color: var(--border-focus);
}
