/* ═══════════════════════════════════════════════════════════════════════════
   GERIATRIS - Estilo Minimalista Blanco y Negro
   Desarrollado por: D'Agostini Sistemas
   ═══════════════════════════════════════════════════════════════════════════ */

/* Reset & Variables */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Palette Minimalista - Verde solo para logo y acentos importantes */
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-light: #34d399;
  --primary-container: #f0fdf4;
  --on-primary: #ffffff;
  --on-primary-container: #064e3b;

  /* Secundario Neutral (grises) */
  --secondary: #525252;
  --secondary-dark: #404040;
  --secondary-light: #737373;
  --secondary-container: #f5f5f5;
  --on-secondary: #ffffff;

  /* Gradientes minimalistas */
  --gradient-primary: linear-gradient(135deg, #171717, #262626);
  --gradient-primary-hover: linear-gradient(135deg, #262626, #404040);
  --gradient-subtle: linear-gradient(135deg, rgba(0,0,0,0.02), rgba(0,0,0,0.01));

  --surface: #fafafa;
  --surface-dim: #e5e5e5;
  --surface-bright: #ffffff;
  --surface-container: #f5f5f5;
  --surface-container-low: #fafafa;
  --surface-container-high: #e5e5e5;
  --surface-variant: #f5f5f5;

  --on-surface: #171717;
  --on-surface-variant: #525252;
  --outline: #737373;
  --outline-variant: #d4d4d4;

  /* Status Colors */
  --success: #16a34a;
  --success-container: #dcfce7;
  --warning: #d97706;
  --warning-container: #fef3c7;
  --error: #dc2626;
  --error-container: #fee2e2;
  --info: #2563eb;
  --info-container: #dbeafe;

  /* Shadows - más suaves */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --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-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.03);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

/* Elementos solo para administradores - ocultos por defecto */
.admin-only {
  display: none !important;
}

body.is-admin .admin-only {
  display: inline-flex !important;
}

body.is-enfermera .enfermeria-hide {
  display: none !important;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  line-height: 1.5;
  overflow-x: hidden;
  cursor: default;
}

/* Heredar cursor en todo */
*, *::before, *::after {
  cursor: inherit;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CURSORES PERSONALIZADOS GERIATRIS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Cursor pointer estándar para elementos clickeables */
a, button, [onclick], [role="button"], [tabindex],
.btn, .btn-primary, .btn-secondary, .btn-icon, .btn-sm, .btn-danger, .btn-success, .btn-warning,
.nav-item, .patient-item, .card, .clickable,
input[type="submit"], input[type="button"], input[type="checkbox"], input[type="radio"],
select, option, .dropdown, .modal-close, .chip, label[for],
.sidebar-toggle, .notification-btn, .user-menu, .user-menu-container,
.tab, .table-actions button, .action-btn, .icon-btn,
.patient-avatar, .tipo-atencion-btn, .accion-principal-btn,
.facturacion-tipo-btn, .btn-volver-facturacion,
.ficha-tab, .indicator, .toggle-password, .checkbox-wrapper,
.user-dropdown-item, .perfil-foto-edit, .modulo-check-item,
.stat-card, .quick-action, .notification-item, .notif-item,
.habitacion-card, .cama-card, .paciente-card, .medicamento-item,
.evolucion-item, .factura-item, .rol-item, .permiso-item,
.pagination button, .pagination a, .page-link, .page-item,
.dropdown-item, .dropdown-menu a, .list-group-item,
.accordion-header, .accordion-button, .collapse-toggle,
.close, .close-btn, [data-dismiss], [data-toggle], [data-bs-toggle],
.form-check-label, .custom-checkbox, .custom-radio,
.slider, .range, .switch, .toggle,
.breadcrumb a, .breadcrumb-item a, .link, .nav-link,
.card-header, .card-title, .card-clickable,
.list-item, .menu-item, .sidebar-item, .sidebar-link,
.tag, .badge-clickable, .filter-btn, .sort-btn,
.expand-btn, .collapse-btn, .more-btn, .options-btn,
.edit-btn, .delete-btn, .save-btn, .cancel-btn, .add-btn,
.upload-btn, .download-btn, .print-btn, .export-btn,
.prev-btn, .next-btn, .arrow-btn, .nav-arrow,
.thumbnail, .image-clickable, .gallery-item, .preview,
.row-clickable, tr[onclick], td[onclick], th[onclick],
.table-row-clickable, .grid-item-clickable,
[style*="cursor: pointer"], [style*="cursor:pointer"] {
  cursor: pointer !important;
}

/* Cursor estándar al hacer click */
a:active, button:active, [onclick]:active,
.btn:active, .btn-primary:active, .btn-secondary:active,
[role="button"]:active, .clickable:active {
  cursor: pointer !important;
}

/* Cursor texto para inputs */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="search"],
input[type="date"], input[type="time"], input[type="datetime-local"],
textarea, [contenteditable="true"] {
  cursor: text;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADER LATIDO CARDÍACO - GERIATRIS
   ═══════════════════════════════════════════════════════════════════════════ */
.geriatris-loader {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--primary);
}

.geriatris-loader i {
  font-size: 28px;
  animation: heartbeat-loader 1s ease-in-out infinite;
}

.geriatris-loader span {
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
}

@keyframes heartbeat-loader {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.25); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}

/* Overlay de carga con latido */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-overlay .heart-icon {
  font-size: 50px;
  color: var(--primary);
  animation: heartbeat-loader 1s ease-in-out infinite;
}

.loading-overlay .loading-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--on-surface-variant);
}

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */
#app {
  display: block;
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NAVIGATION RAIL - Estilo Moderno Elegante
   ═══════════════════════════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR - ALTO CONTRASTE CON NEÓN VERDE
   ═══════════════════════════════════════════════════════════════════════════ */
.nav-rail {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Línea superior removida - estilo minimalista */
.nav-rail::before {
  display: none;
}

/* Header con logo y brand */
.nav-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 6px;
  margin-bottom: 24px;
}

.nav-logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  flex-shrink: 0;
  position: relative;
  color: transparent;
  background: transparent;
  -webkit-text-stroke: 1.2px #1e40af;
  -webkit-text-fill-color: transparent;
  border: 2px solid #1e40af;
}

.nav-logo::before {
  display: none;
}

/* Animaciones de neón desactivadas */
@keyframes logoNeonPulse {
  0%, 100% { opacity: 1; }
}

@keyframes borderNeonPulse {
  0%, 100% { opacity: 1; }
}

.nav-brand {
  display: flex;
  flex-direction: column;
}

.nav-brand h2 {
  color: #0a0a0a;
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}

.nav-brand h2 span {
  color: #10b981;
}

.nav-brand p {
  color: #6b7280;
  font-size: 11px;
  margin: 0;
}

/* NEURAVANTA Brand en sidebar */
.neuravanta-brand {
  font-family: 'Exo 2', sans-serif !important;
  font-size: 18px !important;
  font-weight: 400 !important;
  display: flex;
  align-items: center;
  gap: 0;
  letter-spacing: 3px;
}
.nv-neura {
  font-weight: 700 !important;
  color: #1e293b !important;
}
.nv-vanta {
  font-weight: 300 !important;
  color: #1e40af !important;
}
.nv-nodes {
  font-size: 10px;
  color: #1e40af;
  margin-left: 5px;
  display: inline-block;
  animation: nvNodesRotate 6s linear infinite;
}
@keyframes nvNodesRotate {
  0% { transform: rotate(0deg); color: #1e40af; }
  25% { transform: rotate(90deg); color: #3b82f6; }
  50% { transform: rotate(180deg); color: #0d9488; }
  75% { transform: rotate(270deg); color: #3b82f6; }
  100% { transform: rotate(360deg); color: #1e40af; }
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 10px;
}

.nav-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  color: #1a1a1a;
  flex-shrink: 0;
  position: relative;
}

.nav-item .nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item i {
  font-size: 18px;
  color: #1f2937;
  transition: all 0.25s ease;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}

.nav-item span {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
}

.nav-item:hover {
  background: #f5f5f5;
}

.nav-item:hover i {
  color: #171717;
}

.nav-item:hover span {
  color: #171717;
}

/* Indicador simple al seleccionar */
.nav-item.active {
  background: #f5f5f5;
  border-left: 3px solid #10b981;
}

/* Punto indicador removido - estilo minimalista */
.nav-item.active::after {
  display: none;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
}

.nav-item.active i {
  color: #10b981;
}

.nav-item.active span {
  color: #171717;
  font-weight: 600;
}

/* Items sin permiso - mostrar con candado */
.nav-item.sin-permiso {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
  position: relative;
}

.nav-item.sin-permiso::after {
  content: '\f023'; /* Candado Font Awesome */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
  margin-left: auto;
  color: #94a3b8;
}

.nav-item.sin-permiso:hover {
  background: transparent;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.nav-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #d1d5db, transparent);
  margin: 12px 8px;
}

.nav-bottom {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  margin-top: 0;
  flex-shrink: 0;
}

/* User section at bottom - Con foto de perfil */
.nav-user-section {
  margin-top: auto;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #e5e5e5;
}

.nav-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Placeholder cuando no hay foto */
.nav-user-avatar i {
  font-size: 20px;
  color: #9ca3af;
}

.nav-user-info {
  flex: 1;
}

.nav-user-name {
  color: #111827;
  font-weight: 600;
  font-size: 14px;
}

.nav-user-role {
  color: #10b981;
  font-size: 12px;
}

.nav-logout-btn {
  color: #9ca3af;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-logout-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */
.main-content {
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: calc(100vw - 260px);
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════════════════════════════════════ */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-variant);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  flex-wrap: wrap;
}

.top-bar-left {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.top-bar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--on-surface);
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  flex: 1;
  max-width: 350px;
  min-width: 180px;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  background: #ffffff;
  border-color: #a3a3a3;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.search-icon {
  color: var(--on-surface-variant);
}

.search-box input {
  border: none;
  background: transparent;
  font-size: 14px;
  width: 100%;
  outline: none;
  color: var(--on-surface);
}

.search-box input::placeholder {
  color: var(--outline);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BÚSQUEDA GLOBAL - Dropdown de Resultados
   ═══════════════════════════════════════════════════════════════════════════ */
.search-container {
  position: relative;
  flex: 1;
  max-width: 400px;
  min-width: 200px;
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid #e5e5e5;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.search-results-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.search-results-dropdown:empty {
  display: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid #f1f5f9;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: #f8fafc;
}

.search-result-item:first-child {
  border-radius: 16px 16px 0 0;
}

.search-result-item:last-child {
  border-radius: 0 0 16px 16px;
}

.search-result-item:only-child {
  border-radius: 16px;
}

.search-result-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  flex-shrink: 0;
  position: relative;
}

.search-result-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

/* Punto verde de conectado */
.search-result-icon .online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-title .highlight {
  background: #fef3c7;
  padding: 1px 3px;
  border-radius: 3px;
  color: #171717;
}

.search-result-subtitle {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-extra {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.search-result-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.search-result-badge.paciente {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.search-result-badge.profesional {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

.search-result-badge.usuario {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.search-result-badge.medicamento {
  background: rgba(236, 72, 153, 0.1);
  color: #db2777;
}

.search-result-badge.habitacion {
  background: rgba(20, 184, 166, 0.1);
  color: #0d9488;
}

/* Stock badges */
.stock-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.stock-badge.sin_stock {
  background: #fee2e2;
  color: #dc2626;
}

.stock-badge.bajo {
  background: #fef3c7;
  color: #d97706;
}

.stock-badge.normal {
  background: #d1fae5;
  color: #059669;
}

.stock-badge.alto {
  background: #dbeafe;
  color: #2563eb;
}

.search-no-results {
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
}

.search-no-results i {
  font-size: 32px;
  margin-bottom: 10px;
  display: block;
  opacity: 0.5;
}

.search-loading {
  padding: 20px;
  text-align: center;
  color: #10b981;
}

.search-loading i {
  animation: spin 1s linear infinite;
}

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

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--on-surface-variant);
  transition: var(--transition-fast);
  position: relative;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--surface-container);
}

.notif-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--error);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.user-menu:hover {
  background: var(--surface-container);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface);
}

.user-menu-arrow {
  font-size: 10px;
  color: var(--on-surface-variant);
  transition: transform 0.2s ease;
}

.user-menu-container {
  position: relative;
}

.user-menu-container.open .user-menu-arrow {
  transform: rotate(180deg);
}

/* Dropdown del usuario */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  border: 1px solid var(--outline-variant);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  overflow: hidden;
}

.user-menu-container.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  color: var(--on-surface);
  font-size: 14px;
}

.user-dropdown-item:hover {
  background: var(--surface-container);
}

.user-dropdown-item i {
  width: 18px;
  text-align: center;
  color: var(--on-surface-variant);
}

.user-dropdown-item.logout {
  color: var(--error);
}

.user-dropdown-item.logout i {
  color: var(--error);
}

.user-dropdown-item.logout:hover {
  background: rgba(185, 28, 28, 0.1);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--outline-variant);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL MI PERFIL
   ═══════════════════════════════════════════════════════════════════════════ */

.perfil-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.perfil-foto-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.perfil-foto-wrapper {
  position: relative;
}

.perfil-foto {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #1e40af));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: white;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.perfil-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.perfil-foto-edit {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.perfil-foto-edit:hover {
  background: var(--primary-dark, #1e40af);
  transform: scale(1.1);
}

.perfil-foto-hint {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin: 0;
}

.perfil-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
  background: var(--surface-container);
  border-radius: var(--radius-lg);
}

.perfil-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.perfil-info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.perfil-info-item label {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.perfil-info-item span {
  font-size: 15px;
  font-weight: 500;
  color: var(--on-surface);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */
.section {
  display: none;
  padding: 16px 20px;
  flex: 1;
  overflow-x: hidden;
}

.section.active {
  display: block;
}

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

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--on-surface);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATS CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border: 1px solid rgba(16,185,129,0.15);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

/* Linea degradada superior elegante */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-primary);
}

.stat-card:hover {
  box-shadow: 0 8px 25px rgba(16,185,129,0.15);
  transform: translateY(-3px);
}

.stat-card.filled {
  background: var(--gradient-primary);
  border: none;
  color: var(--on-primary);
}

.stat-card.filled::before {
  display: none;
}

.stat-card.tonal {
  background: var(--primary-container);
  border: none;
}

.stat-card.warning {
  background: var(--warning-container);
  border: none;
}

