/* ==========================================================================
   Salud 2.0 - Sistema de Diseño Cálido, Médico y Accesible
   ========================================================================== */

:root {
  --bg-main: #F8F9FA;
  --bg-card: #FFFFFF;
  --bg-card-subtle: #F1F5F7;
  
  --primary-mint: #2A9D8F;
  --primary-mint-dark: #20756B;
  --primary-mint-light: #E6F5F3;
  --primary-mint-rgb: 42, 157, 143;

  --btn-green: #2E8B57; /* SeaGreen / Verde Saludable */
  --btn-green-hover: #236B43;
  --btn-green-light: #EBF8F1;

  --accent-coral: #E76F51;
  --accent-coral-light: #FDF0ED;
  --accent-amber: #F4A261;
  --accent-blue: #3A86FF;
  --accent-purple: #7209B7;

  --text-dark: #1E293B;
  --text-medium: #475569;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --border-light: #E2E8F0;
  --border-focus: #2A9D8F;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --header-height: 72px;
  --nav-height: 68px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.5;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ==========================================================================
   Contenedor y Layout Full-Width
   ========================================================================== */

.app-wrapper {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 96px; /* Espacio para barra móvil */
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

@media (min-width: 768px) {
  .app-wrapper {
    padding: 24px 32px 60px 32px;
  }
}

/* ==========================================================================
   Header y Barra Superior Limpia
   ========================================================================== */

.top-navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.top-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-dark);
  cursor: pointer;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-mint), #1F7A6F);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(42, 157, 143, 0.3);
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-dark);
  line-height: 1.1;
}

.brand-text span {
  font-size: 12px;
  color: var(--primary-mint);
  font-weight: 600;
}

/* Selector Superior de Familiar */
.family-picker-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.family-select-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-mint-light);
  border: 1.5px solid rgba(42, 157, 143, 0.25);
  padding: 6px 14px 6px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-mint-dark);
}

.family-select-btn:hover,
.family-select-btn:focus {
  background: #DCF2EE;
  border-color: var(--primary-mint);
}

.family-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary-mint);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
}

.family-select-btn .chevron-icon {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.family-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 101;
  overflow: hidden;
  animation: fadeInDown 0.15s ease-out forwards;
}

.family-dropdown-menu.active {
  display: flex;
}

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

.dropdown-header-label {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  border-bottom: 1px solid var(--border-light);
}

.family-list-scroll {
  max-height: 240px;
  overflow-y: auto;
}

.family-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid #f1f5f9;
}

.family-option:hover {
  background: var(--primary-mint-light);
}

.family-option.selected {
  background: #EFF9F7;
  font-weight: 600;
}

.family-option-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.family-option-name {
  font-size: 14px;
  color: var(--text-dark);
}

.family-option-role {
  font-size: 11px;
  color: var(--text-muted);
}

.dropdown-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  background: #FAFAFA;
  color: var(--btn-green);
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-top: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
}

.dropdown-add-btn:hover {
  background: var(--btn-green-light);
}

/* ==========================================================================
   Barra de Acciones Globales del Perfil
   ========================================================================== */

