/* TriaHealth — Sistema de Triage Digital
   ESE Suroccidente · Universidad del Cauca
   Hoja de estilos global
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Variables ───────────────────────────────────────────────────────────── */
:root {
  --primary:   #1A2E5A;
  --primary-light: #2a4680;
  --primary-dark:  #0f1c38;
  --secondary: #2E8B35;
  --secondary-light: #3aad42;
  --accent:    #7BC44A;
  --t1:        #C00000;
  --t1-light:  #ff2020;
  --t1-bg:     #fff0f0;
  --t2:        #ED7D31;
  --t2-bg:     #fff5ec;
  --t3:        #D4A017;
  --t3-bg:     #fffbec;
  --t4:        #2E8B35;
  --t4-bg:     #f0fff2;
  --t5:        #2E75B6;
  --t5-bg:     #f0f6ff;
  --white:     #ffffff;
  --gray-50:   #f8fafc;
  --gray-100:  #f1f5f9;
  --gray-200:  #e2e8f0;
  --gray-300:  #cbd5e1;
  --gray-400:  #94a3b8;
  --gray-500:  #64748b;
  --gray-600:  #475569;
  --gray-700:  #334155;
  --gray-800:  #1e293b;
  --gray-900:  #0f172a;
  --danger:    #dc2626;
  --danger-bg: #fef2f2;
  --success:   #16a34a;
  --success-bg:#f0fdf4;
  --warning:   #d97706;
  --warning-bg:#fffbeb;
  --info:      #0284c7;
  --info-bg:   #f0f9ff;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);
  --shadow-xl: 0 20px 60px rgba(0,0,0,.18);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: .2s ease;
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }
input, button, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ─── Typography ──────────────────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.25rem;font-weight: 600; line-height: 1.4; }
h4 { font-size: 1.1rem; font-weight: 600; }
h5 { font-size: 1rem;   font-weight: 600; }
p  { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

/* ─── Utilidades ──────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem;  }
.text-lg     { font-size: 1.125rem; }
.text-xl     { font-size: 1.25rem; }
.fw-bold     { font-weight: 700; }
.fw-medium   { font-weight: 500; }
.text-muted  { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success{ color: var(--success); }
.text-primary{ color: var(--primary); }
.d-flex      { display: flex; }
.d-grid      { display: grid; }
.d-none      { display: none; }
.gap-1       { gap: .5rem; }
.gap-2       { gap: 1rem; }
.gap-3       { gap: 1.5rem; }
.align-center{ align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-col    { flex-direction: column; }
.flex-1      { flex: 1; }
.w-full      { width: 100%; }
.h-full      { height: 100%; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1  { padding: .5rem; }
.p-2  { padding: 1rem; }
.p-3  { padding: 1.5rem; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }

/* ─── Layout: contenedor principal ───────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.container-sm { max-width: 480px; margin: 0 auto; padding: 0 1rem; }
.container-md { max-width: 768px; margin: 0 auto; padding: 0 1.5rem; }

/* ─── Header genérico ────────────────────────────────────────────────────── */
.app-header {
  background: var(--primary);
  color: var(--white);
  padding: .875rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header .logo-area {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.app-header .app-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--white);
}
.app-header .app-subtitle {
  font-size: .75rem;
  color: rgba(255,255,255,.7);
  font-weight: 400;
}
.app-header .header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.app-header .user-name {
  font-size: .875rem;
  color: rgba(255,255,255,.9);
}

/* ─── Botones ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .625rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  line-height: 1;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid transparent;
  text-decoration: none;
}
.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  text-decoration: none;
  color: var(--white);
}
.btn-secondary {
  background: var(--secondary);
  color: var(--white);
  border-color: var(--secondary);
}
.btn-secondary:hover {
  background: var(--secondary-light);
  border-color: var(--secondary-light);
  color: var(--white);
  text-decoration: none;
}
.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: var(--white);
  text-decoration: none;
}
.btn-success {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}
.btn-success:hover {
  background: #15803d;
  border-color: #15803d;
  color: var(--white);
  text-decoration: none;
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: var(--white);
  text-decoration: none;
}
.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-outline-danger:hover {
  background: var(--danger);
  color: var(--white);
  text-decoration: none;
}
.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-300);
}
.btn-ghost:hover {
  background: var(--gray-100);
  color: var(--gray-800);
  text-decoration: none;
}
.btn-lg {
  padding: .875rem 2rem;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}
.btn-xl {
  padding: 1.25rem 2.5rem;
  font-size: 1.25rem;
  border-radius: var(--radius-lg);
  min-height: 70px;
}
.btn-sm {
  padding: .375rem .75rem;
  font-size: .8rem;
}
.btn-block { width: 100%; }
.btn-icon {
  padding: .5rem;
  border-radius: var(--radius);
  min-width: 36px;
  min-height: 36px;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-800);
  margin: 0;
}
.card-sm .card-header { padding: .75rem 1rem; }
.card-sm .card-body   { padding: 1rem; }

/* ─── Badges de triage ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-t1 { background: var(--t1);  color: #fff; }
.badge-t2 { background: var(--t2);  color: #fff; }
.badge-t3 { background: var(--t3);  color: #fff; }
.badge-t4 { background: var(--t4);  color: #fff; }
.badge-t5 { background: var(--t5);  color: #fff; }
.badge-lg {
  padding: .5rem 1.25rem;
  font-size: 1rem;
  border-radius: var(--radius);
}
.badge-xl {
  padding: .75rem 2rem;
  font-size: 1.25rem;
  border-radius: var(--radius-lg);
}

/* Indicadores de color inline */
.triage-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.triage-dot.t1 { background: var(--t1); }
.triage-dot.t2 { background: var(--t2); }
.triage-dot.t3 { background: var(--t3); }
.triage-dot.t4 { background: var(--t4); }
.triage-dot.t5 { background: var(--t5); }

/* ─── Alertas / Mensajes ──────────────────────────────────────────────────── */
.alert {
  padding: .875rem 1.125rem;
  border-radius: var(--radius);
  border-left: 4px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  font-size: .9rem;
}
.alert-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: .05rem; }
.alert-info    { background: var(--info-bg);    border-color: var(--info);    color: #0c4a6e; }
.alert-success { background: var(--success-bg); border-color: var(--success); color: #14532d; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: #78350f; }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: #7f1d1d; }

/* ─── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: .875rem 1.25rem;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .9rem;
  font-weight: 500;
  border-left: 4px solid var(--primary);
  animation: slideIn .3s ease;
  pointer-events: all;
}
.toast.toast-success { border-color: var(--success); }
.toast.toast-danger  { border-color: var(--danger); }
.toast.toast-warning { border-color: var(--warning); }
.toast.toast-info    { border-color: var(--info); }
.toast.hiding { animation: slideOut .3s ease forwards; }

/* ─── Formularios ─────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: .375rem;
}
.form-control {
  width: 100%;
  padding: .625rem .875rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,46,90,.12);
}
.form-control:read-only {
  background: var(--gray-50);
  cursor: not-allowed;
}
select.form-control,
select.form-control:read-only { cursor: pointer; }
.form-control.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}
.form-error {
  color: var(--danger);
  font-size: .8rem;
  margin-top: .3rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.form-hint {
  color: var(--gray-500);
  font-size: .8rem;
  margin-top: .3rem;
}
.form-control-lg {
  padding: .875rem 1.125rem;
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
}

/* ─── Tablas ──────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.table th {
  padding: .75rem 1rem;
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 2px solid var(--gray-200);
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--gray-50); }
.table-sm th, .table-sm td { padding: .5rem .75rem; }

/* ─── Modales ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn .2s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn .25s ease;
}
.modal-lg { max-width: 750px; }
.modal-xl { max-width: 960px; }
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.modal-title { font-size: 1.1rem; font-weight: 700; margin: 0; }
.modal-close {
  background: var(--gray-100);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--gray-600);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-900); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* ─── Spinner / Loading ───────────────────────────────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}
.spinner-lg {
  width: 64px;
  height: 64px;
  border-width: 6px;
}
.loading-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 3rem;
  text-align: center;
  color: var(--gray-500);
}
.loading-center p { font-size: 1.1rem; font-weight: 500; color: var(--gray-600); }

/* ─── Teclado virtual ─────────────────────────────────────────────────────── */
.teclado-virtual {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
  padding: .75rem;
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  margin-top: .75rem;
}
.teclado-btn {
  width: 80px;
  height: 80px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-800);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.teclado-btn:hover  { background: var(--gray-50); border-color: var(--primary); }
.teclado-btn:active { background: var(--primary); color: var(--white); transform: scale(.95); }
.teclado-btn.borrar {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
  font-size: 1.25rem;
}
.teclado-btn.borrar:active  { background: var(--danger); color: var(--white); }
.teclado-btn.confirmar {
  background: var(--success);
  border-color: var(--secondary);
  color: var(--white);
  font-size: 1.1rem;
}
.teclado-btn.confirmar:active { background: #15803d; }
.teclado-display {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--primary);
  text-align: center;
  padding: .75rem 1rem;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .5rem;
  word-break: break-all;
}

/* ─── Estación kiosk ──────────────────────────────────────────────────────── */
.kiosk-layout {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--gray-50);
}
.kiosk-header {
  background: var(--primary);
  color: var(--white);
  padding: .875rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.kiosk-clock {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
}
.kiosk-title { font-size: 1.5rem; font-weight: 800; }
.kiosk-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 1.5rem;
}
.kiosk-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.75);
  padding: .5rem 2rem;
  text-align: center;
  font-size: .75rem;
  flex-shrink: 0;
}
.kiosk-step {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 700px;
  text-align: center;
  animation: fadeIn .3s ease;
}
.kiosk-step-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: .5rem;
}
.kiosk-step-subtitle {
  font-size: 1.1rem;
  color: var(--gray-500);
  margin-bottom: 2rem;
}
.kiosk-doc-btns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kiosk-doc-btn {
  padding: 1.5rem;
  border: 3px solid var(--gray-200);
  border-radius: var(--radius-lg);
  background: var(--white);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-700);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 100px;
}
.kiosk-doc-btn:hover  { border-color: var(--primary); color: var(--primary); background: var(--gray-50); }
.kiosk-doc-btn.active { border-color: var(--primary); background: var(--primary); color: var(--white); }