.stat-card.warning::before {
  background: linear-gradient(90deg, #f97316, #f59e0b);
}

.stat-icon {
  width: 45px;
  height: 45px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.stat-card.filled .stat-icon {
  background: rgba(255,255,255,0.2);
  color: white;
  box-shadow: none;
}

.stat-card:not(.filled) .stat-icon {
  background: var(--gradient-primary);
  color: white;
}

.stat-card.warning .stat-icon {
  background: linear-gradient(135deg, #f97316, #f59e0b);
  color: white;
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card.filled .stat-value {
  background: none;
  -webkit-text-fill-color: white;
  color: white;
}

.stat-label {
  font-size: 11px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD GRID
   ═══════════════════════════════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card.full-width {
  grid-column: 1 / -1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--outline-variant);
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.card-header a {
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-fast);
}

.card-header a:hover {
  color: var(--primary-dark);
}

.card-body {
  padding: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PIPELINE DE ADMISIONES EN PROCESO
   ═══════════════════════════════════════════════════════════════════════════ */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.pipeline-stage {
  text-align: center;
  padding: 16px 8px;
  background: var(--surface-container);
  border-radius: 12px;
  border: 1px solid var(--outline-variant);
}

.pipeline-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 6px;
}

.pipeline-label {
  font-size: 11px;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.pipeline-label i {
  font-size: 12px;
  color: var(--primary);
}

/* Pipeline responsive - Mobile */
@media (max-width: 768px) {
  .pipeline-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .pipeline-stage {
    padding: 12px 6px;
  }

  .pipeline-count {
    font-size: 22px;
  }

  .pipeline-label {
    font-size: 10px;
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 400px) {
  .pipeline-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .pipeline-stage {
    padding: 10px 4px;
  }

  .pipeline-count {
    font-size: 20px;
  }

  .pipeline-label {
    font-size: 9px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PATIENT LIST
   ═══════════════════════════════════════════════════════════════════════════ */
.patient-list {
  display: flex;
  flex-direction: column;
}

.patient-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.patient-item:hover {
  background: var(--surface-container);
}

.patient-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--primary-container);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.patient-info {
  flex: 1;
}

.patient-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 2px;
}

.patient-info span {
  font-size: 12px;
  color: var(--on-surface-variant);
}

.chip {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chip.pami {
  background: #e3f2fd;
  color: #1565c0;
}

.chip.particular {
  background: #e8f5e9;
  color: #2e7d32;
}

.chip.especial {
  background: #fff3e0;
  color: #e65100;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS LIST
   ═══════════════════════════════════════════════════════════════════════════ */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
}

.alert-item.critical {
  background: var(--error-container);
}

.alert-item.warning {
  background: var(--warning-container);
}

.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.alert-item.critical .alert-icon {
  background: var(--error);
  color: white;
}

.alert-item.warning .alert-icon {
  background: var(--warning);
  color: white;
}

.alert-text h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
}

.alert-text span {
  font-size: 12px;
  color: var(--on-surface-variant);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS - Estilo Moderno Elegante
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--gradient-primary);
  color: var(--on-primary);
  border: none;
  border-radius: 25px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--gradient-primary-hover);
  box-shadow: 0 0 20px rgba(16,185,129,0.3);
  transform: translateY(-2px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: white;
  color: var(--primary);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 25px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: rgba(16,185,129,0.05);
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(16,185,129,0.15);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-subtle);
  border: 1px solid rgba(16,185,129,0.2);
  color: var(--primary);
  transition: all 0.3s ease;
}

.btn-icon:hover {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

/* Botones mini para tablas */
.btn-mini {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-mini.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-mini.success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-mini.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.btn-mini.danger:hover {
  background: #ef4444;
  color: white;
}

.btn-mini i {
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DATA TABLE
   ═══════════════════════════════════════════════════════════════════════════ */
.data-table-container {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.data-table thead {
  background: var(--surface-container);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--on-surface);
  border-bottom: 1px solid var(--outline-variant);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-container-low);
}

.table-actions {
  display: flex;
  gap: 8px;
}

/* Botones con etiqueta para tabla pacientes */
.table-actions-labeled {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  justify-content: center;
}

.btn-action-labeled {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 5px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  min-width: 38px;
}

.btn-action-labeled span {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #94a3b8;
  line-height: 1;
}

.btn-action-labeled:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #1e293b;
  transform: translateY(-1px);
}

.btn-action-labeled:hover span {
  color: #475569;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER TABS
   ═══════════════════════════════════════════════════════════════════════════ */
.filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.filter-tab:hover {
  background: var(--surface-container);
}

.filter-tab.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION TABS
   ═══════════════════════════════════════════════════════════════════════════ */
.section-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-container);
  padding: 3px;
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.section-tab {
  padding: 8px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.section-tab:hover {
  color: var(--on-surface);
}

.section-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ADMISSION BOARD (Kanban)
   ═══════════════════════════════════════════════════════════════════════════ */
.admission-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.admission-column {
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

.column-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.column-header.stage-1 { background: var(--info-container); }
.column-header.stage-2 { background: var(--warning-container); }
.column-header.stage-3 { background: var(--primary-container); }
.column-header.stage-4 { background: var(--success-container); }

.stage-number {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.column-header.stage-1 .stage-number { color: var(--info); }
.column-header.stage-2 .stage-number { color: var(--warning); }
.column-header.stage-3 .stage-number { color: var(--primary); }
.column-header.stage-4 .stage-number { color: var(--success); }

.column-header h4 {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.column-count {
  background: white;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.column-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admission-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.admission-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.admission-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.admission-card-header h5 {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.admission-card-body {
  font-size: 12px;
  color: var(--on-surface-variant);
}

.admission-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--outline-variant);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ROOMS GRID
   ═══════════════════════════════════════════════════════════════════════════ */
.map-legend {
  display: flex;
  gap: 24px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--on-surface-variant);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
}

.dot.available { background: var(--success); }
.dot.occupied { background: var(--primary); }
.dot.maintenance { background: var(--warning); }

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.room-card {
  background: var(--surface);
  border: 2px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.room-card.available {
  border-color: var(--success);
}

.room-card.occupied {
  border-color: var(--primary);
  background: var(--primary-container);
}

.room-card.maintenance {
  border-color: var(--warning);
  background: var(--warning-container);
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.room-number {
  font-size: 20px;
  font-weight: 700;
  color: var(--on-surface);
}

.room-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.room-card.available .room-status {
  background: var(--success);
  color: white;
}

.room-card.occupied .room-status {
  background: var(--primary);
  color: white;
}

.room-card.maintenance .room-status {
  background: var(--warning);
  color: white;
}

.room-beds {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--on-surface-variant);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAPA DE HABITACIONES - PLANO DE EDIFICIO
   ═══════════════════════════════════════════════════════════════════════════ */

/* Header del mapa */
.mapa-header-left h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.mapa-header-left h2 i {
  color: var(--primary);
}

.mapa-subtitle {
  margin: 4px 0 0 0;
  font-size: 14px;
  color: var(--on-surface-variant);
}

.mapa-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Selector de piso */
.floor-selector {
  display: flex;
  gap: 8px;
  background: var(--surface-container);
  padding: 6px;
  border-radius: 12px;
}

.floor-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all 0.2s ease;
}

.floor-btn:hover {
  background: var(--surface);
  color: var(--on-surface);
}

.floor-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Barra de leyenda */
.mapa-legend-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  background: var(--surface-container);
  border-radius: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mapa-legend-bar .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--on-surface-variant);
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.legend-dot.disponible {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.legend-dot.ocupada {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.legend-dot.reservada {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.legend-dot.mantenimiento {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.legend-stats {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.stat-badge.disponibles {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.stat-badge.ocupadas {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

/* Contenedor del plano */
.floor-plan-container {
  position: relative;
  display: flex;
  gap: 20px;
}

.floor-plan {
  flex: 1;
  background: #f1f5f9;
  border-radius: 16px;
  padding: 16px;
  border: 2px solid var(--outline-variant);
  overflow: visible;
}

/* Estructura del edificio */
.building-outline {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: auto 1fr auto auto;
  gap: 20px;
  min-height: 550px;
}

/* Pasillos */
.hallway {
  background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9);
  border: 2px dashed var(--outline-variant);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hallway-horizontal {
  grid-column: 1 / -1;
  height: 50px;
}

.main-hall {
  grid-row: 1;
}

.bottom-hall {
  grid-row: 4;
}

.hallway-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Alas del edificio */
.wing {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 15px;
  background: var(--surface-container);
  border-radius: 12px;
  border: 2px solid var(--outline-variant);
  grid-row: 2;
}

.wing-left {
  grid-column: 1;
}

.wing-right {
  grid-column: 3;
}

.wing-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--outline-variant);
}

/* Filas de habitaciones */
.room-row {
  display: flex;
  gap: 12px;
}

/* Habitación individual */
.room.habitacion {
  flex: 1;
  background: var(--surface);
  border: 2px solid var(--outline-variant);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  min-width: 140px;
  position: relative;
}

.room.habitacion:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.room.habitacion[data-status="disponible"] {
  border-color: #22c55e;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(22, 163, 74, 0.03));
}

.room.habitacion[data-status="ocupada"] {
  border-color: #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.03));
}

.room.habitacion[data-status="reservada"] {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(217, 119, 6, 0.03));
}

.room.habitacion[data-status="mantenimiento"] {
  border-color: #ef4444;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(220, 38, 38, 0.03));
}

.room.habitacion:hover[data-status="disponible"] {
  border-color: #16a34a;
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.2);
}

.room.habitacion:hover[data-status="ocupada"] {
  border-color: #2563eb;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
}

/* Cabecera de habitación */
.room.habitacion .room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--outline-variant);
}

.room.habitacion .room-number {
  font-size: 18px;
  font-weight: 800;
  color: var(--on-surface);
}

.room.habitacion .room-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface-container);
  color: var(--on-surface-variant);
}

/* Camas dentro de la habitación */
.room.habitacion .room-beds {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.room.habitacion .room-beds.triple {
  flex-wrap: wrap;
}

.room.habitacion .bed {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 6px;
  border-radius: 8px;
  flex: 1;
  min-width: 70px;
  max-width: 120px;
  transition: all 0.2s ease;
  position: relative;
  cursor: pointer;
}

.room.habitacion .bed:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Header de la cama con el identificador */
.bed-header {
  display: flex;
  justify-content: center;
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.bed-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Contenido de la cama */
.bed-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.bed-content.disponible,
.bed-content.mantenimiento {
  padding: 8px 0;
}

.bed-content.disponible i,
.bed-content.mantenimiento i {
  font-size: 16px;
  opacity: 0.8;
}

.bed-content.disponible span,
.bed-content.mantenimiento span {
  font-size: 9px;
  font-weight: 500;
}

/* Avatar del paciente en la cama */
.bed-patient-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Placeholder cuando no hay foto */
.bed-patient-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.bed-patient-placeholder i {
  font-size: 14px;
  opacity: 0.6;
}

/* Nombre del paciente */
.bed-patient-name {
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Colores heredados del estado de la cama */
.bed.ocupada .bed-patient-placeholder {
  background: rgba(59, 130, 246, 0.2);
}

.bed.ocupada .bed-patient-placeholder i {
  color: #2563eb;
}

/* Estados de camas */
.bed.disponible {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.bed.ocupada {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.bed.reservada {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.bed.mantenimiento {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Info de paciente en habitación */
.room-patient {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--on-surface-variant);
}

.patient-mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ocupacion-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.ocupacion-badge.full {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

/* Estado de habitación */
.room-status-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
}

.room-status-label.disponible {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.room-status-label.reservada {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.room-status-label.mantenimiento {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.room-status-label.ocupacion {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

/* Amenidades de habitación */
.room-amenities {
  display: flex;
  gap: 8px;
  font-size: 14px;
  color: var(--on-surface-variant);
}

.room-amenities i {
  padding: 4px;
  border-radius: 4px;
  background: var(--surface-container);
}

/* Áreas comunes */
.common-areas {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 15px;
}

.common-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 15px;
  background: var(--surface-container);
  border-radius: 12px;
  border: 2px solid var(--outline-variant);
  text-align: center;
  min-width: 100px;
}

.common-area i {
  font-size: 24px;
  margin-bottom: 8px;
  color: var(--primary);
}

.common-area span {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.common-area.recepcion {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(20, 184, 166, 0.05));
  border-color: var(--primary);
}

.common-area.enfermeria {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
  border-color: #ef4444;
}

.common-area.enfermeria i {
  color: #ef4444;
}

.common-area.comedor {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
  border-color: #f59e0b;
}

.common-area.comedor i {
  color: #f59e0b;
}

.common-area.sala-estar {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(124, 58, 237, 0.05));
  border-color: #8b5cf6;
}

.common-area.sala-estar i {
  color: #8b5cf6;
}

.common-area.terapia {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
  border-color: #3b82f6;
}

.common-area.terapia i {
  color: #3b82f6;
}

/* Salida de emergencia */
.emergency-exit {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 600;
}

.emergency-exit i {
  font-size: 18px;
}

/* Áreas de servicio */
.service-areas {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  justify-content: center;
  gap: 15px;
  padding: 10px;
}

.service-room {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-container);
  border-radius: 8px;
  border: 1px solid var(--outline-variant);
  font-size: 12px;
  color: var(--on-surface-variant);
}

.service-room i {
  font-size: 16px;
  color: var(--primary);
}

/* Panel de detalle de habitación */
.room-detail-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  height: 100vh;
  background: var(--surface);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.room-detail-panel.open {
  right: 0;
}

.detail-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--outline-variant);
  background: var(--surface-container);
}

.detail-panel-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.detail-panel-header h3 i {
  color: var(--primary);
}

.close-panel-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--on-surface-variant);
  transition: all 0.2s ease;
}

.close-panel-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.detail-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Secciones del panel de detalle */
.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--outline-variant);
}

.detail-section h4 i {
  color: var(--primary);
}

/* Info de habitación */
.detail-room-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-label {
  font-size: 13px;
  color: var(--on-surface-variant);
}

.detail-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
}

.detail-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: capitalize;
}

.detail-status-badge.disponible {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.detail-status-badge.ocupada {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.detail-status-badge.reservada {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.detail-status-badge.mantenimiento {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

/* Lista de camas en detalle */
.detail-beds-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-bed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-container);
}

.detail-bed-item.disponible {
  border-left: 4px solid #22c55e;
}

.detail-bed-item.ocupada {
  border-left: 4px solid #3b82f6;
}

.detail-bed-item.reservada {
  border-left: 4px solid #f59e0b;
}

.detail-bed-item.mantenimiento {
  border-left: 4px solid #ef4444;
}

.detail-bed-icon {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--on-surface);
}

.detail-bed-icon i {
  font-size: 18px;
  color: var(--primary);
}

.detail-bed-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.detail-bed-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--on-surface-variant);
}

.detail-bed-patient {
  font-size: 12px;
  color: var(--on-surface);
}

/* Acciones del panel */
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.detail-action-btn.primary:hover {
  background: var(--esmeralda-600);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.detail-action-btn.secondary {
  background: var(--surface-container);
  color: var(--on-surface);
  border: 1px solid var(--outline-variant);
}

.detail-action-btn.secondary:hover {
  background: var(--surface-container-high);
  border-color: var(--primary);
  color: var(--primary);
}

.detail-action-btn.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.detail-action-btn.danger:hover {
  background: #ef4444;
  color: white;
}

/* Responsive */
@media (max-width: 1200px) {
  .building-outline {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .wing {
    grid-column: 1;
    grid-row: auto;
  }

  .common-areas {
    grid-column: 1;
    grid-row: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .hallway-horizontal {
    grid-column: 1;
  }

  .service-areas {
    grid-column: 1;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  .floor-selector {
    flex-wrap: wrap;
  }

  .floor-btn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }

  .mapa-legend-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .legend-stats {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .room-row {
    flex-direction: column;
  }

  .room-detail-panel {
    width: 100%;
    right: -100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PLANO ARQUITECTONICO - BUILDING & AREAS
   ═══════════════════════════════════════════════════════════════════════════ */

.plano-building {
  width: 100%;
  aspect-ratio: 1.47 / 1;
  position: relative;
  background: white;
  border: 3px solid #1e293b;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  margin: 0 auto;
  max-width: 1500px;
}

.plano-building::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #cbd5e1 0.5px, transparent 0.5px);
  background-size: 14px 14px;
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

/* Area base */
.plano-area {
  position: absolute;
  border: 1.5px solid #334155;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  z-index: 2;
  overflow: visible;
  gap: 1px;
}

.plano-area:hover {
  z-index: 10;
  transform: scale(1.04);
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
}

.plano-area-icon { font-size: 14px; opacity: 0.7; }
.plano-area-name {
  font-size: 8px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.3px; text-align: center; line-height: 1.15; padding: 0 2px;
}
/* Room name smaller when photos are present */
.plano-type-hd .plano-area-name,
.plano-type-ht .plano-area-name {
  font-size: 7px;
  opacity: 0.8;
  margin-top: auto;
  padding-bottom: 1px;
}
.plano-area-sub { font-size: 7px; opacity: 0.6; font-weight: 500; }

/* Status dot */
.plano-status-dot {
  position: absolute; top: 3px; right: 3px;
  width: 7px; height: 7px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.8);
}
.plano-status-dot.occupied { background: #ef4444; }
.plano-status-dot.partial { background: #f59e0b; }
.plano-status-dot.available { background: #22c55e; }
.plano-status-dot.maintenance { background: #6b7280; }

/* Bath indicator */
.plano-bath {
  position: absolute; bottom: 2px; right: 2px;
  font-size: 7px; opacity: 0.4;
}

/* Room type colors */
.plano-type-hd {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  border-color: #60a5fa; color: #1e40af;
  padding: 3px 1px;
  justify-content: center;
}
.plano-type-hd:hover { background: linear-gradient(135deg, #bfdbfe, #93c5fd); }

.plano-type-ht {
  background: linear-gradient(135deg, #ede9fe, #ddd6fe);
  border-color: #a78bfa; color: #5b21b6;
  padding: 2px 2px;
  justify-content: center;
}
.plano-type-ht:hover { background: linear-gradient(135deg, #ddd6fe, #c4b5fd); }

.plano-type-medical {
  background: linear-gradient(135deg, #ccfbf1, #99f6e4);
  border-color: #2dd4bf; color: #0f766e;
}

.plano-type-service {
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-color: #94a3b8; color: #475569;
}

.plano-type-admin {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-color: #fbbf24; color: #92400e;
}

.plano-type-common {
  background: linear-gradient(135deg, #ffedd5, #fed7aa);
  border-color: #fb923c; color: #9a3412;
}

.plano-type-infrastructure {
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
  border-color: #9ca3af; color: #374151;
}
.plano-type-infrastructure .plano-area-icon { font-size: 12px; }
.plano-type-infrastructure .plano-area-name { font-size: 7px; }

.plano-type-morgue {
  background: linear-gradient(135deg, #374151, #4b5563);
  border-color: #1f2937; color: #e5e7eb;
}

.plano-type-danger {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-color: #f87171; color: #991b1b;
}

.plano-type-cold {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  border-color: #38bdf8; color: #0c4a6e;
}

/* Corridors */
.plano-corridor {
  position: absolute;
  background: linear-gradient(90deg, #f8fafc, #f1f5f9);
  border: 1px dashed #94a3b8;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  z-index: 1; pointer-events: none;
}
.plano-corridor span {
  font-size: 9px; font-weight: 700; color: #64748b;
  letter-spacing: 2px; text-transform: uppercase;
}

/* Patios */
.plano-patio {
  position: absolute;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid #86efac;
  border-radius: 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 1;
}
.plano-patio-icon { font-size: 24px; color: #22c55e; opacity: 0.4; margin-bottom: 4px; }
.plano-patio-name { font-size: 11px; font-weight: 700; color: #166534; letter-spacing: 1px; text-transform: uppercase; }
.plano-pillars {
  position: absolute; inset: 15px;
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
}
.plano-pillar { width: 6px; height: 6px; background: #334155; border-radius: 1px; place-self: center; }

/* Entrance markers */
.plano-entrance {
  position: absolute; z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.plano-entrance-circle {
  width: 40px; height: 40px; border: 2px dashed #64748b;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.plano-entrance-circle i { font-size: 14px; color: #475569; }
.plano-entrance-label {
  font-size: 8px; font-weight: 700; color: #475569;
  text-transform: uppercase; text-align: center; line-height: 1.2; max-width: 70px;
}

/* Compass */
.plano-compass {
  position: absolute; left: 15px; top: 15px;
  width: 45px; height: 45px; z-index: 20;
}
.plano-compass svg { width: 100%; height: 100%; }

/* Title block */
.plano-title-block {
  position: absolute; bottom: 8px; right: 8px;
  background: white; border: 2px solid #1e293b; border-radius: 4px;
  padding: 8px 14px; z-index: 20;
  display: flex; align-items: center; gap: 16px;
}

/* Detail icon */
.plano-detail-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.plano-detail-icon-hd { background: #dbeafe; color: #2563eb; }
.plano-detail-icon-ht { background: #ede9fe; color: #7c3aed; }
.plano-detail-icon-medical { background: #ccfbf1; color: #0d9488; }
.plano-detail-icon-service { background: #f1f5f9; color: #475569; }
.plano-detail-icon-admin { background: #fef3c7; color: #d97706; }
.plano-detail-icon-common { background: #ffedd5; color: #ea580c; }
.plano-detail-icon-infrastructure { background: #e5e7eb; color: #374151; }
.plano-detail-icon-morgue { background: #374151; color: #e5e7eb; }
.plano-detail-icon-danger { background: #fee2e2; color: #991b1b; }
.plano-detail-icon-cold { background: #e0f2fe; color: #0c4a6e; }

/* Equip tags */
.plano-equip-tag {
  background: var(--surface-container, #f1f5f9); padding: 4px 8px; border-radius: 4px;
  font-size: 11px; color: #475569; display: flex; align-items: center; gap: 4px;
}
.plano-equip-tag i { font-size: 10px; color: #22c55e; }

/* Highlight & dimmed */
.plano-area.plano-highlight {
  z-index: 20 !important;
  box-shadow: 0 0 0 4px rgba(16,185,129,0.5) !important;
}
.plano-area.plano-dimmed { opacity: 0.25; }

/* 3 destellos al buscar paciente */
.plano-area.plano-flash {
  z-index: 30 !important;
  animation: plano-flash-3 1.8s ease-out forwards;
}
@keyframes plano-flash-3 {
  0%   { box-shadow: 0 0 0 0px rgba(239,68,68,0); transform: scale(1); }
  8%   { box-shadow: 0 0 0 12px rgba(239,68,68,0.6), 0 0 30px rgba(239,68,68,0.4); transform: scale(1.12); background: rgba(254,240,138,0.8) !important; }
  20%  { box-shadow: 0 0 0 4px rgba(239,68,68,0.15); transform: scale(1); }
  30%  { box-shadow: 0 0 0 0px rgba(239,68,68,0); transform: scale(1); }
  38%  { box-shadow: 0 0 0 12px rgba(239,68,68,0.6), 0 0 30px rgba(239,68,68,0.4); transform: scale(1.12); background: rgba(254,240,138,0.8) !important; }
  50%  { box-shadow: 0 0 0 4px rgba(239,68,68,0.15); transform: scale(1); }
  60%  { box-shadow: 0 0 0 0px rgba(239,68,68,0); transform: scale(1); }
  68%  { box-shadow: 0 0 0 12px rgba(239,68,68,0.6), 0 0 30px rgba(239,68,68,0.4); transform: scale(1.12); background: rgba(254,240,138,0.8) !important; }
  80%  { box-shadow: 0 0 0 4px rgba(239,68,68,0.15); transform: scale(1); }
  100% { box-shadow: 0 0 0 3px rgba(16,185,129,0.4); transform: scale(1); }
}

/* Mini fotos de pacientes en areas del plano */
.plano-mini-fotos {
  display: flex;
  gap: 3px;
  justify-content: center;
  align-items: center;
  z-index: 3;
  position: relative;
}
.plano-mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  flex-shrink: 0;
  transition: transform 0.2s;
  position: relative;
}
.plano-area:hover .plano-mini-avatar {
  transform: scale(1.25);
  z-index: 10;
}
.plano-mini-avatar-ph {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: white;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  flex-shrink: 0;
  transition: transform 0.2s;
  position: relative;
}
.plano-area:hover .plano-mini-avatar-ph {
  transform: scale(1.25);
  z-index: 10;
}
.plano-mini-bed-free {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #22c55e;
  background: rgba(255,255,255,0.9);
  border: 2px dashed #22c55e;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.plano-area:hover .plano-mini-bed-free {
  transform: scale(1.25);
}
/* Occupied avatar red ring */
.plano-mini-occupied {
  border-color: #fca5a5 !important;
  box-shadow: 0 0 0 1.5px #ef4444, 0 2px 6px rgba(239,68,68,0.4) !important;
}
/* HD rooms: vertical (tall narrow rooms - stack vertically) */
.plano-type-hd .plano-mini-fotos {
  flex-direction: column;
  gap: 4px;
}
/* HT rooms: horizontal (wider rooms - row) */
.plano-type-ht .plano-mini-fotos {
  flex-direction: row;
  gap: 2px;
}
.plano-type-ht .plano-mini-avatar,
.plano-type-ht .plano-mini-avatar-ph,
.plano-type-ht .plano-mini-bed-free {
  width: 20px;
  height: 20px;
  font-size: 7px;
}

/* Print selected */
.plano-area.plano-print-selected {
  box-shadow: 0 0 0 3px #b91c1c, 0 6px 20px rgba(185,28,28,0.3) !important;
  z-index: 20 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAPA - BUSCADOR DE PACIENTES
   ═══════════════════════════════════════════════════════════════════════════ */
.mapa-search-wrapper {
  position: relative;
  flex-shrink: 0;
}

.mapa-search-box {
  width: 300px;
  padding: 10px 14px 10px 38px;
  border: 2px solid var(--outline-variant);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--on-surface);
  background: var(--surface);
  outline: none;
  transition: all 0.2s;
}

.mapa-search-box::placeholder {
  color: var(--on-surface-variant);
  opacity: 0.6;
}

.mapa-search-box:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  width: 360px;
}

.mapa-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--on-surface-variant);
  opacity: 0.5;
  pointer-events: none;
}

/* Search results dropdown */
.mapa-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--outline-variant);
  max-height: 400px;
  overflow-y: auto;
  z-index: 600;
  display: none;
}

.mapa-search-results.open {
  display: block;
}

.mapa-search-results::-webkit-scrollbar {
  width: 5px;
}

.mapa-search-results::-webkit-scrollbar-thumb {
  background: var(--outline-variant);
  border-radius: 3px;
}

.mapa-sr-section-label {
  padding: 10px 16px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--on-surface-variant);
  opacity: 0.7;
}

.mapa-sr-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--outline-variant);
}

.mapa-sr-item:last-child {
  border-bottom: none;
}

.mapa-sr-item:hover {
  background: var(--surface-container);
}

.mapa-sr-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.mapa-sr-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.mapa-sr-info {
  flex: 1;
  min-width: 0;
}

.mapa-sr-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mapa-sr-detail {
  font-size: 11px;
  color: var(--on-surface-variant);
  margin-top: 2px;
}

.mapa-sr-badge {
  background: var(--surface-container);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  flex-shrink: 0;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.mapa-sr-room-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--surface-container);
  color: var(--primary);
}

.mapa-sr-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--on-surface-variant);
  font-size: 13px;
}

.mapa-sr-empty i {
  display: block;
  font-size: 22px;
  margin-bottom: 8px;
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAPA - DETALLE PANEL MEJORADO (fotos, info)
   ═══════════════════════════════════════════════════════════════════════════ */
.detail-bed-item-enhanced {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-container);
  margin-bottom: 10px;
  transition: all 0.2s;
}

.detail-bed-item-enhanced:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.detail-bed-item-enhanced.disponible {
  border-left: 4px solid #22c55e;
}

.detail-bed-item-enhanced.ocupada {
  border-left: 4px solid #ef4444;
}

.detail-bed-item-enhanced.mantenimiento {
  border-left: 4px solid #ef4444;
}

.detail-bed-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}

.detail-bed-avatar-placeholder {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
  font-weight: 700;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.detail-bed-content {
  flex: 1;
  min-width: 0;
}

.detail-bed-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.detail-bed-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
}

.detail-bed-cama-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--on-surface-variant);
}

.detail-bed-meta {
  font-size: 11px;
  color: var(--on-surface-variant);
  line-height: 1.5;
}

.detail-bed-empty {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-bed-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  font-size: 18px;
  flex-shrink: 0;
}

.detail-bed-empty-icon.mantenimiento-icon {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Status dot para ocupada (rojo) en item de cama */
.detail-bed-item-enhanced.ocupada .detail-bed-cama-label {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.detail-bed-item-enhanced.disponible .detail-bed-cama-label {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

/* Boton asignar paciente en cama disponible */
.detail-bed-assign-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 6px;
}
.detail-bed-assign-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(34, 197, 94, 0.3);
}
.detail-bed-assign-btn i {
  font-size: 10px;
}

/* Status badge rojo/verde en cada cama */
.detail-bed-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.detail-bed-status-dot.red {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239,68,68,0.4);
}
.detail-bed-status-dot.green {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34,197,94,0.4);
}

/* Modal seleccionar paciente para asignar desde mapa */
.mapa-assign-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
.mapa-assign-modal {
  background: var(--surface, white);
  border-radius: 16px;
  width: 420px;
  max-width: 92vw;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}
.mapa-assign-modal-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mapa-assign-modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}
.mapa-assign-modal-header .close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.8;
}
.mapa-assign-modal-header .close-btn:hover { opacity: 1; }
.mapa-assign-modal-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--outline-variant, #e2e8f0);
}
.mapa-assign-modal-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--outline-variant, #e2e8f0);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
.mapa-assign-modal-search input:focus {
  border-color: #22c55e;
}
.mapa-assign-modal-list {
  overflow-y: auto;
  flex: 1;
  max-height: 400px;
  padding: 8px;
}
.mapa-assign-patient-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.mapa-assign-patient-item:hover {
  background: var(--surface-container, #f1f5f9);
}
.mapa-assign-patient-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  flex-shrink: 0;
}
.mapa-assign-patient-avatar-ph {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.mapa-assign-patient-info {
  flex: 1;
  min-width: 0;
}
.mapa-assign-patient-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface, #1e293b);
}
.mapa-assign-patient-detail {
  font-size: 11px;
  color: var(--on-surface-variant, #64748b);
}
.mapa-assign-empty {
  text-align: center;
  padding: 30px;
  color: var(--on-surface-variant, #64748b);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════ */
/* Modal Decision Admision (Aceptar/Rechazar)                    */
/* ═══════════════════════════════════════════════════════════════ */
.admision-decision-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: admisionFadeIn 0.2s ease;
}

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

@keyframes admisionSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.admision-decision-modal {
  background: var(--surface, white);
  border-radius: 18px;
  width: 95%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255,255,255,0.08);
  overflow: hidden;
  animation: admisionSlideUp 0.3s ease;
}

.admision-decision-header {
  padding: 18px 20px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.admision-decision-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
}

.admision-decision-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.admision-decision-close:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

.admision-decision-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.admision-decision-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 16px;
}

.admision-decision-loader p {
  margin: 0;
  font-size: 13px;
  color: var(--on-surface-variant, #64748b);
}

.admision-loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(34, 197, 94, 0.15);
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: admisionSpin 0.8s linear infinite;
}

@keyframes admisionSpin {
  to { transform: rotate(360deg); }
}

.admision-paciente-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface-container, #f8fafc);
  border-bottom: 1px solid var(--outline-variant, #e2e8f0);
}

.admision-paciente-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.admision-camas-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  max-height: 400px;
}

.admision-camas-scroll::-webkit-scrollbar {
  width: 5px;
}

.admision-camas-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.admision-camas-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 10px;
}

.admision-hab-group {
  margin-bottom: 12px;
}

.admision-hab-group:last-child {
  margin-bottom: 0;
}

.admision-hab-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface, #1e293b);
  margin-bottom: 8px;
  padding: 0 2px;
}

.admision-hab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.admision-hab-badge.hd {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e40af;
}

.admision-hab-badge.ht {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
}

.admision-camas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.admision-cama-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface, white);
  border: 1.5px solid var(--outline-variant, #e2e8f0);
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface, #1e293b);
  transition: all 0.2s ease;
}

.admision-cama-btn i {
  color: #22c55e;
  font-size: 15px;
}

.admision-cama-btn:hover {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.06);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
  transform: translateY(-1px);
}

.admision-cama-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Responsive */
@media (max-width: 480px) {
  .admision-decision-modal {
    width: 98%;
    max-height: 90vh;
    border-radius: 14px;
  }
  .admision-camas-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

/* Boton imprimir en panel de detalle */
.detail-print-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.detail-print-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

.detail-print-btn i {
  font-size: 15px;
}

/* Room highlight on search */
.room.habitacion.search-highlight {
  box-shadow: 0 0 0 3px var(--primary), 0 8px 25px rgba(16, 185, 129, 0.3) !important;
  transform: translateY(-3px);
  z-index: 10;
}

.room.habitacion.search-dimmed {
  opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAPA - PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Print header/footer hidden by default */
.mapa-print-header,
.mapa-print-footer {
  display: none;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: white !important;
  }

  /* Hide everything except the mapa section */
  .sidebar,
  .main-header,
  .section:not(#section-mapa),
  .room-detail-panel,
  .mapa-search-wrapper,
  .floor-selector,
  .mapa-legend-bar,
  .categorias-leyenda,
  .detail-print-btn,
  .detail-actions,
  .detail-action-btn,
  .plano-compass,
  .plano-entrance,
  .plano-title-block {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  #section-mapa {
    padding: 0 !important;
  }

  .section-header {
    display: none !important;
  }

  /* Show print header */
  .mapa-print-header {
    display: block !important;
    text-align: center;
    padding: 20px 0 16px 0;
    border-bottom: 2px solid #0f172a;
    margin-bottom: 16px;
  }

  .mapa-print-header h1 {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px 0;
  }

  .mapa-print-header .print-subtitle {
    font-size: 12px;
    color: #64748b;
    margin: 0;
  }

  .mapa-print-header .print-room-info {
    margin-top: 10px;
    font-size: 16px;
    font-weight: 700;
    color: #b91c1c;
    padding: 8px 20px;
    background: #fef3c7;
    display: inline-block;
    border-radius: 8px;
    border: 1px solid #fbbf24;
  }

  /* Building on print */
  .plano-building {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1.5 / 1;
    transform: none !important;
    border: 2px solid #334155 !important;
    box-shadow: none !important;
    margin: 0 auto !important;
    page-break-inside: avoid;
  }
  .plano-building::before { opacity: 0.1 !important; }

  .floor-plan {
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* Dim all areas */
  .plano-area {
    opacity: 0.4 !important;
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #94a3b8 !important;
  }
  .plano-area .plano-area-icon { display: none !important; }
  .plano-area .plano-area-sub { display: none !important; }
  .plano-area .plano-bath { display: none !important; }
  .plano-area .plano-status-dot { display: none !important; }
  .plano-area .plano-area-name { font-size: 6px !important; color: #94a3b8 !important; }

  /* Selected area stands out */
  .plano-area.plano-print-selected {
    background: linear-gradient(135deg, #fef08a, #fde047) !important;
    border: 3px solid #b91c1c !important;
    color: #0f172a !important;
    opacity: 1 !important;
    z-index: 50 !important;
    box-shadow: 0 0 0 4px rgba(185,28,28,0.3) !important;
  }
  .plano-area.plano-print-selected .plano-area-name {
    font-size: 10px !important; font-weight: 900 !important;
    color: #0f172a !important; opacity: 1 !important;
  }
  .plano-area.plano-print-selected .plano-area-icon {
    display: block !important; font-size: 16px !important;
    color: #b91c1c !important; opacity: 1 !important;
  }

  /* Corridors & patios dimmed */
  .plano-corridor { opacity: 0.3 !important; }
  .plano-patio { opacity: 0.3 !important; }

  /* Print footer */
  .mapa-print-footer {
    display: block !important;
    text-align: center;
    padding: 16px 0;
    border-top: 1px solid #e2e8f0;
    margin-top: 16px;
    font-size: 11px;
    color: #64748b;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FARMACIA TABS
   ═══════════════════════════════════════════════════════════════════════════ */
.farmacia-tab {
  display: none;
  margin-top: 20px;
}

.farmacia-tab.active {
  display: block;
}

.stock-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  padding: 8px 16px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-full);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-chip:hover {
  background: var(--surface-container);
}

.filter-chip.active {
  background: var(--surface-container-high);
  color: var(--on-surface);
  border-color: var(--on-surface-variant);
}

.filter-chip.alert.active {
  background: var(--error-container);
  color: var(--error);
  border-color: var(--error);
}

.filter-chip.warning.active {
  background: var(--warning-container);
  color: var(--warning);
  border-color: var(--warning);
}

.status-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.status-badge.critical {
  background: var(--error-container);
  color: var(--error);
}

.status-badge.low {
  background: var(--warning-container);
  color: var(--warning);
}

.status-badge.normal {
  background: var(--success-container);
  color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EVOLUCION
   ═══════════════════════════════════════════════════════════════════════════ */
.evolucion-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  margin-top: 20px;
  min-height: 600px;
}

.evolucion-sidebar {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.sidebar-search {
  padding: 16px;
  border-bottom: 1px solid var(--outline-variant);
}

.sidebar-search input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--surface-container);
}

.patients-sidebar-list {
  max-height: 500px;
  overflow-y: auto;
}

.sidebar-patient {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--outline-variant);
}

.sidebar-patient:hover {
  background: var(--surface-container);
}

.sidebar-patient.active {
  background: var(--primary-container);
}

.evolucion-main {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.evolucion-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--on-surface-variant);
  gap: 16px;
}

.evolucion-placeholder span {
  font-size: 48px;
  opacity: 0.5;
}

.evolucion-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.evolucion-patient-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
}

.evolucion-tab-content {
  display: none;
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
}

.evolucion-tab-content.active {
  display: block;
}

.evolucion-actions {
  margin-bottom: 20px;
}

.evolucion-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-item {
  background: var(--surface-container-low);
  border-radius: var(--radius-lg);
  padding: 20px;
  border-left: 4px solid var(--primary);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.timeline-date {
  font-size: 12px;
  color: var(--on-surface-variant);
}

.timeline-author {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

.timeline-body {
  font-size: 14px;
  color: var(--on-surface);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FACTURACION
   ═══════════════════════════════════════════════════════════════════════════ */
.facturacion-tab {
  display: none;
  margin-top: 20px;
}

.facturacion-tab.active {
  display: block;
}

.facturacion-filters {
  margin-bottom: 20px;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-range label {
  font-size: 14px;
  color: var(--on-surface-variant);
}

.date-range input {
  padding: 10px 14px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.resumen-select {
  margin-bottom: 20px;
}

.resumen-select select {
  padding: 12px 16px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  font-size: 14px;
  min-width: 300px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONFIGURACION
   ═══════════════════════════════════════════════════════════════════════════ */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.config-card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: var(--transition-fast);
}

.config-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.config-card h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.config-card p {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS - Estilo Moderno Elegante
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 41, 59, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
}

.modal-overlay.active {
  display: block;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(16,185,129,0.15);
  z-index: 1001;
  width: 92%;
  max-width: 500px;
  max-height: 85vh;
  overflow: hidden;
  display: none;
  opacity: 0;
  transition: all 0.3s ease;
  border: 1px solid rgba(16,185,129,0.1);
}

.modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid transparent;
  background: linear-gradient(90deg, rgba(16,185,129,0.05) 0%, rgba(20,184,166,0.05) 100%);
  position: relative;
}

.modal-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Fix para headers con fondo de color - el texto debe ser blanco */
.modal-header[style*="background"] h3,
.modal-header[style*="background"] h2 {
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: white !important;
  color: white !important;
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: rgba(59,130,246,0.1);
  color: var(--primary);
}

.modal-body {
  padding: 20px;
  max-height: 55vh;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(59,130,246,0.1);
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  color: var(--on-surface);
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(59,130,246,0.15);
  background: rgba(59,130,246,0.02);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS PANEL
   ═══════════════════════════════════════════════════════════════════════════ */
.notifications-panel {
  position: fixed;
  top: 72px;
  right: 32px;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  display: none;
}

.notifications-panel.active {
  display: block;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--outline-variant);
}

.notif-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notif-header h3 i {
  color: var(--primary);
}

.notif-actions {
  display: flex;
  gap: 8px;
}

.notif-header button {
  background: none;
  border: none;
  color: var(--on-surface-variant);
  font-size: 14px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.notif-header button:hover {
  background: var(--surface-container);
  color: var(--error);
}

.notif-list {
  max-height: 400px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--outline-variant);
  cursor: pointer;
  transition: var(--transition-fast);
}

.notif-item:hover {
  background: var(--surface-container);
}

.notif-item.unread {
  background: var(--primary-container);
}

.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary);
}

.notif-item {
  position: relative;
}

.notif-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.notif-icon.default {
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
}

.notif-icon.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.notif-icon.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.notif-icon.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.notif-icon.info {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.notif-icon.primary {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-text {
  font-size: 13px;
  color: var(--on-surface);
  margin: 0 0 4px;
  line-height: 1.4;
}

.notif-time {
  font-size: 11px;
  color: var(--on-surface-variant);
}

.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--on-surface-variant);
  text-align: center;
}

.notif-empty i {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.notif-empty p {
  margin: 0;
  font-size: 14px;
}

/* Animación campanita con notificación nueva */
.icon-btn.has-new {
  animation: bellShake 0.5s ease;
}

@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(15deg); }
  40% { transform: rotate(-15deg); }
  60% { transform: rotate(10deg); }
  80% { transform: rotate(-10deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--on-surface);
  color: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  min-width: 300px;
}

.toast.success {
  background: var(--success);
  color: white;
}

.toast.error {
  background: var(--error);
  color: white;
}

.toast.warning {
  background: var(--warning);
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTA DE URGENCIA NFC
   ═══════════════════════════════════════════════════════════════════════════ */

.urgencia-overlay {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  animation: urgenciaSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes urgenciaSlideIn {
  from {
    transform: translateX(120%) scale(0.8);
    opacity: 0;
  }
  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.urgencia-popup {
  width: 340px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(239, 68, 68, 0.3), 0 0 0 2px #ef4444;
  overflow: hidden;
  animation: urgenciaPulse 2s ease-in-out infinite;
}

@keyframes urgenciaPulse {
  0%, 100% { box-shadow: 0 8px 40px rgba(239, 68, 68, 0.3), 0 0 0 2px #ef4444; }
  50% { box-shadow: 0 8px 40px rgba(239, 68, 68, 0.5), 0 0 0 3px #ef4444; }
}

.urgencia-header {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.urgencia-icon-pulse {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  animation: urgenciaIconShake 0.6s ease-in-out infinite alternate;
}

@keyframes urgenciaIconShake {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(10deg); }
}

.urgencia-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
}

.urgencia-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.urgencia-field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.urgencia-field > i {
  width: 28px;
  height: 28px;
  background: #fef2f2;
  color: #ef4444;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.urgencia-field > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.urgencia-label {
  font-size: 11px;
  color: #9ca3af;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.urgencia-value {
  font-size: 14px;
  color: #111827;
  font-weight: 600;
}

.urgencia-btn-confirmar {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.urgencia-btn-confirmar:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACTIVIDADES RECIENTES
   ═══════════════════════════════════════════════════════════════════════════ */
.actividades-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.actividades-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-container);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--outline-variant);
  transition: all 0.3s ease;
}

.actividades-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.actividades-search i {
  color: var(--outline);
  font-size: 12px;
}

.actividades-search input {
  border: none;
  background: transparent;
  font-size: 13px;
  width: 150px;
  color: var(--on-surface);
}

.actividades-search input:focus {
  outline: none;
}

.actividades-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 350px;
  overflow-y: auto;
}

.actividad-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--surface-container-low);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  transition: all 0.2s ease;
  cursor: pointer;
}

.actividad-item:hover {
  background: var(--surface-container);
  transform: translateX(3px);
}

.actividad-item.tipo-medicacion { border-left-color: #10b981; }
.actividad-item.tipo-paciente { border-left-color: #3b82f6; }
.actividad-item.tipo-cama { border-left-color: #f59e0b; }
.actividad-item.tipo-stock { border-left-color: #ef4444; }
.actividad-item.tipo-admision { border-left-color: #8b5cf6; }
.actividad-item.tipo-evolucion { border-left-color: #10b981; }
.actividad-item.tipo-facturacion { border-left-color: #ec4899; }

.actividad-icono {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.actividad-item.tipo-medicacion .actividad-icono { background: rgba(16,185,129,0.15); color: #10b981; }
.actividad-item.tipo-paciente .actividad-icono { background: rgba(59,130,246,0.15); color: #3b82f6; }
.actividad-item.tipo-cama .actividad-icono { background: rgba(245,158,11,0.15); color: #f59e0b; }
.actividad-item.tipo-stock .actividad-icono { background: rgba(239,68,68,0.15); color: #ef4444; }
.actividad-item.tipo-admision .actividad-icono { background: rgba(139,92,246,0.15); color: #8b5cf6; }
.actividad-item.tipo-evolucion .actividad-icono { background: rgba(6,182,212,0.15); color: #10b981; }
.actividad-item.tipo-facturacion .actividad-icono { background: rgba(236,72,153,0.15); color: #ec4899; }

.actividad-content {
  flex: 1;
  min-width: 0;
}

.actividad-titulo {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 2px;
}

.actividad-descripcion {
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.4;
}

.actividad-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--outline);
  flex-wrap: wrap;
}

.actividad-meta i {
  font-size: 10px;
}

.actividad-usuario {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL DETALLE ALERTA
   ═══════════════════════════════════════════════════════════════════════════ */
.alerta-detalle-content {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.alerta-icono {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: rgba(16,185,129,0.15);
  color: var(--primary);
}

.alerta-icono.alerta-warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.alerta-icono.alerta-error { background: rgba(239,68,68,0.15); color: #ef4444; }
.alerta-icono.alerta-info { background: rgba(59,130,246,0.15); color: #3b82f6; }
.alerta-icono.alerta-success { background: rgba(16,185,129,0.15); color: #10b981; }

.alerta-info {
  flex: 1;
}

.alerta-tipo {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
}

.alerta-mensaje {
  font-size: 16px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 8px;
}

.alerta-fecha {
  font-size: 12px;
  color: var(--outline);
  margin-bottom: 12px;
}

.alerta-detalles {
  background: var(--surface-container);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--on-surface-variant);
}

.alerta-detalles p {
  margin: 4px 0;
}

.alerta-detalles strong {
  color: var(--on-surface);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EFECTO DESTELLO PARA ELEMENTOS
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes elementFlash {
  0%, 100% {
    box-shadow: 0 0 0 0 transparent;
    background-color: inherit;
  }
  50% {
    box-shadow: 0 0 20px 5px rgba(16,185,129,0.5);
    background-color: rgba(16,185,129,0.1);
  }
}

.element-flash {
  animation: elementFlash 0.5s ease-in-out 3;
  position: relative;
}

.element-flash::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--primary);
  border-radius: inherit;
  animation: elementFlash 0.5s ease-in-out 3;
  pointer-events: none;
}

/* Notificaciones con animación de campanita */
@keyframes bellShake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(15deg); }
  30% { transform: rotate(-15deg); }
  45% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  75% { transform: rotate(5deg); }
  90% { transform: rotate(-5deg); }
}

.notif-btn.has-new i {
  animation: bellShake 0.8s ease-in-out;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POPUP DE SESIÓN DE USUARIO
   ═══════════════════════════════════════════════════════════════════════════ */
.session-popup-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.session-popup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: white;
  border-radius: 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border-left: 4px solid var(--primary);
  animation: sessionSlideIn 0.4s ease-out;
  pointer-events: auto;
  min-width: 280px;
  max-width: 350px;
}

.session-popup.logout {
  border-left-color: #64748b;
}

.session-popup.logout .session-avatar {
  background: #64748b;
}

@keyframes sessionSlideIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes sessionSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100px);
  }
}

.session-popup.hiding {
  animation: sessionSlideOut 0.3s ease-in forwards;
}

.session-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  overflow: hidden;
}

.session-avatar.has-photo {
  background: transparent;
  border: 2px solid var(--primary);
}

.session-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-status {
  font-size: 12px;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-status i {
  font-size: 8px;
}

.session-status.online i {
  color: #10b981;
}

.session-status.offline i {
  color: #64748b;
}

.session-time {
  font-size: 11px;
  color: var(--outline);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PÁGINA DE ESTADÍSTICAS - VERSIÓN SIMPLIFICADA
   ═══════════════════════════════════════════════════════════════════════════ */

/* Header simple */
/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD ESTADISTICAS - NUEVO
   ═══════════════════════════════════════════════════════════════════════════ */

.stats-dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.stats-dash-title h2 {
  font-size: 1.6em;
  font-weight: 700;
  color: var(--on-surface);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-dash-title h2 i { color: var(--primary); }

.stats-dash-fecha {
  font-size: 0.85em;
  color: var(--on-surface-variant);
}

.stats-refresh-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--outline-variant);
  background: white;
  color: var(--on-surface-variant);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}
.stats-refresh-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.stats-refresh-btn:active i { animation: spin-once 0.5s ease; }

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

/* KPI Cards Row */
.stats-kpi-row {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stats-kpi-card {
  background: white;
  border-radius: 18px;
  padding: 22px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
  border: 1px solid var(--outline-variant);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stats-kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.stats-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}

.kpi-ocupacion::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.kpi-pacientes::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-camas::before { background: linear-gradient(90deg, #22c55e, #86efac); }
.kpi-estadia::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

.kpi-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  margin-bottom: 4px;
}

.kpi-ocupacion .kpi-icon-wrap { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.kpi-pacientes .kpi-icon-wrap { background: linear-gradient(135deg, #10b981, #059669); }
.kpi-camas .kpi-icon-wrap { background: linear-gradient(135deg, #22c55e, #16a34a); }
.kpi-estadia .kpi-icon-wrap { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.kpi-data {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kpi-value {
  font-size: 2em;
  font-weight: 800;
  color: var(--on-surface);
  line-height: 1.1;
}

.kpi-label {
  font-size: 0.82em;
  color: var(--on-surface-variant);
  font-weight: 500;
}

.kpi-sub {
  font-size: 0.75em;
  color: var(--outline);
}

/* Row de 2 columnas */
.stats-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Row de 3 columnas */
.stats-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Row de 1 columna */
.stats-row-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Chart card */
.stats-chart-card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  border: 1px solid var(--outline-variant);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stats-chart-card.stats-card-compact {
  /* Cards compactas */
}

.stats-card-header {
  padding: 14px 18px 0;
}

.stats-card-header h3 {
  font-size: 0.9em;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-card-header h3 i {
  color: var(--primary);
  font-size: 0.9em;
}

.stats-chart-body {
  padding: 14px 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 200px;
}

.stats-chart-body-compact {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
}

.stats-chart-body-compact canvas {
  max-width: 140px;
  max-height: 140px;
}

.stats-chart-body-compact .chart-legend {
  flex-direction: row;
  gap: 12px;
  font-size: 0.78em;
}

.stats-chart-body.chart-tall {
  min-height: 220px;
}

.stats-chart-body canvas {
  max-width: 100%;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.85em;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--on-surface);
}

.chart-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Actividad del mes - modern counters */
.stats-actividad-modern {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  flex: 1;
}

.actividad-counter {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-container);
  transition: transform 0.15s;
}

.actividad-counter:hover { transform: scale(1.02); }

.actividad-counter-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
}

.actividad-counter.ingresos .actividad-counter-icon { background: linear-gradient(135deg, #10b981, #059669); }
.actividad-counter.altas .actividad-counter-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.actividad-counter.evoluciones .actividad-counter-icon { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.actividad-counter-data {
  display: flex;
  flex-direction: column;
}

.actividad-counter-val {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--on-surface);
  line-height: 1.1;
}

.actividad-counter-label {
  font-size: 0.8em;
  color: var(--on-surface-variant);
}

/* Farmacia alerts inline */
.stats-farmacia-inline {
  display: flex;
  gap: 12px;
  padding: 0 22px 20px;
}

.farmacia-alert-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  transition: transform 0.15s;
}

.farmacia-alert-item:hover { transform: scale(1.02); }

.farmacia-alert-item.critico {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 1px solid #fecaca;
}

.farmacia-alert-item.critico i { color: #ef4444; font-size: 18px; }

.farmacia-alert-item.bajo {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid #fde68a;
}

.farmacia-alert-item.bajo i { color: #f59e0b; font-size: 18px; }

.farmacia-alert-val {
  font-size: 1.4em;
  font-weight: 700;
  color: var(--on-surface);
}

.farmacia-alert-label {
  font-size: 0.78em;
  color: var(--on-surface-variant);
}

/* Lista moderna (ultimos ingresos/altas) */
.stats-lista-modern {
  padding: 12px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.stats-lista-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-container);
  border-radius: 12px;
  transition: background 0.15s;
}

.stats-lista-item:hover {
  background: var(--surface-container-high);
}

.stats-lista-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
}

.stats-lista-info {
  flex: 1;
  min-width: 0;
}

.stats-lista-nombre {
  font-weight: 600;
  font-size: 0.9em;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-lista-detalle {
  font-size: 0.78em;
  color: var(--on-surface-variant);
}

.stats-lista-fecha {
  font-size: 0.78em;
  color: var(--outline);
  text-align: right;
  white-space: nowrap;
}

.stats-lista-empty {
  text-align: center;
  padding: 30px;
  color: var(--on-surface-variant);
}

.stats-lista-empty i {
  font-size: 28px;
  opacity: 0.25;
  margin-bottom: 8px;
  display: block;
}

/* Responsive Dashboard */
@media (max-width: 1024px) {
  .stats-kpi-row { grid-template-columns: repeat(2,1fr); }
  .stats-row-2 { grid-template-columns: 1fr; }
  .stats-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stats-kpi-row { grid-template-columns: 1fr; }
  .stats-farmacia-inline { flex-direction: column; }
}

/* Gauge de efectividad (legacy) */
.efectividad-gauge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 30px;
}

.gauge-circle {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(
    var(--primary) 0deg 252deg,
    #f59e0b 252deg 288deg,
    #ef4444 288deg 360deg
  );
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gauge-circle::before {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--surface);
}

.gauge-value {
  position: relative;
  z-index: 1;
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
}

.gauge-labels {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.gauge-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--on-surface);
}

.gauge-label .label-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.gauge-label.completadas .label-color { background: var(--primary); }
.gauge-label.pendientes .label-color { background: #f59e0b; }
.gauge-label.canceladas .label-color { background: #ef4444; }

/* Lista de facturas y ranking */
.facturas-list,
.ranking-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ESTILOS DE FACTURACIÓN
   ═══════════════════════════════════════════════════════════════════════════ */

.progress-chart-container {
  padding: 20px;
}

.facturacion-progress-bar {
  display: flex;
  height: 24px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-container);
  margin-bottom: 12px;
}

.progress-fill {
  transition: width 0.5s ease;
}

.progress-fill.cobrado {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.progress-fill.pendiente {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.cobrado-label {
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pendiente-label {
  color: #d97706;
  display: flex;
  align-items: center;
  gap: 6px;
}

.factura-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 10px;
  border-left: 4px solid var(--surface-container);
  transition: all 0.2s ease;
}

.factura-item:hover {
  background: var(--surface-container);
  transform: translateX(4px);
}

.factura-item.pagada,
.factura-item.cobrada {
  border-left-color: #22c55e;
}

.factura-item.pendiente {
  border-left-color: #f59e0b;
}

.factura-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.factura-numero {
  font-weight: 600;
  color: var(--on-surface);
  font-size: 14px;
}

.factura-paciente {
  color: var(--on-surface-variant);
  font-size: 13px;
}

.factura-fecha {
  color: var(--on-surface-variant);
  font-size: 12px;
}

.factura-monto {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.monto-valor {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.factura-estado {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.factura-estado.pagada,
.factura-estado.cobrada {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.factura-estado.pendiente {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ESTILOS DE EFECTIVIDAD
   ═══════════════════════════════════════════════════════════════════════════ */

.efectividad-gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 30px;
}

.efectividad-gauge {
  width: 200px;
  height: 100px;
  border-radius: 100px 100px 0 0;
  position: relative;
  overflow: hidden;
}

.efectividad-gauge::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 70px;
  background: var(--surface);
  border-radius: 70px 70px 0 0;
}

.gauge-content {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 1;
}

.gauge-content .gauge-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.gauge-content .gauge-label {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-top: 4px;
}

/* Ranking de efectividad */
.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}

.ranking-item:hover {
  background: var(--surface-container);
  transform: translateX(4px);
}

.ranking-item.oro {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.ranking-item.plata {
  background: linear-gradient(135deg, rgba(156, 163, 175, 0.1), rgba(107, 114, 128, 0.05));
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.ranking-item.bronce {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.1), rgba(217, 119, 6, 0.05));
  border: 1px solid rgba(180, 83, 9, 0.3);
}

.ranking-position {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--on-surface-variant);
}

.ranking-item.oro .ranking-position {
  color: #fbbf24;
}

.ranking-item.plata .ranking-position {
  color: #9ca3af;
}

.ranking-item.bronce .ranking-position {
  color: #b45309;
}

.ranking-position i {
  font-size: 18px;
}

.ranking-avatar-container {
  flex-shrink: 0;
}

.ranking-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

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

.ranking-nombre {
  font-weight: 600;
  font-size: 14px;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-stats {
  font-size: 12px;
  color: var(--on-surface-variant);
}

.ranking-tasa {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  min-width: 80px;
}

.tasa-valor {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.tasa-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-container-high);
  border-radius: 3px;
  overflow: hidden;
}

.tasa-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.no-data-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--on-surface-variant);
  text-align: center;
}

.no-data-message i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.no-data-message p {
  margin: 0;
  font-size: 14px;
}

/* Header de la página */
.stats-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 20px;
}

.stats-title-section h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--on-surface);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.stats-title-section h2 i {
  color: var(--primary);
}

.stats-subtitle {
  font-size: 14px;
  color: var(--on-surface-variant);
  margin-top: 4px;
}

.stats-search-section {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.stats-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  padding: 10px 18px;
  border-radius: 25px;
  border: 2px solid var(--outline-variant);
  transition: all 0.3s;
  min-width: 250px;
}

.stats-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.1);
}

.stats-search-box i {
  color: var(--outline);
  font-size: 14px;
}

.stats-search-box input {
  border: none;
  background: transparent;
  font-size: 14px;
  width: 100%;
  color: var(--on-surface);
}

.stats-search-box input:focus {
  outline: none;
}

.stats-period-selector {
  display: flex;
  background: white;
  border-radius: 25px;
  padding: 4px;
  border: 2px solid var(--outline-variant);
}

.period-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface-variant);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s;
}

.period-btn:hover {
  color: var(--primary);
}

.period-btn.active {
  background: var(--gradient-primary);
  color: white;
}

/* Tarjetas de resumen */
.stats-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 25px;
}

.summary-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border: 1px solid var(--outline-variant);
  transition: all 0.3s;
}

.summary-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.summary-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.summary-icon.usuarios-online {
  background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(20,184,166,0.15));
  color: #10b981;
}

.summary-icon.tiempo-total {
  background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(99,102,241,0.15));
  color: #3b82f6;
}

.summary-icon.sesiones {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(251,191,36,0.15));
  color: #f59e0b;
}

.summary-icon.promedio {
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(168,85,247,0.15));
  color: #8b5cf6;
}

.summary-content {
  flex: 1;
}

.summary-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--on-surface);
  display: block;
  line-height: 1;
}

.summary-label {
  font-size: 13px;
  color: var(--on-surface-variant);
  margin-top: 4px;
}

.summary-trend {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
}

.summary-trend.up {
  background: rgba(16,185,129,0.1);
  color: #10b981;
}

.summary-trend.down {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

.summary-trend.neutral {
  background: rgba(100,116,139,0.1);
  color: #64748b;
}

/* Grid principal */
.stats-main-grid {
  display: grid;
  grid-template-columns: 280px 1fr 300px;
  gap: 20px;
  margin-bottom: 25px;
}

.stats-panel {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border: 1px solid var(--outline-variant);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--outline-variant);
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
}

.panel-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--on-surface);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.panel-header h3 i {
  color: var(--primary);
  font-size: 14px;
}

.panel-header .badge {
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* Panel de empleados */
.empleados-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

.empleado-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  background: var(--surface);
  border: 1px solid transparent;
}

.empleado-item:hover {
  background: var(--surface-container);
}

.empleado-item.selected {
  background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(20,184,166,0.08));
  border-color: var(--primary);
}

.empleado-item.con-actividad {
  border-left: 3px solid var(--primary);
}

/* Avatar container global (usado por renderAvatar) */
.avatar-container {
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-container img,
.avatar-container .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatar-container span {
  font-weight: 600;
}

/* Avatar en lista de empleados */
.empleado-avatar-img {
  border: 2px solid var(--primary);
}

/* Avatar en detalle de empleado */
.detalle-avatar-img {
  border: 3px solid var(--primary);
}

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

.empleado-nombre {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.empleado-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empleado-sesiones {
  font-size: 11px;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  gap: 4px;
}

.empleado-sesiones i {
  font-size: 10px;
  color: var(--primary);
}

.empleado-tiempo-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.tiempo-valor {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
}

.tiempo-label {
  font-size: 10px;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Estado vacío */
.empleados-list .no-data {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--on-surface-variant);
  text-align: center;
}

.empleados-list .no-data i {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empleados-list .no-data p {
  margin: 0;
  font-size: 13px;
}

/* Panel de gráfico */
.chart-container {
  padding: 20px;
  height: 280px;
}

.hour-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 220px;
  gap: 4px;
  padding: 0 10px;
}

.hour-bar {
  flex: 1;
  background: linear-gradient(180deg, #10b981 0%, #14b8a6 100%);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: all 0.3s;
  position: relative;
}

.hour-bar:hover {
  opacity: 0.8;
}

.hour-bar.inactive {
  background: #e2e8f0;
}

.hour-bar::after {
  content: attr(data-value);
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--on-surface-variant);
  opacity: 0;
  transition: opacity 0.2s;
}

.hour-bar:hover::after {
  opacity: 1;
}

.chart-hours-labels {
  display: flex;
  justify-content: space-between;
  padding: 10px 30px 15px;
  font-size: 10px;
  color: var(--outline);
}

.chart-legend {
  display: flex;
  gap: 15px;
}

.legend-item {
  font-size: 11px;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-item i {
  font-size: 8px;
}

/* Panel de detalle */
.empleado-detalle {
  padding: 20px;
}

.detalle-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--outline);
  text-align: center;
}

.detalle-placeholder i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.3;
}

.detalle-placeholder p {
  font-size: 14px;
}

.detalle-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--outline-variant);
}

.detalle-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 20px;
  overflow: hidden;
}

.detalle-avatar.has-photo {
  background: transparent;
  border: 3px solid var(--primary);
}

.detalle-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detalle-info h4 {
  font-size: 18px;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0 0 4px;
}

.detalle-info span {
  font-size: 13px;
  color: var(--on-surface-variant);
}

.detalle-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.detalle-stat {
  background: var(--surface-container);
  padding: 12px;
  border-radius: 10px;
  text-align: center;
}

.detalle-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.detalle-stat-label {
  font-size: 11px;
  color: var(--on-surface-variant);
}

.detalle-sesiones-list {
  max-height: 180px;
  overflow-y: auto;
}

.detalle-sesion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--outline-variant);
  font-size: 13px;
}

.detalle-sesion-item:last-child {
  border-bottom: none;
}

.detalle-sesion-fecha {
  color: var(--on-surface-variant);
}

.detalle-sesion-duracion {
  font-weight: 600;
  color: var(--on-surface);
}

/* Panel de tabla de sesiones */
.sesiones-panel {
  margin-top: 0;
}

.stats-table {
  font-size: 13px;
}

.stats-table th {
  background: var(--surface-container);
  font-weight: 600;
  color: var(--on-surface-variant);
  padding: 12px 15px;
}

.stats-table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--outline-variant);
}

.stats-table .status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.stats-table .status-badge.completada {
  background: rgba(16,185,129,0.1);
  color: #10b981;
}

.stats-table .status-badge.en-curso {
  background: rgba(59,130,246,0.1);
  color: #3b82f6;
}

/* Detalle empleado - Estilos adicionales */
.detalle-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}

.detalle-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-container);
  padding: 12px;
  border-radius: 10px;
}

.detalle-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.detalle-stat-content {
  display: flex;
  flex-direction: column;
}

.detalle-horario {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(20,184,166,0.1));
  border-radius: 10px;
  margin-bottom: 15px;
  font-size: 13px;
  color: var(--on-surface);
}

.detalle-horario i {
  color: #10b981;
}

.detalle-ultimas-sesiones {
  border-top: 1px solid var(--outline-variant);
  padding-top: 15px;
}

.detalle-ultimas-sesiones h5 {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-sesiones-list {
  max-height: 150px;
  overflow-y: auto;
}

.mini-sesion-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--outline-variant);
  font-size: 12px;
}

.mini-sesion-item:last-child {
  border-bottom: none;
}

.mini-sesion-fecha {
  color: var(--on-surface-variant);
  min-width: 65px;
}

.mini-sesion-hora {
  color: var(--on-surface);
  flex: 1;
  text-align: center;
}

.mini-sesion-duracion {
  font-weight: 600;
  color: var(--primary);
  min-width: 50px;
  text-align: right;
}

.no-data-mini {
  font-size: 12px;
  color: var(--on-surface-variant);
  text-align: center;
  padding: 20px;
}

/* Gráfico de horas */
.hour-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 150px;
  gap: 4px;
  padding: 10px 0;
}

.hour-bar-container {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.hour-bar {
  width: 100%;
  background: var(--outline-variant);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease, background 0.3s ease;
  cursor: pointer;
}

.hour-bar.activo {
  background: var(--gradient-primary);
}

.hour-bar:hover {
  opacity: 0.8;
}

.chart-hours-labels {
  display: flex;
  justify-content: space-between;
  padding: 8px 0 0;
  border-top: 1px solid var(--outline-variant);
}

.hour-label {
  font-size: 10px;
  color: var(--on-surface-variant);
}

/* Tabla de sesiones adicional */
.user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-cell i {
  color: var(--primary);
}

.duracion-badge {
  background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(20,184,166,0.1));
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
}

.status-badge.activo {
  background: rgba(59,130,246,0.1);
  color: #3b82f6;
}

.status-badge.finalizado {
  background: rgba(16,185,129,0.1);
  color: #10b981;
}

.sesion-activa {
  background: rgba(59,130,246,0.05);
}

.no-data-cell {
  text-align: center;
  padding: 40px !important;
  color: var(--on-surface-variant);
}

.no-data-cell i {
  margin-right: 8px;
  font-size: 16px;
}

.detalle-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--on-surface-variant);
  text-align: center;
}

.detalle-placeholder i {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.detalle-placeholder p {
  font-size: 14px;
  margin: 0;
}

.detalle-rol {
  font-size: 12px !important;
  color: var(--primary) !important;
  background: rgba(16,185,129,0.1);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Responsive */
@media (max-width: 1200px) {
  .stats-main-grid {
    grid-template-columns: 1fr 1fr;
  }

  .detalle-panel {
    grid-column: span 2;
  }

  .stats-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .detalle-panel {
    grid-column: span 1;
  }

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

  .stats-page-header {
    flex-direction: column;
  }

  .stats-search-section {
    width: 100%;
    flex-direction: column;
  }

  .stats-search-box {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--surface-container);
  border-top: 1px solid var(--outline-variant);
  font-size: 11px;
  color: var(--on-surface-variant);
  margin-top: auto;
  flex-wrap: wrap;
  gap: 8px;
}

.developer-credit {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-fast);
}

.developer-credit:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Large screens - ensure everything fits */
@media (min-width: 1400px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

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

/* Medium-large screens */
@media (max-width: 1399px) and (min-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Medium screens */
@media (max-width: 1023px) and (min-width: 769px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .admission-board {
    grid-template-columns: repeat(2, 1fr);
  }

  .top-bar-center {
    order: 3;
    flex-basis: 100%;
    margin-top: 10px;
  }

  .search-box {
    max-width: 100%;
  }
}

/* Small screens - mobile */
@media (max-width: 768px) {
  #app {
    grid-template-columns: 1fr;
  }

  /* Nav-rail ahora se maneja como drawer móvil - ver estilos más abajo */

  .main-content {
    margin-left: 0;
    max-width: 100vw;
  }

  .top-bar {
    padding: 10px 12px;
  }

  .search-box {
    display: none;
  }

  .user-name {
    display: none;
  }

  .section {
    padding: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 18px;
  }

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

  .admission-board {
    grid-template-columns: 1fr;
  }

  .evolucion-container {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 16px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE MENU (Hamburguesa)
   ═══════════════════════════════════════════════════════════════════════════ */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--on-surface);
  font-size: 20px;
  padding: 8px;
  margin-right: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}
.mobile-menu-btn:active {
  background: var(--surface-container-high);
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--surface);
  z-index: 1000;
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}
.mobile-menu.active {
  left: 0;
}

.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--outline-variant);
  background: var(--primary);
}
.mobile-menu-logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.5px;
}
.mobile-menu-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-menu-close:active {
  background: rgba(255,255,255,0.3);
}

.mobile-menu-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  color: var(--on-surface);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.95rem;
}
.mobile-menu-item:active {
  background: var(--surface-container-high);
}
.mobile-menu-item.active {
  background: var(--primary-container);
  color: var(--primary);
  font-weight: 600;
}
.mobile-menu-item i {
  width: 24px;
  text-align: center;
  font-size: 1.1rem;
}

.mobile-menu-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--outline-variant);
  text-align: center;
  font-size: 0.75rem;
  color: var(--on-surface-variant);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE FIXES - ALL SECTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

/* TABLET BREAKPOINT (992px) */
@media (max-width: 992px) {
  .stats-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .ficha-indicadores {
    grid-template-columns: repeat(2, 1fr);
  }

  .calendario-grid {
    gap: 4px;
  }

  .calendario-dia {
    min-height: 60px;
    padding: 6px;
    font-size: 0.8rem;
  }
}

/* MOBILE BREAKPOINT (768px) */
@media (max-width: 768px) {
  /* Stats Summary Cards */
  .stats-summary-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Ficha Indicadores */
  .ficha-indicadores {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Ficha Datos Grid */
  .ficha-datos-grid {
    grid-template-columns: 1fr;
  }

  /* Medicacion Grid */
  .medicacion-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Ficha Resumen y Antecedentes */
  .ficha-resumen-grid,
  .antecedentes-grid {
    grid-template-columns: 1fr;
  }

  /* Signos Form Grid */
  .signos-form-grid {
    grid-template-columns: 1fr;
  }

  /* Camas Grid */
  .camas-grid,
  .camas-disponibles-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Calendario - importante */
  .calendario-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
  }

  .calendario-dia {
    min-height: 45px;
    padding: 4px;
    font-size: 0.7rem;
  }

  .calendario-dia-numero {
    font-size: 0.75rem;
  }

  .calendario-eventos {
    display: none; /* Ocultar eventos en calendario mobile */
  }

  /* Config Section */
  .config-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .config-card {
    padding: 12px;
  }

  /* Farmacia Section */
  .farmacia-tab {
    padding: 12px;
  }

  .stock-filters {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .stock-filters .filter-chip {
    padding: 6px 10px;
    font-size: 11px;
  }

  .stock-filters select,
  .stock-filters input {
    width: 100%;
  }

  /* Data table mobile - scroll horizontal */
  .data-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 700px;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
  }

  .data-table thead th:first-child {
    background: var(--surface-container);
  }

  /* Evolución Timeline */
  .evolucion-item {
    padding: 12px;
  }

  .evolucion-item-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  /* Pacientes Section */
  .patient-item {
    padding: 10px;
  }

  .patient-avatar {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }

  .patient-info h4 {
    font-size: 0.9rem;
  }

  .patient-info p {
    font-size: 0.75rem;
  }

  /* Tables responsive */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  /* Modal responsive */
  .modal {
    width: 95%;
    max-width: 95%;
    margin: 10px;
    max-height: 90vh;
  }

  .modal-body {
    padding: 12px;
  }

  /* Cards generales */
  .card {
    padding: 12px;
  }

  .card-header {
    padding: 10px 12px;
  }

  /* Buttons */
  .btn-group {
    flex-direction: column;
    gap: 8px;
  }

  .btn-group .btn {
    width: 100%;
  }

  /* Forms */
  .form-actions {
    flex-direction: column;
    gap: 8px;
  }

  .form-actions .btn {
    width: 100%;
  }

  /* Top bar adjustments */
  .atajos-rapidos-hint {
    display: none;
  }
}

/* SMALL MOBILE (480px) */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .camas-grid,
  .camas-disponibles-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 14px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .top-bar {
    padding: 8px 10px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
  }

  /* Admission cards */
  .admission-card {
    padding: 10px;
  }

  .admission-card h4 {
    font-size: 0.85rem;
  }

  /* Calendario super pequeño */
  .calendario-dia {
    min-height: 35px;
    padding: 2px;
  }

  .calendario-dia-numero {
    font-size: 0.65rem;
  }

  /* Ficha paciente compact */
  .ficha-header {
    flex-direction: column;
    text-align: center;
  }

  .ficha-avatar {
    margin: 0 auto 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #eef2ff;
}

::-webkit-scrollbar-thumb {
  background: #93b4f5;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #1e40af;
}

/* ═══════════════════════════════════════════════════════════════════════════
   WELCOME LOADER OVERLAY - Círculos Animados
   ═══════════════════════════════════════════════════════════════════════════ */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 1;
  transition: opacity 0.8s ease-out;
  pointer-events: all;
}

.welcome-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.welcome-overlay.hidden {
  display: none;
}

/* Círculos que se expanden */
.welcome-overlay .circle {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.25);
  animation: welcomeExpandCircle 2.5s ease-out infinite;
}

.welcome-overlay .circle:nth-child(1) { animation-delay: 0s; }
.welcome-overlay .circle:nth-child(2) { animation-delay: 0.6s; }
.welcome-overlay .circle:nth-child(3) { animation-delay: 1.2s; }

@keyframes welcomeExpandCircle {
  0% {
    width: 80px;
    height: 80px;
    opacity: 0.8;
    border-color: rgba(16, 185, 129, 0.4);
  }
  100% {
    width: 500px;
    height: 500px;
    opacity: 0;
    border-color: rgba(16, 185, 129, 0);
  }
}

.welcome-overlay dotlottie-wc {
  width: 180px;
  height: 180px;
  position: relative;
  z-index: 1;
}

.welcome-overlay .welcome-text {
  text-align: center;
  margin-top: -15px;
  position: relative;
  z-index: 1;
}

.welcome-overlay .welcome-text h2 {
  color: #0f172a;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-overlay .welcome-text h2 .user-name-welcome {
  background: linear-gradient(135deg, #10b981, #14b8a6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-overlay .welcome-text p {
  color: #64748b;
  font-size: 15px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes highlightPulse {
  0% { background: rgba(16, 185, 129, 0.3); }
  50% { background: rgba(16, 185, 129, 0.15); }
  100% { background: transparent; }
}

.section.active {
  animation: fadeIn 0.3s ease;
}

.stat-card {
  animation: slideUp 0.4s ease;
}

.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.3s; }

/* ═══════════════════════════════════════════════════════════════════════════
   TIPO ATENCION SELECTOR - Botones grandes para evolución rápida
═══════════════════════════════════════════════════════════════════════════ */
.tipo-atencion-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .tipo-atencion-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .tipo-atencion-grid {
    grid-template-columns: 1fr;
  }
}

.tipo-atencion-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 25px 15px;
  background: linear-gradient(145deg, #ffffff, #f5f5f5);
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 120px;
}

.tipo-atencion-btn i {
  font-size: 2.5em;
  color: var(--primary);
  transition: transform 0.2s ease;
}

.tipo-atencion-btn span {
  font-size: 1.1em;
  font-weight: 600;
  color: #333;
}

.tipo-atencion-btn small {
  font-size: 0.75em;
  color: #888;
  text-align: center;
}

.tipo-atencion-btn:hover {
  border-color: var(--primary);
  background: linear-gradient(145deg, #f0f7ff, #e8f4ff);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(25, 118, 210, 0.15);
}

.tipo-atencion-btn:hover i {
  transform: scale(1.1);
}

.tipo-atencion-btn:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.2);
}

.tipo-atencion-btn.selected {
  background: var(--primary);
  border-color: var(--primary);
}

.tipo-atencion-btn.selected i,
.tipo-atencion-btn.selected span,
.tipo-atencion-btn.selected small {
  color: white;
}

/* Colores por tipo */
.tipo-atencion-btn[data-tipo="consulta"] i { color: #1976d2; }
.tipo-atencion-btn[data-tipo="control"] i { color: #388e3c; }
.tipo-atencion-btn[data-tipo="urgencia"] i { color: #d32f2f; }
.tipo-atencion-btn[data-tipo="interconsulta"] i { color: #7b1fa2; }

.tipo-atencion-btn[data-tipo="urgencia"]:hover {
  border-color: #d32f2f;
  background: linear-gradient(145deg, #fff5f5, #ffebee);
}

.tipo-atencion-btn[data-tipo="urgencia"]:focus {
  box-shadow: 0 0 0 4px rgba(211, 47, 47, 0.2);
}

/* Indicador de atajo de teclado */
.tipo-shortcut {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(0,0,0,0.08);
  color: #666;
  font-size: 11px;
  font-weight: 600;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tipo-atencion-btn {
  position: relative;
}

.tipo-atencion-btn:focus .tipo-shortcut,
.tipo-atencion-btn:hover .tipo-shortcut {
  background: var(--primary);
  color: white;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ACCIONES PRINCIPALES - Nueva Evolución / Ver Historial
═══════════════════════════════════════════════════════════════════════════ */
.acciones-principales-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.accion-principal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border: 2px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.accion-principal-btn i {
  font-size: 3em;
  color: var(--primary);
  transition: transform 0.2s ease;
}

.accion-principal-btn span {
  font-size: 1.3em;
  font-weight: 600;
  color: #333;
}

.accion-principal-btn small {
  font-size: 0.85em;
  color: #888;
}

.accion-principal-btn:hover {
  border-color: var(--primary);
  background: linear-gradient(145deg, #e3f2fd, #f0f7ff);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(25, 118, 210, 0.15);
}

.accion-principal-btn:hover i {
  transform: scale(1.15);
}

.accion-principal-btn:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.2);
}

.accion-principal-btn.accion-ver i {
  color: #7b1fa2;
}

.accion-principal-btn.accion-ver:hover {
  border-color: #7b1fa2;
  background: linear-gradient(145deg, #f3e5f5, #faf5fc);
  box-shadow: 0 12px 30px rgba(123, 31, 162, 0.15);
}

.accion-principal-btn.accion-ubicacion i {
  color: #f59e0b;
}

.accion-principal-btn.accion-ubicacion:hover {
  border-color: #f59e0b;
  background: linear-gradient(145deg, #fffbeb, #fef9e7);
  box-shadow: 0 12px 30px rgba(245, 158, 11, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FACTURACIÓN - DASHBOARD DE INDICADORES
═══════════════════════════════════════════════════════════════════════════ */

/* Grid de dashboard */
.facturacion-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

/* Tarjeta de dashboard - NO es un botón */
.dashboard-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  cursor: default;
  overflow: hidden;
}

/* Icono flotante en esquina */
.dashboard-card .card-icon-float {
  position: absolute;
  top: -10px;
  right: 15px;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.dashboard-card .card-icon-float i {
  font-size: 1.4em;
  color: white;
}

/* Header */
.dashboard-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  padding-right: 50px;
}

.dashboard-card .card-category {
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 1px;
  color: #999;
}

.dashboard-card .card-period {
  font-size: 0.65em;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Body - Monto principal */
.dashboard-card .card-body {
  margin-bottom: 15px;
}

.dashboard-card .card-main-amount {
  font-size: 2.2em;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.dashboard-card .card-subtitle {
  font-size: 0.75em;
  color: #888;
}

/* Sección de dona */
.dashboard-card .card-donut-section {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 12px;
  margin-bottom: 15px;
}

/* Gráfico de dona */
.donut-chart {
  width: 80px;
  height: 80px;
  position: relative;
  flex-shrink: 0;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-chart .donut-bg {
  fill: none;
  stroke: #e0e0e0;
  stroke-width: 3;
}

.donut-chart .donut-segment {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s ease;
}

.donut-chart .donut-segment.paid {
  stroke: #4caf50;
}

.donut-chart .donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-chart .donut-center span {
  font-size: 1.1em;
  font-weight: 700;
  color: #333;
}

.donut-chart .donut-center small {
  font-size: 0.6em;
  color: #888;
}

/* Breakdown */
.dashboard-card .card-breakdown {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-card .breakdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8em;
}

.dashboard-card .breakdown-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dashboard-card .breakdown-item.paid .breakdown-dot {
  background: linear-gradient(135deg, #4caf50, #66bb6a);
}

.dashboard-card .breakdown-item.pending .breakdown-dot {
  background: linear-gradient(135deg, #ff9800, #ffb74d);
}

.dashboard-card .breakdown-label {
  color: #666;
  flex: 1;
}

.dashboard-card .breakdown-value {
  font-weight: 600;
  color: #333;
}

/* Footer */
.dashboard-card .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px dashed #e0e0e0;
}

.dashboard-card .card-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8em;
  color: #666;
}

.dashboard-card .card-stat i {
  opacity: 0.5;
}

/* Mini barras (sparkline) */
.dashboard-card .card-mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 30px;
}

.dashboard-card .mini-bar {
  width: 6px;
  background: #e0e0e0;
  border-radius: 2px;
  transition: background 0.3s ease;
}

.dashboard-card .mini-bar.active {
  background: #4caf50;
}

/* Colores por tipo de tarjeta */
.card-profesionales .card-icon-float {
  background: linear-gradient(135deg, #1976d2, #1565c0);
}
.card-profesionales .card-main-amount { color: #1565c0; }
.card-profesionales .donut-segment.paid { stroke: #1976d2; }
.card-profesionales .mini-bar.active { background: #1976d2; }

.card-pacientes .card-icon-float {
  background: linear-gradient(135deg, #388e3c, #2e7d32);
}
.card-pacientes .card-main-amount { color: #2e7d32; }
.card-pacientes .donut-segment.paid { stroke: #388e3c; }
.card-pacientes .mini-bar.active { background: #388e3c; }

.card-farmacia .card-icon-float {
  background: linear-gradient(135deg, #7b1fa2, #6a1b9a);
}
.card-farmacia .card-main-amount { color: #6a1b9a; }
.card-farmacia .donut-segment.paid { stroke: #7b1fa2; }
.card-farmacia .mini-bar.active { background: #7b1fa2; }

/* Responsive */
@media (max-width: 992px) {
  .facturacion-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card .card-donut-section {
    flex-direction: column;
    text-align: center;
  }
}

/* Selector de botones */
.facturacion-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 15px;
}

.facturacion-tipo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 35px 20px;
  background: linear-gradient(145deg, #ffffff, #f8f9fa);
  border: 3px solid #e0e0e0;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.facturacion-tipo-btn i {
  font-size: 2.5em;
  transition: transform 0.2s ease;
}

.facturacion-tipo-btn span {
  font-size: 1.2em;
  font-weight: 600;
  color: #333;
}

.facturacion-tipo-btn small {
  font-size: 0.8em;
  color: #888;
}

.facturacion-tipo-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.facturacion-tipo-btn:hover i {
  transform: scale(1.15);
}

/* Focus state muy visible */
.facturacion-tipo-btn:focus {
  outline: none;
  transform: translateY(-4px) scale(1.02);
}

.facturacion-tipo-btn:focus .tipo-shortcut {
  background: white;
  transform: scale(1.2);
}

/* Colores por tipo de facturación */
.facturacion-tipo-btn[data-tipo="profesionales"] i { color: #1976d2; }
.facturacion-tipo-btn[data-tipo="profesionales"]:hover,
.facturacion-tipo-btn[data-tipo="profesionales"]:focus {
  border-color: #1976d2;
  background: linear-gradient(145deg, #e3f2fd, #f0f7ff);
  box-shadow: 0 12px 30px rgba(25, 118, 210, 0.25), 0 0 0 4px rgba(25, 118, 210, 0.15);
}
.facturacion-tipo-btn[data-tipo="profesionales"]:focus .tipo-shortcut {
  color: #1976d2;
}

.facturacion-tipo-btn[data-tipo="pacientes"] i { color: #388e3c; }
.facturacion-tipo-btn[data-tipo="pacientes"]:hover,
.facturacion-tipo-btn[data-tipo="pacientes"]:focus {
  border-color: #388e3c;
  background: linear-gradient(145deg, #e8f5e9, #f1f8e9);
  box-shadow: 0 12px 30px rgba(56, 142, 60, 0.25), 0 0 0 4px rgba(56, 142, 60, 0.15);
}
.facturacion-tipo-btn[data-tipo="pacientes"]:focus .tipo-shortcut {
  color: #388e3c;
}

.facturacion-tipo-btn[data-tipo="farmacia"] i { color: #7b1fa2; }
.facturacion-tipo-btn[data-tipo="farmacia"]:hover,
.facturacion-tipo-btn[data-tipo="farmacia"]:focus {
  border-color: #7b1fa2;
  background: linear-gradient(145deg, #f3e5f5, #faf5fc);
  box-shadow: 0 12px 30px rgba(123, 31, 162, 0.25), 0 0 0 4px rgba(123, 31, 162, 0.15);
}
.facturacion-tipo-btn[data-tipo="farmacia"]:focus .tipo-shortcut {
  color: #7b1fa2;
}

/* Hint de teclado */
.facturacion-hint {
  text-align: center;
  color: #888;
  font-size: 0.85em;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.facturacion-hint i {
  color: var(--primary);
}

/* Header simple de facturación */
.facturacion-header-simple {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
}

.facturacion-header-simple h2 {
  font-size: 1.8em;
  color: var(--primary);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.facturacion-header-simple h2 i {
  font-size: 0.9em;
}

.facturacion-header-simple p {
  color: #666;
  margin: 0;
  font-size: 1em;
}

/* Selector de mes con nombre y año */
.mes-selector {
  min-width: 180px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 35px;
}

.mes-selector:hover {
  border-color: var(--primary);
}

.mes-selector:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.15);
}

.mes-selector option {
  padding: 10px;
  font-size: 14px;
}

/* Header del panel de facturación */
.facturacion-panel-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e0e0e0;
}

.facturacion-panel-header h3 {
  font-size: 1.4em;
  color: #333;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.facturacion-panel-header h3 i {
  color: var(--primary);
}

.btn-volver-facturacion {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 10px;
  color: #555;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-volver-facturacion:hover {
  background: #e0e0e0;
  color: #333;
}

.btn-volver-facturacion i {
  font-size: 0.9em;
}

/* Responsive para facturación */
@media (max-width: 992px) {
  .facturacion-stats-grid {
    grid-template-columns: 1fr;
  }

  .facturacion-stat-card {
    min-height: auto;
  }

  .facturacion-selector-grid {
    grid-template-columns: 1fr;
  }

  .facturacion-tipo-btn {
    padding: 25px 15px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 20px;
  }

  .facturacion-tipo-btn i {
    font-size: 2em;
  }

  .facturacion-tipo-btn .tipo-shortcut {
    top: 50%;
    transform: translateY(-50%);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FICHA PACIENTE HISTORIAL
═══════════════════════════════════════════════════════════════════════════ */
.ficha-paciente-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 25px;
  color: white;
  margin-bottom: 25px;
  display: flex;
  gap: 25px;
  align-items: flex-start;
}

.ficha-paciente-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5em;
  font-weight: 600;
  flex-shrink: 0;
  border: 3px solid rgba(255,255,255,0.3);
}

.ficha-paciente-info {
  flex: 1;
}

.ficha-paciente-info h2 {
  margin: 0 0 8px 0;
  font-size: 1.8em;
  font-weight: 600;
}

.ficha-paciente-datos {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 15px;
}

.ficha-dato {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9em;
}

.ficha-dato i {
  opacity: 0.8;
}

.ficha-evoluciones {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e0e0e0;
}

.evolucion-timeline-ficha {
  max-height: 500px;
  overflow-y: auto;
}

.evolucion-item {
  background: #f8f9fa;
  border-left: 4px solid var(--primary);
  border-radius: 0 12px 12px 0;
  padding: 18px;
  margin-bottom: 15px;
  transition: all 0.2s ease;
}

.evolucion-item:hover {
  background: #f0f7ff;
  transform: translateX(5px);
}

.evolucion-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.evolucion-tipo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
}

.evolucion-tipo-badge.consulta { background: #e3f2fd; color: #1565c0; }
.evolucion-tipo-badge.control { background: #e8f5e9; color: #2e7d32; }
.evolucion-tipo-badge.urgencia { background: #ffebee; color: #c62828; }
.evolucion-tipo-badge.interconsulta { background: #f3e5f5; color: #7b1fa2; }

.evolucion-fecha {
  color: #888;
  font-size: 0.85em;
}

.evolucion-contenido p {
  margin: 0 0 8px 0;
  color: #333;
  line-height: 1.5;
}

.evolucion-profesional {
  color: #666;
  font-size: 0.85em;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #ddd;
}

@media (max-width: 600px) {
  .acciones-principales-grid {
    grid-template-columns: 1fr;
  }
  .ficha-paciente-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .ficha-paciente-datos {
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FICHA PACIENTE FLOTANTE
═══════════════════════════════════════════════════════════════════════════ */
.ficha-flotante-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s ease;
}

.ficha-flotante-overlay.active {
  opacity: 1;
  visibility: visible;
}

.ficha-flotante {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: 96%;
  max-width: 1050px;
  max-height: 90vh;
  background: #f8fafc;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0,0,0,0.06);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ficha-flotante.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* Header de la ficha flotante */
.ficha-flotante-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
  position: relative;
  overflow: hidden;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.ficha-flotante-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.1), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.ficha-flotante-header::after {
  display: none;
}

.ficha-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.ficha-mini-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.2);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.ficha-mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ficha-header-info h2 {
  margin: 0 0 4px 0;
  font-size: 1.15em;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ficha-header-datos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8em;
  opacity: 0.8;
}

.ficha-header-datos span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ficha-categoria-chip {
  background: rgba(255,255,255,0.12);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255,255,255,0.15);
}

.ficha-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.ficha-header-actions .btn-primary,
.ficha-header-actions .btn-cambiar-ubicacion,
.ficha-header-actions .btn-calendario-paciente {
  border-radius: 8px !important;
  font-size: 0.78em !important;
  padding: 6px 12px !important;
  background: rgba(255,255,255,0.1) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  color: white !important;
  backdrop-filter: blur(4px);
  transition: all 0.2s;
}

.ficha-header-actions .btn-primary:hover,
.ficha-header-actions .btn-cambiar-ubicacion:hover,
.ficha-header-actions .btn-calendario-paciente:hover {
  background: rgba(255,255,255,0.22) !important;
  border-color: rgba(255,255,255,0.3) !important;
}

.btn-sm {
  padding: 8px 16px !important;
  font-size: 0.9em !important;
}

.btn-icon-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-close:hover {
  background: rgba(239,68,68,0.3);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.3);
}

/* Tabs de la ficha */
.ficha-flotante > .ficha-tabs {
  display: flex;
  background: #1e293b;
  padding: 5px 14px;
  gap: 2px;
  overflow-x: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.ficha-flotante > .ficha-tabs > .ficha-tab {
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.55) !important;
  font-size: 0.82em;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  border-bottom: none !important;
}

.ficha-flotante > .ficha-tabs > .ficha-tab:hover {
  color: rgba(255,255,255,0.85) !important;
  background: rgba(255,255,255,0.08) !important;
}

.ficha-flotante > .ficha-tabs > .ficha-tab.active {
  color: white !important;
  background: var(--primary) !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,137,123,0.3);
  border-bottom-color: transparent !important;
}

/* Contenido de la ficha */
.ficha-flotante > .ficha-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #f8fafc;
  position: relative;
  z-index: 1;
}

.ficha-tab-content {
  display: none;
  padding: 16px 18px;
  animation: fichaFadeIn 0.25s ease;
}

.ficha-tab-content.active {
  display: block;
}

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

/* TAB INICIO - Grid de contenido */
.ficha-inicio-grid {
  display: grid;
  gap: 14px;
}

/* Indicadores rapidos */
.ficha-indicadores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ficha-indicador {
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ficha-indicador:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.ficha-indicador:nth-child(1) { background: linear-gradient(135deg, #10b981, #059669); }
.ficha-indicador:nth-child(2) { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.ficha-indicador:nth-child(3) { background: linear-gradient(135deg, #f59e0b, #d97706); }

.ficha-indicador::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -15%;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  pointer-events: none;
}

.indicador-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  background: rgba(255,255,255,0.2);
  color: white;
  flex-shrink: 0;
}

.indicador-icon.green,
.indicador-icon.blue,
.indicador-icon.orange {
  background: rgba(255,255,255,0.2);
  color: white;
}

.indicador-info {
  display: flex;
  flex-direction: column;
}

.indicador-valor {
  font-size: 1.4em;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.indicador-label {
  font-size: 0.72em;
  color: rgba(255,255,255,0.85);
  margin-top: 2px;
  font-weight: 500;
}

/* Secciones del inicio */
.ficha-seccion {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.2s;
}

.ficha-seccion:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ficha-seccion h4 {
  margin: 0 0 12px 0;
  font-size: 0.88em;
  font-weight: 600;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 7px;
}

.ficha-seccion h4 i {
  color: var(--primary);
  font-size: 0.88em;
}

.ficha-seccion-full {
  grid-column: 1 / -1;
}

/* Lista de actividad */
.ficha-actividad-list {
  max-height: 250px;
  overflow-y: auto;
}

.actividad-item {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f0f0f0;
}

.actividad-item:last-child {
  border-bottom: none;
}

.actividad-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82em;
  flex-shrink: 0;
}

.actividad-icon.evolucion {
  background: #e8f5e9;
  color: #2e7d32;
}

.actividad-icon.medicamento {
  background: #e3f2fd;
  color: #1976d2;
}

.actividad-icon.factura {
  background: #fff3e0;
  color: #f57c00;
}

.actividad-content {
  flex: 1;
}

.actividad-content strong {
  display: block;
  font-size: 0.9em;
  color: #333;
}

.actividad-content small {
  color: #888;
  font-size: 0.8em;
}

.actividad-fecha {
  font-size: 0.75em;
  color: #999;
  white-space: nowrap;
}

/* Actividades en ficha del paciente - Estilo timeline */
.actividad-item-ficha {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: #f8fafc;
  border-radius: 10px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.actividad-item-ficha:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.actividad-icon-ficha {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  flex-shrink: 0;
}

.actividad-content-ficha {
  flex: 1;
  min-width: 0;
}

.actividad-titulo-ficha {
  font-weight: 600;
  font-size: 0.9em;
  color: #333;
  margin-bottom: 3px;
}

.actividad-desc-ficha {
  font-size: 0.85em;
  color: #555;
  margin-bottom: 5px;
  line-height: 1.3;
}

.actividad-meta-ficha {
  display: flex;
  gap: 12px;
  font-size: 0.75em;
  color: #888;
}

.actividad-meta-ficha span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.actividad-meta-ficha i {
  font-size: 0.9em;
}

/* Iconos compactos de medicamentos asignados */
.ficha-meds-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.med-icon-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 72px;
  max-width: 90px;
  position: relative;
  overflow: hidden;
}

.med-icon-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #3b82f6);
}

.med-icon-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.med-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.med-icon-circle i {
  color: white;
  font-size: 15px;
}

.med-icon-nombre {
  font-size: 0.72em;
  font-weight: 600;
  color: #1e293b;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.med-icon-frecuencia {
  font-size: 0.65em;
  color: var(--primary);
  font-weight: 600;
  margin-top: 3px;
}

/* Boton pequeno para asignar */
.btn-xs {
  padding: 5px 10px;
  font-size: 0.75em;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.btn-xs.btn-primary {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: white;
  box-shadow: 0 2px 6px rgba(0,137,123,0.2);
}

.btn-xs.btn-primary:hover {
  box-shadow: 0 4px 10px rgba(0,137,123,0.3);
  transform: translateY(-1px);
}

/* Sección de Medicación Asignada en Ficha (legacy) */
.ficha-medicacion-section {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 2px solid #e5e5e5;
}

.ficha-medicacion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.ficha-medicacion-header h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
}

.ficha-medicacion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

/* Card de medicamento asignado */
.medicacion-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  position: relative;
  transition: all 0.25s ease;
  overflow: hidden;
}

.medicacion-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #3b82f6);
  border-radius: 16px 16px 0 0;
}

.medicacion-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.medicacion-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.medicacion-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1em;
  flex-shrink: 0;
}

.medicacion-info {
  flex: 1;
  min-width: 0;
}

.medicacion-nombre {
  font-weight: 700;
  font-size: 1em;
  color: #1e293b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.medicacion-presentacion {
  font-size: 0.8em;
  color: #64748b;
}

.medicacion-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.medicacion-dato {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
}

.medicacion-dato i {
  color: var(--primary);
  width: 16px;
  text-align: center;
}

.medicacion-dato-label {
  color: #64748b;
}

.medicacion-dato-valor {
  font-weight: 600;
  color: #334155;
}

.medicacion-frecuencia-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
}

.medicacion-via-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f0fdf4;
  color: #166534;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 500;
  text-transform: capitalize;
}

.medicacion-indicaciones {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 8px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 0.8em;
  color: #92400e;
  margin-top: 10px;
}

.medicacion-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
  font-size: 0.75em;
  color: #94a3b8;
}

.medicacion-asignado-por {
  display: flex;
  align-items: center;
  gap: 6px;
}

.medicacion-asignado-por img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.medicacion-acciones {
  display: flex;
  gap: 6px;
}

.medicacion-acciones button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.medicacion-acciones .btn-edit {
  background: #e0f2fe;
  color: #0284c7;
}

.medicacion-acciones .btn-edit:hover {
  background: #0284c7;
  color: white;
}

.medicacion-acciones .btn-delete {
  background: #fee2e2;
  color: #dc2626;
}

.medicacion-acciones .btn-delete:hover {
  background: #dc2626;
  color: white;
}

.medicacion-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
}

.medicacion-empty i {
  font-size: 3em;
  margin-bottom: 15px;
  opacity: 0.5;
}

.medicacion-empty p {
  margin: 0;
  font-size: 0.95em;
}

/* Lista de medicamentos */
.ficha-meds-list {
  max-height: 150px;
  overflow-y: auto;
}

.med-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9em;
}

.med-item:last-child {
  border-bottom: none;
}

.med-nombre {
  color: #333;
}

.med-fecha {
  color: #888;
  font-size: 0.85em;
}

/* Lista de patologías */
.ficha-patologias-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.patologia-chip {
  background: #fff3e0;
  color: #e65100;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85em;
}

/* TAB DATOS - Grid de datos */
.ficha-datos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.dato-grupo {
  background: white;
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.dato-grupo:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.dato-grupo h5 {
  margin: 0;
  color: white;
  font-size: 0.82em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-bottom: none;
  letter-spacing: 0.3px;
}

/* Colores por tipo de grupo */
.dato-grupo:nth-child(1) h5 { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.dato-grupo:nth-child(2) h5 { background: linear-gradient(135deg, #10b981, #059669); }
.dato-grupo:nth-child(3) h5 { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.dato-grupo:nth-child(4) h5 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dato-grupo:nth-child(5) h5 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.dato-grupo:nth-child(6) h5 { background: linear-gradient(135deg, #ef4444, #dc2626); }
.dato-grupo:nth-child(7) h5 { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.dato-grupo h5 i {
  color: rgba(255,255,255,0.9);
}

.dato-campo {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid #f3f4f6;
  transition: background 0.15s;
}

.dato-campo:hover {
  background: #f9fafb;
}

.dato-campo:last-child {
  border-bottom: none;
}

.dato-label {
  color: #64748b;
  font-size: 0.8em;
  font-weight: 500;
}

.dato-valor {
  color: #1e293b;
  font-weight: 600;
  font-size: 0.82em;
}

/* TAB HISTORIA CLÍNICA - Estilo macOS/iOS */

/* Summary strip */
.hc-summary-strip {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.hc-summary-item {
  flex: 1;
  background: white;
  border-radius: 10px;
  padding: 10px 14px;
  text-align: center;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.hc-summary-number {
  display: block;
  font-size: 1.2em;
  font-weight: 700;
  color: #1d1d1f;
  line-height: 1.2;
}

.hc-summary-label {
  display: block;
  font-size: 0.7em;
  color: #86868b;
  margin-top: 1px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Barra de búsqueda Spotlight */
.hc-search-bar {
  position: relative;
  margin-bottom: 12px;
}

.hc-search-bar input {
  width: 100%;
  padding: 11px 16px 11px 40px;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  font-size: 0.9em;
  background: white;
  color: #1d1d1f;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  outline: none;
}

.hc-search-bar input::placeholder {
  color: #86868b;
}

.hc-search-bar input:focus {
  border-color: rgba(0,122,255,0.4);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.1), 0 1px 3px rgba(0,0,0,0.04);
}

.hc-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #86868b;
  font-size: 0.85em;
}

/* Segmented control tipo iOS */
.hc-segmented-control {
  display: flex;
  background: rgba(0,0,0,0.04);
  border-radius: 9px;
  padding: 2px;
  margin-bottom: 18px;
  gap: 1px;
  overflow-x: auto;
}

.hc-segment {
  flex: 1;
  padding: 7px 12px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-size: 0.8em;
  font-weight: 500;
  color: #1d1d1f;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  min-width: 0;
}

.hc-segment:hover {
  background: rgba(0,0,0,0.04);
}

.hc-segment.active {
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  font-weight: 600;
}

.hc-segment i {
  font-size: 0.9em;
  opacity: 0.7;
}

.hc-segment.active i {
  opacity: 1;
}

/* Timeline de evoluciones - estilo limpio */
.ficha-historia-timeline {
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.ficha-historia-timeline::-webkit-scrollbar {
  width: 6px;
}

.ficha-historia-timeline::-webkit-scrollbar-track {
  background: transparent;
}

.ficha-historia-timeline::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 3px;
}

/* Agrupador por fecha */
.hc-date-group {
  margin-bottom: 6px;
}

.hc-date-label {
  font-size: 0.78em;
  font-weight: 600;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 4px 6px;
  position: sticky;
  top: 0;
  background: #fafafa;
  z-index: 1;
}

/* Card de evolución - estilo Apple */
.hc-evo-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 8px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.2s ease;
  cursor: default;
}

.hc-evo-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-color: rgba(0,0,0,0.1);
}

.hc-evo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.hc-evo-tipo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hc-evo-tipo.consulta {
  background: #eff6ff;
  color: #2563eb;
}

.hc-evo-tipo.control {
  background: #f0fdf4;
  color: #16a34a;
}

.hc-evo-tipo.urgencia {
  background: #fef2f2;
  color: #dc2626;
}

.hc-evo-tipo.interconsulta {
  background: #faf5ff;
  color: #9333ea;
}

.hc-evo-hora {
  font-size: 0.78em;
  color: #86868b;
  font-weight: 500;
}

.hc-evo-body {
  font-size: 0.88em;
  line-height: 1.55;
  color: #333;
}

.hc-evo-body p {
  margin: 0 0 6px 0;
}

.hc-evo-body p:last-child {
  margin-bottom: 0;
}

.hc-evo-diagnostico {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f5f5f7;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85em;
  color: #1d1d1f;
  font-weight: 500;
  margin-bottom: 8px;
}

.hc-evo-indicaciones {
  background: #fffbeb;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 0.85em;
  color: #92400e;
  border: 1px solid rgba(245,158,11,0.15);
}

.hc-evo-indicaciones strong {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
  font-size: 0.9em;
  color: #b45309;
}

.hc-evo-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.05);
  font-size: 0.8em;
  color: #86868b;
}

.hc-evo-footer i {
  font-size: 0.95em;
}

/* Empty state */
.hc-empty-state {
  text-align: center;
  padding: 50px 20px;
  color: #86868b;
}

.hc-empty-state i {
  font-size: 2.5em;
  margin-bottom: 12px;
  opacity: 0.4;
}

.hc-empty-state p {
  font-size: 0.9em;
  font-weight: 500;
}

/* Legacy compat - keep old header hidden */
.ficha-historia-header {
  display: none;
}

.ficha-historia-header input,
.ficha-historia-header select {
  display: none;
}

/* Responsive */
@media (max-width: 600px) {
  .hc-summary-strip {
    flex-direction: column;
    gap: 8px;
  }
  .hc-segmented-control {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .hc-segment {
    min-width: max-content;
    padding: 7px 10px;
    font-size: 0.75em;
  }
}

/* TAB FACTURACIÓN */
.ficha-facturacion-resumen {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.facturacion-stat {
  background: white;
  border-radius: 16px;
  padding: 22px;
  text-align: center;
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.facturacion-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.facturacion-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.facturacion-stat:nth-child(1)::before { background: linear-gradient(90deg, #10b981, #34d399); }
.facturacion-stat:nth-child(2)::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.facturacion-stat:nth-child(3)::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

.facturacion-stat .stat-label {
  display: block;
  color: #64748b;
  font-size: 0.82em;
  margin-bottom: 8px;
  font-weight: 500;
}

.facturacion-stat .stat-valor {
  font-size: 1.8em;
  font-weight: 800;
}

.facturacion-stat .stat-valor.green { color: #059669; }
.facturacion-stat .stat-valor.orange { color: #d97706; }
.facturacion-stat .stat-valor.blue { color: #2563eb; }

.ficha-facturacion-tabla {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

/* Responsive para ficha flotante */
@media (max-width: 900px) {
  .ficha-flotante {
    width: 99%;
    max-height: 96vh;
    border-radius: 18px;
  }

  .ficha-indicadores {
    grid-template-columns: 1fr;
  }

  .ficha-datos-grid {
    grid-template-columns: 1fr;
  }

  .ficha-facturacion-resumen {
    grid-template-columns: 1fr;
  }

  .ficha-flotante-header {
    padding: 14px 16px;
    gap: 8px;
  }

  .ficha-header-left {
    gap: 10px;
    min-width: 0;
  }

  .ficha-mini-avatar {
    width: 44px;
    height: 44px;
    font-size: 1em;
    flex-shrink: 0;
  }

  .ficha-header-info h2 {
    font-size: 1.05em;
    margin-bottom: 2px;
  }

  .ficha-header-datos {
    gap: 8px;
    font-size: 0.78em;
  }

  .ficha-header-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .ficha-tabs {
    overflow-x: auto;
    padding: 6px 10px;
    gap: 3px;
  }

  .ficha-tab {
    padding: 8px 14px;
    font-size: 0.82em;
  }

  .ficha-comidas-hoy {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PANTALLA SIN PERMISOS - D'Agostini Sistemas
   ═══════════════════════════════════════════════════════════════════════════ */

.no-permisos-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f8fcfb 0%, #e8f5e9 50%, #f8fcfb 100%);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeInOverlay 0.5s ease;
}

.no-permisos-overlay.active {
  display: flex;
}

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

.no-permisos-content {
  text-align: center;
  max-width: 500px;
  padding: 40px;
}

/* Logo D'Agostini con animación */
.no-permisos-animation {
  margin-bottom: 40px;
}

.dagostini-logo {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto;
}

.logo-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 40px rgba(0, 137, 123, 0.4),
    inset 0 -3px 10px rgba(0, 0, 0, 0.1),
    inset 0 3px 10px rgba(255, 255, 255, 0.2);
  z-index: 10;
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); }
  50% { transform: translate(-50%, -50%) translateY(-8px); }
}

.logo-inner {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.logo-d {
  font-family: 'Inter', sans-serif;
  font-size: 48px;
  font-weight: 800;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  letter-spacing: -2px;
}

/* Pulsos animados */
.logo-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border: 3px solid var(--primary);
  border-radius: 50%;
  animation: pulse 2s ease-out infinite;
  opacity: 0;
}

.logo-pulse.delay-1 {
  animation-delay: 0.6s;
}

.logo-pulse.delay-2 {
  animation-delay: 1.2s;
}

@keyframes pulse {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.6;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* Textos */
.no-permisos-text h1 {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 25px;
  letter-spacing: -0.5px;
}

.no-permisos-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(145deg, #fff3e0, #ffe0b2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 25px rgba(245, 124, 0, 0.25);
}

.no-permisos-icon i {
  font-size: 30px;
  color: #f57c00;
}

.no-permisos-text h2 {
  font-size: 1.4em;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.no-permisos-text p {
  font-size: 1em;
  color: #666;
  margin-bottom: 8px;
}

.no-permisos-text p strong {
  color: var(--primary);
}

.no-permisos-subtitle {
  font-size: 0.9em !important;
  color: #888 !important;
  margin-top: 5px;
}

/* Info del usuario */
.no-permisos-info {
  display: flex;
  gap: 25px;
  justify-content: center;
  margin: 30px 0;
  padding: 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid #eee;
}

.no-permisos-info .info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #555;
}

.no-permisos-info .info-item i {
  color: var(--primary);
  font-size: 1.1em;
}

.no-permisos-info .info-item strong {
  color: #333;
}

/* Botón logout */
.btn-logout-permisos {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 137, 123, 0.35);
}

.btn-logout-permisos:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 137, 123, 0.45);
}

.btn-logout-permisos:active {
  transform: translateY(0);
}

/* Footer */
.no-permisos-footer {
  margin-top: 50px;
  padding-top: 25px;
  border-top: 1px solid #e0e0e0;
  font-size: 0.85em;
  color: #999;
}

.no-permisos-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-left: 5px;
  transition: color 0.2s;
}

.no-permisos-footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 600px) {
  .no-permisos-content {
    padding: 30px 20px;
  }

  .no-permisos-info {
    flex-direction: column;
    gap: 15px;
  }

  .logo-circle {
    width: 80px;
    height: 80px;
  }

  .logo-inner {
    width: 65px;
    height: 65px;
  }

  .logo-d {
    font-size: 38px;
  }

  .logo-pulse {
    width: 80px;
    height: 80px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTÓN CHECK CIRCULAR - Para contabilizar servicios
   ═══════════════════════════════════════════════════════════════════════════ */

.btn-check-circular {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #d1d5db;
  background: #f9fafb;
  color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.btn-check-circular:hover {
  border-color: #22c55e;
  background: #f0fdf4;
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

.btn-check-circular i {
  color: transparent;
  font-size: 16px;
  transition: color 0.2s ease;
}

.btn-check-circular:hover i {
  color: #22c55e;
}

.btn-check-circular.checked {
  border-color: #22c55e;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-check-circular.checked i {
  color: white !important;
  font-size: 16px !important;
  font-weight: bold;
  display: block !important;
}

.btn-check-circular.checked:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: #15803d;
  transform: scale(1.1);
}

/* Fila contabilizada */
.row-contabilizado {
  background: #f0fdf4 !important;
}

.row-contabilizado td {
  color: #166534;
}

/* Status badge para contabilizado */
.status-badge.contabilizado {
  background: #dcfce7;
  color: #166534;
}

.status-badge.pendiente {
  background: #fef3c7;
  color: #92400e;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL DE CONFIRMACIÓN PERSONALIZADO
   ═══════════════════════════════════════════════════════════════════════════ */

.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999998;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.confirm-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.confirm-modal {
  background: white;
  padding: 32px 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.35);
  max-width: 400px;
  width: 90%;
  animation: confirmSlideIn 0.3s ease forwards;
}

@keyframes confirmSlideIn {
  0% {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.confirm-modal-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: confirmIconPulse 2s ease-in-out infinite;
}

.confirm-modal-icon i {
  font-size: 28px;
  color: #dc2626;
}

.confirm-modal-icon.warning {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.confirm-modal-icon.warning i {
  color: #d97706;
}

.confirm-modal-icon.info {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.confirm-modal-icon.info i {
  color: #2563eb;
}

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

.confirm-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 10px 0;
}

.confirm-modal-message {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 28px 0;
  line-height: 1.5;
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-modal-btn {
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border: none;
}

.confirm-modal-btn.cancel {
  background: #f1f5f9;
  color: #64748b;
}

.confirm-modal-btn.cancel:hover {
  background: #e2e8f0;
  color: #475569;
}

.confirm-modal-btn.confirm {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.confirm-modal-btn.confirm:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.confirm-modal-btn.confirm.success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.confirm-modal-btn.confirm.success:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADER DE ELIMINACIÓN CON TACHITO DE BASURA
   ═══════════════════════════════════════════════════════════════════════════ */

.delete-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.delete-loader-overlay.active {
  display: flex;
  opacity: 1;
}

.delete-loader-overlay.fade-out {
  opacity: 0;
}

.delete-loader-content {
  background: white;
  padding: 40px 50px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: deletePopIn 0.4s ease forwards;
}

@keyframes deletePopIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.trash-animation {
  width: 80px;
  height: 100px;
  margin: 0 auto 20px;
  position: relative;
}

.trash-can {
  position: relative;
  width: 60px;
  margin: 0 auto;
}

.trash-lid {
  width: 70px;
  height: 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 4px 4px 0 0;
  position: relative;
  left: -5px;
  animation: lidOpen 0.6s ease-in-out infinite alternate;
  transform-origin: left center;
}

.trash-lid::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 10px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 4px 4px 0 0;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
}

@keyframes lidOpen {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-25deg); }
}

.trash-body {
  width: 60px;
  height: 70px;
  background: linear-gradient(135deg, #f87171, #ef4444);
  border-radius: 0 0 8px 8px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px;
  box-sizing: border-box;
}

.trash-line {
  width: 4px;
  height: 45px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
}

.falling-items {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 60px;
}

.falling-item {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fbbf24;
  border-radius: 3px;
  opacity: 0;
}

.falling-item.item-1 {
  left: 5px;
  animation: fallIn 1.2s ease-in infinite;
  animation-delay: 0s;
  background: #60a5fa;
}

.falling-item.item-2 {
  left: 15px;
  animation: fallIn 1.2s ease-in infinite;
  animation-delay: 0.2s;
  background: #34d399;
}

.falling-item.item-3 {
  left: 25px;
  animation: fallIn 1.2s ease-in infinite;
  animation-delay: 0.4s;
  background: #f472b6;
}

@keyframes fallIn {
  0% {
    opacity: 1;
    transform: translateY(-30px) rotate(0deg);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(50px) rotate(180deg);
  }
}

.delete-message {
  font-size: 18px;
  font-weight: 600;
  color: #ef4444;
  margin: 0;
  animation: deletePulse 1s ease-in-out infinite;
}

@keyframes deletePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADER DE CONFIRMACIÓN CON TIC VERDE
   ═══════════════════════════════════════════════════════════════════════════ */

.success-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.success-loader-overlay.active {
  display: flex;
  opacity: 1;
}

.success-loader-overlay.fade-out {
  opacity: 0;
}

.success-loader-content {
  background: white;
  padding: 40px 50px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.8);
  animation: successPopIn 0.4s ease forwards;
}

@keyframes successPopIn {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.success-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  position: relative;
}

.check-icon {
  width: 80px;
  height: 80px;
  position: relative;
  border-radius: 50%;
  box-sizing: content-box;
  border: 4px solid #4CAF50;
}

.check-icon::before {
  top: 3px;
  left: -2px;
  width: 30px;
  transform-origin: 100% 50%;
  border-radius: 100px 0 0 100px;
}

.check-icon::after {
  top: 0;
  left: 30px;
  width: 60px;
  transform-origin: 0 50%;
  border-radius: 0 100px 100px 0;
  animation: rotate-circle 4.25s ease-in;
}

.check-icon::before, .check-icon::after {
  content: '';
  height: 100px;
  position: absolute;
  background: #FFFFFF;
  transform: rotate(-45deg);
}

.icon-line {
  height: 5px;
  background-color: #4CAF50;
  display: block;
  border-radius: 2px;
  position: absolute;
  z-index: 10;
}

.icon-line.line-tip {
  top: 46px;
  left: 14px;
  width: 25px;
  transform: rotate(45deg);
  animation: icon-line-tip 0.75s ease forwards;
}

.icon-line.line-long {
  top: 38px;
  right: 8px;
  width: 47px;
  transform: rotate(-45deg);
  animation: icon-line-long 0.75s ease forwards;
}

@keyframes icon-line-tip {
  0% { width: 0; left: 1px; top: 19px; }
  54% { width: 0; left: 1px; top: 19px; }
  70% { width: 50px; left: -8px; top: 37px; }
  84% { width: 17px; left: 21px; top: 48px; }
  100% { width: 25px; left: 14px; top: 46px; }
}

@keyframes icon-line-long {
  0% { width: 0; right: 46px; top: 54px; }
  65% { width: 0; right: 46px; top: 54px; }
  84% { width: 55px; right: 0px; top: 35px; }
  100% { width: 47px; right: 8px; top: 38px; }
}

.icon-circle {
  top: -4px;
  left: -4px;
  z-index: 10;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: absolute;
  box-sizing: content-box;
  border: 4px solid rgba(76, 175, 80, 0.5);
}

.icon-fix {
  top: 8px;
  width: 5px;
  left: 26px;
  z-index: 1;
  height: 85px;
  position: absolute;
  transform: rotate(-45deg);
  background-color: #FFFFFF;
}

.success-message {
  margin: 0;
  font-size: 1.1em;
  font-weight: 600;
  color: #333;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMACIÓN DE DESTELLO PARA FILA NUEVA
   ═══════════════════════════════════════════════════════════════════════════ */

.row-flash-highlight {
  animation: rowFlash 0.5s ease-in-out 3;
  position: relative;
}

.row-flash-highlight::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  animation: rowGlow 0.5s ease-in-out 3;
}

@keyframes rowFlash {
  0%, 100% {
    background-color: transparent;
  }
  50% {
    background-color: rgba(76, 175, 80, 0.25);
  }
}

@keyframes rowGlow {
  0%, 100% {
    box-shadow: none;
  }
  50% {
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.5), inset 0 0 10px rgba(76, 175, 80, 0.1);
  }
}

/* Estrellas/destellos */
.row-flash-highlight .sparkle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, #4CAF50 0%, transparent 70%);
  border-radius: 50%;
  animation: sparkle 0.5s ease-out 3;
  pointer-events: none;
}

.row-flash-highlight .sparkle:nth-child(1) { top: -5px; left: 20%; animation-delay: 0s; }
.row-flash-highlight .sparkle:nth-child(2) { top: -5px; left: 50%; animation-delay: 0.1s; }
.row-flash-highlight .sparkle:nth-child(3) { top: -5px; left: 80%; animation-delay: 0.2s; }

@keyframes sparkle {
  0% {
    transform: scale(0) translateY(0);
    opacity: 1;
  }
  50% {
    transform: scale(1.5) translateY(-10px);
    opacity: 1;
  }
  100% {
    transform: scale(0) translateY(-20px);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODULOS CHECKBOXES EN FORMULARIO USUARIO
   ═══════════════════════════════════════════════════════════════════════════ */

.form-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 15px;
  gap: 15px;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.form-divider span {
  font-size: 0.85em;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modulos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.modulo-check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

.modulo-check-item:hover {
  background: #f0f4f3;
  border-color: var(--primary-light);
}

.modulo-check-item.checked {
  background: var(--primary-container);
  border-color: var(--primary);
}

.modulo-check-item input[type="checkbox"] {
  display: none;
}

.modulo-check-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 1em;
  transition: all 0.2s;
}

.modulo-check-item.checked .modulo-check-icon {
  background: var(--primary);
  color: white;
}

.modulo-check-info {
  flex: 1;
}

.modulo-check-info .nombre {
  font-weight: 600;
  font-size: 0.9em;
  color: #333;
}

.modulo-check-info .desc {
  font-size: 0.75em;
  color: #888;
}

.modulo-check-toggle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modulo-check-item.checked .modulo-check-toggle {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.modulo-check-toggle i {
  font-size: 12px;
  opacity: 0;
}

.modulo-check-item.checked .modulo-check-toggle i {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL ROLES Y PERMISOS
   ═══════════════════════════════════════════════════════════════════════════ */

.permisos-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 25px;
  min-height: 450px;
}

/* Lista de usuarios */
.permisos-usuarios {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e0e0e0;
}

.permisos-usuarios h4 {
  margin: 0 0 15px 0;
  font-size: 0.95em;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.permisos-usuarios h4 i {
  color: var(--primary);
}

.usuarios-lista {
  max-height: 400px;
  overflow-y: auto;
}

.usuario-item-permisos {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: white;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.usuario-item-permisos:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(0, 137, 123, 0.1);
}

.usuario-item-permisos.selected {
  border-color: var(--primary);
  background: var(--primary-container);
}

.usuario-item-permisos .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9em;
  flex-shrink: 0;
}

.usuario-item-permisos .info {
  flex: 1;
  min-width: 0;
}

.usuario-item-permisos .info .nombre {
  font-weight: 600;
  color: #333;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.usuario-item-permisos .info .rol {
  font-size: 0.75em;
  color: #666;
}

.usuario-item-permisos .permisos-badge {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7em;
  font-weight: 600;
}

.usuario-item-permisos .permisos-badge.personalizado {
  background: #fff3e0;
  color: #f57c00;
}

/* Panel de permisos */
.permisos-panel {
  background: white;
  border-radius: 12px;
  padding: 25px;
  border: 1px solid #e0e0e0;
}

.permisos-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.permisos-empty i {
  font-size: 48px;
  margin-bottom: 15px;
  color: #ccc;
}

.permisos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.permisos-user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.permisos-user-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1em;
}

.permisos-user-info h4 {
  margin: 0 0 5px 0;
  font-size: 1.1em;
}

.badge-rol {
  background: var(--primary-container);
  color: var(--primary-dark);
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 0.75em;
  font-weight: 600;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85em;
}

.permisos-notice {
  background: #fff3e0;
  color: #e65100;
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9em;
}

/* Módulos y acciones */
.permisos-modulos {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modulo-card {
  background: #f8f9fa;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
}

.modulo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: white;
  border-bottom: 1px solid #eee;
}

.modulo-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modulo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-container);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
}

.modulo-info h5 {
  margin: 0;
  font-size: 0.95em;
  color: #333;
}

.modulo-info span {
  font-size: 0.75em;
  color: #888;
}

/* Switch toggle */
.switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 26px;
}

.switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: var(--primary);
}

.switch input:checked + .slider:before {
  transform: translateX(24px);
}

/* Acciones del módulo */
.modulo-acciones {
  padding: 15px 20px;
  display: none;
}

.modulo-card.expanded .modulo-acciones {
  display: block;
}

.accion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: white;
  border-radius: 8px;
  margin-bottom: 8px;
}

.accion-item:last-child {
  margin-bottom: 0;
}

.accion-item label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
}

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

.accion-item .accion-nombre {
  font-size: 0.9em;
  color: #333;
}

.accion-item .accion-desc {
  font-size: 0.75em;
  color: #888;
}

/* Botón expandir */
.btn-expand {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.modulo-card.expanded .btn-expand {
  transform: rotate(180deg);
}

.permisos-actions {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
  .permisos-layout {
    grid-template-columns: 1fr;
  }

  .permisos-usuarios {
    max-height: 200px;
    overflow-y: auto;
  }

  .usuarios-lista {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 10px;
  }

  .usuario-item-permisos {
    min-width: 150px;
    margin-bottom: 0;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL ASIGNACIÓN DE CAMA
═══════════════════════════════════════════════════════════════════════════ */
.camas-disponibles-container {
  max-height: 500px;
  overflow-y: auto;
}

.camas-piso-grupo {
  margin-bottom: 20px;
}

.camas-piso-titulo {
  font-size: 0.95em;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.camas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.cama-disponible-card {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 2px solid #10b981;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cama-disponible-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
  border-color: var(--primary);
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.cama-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.cama-icon i {
  font-size: 22px;
  color: white;
}

.cama-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cama-hab {
  font-weight: 700;
  font-size: 1em;
  color: #065f46;
}

.cama-id {
  font-size: 0.85em;
  color: #047857;
}

.cama-sector {
  font-size: 0.75em;
  color: #6b7280;
  background: rgba(0,0,0,0.05);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL CONFIRMACIÓN ASIGNACIÓN DE CAMA
═══════════════════════════════════════════════════════════════════════════ */
.confirm-cama-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.confirm-cama-overlay.show {
  opacity: 1;
}

.confirm-cama-box {
  background: white;
  border-radius: 20px;
  padding: 30px 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.8) translateY(20px);
  transition: transform 0.3s ease;
}

.confirm-cama-overlay.show .confirm-cama-box {
  transform: scale(1) translateY(0);
}

.confirm-cama-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: pulse-icon 2s infinite;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.confirm-cama-icon i {
  font-size: 30px;
  color: white;
}

.confirm-cama-box h3 {
  margin: 0 0 20px;
  font-size: 1.4em;
  color: #1e293b;
}

.confirm-cama-detalle {
  margin: 0 0 10px;
}

.confirm-habitacion {
  display: inline-block;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #065f46;
  font-weight: 700;
  font-size: 1.2em;
  padding: 10px 20px;
  border-radius: 12px;
  border: 2px solid #10b981;
}

.confirm-paciente {
  color: #64748b;
  font-size: 1em;
  margin: 15px 0 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.confirm-paciente i {
  color: var(--primary);
}

.confirm-cama-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-cancel-cama,
.btn-confirm-cama {
  padding: 12px 28px;
  border-radius: 12px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.btn-cancel-cama {
  background: #f1f5f9;
  color: #64748b;
}

.btn-cancel-cama:hover {
  background: #e2e8f0;
  color: #475569;
}

.btn-confirm-cama {
  background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-confirm-cama:hover {
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOADER Y ANIMACIÓN DE ÉXITO
═══════════════════════════════════════════════════════════════════════════ */
.loader-asignacion-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.loader-asignacion-overlay.show {
  opacity: 1;
}

.loader-asignacion-box {
  background: white;
  border-radius: 20px;
  padding: 40px 50px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.loader-asignacion-box p {
  margin: 15px 0 0;
  font-size: 1.1em;
  font-weight: 600;
  color: #1e293b;
}

.loader-asignacion-box.exito p {
  color: #10b981;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #e5e7eb;
  border-top-color: #10b981;
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

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

/* Checkmark animado */
.check-circle {
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 3;
  stroke: #10b981;
  stroke-miterlimit: 10;
  animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 3;
  stroke-miterlimit: 10;
  stroke: #10b981;
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-width: 4;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
  100% { stroke-dashoffset: 0; }
}

@keyframes scale {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes fill {
  100% { box-shadow: inset 0 0 0 100px rgba(16, 185, 129, 0.1); }
}

/* Botón Calendario en Ficha Paciente */
.btn-calendario-paciente {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.btn-calendario-paciente:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.5);
}

.btn-calendario-paciente i {
  font-size: 14px;
}

/* Botón calendario en tabla de pacientes */
.btn-icon.btn-calendario {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
  border: none !important;
}

.btn-icon.btn-calendario:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CALENDARIO DEL PACIENTE - PANTALLA COMPLETA
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-fullscreen {
  position: fixed;
  inset: 0;
  background: var(--surface);
  z-index: 9999;
  animation: slideInFullscreen 0.3s ease;
}

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

.calendario-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendario-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: white;
  border-bottom: 1px solid var(--outline-variant);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.calendario-header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.calendario-header-center {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendario-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendario-paciente-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendario-paciente-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e0f2fe, #f0fdf4);
  color: #525252;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.calendario-paciente-avatar .avatar-iniciales {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.calendario-paciente-avatar .avatar-foto {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.calendario-paciente-info h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--on-surface);
}

.calendario-filtros {
  display: flex;
  gap: 15px;
  font-size: 12px;
}

.filtro-check {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--on-surface-variant);
}

.filtro-check input {
  cursor: pointer;
}

.calendario-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 350px;
  overflow: hidden;
}

.calendario-grid-container {
  padding: 12px 15px;
  overflow: auto;
  background: var(--surface);
}

.calendario-dias-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  color: var(--on-surface-variant);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--outline-variant);
  margin-bottom: 6px;
}

.calendario-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  height: calc(100% - 40px);
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
}

.calendario-dia {
  background: white;
  border-radius: 0;
  padding: 6px;
  min-height: 75px;
  cursor: pointer;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  transition: all 0.2s;
  overflow: hidden;
}

.calendario-dia:nth-child(7n) {
  border-right: none;
}

.calendario-dia:hover {
  background: #f0fdf4;
  box-shadow: inset 0 0 0 2px var(--primary-light);
}

.calendario-dia.hoy {
  background: var(--primary-container);
  box-shadow: inset 0 0 0 3px var(--primary);
}

.calendario-dia.seleccionado {
  background: #ecfdf5;
  box-shadow: inset 0 0 0 3px var(--primary);
}

.calendario-dia.otro-mes {
  opacity: 0.4;
}

.calendario-dia-numero {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 6px;
}

.calendario-dia.hoy .calendario-dia-numero {
  background: var(--primary);
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendario-dia-eventos {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calendario-evento-mini {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.calendario-evento-mini:hover {
  filter: brightness(0.9);
}

.calendario-mas-eventos {
  font-size: 10px;
  color: var(--primary);
  font-weight: 500;
  padding: 2px;
  text-align: center;
}

/* Panel Lateral */
.calendario-side-panel {
  background: white;
  border-left: 1px solid var(--outline-variant);
  padding: 20px;
  overflow-y: auto;
}

.panel-fecha-seleccionada h4 {
  font-size: 16px;
  color: var(--on-surface);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
}

.panel-eventos-dia {
  max-height: 300px;
  overflow-y: auto;
}

.evento-detalle-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 4px solid transparent;
}

.evento-detalle-item:hover {
  transform: translateX(3px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.evento-detalle-icono {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.evento-detalle-info {
  flex: 1;
  min-width: 0;
}

.evento-detalle-titulo {
  font-weight: 600;
  font-size: 13px;
  color: var(--on-surface);
  margin-bottom: 3px;
}

.evento-detalle-desc {
  font-size: 11px;
  color: var(--on-surface-variant);
}

.evento-detalle-hora {
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
}

/* Medicación Item en Panel */
.medicacion-programada-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #f1f8f5;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 3px solid #4caf50;
}

.medicacion-programada-hora {
  font-weight: 700;
  color: #4caf50;
  font-size: 14px;
  min-width: 50px;
}

.medicacion-programada-info {
  flex: 1;
}

.medicacion-programada-nombre {
  font-weight: 600;
  font-size: 12px;
  color: var(--on-surface);
}

.medicacion-programada-dosis {
  font-size: 11px;
  color: var(--on-surface-variant);
}

.medicacion-programada-acciones {
  display: flex;
  gap: 5px;
}

.medicacion-programada-acciones button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--outline-variant);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--on-surface-variant);
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--surface-variant);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline {
  padding: 8px 16px;
  border: 1px solid var(--outline-variant);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Día checkbox selector */
.dia-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--surface);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.dia-check:has(input:checked) {
  background: var(--primary-container);
  color: var(--primary-dark);
}

.dia-check input {
  cursor: pointer;
}

/* Responsive */
@media (max-width: 1024px) {
  .calendario-body {
    grid-template-columns: 1fr;
  }

  .calendario-side-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 300px;
    border-left: none;
    border-top: 1px solid var(--outline-variant);
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
  }

  .calendario-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .calendario-filtros {
    display: none;
  }
}

@media (max-width: 768px) {
  .calendario-dia {
    min-height: 60px;
    padding: 5px;
  }

  .calendario-dia-numero {
    font-size: 12px;
  }

  .calendario-evento-mini {
    font-size: 8px;
    padding: 1px 3px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BÚSQUEDA GLOBAL (Ctrl+Espacio)
   ═══════════════════════════════════════════════════════════════════════════ */

.busqueda-global-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  animation: fadeIn 0.15s ease;
}

.busqueda-global-overlay.active {
  display: flex;
}

.busqueda-global-modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.busqueda-global-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  gap: 12px;
}

.busqueda-global-header i {
  color: #9ca3af;
  font-size: 18px;
}

.busqueda-global-header input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 18px;
  background: transparent;
  color: #1f2937;
}

.busqueda-global-header input::placeholder {
  color: #9ca3af;
}

.busqueda-global-shortcut {
  background: #f3f4f6;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.busqueda-global-resultados {
  max-height: 400px;
  overflow-y: auto;
  padding: 12px;
}

.busqueda-global-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: #6b7280;
  font-size: 13px;
}

.busqueda-global-hint i {
  color: #fbbf24;
}

.busqueda-global-accesos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.busqueda-acceso-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #f9fafb;
}

.busqueda-acceso-item:hover {
  background: #eff6ff;
  transform: translateX(4px);
}

.busqueda-acceso-item i {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border-radius: 8px;
  font-size: 14px;
}

.busqueda-acceso-item span {
  flex: 1;
  font-weight: 500;
  color: #374151;
}

.busqueda-acceso-item kbd {
  background: white;
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: #6b7280;
  font-family: inherit;
}

/* Resultados de búsqueda */
.busqueda-grupo {
  margin-bottom: 16px;
}

.busqueda-grupo-titulo {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
}

.busqueda-resultado-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.busqueda-resultado-item:hover,
.busqueda-resultado-item.selected {
  background: #eff6ff;
}

.busqueda-resultado-item.selected {
  border-left: 3px solid var(--primary);
}

.busqueda-resultado-icono {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
}

.busqueda-resultado-icono.paciente {
  background: #dcfce7;
  color: #16a34a;
}

.busqueda-resultado-icono.medicamento {
  background: #fef3c7;
  color: #d97706;
}

.busqueda-resultado-icono.seccion {
  background: #dbeafe;
  color: #2563eb;
}

.busqueda-resultado-icono.usuario {
  background: #f3e8ff;
  color: #9333ea;
}

.busqueda-resultado-info {
  flex: 1;
}

.busqueda-resultado-titulo {
  font-weight: 500;
  color: #1f2937;
  font-size: 14px;
}

.busqueda-resultado-subtitulo {
  font-size: 12px;
  color: #6b7280;
}

.busqueda-resultado-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #f3f4f6;
  color: #6b7280;
}

/* Sin resultados */
.busqueda-sin-resultados {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
}

.busqueda-sin-resultados i {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.busqueda-sin-resultados p {
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   INDICADOR DE ATAJOS DE TECLADO
   ═══════════════════════════════════════════════════════════════════════════ */

.atajos-rapidos-hint {
  display: none; /* Ocultar por defecto - atajos siguen funcionando */
  align-items: center;
  gap: 12px;
  margin-left: 15px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.atajos-rapidos-hint:hover {
  opacity: 1;
}

.atajo-hint {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #64748b;
  cursor: default;
}

.atajo-hint kbd {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 10px;
  font-family: inherit;
  color: #475569;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.atajo-hint:hover kbd {
  background: #e0e7ff;
  border-color: #c7d2fe;
  color: #4f46e5;
}

@media (max-width: 1200px) {
  .atajos-rapidos-hint {
    display: none;
  }
}

/* Actualización atajos - con descripción debajo */
.atajo-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.atajo-teclas {
  display: flex;
  align-items: center;
  gap: 2px;
}

.atajo-desc {
  font-size: 9px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.atajo-hint:hover .atajo-desc {
  color: #4f46e5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL CAMBIAR UBICACIÓN / CATEGORÍA
   ═══════════════════════════════════════════════════════════════════════════ */

.cambio-ubicacion-paciente-info {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  border: 1px solid #e2e8f0;
}

.paciente-actual-ubicacion {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.paciente-actual-ubicacion .label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.paciente-actual-ubicacion .valor {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.paciente-actual-ubicacion .categoria-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

/* Selector de categorías */
.categorias-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.categoria-card {
  flex: 1;
  min-width: 140px;
  max-width: 180px;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.categoria-card:hover {
  border-color: #94a3b8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.categoria-card.selected {
  border-color: var(--color-categoria, #3b82f6);
  background: linear-gradient(135deg, var(--color-categoria-light, #eff6ff), white);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.categoria-card .categoria-icono {
  font-size: 28px;
  margin-bottom: 8px;
}

.categoria-card .categoria-nombre {
  font-weight: 600;
  font-size: 13px;
  color: #1e293b;
  margin-bottom: 4px;
}

.categoria-card .categoria-camas {
  font-size: 11px;
  color: #64748b;
}

/* Grid de camas disponibles */
.camas-disponibles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding: 5px;
}

.camas-hint {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  color: #94a3b8;
  font-style: italic;
}

.cama-disponible-item {
  padding: 12px;
  border-radius: 10px;
  border: 2px solid #e2e8f0;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.cama-disponible-item:hover {
  border-color: #3b82f6;
  background: #f8fafc;
}

.cama-disponible-item.selected {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.cama-disponible-item .cama-numero {
  font-weight: 700;
  font-size: 16px;
  color: #1e293b;
}

.cama-disponible-item .cama-habitacion {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.cama-disponible-item .cama-piso {
  font-size: 10px;
  color: #94a3b8;
}

/* Botón cambiar ubicación en ficha */
.btn-cambiar-ubicacion {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cambiar-ubicacion:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Estilos para niveles de cuidado en mapa */
.habitacion-categoria-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 5;
}

/* Colores por categoría */
.categoria-normal { --color-categoria: #22c55e; --color-categoria-light: #f0fdf4; }
.categoria-intermedio { --color-categoria: #f59e0b; --color-categoria-light: #fffbeb; }
.categoria-intensivo { --color-categoria: #ef4444; --color-categoria-light: #fef2f2; }
.categoria-rehabilitacion { --color-categoria: #3b82f6; --color-categoria-light: #eff6ff; }

/* Mensaje sin camas */
.sin-camas-mensaje {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: #ef4444;
  background: #fef2f2;
  border-radius: 8px;
}

/* Loading en camas */
.camas-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 30px;
  color: #64748b;
}

.camas-loading i {
  font-size: 24px;
  margin-bottom: 10px;
  display: block;
}

/* Leyenda de categorías en mapa */
.categorias-leyenda {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.leyenda-titulo {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.categoria-leyenda-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}

.categoria-leyenda-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: white;
  background: var(--cat-color, #64748b);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Badge de nivel de cuidado en camas del mapa */
.cama-nivel-badge {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  margin-left: auto;
}

.bed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SISTEMA DE ADMISIONES - Estilos
   ═══════════════════════════════════════════════════════════════════════════ */

/* Barra de estadísticas de admisiones */
.admision-stats-bar {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admision-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  min-width: 120px;
}

.admision-stat i {
  font-size: 20px;
}

.admision-stat .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.admision-stat .stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Board de admisiones estilo Kanban */
.admission-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-height: 500px;
}

@media (max-width: 1200px) {
  .admission-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.admission-column {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}

/* Header de columna Kanban */
.admission-column .column-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(20, 184, 166, 0.1));
}

.column-header.stage-1 { background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.1)); }
.column-header.stage-2 { background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(109, 40, 217, 0.1)); }
.column-header.stage-3 { background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(8, 145, 178, 0.1)); }
.column-header.stage-4 { background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.1)); }

.column-header .stage-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  background: #10b981;
  flex-shrink: 0;
}

.column-header.stage-1 .stage-number { background: #3b82f6; }
.column-header.stage-2 .stage-number { background: #8b5cf6; }
.column-header.stage-3 .stage-number { background: #0891b2; }
.column-header.stage-4 .stage-number { background: #22c55e; }

.column-header .stage-info {
  flex: 1;
}

.column-header .stage-info h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.column-header .stage-info small {
  font-size: 11px;
  color: #64748b;
}

.column-header .column-count {
  background: #10b981;
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  min-width: 28px;
  text-align: center;
}

.column-header.stage-1 .column-count { background: #3b82f6; }
.column-header.stage-2 .column-count { background: #8b5cf6; }
.column-header.stage-3 .column-count { background: #0891b2; }
.column-header.stage-4 .column-count { background: #22c55e; }

/* Body de columna */
.admission-column .column-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px;
}

/* Cards de admisión */
.admission-card {
  background: white;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 4px solid #10b981;
}

.admission-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.admission-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.admission-card-header h5 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  line-height: 1.3;
}

.admission-card-body {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 10px;
}

.admission-card-body p {
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.admission-card-body p i {
  width: 14px;
  color: #94a3b8;
}

.admission-card-footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Evaluaciones pendientes badge */
.evaluaciones-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #fef3c7;
  color: #92400e;
}

.evaluaciones-badge.completadas {
  background: #d1fae5;
  color: #065f46;
}

/* Botones de acción en cards */
.btn-avanzar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-avanzar:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

.btn-aceptar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #ffffff !important;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-aceptar i,
.btn-aceptar span {
  color: #ffffff !important;
}

.btn-aceptar:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  transform: translateY(-1px);
  color: #ffffff !important;
}

.btn-rechazar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff !important;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-rechazar i,
.btn-rechazar span {
  color: #ffffff !important;
}

.btn-rechazar:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  color: #ffffff !important;
}

/* Mensaje vacío */
.admision-empty {
  text-align: center;
  padding: 30px 20px;
  color: #94a3b8;
  font-size: 13px;
  font-style: italic;
}

/* Chip de obra social */
.admission-card .chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.admission-card .chip.osde { background: #dbeafe; color: #1e40af; }
.admission-card .chip.pami { background: #fce7f3; color: #9d174d; }
.admission-card .chip.swiss { background: #fee2e2; color: #991b1b; }
.admission-card .chip.galeno { background: #fef3c7; color: #92400e; }
.admission-card .chip.particular { background: #e2e8f0; color: #475569; }
.admission-card .chip.otra { background: #f3e8ff; color: #6b21a8; }

/* Modal de nueva admisión */
.admision-form-section {
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.admision-form-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admision-form-section h4 i {
  color: #10b981;
}

.admision-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.admision-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admision-form-group label {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
}

.admision-form-group input,
.admision-form-group select,
.admision-form-group textarea {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  transition: border-color 0.2s ease;
}

.admision-form-group input:focus,
.admision-form-group select:focus,
.admision-form-group textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.admision-form-group.full-width {
  grid-column: 1 / -1;
}

/* Consentimiento checkbox */
.consent-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #ecfdf5;
  border-radius: 8px;
  border: 1px solid #a7f3d0;
}

.consent-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #10b981;
}

.consent-checkbox label {
  font-size: 13px;
  color: #065f46;
  font-weight: 500;
}

/* Tipo de internación badge */
.admission-tipo {
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: #e2e8f0;
  color: #475569;
}

.admission-tipo.geriatrica { background: #d1fae5; color: #065f46; }
.admission-tipo.psiquiatrica { background: #ede9fe; color: #5b21b6; }
.admission-tipo.rehabilitacion { background: #dbeafe; color: #1e40af; }
.admission-tipo.paliativos { background: #fce7f3; color: #9d174d; }

/* Fecha en card */
.admission-fecha {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #94a3b8;
}

/* Evaluaciones pendientes */
.eval-pendientes {
  background: #fef3c7;
  color: #92400e;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  margin-top: 6px;
}

/* Botones de decisión */
.decision-btns {
  display: flex;
  gap: 6px;
}

/* Estilos para sección header de admisiones */
.section-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Modal de nueva admisión - Form section */
.form-section {
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.form-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.form-section h4 i {
  color: #10b981;
}

/* Checkboxes de interconsultas */
.interconsulta-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid #dbeafe;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
}
.interconsulta-check:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}
.interconsulta-check input[type="checkbox"] {
  accent-color: #2563eb;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.interconsulta-check input[type="checkbox"]:checked + span {
  color: #1e40af;
  font-weight: 600;
}
.interconsulta-check:has(input:checked) {
  border-color: #2563eb;
  background: #dbeafe;
}
.interconsulta-check span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.interconsulta-check span i {
  font-size: 13px;
  color: #3b82f6;
  width: 16px;
  text-align: center;
}

/* Badges de interconsultas en tarjeta admisión */
.interconsulta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}
.interconsulta-badge.pendiente {
  background: #fef3c7;
  color: #92400e;
}
.interconsulta-badge.completada {
  background: #dcfce7;
  color: #166534;
}
.interconsulta-badge.en_proceso {
  background: #dbeafe;
  color: #1e40af;
}

@media (max-width: 640px) {
  #interconsultasCheckboxes {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   WIZARD DE ADMISIÓN - 4 pasos simplificados
   ═══════════════════════════════════════════════════════════════════════════ */
.wizard-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  margin: 0 -20px 20px -20px;
  border-bottom: 1px solid #e2e8f0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.wizard-step.active {
  opacity: 1;
}

.wizard-step.completed {
  opacity: 1;
}

.wizard-step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
}

.wizard-step.active .wizard-step-number {
  background: linear-gradient(135deg, var(--primary), #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 137, 123, 0.3);
}

.wizard-step.completed .wizard-step-number {
  background: #22c55e;
  color: white;
}

.wizard-step.completed .wizard-step-number::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 12px;
}

.wizard-step.completed .wizard-step-number span {
  display: none;
}

.wizard-step-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.wizard-step.active .wizard-step-label {
  color: var(--primary);
  font-weight: 600;
}

.wizard-step-line {
  width: 40px;
  height: 3px;
  background: #e2e8f0;
  margin: 0 8px;
  margin-bottom: 20px;
  border-radius: 2px;
  transition: background 0.3s ease;
}

.wizard-step-line.completed {
  background: #22c55e;
}

.wizard-content {
  display: none;
  animation: wizardFadeIn 0.3s ease;
}

.wizard-content.active {
  display: block;
}

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

.wizard-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.wizard-nav .btn-secondary,
.wizard-nav .btn-primary {
  padding: 12px 24px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-nav .wizard-submit {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
}

/* Estilos específicos de columnas por etapa */
.admission-column:nth-child(1) .admission-card { border-left-color: #3b82f6; }
.admission-column:nth-child(2) .admission-card { border-left-color: #8b5cf6; }
.admission-column:nth-child(3) .admission-card { border-left-color: #10b981; }
.admission-column:nth-child(4) .admission-card { border-left-color: #22c55e; }

/* Info del paciente en modal de evaluación */
.eval-paciente-info {
  margin-bottom: 20px;
}

.eval-paciente-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px;
  border-left: 4px solid #8b5cf6;
}

.eval-paciente-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  flex-shrink: 0;
}

.eval-paciente-datos h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 6px 0;
}

.eval-paciente-datos p {
  font-size: 13px;
  color: #64748b;
  margin: 3px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.eval-paciente-datos p i {
  color: #94a3b8;
  width: 16px;
}

/* Fotos de evaluación */
.eval-foto-item {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e5e7eb;
  transition: transform 0.2s, box-shadow 0.2s;
}

.eval-foto-item:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.eval-foto-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.eval-foto-item button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.eval-foto-item:hover button {
  opacity: 1;
}

/* Checklist de enfermería */
.enfermeria-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 220px;
}

.check-item:hover {
  border-color: #10b981;
  background: #f0fdfa;
}

.check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #10b981;
}

.check-item span {
  font-size: 13px;
  color: #475569;
}

.check-item:has(input:checked) {
  background: #ecfeff;
  border-color: #10b981;
}

.check-item:has(input:checked) span {
  color: #059669;
  font-weight: 500;
}

/* Botón de evaluación en cards */
.btn-evaluar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-evaluar:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  transform: translateY(-1px);
}

.btn-evaluar.enfermeria {
  background: linear-gradient(135deg, #10b981, #10b981);
}

.btn-evaluar.enfermeria:hover {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTON PRINCIPAL DESTACADO - Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */

.main-action-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.main-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 48px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.35);
}

.main-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(34, 197, 94, 0.45);
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.main-action-btn:active {
  transform: translateY(0);
}

.main-action-btn i {
  font-size: 22px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BARRA DE ACCIONES RÁPIDAS - Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */

.quick-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.quick-actions-label {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.quick-actions-label i {
  color: #f59e0b;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff !important;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.quick-action-btn i {
  color: #ffffff !important;
  font-size: 14px;
}

.quick-action-btn.admision {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.quick-action-btn.admision:hover {
  background: linear-gradient(135deg, #16a34a, #15803d);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.quick-action-btn.paciente {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.quick-action-btn.paciente:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.quick-action-btn.mapa {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.quick-action-btn.mapa:hover {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.quick-action-btn.farmacia {
  background: linear-gradient(135deg, #f97316, #ea580c);
}

.quick-action-btn.farmacia:hover {
  background: linear-gradient(135deg, #ea580c, #c2410c);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════
   GERIABOT - Asistente IA Flotante
   ═══════════════════════════════════════════════════════════════════════════ */

/* Contenedor del widget */
.geriabot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

/* Widget del robot */
.geriabot-widget {
  width: 110px;
  height: 110px;
  cursor: pointer;
  filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.4));
  transition: all 0.3s ease;
  animation: geriabot-float 3s ease-in-out infinite;
}

.geriabot-widget:hover {
  transform: scale(1.1);
  filter: drop-shadow(0 6px 20px rgba(16, 185, 129, 0.6));
}

@keyframes geriabot-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Burbuja de mensaje */
.geriabot-bubble {
  position: relative;
  background: white;
  padding: 12px 16px;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  max-width: 220px;
  font-size: 13px;
  color: #1e293b;
  animation: bubble-appear 0.4s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
}

.geriabot-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid white;
}

.geriabot-bubble.hidden {
  display: none;
}

.bubble-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
}

.bubble-close:hover {
  color: #64748b;
}

@keyframes bubble-appear {
  from { opacity: 0; transform: translateY(10px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Ventana de Chat */
.geriabot-chat {
  position: fixed;
  bottom: 110px;
  right: 20px;
  width: 380px;
  height: 520px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  z-index: 10000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chat-appear 0.3s ease-out;
}

.geriabot-chat.active {
  display: flex;
}

.geriabot-chat.minimized {
  height: 56px;
}

.geriabot-chat.minimized .geriabot-chat-messages,
.geriabot-chat.minimized .geriabot-chat-typing,
.geriabot-chat.minimized .geriabot-chat-input,
.geriabot-chat.minimized .geriabot-chat-footer {
  display: none;
}

@keyframes chat-appear {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header del chat */
.geriabot-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-header-text h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.chat-status {
  font-size: 11px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-status i {
  font-size: 6px;
  color: #4ade80;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

.chat-btn-minimize,
.chat-btn-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255,255,255,0.2);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-btn-minimize:hover,
.chat-btn-close:hover {
  background: rgba(255,255,255,0.3);
}

/* Área de mensajes */
.geriabot-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.chat-message {
  display: flex;
  gap: 10px;
  max-width: 90%;
}

.chat-message.bot {
  align-self: flex-start;
}

.chat-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-message.user .message-avatar {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.message-content {
  background: white;
  padding: 12px 14px;
  border-radius: 12px 12px 12px 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border-radius: 12px 12px 4px 12px;
}

.message-content p {
  margin: 0 0 8px 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.message-content li {
  margin: 4px 0;
}

/* Indicador de escritura */
.geriabot-chat-typing {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  background: white;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.typing-indicator span:not(.typing-text) {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: typing-dot 1.4s ease-in-out infinite;
}

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

.typing-text {
  font-size: 12px;
  color: #64748b;
  margin-left: 8px;
}

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.6; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input del chat */
.geriabot-chat-input {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
}

.geriabot-chat-input input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.geriabot-chat-input input:focus {
  border-color: #10b981;
}

.geriabot-chat-input button {
  width: 44px;
  height: 44px;
  border: none;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.geriabot-chat-input button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.geriabot-chat-input button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Footer del chat */
.geriabot-chat-footer {
  padding: 8px 16px;
  background: #f8fafc;
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
}

.geriabot-chat-footer a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s;
}

.geriabot-chat-footer a:hover {
  color: #3b82f6;
}

.geriabot-chat-footer a:hover strong {
  color: #3b82f6;
}

.geriabot-chat-footer strong {
  color: #64748b;
}

/* Responsive */
@media (max-width: 480px) {
  .geriabot-chat {
    width: calc(100vw - 20px);
    right: 10px;
    bottom: 100px;
    height: 70vh;
  }

  .geriabot-container {
    right: 10px;
    bottom: 10px;
  }

  .geriabot-widget {
    width: 85px;
    height: 85px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GERIABOT - Funcionalidad de Arrastre
   ═══════════════════════════════════════════════════════════════════════════ */

/* Estado arrastrable del robot */
.geriabot-container.draggable {
  cursor: grab;
  user-select: none;
}

.geriabot-container.dragging {
  cursor: grabbing !important;
  z-index: 100000 !important;
  opacity: 0.9;
}

.geriabot-container.dragging .geriabot-widget {
  animation: none !important;
  transform: scale(1.05);
}

/* Estado arrastrable del chat */
.geriabot-chat.draggable {
  user-select: none;
}

.geriabot-chat.dragging {
  cursor: grabbing !important;
  z-index: 100001 !important;
  opacity: 0.95;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Header del chat arrastrable */
.geriabot-chat-header.drag-handle {
  cursor: grab;
}

.geriabot-chat-header.drag-handle:active {
  cursor: grabbing;
}

/* Indicador visual de arrastre en el header */
.geriabot-chat-header .drag-indicator {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-left: auto;
  margin-right: 12px;
  opacity: 0.5;
}

.geriabot-chat-header .drag-indicator::before {
  content: '⋮⋮';
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  letter-spacing: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FICHA MÉDICA COMPLETA - Estilos
   ═══════════════════════════════════════════════════════════════════════════ */

/* Elementos solo para médicos */
.medico-only {
  display: none !important;
}

body.is-medico .medico-only {
  display: flex !important;
}

/* Header de la ficha médica */
.ficha-medica-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ficha-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ficha-header-actions .btn-icon {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.ficha-header-actions .btn-icon:hover {
  background: rgba(255,255,255,0.3);
}

/* Header del paciente */
.ficha-paciente-header {
  background: linear-gradient(135deg, #f0fdfa, #e0f2fe);
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 20px;
  align-items: center;
}

.ficha-paciente-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  font-weight: 600;
  flex-shrink: 0;
}

.ficha-paciente-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Avatar upload overlay para fotos de pacientes */
.avatar-upload-container {
  position: relative;
  display: inline-block;
}

.avatar-upload-container:hover .avatar-upload-overlay {
  opacity: 1;
}

.avatar-upload-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  opacity: 0.85;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  border: 2px solid white;
}

.avatar-upload-container:hover .avatar-upload-overlay {
  opacity: 1;
  transform: scale(1.1);
  background: linear-gradient(135deg, #4f46e5, #4338ca);
}

.ficha-paciente-info {
  flex: 1;
}

.ficha-paciente-info h2 {
  margin: 0 0 5px;
  font-size: 1.4em;
  color: #0f172a;
}

.ficha-paciente-info .ficha-datos-basicos {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.9em;
  color: #475569;
}

.ficha-paciente-info .ficha-datos-basicos span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ficha-alergias-banner {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 2px solid #fca5a5;
  border-radius: 12px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 300px;
}

.ficha-alergias-banner i {
  color: #dc2626;
  font-size: 1.5em;
}

.ficha-alergias-banner .alergias-texto {
  font-size: 0.85em;
  color: #991b1b;
  font-weight: 500;
}

.ficha-sin-alergias {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 2px solid #86efac;
  border-radius: 12px;
  padding: 10px 15px;
  color: #166534;
  font-size: 0.85em;
}

/* Tabs de navegación */
.ficha-tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
  padding: 0 10px;
}

.ficha-tab {
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.85em;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.ficha-tab:hover {
  color: #10b981;
  background: rgba(8, 145, 178, 0.05);
}

.ficha-tab.active {
  color: #10b981;
  border-bottom-color: #10b981;
  font-weight: 600;
}

/* Contenido de tabs */
.ficha-tab-content {
  display: none;
}

.ficha-tab-content.active {
  display: block;
}

/* Grid de resumen */
.ficha-resumen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.ficha-card {
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
}

.ficha-card h4 {
  margin: 0 0 12px;
  font-size: 0.95em;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ficha-card.alergias-card {
  border-left: 4px solid #dc2626;
}

.ficha-card.diagnosticos-card {
  border-left: 4px solid #10b981;
}

.ficha-card.medicacion-card {
  border-left: 4px solid #7c3aed;
}

.ficha-card.signos-card {
  border-left: 4px solid #059669;
}

/* Section header */
.ficha-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.ficha-section-header h4 {
  margin: 0;
  font-size: 1.1em;
  color: #0f172a;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85em;
}

/* Antecedentes grid */
.antecedentes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 15px;
}

.antecedente-card {
  background: white;
  border-radius: 10px;
  padding: 15px;
  border: 1px solid #e2e8f0;
  position: relative;
}

.antecedente-card .tipo-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
}

.antecedente-card .tipo-badge.patologico { background: #fef3c7; color: #92400e; }
.antecedente-card .tipo-badge.quirurgico { background: #dbeafe; color: #1e40af; }
.antecedente-card .tipo-badge.familiar { background: #f3e8ff; color: #6b21a8; }
.antecedente-card .tipo-badge.traumatico { background: #fee2e2; color: #991b1b; }
.antecedente-card .tipo-badge.otro { background: #e2e8f0; color: #475569; }

.antecedente-card h5 {
  margin: 0 0 8px;
  font-size: 1em;
  color: #0f172a;
  padding-right: 80px;
}

.antecedente-card .estado {
  font-size: 0.8em;
  color: #64748b;
}

.antecedente-card .estado.activo { color: #059669; }
.antecedente-card .estado.cronico { color: #d97706; }
.antecedente-card .estado.resuelto { color: #6b7280; }

/* Alergias list */
.alergias-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alergia-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.alergia-item.severa, .alergia-item.anafilaxia {
  border-color: #fca5a5;
  background: #fef2f2;
}

.alergia-severidad {
  width: 10px;
  height: 40px;
  border-radius: 5px;
  flex-shrink: 0;
}

.alergia-severidad.leve { background: #fbbf24; }
.alergia-severidad.moderada { background: #f97316; }
.alergia-severidad.severa { background: #dc2626; }
.alergia-severidad.anafilaxia { background: #7f1d1d; }

.alergia-info {
  flex: 1;
}

.alergia-info h5 {
  margin: 0 0 4px;
  font-size: 1em;
}

.alergia-info .tipo {
  font-size: 0.8em;
  color: #64748b;
}

/* Diagnósticos list */
.diagnosticos-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diagnostico-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.diagnostico-item.principal {
  border-left: 4px solid #10b981;
}

.diagnostico-estado {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
}

.diagnostico-estado.activo { background: #dcfce7; color: #166534; }
.diagnostico-estado.cronico { background: #fef3c7; color: #92400e; }
.diagnostico-estado.en_tratamiento { background: #dbeafe; color: #1e40af; }
.diagnostico-estado.resuelto { background: #e2e8f0; color: #475569; }

/* Hábitos form */
.habitos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.habito-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.habito-group label {
  font-weight: 600;
  color: #334155;
  font-size: 0.9em;
}

/* Vacunas list */
.vacunas-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

.vacuna-card {
  background: white;
  border-radius: 10px;
  padding: 15px;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.vacuna-card i {
  font-size: 1.5em;
  color: #059669;
}

.vacuna-info h5 {
  margin: 0 0 4px;
}

.vacuna-info .fecha {
  font-size: 0.8em;
  color: #64748b;
}

/* Signos vitales */
.signos-periodo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.signos-graficos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.signos-graficos canvas {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 15px;
}

.signos-periodo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.signos-periodo label {
  font-weight: 500;
  color: #64748b;
}

.signos-periodo select {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.9em;
}

.signos-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.signos-tabla {
  overflow-x: auto;
}

.signos-tabla table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}

.signos-tabla th, .signos-tabla td {
  padding: 10px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.signos-tabla th {
  background: #f8fafc;
  font-weight: 600;
}

/* Estudios */
.estudios-filtros {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.filtro-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
}

.filtro-btn.active, .filtro-btn:hover {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.estudios-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.estudio-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.estudio-item.urgente {
  border-left: 4px solid #dc2626;
}

.estudio-tipo-icon {
  width: 45px;
  height: 45px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  color: white;
}

.estudio-tipo-icon.laboratorio { background: #7c3aed; }
.estudio-tipo-icon.imagen { background: #10b981; }
.estudio-tipo-icon.electrocardiograma { background: #dc2626; }
.estudio-tipo-icon.otro { background: #64748b; }

.estudio-estado {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
}

.estudio-estado.pendiente { background: #fef3c7; color: #92400e; }
.estudio-estado.realizado { background: #dbeafe; color: #1e40af; }
.estudio-estado.con_resultado { background: #dcfce7; color: #166534; }

/* Submodales */
.modal.submodal {
  z-index: 1002;
}

/* Resumen items */
.resumen-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

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

.resumen-item .badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7em;
  font-weight: 600;
}

.resumen-vacio {
  color: #94a3b8;
  font-style: italic;
  padding: 10px 0;
}

/* Botón eliminar en items */
.btn-delete-item {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  padding: 5px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-delete-item:hover {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALTAS TRANSITORIAS Y TOPE DE FACTURACIÓN
   ═══════════════════════════════════════════════════════════════════════════ */

/* Badges de estado para pacientes */
.paciente-badges {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.badge-transitorio {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  font-size: 0.7em;
  font-weight: 600;
  border-radius: 10px;
}

.badge-hospital-dia {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 0.7em;
  font-weight: 600;
  border-radius: 10px;
}

.badge-temporal {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-size: 0.7em;
  font-weight: 600;
  border-radius: 10px;
}

.badge-internacion-corta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #ec4899, #db2777);
  color: white;
  font-size: 0.7em;
  font-weight: 600;
  border-radius: 10px;
}

.badge-indefinido {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  font-size: 0.7em;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.badge-salida {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 0.7em;
  font-weight: 600;
  border-radius: 10px;
  animation: pulse-salida 2s infinite;
}

@keyframes pulse-salida {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Fila de paciente en salida */
.row-en-salida {
  background: linear-gradient(135deg, #fef3c7, #fef9c3) !important;
}

.row-en-salida:hover {
  background: linear-gradient(135deg, #fde68a, #fef08a) !important;
}

/* Status badge warning */
.status-badge.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

/* Indicador de tope de facturación */
.tope-facturacion-indicador {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.tope-barra {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.tope-barra-progreso {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}

.tope-barra-progreso.ok {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.tope-barra-progreso.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.tope-barra-progreso.danger {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.tope-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75em;
  color: #64748b;
}

.tope-excedente {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 0.8em;
  font-weight: 600;
}

/* Card de paciente en salida (para dashboard) */
.salida-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: white;
  border-radius: 10px;
  border-left: 4px solid #f59e0b;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.salida-card-info {
  flex: 1;
}

.salida-card-info h4 {
  margin: 0 0 5px 0;
  color: #1e293b;
}

.salida-card-info p {
  margin: 0;
  color: #64748b;
  font-size: 0.85em;
}

.salida-card-fecha {
  text-align: right;
}

.salida-card-fecha .fecha-retorno {
  font-weight: 600;
  color: #f59e0b;
}

.salida-card-fecha .fecha-label {
  font-size: 0.75em;
  color: #94a3b8;
}

/* Lista de pacientes en salida */
.salidas-transitorias-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

/* Botón de configuración en tabla */
.btn-config-facturacion {
  color: #8b5cf6;
}

.btn-config-facturacion:hover {
  background: #f3e8ff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL CONFIGURACIÓN ESTANCIA
   ═══════════════════════════════════════════════════════════════════════════ */

.estancia-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.estancia-option {
  cursor: pointer;
}

.estancia-option input[type="radio"] {
  display: none;
}

.estancia-option-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.2s;
}

.estancia-option-content i {
  font-size: 1.3em;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 8px;
  color: #64748b;
}

.estancia-option-content span {
  font-weight: 600;
  color: #1e293b;
  flex: 1;
}

.estancia-option-content small {
  font-size: 0.75em;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
}

.estancia-option input[type="radio"]:checked + .estancia-option-content {
  border-color: #8b5cf6;
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}

.estancia-option input[type="radio"]:checked + .estancia-option-content i {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

.estancia-option:hover .estancia-option-content {
  border-color: #c4b5fd;
  background: #faf5ff;
}

.config-section {
  margin-bottom: 15px;
}

.config-campo {
  margin-top: 15px;
  padding: 15px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MÓDULO NFC - PULSERAS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Container principal NFC */
.nfc-container {
  padding: 0;
}

/* Header NFC */
.nfc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.nfc-header-left h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--on-surface);
  display: flex;
  align-items: center;
  gap: 12px;
}

.nfc-header-left h2 i {
  color: var(--primary);
}

.nfc-subtitle {
  margin: 4px 0 0;
  color: var(--on-surface-variant);
  font-size: 0.9rem;
}

/* Estado del lector NFC */
.nfc-reader-status {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface-bright);
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline-variant);
  box-shadow: var(--shadow-sm);
}

.nfc-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.nfc-status-indicator .status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

.nfc-status-indicator.connected .status-dot {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.nfc-status-indicator.disconnected .status-dot {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: none;
}

.nfc-status-indicator.connected .status-text {
  color: #16a34a;
}

.nfc-status-indicator.disconnected .status-text {
  color: #dc2626;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.7; }
}

.nfc-reader-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--on-surface-variant);
  font-size: 0.85rem;
  padding-left: 16px;
  border-left: 1px solid var(--outline-variant);
}

.nfc-reader-info i {
  color: var(--primary);
}

/* Paneles NFC */
.nfc-panels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1200px) {
  .nfc-panels {
    grid-template-columns: 1fr 1fr;
  }
  .nfc-panel-historial {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .nfc-panels {
    grid-template-columns: 1fr;
  }
  .nfc-panel-historial {
    grid-column: span 1;
  }
}

.nfc-panel {
  background: var(--surface-bright);
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline-variant);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.nfc-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--surface-container);
  border-bottom: 1px solid var(--outline-variant);
}

.nfc-panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--on-surface);
}

.nfc-panel-header h3 i {
  color: var(--primary);
}

.nfc-panel-count {
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.nfc-panel-count.success {
  background: var(--success-container);
  color: var(--success);
}

/* Búsqueda en panel */
.nfc-panel-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
}

.nfc-panel-search i {
  color: var(--on-surface-variant);
}

.nfc-panel-search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  outline: none;
  color: var(--on-surface);
}

.nfc-panel-search input::placeholder {
  color: var(--outline);
}

/* Lista de pacientes NFC */
.nfc-patient-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.nfc-patient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: default;
}

.nfc-patient-item:hover {
  background: var(--surface-container);
}

.nfc-patient-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  position: relative;
  flex-shrink: 0;
}

.nfc-badge-check {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #22c55e;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.nfc-badge-check i {
  font-size: 0.6rem;
  color: white;
}

.nfc-patient-info {
  flex: 1;
  min-width: 0;
}

.nfc-patient-name {
  font-weight: 600;
  color: var(--on-surface);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nfc-patient-details {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.nfc-patient-details span {
  font-size: 0.8rem;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  gap: 4px;
}

.nfc-patient-details i {
  font-size: 0.7rem;
}

.nfc-uid-badge {
  background: var(--surface-container-high);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.75rem !important;
}

.nfc-patient-date {
  font-size: 0.75rem;
  color: var(--outline);
  margin-top: 4px;
}

/* Botones de acción NFC */
.btn-nfc-assign {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-nfc-assign:hover {
  background: var(--gradient-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-nfc-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--error-container);
  color: var(--error);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-nfc-reset:hover {
  background: var(--error);
  color: white;
  transform: translateY(-1px);
}

/* Estado vacío */
.nfc-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--on-surface-variant);
}

.nfc-empty-state i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.nfc-empty-state p {
  margin: 0;
  font-size: 0.9rem;
}

/* Loading NFC */
.nfc-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  gap: 12px;
  color: var(--on-surface-variant);
}

.nfc-loading i {
  font-size: 1.5rem;
  color: var(--primary);
}

/* Historial NFC */
.nfc-historial-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.nfc-historial-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

.nfc-historial-item:hover {
  background: var(--surface-container);
}

.historial-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-container-high);
  color: var(--on-surface-variant);
}

.nfc-historial-item.action-assign .historial-icon {
  background: var(--success-container);
  color: var(--success);
}

.nfc-historial-item.action-reset .historial-icon {
  background: var(--warning-container);
  color: var(--warning);
}

.nfc-historial-item.action-read .historial-icon {
  background: var(--info-container);
  color: var(--info);
}

.historial-content {
  flex: 1;
  min-width: 0;
}

.historial-main {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.historial-action {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--on-surface);
}

.historial-patient {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

.historial-meta {
  display: flex;
  gap: 16px;
  margin-top: 4px;
}

.historial-meta span {
  font-size: 0.75rem;
  color: var(--outline);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Botón pequeño de ícono */
.btn-icon-sm {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-sm);
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-sm:hover {
  background: var(--surface-container);
  color: var(--primary);
  border-color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL NFC PROGRAMACIÓN
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-nfc-programar {
  max-width: 480px;
  text-align: center;
}

.modal-nfc-programar .modal-header {
  border-bottom: none;
  padding-bottom: 0;
}

.modal-nfc-programar .modal-body {
  padding: 20px 30px 30px;
}

/* Info del paciente en modal */
.nfc-modal-patient {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface-container);
  border-radius: var(--radius-lg);
  margin-bottom: 30px;
}

.patient-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.patient-info {
  text-align: left;
}

.patient-info h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--on-surface);
}

.patient-info p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

/* Contenedor de animación NFC */
.nfc-animation-container {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

/* Animación: Esperando */
.nfc-animation.waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
}

.nfc-device {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: var(--surface-container);
  border-radius: var(--radius-lg);
  border: 2px solid var(--outline-variant);
  min-width: 100px;
}

.nfc-device i {
  font-size: 2rem;
  color: var(--primary);
}

.nfc-device span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nfc-bracelet {
  animation: float-bracelet 2s ease-in-out infinite;
}

@keyframes float-bracelet {
  0%, 100% { transform: translateX(0) translateY(0); }
  50% { transform: translateX(5px) translateY(-3px); }
}

.nfc-reader {
  animation: reader-pulse-glow 2s ease-in-out infinite;
}

@keyframes reader-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
}

/* Ondas NFC */
.nfc-waves {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nfc-wave {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  opacity: 0;
  animation: nfc-wave-expand 2s ease-out infinite;
}

.nfc-wave:nth-child(2) {
  animation-delay: 0.5s;
}

.nfc-wave:nth-child(3) {
  animation-delay: 1s;
}

@keyframes nfc-wave-expand {
  0% {
    width: 30px;
    height: 30px;
    opacity: 0.8;
  }
  100% {
    width: 80px;
    height: 80px;
    opacity: 0;
  }
}

.nfc-data-dots {
  display: flex;
  gap: 6px;
}

.nfc-data-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: dot-flow 1.5s ease-in-out infinite;
}

.nfc-data-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.nfc-data-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-flow {
  0%, 100% { transform: scale(0.5); opacity: 0.3; }
  50% { transform: scale(1); opacity: 1; }
}

/* Animación: Programando */
.nfc-animation.programming {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nfc-progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.nfc-progress-ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.nfc-progress-ring .progress-bg {
  fill: none;
  stroke: var(--surface-container-high);
  stroke-width: 8;
}

.nfc-progress-ring .progress-bar {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  animation: progress-fill 2s ease-in-out infinite;
}

@keyframes progress-fill {
  0% { stroke-dashoffset: 283; }
  50% { stroke-dashoffset: 70; }
  100% { stroke-dashoffset: 283; }
}

.progress-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: var(--primary);
  animation: icon-pulse 1s ease-in-out infinite;
}

@keyframes icon-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Animación: Éxito */
.nfc-animation.success {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nfc-success-icon {
  font-size: 5rem;
  color: #22c55e;
  animation: success-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes success-pop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}

/* Animación: Error */
.nfc-animation.error {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nfc-error-icon {
  font-size: 5rem;
  color: #ef4444;
  animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* Mensaje de estado */
.nfc-status-message {
  margin-top: 8px;
}

.nfc-message-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0 0 8px;
}

.nfc-message-sub {
  font-size: 0.9rem;
  color: var(--on-surface-variant);
  margin: 0;
}

#nfcCountdown {
  font-weight: 700;
  color: var(--primary);
}

/* Footer del modal NFC */
.nfc-modal-footer {
  justify-content: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--outline-variant);
}

/* ═══════════════════════════════════════════════════════════════════════════
   INDICADOR NFC EN TABLA DE PACIENTES
   ═══════════════════════════════════════════════════════════════════════════ */

.nfc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.nfc-status-badge.assigned {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #166534;
}

.nfc-status-badge.assigned i:first-child {
  font-size: 0.9rem;
}

.nfc-status-badge.assigned i:last-child {
  font-size: 0.65rem;
}

.btn-nfc-table {
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.btn-nfc-table:hover {
  opacity: 1;
}

.btn-nfc-table i {
  transition: color var(--transition-fast);
}

.btn-nfc-table:hover i {
  color: var(--primary) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NFC - PÁGINA DE DESCARGA
   ═══════════════════════════════════════════════════════════════════════════ */

.nfc-download-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.nfc-download-header {
  text-align: center;
  margin-bottom: 30px;
}

.nfc-download-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.nfc-download-icon i {
  font-size: 2.5rem;
  color: white;
}

.nfc-download-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--on-surface);
  margin: 0 0 10px;
}

.nfc-download-header p {
  font-size: 1rem;
  color: var(--on-surface-variant);
  margin: 0;
}

.nfc-info-card {
  background: var(--surface-bright);
  border-radius: var(--radius-lg);
  border: 1px solid var(--outline-variant);
  overflow: hidden;
  margin-bottom: 30px;
}

.nfc-info-section {
  padding: 25px 30px;
  border-bottom: 1px solid var(--outline-variant);
}

.nfc-info-section:last-child {
  border-bottom: none;
}

.nfc-info-section h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--on-surface);
  margin: 0 0 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nfc-info-section h3 i {
  color: var(--primary);
}

.nfc-info-section p {
  font-size: 0.95rem;
  color: var(--on-surface-variant);
  margin: 0 0 12px;
  line-height: 1.6;
}

.nfc-info-section ul {
  list-style: none;
  padding: 0;
  margin: 15px 0 0;
}

.nfc-info-section ul li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.95rem;
  color: var(--on-surface);
}

.nfc-info-section ul li i {
  color: var(--success);
  font-size: 0.85rem;
}

.nfc-requirements {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.nfc-requirement {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: var(--surface-container);
  border-radius: var(--radius-md);
}

.nfc-requirement i {
  font-size: 1.5rem;
  color: var(--primary);
  width: 40px;
  text-align: center;
}

.nfc-requirement div {
  flex: 1;
}

.nfc-requirement strong {
  display: block;
  font-size: 0.95rem;
  color: var(--on-surface);
  margin-bottom: 2px;
}

.nfc-requirement span {
  font-size: 0.85rem;
  color: var(--on-surface-variant);
}

.nfc-instructions {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}

.nfc-instructions li {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--outline-variant);
}

.nfc-instructions li:last-child {
  border-bottom: none;
}

.step-number {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.nfc-instructions li span:last-child {
  font-size: 0.95rem;
  color: var(--on-surface);
}

.nfc-download-action {
  text-align: center;
}

.btn-nfc-download {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 40px;
  background: var(--gradient-primary);
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-nfc-download:hover {
  background: var(--gradient-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-nfc-download i {
  font-size: 1.3rem;
}

.nfc-download-note {
  margin-top: 15px;
  font-size: 0.85rem;
  color: var(--on-surface-variant);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nfc-download-note i {
  color: var(--primary);
}

/* NFC Download Options - Checkbox */
.nfc-download-options {
  margin-bottom: 20px;
}

.nfc-checkbox-option {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 14px 20px;
  background: var(--surface-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.nfc-checkbox-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.nfc-checkbox-option input[type="checkbox"] {
  display: none;
}

.nfc-checkbox-option .checkmark {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.nfc-checkbox-option input[type="checkbox"]:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.nfc-checkbox-option input[type="checkbox"]:checked + .checkmark::after {
  content: "✓";
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.nfc-checkbox-option .option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nfc-checkbox-option .option-text strong {
  color: var(--on-surface);
  font-size: 1rem;
}

.nfc-checkbox-option .option-text small {
  color: var(--on-surface-variant);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .nfc-download-container {
    padding: 10px;
  }

  .nfc-info-section {
    padding: 20px;
  }

  .nfc-requirement {
    flex-direction: column;
    text-align: center;
  }

  .btn-nfc-download {
    width: 100%;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SISTEMA DE GUÍA INTERACTIVA (TOUR)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Overlay del tour */
.tour-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.tour-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Elemento destacado durante el tour */
.tour-highlight {
  position: relative;
  z-index: 9999 !important;
  background: white !important;
  border-radius: 12px !important;
  transform: scale(1.08);
  box-shadow:
    0 0 0 3px #10b981,
    0 0 0 6px rgba(16, 185, 129, 0.3),
    0 20px 40px rgba(0, 0, 0, 0.25) !important;
  animation: tour-glow 2s ease-in-out infinite;
}

@keyframes tour-glow {
  0%, 100% {
    box-shadow:
      0 0 0 3px #10b981,
      0 0 0 6px rgba(16, 185, 129, 0.3),
      0 20px 40px rgba(0, 0, 0, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 4px #10b981,
      0 0 0 10px rgba(16, 185, 129, 0.2),
      0 25px 50px rgba(0, 0, 0, 0.3);
  }
}

/* Tooltip del tour */
.tour-tooltip {
  position: fixed;
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.tour-tooltip.active {
  opacity: 1;
  transform: translateY(0);
}

.tour-tooltip-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.tour-tooltip-robot {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
}

.tour-tooltip-robot dotlottie-wc {
  display: block;
}

.tour-tooltip-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  flex-shrink: 0;
}

.tour-tooltip-title {
  flex: 1;
}

.tour-tooltip-title h3 {
  font-size: 1.1em;
  color: var(--on-surface);
  margin: 0 0 4px;
}

.tour-tooltip-title span {
  font-size: 0.85em;
  color: var(--on-surface-variant);
}

.tour-tooltip-content {
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin-bottom: 20px;
}

.tour-tooltip-content p {
  margin: 0 0 10px;
}

.tour-tooltip-content ul {
  margin: 10px 0;
  padding-left: 20px;
}

.tour-tooltip-content li {
  margin-bottom: 6px;
}

/* Progreso del tour */
.tour-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.tour-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-container);
  border-radius: 3px;
  overflow: hidden;
}

.tour-progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

.tour-progress-text {
  font-size: 0.8em;
  color: var(--on-surface-variant);
  white-space: nowrap;
}

/* Navegación del tour */
.tour-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.tour-btn {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tour-btn-secondary {
  background: var(--surface-container);
  border: none;
  color: var(--on-surface-variant);
}

.tour-btn-secondary:hover {
  background: var(--surface-container-high);
}

.tour-btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: white;
}

.tour-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.tour-btn-skip {
  background: transparent;
  border: none;
  color: var(--outline);
  font-size: 13px;
}

.tour-btn-skip:hover {
  color: var(--on-surface);
}

/* Flecha del tooltip - apunta al elemento */
.tour-tooltip::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: white;
  transform: rotate(45deg);
  box-shadow: -3px -3px 8px rgba(0,0,0,0.1);
}

.tour-tooltip.arrow-top::before {
  top: -10px;
  left: var(--arrow-left, 50%);
  margin-left: -10px;
  box-shadow: -3px -3px 8px rgba(0,0,0,0.1);
}

.tour-tooltip.arrow-bottom::before {
  bottom: -10px;
  left: var(--arrow-left, 50%);
  margin-left: -10px;
  box-shadow: 3px 3px 8px rgba(0,0,0,0.1);
}

.tour-tooltip.arrow-left::before {
  left: -10px;
  top: var(--arrow-top, 50%);
  margin-top: -10px;
  box-shadow: -3px 3px 8px rgba(0,0,0,0.1);
}

.tour-tooltip.arrow-right::before {
  right: -10px;
  top: var(--arrow-top, 50%);
  margin-top: -10px;
  box-shadow: 3px -3px 8px rgba(0,0,0,0.1);
}

/* Botón para iniciar el tour */
.btn-start-tour {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 25px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-start-tour:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-start-tour i {
  color: white;
  font-size: 14px;
}

/* Modal de bienvenida del tour */
.tour-welcome {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 24px;
  padding: 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  z-index: 10000;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}

.tour-welcome-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 36px;
  color: white;
}

.tour-welcome-robot {
  width: 120px;
  height: 120px;
  margin: 0 auto 16px;
  animation: robot-wave 2s ease-in-out infinite;
}

.tour-welcome-robot dotlottie-wc {
  display: block;
}

@keyframes robot-wave {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

.tour-welcome h2 {
  font-size: 1.5em;
  color: var(--on-surface);
  margin: 0 0 12px;
}

.tour-welcome p {
  color: var(--on-surface-variant);
  line-height: 1.6;
  margin: 0 0 24px;
}

.tour-welcome-features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 30px;
}

.tour-welcome-feature {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-container);
  border-radius: 20px;
  font-size: 13px;
  color: var(--on-surface-variant);
}

.tour-welcome-feature i {
  color: var(--primary);
}

.tour-welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tour-welcome .tour-btn-primary {
  width: 100%;
  justify-content: center;
  padding: 16px;
  font-size: 16px;
}

/* Responsive del tour */
@media (max-width: 768px) {
  .btn-start-tour {
    padding: 10px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
  }

  .btn-start-tour span {
    display: none;
  }

  .btn-start-tour i {
    margin: 0;
    font-size: 18px;
  }

  .tour-tooltip {
    max-width: calc(100vw - 30px);
    padding: 16px;
    width: auto;
  }

  .tour-tooltip-robot {
    width: 40px;
    height: 40px;
  }

  .tour-tooltip-robot dotlottie-wc {
    width: 40px !important;
    height: 40px !important;
  }

  .tour-tooltip::before {
    display: none;
  }

  .tour-pointer-hand {
    font-size: 36px;
  }

  .tour-pointer-ring {
    width: 60px;
    height: 60px;
  }

  .tour-welcome {
    padding: 30px 20px;
  }

  .tour-nav {
    flex-direction: column;
  }

  .tour-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MEJORAS GLOBALES RESPONSIVE Y UX/UI
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   1. TABLAS RESPONSIVE - Scroll horizontal en móvil
   ───────────────────────────────────────────────────────────────────────────── */

.data-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

.data-table {
  min-width: 600px; /* Fuerza scroll en pantallas pequeñas */
}

/* Indicador de scroll en tablas */
.table-scroll-hint {
  display: none;
  text-align: center;
  padding: 8px;
  background: var(--surface-container);
  color: var(--on-surface-variant);
  font-size: 12px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.table-scroll-hint i {
  margin-right: 5px;
  animation: scrollHint 1.5s ease-in-out infinite;
}

@keyframes scrollHint {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

@media (max-width: 768px) {
  .table-scroll-hint {
    display: block;
  }

  .data-table {
    font-size: 13px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
    white-space: nowrap;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   2. MODALES RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

.modal {
  max-height: 90vh;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .modal {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px;
    max-height: 85vh;
  }

  .modal-header {
    padding: 15px;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 10;
  }

  .modal-header h3 {
    font-size: 1.1em;
  }

  .modal-body {
    padding: 15px;
  }

  .modal-actions {
    padding: 15px;
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid var(--outline-variant);
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions button {
    width: 100%;
    justify-content: center;
  }

  /* Form rows en una columna */
  .modal .form-row {
    flex-direction: column;
    gap: 15px;
  }

  .modal .form-group {
    width: 100%;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   3. NAVEGACIÓN MÓVIL MEJORADA
   ───────────────────────────────────────────────────────────────────────────── */

/* Botón menú hamburguesa - Oculto por defecto en desktop */
.menu-toggle {
  display: none;
}

/* Overlay sidebar - Oculto por defecto */
.sidebar-overlay {
  display: none;
}

@media (max-width: 768px) {
  /* Sidebar/Nav-rail como drawer */
  .nav-rail, .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    width: 280px !important;
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: var(--shadow-xl);
  }

  .nav-rail.open, .sidebar.open {
    left: 0;
  }

  /* Overlay cuando sidebar está abierto */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.active {
    display: block;
  }

  /* Main content ocupa todo */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  /* Botón menú hamburguesa */
  .menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    z-index: 998;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
  }

  .menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(16, 185, 129, 0.5);
  }

  .menu-toggle:active {
    transform: scale(0.95);
  }

  /* Header más compacto */
  .top-header {
    padding: 10px 15px;
  }

  .page-title h1 {
    font-size: 1.2em;
  }

  .page-title p {
    display: none;
  }

  /* Navbar items más grandes para touch */
  .nav-item {
    padding: 14px 20px;
    font-size: 15px;
  }

  .nav-item i {
    font-size: 20px;
    width: 28px;
  }

  /* Nav header más compacto */
  .nav-header {
    padding: 15px;
  }

  .nav-brand h2 {
    font-size: 1.3em;
  }
}

/* Ocultar menú toggle en desktop */
@media (min-width: 769px) {
  .menu-toggle {
    display: none !important;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   4. BOTONES TOUCH-FRIENDLY
   ───────────────────────────────────────────────────────────────────────────── */

/* Tamaño mínimo para touch */
button, .btn, .btn-primary, .btn-secondary, .btn-icon {
  min-height: 44px;
  min-width: 44px;
}

/* Botones pequeños mantienen su tamaño pero con área touch expandida */
.btn-sm, .btn-mini, .btn-icon-sm {
  position: relative;
  min-height: 32px;
  min-width: 32px;
}

.btn-sm::before, .btn-mini::before, .btn-icon-sm::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
}

/* Estados hover/active más claros */
button:active, .btn:active {
  transform: scale(0.97);
  transition: transform 0.1s;
}

/* Focus visible para accesibilidad */
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   5. FORMULARIOS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 15px;
  }

  .form-group {
    width: 100% !important;
    flex: none !important;
  }

  input, select, textarea {
    font-size: 16px !important; /* Evita zoom en iOS */
    padding: 14px 16px;
  }

  label {
    font-size: 14px;
    margin-bottom: 6px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   6. ESTADOS VACÍOS MEJORADOS
   ───────────────────────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 30px;
  text-align: center;
  color: var(--on-surface-variant);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--surface-container);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.empty-state-icon i {
  font-size: 32px;
  color: var(--outline);
}

.empty-state-title {
  font-size: 1.2em;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.95em;
  max-width: 300px;
  line-height: 1.5;
}

.empty-state-action {
  margin-top: 20px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   7. CARDS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 1200px) {
  .stats-cards, .dashboard-cards, .config-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-cards, .dashboard-cards, .config-cards {
    grid-template-columns: 1fr;
  }

  .stat-card, .dashboard-card, .config-card {
    padding: 20px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   8. MEJORAS DE CONTRASTE Y ACCESIBILIDAD
   ───────────────────────────────────────────────────────────────────────────── */

/* Textos secundarios con mejor contraste */
.text-muted, .text-secondary, [style*="color:#666"], [style*="color: #666"],
[style*="color:#999"], [style*="color: #999"] {
  color: #555 !important; /* Mejor contraste que #666 o #999 */
}

/* Labels de formulario */
label {
  color: var(--on-surface);
  font-weight: 500;
}

/* Placeholder con contraste */
::placeholder {
  color: #888;
  opacity: 1;
}

/* Links accesibles */
a {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--primary);
}

/* Skip link para navegación por teclado */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  z-index: 10000;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 10px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   9. MAPA HABITACIONAL RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .mapa-edificio {
    flex-direction: column;
  }

  .mapa-ala {
    width: 100%;
  }

  .habitacion-card {
    min-width: 140px;
  }
}

@media (max-width: 768px) {
  .mapa-piso {
    padding: 15px;
  }

  .habitaciones-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .habitacion-card {
    min-width: auto;
    padding: 12px;
  }

  .habitacion-numero {
    font-size: 1em;
  }

  .cama-item {
    padding: 8px;
    font-size: 12px;
  }

  /* Panel lateral como modal en móvil */
  .panel-paciente-flotante {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
    z-index: 1001;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   10. DASHBOARD RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

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

  .quick-actions {
    flex-wrap: wrap;
  }

  .quick-action-btn {
    flex: 1;
    min-width: 45%;
    padding: 15px 10px;
    font-size: 13px;
  }

  .quick-action-btn i {
    font-size: 20px;
  }

  .quick-action-btn span {
    display: block;
    margin-top: 5px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   11. CALENDARIO RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .fc .fc-toolbar {
    flex-direction: column;
    gap: 10px;
  }

  .fc .fc-toolbar-title {
    font-size: 1.2em;
  }

  .fc .fc-button {
    padding: 8px 12px;
    font-size: 13px;
  }

  .fc .fc-daygrid-day {
    min-height: 80px;
  }

  .fc .fc-event {
    font-size: 11px;
    padding: 2px 4px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   12. FACTURACIÓN RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .facturacion-tabs {
    flex-wrap: wrap;
  }

  .facturacion-tab-btn {
    flex: 1;
    min-width: 45%;
    padding: 12px;
    font-size: 13px;
  }

  .facturacion-resumen {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .facturacion-resumen {
    grid-template-columns: 1fr;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   13. FICHA PACIENTE RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .ficha-header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .ficha-foto {
    margin: 0 auto;
  }

  .ficha-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
  }

  .ficha-tab-btn {
    white-space: nowrap;
    padding: 10px 15px;
    font-size: 13px;
  }

  .ficha-section {
    padding: 15px;
  }

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

/* ─────────────────────────────────────────────────────────────────────────────
   14. WIZARD ADMISIÓN RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .wizard-indicators {
    gap: 5px;
  }

  .wizard-step-indicator {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }

  .wizard-step-indicator span {
    display: none;
  }

  .wizard-step-line {
    width: 20px;
  }

  .wizard-nav {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .wizard-nav button {
    width: 100%;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   15. TOAST NOTIFICATIONS RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 80px; /* Espacio para el botón menú */
  }

  .toast {
    width: 100%;
    min-width: auto;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   16. GERIABOT RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .geriabot-container {
    bottom: 90px; /* Encima del menú toggle */
  }

  .geriabot-widget {
    width: 70px;
    height: 70px;
  }

  .geriabot-chat {
    width: calc(100vw - 20px);
    height: 60vh;
    right: 10px;
    bottom: 170px;
  }

  .geriabot-bubble {
    max-width: 200px;
    font-size: 13px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   17. LOADING STATES
   ───────────────────────────────────────────────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 100px;
  margin-bottom: 10px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   18. ANIMACIONES SUAVES
   ───────────────────────────────────────────────────────────────────────────── */

/* Transiciones suaves globales */
* {
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
  transition-duration: 0.15s;
  transition-timing-function: ease;
}

/* Deshabilitar animaciones si el usuario lo prefiere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   19. PRINT STYLES
   ───────────────────────────────────────────────────────────────────────────── */

@media print {
  .sidebar, .top-header, .menu-toggle, .geriabot-container,
  .toast-container, .modal-overlay, button, .btn {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .section {
    padding: 0 !important;
  }

  body {
    background: white;
    color: black;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   20. MÓDULOS DE GESTIÓN - NUEVOS ESTILOS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Tarjetas de configuración de módulos */
.config-item-card {
  background: #f8fafc;
  border-radius: 10px;
  padding: 15px;
  border-left: 4px solid var(--primary);
  transition: all 0.2s ease;
}

.config-item-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* Módulos de internación cards */
.modulo-internacion-card {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px;
  padding: 20px;
  border-left: 4px solid #6366f1;
  transition: all 0.2s ease;
}

.modulo-internacion-card:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}

/* Badges de estado */
.badge-activo {
  background: #dcfce7;
  color: #16a34a;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-inactivo {
  background: #fee2e2;
  color: #dc2626;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Formulario de Epicrisis */
.epicrisis-section {
  background: #f8fafc;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.epicrisis-section h4 {
  margin: 0 0 15px 0;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.epicrisis-section h4 i {
  color: #ef4444;
}

/* Vista previa de epicrisis para imprimir */
.epicrisis-preview {
  font-family: 'Times New Roman', serif;
  line-height: 1.8;
}

.epicrisis-preview h1 {
  text-align: center;
  color: #1e293b;
  border-bottom: 2px solid #ef4444;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.epicrisis-preview h4 {
  color: #1e293b;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 5px;
  margin-top: 20px;
}

.epicrisis-preview p {
  margin: 10px 0;
  text-align: justify;
}

/* Reportes familiares */
.reporte-familiar-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
  border-left: 3px solid #14b8a6;
  transition: all 0.2s ease;
}

.reporte-familiar-card:hover {
  background: #f0fdfa;
}

/* Reglas comerciales */
.regla-comercial-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.regla-comercial-card:hover {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   21. ARANCELES DE PROFESIONALES - ESTILOS MEJORADOS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Grid de profesionales */
#profesionalesArancelesGrid {
  display: grid;
  gap: 12px;
  max-height: 450px;
  overflow-y: auto;
  padding-right: 5px;
}

#profesionalesArancelesGrid::-webkit-scrollbar {
  width: 6px;
}

#profesionalesArancelesGrid::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

#profesionalesArancelesGrid::-webkit-scrollbar-thumb {
  background: #c7d2fe;
  border-radius: 3px;
}

#profesionalesArancelesGrid::-webkit-scrollbar-thumb:hover {
  background: #a5b4fc;
}

/* Tarjeta de profesional */
.profesional-arancel-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.25s ease;
  cursor: default;
}

.profesional-arancel-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.12);
  border-color: #c7d2fe;
}

/* Avatar del profesional */
.profesional-arancel-avatar {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Info del profesional */
.profesional-arancel-info {
  flex: 1;
  min-width: 0;
}

.profesional-arancel-nombre {
  font-weight: 600;
  font-size: 15px;
  color: #1e293b;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profesional-arancel-rol {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Grid de aranceles */
.profesional-aranceles-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  border-radius: 10px;
}

.profesional-aranceles-grid > div {
  text-align: center;
}

.profesional-aranceles-grid .arancel-label {
  font-size: 10px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.profesional-aranceles-grid .arancel-valor {
  font-weight: 600;
  font-size: 13px;
}

.profesional-aranceles-grid .arancel-valor.consulta { color: #2563eb; }
.profesional-aranceles-grid .arancel-valor.visita { color: #d97706; }
.profesional-aranceles-grid .arancel-valor.procedimiento { color: #db2777; }
.profesional-aranceles-grid .arancel-valor.guardia { color: #16a34a; }

/* Badge sin aranceles */
.profesional-sin-aranceles {
  padding: 8px 16px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profesional-sin-aranceles span {
  color: #92400e;
  font-size: 12px;
  font-weight: 500;
}

/* Botón editar en tarjeta */
.profesional-arancel-card .btn-editar-arancel {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.profesional-arancel-card .btn-editar-arancel:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Modal Editar Aranceles - Estilos mejorados */
#modalEditarAranceles .arancel-input-card {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

#modalEditarAranceles .arancel-input-card:hover {
  border-color: #c7d2fe;
}

#modalEditarAranceles .arancel-input-card.consulta:hover { border-color: #93c5fd; }
#modalEditarAranceles .arancel-input-card.visita:hover { border-color: #fcd34d; }
#modalEditarAranceles .arancel-input-card.procedimiento:hover { border-color: #f9a8d4; }
#modalEditarAranceles .arancel-input-card.guardia:hover { border-color: #86efac; }

#modalEditarAranceles .arancel-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  font-size: 16px;
}

#modalEditarAranceles .arancel-icon.consulta { background: #dbeafe; color: #2563eb; }
#modalEditarAranceles .arancel-icon.visita { background: #fef3c7; color: #d97706; }
#modalEditarAranceles .arancel-icon.procedimiento { background: #fce7f3; color: #db2777; }
#modalEditarAranceles .arancel-icon.guardia { background: #dcfce7; color: #16a34a; }

#modalEditarAranceles .arancel-input-card label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  display: block;
  margin-bottom: 8px;
}

#modalEditarAranceles .arancel-input-card input {
  width: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

#modalEditarAranceles .arancel-input-card input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Responsive para tarjetas de aranceles */
@media (max-width: 768px) {
  .profesional-arancel-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
  }

  .profesional-aranceles-grid {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }

  .profesional-arancel-card .btn-editar-arancel {
    width: 100%;
    justify-content: center;
  }

  .profesional-sin-aranceles {
    width: 100%;
    justify-content: center;
  }
}

/* Estado vacío mejorado */
.profesionales-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.profesionales-empty-state i {
  font-size: 48px;
  color: #cbd5e1;
  margin-bottom: 15px;
  display: block;
}

.profesionales-empty-state p {
  margin: 0;
  font-size: 15px;
}

.profesionales-empty-state .empty-hint {
  margin-top: 8px;
  font-size: 13px;
  color: #94a3b8;
}

/* Animación de entrada para las tarjetas */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profesional-arancel-card {
  animation: fadeInUp 0.3s ease forwards;
}

.profesional-arancel-card:nth-child(1) { animation-delay: 0ms; }
.profesional-arancel-card:nth-child(2) { animation-delay: 50ms; }
.profesional-arancel-card:nth-child(3) { animation-delay: 100ms; }
.profesional-arancel-card:nth-child(4) { animation-delay: 150ms; }
.profesional-arancel-card:nth-child(5) { animation-delay: 200ms; }
.profesional-arancel-card:nth-child(n+6) { animation-delay: 250ms; }

/* Botones de acción pequeños */
.btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
}

.btn-icon.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Modal toolbar */
.modal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e2e8f0;
}

/* Servicios del módulo en formulario */
.servicio-modulo-item {
  display: flex;
  gap: 10px;
  align-items: center;
  background: white;
  padding: 10px;
  border-radius: 6px;
}

.servicio-modulo-item select,
.servicio-modulo-item input {
  font-size: 13px;
  padding: 6px 10px;
}

/* Indicador de honorario fijo */
.honorario-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #16a34a;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.honorario-indicator i {
  font-size: 11px;
}

/* Info boxes en modales */
.info-box {
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.info-box.success {
  background: #f0fdf4;
  border-left: 4px solid #22c55e;
}

.info-box.warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.info-box.info {
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
}

.info-box.danger {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}

/* ═══════════════════════════════════════════════════════════════════════════
   22. MÓDULOS DE INTERNACIÓN - CONFIGURACIÓN DE FACTURACIÓN
   ═══════════════════════════════════════════════════════════════════════════ */

/* Opciones de tipo de facturación */
.facturacion-tipo-option input:checked + .facturacion-tipo-content {
  border-color: #1e293b !important;
  background: #f1f5f9 !important;
}

.facturacion-tipo-option input:checked + .facturacion-tipo-content i {
  color: #1e293b !important;
}

.facturacion-tipo-content {
  transition: all 0.2s ease;
}

.facturacion-tipo-content:hover {
  border-color: #94a3b8 !important;
  background: #f8fafc !important;
}

/* Sección de módulo de internación */
#seccionModuloInternacion {
  animation: fadeIn 0.3s ease;
}

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

/* Select de módulos */
#configModuloId {
  font-size: 14px;
  padding: 12px;
}

/* Total mensual highlight */
#totalMensualModulo {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   23. PRINT STYLES - EPICRISIS Y REPORTES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
  /* Estilos específicos para imprimir epicrisis */
  .epicrisis-print {
    font-family: 'Times New Roman', serif;
    font-size: 12pt;
    line-height: 1.6;
    color: black;
    background: white;
  }

  .epicrisis-print h1 {
    font-size: 18pt;
    text-align: center;
    margin-bottom: 20pt;
  }

  .epicrisis-print h4 {
    font-size: 12pt;
    font-weight: bold;
    margin-top: 15pt;
    border-bottom: 1pt solid #333;
    padding-bottom: 3pt;
  }

  .epicrisis-print p {
    text-align: justify;
    margin: 8pt 0;
  }

  /* Ocultar elementos no necesarios para impresión */
  .no-print {
    display: none !important;
  }

  /* Forzar saltos de página */
  .page-break {
    page-break-before: always;
  }

  /* Evitar cortar elementos importantes */
  .epicrisis-section {
    page-break-inside: avoid;
  }

  /* Pie de página para impresión */
  .print-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt;
    color: #666;
    border-top: 1pt solid #ddd;
    padding-top: 5pt;
  }

  /* Encabezado para impresión */
  .print-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9pt;
    color: #666;
    border-bottom: 1pt solid #ddd;
    padding-bottom: 5pt;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   22. RESPONSIVE - NUEVOS MÓDULOS
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Modales ajustados para móvil */
  #modalEpicrisis .modal-body {
    padding: 15px;
  }

  .epicrisis-section {
    padding: 15px;
  }

  .form-row {
    flex-direction: column;
  }

  .form-row .form-group {
    width: 100%;
    margin-right: 0;
  }

  /* Cards de módulos en móvil */
  .modulo-internacion-card {
    padding: 15px;
  }

  .modulo-internacion-card > div:first-child {
    flex-direction: column;
    gap: 10px;
  }

  .modulo-internacion-card > div:first-child > div:last-child {
    text-align: left;
  }

  /* Reglas comerciales en móvil */
  .regla-comercial-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .regla-comercial-card > div:last-child {
    width: 100%;
    justify-content: flex-end;
    display: flex;
  }

  /* Modal toolbar en móvil */
  .modal-toolbar {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .modal-toolbar button {
    width: 100%;
  }

  /* Servicios del módulo en móvil */
  .servicio-modulo-item {
    flex-wrap: wrap;
  }

  .servicio-modulo-item select,
  .servicio-modulo-item input[type="text"] {
    flex: 1 1 100%;
    margin-bottom: 8px;
  }

  .servicio-modulo-item input[type="number"] {
    flex: 0 0 60px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ESTILO MINIMALISTA - SOBRESCRITURAS GLOBALES
   Neutraliza colores excesivos, mantiene verde solo para logo y estados
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- BOTONES PRIMARIOS: Negro en lugar de verde --- */
.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary {
  background: #171717 !important;
  border-color: #171717 !important;
  color: white !important;
}

.btn-primary:hover,
button.btn-primary:hover {
  background: #262626 !important;
  border-color: #262626 !important;
}

/* --- BOTONES SECUNDARIOS: Gris neutro --- */
.btn-secondary,
button.btn-secondary {
  background: #f5f5f5 !important;
  border: 1px solid #e5e5e5 !important;
  color: #171717 !important;
}

.btn-secondary:hover,
button.btn-secondary:hover {
  background: #e5e5e5 !important;
}

/* --- BOTONES DE EXITO: Mantener verde --- */
.btn-success,
button.btn-success {
  background: #10b981 !important;
  border-color: #10b981 !important;
}

.btn-success:hover,
button.btn-success:hover {
  background: #059669 !important;
  border-color: #059669 !important;
}

/* --- CARDS Y CONTENEDORES: Bordes simples --- */
.card,
.stat-card,
.patient-card,
.habitacion-card,
.evolucion-item,
.medicamento-item,
.factura-item {
  border: 1px solid #e5e5e5 !important;
  box-shadow: none !important;
}

.card:hover,
.stat-card:hover,
.patient-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

/* --- STAT CARDS: Iconos neutrales excepto estados --- */
.stat-icon {
  background: #f5f5f5 !important;
  color: #525252 !important;
}

.stat-icon.primary,
.stat-icon.success,
.stat-icon.green {
  background: #f0fdf4 !important;
  color: #10b981 !important;
}

.stat-icon.warning,
.stat-icon.orange {
  background: #fef3c7 !important;
  color: #d97706 !important;
}

.stat-icon.danger,
.stat-icon.red {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.stat-icon.info,
.stat-icon.blue {
  background: #dbeafe !important;
  color: #2563eb !important;
}

/* --- QUICK ACTIONS: Bordes simples, iconos con color sutil --- */
.quick-action-btn {
  background: #ffffff !important;
  border: 1px solid #e5e5e5 !important;
  box-shadow: none !important;
  color: #1e293b !important;
  text-shadow: none !important;
}

.quick-action-btn:hover {
  border-color: #a3a3a3 !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}

.quick-action-btn i {
  color: #525252 !important;
}

.quick-action-btn.pacientes i { color: #10b981 !important; }
.quick-action-btn.usuarios i { color: #2563eb !important; }
.quick-action-btn.evolucion i { color: #8b5cf6 !important; }
.quick-action-btn.farmacia i { color: #f97316 !important; }
.quick-action-btn.habitaciones i { color: #0d9488 !important; }
.quick-action-btn.reportes i { color: #dc2626 !important; }

/* --- INPUTS Y SELECTS: Bordes grises --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
  border: 1px solid #e5e5e5 !important;
  background: #ffffff !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #a3a3a3 !important;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.05) !important;
  outline: none !important;
}

/* --- TABS: Estilo neutro --- */
.ficha-tab,
.tab {
  color: #525252 !important;
  border-bottom-color: transparent !important;
}

.ficha-tab:hover,
.tab:hover {
  color: #171717 !important;
  background: #f5f5f5 !important;
}

.ficha-tab.active,
.tab.active {
  color: #171717 !important;
  border-bottom-color: #171717 !important;
  background: #ffffff !important;
  font-weight: 600 !important;
}

/* --- MODALS: Headers sin gradientes coloridos (excepto especiales) --- */
.modal-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e5e5e5 !important;
}

.modal-header h2,
.modal-header h3 {
  color: #171717 !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: #171717 !important;
}

/* Mantener headers con fondo de color legibles */
.modal-header[style*="background"] h3,
.modal-header[style*="background"] h2 {
  -webkit-text-fill-color: white !important;
  color: white !important;
}

/* --- DROPDOWN Y MENUS: Sin bordes verdes --- */
.dropdown-menu,
.user-dropdown {
  border: 1px solid #e5e5e5 !important;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12) !important;
}

.dropdown-item:hover,
.user-dropdown-item:hover {
  background: #f5f5f5 !important;
}

/* --- TABLAS: Estilo limpio --- */
table thead,
table th {
  background: #fafafa !important;
}

table th {
  color: #525252 !important;
  border-bottom: 1px solid #e5e5e5 !important;
}

table td {
  border-bottom: 1px solid #f5f5f5 !important;
}

table tr:hover {
  background: #fafafa !important;
}

/* --- BADGES: Colores sutiles --- */
.badge,
.chip {
  background: #f5f5f5 !important;
  color: #525252 !important;
}

.badge.primary,
.badge.success,
.badge.verde,
.badge.activo {
  background: #dcfce7 !important;
  color: #16a34a !important;
}

.badge.warning,
.badge.amarillo,
.badge.pendiente {
  background: #fef3c7 !important;
  color: #d97706 !important;
}

.badge.danger,
.badge.rojo,
.badge.error,
.badge.alta {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.badge.info,
.badge.azul {
  background: #dbeafe !important;
  color: #2563eb !important;
}

.chip.active {
  background: #171717 !important;
  color: white !important;
}

/* --- INDICADOR DE CARGA: Mantener verde --- */
.geriatris-loader,
.loading-overlay .heart-icon {
  color: #10b981 !important;
}

/* --- ICONOS EN GENERAL: Neutrales excepto estados --- */
.ficha-seccion h4 i,
.section-header i,
.card-title i {
  color: #525252 !important;
}

/* --- EVOLUCIONES: Iconos neutrales --- */
.evolucion-tipo-icon {
  background: #f5f5f5 !important;
  color: #525252 !important;
}

/* --- NOTIFICACIONES: Borde lateral de color --- */
.notification {
  background: #ffffff !important;
  border: 1px solid #e5e5e5 !important;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12) !important;
}

.notification.success { border-left: 4px solid #16a34a !important; }
.notification.error { border-left: 4px solid #dc2626 !important; }
.notification.warning { border-left: 4px solid #d97706 !important; }
.notification.info { border-left: 4px solid #2563eb !important; }

/* --- ALERTAS: Mantener colores semanticos --- */
.alert {
  border-radius: 8px !important;
}

/* --- PAGINATION: Estilo neutro --- */
.pagination button,
.pagination a {
  background: #ffffff !important;
  border: 1px solid #e5e5e5 !important;
  color: #525252 !important;
}

.pagination button:hover,
.pagination a:hover {
  background: #f5f5f5 !important;
}

.pagination button.active,
.pagination a.active {
  background: #171717 !important;
  border-color: #171717 !important;
  color: white !important;
}

/* --- SWITCH/TOGGLE: Verde solo cuando activo --- */
.toggle-slider,
.switch-slider {
  background: #e5e5e5 !important;
}

input:checked + .toggle-slider,
input:checked + .switch-slider {
  background: #10b981 !important;
}

/* --- PROGRESS BARS: Verde por defecto --- */
.progress {
  background: #e5e5e5 !important;
}

.progress-bar {
  background: #10b981 !important;
}

.progress-bar.warning { background: #d97706 !important; }
.progress-bar.danger { background: #dc2626 !important; }

/* --- SCROLLBARS: Azul NEURAVANTA --- */
::-webkit-scrollbar-thumb {
  background: #93b4f5 !important;
}

::-webkit-scrollbar-thumb:hover {
  background: #1e40af !important;
}

/* --- FOCUS VISIBLE: Sutil --- */
:focus-visible {
  outline: 2px solid #a3a3a3 !important;
  outline-offset: 2px !important;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #a3a3a3 !important;
  outline-offset: 2px !important;
}

/* --- SELECTION: Sutil --- */
::selection {
  background: rgba(0, 0, 0, 0.1) !important;
  color: inherit !important;
}

/* --- MODULO FACTURACION: Neutro --- */
.modulo-facturacion-header {
  background: #fafafa !important;
  border: 1px solid #e5e5e5 !important;
}

.modulo-facturacion-icon {
  background: #f5f5f5 !important;
  color: #525252 !important;
}

.modulo-total-bar {
  background: #171717 !important;
}

/* --- FICHA PACIENTE HEADER: Si tiene gradiente, mantener legible --- */
.ficha-header {
  background: linear-gradient(135deg, #171717, #262626) !important;
}

/* --- TIPOS DE ATENCION BUTTONS: Neutrales --- */
.tipo-atencion-btn {
  background: #f5f5f5 !important;
  border: 1px solid #e5e5e5 !important;
  color: #525252 !important;
}

.tipo-atencion-btn:hover,
.tipo-atencion-btn.selected {
  background: #171717 !important;
  border-color: #171717 !important;
  color: white !important;
}

/* --- NAV BOTTOM SECTION: Borde simple --- */
.nav-bottom {
  border-top: 1px solid #e5e5e5 !important;
}

.nav-user-section {
  background: #fafafa !important;
  border: 1px solid #e5e5e5 !important;
}

/* --- FORMULARIOS DE ADMISION/ALTA: Neutros --- */
.admission-step,
.alta-step {
  background: #ffffff !important;
  border: 1px solid #e5e5e5 !important;
}

/* --- ICONOS DE SECCION: Neutrales --- */
.indicador-icon {
  background: #f5f5f5 !important;
  color: #525252 !important;
}

.indicador-icon.green {
  background: #dcfce7 !important;
  color: #16a34a !important;
}

.indicador-icon.blue {
  background: #dbeafe !important;
  color: #2563eb !important;
}

.indicador-icon.orange {
  background: #fef3c7 !important;
  color: #d97706 !important;
}

/* --- REMOVER CUALQUIER BOX-SHADOW VERDE RESTANTE --- */
*[style*="box-shadow"] {
  box-shadow: none;
}

/* --- TOP BAR: Limpia --- */
.top-bar {
  background: #ffffff !important;
  border-bottom: 1px solid #e5e5e5 !important;
}

/* --- SECTION BACKGROUNDS --- */
.section,
.ficha-content {
  background: #fafafa !important;
}

/* --- FICHA TABS CONTAINER --- */
.ficha-tabs {
  background: #f5f5f5 !important;
  border-bottom: 1px solid #e5e5e5 !important;
}

/* --- ASEGURAR QUE EL LOGO MANTENGA SU VERDE --- */
.nav-logo {
  color: transparent !important;
  -webkit-text-stroke: 1.2px #1e40af !important;
  -webkit-text-fill-color: transparent !important;
  border-color: #1e40af !important;
}

.nav-brand h2 span {
  color: #1e40af !important;
}

.nav-user-role {
  color: #10b981 !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DOCUMENTOS / EPICRISIS - Lista de documentos
   ═══════════════════════════════════════════════════════════════════════════ */
.documentos-lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.documento-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.documento-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.documento-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.documento-icon.firmado {
  background: #dcfce7;
  color: #16a34a;
}

.documento-icon.pendiente {
  background: #fef3c7;
  color: #d97706;
}

.documento-info {
  flex: 1;
  min-width: 0;
}

.documento-titulo {
  font-size: 15px;
  font-weight: 600;
  color: #171717;
  margin-bottom: 4px;
}

.documento-detalles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #737373;
  margin-bottom: 4px;
}

.documento-detalles span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.documento-detalles i {
  font-size: 11px;
}

.documento-motivo {
  font-size: 13px;
  color: #525252;
}

.documento-acciones {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.empty-state-small {
  text-align: center;
  padding: 40px 20px;
  color: #737373;
}

.empty-state-small i {
  font-size: 40px;
  margin-bottom: 12px;
  color: #d4d4d4;
}

.empty-state-small p {
  font-size: 14px;
  margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NEURAVANTA - macOS GLASS UI OVERRIDES
   Solo visual/estética. Ninguna funcionalidad modificada.
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- CURSOR PERSONALIZADO NEURAVANTA --- */
body, * {
  cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 20 20"><path fill="%231e40af" stroke="%231e3a5f" stroke-width="0.8" d="M1 1 L1 15 L4.5 11.5 L7.5 17 L10 15.5 L7 9.5 L12 9.5 Z"/></svg>') 1 1, auto;
}

a, button, select, label[for], .checkbox-wrapper, .nav-item, .toggle-password, .btn, .btn-primary, .btn-secondary,
.stat-card, .quick-action-btn, .notification-btn, .user-menu-btn, .tab, .filter-tab, .dropdown-item,
.modal-close, .close-btn, .geriabot-widget, .geriabot-bubble, .chat-btn-minimize, .chat-btn-close,
.chat-send-btn, .tour-btn-primary, .tour-close-btn, [onclick], [role="button"] {
  cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="%231e40af" stroke="%231e3a5f" stroke-width="0.5" d="M6.5 10.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v3h1V7c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v6.5h1V8c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v5.5h1V10c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5v7c0 2.21-1.79 4-4 4h-4.53c-1.34 0-2.6-.67-3.35-1.78l-2.97-4.42c-.32-.48-.26-1.12.15-1.53.51-.51 1.34-.51 1.85 0l1.35 1.35V10.5z"/></svg>') 6 0, pointer !important;
}

a:active, button:active, .btn:active, .nav-item:active, .stat-card:active, .quick-action-btn:active,
[onclick]:active, [role="button"]:active {
  cursor: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="%231e3a5f" stroke="%23172554" stroke-width="0.5" d="M19 12c0-.83-.67-1.5-1.5-1.5S16 11.17 16 12h-1c0-.83-.67-1.5-1.5-1.5S12 11.17 12 12h-1c0-.83-.67-1.5-1.5-1.5S8 11.17 8 12v5.5l-1.35-1.35c-.51-.51-1.34-.51-1.85 0-.41.41-.47 1.05-.15 1.53l2.97 4.42c.75 1.11 2.01 1.78 3.35 1.78H15.5c2.21 0 4-1.79 4-4V12z"/></svg>') 6 0, grabbing !important;
}

input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="search"],
input[type="tel"], input[type="url"], textarea, [contenteditable="true"] {
  cursor: text !important;
}

/* --- BODY: Fondo gris macOS con gradientes sutiles --- */
body {
  background: #e8ecf2 !important;
  background-image:
    radial-gradient(ellipse at 10% 20%, rgba(30,64,175,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(13,148,136,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% -10%, rgba(148,163,184,0.06) 0%, transparent 40%) !important;
}

/* Noise texture overlay para efecto vidrio esmerilado */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 99999;
  pointer-events: none;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- SIDEBAR: Vidrio esmerilado + Layout compacto (sin scroll) --- */
.nav-rail {
  width: 250px !important;
  background: rgba(236,239,244,0.72) !important;
  backdrop-filter: blur(60px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(60px) saturate(200%) !important;
  border-right: 1px solid rgba(0,0,0,0.08) !important;
  padding: 12px 10px !important;
  overflow-y: hidden !important;
}

.nav-header {
  margin-bottom: 10px !important;
  padding: 0 6px !important;
  gap: 10px !important;
}

.nav-logo {
  width: 38px !important;
  height: 38px !important;
  border-radius: 10px !important;
  background: linear-gradient(145deg, rgba(30,64,175,0.12), rgba(13,148,136,0.08)) !important;
  border: 1px solid rgba(30,64,175,0.1) !important;
  -webkit-text-stroke: 1.2px #1e40af !important;
}

.nav-logo i {
  font-size: 17px !important;
}

.neuravanta-brand {
  font-size: 15px !important;
  letter-spacing: 2.5px !important;
}

.nav-brand p {
  font-size: 8px !important;
  color: #8e8e93 !important;
  letter-spacing: 1.5px !important;
}

/* Items compactos - todos visibles sin scroll */
.nav-items {
  gap: 2px !important;
  padding-bottom: 0 !important;
  overflow-y: hidden !important;
}

.nav-item {
  padding: 9px 12px !important;
  border-radius: 8px !important;
  gap: 10px !important;
  color: #48484a !important;
  border-left: none !important;
  flex-shrink: 0 !important;
}

.nav-item .nav-icon {
  width: 20px !important;
  height: 20px !important;
}

.nav-item i {
  color: #636366 !important;
  filter: none !important;
  font-size: 15px !important;
}

.nav-item span {
  color: #48484a !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
}

.nav-item:hover {
  background: rgba(0,0,0,0.04) !important;
}

.nav-item:hover i,
.nav-item:hover span {
  color: #1c1c1e !important;
}

.nav-item.active {
  background: rgba(30,64,175,0.08) !important;
  border-left: 3px solid #1e40af !important;
}

.nav-item.active i {
  color: #1e40af !important;
}

.nav-item.active span {
  color: #1e40af !important;
  font-weight: 600 !important;
}

.nav-divider {
  height: 1px !important;
  background: rgba(0,0,0,0.08) !important;
  margin: 5px 10px !important;
}

.nav-bottom {
  border-top: 1px solid rgba(0,0,0,0.08) !important;
  padding-top: 5px !important;
  gap: 2px !important;
  margin-top: 0 !important;
}

.nav-user-section {
  background: rgba(0,0,0,0.02) !important;
  border: none !important;
  border-top: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 0 !important;
  margin-top: 4px !important;
  padding: 10px 12px !important;
}

.nav-user-avatar {
  width: 38px !important;
  height: 38px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #1e40af, #0d9488) !important;
  border: none !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(30,64,175,0.2) !important;
}

.nav-user-avatar i {
  color: white !important;
  font-size: 16px !important;
}

.nav-user-name {
  color: #1c1c1e !important;
  font-size: 13px !important;
}

.nav-user-role {
  color: #8e8e93 !important;
  font-size: 11px !important;
}

.nav-logout-btn {
  color: #aeaeb2 !important;
}

.nav-logout-btn:hover {
  color: #e11d48 !important;
  background: rgba(225,29,72,0.06) !important;
}

/* Ajustar main-content al nuevo ancho de sidebar */
.main-content {
  margin-left: 250px !important;
  max-width: calc(100vw - 250px) !important;
}

/* --- MAIN CONTENT: Fondo transparente --- */
.main-content {
  background: transparent !important;
}

.section,
.ficha-content {
  background: transparent !important;
}

/* --- TOP BAR: Vidrio esmerilado --- */
.top-bar {
  background: rgba(240,241,245,0.7) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  border-bottom: 1px solid rgba(0,0,0,0.08) !important;
}

.page-title {
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #1c1c1e !important;
}

.search-box {
  background: rgba(0,0,0,0.03) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 10px !important;
  padding: 8px 14px !important;
}

.search-box:focus-within {
  background: rgba(255,255,255,0.6) !important;
  border-color: rgba(30,64,175,0.2) !important;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.06) !important;
}

.search-box input {
  color: #1c1c1e !important;
  font-size: 13.5px !important;
}

.search-box input::placeholder {
  color: #aeaeb2 !important;
}

.search-box .search-icon {
  color: #aeaeb2 !important;
}

/* --- USER MENU (Top bar): Glass --- */
.user-menu {
  border-radius: 10px !important;
}

.user-menu:hover {
  background: rgba(0,0,0,0.04) !important;
}

.user-avatar {
  background: linear-gradient(135deg, #1e40af, #0d9488) !important;
  border-radius: 50% !important;
  border: none !important;
  color: white !important;
}

.user-name {
  color: #1c1c1e !important;
}

/* --- NOTIFICATIONS: Glass --- */
.notifications-panel {
  background: rgba(255,255,255,0.85) !important;
  backdrop-filter: blur(30px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 14px !important;
}

.notif-header {
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

.notif-item {
  border-bottom: 1px solid rgba(0,0,0,0.04) !important;
}

.notif-item:hover {
  background: rgba(30,64,175,0.03) !important;
}

.notif-badge {
  background: #e11d48 !important;
  border: 2px solid rgba(240,241,245,0.9) !important;
}

/* Boton guia */
.btn-start-tour {
  background: rgba(0,0,0,0.03) !important;
  border: none !important;
  border-radius: 8px !important;
  color: #636366 !important;
}

.btn-start-tour:hover {
  background: rgba(30,64,175,0.06) !important;
  color: #1e40af !important;
}

.btn-start-tour i {
  color: #3b82f6 !important;
}

/* --- STAT CARDS: Vidrio --- */
.stat-card,
.stat-card.filled,
.stat-card.tonal,
.stat-card.warning {
  background: rgba(255,255,255,0.52) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  position: relative;
  overflow: hidden;
}

.stat-card:hover,
.stat-card.filled:hover,
.stat-card.tonal:hover,
.stat-card.warning:hover {
  background: rgba(255,255,255,0.72) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.05) !important;
}

/* Linea superior color en hover */
.stat-card::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important; left: 0 !important; right: 0 !important;
  height: 2.5px !important;
  display: block !important;
  opacity: 0 !important;
  transition: opacity 0.2s !important;
  border-radius: 14px 14px 0 0 !important;
}
.stat-card:hover::before { opacity: 1 !important; }
.stat-card.filled::before { background: linear-gradient(90deg, #1e40af, #3b82f6) !important; }
.stat-card.tonal::before { background: linear-gradient(90deg, #0d9488, #14b8a6) !important; }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa) !important; }
.stat-card.warning::before { background: linear-gradient(90deg, #d97706, #f59e0b) !important; }

.stat-icon {
  border-radius: 12px !important;
}

.stat-card.filled .stat-icon {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe) !important;
  color: #1e40af !important;
}

.stat-card.tonal .stat-icon {
  background: linear-gradient(135deg, #ccfbf1, #99f6e4) !important;
  color: #0d9488 !important;
}

.stat-card.warning .stat-icon {
  background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
  color: #d97706 !important;
}

.stat-value {
  color: #1c1c1e !important;
  -webkit-text-fill-color: #1c1c1e !important;
  background: none !important;
}

.stat-card.filled .stat-value {
  color: #1e40af !important;
  -webkit-text-fill-color: #1e40af !important;
  background: none !important;
}

.stat-card.filled .stat-label {
  color: #475569 !important;
}

.stat-label {
  color: #636366 !important;
}

/* --- CARDS: Vidrio --- */
.card,
.patient-card,
.evolucion-item,
.medicamento-item,
.factura-item {
  background: rgba(255,255,255,0.52) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

.card:hover,
.patient-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.04) !important;
}

.card-header {
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
  background: transparent !important;
}

.card-header h3 {
  color: #1c1c1e !important;
}

.card-header a {
  color: #3b82f6 !important;
}

/* --- BOTONES PRIMARIOS: Azul NEURAVANTA --- */
.btn-primary,
button.btn-primary,
input[type="submit"].btn-primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: none !important;
  border-color: transparent !important;
  color: white !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 8px rgba(30,64,175,0.25), inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.btn-primary:hover,
button.btn-primary:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(30,64,175,0.3), inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

/* --- BOTONES SECUNDARIOS: Vidrio --- */
.btn-secondary,
button.btn-secondary {
  background: rgba(255,255,255,0.7) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  color: #3a3a3c !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

.btn-secondary:hover,
button.btn-secondary:hover {
  background: rgba(255,255,255,0.9) !important;
  color: #1c1c1e !important;
}

/* --- ACCION PRINCIPAL: Nuevo Ingreso --- */
.main-action-btn {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
  box-shadow: 0 2px 8px rgba(30,64,175,0.25), inset 0 1px 0 rgba(255,255,255,0.15) !important;
  border-radius: 10px !important;
}

.main-action-btn:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%) !important;
  box-shadow: 0 6px 20px rgba(30,64,175,0.3), inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

/* --- QUICK ACTIONS: Vidrio --- */
.quick-action-btn {
  background: rgba(255,255,255,0.5) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 9px !important;
  color: #3a3a3c !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

.quick-action-btn:hover {
  background: rgba(255,255,255,0.8) !important;
  border-color: rgba(0,0,0,0.1) !important;
  color: #1c1c1e !important;
  box-shadow: 0 3px 10px rgba(0,0,0,0.04) !important;
}

.quick-action-btn.mapa i { color: #0d9488 !important; }
.quick-action-btn.farmacia i { color: #e11d48 !important; }
.quick-action-btn.admision i { color: #2563eb !important; }
.quick-action-btn i { color: #636366 !important; }

/* --- DATA TABLE: Limpia con lineas visibles --- */
.data-table-container {
  background: rgba(255,255,255,0.52) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
}

.data-table thead {
  background: rgba(0,0,0,0.015) !important;
}

.data-table th {
  color: #8e8e93 !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
  font-size: 11px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
}

.data-table td {
  border-bottom: 1px solid rgba(0,0,0,0.04) !important;
  color: #1c1c1e !important;
}

.data-table tbody tr:hover {
  background: rgba(30,64,175,0.02) !important;
}

/* --- FILTER TABS: Segmented control estilo macOS --- */
.filter-tabs {
  background: rgba(0,0,0,0.04) !important;
  border-radius: 9px !important;
  padding: 3px !important;
  border: none !important;
}

.filter-tab {
  border-radius: 7px !important;
  border: none !important;
  color: #636366 !important;
  background: transparent !important;
  font-weight: 500 !important;
}

.filter-tab:hover {
  color: #1c1c1e !important;
  background: transparent !important;
}

.filter-tab.active {
  background: white !important;
  color: #1c1c1e !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 0.5px rgba(0,0,0,0.04) !important;
  border-bottom-color: transparent !important;
}

/* --- ACTIVIDADES: Lineas visibles --- */
.actividades-list .actividad-item,
.actividades-list > div {
  border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}

.actividades-search {
  background: rgba(0,0,0,0.025) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 8px !important;
}

.actividades-search:focus-within {
  background: rgba(255,255,255,0.6) !important;
  border-color: rgba(30,64,175,0.2) !important;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.06) !important;
}

/* --- ALERTS DE STOCK: Lineas visibles --- */
.alerts-list .alert-item,
.alerts-list > div {
  border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}

/* --- INPUTS: Glass focus --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
  border: 1px solid rgba(0,0,0,0.1) !important;
  background: rgba(255,255,255,0.8) !important;
  border-radius: 9px !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(30,64,175,0.3) !important;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.06) !important;
  background: white !important;
}

/* --- MODALS: Vidrio --- */
.modal-content {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(30px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
  border-radius: 16px !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
}

.modal-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

.modal-header h2,
.modal-header h3 {
  color: #1c1c1e !important;
  -webkit-text-fill-color: #1c1c1e !important;
}

/* Modal headers con fondo de color: mantener legibles */
.modal-header[style*="background"] h3,
.modal-header[style*="background"] h2 {
  -webkit-text-fill-color: white !important;
  color: white !important;
}

/* --- TABS: Glass segmented --- */
.ficha-tabs {
  background: rgba(0,0,0,0.03) !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

.ficha-tab,
.tab {
  color: #636366 !important;
  border-bottom: 2px solid transparent !important;
}

.ficha-tab:hover,
.tab:hover {
  color: #1c1c1e !important;
  background: rgba(0,0,0,0.03) !important;
}

.ficha-tab.active,
.tab.active {
  color: #1e40af !important;
  border-bottom-color: #1e40af !important;
  background: rgba(255,255,255,0.6) !important;
  font-weight: 600 !important;
}

/* --- DROPDOWN MENUS: Vidrio --- */
.dropdown-menu,
.user-dropdown {
  background: rgba(255,255,255,0.9) !important;
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1) !important;
}

/* --- SECTION HEADER --- */
.section-header {
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

.section-header h2 {
  color: #1c1c1e !important;
}

/* --- ADMISSION BOARD: Glass --- */
.admission-column {
  background: rgba(255,255,255,0.4) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
}

/* --- STAT CARDS SIMPLE (Estadisticas): Glass --- */
.stat-card-simple {
  background: rgba(255,255,255,0.52) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

.stat-card-simple:hover {
  background: rgba(255,255,255,0.72) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.04) !important;
}

/* --- GERIABOT/NEURABOT: Widget + Ventana de Chat --- */

/* Widget flotante: sin fondo, solo Lottie */
.geriabot-widget {
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 4px 12px rgba(30,64,175,0.3)) !important;
}

.geriabot-widget:hover {
  filter: drop-shadow(0 6px 20px rgba(30,64,175,0.5)) !important;
}

/* Burbuja de mensaje: glass */
.geriabot-bubble {
  background: rgba(255,255,255,0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1) !important;
  border-radius: 14px 14px 4px 14px !important;
  font-size: 13px !important;
  color: #1c1c1e !important;
}

.geriabot-bubble::after {
  border-top-color: rgba(255,255,255,0.88) !important;
}

/* Ventana de chat: glass completo */
.geriabot-chat {
  background: rgba(255,255,255,0.96) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  border: 1px solid rgba(0,0,0,0.1) !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 50px rgba(0,0,0,0.15) !important;
}

/* Header: gradiente azul NEURAVANTA con logo brain */
.geriabot-chat-header {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 50%, #0d9488 100%) !important;
  border-bottom: none !important;
  padding: 16px 18px !important;
  border-radius: 18px 18px 0 0 !important;
}

.chat-header-avatar {
  width: 42px !important;
  height: 42px !important;
  background: rgba(255,255,255,0.2) !important;
  border-radius: 12px !important;
  font-size: 20px !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
}

.chat-header-text h4 {
  font-size: 16px !important;
  font-weight: 700 !important;
  letter-spacing: 0.5px !important;
}

.chat-status {
  font-size: 11.5px !important;
}

.chat-status i {
  color: #4ade80 !important;
  font-size: 7px !important;
}

/* Botones minimizar/cerrar: MAS VISIBLES */
.chat-btn-minimize,
.chat-btn-close {
  width: 34px !important;
  height: 34px !important;
  background: rgba(255,255,255,0.25) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 9px !important;
  color: white !important;
  font-size: 15px !important;
}

.chat-btn-minimize:hover {
  background: rgba(255,255,255,0.35) !important;
}

.chat-btn-close:hover {
  background: rgba(225,29,72,0.6) !important;
  border-color: rgba(225,29,72,0.4) !important;
}

/* Area mensajes */
.geriabot-chat-messages {
  background: rgba(248,250,252,0.8) !important;
}

/* Avatar del bot: azul NEURAVANTA con brain */
.message-avatar {
  background: linear-gradient(135deg, #1e40af, #0d9488) !important;
  border-radius: 10px !important;
  width: 34px !important;
  height: 34px !important;
}

.chat-message.user .message-avatar {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
}

/* Burbujas de mensaje */
.message-content {
  background: white !important;
  border: 1px solid rgba(0,0,0,0.05) !important;
  border-radius: 14px 14px 14px 4px !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05) !important;
  font-size: 13.5px !important;
  color: #1c1c1e !important;
}

.chat-message.user .message-content {
  background: linear-gradient(135deg, #2563eb, #1e40af) !important;
  color: white !important;
  border: none !important;
  border-radius: 14px 14px 4px 14px !important;
}

/* Typing indicator: azul */
.typing-indicator span:not(.typing-text) {
  background: #1e40af !important;
}

.geriabot-chat-typing {
  background: rgba(248,250,252,0.8) !important;
}

/* Input del chat */
.geriabot-chat-input {
  background: white !important;
  border-top: 1px solid rgba(0,0,0,0.06) !important;
  padding: 14px 16px !important;
}

.geriabot-chat-input input {
  border: 1px solid rgba(0,0,0,0.1) !important;
  border-radius: 24px !important;
  padding: 12px 18px !important;
  font-size: 13.5px !important;
  background: rgba(0,0,0,0.02) !important;
}

.geriabot-chat-input input:focus {
  border-color: rgba(30,64,175,0.3) !important;
  box-shadow: 0 0 0 3px rgba(30,64,175,0.08) !important;
  background: white !important;
}

/* Boton enviar: azul NEURAVANTA */
.geriabot-chat-input button {
  width: 46px !important;
  height: 46px !important;
  background: linear-gradient(135deg, #2563eb, #1e40af) !important;
  border-radius: 50% !important;
  font-size: 16px !important;
  box-shadow: 0 2px 8px rgba(30,64,175,0.25) !important;
}

.geriabot-chat-input button:hover {
  box-shadow: 0 4px 14px rgba(30,64,175,0.4) !important;
  transform: scale(1.05) !important;
}

/* Footer del chat */
.geriabot-chat-footer {
  border-top: 1px solid rgba(0,0,0,0.05) !important;
  background: rgba(248,250,252,0.5) !important;
  padding: 10px 16px !important;
}

.geriabot-chat-footer a {
  color: #8e8e93 !important;
}

.geriabot-chat-footer a:hover {
  color: #1e40af !important;
}

.geriabot-chat-footer a:hover strong {
  color: #1e40af !important;
}

.geriabot-chat-footer strong {
  color: #636366 !important;
}

/* --- TOUR: Glass + Boton cerrar --- */
.tour-tooltip {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 16px !important;
}

.tour-tooltip::before {
  background: rgba(255,255,255,0.95) !important;
}

.tour-highlight {
  box-shadow:
    0 0 0 3px #1e40af,
    0 0 0 6px rgba(30,64,175,0.3),
    0 20px 40px rgba(0,0,0,0.25) !important;
}

@keyframes tour-glow {
  0%, 100% {
    box-shadow:
      0 0 0 3px #1e40af,
      0 0 0 6px rgba(30,64,175,0.3),
      0 20px 40px rgba(0,0,0,0.25);
  }
  50% {
    box-shadow:
      0 0 0 4px #1e40af,
      0 0 0 10px rgba(30,64,175,0.2),
      0 25px 50px rgba(0,0,0,0.3);
  }
}

.tour-btn-primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-radius: 10px !important;
}

.tour-btn-primary:hover {
  box-shadow: 0 4px 12px rgba(30,64,175,0.4) !important;
}

.tour-progress-fill {
  background: linear-gradient(90deg, #1e40af, #3b82f6) !important;
}

.tour-btn-secondary {
  background: rgba(0,0,0,0.04) !important;
  border-radius: 10px !important;
}

/* Boton X para cerrar tour */
.tour-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.05);
  color: #8e8e93;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 1;
}

.tour-close-btn:hover {
  background: rgba(225,29,72,0.1);
  color: #e11d48;
}

.tour-tooltip-header {
  position: relative;
  padding-right: 36px !important;
}

/* Tour welcome glass */
.tour-welcome {
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(30px) !important;
  -webkit-backdrop-filter: blur(30px) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 20px !important;
}

.tour-welcome .tour-btn-primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%) !important;
}

/* --- FACTURACION HEADER: Glass --- */
.modulo-facturacion-header {
  background: rgba(255,255,255,0.52) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
}

/* --- ADMISION STATS: Glass --- */
.admision-stats-bar {
  background: rgba(255,255,255,0.4) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 12px !important;
}

/* --- SCROLLBAR: Azul NEURAVANTA --- */
::-webkit-scrollbar {
  width: 6px !important;
}

::-webkit-scrollbar-track {
  background: transparent !important;
}

::-webkit-scrollbar-thumb {
  background: rgba(30,64,175,0.15) !important;
  border-radius: 3px !important;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(30,64,175,0.3) !important;
}

/* --- FOCUS VISIBLE: Azul sutil --- */
:focus-visible {
  outline: 2px solid rgba(30,64,175,0.3) !important;
  outline-offset: 2px !important;
}

/* --- SELECTION: Azul sutil --- */
::selection {
  background: rgba(30,64,175,0.12) !important;
  color: inherit !important;
}

/* --- FICHA HEADER: Azul oscuro --- */
.ficha-header {
  background: linear-gradient(135deg, #1e293b, #334155) !important;
}

/* --- HABITACION CARD: Glass --- */
.habitacion-card {
  background: rgba(255,255,255,0.52) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
  border-radius: 12px !important;
}

/* --- DOCUMENTO ITEMS: Glass --- */
.documento-item {
  background: rgba(255,255,255,0.52) !important;
  border: 1px solid rgba(0,0,0,0.06) !important;
}

.documento-item:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FEATURE: BOTÓN CAJA EN HEADER
   ═══════════════════════════════════════════════════════════════════ */
.btn-caja-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-caja-header:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}

.btn-caja-header i {
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   FEATURE: MODAL CAJA
   ═══════════════════════════════════════════════════════════════════ */
.modal-caja {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-caja-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 1100px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
  position: relative;
}

.modal-caja-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: white;
  z-index: 2;
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
}

.modal-caja-header h2 {
  font-size: 18px;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-caja-header h2 i {
  color: #f59e0b;
}

/* Caja Tabs */
.caja-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 24px;
  background: #f8fafc;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.caja-tab-btn {
  padding: 12px 20px;
  border: none;
  background: none;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.caja-tab-btn:hover {
  color: #f59e0b;
}

.caja-tab-btn.active {
  color: #f59e0b;
  border-bottom-color: #f59e0b;
  font-weight: 600;
}

.caja-tab-content {
  display: none;
  padding: 24px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.caja-tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Caja Layout 2 columnas */
.caja-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.caja-form-col {
  min-width: 0;
}

.caja-preview-col {
  min-width: 0;
}

/* Comprobante Preview */
.comprobante-preview {
  background: #fefce8;
  border: 1px solid #fbbf24;
  border-radius: 12px;
  padding: 20px;
  min-height: 300px;
}

.comprobante-preview-content {
  font-size: 13px;
}

.comp-header {
  text-align: center;
  margin-bottom: 10px;
}

.comp-divider {
  border-top: 1px dashed #d4a574;
  margin: 10px 0;
}

.comp-numero {
  text-align: center;
  font-size: 14px;
  margin: 8px 0;
}

.comp-fecha {
  text-align: right;
  font-size: 12px;
  color: #64748b;
}

.comp-paciente {
  line-height: 1.6;
}

.comp-concepto {
  margin: 6px 0;
}

.comp-detalle {
  font-size: 12px;
  color: #64748b;
  margin: 4px 0;
}

.comp-total {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  color: #1e40af;
  margin: 12px 0;
  padding: 8px;
  background: rgba(30,64,175,0.05);
  border-radius: 8px;
}

.comp-pago {
  font-size: 13px;
  margin: 6px 0;
}

.comp-firmas {
  margin-top: 15px;
  font-size: 12px;
  color: #64748b;
}

.comp-firmas div {
  margin: 8px 0;
}

.comp-fiscal {
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
  margin-top: 10px;
}

/* Paciente search dropdown */
.caja-paciente-search-container {
  position: relative;
}

.caja-paciente-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 100;
  max-height: 250px;
  overflow-y: auto;
}

.caja-pac-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.caja-pac-item:hover {
  background: #f0f9ff;
}

.caja-pac-item:last-child {
  border-bottom: none;
}

/* Historial table */
.comprobante-historial {
  overflow-x: auto;
}

.table-compact {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-compact th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
}

.table-compact td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.table-compact tr:hover {
  background: #f8fafc;
}

.row-anulado {
  opacity: 0.5;
  text-decoration: line-through;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: #dcfce7;
  color: #16a34a;
}

.badge-danger {
  background: #fee2e2;
  color: #dc2626;
}

/* Button icon small */
.btn-icon-sm {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 13px;
}

.btn-icon-sm:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-danger-sm {
  color: #ef4444;
}

.btn-danger-sm:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* Resumen cards */
.resumen-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.resumen-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.resumen-card-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.resumen-card-value {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
}

/* ═══════════════════════════════════════════════════════════════════
   CAJA: SUCCESS OVERLAY - ANIMACIÓN ÉXITO
   ═══════════════════════════════════════════════════════════════════ */
.caja-success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: successFadeIn 0.2s ease;
}

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

.success-content {
  text-align: center;
  padding: 24px 28px;
  max-width: 340px;
  width: 100%;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: successPopIn 0.3s ease;
}

@keyframes successPopIn {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.success-content h3 {
  font-size: 17px;
  color: #1e293b;
  margin: 10px 0 4px;
  font-weight: 700;
}

.success-numero {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 2px;
  font-weight: 500;
}

.success-monto {
  font-size: 22px;
  font-weight: 800;
  color: #22c55e;
  margin-bottom: 16px;
}

/* SVG Checkmark animation */
.success-checkmark {
  width: 56px;
  height: 56px;
}

.success-checkmark circle {
  stroke: #22c55e;
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: checkCircle 0.6s ease forwards;
}

.success-checkmark path {
  stroke: #22c55e;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkDraw 0.4s 0.5s ease forwards;
}

@keyframes checkCircle {
  to { stroke-dashoffset: 0; fill: rgba(34,197,94,0.08); }
}

@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}

/* Success action buttons */
.success-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.success-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.success-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.success-btn:active {
  transform: translateY(0);
}

.success-btn-print {
  background: #3b82f6;
  color: white;
}

.success-btn-download {
  background: #8b5cf6;
  color: white;
}

.success-btn-new {
  background: #22c55e;
  color: white;
}

.success-btn-close {
  background: #64748b;
  color: white;
}

/* ═══════════════════════════════════════════════════════════════════
   CAJA: HISTORIAL CARDS ACCORDION
   ═══════════════════════════════════════════════════════════════════ */
.caja-historial-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.caja-historial-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s ease;
  background: white;
}

.caja-historial-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.caja-historial-card.expanded {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59,130,246,0.1);
}

.caja-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.2s ease;
  user-select: none;
}

.caja-card-header:hover {
  background: #f8fafc;
}

.caja-card-header .card-num {
  font-weight: 700;
  font-size: 13px;
  color: #1e40af;
  min-width: 130px;
}

.caja-card-header .card-fecha {
  font-size: 12px;
  color: #64748b;
  min-width: 80px;
}

.caja-card-header .card-dest {
  flex: 1;
  font-size: 13px;
  color: #334155;
  font-weight: 500;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.caja-card-header .card-monto {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  min-width: 100px;
  text-align: right;
}

.caja-card-header .card-chevron {
  color: #94a3b8;
  transition: transform 0.3s ease;
  font-size: 12px;
}

.caja-historial-card.expanded .card-chevron {
  transform: rotate(180deg);
}

.caja-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.caja-historial-card.expanded .caja-card-body {
  max-height: 500px;
}

.caja-card-body-inner {
  padding: 0 16px 16px;
  border-top: 1px solid #f1f5f9;
}

.caja-card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
  font-size: 13px;
}

.caja-card-detail-item label {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 2px;
}

.caja-card-detail-item span {
  color: #334155;
}

.caja-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}

.caja-card-actions button {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.caja-card-actions .btn-card-print {
  background: #eff6ff;
  color: #3b82f6;
}
.caja-card-actions .btn-card-print:hover {
  background: #3b82f6;
  color: white;
}

.caja-card-actions .btn-card-download {
  background: #f5f3ff;
  color: #8b5cf6;
}
.caja-card-actions .btn-card-download:hover {
  background: #8b5cf6;
  color: white;
}

.caja-card-actions .btn-card-nc {
  background: #fff7ed;
  color: #ea580c;
}
.caja-card-actions .btn-card-nc:hover {
  background: #ea580c;
  color: white;
}

.caja-card-actions .btn-card-anular {
  background: #fef2f2;
  color: #ef4444;
}
.caja-card-actions .btn-card-anular:hover {
  background: #ef4444;
  color: white;
}

/* ═══════════════════════════════════════════════════════════════════
   CAJA: NOTA DE CRÉDITO STYLES
   ═══════════════════════════════════════════════════════════════════ */
.caja-historial-card.nota-credito {
  border-left: 3px solid #ef4444;
  background: #fef2f2;
}

.caja-historial-card.nota-credito .caja-card-header .card-num,
.caja-historial-card.nota-credito .caja-card-header .card-dest,
.caja-historial-card.nota-credito .caja-card-header .card-monto {
  text-decoration: line-through;
  color: #ef4444;
  opacity: 0.7;
}

.caja-historial-card.anulado {
  opacity: 0.5;
}

.caja-historial-card.anulado .caja-card-header .card-num,
.caja-historial-card.anulado .caja-card-header .card-dest,
.caja-historial-card.anulado .caja-card-header .card-monto {
  text-decoration: line-through;
}

.badge-nota-credito {
  background: #fff7ed;
  color: #ea580c;
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.nc-motivo {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fee2e2;
  border-radius: 6px;
  font-size: 12px;
  color: #b91c1c;
}

.nc-motivo strong {
  display: block;
  margin-bottom: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   MODAL NOTA DE CRÉDITO - CUSTOM PROMPT
   ═══════════════════════════════════════════════════════════════════ */
.nc-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ncFadeIn 0.2s ease;
}

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

.nc-modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.25);
  text-align: center;
  animation: ncSlideIn 0.3s ease;
}

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

.nc-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fff7ed, #fed7aa);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 26px;
  color: #ea580c;
}

.nc-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 6px;
}

.nc-modal-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
}

.nc-modal-field {
  text-align: left;
  margin-bottom: 20px;
}

.nc-modal-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.nc-modal-field textarea {
  width: 100%;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.nc-modal-field textarea:focus {
  outline: none;
  border-color: #ea580c;
  box-shadow: 0 0 0 3px rgba(234,88,12,0.1);
}

.nc-modal-actions {
  display: flex;
  gap: 10px;
}

.nc-btn {
  flex: 1;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nc-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.nc-btn:active {
  transform: translateY(0);
}

.nc-btn-cancel {
  background: #f1f5f9;
  color: #64748b;
}

.nc-btn-cancel:hover {
  background: #e2e8f0;
}

.nc-btn-confirm {
  background: linear-gradient(135deg, #ea580c, #dc2626);
  color: white;
}

.nc-btn-done {
  background: linear-gradient(135deg, #ea580c, #f97316);
  color: white;
  width: 100%;
  margin-top: 16px;
}

/* NC success animation */
.nc-success-anim {
  margin-bottom: 16px;
}

.nc-success-check {
  width: 72px;
  height: 72px;
}

.nc-success-check circle {
  stroke: #ea580c;
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 157;
  stroke-dashoffset: 157;
  animation: ncCircle 0.6s ease forwards;
}

.nc-success-check path {
  stroke: #ea580c;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: ncDraw 0.4s 0.5s ease forwards;
}

@keyframes ncCircle {
  to { stroke-dashoffset: 0; fill: rgba(234,88,12,0.08); }
}

@keyframes ncDraw {
  to { stroke-dashoffset: 0; }
}

/* ═══════════════════════════════════════════════════════════════════
   FEATURE: FILE UPLOAD / DOCUMENTOS ADMISIÓN
   ═══════════════════════════════════════════════════════════════════ */
.file-upload-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.file-preview-list, .file-uploaded-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.file-preview-item, .file-uploaded-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.file-preview-item:hover, .file-uploaded-item:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59,130,246,0.1);
}

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

.file-preview-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-preview-size {
  font-size: 11px;
  color: #94a3b8;
}

.file-preview-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s ease;
}

.file-preview-remove:hover {
  background: #ef4444;
  color: white;
}

.file-actions {
  display: flex;
  gap: 4px;
}

/* ═══════════════════════════════════════════════════════════════════
   PRESUPUESTOS & SOLICITUDES
   ═══════════════════════════════════════════════════════════════════ */

/* Sub-navigation */
.pres-sub-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.pres-sub-btn {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  background: white;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pres-sub-btn:hover {
  border-color: #8b5cf6;
  color: #8b5cf6;
}

.pres-sub-btn.active {
  background: #8b5cf6;
  color: white;
  border-color: #8b5cf6;
}

/* Item rows for presupuestos */
.pres-item-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.pres-item-row .pres-item-desc {
  flex: 3;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.pres-item-row .pres-item-cant {
  flex: 0.7;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-align: center;
}

.pres-item-row .pres-item-precio {
  flex: 1;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  text-align: right;
}

.pres-item-subtotal {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  color: #1e293b;
  white-space: nowrap;
}

.pres-item-delete {
  width: 28px;
  height: 28px;
  border: none;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.pres-item-delete:hover {
  background: #ef4444;
  color: white;
}

/* Link rows for solicitudes */
.sol-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.sol-link-row input {
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

/* Botones tipo movimiento (Ingreso/Egreso) */
.caja-tipo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 40px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
  font-weight: 700;
  background: white;
}
.caja-tipo-ingreso {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}
.caja-tipo-ingreso:hover {
  background: #16a34a;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(22, 163, 74, 0.3);
}
.caja-tipo-egreso {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.caja-tipo-egreso:hover {
  background: #dc2626;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.3);
}

/* Botón cambiar tipo movimiento (dentro del badge, separado visualmente) */
.btn-cambiar-tipo-mov {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 6px 16px;
  background: rgba(255,255,255,0.85);
  color: #334155;
  border: 1.5px solid rgba(0,0,0,0.15);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cambiar-tipo-mov:hover {
  background: #1e293b;
  color: white;
  border-color: #1e293b;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Toggle cobrado mensual */
.cobro-toggle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
}
.cobro-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
}
.cobro-tick {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: transparent;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  transition: all 0.3s ease 0.1s;
}
.cobro-label {
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  transition: color 0.25s ease;
}
.cobro-toggle:hover .cobro-circle {
  border-color: #94a3b8;
  background: #f1f5f9;
}
.cobro-toggle.cobrado .cobro-circle {
  border-color: #22c55e;
  background: #22c55e;
}
.cobro-toggle.cobrado .cobro-tick {
  stroke: white;
  stroke-dashoffset: 0;
}
.cobro-toggle.cobrado .cobro-label {
  color: #22c55e;
}

/* Print button in cobrado row */
.cobro-print-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: white;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s ease;
  padding: 0;
}
.cobro-print-btn:hover {
  background: #3b82f6;
  border-color: #3b82f6;
  color: white;
  transform: scale(1.1);
}

/* Multi-pago rows */
.caja-pago-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.caja-pago-row select {
  flex: 1;
}
.caja-pago-row input {
  flex: 0.7;
}

/* Historial cards */
.pres-hist-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.pres-hist-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.pres-hist-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  gap: 12px;
}

.pres-hist-header:hover {
  background: #f8fafc;
}

.pres-estado-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE CAJA
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .caja-tab-btn i {
    display: none;
  }
  .caja-tab-btn {
    padding: 10px 12px;
    font-size: 12px;
  }
  .pres-item-row {
    flex-wrap: wrap;
  }
  .pres-item-row .pres-item-desc {
    flex: 1 1 100%;
  }
}

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

  .modal-caja-content {
    max-width: 100%;
    border-radius: 12px;
    margin: 10px;
  }

  .caja-tabs {
    overflow-x: auto;
    padding: 0 12px;
  }

  .caja-tab-btn {
    font-size: 12px;
    padding: 10px 14px;
    white-space: nowrap;
  }

  .caja-tab-content {
    padding: 16px;
  }

  .btn-caja-header span {
    display: none;
  }

  .btn-caja-header {
    padding: 8px 10px;
  }

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

@media (max-width: 480px) {
  .resumen-cards {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   COMIDAS DEL DÍA - Tab Inicio Ficha
   ═══════════════════════════════════════════════════════════════════════════ */

.ficha-comidas-hoy {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.comida-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.comida-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.comida-card.entregada {
  background: white;
  border-color: #86efac;
  border-left: 4px solid #22c55e;
}

.comida-card.pendiente {
  background: white;
  border-color: #e2e8f0;
  border-left: 4px solid #cbd5e1;
}

.comida-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15em;
  flex-shrink: 0;
}

.comida-card.entregada .comida-card-icon {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #16a34a;
}

.comida-card.pendiente .comida-card-icon {
  background: #f1f5f9;
  color: #94a3b8;
}

.comida-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.comida-card-tipo {
  font-weight: 600;
  font-size: 0.88em;
  color: #1e293b;
}

.comida-card-estado {
  font-size: 0.75em;
  margin-top: 3px;
}

.comida-card-estado.entregada {
  color: #16a34a;
  font-weight: 600;
}

.comida-card-estado.entregada i {
  margin-right: 3px;
}

.comida-card-estado.pendiente {
  color: #94a3b8;
}

@media (max-width: 768px) {
  .ficha-comidas-hoy {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .ficha-comidas-hoy {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DETALLE MEDICACIÓN MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.detalle-med-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.detalle-med-campo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}

.detalle-med-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  flex-shrink: 0;
}

.detalle-med-label {
  display: block;
  font-size: 0.7em;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.detalle-med-valor {
  display: block;
  font-size: 0.95em;
  font-weight: 600;
  color: #1e293b;
}

.detalle-med-indicaciones {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 12px 16px;
  border-radius: 0 10px 10px 0;
  margin-bottom: 16px;
}

.detalle-med-indicaciones strong {
  display: block;
  font-size: 0.85em;
  color: #92400e;
  margin-bottom: 6px;
}

.detalle-med-indicaciones p {
  margin: 0;
  font-size: 0.9em;
  color: #78350f;
}

.detalle-med-prescripcion {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  padding: 12px 16px;
  border-radius: 10px;
}

.detalle-med-prescripcion-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85em;
  color: #64748b;
}

.detalle-med-prescripcion-item i {
  width: 16px;
  text-align: center;
  color: #94a3b8;
}

.detalle-med-prescripcion-item strong {
  color: #1e293b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTA ALERGIA CHIP
   ═══════════════════════════════════════════════════════════════════════════ */

.alerta-alergia {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 600;
}

.alerta-alergia i {
  font-size: 0.85em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HORARIOS DE COMIDA MODAL
   ═══════════════════════════════════════════════════════════════════════════ */

.horarios-comida-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.horario-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
}

.horario-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9em;
  color: #1e293b;
  min-width: 110px;
}

.horario-row input[type="time"] {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9em;
  width: 120px;
}

.horario-general {
  font-size: 0.75em;
  color: #94a3b8;
  margin-left: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTAS PROGRAMADAS
   ═══════════════════════════════════════════════════════════════════════════ */

.form-alerta-inline {
  background: #f8fafc;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 12px;
}

.ficha-alertas-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alerta-programada-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
}

.alerta-programada-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fef3c7;
  color: #d97706;
  font-size: 0.9em;
  flex-shrink: 0;
}

.alerta-programada-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.alerta-programada-msg {
  font-weight: 600;
  font-size: 0.85em;
  color: #1e293b;
}

.alerta-programada-fecha {
  font-size: 0.75em;
  color: #92400e;
  margin-top: 2px;
}

.alerta-programada-fecha i {
  margin-right: 3px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   REDISEÑO VISUAL - MODAL FICHA MÉDICA COMPLETA v2
   Ultra-compacto, fluido, máxima densidad de información
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- 1. Modal container --- */
.ficha-medica-modal {
  height: 94vh !important;
  max-width: 1100px !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  background: #f4f7fa !important;
  box-shadow: 0 25px 60px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05) !important;
}

.ficha-medica-modal .modal-body {
  height: calc(94vh - 44px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 0 !important;
}

.ficha-medica-modal .ficha-content {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  background: #f4f7fa !important;
  padding: 12px 14px !important;
  scroll-behavior: smooth;
}

/* Scrollbar sutil */
.ficha-medica-modal .ficha-content::-webkit-scrollbar {
  width: 5px;
}
.ficha-medica-modal .ficha-content::-webkit-scrollbar-track {
  background: transparent;
}
.ficha-medica-modal .ficha-content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
.ficha-medica-modal .ficha-content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.ficha-medica-modal .ficha-tab-content.active {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100% !important;
  animation: fichaFadeIn 0.2s ease;
}

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

/* --- 2. Modal header: ultra compacto --- */
.ficha-medica-modal .modal-header {
  background: linear-gradient(135deg, #059669, #047857) !important;
  border-bottom: none !important;
  padding: 8px 16px !important;
  position: relative !important;
  min-height: auto !important;
}

.ficha-medica-modal .modal-header::after {
  display: none !important;
}

.ficha-medica-modal .modal-header h3 {
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  background: none !important;
  -webkit-background-clip: unset !important;
  -webkit-text-fill-color: #ffffff !important;
  letter-spacing: 0.3px;
}

.ficha-medica-modal .ficha-header-actions {
  gap: 6px !important;
}

.ficha-medica-modal .ficha-header-actions .btn-icon {
  background: rgba(255,255,255,0.15) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  color: #ffffff !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
  transition: all 0.15s ease !important;
}

.ficha-medica-modal .ficha-header-actions .btn-icon:hover {
  background: rgba(255,255,255,0.3) !important;
  transform: scale(1.05);
}

.ficha-medica-modal .modal-close {
  background: rgba(255,255,255,0.12) !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  color: #ffffff !important;
  width: 30px !important;
  height: 30px !important;
  border-radius: 8px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 16px !important;
  transition: all 0.15s ease !important;
}

.ficha-medica-modal .modal-close:hover {
  background: rgba(239,68,68,0.85) !important;
  border-color: transparent !important;
}

/* --- 3. Header del paciente: barra horizontal ultra-compacta --- */
.ficha-medica-modal .ficha-paciente-header {
  background: #ffffff !important;
  padding: 8px 14px !important;
  border-bottom: 1px solid #e8ecf1 !important;
  display: flex !important;
  gap: 10px !important;
  align-items: center !important;
  flex-shrink: 0 !important;
}

.ficha-medica-modal .ficha-paciente-avatar {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  border-radius: 10px !important;
  font-size: 15px !important;
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
}

.ficha-medica-modal .ficha-paciente-avatar img {
  border-radius: 9px !important;
}

.ficha-medica-modal .avatar-upload-overlay {
  width: 20px !important;
  height: 20px !important;
  font-size: 9px !important;
  border-width: 1.5px !important;
  border-color: white !important;
}

.ficha-medica-modal .ficha-paciente-info h2 {
  font-size: 0.95em !important;
  margin: 0 !important;
  color: #1e293b !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

.ficha-medica-modal .ficha-paciente-info .ficha-datos-basicos {
  gap: 4px !important;
  font-size: 0.72em !important;
  color: #64748b !important;
  margin-top: 2px !important;
}

.ficha-medica-modal .ficha-paciente-info .ficha-datos-basicos span {
  background: #f1f5f9 !important;
  padding: 1px 7px !important;
  border-radius: 4px !important;
  font-size: 1em !important;
  color: #475569 !important;
}

.ficha-medica-modal .ficha-paciente-info .ficha-datos-basicos span i {
  font-size: 0.85em !important;
  color: #94a3b8 !important;
}

/* Banner alergias inline compacto */
.ficha-medica-modal .ficha-alergias-banner {
  padding: 4px 10px !important;
  border-radius: 8px !important;
  max-width: 220px !important;
  font-size: 0.75em !important;
  gap: 6px !important;
  margin-left: auto !important;
  border-width: 1.5px !important;
}

.ficha-medica-modal .ficha-alergias-banner i {
  font-size: 1em !important;
}

.ficha-medica-modal .ficha-alergias-banner .alergias-texto {
  font-size: 0.85em !important;
  line-height: 1.3 !important;
}

.ficha-medica-modal .ficha-sin-alergias {
  padding: 4px 10px !important;
  border-radius: 8px !important;
  font-size: 0.72em !important;
  margin-left: auto !important;
  border-width: 1.5px !important;
}

/* --- 4. Tabs: micro-pills --- */
.ficha-medica-modal .ficha-tabs {
  background: #f8fafb !important;
  border-bottom: 1px solid #e8ecf1 !important;
  padding: 4px 10px !important;
  gap: 2px !important;
  flex-shrink: 0 !important;
}

.ficha-medica-modal .ficha-tab {
  border-radius: 6px !important;
  border-bottom: none !important;
  border: none !important;
  color: #64748b !important;
  padding: 5px 10px !important;
  font-size: 0.73em !important;
  font-weight: 500 !important;
  transition: all 0.15s ease !important;
  background: transparent !important;
  white-space: nowrap !important;
  gap: 4px !important;
}

.ficha-medica-modal .ficha-tab i {
  font-size: 0.9em !important;
}

.ficha-medica-modal .ficha-tab:hover {
  background: #eef2f6 !important;
  color: #334155 !important;
}

.ficha-medica-modal .ficha-tab.active {
  background: #059669 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 4px rgba(5,150,105,0.3) !important;
  border-bottom-color: transparent !important;
}

/* --- 5. Strip resumen fijo (no scrollea) --- */
.ficha-medica-modal .ficha-resumen-strip {
  flex-shrink: 0 !important;
  background: #f0f3f7 !important;
  padding: 6px 10px !important;
  border-bottom: 1px solid #e5e9ef !important;
}

.ficha-medica-modal .ficha-resumen-grid {
  gap: 6px !important;
  grid-template-columns: repeat(4, 1fr) !important;
}

.ficha-medica-modal .ficha-resumen-strip .ficha-card {
  border-radius: 8px !important;
  border: 1px solid #e5e9ef !important;
  box-shadow: none !important;
  background: #ffffff !important;
  padding: 6px 10px !important;
  overflow: hidden;
  position: relative;
}

.ficha-medica-modal .ficha-resumen-strip .ficha-card h4 {
  font-weight: 600;
  font-size: 0.7em !important;
  margin: 0 0 3px 0 !important;
  color: #64748b !important;
  text-transform: uppercase !important;
  letter-spacing: 0.3px !important;
}

.ficha-medica-modal .ficha-resumen-strip .ficha-card h4 i {
  font-size: 0.9em !important;
  margin-right: 3px !important;
}

.ficha-medica-modal .ficha-content .ficha-card {
  border-radius: 10px !important;
  border: 1px solid #e5e9ef !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
  background: #ffffff !important;
  padding: 10px 12px !important;
  overflow: hidden;
  position: relative;
}

.ficha-medica-modal .ficha-content .ficha-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06) !important;
  border-color: #d1d9e2 !important;
}

.ficha-medica-modal .ficha-content .ficha-card h4 {
  font-weight: 600;
  font-size: 0.85em !important;
  margin: 0 0 6px 0 !important;
  color: #475569 !important;
}

/* Left borders en strip cards */
.ficha-resumen-strip .ficha-card.alergias-card,
.ficha-resumen-strip .ficha-card.diagnosticos-card,
.ficha-resumen-strip .ficha-card.medicacion-card,
.ficha-resumen-strip .ficha-card.signos-card {
  border-left: 3px solid !important;
  padding-left: 10px !important;
}

.ficha-resumen-strip .ficha-card.alergias-card { border-left-color: #ef4444 !important; }
.ficha-resumen-strip .ficha-card.diagnosticos-card { border-left-color: #10b981 !important; }
.ficha-resumen-strip .ficha-card.medicacion-card { border-left-color: #8b5cf6 !important; }
.ficha-resumen-strip .ficha-card.signos-card { border-left-color: #0ea5e9 !important; }

.ficha-resumen-strip .ficha-card.alergias-card::before,
.ficha-resumen-strip .ficha-card.diagnosticos-card::before,
.ficha-resumen-strip .ficha-card.medicacion-card::before,
.ficha-resumen-strip .ficha-card.signos-card::before {
  display: none !important;
}

.ficha-resumen-strip .ficha-card.alergias-card h4 i { color: #ef4444; }
.ficha-resumen-strip .ficha-card.diagnosticos-card h4 i { color: #10b981; }
.ficha-resumen-strip .ficha-card.medicacion-card h4 i { color: #8b5cf6; }
.ficha-resumen-strip .ficha-card.signos-card h4 i { color: #0ea5e9; }

/* Gráfico signos en tab evolución */
.ficha-medica-modal #tabResumen canvas {
  max-height: 180px !important;
}

/* --- 6. Resumen items dentro del strip: ultra-densos --- */
.ficha-resumen-strip .resumen-item {
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 2px 0 !important;
  font-size: 0.72em !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  line-height: 1.3 !important;
}

.ficha-resumen-strip .resumen-item .badge {
  padding: 0px 5px !important;
  font-size: 0.7em !important;
  border-radius: 3px !important;
}

.ficha-resumen-strip .resumen-item:last-child {
  border-bottom: none !important;
}

.ficha-resumen-strip .resumen-vacio {
  padding: 2px 0 !important;
  font-size: 0.72em !important;
  color: #94a3b8 !important;
}

/* Signos vitales grid dentro del strip - compacto */
.ficha-resumen-strip .signos-card .signo-item,
.ficha-resumen-strip .signos-card span {
  font-size: 0.72em !important;
}

.ficha-resumen-strip .signos-card small {
  font-size: 0.65em !important;
}

/* --- 7. Section headers: flat, limpio --- */
.ficha-medica-modal .ficha-section-header {
  background: transparent !important;
  border-radius: 0 !important;
  padding: 0 0 10px 0 !important;
  margin-bottom: 10px !important;
  border: none !important;
  border-bottom: 2px solid #e8ecf1 !important;
}

.ficha-medica-modal .ficha-section-header h4 {
  font-weight: 700 !important;
  font-size: 0.92em !important;
  color: #1e293b !important;
}

.ficha-medica-modal .ficha-section-header h4 i {
  margin-right: 6px;
  color: #059669;
  font-size: 0.9em;
}

.ficha-medica-modal .ficha-section-header .btn-sm {
  border-radius: 8px !important;
  font-weight: 600;
  font-size: 0.78em !important;
  padding: 5px 12px !important;
}

/* --- 8a. Antecedentes --- */
.ficha-medica-modal .antecedentes-grid {
  gap: 8px !important;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
}

.ficha-medica-modal .antecedente-card {
  border-radius: 8px !important;
  border: 1px solid #e5e9ef !important;
  box-shadow: none !important;
  padding: 10px 12px !important;
  transition: all 0.15s ease !important;
}

.ficha-medica-modal .antecedente-card:hover {
  background: #f8fafb !important;
  border-color: #d1d9e2 !important;
}

.ficha-medica-modal .antecedente-card h5 {
  font-size: 0.88em !important;
  margin-bottom: 4px !important;
  padding-right: 65px !important;
}

.ficha-medica-modal .antecedente-card .tipo-badge {
  top: 8px !important;
  right: 8px !important;
  padding: 2px 6px !important;
  font-size: 0.62em !important;
}

.ficha-medica-modal .antecedente-card .estado {
  font-size: 0.72em !important;
}

/* --- 8b. Alergias --- */
.ficha-medica-modal .alergias-list {
  gap: 6px !important;
}

.ficha-medica-modal .alergia-item {
  border-radius: 8px !important;
  border: 1px solid #e5e9ef !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
  gap: 10px !important;
  transition: all 0.15s ease !important;
}

.ficha-medica-modal .alergia-item:hover {
  background: #f8fafb !important;
  border-color: #d1d9e2 !important;
}

.ficha-medica-modal .alergia-severidad {
  width: 6px !important;
  height: 30px !important;
  border-radius: 3px !important;
}

.ficha-medica-modal .alergia-info h5 {
  font-size: 0.88em !important;
  margin-bottom: 2px !important;
}

.ficha-medica-modal .alergia-info .tipo {
  font-size: 0.72em !important;
}

.ficha-medica-modal .alergia-item.severa,
.ficha-medica-modal .alergia-item.anafilaxia {
  border-color: #fca5a5 !important;
  background: #fef8f8 !important;
}

/* --- 8c. Diagnósticos --- */
.ficha-medica-modal .diagnosticos-list {
  gap: 6px !important;
}

.ficha-medica-modal .diagnostico-item {
  border-radius: 8px !important;
  border: 1px solid #e5e9ef !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
  gap: 10px !important;
  transition: all 0.15s ease !important;
}

.ficha-medica-modal .diagnostico-item:hover {
  background: #f8fafb !important;
  border-color: #d1d9e2 !important;
}

.ficha-medica-modal .diagnostico-item.principal {
  border-left: 3px solid #10b981 !important;
}

.ficha-medica-modal .diagnostico-estado {
  padding: 2px 8px !important;
  font-size: 0.68em !important;
}

/* --- 8d. Vacunas --- */
.ficha-medica-modal .vacunas-list {
  gap: 8px !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
}

.ficha-medica-modal .vacuna-card {
  border-radius: 8px !important;
  border: 1px solid #e5e9ef !important;
  background: #ffffff !important;
  box-shadow: none !important;
  padding: 10px 12px !important;
  transition: all 0.15s ease !important;
}

.ficha-medica-modal .vacuna-card:hover {
  background: #f8fafb !important;
  border-color: #d1d9e2 !important;
}

/* --- 8e. Estudios --- */
.ficha-medica-modal .estudio-item {
  border-radius: 8px !important;
  border: 1px solid #e5e9ef !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
  transition: all 0.15s ease !important;
}

.ficha-medica-modal .estudio-item:hover {
  background: #f8fafb !important;
  border-color: #d1d9e2 !important;
}

.ficha-medica-modal .estudio-tipo-icon {
  border-radius: 8px !important;
}

/* --- 9. Filtros estudios --- */
.ficha-medica-modal .filtro-btn {
  border-radius: 6px !important;
  transition: all 0.15s ease !important;
  font-weight: 500 !important;
  font-size: 0.75em !important;
  padding: 4px 10px !important;
}

.ficha-medica-modal .filtro-btn.active,
.ficha-medica-modal .filtro-btn:hover {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 1px 4px rgba(5,150,105,0.25) !important;
}

/* --- 10. Gráficos signos vitales --- */
.ficha-medica-modal .signos-graficos canvas {
  border-radius: 10px !important;
  border: 1px solid #e5e9ef !important;
  box-shadow: none !important;
}

/* --- 11. Submodales --- */
.ficha-medica-modal ~ .modal.submodal,
.modal.submodal {
  border-radius: 14px !important;
  overflow: hidden !important;
}

/* --- 12. Hábitos: compactos --- */
.ficha-medica-modal .habitos-grid {
  gap: 8px !important;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
}

.ficha-medica-modal .habito-group {
  background: #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid #e5e9ef;
  box-shadow: none;
  gap: 5px !important;
}

.ficha-medica-modal .habito-group label {
  font-size: 0.8em !important;
  font-weight: 600 !important;
  color: #475569 !important;
}

.ficha-medica-modal .habito-group label i {
  font-size: 0.9em;
  margin-right: 4px;
  color: #059669;
}

.ficha-medica-modal .habito-group select,
.ficha-medica-modal .habito-group input {
  font-size: 0.8em !important;
  padding: 5px 8px !important;
  border-radius: 6px !important;
}

/* --- 13. Signos tabla --- */
.ficha-medica-modal .signos-tabla {
  font-size: 0.82em !important;
}

.ficha-medica-modal .signos-tabla th {
  background: #f1f5f9 !important;
  font-size: 0.82em !important;
  padding: 6px 10px !important;
  font-weight: 600 !important;
}

.ficha-medica-modal .signos-tabla td {
  padding: 5px 10px !important;
}

/* --- 14. Evoluciones en ficha --- */
.ficha-medica-modal .ficha-evoluciones {
  background: white !important;
  border-radius: 10px !important;
  padding: 10px !important;
  border: 1px solid #e5e9ef !important;
}

.ficha-medica-modal .evolucion-item {
  padding: 10px 12px !important;
  margin-bottom: 6px !important;
  border-radius: 0 8px 8px 0 !important;
  border-left-width: 3px !important;
}

.ficha-medica-modal .evolucion-item-header {
  margin-bottom: 6px !important;
}

.ficha-medica-modal .evolucion-tipo-badge {
  padding: 2px 8px !important;
  font-size: 0.7em !important;
}

.ficha-medica-modal .evolucion-contenido p {
  font-size: 0.82em !important;
  line-height: 1.4 !important;
  margin-bottom: 4px !important;
}

.ficha-medica-modal .evolucion-profesional {
  font-size: 0.75em !important;
  margin-top: 6px !important;
  padding-top: 6px !important;
}

/* --- 15. Responsive --- */
@media (max-width: 900px) {
  .ficha-medica-modal .ficha-resumen-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 600px) {
  .ficha-medica-modal .ficha-resumen-grid {
    grid-template-columns: 1fr !important;
  }
  .ficha-medica-modal .ficha-paciente-header {
    flex-wrap: wrap !important;
  }
  .ficha-medica-modal .ficha-alergias-banner,
  .ficha-medica-modal .ficha-sin-alergias {
    margin-left: 0 !important;
    max-width: 100% !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   EVENTOS PERSONALIZADOS - Modal Horarios
   ═══════════════════════════════════════════════════════════════════════════ */
.eventos-custom-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evento-custom-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9em;
}

.evento-custom-nombre {
  flex: 1;
  font-weight: 500;
  color: #334155;
}

.evento-custom-hora {
  font-weight: 600;
  color: #8b5cf6;
  font-size: 0.95em;
}

.btn-delete-evento {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 0.85em;
}

.btn-delete-evento:hover {
  color: #ef4444;
  background: #fef2f2;
}

/* ========== Dashboard: Puntualidad, Ranking, Evoluciones ========== */

/* Badge tasa */
.stats-badge-rate {
  font-size: 13px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  background: #e2e8f0;
  color: #64748b;
}
.stats-badge-rate.rate-good { background: #dcfce7; color: #16a34a; }
.stats-badge-rate.rate-warn { background: #fef3c7; color: #d97706; }
.stats-badge-rate.rate-bad  { background: #fee2e2; color: #dc2626; }

/* Puntualidad grid */
.punt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
}
.punt-item {
  background: var(--surface-variant, #f8fafc);
  border-radius: 10px;
  padding: 12px;
}
.punt-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.punt-item-tipo {
  font-weight: 600;
  font-size: 13px;
  color: var(--on-surface, #1e293b);
}
.punt-item-stats {
  font-size: 11px;
  color: #64748b;
}
.punt-bar-wrap {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.punt-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}
.punt-item-footer {
  font-size: 11px;
  color: #94a3b8;
}

/* Puntualidad staff */
.punt-staff-section {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #e2e8f0);
}
.punt-staff-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.punt-staff-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}
.punt-staff-name {
  color: var(--on-surface, #1e293b);
}
.punt-staff-stat {
  color: #64748b;
  font-weight: 500;
}

/* Medicamentos summary */
.med-summary {
  display: flex;
  justify-content: space-around;
  padding: 16px;
  gap: 8px;
}
.med-stat {
  text-align: center;
}
.med-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--on-surface, #1e293b);
}
.med-stat-label {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

/* Compliance bar */
.med-compliance-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 0 16px 12px;
  background: #e2e8f0;
}
.med-compliance-seg {
  transition: width 0.5s ease;
}

/* Evoluciones detalle */
.evol-stat-row {
  display: flex;
  justify-content: space-around;
  padding: 16px;
}
.evol-stat {
  text-align: center;
}
.evol-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--on-surface, #1e293b);
}
.evol-stat-label {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.stats-evol-chart-wrap {
  padding: 0 16px 16px;
  height: 130px;
}

/* Ranking medal & tasa */
.ranking-medal {
  font-size: 22px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ranking-pos {
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
}
.ranking-tasa {
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .punt-grid { grid-template-columns: 1fr; }
  .med-summary { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FICHA FLOTANTE - Overrides finales (deben estar al final del archivo)
   ═══════════════════════════════════════════════════════════════════════════ */
.ficha-flotante.active > .ficha-flotante-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%) !important;
  color: white !important;
  flex-shrink: 0 !important;
  overflow: hidden !important;
}

.ficha-flotante.active > .ficha-tabs {
  background: #ffffff !important;
  border-bottom: 2px solid #e5e7eb !important;
  flex-shrink: 0 !important;
  position: relative !important;
  z-index: 2 !important;
  padding: 0 16px !important;
  gap: 0 !important;
}

.ficha-flotante.active > .ficha-tabs > .ficha-tab {
  color: #64748b !important;
  border-bottom: 3px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 12px 18px !important;
  font-size: 0.88em !important;
  font-weight: 500 !important;
  margin-bottom: -2px !important;
}

.ficha-flotante.active > .ficha-tabs > .ficha-tab:hover {
  color: #1e293b !important;
  background: #f1f5f9 !important;
}

.ficha-flotante.active > .ficha-tabs > .ficha-tab.active {
  color: #059669 !important;
  background: transparent !important;
  border-bottom-color: #059669 !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

.ficha-flotante.active > .ficha-content {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  background: #f8fafc !important;
}