.profile-hero-card {
  background: linear-gradient(135deg, #FFFFFF, #F4FBF9);
  border: 1px solid rgba(42, 157, 143, 0.2);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.profile-hero-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-avatar-big {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--primary-mint);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 4px 10px rgba(42, 157, 143, 0.25);
}

.hero-info h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag-age { background: #EEF2F6; color: var(--text-medium); }
.tag-blood { background: #FDE8E8; color: #C53030; }
.tag-condition { background: #FEF3C7; color: #92400E; }
.tag-role-editor { background: #DEF7EC; color: #03543F; }
.tag-role-reader { background: #E1EFFE; color: #1E429F; }

.hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Botones y Elementos Interactivos
   ========================================================================== */

button {
  font-family: inherit;
  outline: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px; /* Tamaño táctil accesible */
  text-decoration: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  min-height: 36px;
  border-radius: var(--radius-sm);
}

.btn-primary-green {
  background: var(--btn-green);
  color: #FFFFFF;
  box-shadow: 0 3px 8px rgba(46, 139, 87, 0.25);
}

.btn-primary-green:hover {
  background: var(--btn-green-hover);
  box-shadow: 0 4px 12px rgba(46, 139, 87, 0.35);
  transform: translateY(-1px);
}

.btn-mint {
  background: var(--primary-mint);
  color: #FFFFFF;
  box-shadow: 0 3px 8px rgba(42, 157, 143, 0.25);
}

.btn-mint:hover {
  background: var(--primary-mint-dark);
  transform: translateY(-1px);
}

.btn-outline-mint {
  background: transparent;
  color: var(--primary-mint-dark);
  border: 1.5px solid var(--primary-mint);
}

.btn-outline-mint:hover {
  background: var(--primary-mint-light);
}

.btn-outline-gray {
  background: var(--bg-card);
  color: var(--text-medium);
  border: 1px solid var(--border-light);
}

.btn-outline-gray:hover {
  background: var(--bg-card-subtle);
  color: var(--text-dark);
}

.btn-icon-round {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   Navegación por Pestañas (Mobile & Desktop)
   ========================================================================== */

.main-tabs-nav {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 6px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  gap: 6px;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-medium);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--bg-card-subtle);
  color: var(--text-dark);
}

.tab-btn.active {
  background: var(--primary-mint);
  color: #FFFFFF;
  box-shadow: 0 4px 10px rgba(42, 157, 143, 0.25);
}

/* Barra Flotante Inferior en Móviles */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
  z-index: 99;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
}

@media (max-width: 767px) {
  .main-tabs-nav {
    display: none;
  }
  .mobile-bottom-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
  .mobile-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
  }
  .mobile-tab-item .tab-icon {
    font-size: 20px;
  }
  .mobile-tab-item.active {
    color: var(--primary-mint-dark);
    background: var(--primary-mint-light);
  }
}

/* ==========================================================================
   Contenido Principal y Vistas de Pestañas
   ========================================================================== */

.tab-content-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.tab-content-panel.active {
  display: flex;
  animation: fadeIn 0.2s ease-in-out;
}

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

.section-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px;
}

.section-title-group h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title-group p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   Módulo 3: Citas Médicas (Acordeones, Voz, Cámara, Calendario)
   ========================================================================== */

.appointments-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.appointment-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(42, 157, 143, 0.3);
}

.appointment-card.private-entry {
  border-left: 4px solid var(--accent-coral);
}

.accordion-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  background: var(--bg-card);
  user-select: none;
  gap: 10px;
}

.accordion-header:hover {
  background: #FAFDFD;
}

.acc-date-badge {
  background: #E6F7F5;
  color: var(--primary-mint-dark);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  text-align: center;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  border: 1px solid rgba(42, 157, 143, 0.2);
}

.acc-date-day {
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
}

.acc-date-hour {
  font-size: 11px;
  color: #0F766E;
  margin-top: 2px;
  font-weight: 600;
}

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

.acc-doctor-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  word-break: break-word;
}

.acc-specialty-sub {
  font-size: 12px;
  color: var(--primary-mint-dark);
  font-weight: 600;
  line-height: 1.25;
}

.acc-clinic-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-right-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.acc-files-badge {
  font-size: 11.5px;
  font-weight: 700;
  background: var(--primary-mint-light);
  color: var(--primary-mint-dark);
  padding: 3px 7px;
  border-radius: 12px;
  border: 1px solid rgba(42, 157, 143, 0.2);
}

.acc-edit-btn {
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
}

.private-pill {
  background: #FEE2E2;
  color: #991B1B;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.accordion-chevron {
  font-size: 16px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  margin-left: 2px;
}
  font-size: 18px;
  color: var(--text-light);
  transition: transform 0.25s ease;
}

.appointment-card.open .accordion-chevron {
  transform: rotate(180deg);
  color: var(--primary-mint);
}

.accordion-body {
  padding: 0 16px 18px 16px;
  border-top: 1px solid var(--border-light);
  background: #FBFDFD;
  display: none;
  box-sizing: border-box;
  width: 100%;
}

.appointment-card.open .accordion-body {
  display: block;
}

.appointment-details-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
  width: 100%;
  box-sizing: border-box;
}

.detail-block {
  background: var(--bg-card);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

.detail-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-value {
  font-size: 14px;
  color: var(--text-dark);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.detail-block-full {
  width: 100%;
}

/* Documentos Adjuntos y Recetas */
.prescription-doc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F0FDF4;
  border: 1px dashed #86EFAC;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 12px;
}

.doc-info-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-icon {
  font-size: 28px;
  color: #16A34A;
}

.appointment-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #EEF2F6;
}

/* ==========================================================================
   Módulo 4: Bitácora de Cuidados y Turnos
   ========================================================================== */

.shift-header-custom {
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  gap: 12px;
  flex-wrap: wrap;
}

