:root { --brand: #4f46e5; --sab: env(safe-area-inset-bottom, 0px); }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, sans-serif; overflow-x: hidden; }

/* ============ ANIMACIONES GLOBALES ============ */
/* Fade-in suave para cards al cargar (escalonado) */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.card { animation: cardIn .45s cubic-bezier(.2,.8,.2,1) both; }
.card:nth-of-type(2) { animation-delay: .05s; }
.card:nth-of-type(3) { animation-delay: .10s; }
.card:nth-of-type(4) { animation-delay: .15s; }
.card:nth-of-type(5) { animation-delay: .20s; }
.card:nth-of-type(6) { animation-delay: .25s; }
.card:nth-of-type(7) { animation-delay: .30s; }
.card:nth-of-type(n+8) { animation-delay: .35s; }

/* Cards clickeables: hover lift */
a.card, button.card, .card-hover {
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s, border-color .18s;
  will-change: transform;
}
a.card:hover, button.card:hover, .card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px -8px rgba(79,70,229,.18), 0 4px 10px -2px rgba(0,0,0,.06);
}
a.card:active, button.card:active { transform: translateY(-1px); }

/* Live-dot más vibrante */
.live-dot { position: relative; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 0 rgba(16,185,129,.7); }
.live-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%; background: #10b981;
  animation: livePulse 1.6s cubic-bezier(.4,0,.6,1) infinite;
}
@keyframes livePulse {
  0% { transform: scale(.7); opacity: .9; }
  70% { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* Progress bar con gradiente animado suave */
.progress { background: #e2e8f0; border-radius: 999px; overflow: hidden; height: 8px; position: relative; }
.progress span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5 0%, #6366f1 30%, #818cf8 50%, #6366f1 70%, #4f46e5 100%);
  background-size: 200% 100%;
  animation: progressShine 2.8s linear infinite;
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}
@keyframes progressShine { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }

/* KPIs grandes con bump al cambiar */
@keyframes kpiBump {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); color: #10b981; text-shadow: 0 0 20px rgba(16,185,129,.5); }
  100% { transform: scale(1); }
}
.kpi-bump { animation: kpiBump .55s cubic-bezier(.2,.8,.2,1); }
/* Marca automática en IDs conocidos para que el JS haga bump sin tocar vistas */
#kpi-total, #kpi-votaron, #kpi-porc, #kpi-pendientes,
#votaron, #total, #porc, #votaron-dia,
#pasadas-nuestros, #pasadas-personas, #pasadas-cantidad, #pasadas-porc {
  transition: color .3s ease;
  display: inline-block; /* necesario para transform scale */
}

/* Shimmer (skeleton) para loading states */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px; color: transparent !important;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Botones primary con shine al hover */
.btn-primary, button.btn-primary, .btn.bg-brand-600 {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: white; font-weight: 600; padding: 10px 18px; border-radius: 10px;
  border: none; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 4px 14px -2px rgba(79,70,229,.35);
}
.btn-primary:hover, button.btn-primary:hover, .btn.bg-brand-600:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -3px rgba(79,70,229,.45);
}
.btn-primary::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.25), transparent);
  transition: left .55s ease;
}
.btn-primary:hover::before { left: 100%; }

/* Clickeable feedback — press más notorio */
button, .btn, a.btn { transition: transform .08s; }
button:active:not(:disabled), .btn:active, a.btn:active { transform: scale(.97); }

/* Dots decorativos (puntos flotantes sutiles en backgrounds) */
.gradient-bg { position: relative; overflow: hidden; }
.gradient-bg::before {
  content: ''; position: absolute; top: -50%; right: -20%; width: 60%; height: 200%;
  background: radial-gradient(circle, rgba(99,102,241,.12) 0%, transparent 70%);
  animation: float 12s ease-in-out infinite; pointer-events: none;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(5deg); }
}

/* Tabla de filas que aparecen */
tbody tr { animation: rowIn .3s ease both; }
@keyframes rowIn { from { opacity: 0; } to { opacity: 1; } }

/* Respeta reduced-motion (accesibilidad) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* Prevenir zoom iOS al enfocar inputs (requiere font-size >= 16px) */
input, select, textarea { font-size: 16px; }