/* Instrucciones sensores */
.sensor-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.sensor-card {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1rem;
  text-align: center;
  border: 2px solid var(--gray-200);
}
.sensor-card svg { width: 56px; height: 56px; margin: 0 auto .75rem; }
.sensor-card p { font-size: .875rem; color: var(--gray-600); font-weight: 500; margin: 0; }

/* Vitales en tiempo real */
.vitales-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.vital-item {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border: 2px solid var(--gray-200);
  transition: all .5s ease;
}
.vital-item.has-value { border-color: var(--secondary); background: var(--success-bg); }
.vital-item.out-of-range { border-color: var(--danger); background: var(--danger-bg); }
.vital-emoji { font-size: 1.75rem; line-height: 1; }
.vital-label { font-size: .75rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; }
.vital-value { font-size: 1.375rem; font-weight: 800; color: var(--primary); }
.vital-value.placeholder { color: var(--gray-300); }

/* ─── Dashboard médico ────────────────────────────────────────────────────── */
.medico-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-100);
}
.medico-body {
  flex: 1;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 0;
  height: calc(100vh - 60px);
  overflow: hidden;
}
.cola-panel {
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cola-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.cola-lista {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
}
.cola-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  cursor: pointer;
  transition: background var(--transition);
  border-left: 4px solid transparent;
}
.cola-item:hover  { background: var(--gray-50); }
.cola-item.active { background: var(--gray-100); }
.cola-item.t1 { border-color: var(--t1); }
.cola-item.t2 { border-color: var(--t2); }
.cola-item.t3 { border-color: var(--t3); }
.cola-item.t4 { border-color: var(--t4); }
.cola-item.t5 { border-color: var(--t5); }
.cola-item.t1-alerta { animation: pulsoBg 1.5s ease infinite; }
.cola-item-nombre {
  flex: 1;
  font-weight: 600;
  font-size: .9rem;
  color: var(--gray-800);
}
.cola-item-tiempo {
  font-size: .75rem;
  color: var(--gray-500);
  white-space: nowrap;
}