.shift-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shift-title-area h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-dark);
}

.edit-title-btn {
  background: none;
  border: none;
  color: var(--primary-mint-dark);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.edit-title-btn:hover {
  background: var(--primary-mint-light);
}

/* Barra de Búsqueda con Lupa para Cuidados */
.shift-search-box {
  position: relative;
  min-width: 240px;
  flex: 1;
  max-width: 380px;
}

.shift-search-box input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-light);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: #F8FAFC;
}

.shift-search-box input:focus {
  border-color: var(--primary-mint);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.15);
}

.shift-search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

/* Lista de Turnos Secuenciales */
.shifts-timeline {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.shift-entry-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shift-entry-card:hover {
  box-shadow: var(--shadow-md);
}

.shift-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.shift-author-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-dark);
}

.shift-author-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: #E0E7FF;
  color: #4338CA;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
}

.shift-time-stamp {
  font-size: 13px;
  color: var(--text-muted);
  background: #F1F5F9;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.shift-content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .shift-content-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.shift-meds-box {
  background: #F0FDF4;
  border-left: 3px solid #22C55E;
  padding: 10px 14px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 14px;
}

.shift-notes-box {
  background: #FEF3C7;
  border-left: 3px solid #F59E0B;
  padding: 10px 14px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 14px;
}

.shift-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #F1F5F9;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   Apartado Desplegable: Archivos y Expediente de Estudios en Bitácora
   ========================================================================== */

.shift-files-hub {
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s ease;
}

.shift-files-hub.highlighted {
  border-color: #3B82F6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.shift-files-hub-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
  cursor: pointer;
  user-select: none;
}

.shift-files-hub-header:hover {
  background: #F1F5F9;
}

.shift-files-hub-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shift-files-hub-title strong {
  font-size: 14.5px;
  color: var(--text-dark);
}

.shift-files-count-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: #1D4ED8;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 6px;
}

.shift-files-hub-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.shift-files-hub.open .shift-files-hub-arrow {
  transform: rotate(180deg);
}

.shift-files-hub-content {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  background: #FFFFFF;
  animation: fadeInDown 0.2s ease-out;
}

.shift-files-grid-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .shift-files-grid-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.shift-hub-file-card {
  background: #F8FAFC;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all 0.15s ease;
}

.shift-hub-file-card:hover {
  border-color: #94A3B8;
  background: #F1F5F9;
}

.shift-hub-file-card.matched {
  background: #EFF6FF;
  border-color: #93C5FD;
}

/* Resaltador de búsqueda en texto (Highlights) */
.search-highlight {
  background: #FEF08A;
  color: #854D0E;
  font-weight: 800;
  padding: 0 3px;
  border-radius: 3px;
}

/* ==========================================================================
   Módulo 5: Cartilla de Vacunación Interactiva (México y Adultos)
   ========================================================================== */

.vaccine-actions-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vaccines-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .vaccines-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.vaccine-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

@media (max-width: 480px) {
  .vaccine-card {
    padding: 12px;
    border-radius: var(--radius-md);
  }
}

.vaccine-card:hover {
  border-color: var(--primary-mint);
}

.vaccine-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.vaccine-badge-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.vax-icon-pill {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--primary-mint-light);
  color: var(--primary-mint-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.vax-info {
  min-width: 0;
}

.vax-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vax-target {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vax-chevron {
  font-size: 13px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #F1F5F9;
  flex-shrink: 0;
}

.vaccine-card.open .vax-chevron {
  transform: rotate(180deg);
  background: var(--primary-mint-light);
  color: var(--primary-mint-dark);
}

.vaccine-card-body {
  display: none;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
  animation: fadeInDown 0.2s ease-out;
}

.vaccine-card.open .vaccine-card-body {
  display: flex;
}

.doses-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Tarjeta individual de dosis para celulares y tablets (Mobile-First) */
.dose-row {
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  overflow: hidden;
}

.dose-row:hover {
  border-color: #CBD5E1;
}

.dose-row.applied {
  background: #F0FDF4;
  border-color: #86EFAC;
}

/* Línea 1 en Móvil: Estado (Aplicada/Pendiente) y Fecha destacada */
.dose-row-line-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

/* Línea 2 en Móvil: Nombre / Número de dosis o sugerencia de edad */
.dose-row-line-mid {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  word-break: break-word;
}

.dose-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Línea 3 en Móvil: Botón de eliminar alineado a la derecha */
.dose-row-line-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding-top: 4px;
  border-top: 1px dashed #E2E8F0;
}

.dose-row.applied .dose-row-line-bottom {
  border-top-color: #BBF7D0;
}

/* Disposición horizontal en pantallas grandes (Desktop >= 680px) */
@media (min-width: 680px) {
  .dose-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    gap: 12px;
  }

  .dose-row-line-top {
    width: auto;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .dose-row-line-mid {
    flex: 1;
    min-width: 0;
  }

  .dose-row-line-bottom {
    width: auto;
    padding-top: 0;
    border-top: none;
  }
}

/* Selector Híbrido de Fechas: Teclado Numérico Directo + Calendario */
.hybrid-date-picker {
  display: inline-flex;
  align-items: center;
  position: relative;
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0 4px 0 8px;
  transition: all 0.2s ease;
  height: 32px;
  max-width: 100%;
  box-sizing: border-box;
}

.hybrid-date-picker:focus-within {
  border-color: var(--primary-mint);
  box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.15);
}