/* Touch targets mínimos 44x44 en mobile */
@media (max-width: 640px) {
  button, .btn, a.btn, a.btn-primary, a.btn-secondary, a.btn-danger {
    min-height: 42px;
  }
  /* Tamaños de texto mejorados en mobile */
  h1 { font-size: 1.5rem !important; line-height: 1.2; }
  h2 { font-size: 1.25rem !important; line-height: 1.3; }
  .text-3xl { font-size: 1.75rem !important; }
  .text-4xl { font-size: 2rem !important; }
  /* Tablas con scroll horizontal suave */
  table.data { min-width: 100%; }
  .card { padding: 12px !important; }
  /* Max-width containers: sacar margin extra */
  .max-w-7xl, .max-w-6xl, .max-w-5xl, .max-w-4xl, .max-w-3xl, .max-w-2xl {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}
/* Scroll suave */
html { scroll-behavior: smooth; }
/* Hacer que tablas largas tengan scroll horizontal contenido */
.tabla-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Tooltip de ayuda ℹ */
.help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin-left: 6px;
  background: #e0e7ff;
  color: #4f46e5;
  border-radius: 999px;
  font-size: 11px;
  font-weight: bold;
  cursor: help;
  position: relative;
  vertical-align: middle;
  transition: background .15s;
  user-select: none;
}
.help:hover { background: #4f46e5; color: white; }
.help:hover::after {
  content: attr(data-help);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 400;
  white-space: normal;
  width: max-content;
  max-width: 300px;
  line-height: 1.5;
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
  z-index: 100;
  text-align: left;
  letter-spacing: 0;
}
.help:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #0f172a;
  z-index: 100;
}
html.dark .help { background: #334155; color: #a5b4fc; }
html.dark .help:hover { background: #6366f1; color: white; }
.card { @apply bg-white rounded-xl border border-slate-200 shadow-sm; }
.btn { @apply inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg font-medium transition; }
.btn-primary { @apply btn bg-brand-600 text-white hover:bg-brand-700; }
.btn-secondary { @apply btn bg-slate-100 text-slate-700 hover:bg-slate-200; }
.btn-danger { @apply btn bg-red-50 text-red-700 hover:bg-red-100; }

.progress { position: relative; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > span { position:absolute; inset:0 auto 0 0; background: linear-gradient(90deg,#6366f1,#22c55e); border-radius: 999px; transition: width .4s ease; }

table.data { width:100%; border-collapse:collapse; }
table.data th, table.data td { padding: .6rem .75rem; border-bottom:1px solid #e2e8f0; font-size:.875rem; text-align:left; }
table.data thead th { font-weight:600; background:#f8fafc; color:#334155; position:sticky; top:3.5rem; }

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(79,70,229,.5);}
  100% { box-shadow: 0 0 0 14px rgba(79,70,229,0);}
}
.live-dot { width:.6rem; height:.6rem; background:#10b981; border-radius:999px; display:inline-block; animation: pulse-ring 1.6s infinite; }

/* Widget de chat — estilo WhatsApp */
#chat-widget { position: fixed; bottom: 16px; right: 16px; z-index: 60; font-family: inherit; }
.chat-fab {
  width: 60px; height: 60px; border-radius: 50%;
  background: #25d366;
  border: none; cursor: pointer;
  box-shadow: 0 8px 24px rgba(37,211,102,.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 10px 28px rgba(37,211,102,.6); }
.chat-fab.con-msg { animation: wa-pulse 1.8s infinite; }
@keyframes wa-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.7), 0 8px 24px rgba(37,211,102,.45); }
  50% { box-shadow: 0 0 0 14px rgba(239,68,68,0), 0 8px 24px rgba(37,211,102,.45); }
}
.chat-fab-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: white; font-size: 11px; font-weight: bold;
  min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}
.chat-panel {
  position: absolute; bottom: 74px; right: 0;
  width: min(420px, 94vw); height: min(600px, 80vh);
  background: #efeae2;
  border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 56px rgba(0,0,0,.3);
  display: flex; flex-direction: column;
  border: 1px solid rgba(0,0,0,.08);
}
/* En celular: chat fullscreen */
@media (max-width: 640px) {
  #chat-widget { bottom: 12px; right: 12px; }
  .chat-fab { width: 54px; height: 54px; }
  .chat-panel {
    position: fixed;
    bottom: 0; right: 0; left: 0; top: 0;
    width: 100vw; height: 100vh; max-height: none;
    border-radius: 0; border: none;
  }
}
html.dark .chat-panel { background: #0b141a; color: #e9edef; }
.chat-vista { flex: 1; display: flex; flex-direction: column; overflow: hidden; height: 100%; }
.chat-header-wa {
  background: #128c7e;
  color: white; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.chat-titulo-wa { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.chat-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #25d366; color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 16px;
  flex-shrink: 0;
}
.chat-header-nombre { font-weight: 600; font-size: 15px; line-height: 1.2; }
.chat-header-sub { font-size: 11px; opacity: .85; line-height: 1.2; margin-top: 2px; }
.chat-header-btn {
  background: transparent; border: none; color: white; cursor: pointer;
  padding: 4px 6px; border-radius: 4px; display: flex; align-items: center;
  transition: background .12s;
}
.chat-header-btn:hover { background: rgba(255,255,255,.15); }
.chat-search {
  padding: 8px 12px; background: white; border-bottom: 1px solid rgba(0,0,0,.08);
}
html.dark .chat-search { background: #111b21; border-bottom-color: #222e35; }
.chat-search input {
  width: 100%; padding: 8px 12px; border: none; border-radius: 18px;
  background: #f0f2f5; outline: none; font-size: 13px;
}
html.dark .chat-search input { background: #202c33; color: #e9edef; }
.chat-scroll { flex: 1; overflow-y: auto; background: white; }
html.dark .chat-scroll { background: #111b21; }
.chat-item {
  display: flex; width: 100%; text-align: left; background: transparent;
  border: none; padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,.04);
  gap: 12px; color: inherit;
  transition: background .12s;
}
.chat-item:hover { background: #f5f5f5; }
html.dark .chat-item { border-bottom-color: #222e35; }
html.dark .chat-item:hover { background: #202c33; }
.chat-item-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  color: white; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: bold; font-size: 18px;
  position: relative;
}
.chat-online-dot {
  position: absolute; bottom: 2px; right: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #25d366; border: 2px solid white;
}
html.dark .chat-online-dot { border-color: #111b21; }
.chat-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.chat-item-top { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 2px; }
.chat-item-nombre { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #111b21; }
html.dark .chat-item-nombre { color: #e9edef; }
.chat-item-hora { font-size: 11px; color: #667781; flex-shrink: 0; }
.chat-item-bottom { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.chat-item-ultimo {
  font-size: 13px; color: #667781;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.chat-unread {
  display: inline-block; background: #25d366; color: white;
  font-size: 11px; font-weight: bold;
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  line-height: 20px; text-align: center; flex-shrink: 0;
}
.chat-mensajes-wa {
  flex: 1; overflow-y: auto; padding: 12px 10px;
  background: #efeae2;
  background-image: radial-gradient(ellipse at top, rgba(0,0,0,.03), transparent 50%);
  display: flex; flex-direction: column; gap: 4px;
}
html.dark .chat-mensajes-wa { background: #0b141a; }
.chat-sep-dia {
  text-align: center; margin: 10px 0 6px;
}
.chat-sep-dia > span {
  display: inline-block; background: white; padding: 4px 10px;
  border-radius: 6px; font-size: 11px; color: #667781;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
html.dark .chat-sep-dia > span { background: #182229; color: #8696a0; }
.chat-msg-wa { display: flex; max-width: 90%; }
.chat-msg-wa.mio { align-self: flex-end; justify-content: flex-end; }
.chat-msg-wa.ajeno { align-self: flex-start; }
.chat-bubble {
  padding: 6px 9px 8px 10px;
  border-radius: 8px;
  position: relative;
  box-shadow: 0 1px 1px rgba(0,0,0,.08);
  max-width: 100%;
  word-wrap: break-word;
}
.chat-msg-wa.mio .chat-bubble {
  background: #d9fdd3;
  border-top-right-radius: 2px;
}
.chat-msg-wa.ajeno .chat-bubble {
  background: white;
  border-top-left-radius: 2px;
}
html.dark .chat-msg-wa.mio .chat-bubble { background: #005c4b; color: #e9edef; }
html.dark .chat-msg-wa.ajeno .chat-bubble { background: #202c33; color: #e9edef; }
.chat-bubble-nombre {
  font-size: 12px; font-weight: 600; color: #06cf9c;
  margin-bottom: 2px;
}
.chat-bubble-texto { font-size: 14px; line-height: 1.35; white-space: pre-wrap; color: #111b21; }
html.dark .chat-bubble-texto { color: #e9edef; }
.chat-bubble-meta {
  font-size: 10px; color: #667781;
  text-align: right; margin-top: 2px;
  display: flex; gap: 4px; justify-content: flex-end; align-items: center;
}
html.dark .chat-bubble-meta { color: #8696a0; }
.chat-tick { color: #53bdeb; font-weight: bold; }
.chat-form-wa {
  display: flex; gap: 10px; padding: 10px 12px;
  background: #f0f2f5;
  flex-shrink: 0;
  align-items: flex-end;
}
html.dark .chat-form-wa { background: #202c33; }
.chat-form-wa textarea, .chat-form-wa input {
  flex: 1; padding: 12px 16px; border: none; border-radius: 22px;
  outline: none; font-size: 16px; line-height: 1.4;
  background: white;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  font-family: inherit;
}
html.dark .chat-form-wa textarea, html.dark .chat-form-wa input { background: #2a3942; color: #e9edef; }
.chat-send-btn {
  background: #25d366; color: white; border: none; border-radius: 50%;
  width: 48px; height: 48px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
  flex-shrink: 0;
}
.chat-send-btn:hover { background: #1da851; }
/* Adjuntar foto */
.chat-adjuntar-btn {
  background: transparent; border: none; color: #667781; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.chat-adjuntar-btn:hover { background: rgba(0,0,0,.05); color: #128c7e; }
html.dark .chat-adjuntar-btn { color: #aebac1; }
html.dark .chat-adjuntar-btn:hover { background: rgba(255,255,255,.06); color: #25d366; }
.chat-foto-preview {
  padding: 8px 12px; background: #f0f2f5; border-top: 1px solid #d1d7db;
  display: flex; align-items: center; gap: 8px; position: relative;
}
html.dark .chat-foto-preview { background: #202c33; border-color: #374045; }
.chat-foto-preview img { max-height: 80px; max-width: 120px; border-radius: 8px; object-fit: cover; }
.chat-foto-cancelar {
  width: 26px; height: 26px; border-radius: 50%; background: #1f2937; color: white;
  border: none; cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.chat-foto-cancelar:hover { background: #dc2626; }
/* Foto dentro de mensaje */
.chat-bubble-foto { display: block; margin: -2px -2px 4px; border-radius: 8px; overflow: hidden; }
.chat-bubble-foto img { max-width: 240px; max-height: 240px; width: 100%; height: auto; display: block; cursor: pointer; }
.chat-bubble.con-foto .chat-bubble-texto { margin-top: 4px; }
/* Video en chat */
.chat-bubble-video { max-width: 260px; width: 100%; border-radius: 8px; margin: -2px -2px 4px; display: block; background: #000; }
/* Audio en chat */
.chat-bubble-audio-wrap { display: flex; align-items: center; gap: 6px; padding: 4px 0; }
.chat-bubble-audio-wrap audio { max-width: 220px; width: 100%; height: 36px; }
/* Archivo genérico en chat */
.chat-bubble-file {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; background: rgba(0,0,0,.05); border-radius: 8px;
  color: inherit; text-decoration: none; font-size: 13px; font-weight: 600;
  margin: -2px -2px 4px;
}
.chat-bubble-file:hover { background: rgba(0,0,0,.1); }
@media (max-width: 640px) {
  .chat-form-wa { padding: 12px; gap: 10px; }
  .chat-form-wa textarea, .chat-form-wa input {
    padding: 14px 18px; font-size: 16px; min-height: 48px;
  }
  .chat-send-btn { width: 52px; height: 52px; }
  .chat-send-btn svg { width: 24px; height: 24px; }
}
.chat-empty { padding: 40px 20px; text-align: center; color: #8696a0; font-size: 13px; }

/* ============ ALERTAS URGENTES ============ */
#alertas-widget { position: fixed; bottom: 16px; right: 88px; z-index: 61; }
@media (max-width: 640px) { #alertas-widget { bottom: 12px; right: 74px; } }
.alerta-fab {
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none; cursor: pointer;
  box-shadow: 0 8px 24px rgba(220,38,38,.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
  animation: alerta-respirar 2.5s infinite;
}
.alerta-fab:hover { transform: scale(1.08); }
.alerta-fab.enviada { animation: alerta-enviada .6s; }
.alerta-fab-icon { font-size: 28px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }
@media (max-width: 640px) { .alerta-fab { width: 54px; height: 54px; } .alerta-fab-icon { font-size: 24px; } }
@keyframes alerta-respirar {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5), 0 8px 24px rgba(220,38,38,.45); }
  50% { box-shadow: 0 0 0 10px rgba(220,38,38,0), 0 8px 24px rgba(220,38,38,.45); }
}
@keyframes alerta-enviada { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25) rotate(-10deg); } }

.alerta-modal {
  max-width: 480px; width: calc(100% - 24px);
  border: none; border-radius: 16px; padding: 0;
  box-shadow: 0 30px 60px rgba(0,0,0,.4);
}
.alerta-modal::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(4px); }
.alerta-modal-cabecera {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg,#ef4444,#dc2626);
  color: white; border-radius: 16px 16px 0 0;
}
.alerta-modal-titulo { font-size: 18px; font-weight: 800; }
.alerta-modal-cerrar {
  background: rgba(255,255,255,.2); border: none; color: white;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px;
}
.alerta-modal-cerrar:hover { background: rgba(255,255,255,.3); }
.alerta-modal-sub { padding: 12px 20px 8px; font-size: 13px; color: #64748b; }
html.dark .alerta-modal { background: #1e293b; color: #e2e8f0; }
html.dark .alerta-modal-sub { color: #94a3b8; }
.alerta-botones { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 20px; }
.alerta-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px;
  background: white; border: 2px solid;
  border-radius: 12px; cursor: pointer;
  text-align: left; font-weight: 600; font-size: 15px;
  transition: all .15s;
  color: #0f172a;
}
html.dark .alerta-btn { background: #0f172a; color: #e2e8f0; }
.alerta-btn:hover, .alerta-btn.sel { transform: translateX(4px); }
.alerta-btn-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 20px; flex-shrink: 0;
}
.alerta-btn-label { flex: 1; }
.alerta-extra { padding: 12px 20px 20px; }
.alerta-extra textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid #cbd5e1; border-radius: 8px;
  font-size: 14px; resize: vertical; outline: none;
  margin-top: 4px;
}
html.dark .alerta-extra textarea { background: #0f172a; border-color: #475569; color: #e2e8f0; }
.alerta-extra textarea:focus { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.1); }

/* Banner cuando llega una alerta */
.alerta-banner {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 100; width: min(500px, calc(100% - 24px));
  background: linear-gradient(135deg,#dc2626,#b91c1c);
  color: white; border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  animation: alerta-entrar .4s cubic-bezier(.18,.89,.32,1.28);
  border: 2px solid rgba(255,255,255,.3);
}
.alerta-banner.saliendo { animation: alerta-salir .3s forwards; }
@keyframes alerta-entrar {
  0% { transform: translate(-50%, -200%); opacity: 0; }
  60% { transform: translate(-50%, 10px); }
  100% { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes alerta-salir {
  to { transform: translate(-50%, -120%); opacity: 0; }
}
.alerta-banner-icon { font-size: 32px; animation: alerta-latir 1s infinite; flex-shrink: 0; }
@keyframes alerta-latir { 0%,100% { transform: scale(1); } 50% { transform: scale(1.2); } }
.alerta-banner-body { flex: 1; min-width: 0; }
.alerta-banner-titulo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: .9; }
.alerta-banner-msg { font-size: 15px; font-weight: 600; margin-top: 2px; line-height: 1.3; }
.alerta-banner-ok {
  background: white; color: #dc2626; font-weight: 700;
  border: none; padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 13px; white-space: nowrap;
  flex-shrink: 0;
}
.alerta-banner-ok:hover { background: #fef2f2; }
@media (max-width: 640px) {
  .alerta-banner { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .alerta-banner-ok { width: 100%; padding: 12px; }
}

/* Modo oscuro global */
html.dark body { background: #0f172a; color: #e2e8f0; }
html.dark .card { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark nav { background: rgba(15,23,42,.9) !important; border-color: #334155 !important; }
html.dark nav a { color: #cbd5e1; }
html.dark nav a:hover { background: #334155; }
html.dark .text-slate-900 { color: #f1f5f9 !important; }
html.dark .text-slate-800 { color: #e2e8f0 !important; }
html.dark .text-slate-700 { color: #cbd5e1 !important; }
html.dark .text-slate-600 { color: #94a3b8 !important; }
html.dark .text-slate-500 { color: #64748b !important; }
html.dark .bg-white { background-color: #1e293b !important; }
html.dark .bg-slate-50 { background-color: #0f172a !important; }
html.dark .bg-slate-100 { background-color: #334155 !important; }
html.dark input, html.dark select, html.dark textarea { background: #0f172a; color: #e2e8f0; border-color: #475569; }
html.dark table.data thead th { background: #0f172a; color: #e2e8f0; }
html.dark table.data th, html.dark table.data td { border-color: #334155; }
html.dark .border-slate-200 { border-color: #334155 !important; }
html.dark footer { background: #0f172a !important; border-color: #334155 !important; }

@media print {
  @page { size: A4; margin: 14mm; }
  nav, footer, .no-print { display:none !important; }
  body { background:white; color:#000; }
  .card { box-shadow:none; border:1px solid #cbd5e1; }
  .print-sheet { box-shadow:none !important; border:none !important; padding:0 !important; }
  .page-break-avoid { page-break-inside: avoid; }
  a { color:#000 !important; text-decoration:none !important; }
  svg line { stroke:#000 !important; }
}