.tarjeta-panel {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1.25rem;
  gap: 1rem;
}
.tarjeta-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--gray-400);
  text-align: center;
  gap: 1rem;
}
.tarjeta-empty svg { width: 80px; height: 80px; opacity: .3; }

/* Botones de acción médico */
.acciones-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .625rem;
}
.btn-accion {
  padding: .875rem .75rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  line-height: 1.3;
}
.btn-accion .icon { font-size: 1.5rem; }

/* Signos vitales médico */
.vitales-medico-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .625rem;
}
.vital-medico {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: .75rem;
  border: 1px solid var(--gray-200);
}
.vital-medico.fuera-rango { background: var(--danger-bg); border-color: var(--danger); }
.vital-medico .label { font-size: .7rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; margin-bottom: .2rem; }
.vital-medico .value { font-size: 1.25rem; font-weight: 800; color: var(--gray-800); }
.vital-medico.fuera-rango .value { color: var(--danger); }
.vital-medico .unit { font-size: .7rem; color: var(--gray-400); font-weight: 400; }

/* Timer inactividad */
.inactividad-timer {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: rgba(255,255,255,.75);
  padding: .25rem .625rem;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
}
.inactividad-timer.warning { background: rgba(237,125,49,.3); color: #fcd9b0; }
.inactividad-timer.danger  { background: rgba(192,0,0,.4);    color: #fca5a5; }

/* ─── Login page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  color: var(--white);
}
.login-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}
.login-logo-placeholder {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,.15);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 700;
  text-align: center;
  color: rgba(255,255,255,.8);
  padding: .25rem;
  line-height: 1.2;
}
.login-app-name {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.login-app-sub {
  font-size: .9rem;
  color: rgba(255,255,255,.8);
  margin-top: .25rem;
}
.login-body { padding: 2rem; }
.login-footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  padding: 1rem 2rem;
  text-align: center;
  font-size: .75rem;
  color: var(--gray-500);
}
.login-footer .ley { margin-top: .5rem; color: var(--gray-400); font-size: .7rem; }

/* ─── Step indicator ──────────────────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  margin-bottom: 1.5rem;
}
.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-200);
  transition: all var(--transition);
}
.step-dot.active   { background: var(--primary); transform: scale(1.3); }
.step-dot.done     { background: var(--secondary); }

/* ─── Animaciones ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(100%); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,0,0,.6); }
  50%       { box-shadow: 0 0 0 12px rgba(192,0,0,0); }
}
.pulso { animation: pulso 1.5s ease infinite; }

@keyframes pulsoBg {
  0%, 100% { background: var(--t1-bg); }
  50%       { background: rgba(192,0,0,.2); }
}

@keyframes parpadeo {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}
.parpadeo { animation: parpadeo 1s step-start infinite; }

@keyframes latido {
  0%, 100% { transform: scale(1); }
  15%       { transform: scale(1.15); }
  30%       { transform: scale(1); }
  45%       { transform: scale(1.08); }
}
.latido { animation: latido 1.2s ease infinite; }

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .medico-body { grid-template-columns: 300px 1fr; }
  .acciones-grid { grid-template-columns: repeat(2, 1fr); }
  .vitales-medico-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .medico-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
  }
  .cola-panel { height: 280px; }
  .sensor-cards { grid-template-columns: 1fr; }
  .kiosk-doc-btns { grid-template-columns: repeat(2, 1fr); }
  .vitales-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .btn-xl { padding: 1rem 1.5rem; font-size: 1rem; }
  .teclado-btn { width: 70px; height: 70px; font-size: 1.25rem; }
}
@media (max-width: 480px) {
  .kiosk-doc-btns { grid-template-columns: 1fr; }
  .acciones-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { margin: .5rem; }
}

/* ─── Print ───────────────────────────────────────────────────────────────── */
@media print {
  .app-header, .cola-panel, .btn, .modal-overlay { display: none !important; }
  .tarjeta-panel { padding: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARDS — Admin · Médico · Administrativo (Día 4)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Layout con sidebar ─────────────────────────────────────────────────── */
.dashboard-wrapper { display: flex; min-height: 100vh; background: #f4f7f2; }
.sidebar {
  width: 220px; background: var(--primary); color: white;
  flex-shrink: 0; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo {
  padding: 1.375rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo .brand { font-size: 1.1rem; font-weight: 800; color: white; }
.sidebar-logo .sub   { font-size: .7rem; color: rgba(255,255,255,.6); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: .5rem 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .625rem;
  padding: .75rem 1.25rem;
  color: rgba(255,255,255,.72);
  text-decoration: none; font-size: .85rem;
  transition: all .2s; border-left: 3px solid transparent;
}
.sidebar-nav a:hover  { background: rgba(255,255,255,.08); color: white; text-decoration: none; }
.sidebar-nav a.active {
  background: rgba(255,255,255,.12); color: #2E8B35;
  border-left-color: #2E8B35; font-weight: 700;
}
.sidebar-nav .nav-icon { font-size: 1rem; width: 18px; height: 18px; text-align: center; flex-shrink: 0; }
.sidebar-nav img.nav-icon {
  display: block;
  filter: brightness(0) invert(1) drop-shadow(0 0 3px rgba(255,255,255,.35));
  transition: filter .2s;
}
.sidebar-nav a:hover img.nav-icon {
  filter: brightness(0) invert(1) drop-shadow(0 0 5px rgba(255,255,255,.75));
}
.sidebar-nav a.active img.nav-icon {
  filter: brightness(0) invert(1) drop-shadow(0 0 5px rgba(46,139,53,.9));
}
.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .7rem; color: rgba(255,255,255,.4);
}
.main-content { flex: 1; overflow-y: auto; min-width: 0; }

/* ── Top header ─────────────────────────────────────────────────────────── */
.top-header {
  background: white; padding: .75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  position: sticky; top: 0; z-index: 100;
  overflow: hidden;
}
.top-header .page-title { font-size: 1rem; font-weight: 700; color: var(--primary); display:flex; align-items:center; gap:8px; }
.top-header .page-title img { width:20px; height:20px; flex-shrink:0; }
.header-actions { display: flex; align-items: center; gap: .875rem; }
.user-chip {
  display: flex; align-items: center; gap: .375rem;
  font-size: .8rem; color: var(--gray-600);
  background: var(--gray-100); padding: .3rem .75rem; border-radius: 999px;
}
.countdown-badge {
  background: #eff6e8; color: #2E8B35;
  padding: 4px 12px; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.countdown-badge.warning { background: #fff5ec; color: #ED7D31; }
.countdown-badge.danger  { background: #ffecec; color: #C00000; animation: pulso .8s ease infinite; }

/* ── Stat cards ─────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 1rem; padding: 1.5rem;
}
.stat-card {
  background: white; border-radius: 12px;
  padding: 1.25rem 1.25rem 1.125rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-left: 4px solid var(--secondary);
}
.stat-card.t1 { border-color: var(--t1); }
.stat-card.t2 { border-color: var(--t2); }
.stat-card.info{ border-color: var(--t5); }
.stat-num   { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.stat-label { font-size: .72rem; color: var(--gray-500); margin-top: .375rem; font-weight: 500; }

/* ── Sección con título ──────────────────────────────────────────────────── */
.section-wrap { padding: 0 1.5rem 1.5rem; }
.section-title {
  font-size: .8rem; font-weight: 700; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: .875rem;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Cola de pacientes (admin layout) ───────────────────────────────────── */
.cola-wrap {
  background: white; border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); overflow: hidden;
}
.cola-header {
  padding: .75rem 1rem; background: var(--primary); color: white;
  font-weight: 600; font-size: .875rem;
  display: flex; justify-content: space-between; align-items: center;
}
.cola-item {
  display: flex; align-items: center; gap: .875rem;
  padding: .75rem 1rem; border-bottom: 1px solid var(--gray-100);
  cursor: pointer; transition: background .15s;
  border-left: 5px solid transparent;
}
.cola-item:last-child { border-bottom: none; }
.cola-item:hover  { background: var(--gray-50); }
.cola-item.active { background: #eff6e8; }
.cola-nombre  { font-weight: 600; font-size: .875rem; color: var(--primary); }
.cola-tiempo  { font-size: .72rem; color: var(--gray-500); margin-top: 1px; }
.chat-icon    { font-size: 1rem; margin-left: auto; }

/* ── Alerta T1 ──────────────────────────────────────────────────────────── */
.alerta-t1 {
  display: none; background: var(--t1); color: white;
  padding: .75rem 1.5rem; align-items: center; gap: 1rem;
  font-weight: 700; font-size: .9rem;
}
.alerta-t1.visible { display: flex; animation: pulso .8s ease infinite; }
.alerta-t1 .alerta-icono { font-size: 1.5rem; }

/* ── Tarjeta paciente ───────────────────────────────────────────────────── */
.tarjeta-paciente {
  background: white; border-radius: 12px; padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.tarjeta-nombre { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.tarjeta-meta   { font-size: .8rem; color: var(--gray-500); margin-top: .2rem; }
.botones-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: .625rem; margin: 1rem 0;
}
.btn-accion {
  padding: .75rem .5rem; border-radius: 10px; border: 1px solid transparent;
  cursor: pointer; font-size: .75rem; font-weight: 600; font-family: inherit;
  transition: all .15s;
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  line-height: 1.3; text-align: center;
}
.btn-accion:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.btn-gris    { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.btn-rojo    { background: #ffecec; color: var(--t1); border-color: var(--t1); }
.btn-naranja { background: #fff5ec; color: var(--t2); border-color: var(--t2); }
.btn-verde   { background: #eff6e8; color: var(--t4); border-color: var(--t4); }
.btn-azul    { background: #edf2fa; color: var(--primary); border-color: var(--primary); }

/* ── Signos vitales (médico) ────────────────────────────────────────────── */
.signos-grid {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: .625rem; margin: .875rem 0;
}
.signo-card {
  background: var(--gray-50); border-radius: 8px; padding: .75rem;
  text-align: center; border: 1px solid var(--gray-200);
}
.signo-card.critico { background: var(--t1-bg); border-color: var(--t1); }
.signo-valor { font-size: 1.375rem; font-weight: 800; color: var(--primary); }
.signo-valor.critico { color: var(--t1); }
.signo-valor.warning { color: var(--t2); }
.signo-label { font-size: .65rem; color: var(--gray-500); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Gráfica de distribución triage (barras HTML) ───────────────────────── */
.triage-chart { display: flex; flex-direction: column; gap: .5rem; }
.chart-row    { display: flex; align-items: center; gap: .75rem; }
.chart-label  { width: 110px; font-size: .75rem; color: var(--gray-600); font-weight: 600; flex-shrink: 0; }
.chart-bar-wrap { flex: 1; background: var(--gray-100); border-radius: 999px; height: 22px; overflow: hidden; position: relative; }
.chart-bar    { height: 100%; border-radius: 999px; transition: width .5s ease; min-width: 2px; }
.chart-num    { width: 28px; text-align: right; font-size: .8rem; font-weight: 700; color: var(--gray-700); flex-shrink: 0; }

/* ── Médico layout (2 columnas, sin sidebar) ─────────────────────────────── */
.medico-full {
  display: grid; grid-template-columns: 35% 65%;
  height: calc(100vh - 60px); overflow: hidden;
}
.medico-left  { border-right: 1px solid var(--gray-200); overflow-y: auto; background: white; }
.medico-right { overflow-y: auto; background: var(--gray-50); padding: 1.25rem; }

/* ── Tabla histórica ────────────────────────────────────────────────────── */
.tabla-hist th { font-size: .7rem; }
.tabla-hist td { font-size: .8rem; }
.estado-badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .7rem; font-weight: 600;
}
.estado-activa  { background: #eff6e8; color: #2E8B35; }
.estado-cerrada { background: var(--gray-100); color: var(--gray-600); }

/* ── Responsive dashboards ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid  { grid-template-columns: repeat(2,1fr); }
  .botones-grid{ grid-template-columns: repeat(2,1fr); }
  .signos-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  .sidebar      { display: none; }
  .stats-grid   { grid-template-columns: repeat(2,1fr); padding: 1rem; }
  .medico-full  { grid-template-columns: 1fr; height: auto; }
  .medico-left  { height: 260px; }
  .section-wrap { padding: 0 1rem 1rem; }
}

/* ── Día 6: barras distribución triage ──────────────────────────────────── */
.barra-triage  { margin-bottom: .75rem; }
.barra-label   { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: .8rem; }
.barra-track   { background: var(--gray-100); border-radius: 99px; height: 22px; overflow: hidden; }
.barra-fill    { height: 100%; border-radius: 99px; display: flex; align-items: center;
                 padding-left: 8px; color: white; font-size: .7rem; font-weight: 600;
                 transition: width .5s ease; min-width: 28px; }

/* ── Toggle switch (Día 6 — complementa toggle-btn inline) ─────────────── */
.toggle-wrap   { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-wrap input   { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300);
                 border-radius: 24px; transition: background .3s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px;
                          left: 3px; bottom: 3px; background: white; border-radius: 50%;
                          transition: transform .3s; }
.toggle-wrap input:checked + .toggle-slider { background: var(--secondary); }
.toggle-wrap input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Callout de advertencia ─────────────────────────────────────────────── */
.callout-warning { background: #FFF5EC; border-left: 4px solid var(--t2);
                   padding: .75rem 1rem; border-radius: 0 8px 8px 0;
                   margin-bottom: 1rem; font-size: .83rem; color: #7a3a10; }

/* ── Acción badge en logs ───────────────────────────────────────────────── */
.accion-badge { display: inline-block; padding: 2px 7px; border-radius: 4px;
                font-size: .7rem; font-weight: 700; color: white; }

/* ── Inline pulso para online-dot (se complementa con inline en dashboard) */
@keyframes pulso { 0%,100% { box-shadow: 0 0 0 2px rgba(46,139,53,.25); }

/* ── Día 7: chatbot panel en tarjeta médico ─────────────────────────────── */
.chatbot-panel        { display: flex; flex-direction: column; gap: .5rem; }
.chatbot-item         { background: var(--gray-50); border-radius: var(--radius-sm);
                        padding: .625rem .75rem; border-left: 3px solid var(--primary); }
.chatbot-pregunta     { font-size: .72rem; color: var(--gray-500); font-weight: 600;
                        text-transform: uppercase; letter-spacing: .03em; margin-bottom: 3px; }
.chatbot-respuesta    { font-size: .875rem; font-weight: 600; color: var(--gray-800); }

/* ── Día 7: badge triage en cola (variante xl) ──────────────────────────── */
.badge-xl { font-size: .9rem; padding: .4rem .9rem; border-radius: var(--radius); font-weight: 700; }
                   50%      { box-shadow: 0 0 0 5px rgba(46,139,53,.05); } }