.hybrid-date-text {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  font-size: 13px !important;
  color: var(--text-dark) !important;
  padding: 2px 0 !important;
  width: 95px !important;
  min-width: 0 !important;
  font-family: inherit !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

.form-hybrid-date {
  width: 100%;
  height: 44px;
  border-radius: var(--radius-md);
  padding: 2px 8px 2px 14px;
}

.form-hybrid-date .hybrid-date-text {
  width: 100% !important;
  font-size: 15px !important;
  padding: 8px 0 !important;
}

.hybrid-date-calendar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 3px 5px;
  font-size: 15px;
  position: relative;
  user-select: none;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  color: var(--primary-mint-dark);
}

.hybrid-date-calendar-btn:hover {
  background: var(--primary-mint-light);
}

.hybrid-date-native {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
}

.btn-delete-dose {
  background: #FEE2E2;
  border: 1px solid #FECACA;
  color: #DC2626;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
  height: 28px;
  min-width: 28px;
}

.btn-delete-dose:hover {
  background: #FCA5A5;
  color: #991B1B;
  transform: scale(1.05);
}

.dose-status-btn {
  padding: 5px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dose-status-btn.applied {
  background: #2E8B57;
  color: #fff;
}

.dose-status-btn.pending {
  background: #E2E8F0;
  color: var(--text-medium);
}

.dose-status-btn.pending:hover {
  background: #CBD5E1;
}

/* ==========================================================================
   Sección: Vacunas Especiales e Inmunoterapia (Alergias)
   ========================================================================== */

.immunotherapy-wrapper {
  margin-top: 24px;
}

.immunotherapy-banner-inactive {
  background: #F0FDF4;
  border: 2px dashed #86EFAC;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.immunotherapy-banner-inactive .banner-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 260px;
}

.immunotherapy-banner-inactive h4 {
  font-size: 16px;
  font-weight: 700;
  color: #166534;
  margin-bottom: 2px;
}

.immunotherapy-banner-inactive p {
  font-size: 13px;
  color: #15803D;
  margin: 0;
}

.immunotherapy-card {
  background: #FFFFFF;
  border: 1.5px solid #86EFAC;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s ease;
}

.immunotherapy-header {
  background: #F0FDF4;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  flex-wrap: wrap;
}

.immunotherapy-card.open .immunotherapy-header {
  border-bottom: 1px solid #BBF7D0;
}

.immunotherapy-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 240px;
}

.immunotherapy-header-title h4 {
  font-size: 16px;
  font-weight: 700;
  color: #14532D;
  margin: 0 0 2px 0;
}

.immunotherapy-card.open .vax-chevron {
  transform: rotate(180deg);
  background: #DCFCE7;
  color: #166534;
}

.immunotherapy-body {
  display: none;
  padding: 20px;
  flex-direction: column;
  gap: 20px;
  animation: fadeInDown 0.2s ease-out;
}

.immunotherapy-card.open .immunotherapy-body {
  display: flex;
}

.im-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 640px) {
  .im-form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.im-section-box {
  background: #F8FAFC;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.im-section-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.im-section-box-header h5 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.im-doses-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.im-dose-row {
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  overflow: hidden;
}

.im-dose-row.applied {
  background: #F0FDF4;
  border-color: #86EFAC;
}

.im-dose-line-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.im-dose-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.im-input-sm {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #fff;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.im-input-sm:focus {
  border-color: var(--primary-mint);
  box-shadow: 0 0 0 2px rgba(42, 157, 143, 0.12);
}

.im-dose-line-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding-top: 4px;
  border-top: 1px dashed #E2E8F0;
}

.im-dose-row.applied .im-dose-line-bottom {
  border-top-color: #BBF7D0;
}

@media (min-width: 680px) {
  .im-dose-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    gap: 12px;
  }

  .im-dose-line-top {
    width: auto;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .im-dose-fields {
    flex-direction: row;
    flex: 1;
    min-width: 0;
  }

  .im-dose-fields .im-input-sm {
    flex: 1;
  }

  .im-dose-line-bottom {
    width: auto;
    padding-top: 0;
    border-top: none;
  }
}

.im-attachments-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.im-att-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
}

.im-att-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.im-att-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
}

.im-att-pdf-icon {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #FEE2E2;
  color: #DC2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
}

/* ==========================================================================
   Módulo 6: Bitácora de Síntomas y Malestares Diarios
   ========================================================================== */

.symptoms-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.symptom-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.symptom-card.private-entry {
  border-left: 4px solid var(--accent-coral);
}

.symptom-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.symptom-name-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.symptom-intensity-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.intensity-leve { background: #FEF3C7; color: #B45309; }
.intensity-moderado { background: #FFEDD5; color: #C2410C; }
.intensity-fuerte { background: #FEE2E2; color: #B91C1C; }

/* ==========================================================================
   Modales y Formularios Accesibles
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  max-height: calc(100dvh - 32px);
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.modal-card form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FDFEFE;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.modal-close-btn:hover {
  background: #F1F5F9;
  color: var(--text-dark);
}

.modal-body {
  padding: 20px 22px 28px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* Scrollbar sutil para el modal */
.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: #F8FAFC;
}
.modal-body::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.modal-footer {
  padding: 14px 22px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-light);
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.03);
  z-index: 10;
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 8px;
  }
  .modal-card {
    max-height: 94vh;
    max-height: calc(100dvh - 16px);
  }
  .modal-body {
    padding: 16px 16px 28px 16px;
  }
  .modal-footer {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
}

/* Campos de Formulario */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  font-family: inherit;
  font-size: 15px;
  color: var(--text-dark);
  background: #FFFFFF;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-group textarea,
textarea.auto-expand {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-dark);
  background: #FFFFFF;
  outline: none;
  resize: none;
  min-height: 96px; /* 3 a 4 renglones visibles cómodamente */
  max-height: 380px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow-x: hidden;
  overflow-y: auto;
  transition: border-color 0.2s, box-shadow 0.2s, height 0.1s ease-out;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
textarea.auto-expand:focus {
  border-color: var(--primary-mint);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.15);
  background: #FFFFFF;
}

/* Scrollbar suave y elegante para cuadros de texto largos */
textarea::-webkit-scrollbar {
  width: 6px;
}
textarea::-webkit-scrollbar-track {
  background: #F8FAFC;
  border-radius: 4px;
}
textarea::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
textarea::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Casilla de Verificación Especial para Privacidad */
.checkbox-card-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: #FFFBEB;
  border: 1.5px solid #FDE68A;
  cursor: pointer;
  user-select: none;
}

.checkbox-card-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-coral);
  cursor: pointer;
}

.checkbox-text h5 {
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
}

.checkbox-text p {
  font-size: 12px;
  color: #78350F;
}

/* Área de Dictado de Voz y Grabación */
.voice-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.voice-btn-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-dictate {
  background: #FEF2F2;
  color: #DC2626;
  border: 1.5px solid #FECACA;
}

.btn-dictate:hover {
  background: #FEE2E2;
}

.btn-dictate.recording {
  background: #DC2626;
  color: #FFFFFF;
  animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Visor de Cámara, Carga de Archivos y Documentos */
.attachment-upload-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}

@media (max-width: 480px) {
  .attachment-upload-buttons {
    grid-template-columns: 1fr;
  }
}

.btn-attachment-camera {
  background: var(--primary-mint-light);
  border: 1.5px dashed var(--primary-mint);
  color: var(--primary-mint-dark);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-attachment-camera:hover {
  background: #DEF3F0;
  border-color: var(--primary-mint-dark);
  transform: translateY(-1px);
}

.btn-attachment-file {
  background: #F1F5F9;
  border: 1.5px dashed #94A3B8;
  color: var(--text-dark);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-attachment-file:hover {
  background: #E2E8F0;
  border-color: var(--text-medium);
  transform: translateY(-1px);
}

.attachment-preview-box {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.2s ease-out;
}

.attachment-preview-item {
  background: #F8FAFC;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s ease;
}

.attachment-preview-item:hover {
  border-color: var(--primary-mint);
}

.preview-thumb-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.preview-img-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1.5px solid var(--border-light);
  cursor: pointer;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.preview-img-thumb:hover {
  transform: scale(1.05);
}

.preview-pdf-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  background: #FEE2E2;
  color: #DC2626;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preview-file-details {
  flex: 1;
  min-width: 0;
}

.preview-file-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-file-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-remove-attachment {
  background: #FEE2E2;
  color: #DC2626;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-remove-attachment:hover {
  background: #FECACA;
}

/* Visor de Imágenes en Pantalla Completa con Zoom y Arrastre */
.image-viewer-card {
  background: rgba(15, 23, 42, 0.96);
  border-radius: var(--radius-lg);
  padding: 12px;
  width: 95vw;
  max-width: 900px;
  height: 90vh;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-float);
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.image-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.viewer-tool-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: none;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.viewer-tool-btn:hover, .viewer-tool-btn:active {
  background: rgba(255, 255, 255, 0.35);
}

.image-viewer-close-btn {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
  border: 1px solid rgba(239, 68, 68, 0.5);
  font-size: 16px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.image-viewer-close-btn:hover {
  background: rgba(239, 68, 68, 0.8);
}

.image-viewer-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  touch-action: none;
  cursor: grab;
}

.image-viewer-viewport:active {
  cursor: grabbing;
}

.image-viewer-viewport img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  user-select: none;
  pointer-events: none;
}

.image-viewer-caption {
  color: #E2E8F0;
  font-size: 13.5px;
  padding-top: 8px;
  text-align: center;
  font-weight: 600;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Tarjeta de Receta/Estudio dentro del acordeón de cita */
.appointment-attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F0FDF4;
  border: 1px dashed #86EFAC;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  gap: 12px;
  flex-wrap: wrap;
}

.appointment-attachment-card.pdf-theme {
  background: #FEF2F2;
  border-color: #FECACA;
}

/* Visor de PDF Integrado (Modal / Preview Viewer) */
.pdf-viewer-modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 95vw;
  max-width: 1000px;
  height: 92vh;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.pdf-viewer-header {
  padding: 14px 20px;
  background: #FFFFFF;
  border-bottom: 1.5px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.pdf-viewer-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.pdf-viewer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-viewer-frame-container {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #525659;
  position: relative;
}

.pdf-viewer-frame-container iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 600px) {
  .pdf-viewer-modal-card {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .pdf-viewer-header {
    padding: 10px 12px;
    gap: 8px;
  }

  .pdf-viewer-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* Notificación Flotante Toast */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text-dark);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.toast-notification.success {
  background: #166534;
}

.toast-notification.error {
  background: #991B1B;
}

/* ==========================================================================
   Resumen para el Doctor (Modal Especial)
   ========================================================================== */

.doctor-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 14px;
}

.doctor-summary-table th,
.doctor-summary-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.doctor-summary-table th {
  background: #F1F5F9;
  color: var(--text-dark);
  font-weight: 700;
}

.doctor-summary-table tr:hover {
  background: #F8FAFC;
}

/* ==========================================================================
   PWA - Banner y Botón de Instalación en Dispositivos Móviles
   ========================================================================== */

.btn-pwa-header {
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 5px 12px;
  font-size: 13px;
  background: var(--primary-mint-light);
  border-color: var(--primary-mint);
  color: var(--primary-mint-dark);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  animation: pulseLight 2.5s infinite ease-in-out;
}

@keyframes pulseLight {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.pwa-install-banner {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: #FFFFFF;
  border: 1.5px solid #86EFAC;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 1000;
  animation: slideUpBanner 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pwa-banner-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.pwa-banner-texts strong {
  font-size: 14px;
  color: var(--text-dark);
  display: block;
}

.pwa-banner-texts p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.25;
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .pwa-install-banner {
    bottom: 24px;
    right: 24px;
    left: auto;
  }
}

/* Impresión */
@media print {
  body {
    background: #fff;
  }
  .top-navbar, .main-tabs-nav, .mobile-bottom-bar, .hero-actions, .pwa-install-banner, button {
    display: none !important;
  }
  .app-wrapper {
    padding: 0;
    max-width: 100%;
  }
  .modal-backdrop.active {
    position: static;
    background: none;
    padding: 0;
  }
  .modal-card {
    max-width: 100%;
    box-shadow: none;
  }
}
