/* ===============================================================
   MONITOR UCI — SIMULADOR | ESTILOS
   Estética: Industrial médico dark, fondo negro profundo,
   señales luminosas tipo fósforo de CRT hospitalario
   =============================================================== */

:root {
  --bg-main: #050a0a;
  --bg-panel: #080f0f;
  --bg-card: #060d0d;
  --bg-bar: #030808;

  --green:      #00ff7f;
  --green-dim:  #00b85a;
  --cyan:       #00e8ff;
  --cyan-dim:   #009eb3;
  --yellow:     #ffe44d;
  --yellow-dim: #b89f00;
  --red:        #ff3b3b;
  --red-light:  #ff6b6b;
  --red-dim:    #b02020;
  --white:      #d0e8e8;
  --white-dim:  #6a9090;
  --amber:      #ffaa00;
  --purple:     #cc88ff;

  --border:     #0f2a2a;
  --border2:    #152f2f;

  --font-mono: 'Share Tech Mono', monospace;
  --font-disp: 'Orbitron', sans-serif;
  --font-ui:   'Inter', sans-serif;

  --scanline-opacity: 0.04;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-main);
  color: var(--white);
  font-family: var(--font-mono);
  overflow: hidden;
  user-select: none;
}

/* CRT scanline overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,var(--scanline-opacity)) 2px,
    rgba(0,0,0,var(--scanline-opacity)) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ─── LAYOUT ─── */
body {
  display: grid;
  grid-template-columns: 70px 1fr;
  grid-template-rows: 48px 1fr 48px;
  grid-template-areas:
    "sidebar header"
    "sidebar main"
    "sidebar footer";
}

/* ─── SIDEBAR TABS ─── */
.sidebar-tabs {
  grid-area: sidebar;
  background: var(--bg-bar);
  border-right: 1px solid var(--border2);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  gap: 4px;
}

.sidebar-tab {
  width: 56px;
  height: 56px;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--white-dim);
  transition: all 0.2s;
}
.sidebar-tab:hover {
  background: #0a1a1a;
  color: var(--white);
}
.sidebar-tab.active {
  background: #0a2a1a;
  color: var(--green);
}
.sidebar-tab .tab-icon {
  font-size: 18px;
}
.sidebar-tab .tab-label {
  font-size: 7px;
  font-family: var(--font-disp);
  letter-spacing: 0.05em;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-tab.mode-toggle {
  background: #0f1515;
  border: 1px solid var(--border2);
}
.sidebar-tab.mode-toggle:hover {
  background: #152525;
}
.sidebar-tab.mode-toggle.active {
  background: #2a1a0a;
  color: var(--amber);
  border-color: var(--amber);
}

/* Botón de Ayuda en barra lateral */
.sidebar-tab.help-tab-btn {
  background: #0f1515;
  border: 1px solid var(--border2);
}
.sidebar-tab.help-tab-btn:hover {
  background: #1a2a2a;
  border-color: var(--green);
  color: var(--green);
}
.sidebar-tab.help-tab-btn .tab-icon {
  font-size: 16px;
}

/* Botón de Reset en barra lateral */
.sidebar-tab.reset-tab-btn {
  background: #1a0f0f;
  border: 1px solid #2a1515;
}
.sidebar-tab.reset-tab-btn:hover {
  background: #2a1515;
  border-color: var(--red);
  color: var(--red);
}
.sidebar-tab.reset-tab-btn .tab-icon {
  font-size: 16px;
}

/* Botón de Notificaciones en barra lateral */
.sidebar-tab.notif-tab-btn {
  position: relative;
  background: #0f1515;
  border: 1px solid var(--border2);
}
.sidebar-tab.notif-tab-btn:hover {
  background: #1a2525;
  border-color: var(--green);
}
.sidebar-tab.notif-tab-btn.has-new {
  background: #2a1a0a;
  border-color: var(--amber);
  animation: pulseNotif 2s infinite;
}
.sidebar-tab.notif-tab-btn .notif-tab-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--red);
  color: var(--white);
  font-size: 7px;
  font-weight: 700;
  border-radius: 50%;
  padding: 1px 4px;
  min-width: 14px;
  text-align: center;
  border: 1px solid #050a0a;
  animation: bounce 0.5s ease;
}

@keyframes pulseNotif {
  0%, 100% {
    box-shadow: 0 0 5px rgba(255, 170, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.6);
  }
}

/* Botón de Datos Clínicos (solo visible en Modo Test) */
.sidebar-tab#clinicalDataBtn {
  background: #0f1515;
  border: 1px solid var(--border2);
}
.sidebar-tab#clinicalDataBtn:hover {
  background: #1a2a2a;
  color: var(--cyan);
  border-color: var(--cyan);
}
.sidebar-tab#clinicalDataBtn.active {
  background: #1a2a2a;
  color: var(--green);
  border-color: var(--green);
}

/* ─── APP MAIN ─── */
.app-main {
  grid-area: main;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  height: 100%;
}
.tab-panel.active {
  display: block;
}

/* Permitir overflow para panel de datos clínicos */
#panel-monitor.active,
#panel-exams.active,
#panel-treatments.active {
  overflow: visible;
}

/* ─── EXAMS PANEL ─── */
.exams-container, .treatments-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100%;
  background: var(--bg-main);
}

.exams-sidebar, .treatments-sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border2);
  padding: 16px;
  overflow-y: auto;
}

.exams-title, .treatments-title {
  font-family: var(--font-disp);
  font-size: 12px;
  color: var(--green);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.exam-categories, .tx-categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exam-category, .tx-category {
  background: #080f0f;
  border-radius: 6px;
  overflow: hidden;
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #0a1515;
  cursor: pointer;
  font-size: 11px;
  font-family: var(--font-disp);
  color: var(--white);
  letter-spacing: 0.05em;
  transition: background 0.2s;
}
.category-header:hover {
  background: #0f2020;
}
.toggle-icon {
  font-size: 8px;
  color: var(--white-dim);
  transition: transform 0.2s;
}
.category-header.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.category-items {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.category-items.collapsed {
  display: none;
}

.exam-btn, .tx-btn {
  background: #050a0a;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--white-dim);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}
.exam-btn:hover, .tx-btn:hover {
  background: #0a1a1a;
  color: var(--green);
  border-color: var(--green-dim);
}
.tx-btn.emergency {
  border-color: #2a1515;
  color: var(--red-light);
}
.tx-btn.emergency:hover {
  background: #1a0a0a;
  color: var(--red);
  border-color: var(--red);
}

.exams-result, .treatment-result {
  padding: 20px;
  overflow-y: auto;
}

.result-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--white-dim);
  opacity: 0.5;
}
.placeholder-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ─── EXAM RESULT STYLES ─── */
.exam-result-card {
  background: var(--bg-panel);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}
.exam-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.exam-result-title {
  font-family: var(--font-disp);
  font-size: 14px;
  color: var(--green);
  letter-spacing: 0.1em;
}
.exam-result-time {
  font-size: 10px;
  color: var(--white-dim);
}

.exam-values {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.exam-value-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #050a0a;
  border-radius: 4px;
}
.exam-value-label {
  font-size: 10px;
  color: var(--white-dim);
}
.exam-value-result {
  font-family: var(--font-disp);
  font-size: 13px;
  color: var(--white);
}
.exam-value-result.abnormal-high {
  color: var(--red-light);
}
.exam-value-result.abnormal-low {
  color: var(--amber);
}

.exam-interpretation {
  margin-top: 16px;
  padding: 12px;
  background: #0a1515;
  border-radius: 4px;
  border-left: 3px solid var(--green);
}
.exam-interpretation h4 {
  font-size: 10px;
  color: var(--green);
  margin-bottom: 8px;
  font-family: var(--font-disp);
  letter-spacing: 0.1em;
}
.exam-interpretation p {
  font-size: 11px;
  color: var(--white);
  line-height: 1.5;
}

/* ─── TREATMENT RESULT STYLES ─── */
.treatment-card {
  background: var(--bg-panel);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 20px;
}
.treatment-header {
  margin-bottom: 16px;
}
.treatment-name {
  font-family: var(--font-disp);
  font-size: 16px;
  color: var(--amber);
  letter-spacing: 0.1em;
}
.treatment-class {
  font-size: 10px;
  color: var(--white-dim);
  margin-top: 4px;
}

.treatment-section {
  margin-bottom: 16px;
}
.treatment-section-title {
  font-size: 10px;
  color: var(--green);
  font-family: var(--font-disp);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.treatment-section-content {
  font-size: 11px;
  color: var(--white);
  line-height: 1.6;
  padding: 10px;
  background: #050a0a;
  border-radius: 4px;
}

.treatment-effectiveness {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.effectiveness-indicator {
  padding: 8px 16px;
  border-radius: 4px;
  font-family: var(--font-disp);
  font-size: 10px;
  letter-spacing: 0.05em;
}
.effectiveness-indicator.effective {
  background: #0a2a1a;
  color: var(--green);
  border: 1px solid var(--green-dim);
}
.effectiveness-indicator.ineffective {
  background: #2a1a0a;
  color: var(--amber);
  border: 1px solid #3a2a00;
}
.effectiveness-indicator.contraindicated {
  background: #2a0a0a;
  color: var(--red);
  border: 1px solid var(--red-dim);
}

/* Botón Administrar */
.administer-btn {
  width: 100%;
  margin-top: 16px;
  padding: 14px 20px;
  font-family: var(--font-disp);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #0a3a2a 0%, #0a2a1a 100%);
  color: var(--green);
  border: 2px solid var(--green-dim);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-shadow: 0 0 10px var(--green);
}
.administer-btn:hover {
  background: linear-gradient(135deg, #0a4a3a 0%, #0a3a2a 100%);
  box-shadow: 0 0 20px rgba(0, 255, 127, 0.3);
  transform: translateY(-2px);
}
.administer-btn:active {
  transform: translateY(0);
}

/* Feedback de tratamiento exitoso */
.treatment-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #0a2a1a 0%, #051510 100%);
  border: 2px solid var(--green);
  border-radius: 12px;
  text-align: center;
  animation: successPulse 0.5s ease;
}
.success-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: successBounce 0.6s ease;
}
.success-title {
  font-family: var(--font-disp);
  font-size: 28px;
  font-weight: 900;
  color: var(--green);
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px var(--green);
  margin-bottom: 12px;
}
.success-message {
  font-size: 14px;
  color: var(--white);
  margin-bottom: 8px;
}
.success-detail {
  font-size: 12px;
  color: var(--green-dim);
}

@keyframes successPulse {
  0% { transform: scale(0.9); opacity: 0; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes successBounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Feedback de tratamiento fallido */
.treatment-failure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #2a2a1a 0%, #151510 100%);
  border: 2px solid var(--amber);
  border-radius: 12px;
  text-align: center;
  animation: failureShake 0.5s ease;
}
.failure-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.failure-title {
  font-family: var(--font-disp);
  font-size: 24px;
  font-weight: 900;
  color: var(--amber);
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}
.failure-message {
  font-size: 14px;
  color: var(--white);
  margin-bottom: 8px;
}
.failure-detail {
  font-size: 12px;
  color: var(--amber);
}

@keyframes failureShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* Feedback de tratamiento contraindicado */
.treatment-danger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #2a0a0a 0%, #150505 100%);
  border: 2px solid var(--red);
  border-radius: 12px;
  text-align: center;
  animation: dangerPulse 0.3s ease infinite;
}
.danger-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.danger-title {
  font-family: var(--font-disp);
  font-size: 24px;
  font-weight: 900;
  color: var(--red);
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px var(--red);
  margin-bottom: 12px;
}
.danger-message {
  font-size: 14px;
  color: var(--white);
  margin-bottom: 8px;
}
.danger-detail {
  font-size: 12px;
  color: var(--red-light);
}

/* Lista de efectos adversos */
.adverse-effects-list {
  width: 100%;
  max-width: 400px;
  margin: 16px 0;
  padding: 12px;
  background: rgba(255, 59, 59, 0.1);
  border: 1px solid var(--red-dim);
  border-radius: 8px;
}
.effect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 11px;
  color: var(--red-light);
  font-family: var(--font-mono);
  border-bottom: 1px solid rgba(255, 59, 59, 0.2);
}
.effect-item:last-child {
  border-bottom: none;
}

@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 59, 59, 0.3); }
  50% { box-shadow: 0 0 40px rgba(255, 59, 59, 0.6); }
}

/* Cooldown de tratamientos */
.treatment-cooldown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #1a2a2a 0%, #0a1515 100%);
  border: 2px solid var(--cyan);
  border-radius: 12px;
  text-align: center;
}
.cooldown-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: pulse 1s infinite;
}
.cooldown-title {
  font-family: var(--font-disp);
  font-size: 28px;
  font-weight: 900;
  color: var(--cyan);
  letter-spacing: 0.15em;
  margin-bottom: 8px;
}
.cooldown-message {
  font-size: 12px;
  color: var(--white-dim);
  margin-bottom: 16px;
}
.cooldown-bar {
  width: 100%;
  height: 8px;
  background: #0a1a1a;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}
.cooldown-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--green) 100%);
  border-radius: 4px;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px var(--cyan);
}

/* Game Over */
.game-over {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #2a0a0a 0%, #0a0505 100%);
  border: 3px solid var(--red);
  border-radius: 12px;
  text-align: center;
  animation: gameOverPulse 0.5s ease infinite;
}
@keyframes gameOverPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 59, 59, 0.4); }
  50% { box-shadow: 0 0 40px rgba(255, 59, 59, 0.7); }
}
.game-over-icon {
  font-size: 80px;
  margin-bottom: 16px;
}
.game-over-title {
  font-family: var(--font-disp);
  font-size: 36px;
  font-weight: 900;
  color: var(--red);
  letter-spacing: 0.2em;
  text-shadow: 0 0 20px var(--red);
  margin-bottom: 8px;
}
.game-over-reason {
  font-size: 14px;
  color: var(--white);
  margin-bottom: 20px;
  padding: 8px 16px;
  background: rgba(255, 59, 59, 0.2);
  border-radius: 4px;
}
.game-over-info {
  width: 100%;
  max-width: 400px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  text-align: left;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.info-row:last-child {
  border-bottom: none;
}
.info-label {
  font-size: 11px;
  color: var(--white-dim);
  font-family: var(--font-mono);
}
.info-value {
  font-size: 12px;
  color: var(--white);
  font-family: var(--font-disp);
  text-align: right;
  max-width: 60%;
}
.info-value.correct {
  color: var(--green);
}
.info-value.wrong {
  color: var(--red);
}
.restart-btn {
  background: linear-gradient(135deg, #2a1a1a 0%, #1a0a0a 100%);
  border: 2px solid var(--red);
  color: var(--red);
  font-family: var(--font-disp);
  font-size: 16px;
  font-weight: 700;
  padding: 16px 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.restart-btn:hover {
  background: linear-gradient(135deg, #3a2a2a 0%, #2a0a0a 100%);
  box-shadow: 0 0 30px rgba(255, 59, 59, 0.5);
  transform: scale(1.05);
}

/* Feedback de efecto desconocido */
.treatment-unknown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  border: 2px solid var(--white-dim);
  border-radius: 12px;
  text-align: center;
}
.unknown-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.unknown-title {
  font-family: var(--font-disp);
  font-size: 20px;
  font-weight: 900;
  color: var(--white-dim);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.unknown-message {
  font-size: 14px;
  color: var(--white);
  margin-bottom: 8px;
}
.unknown-detail {
  font-size: 12px;
  color: var(--white-dim);
}

/* ─── EVOLUTION PANEL ─── */
.evolution-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border2);
  padding: 16px;
  overflow-y: auto;
}
.evolution-panel h3 {
  font-family: var(--font-disp);
  font-size: 12px;
  color: var(--green);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.evolution-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.evolution-item {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  background: #050a0a;
  border-radius: 4px;
  font-size: 11px;
}
.evolution-time {
  color: var(--white-dim);
  min-width: 60px;
}
.evolution-text {
  color: var(--white);
}
.evolution-text.positive {
  color: var(--green);
}
.evolution-text.negative {
  color: var(--red-light);
}

/* ─── CABECERA ─── */
.top-bar {
  grid-area: header;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
}

.top-left { display: flex; flex-direction: column; line-height: 1.2; }
.hospital-name { font-family: var(--font-disp); font-size: 9px; font-weight: 700; color: var(--green-dim); letter-spacing: 0.15em; }
.bed-id { font-size: 9px; color: var(--white-dim); letter-spacing: 0.1em; }

.top-center { display: flex; flex-direction: column; align-items: center; }
.patient-name { font-family: var(--font-disp); font-size: 12px; font-weight: 700; color: var(--white); letter-spacing: 0.05em; }
.patient-info { font-size: 9px; color: var(--white-dim); margin-top: 1px; }

.top-right { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.clock { font-family: var(--font-disp); font-size: 18px; font-weight: 900; color: var(--green); letter-spacing: 0.1em; }
.date { font-size: 9px; color: var(--white-dim); }

.alarm-indicator {
  font-size: 9px;
  color: var(--red);
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.3s;
}
.alarm-indicator.active { opacity: 1; }
.alarm-dot {
  width: 6px; height: 6px;
  background: var(--red);
  border-radius: 50%;
  animation: blink 0.8s infinite;
}

/* ─── MAIN GRID ─── */
.monitor-grid {
  grid-area: main;
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 0;
  overflow: hidden;
  height: 100%;
}

/* ─── WAVEFORMS ─── */
.waveforms-column {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border2);
  overflow: hidden;
  height: 100%;
}

.wave-panel {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  position: relative;
  padding: 2px 0;
  min-height: 60px;
  max-height: 33.33%;
}

/* ECG panel */
.ecg-panel {
  flex: 1 1 0;
  min-height: 60px;
  max-height: 33.33%;
}

/* Divisores arrastrables entre ondas */
.wave-divider {
  flex: 0 0 6px;
  background: transparent;
  cursor: ns-resize;
  position: relative;
  z-index: 10;
}
.wave-divider::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 4px;
  background: #1a3030;
  border-radius: 2px;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
}
.wave-divider:hover::before {
  opacity: 1;
  background: var(--green-dim);
}
.wave-divider.dragging::before {
  opacity: 1;
  background: var(--green);
}

.wave-panel:last-child { border-bottom: none; }

.wave-label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 10px;
  font-size: 10px;
  color: var(--white-dim);
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  pointer-events: none;
}

.wave-label .lead-name { color: var(--green); font-family: var(--font-disp); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; pointer-events: all; }
.wave-label .lead-name:hover {
  color: var(--white);
  text-shadow: 0 0 10px var(--green);
}
.wave-label .lead-name #ecgLeadLabel {
  display: inline-block;
  min-width: 20px;
  text-align: center;
}
.wave-label .wave-speed { font-size: 8px; color: var(--white-dim); }
.ecg-gain-btn { font-size: 8px; color: var(--amber); cursor: pointer; pointer-events: all; border: 1px solid #2a3a00; padding: 1px 5px; border-radius: 2px; }
.ecg-gain-btn:hover { background: #1a2a00; }

.wave-panel canvas {
  flex: 1;
  width: 100%;
  height: 100%;
  display: block;
}

.wave-footer {
  position: absolute;
  bottom: 2px; left: 10px;
  font-size: 9px;
}

.rhythm-label { color: var(--green-dim); font-family: var(--font-disp); letter-spacing: 0.08em; }

/* ECG glow */
.ecg-panel canvas { filter: drop-shadow(0 0 2px var(--green)); }
.spo2-panel canvas { filter: drop-shadow(0 0 2px var(--cyan)); }
.etco2-panel canvas { filter: drop-shadow(0 0 2px var(--yellow)); }

/* ─── PARAMS COLUMN ─── */
.params-column {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 180px;
  height: 100%;
}

.param-card {
  flex: 1 1 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 4px 6px;
  cursor: pointer;
  position: relative;
  transition: background 0.15s;
  overflow: hidden;
  min-height: 40px;
  max-height: 16.66%;
}
.param-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.param-card:last-child { border-bottom: none; }
.param-card:hover { background: #0a1a1a; }

.ecg-card::before  { background: var(--green); }
.spo2-card::before { background: var(--cyan); }
.nibp-card::before { background: var(--red-light); }
.rr-card::before   { background: var(--white); }
.temp-card::before { background: var(--amber); }
.etco2-card::before { background: var(--yellow); }

.param-label {
  font-family: var(--font-disp);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--white-dim);
  align-self: flex-start;
}

.param-value {
  font-family: var(--font-disp);
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 0 20px currentColor;
  transition: color 0.3s;
}

.ecg-card  .param-value { color: var(--green); }
.spo2-card .param-value { color: var(--cyan); }
.rr-card   .param-value { color: var(--white); }
.temp-card .param-value { color: var(--amber); }
.etco2-card .param-value { color: var(--yellow); }

.param-value-bp {
  font-family: var(--font-disp);
  font-size: 28px;
  font-weight: 900;
  color: var(--red-light);
  text-shadow: 0 0 15px var(--red-light);
  letter-spacing: -0.01em;
}
.param-value-map {
  font-family: var(--font-disp);
  font-size: 16px;
  color: var(--red-light);
  opacity: 0.8;
}

.param-unit {
  font-size: 9px;
  color: var(--white-dim);
  letter-spacing: 0.05em;
}

.param-sublabel {
  font-size: 8px;
  color: var(--white-dim);
  opacity: 0.6;
  margin-top: 2px;
}
.param-sublabel2 {
  font-size: 7px;
  color: var(--white-dim);
  opacity: 0.5;
}

.param-limits {
  font-size: 8px;
  color: var(--white-dim);
  opacity: 0.5;
  margin-top: 2px;
}

.nibp-btn {
  margin-top: 4px;
  font-family: var(--font-disp);
  font-size: 8px;
  background: #0f2020;
  color: var(--red-light);
  border: 1px solid var(--red-dim);
  padding: 2px 8px;
  border-radius: 2px;
  cursor: pointer;
  letter-spacing: 0.05em;
}
.nibp-btn:hover { background: #1f3030; }

/* ─── FOOTER ─── */
.bottom-bar {
  grid-area: footer;
  background: var(--bg-bar);
  border-top: 1px solid var(--border2);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  overflow-x: auto;
  height: 48px;
}

/* Mini-Monitor (visible en Exámenes/Tratamientos) - EN LÍNEA HORIZONTAL */
.mini-monitor {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 8px;
  box-sizing: border-box;
}

.mini-wave-panel {
  position: relative;
  background: #050a0a;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  flex: 1;
  min-width: 100px;
  max-width: 200px;
  height: 40px;
}

.mini-wave-panel canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.mini-wave-panel .mini-label {
  position: absolute;
  top: 2px;
  left: 4px;
  font-family: var(--font-disp);
  font-size: 6px;
  color: var(--white-dim);
  letter-spacing: 0.05em;
  z-index: 10;
}

.mini-wave-panel.ecg canvas {
  filter: drop-shadow(0 0 2px var(--green));
}

.mini-wave-panel.ecg .mini-label {
  color: var(--green);
}

.mini-wave-panel.spo2 canvas {
  filter: drop-shadow(0 0 2px var(--cyan));
}

.mini-wave-panel.spo2 .mini-label {
  color: var(--cyan);
}

.mini-wave-panel.etco2 canvas {
  filter: drop-shadow(0 0 2px var(--yellow));
}

.mini-wave-panel.etco2 .mini-label {
  color: var(--yellow);
}

.mini-param {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  background: #060d0d;
  border-radius: 4px;
  border-left: 2px solid var(--border);
  width: 55px;
  height: 40px;
  flex-shrink: 0;
}

.mini-param.ecg {
  border-left-color: var(--green);
}

.mini-param.spo2 {
  border-left-color: var(--cyan);
}

.mini-param.nibp {
  border-left-color: var(--red-light);
}

.mini-param.rr {
  border-left-color: var(--white);
}

.mini-param-label {
  font-family: var(--font-disp);
  font-size: 5px;
  color: var(--white-dim);
  letter-spacing: 0.1em;
  line-height: 1;
}

.mini-param-value {
  font-family: var(--font-disp);
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 0 10px currentColor;
  line-height: 1;
}

.mini-param-unit {
  font-family: var(--font-mono);
  font-size: 5px;
  color: var(--white-dim);
  line-height: 1;
}

.mini-param.ecg .mini-param-value {
  color: var(--green);
}

.mini-param.spo2 .mini-param-value {
  color: var(--cyan);
}

.mini-param.nibp .mini-param-value {
  color: var(--red-light);
}

.mini-param.rr .mini-param-value {
  color: var(--white);
}

/* Main controls wrapper */
.main-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  overflow-x: auto;
}

.bottom-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sound-ctrl {
  display: flex;
  align-items: center;
}

.sound-btns-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.bottom-section label {
  font-family: var(--font-disp);
  font-size: 8px;
  color: var(--white-dim);
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.bottom-section select {
  background: #0a1a1a;
  color: var(--green);
  border: 1px solid var(--border2);
  border-radius: 3px;
  padding: 3px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  min-width: 200px;
  cursor: pointer;
  outline: none;
}
.bottom-section select:focus { border-color: var(--green-dim); }
.bottom-section select option, .bottom-section select optgroup { background: #0a1a1a; }

/* Wrapper para select con submenús */
.pathology-select-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Submenú STEMI */
.submenu-container {
  position: fixed;
  bottom: 80px;
  left: 200px;
  background: var(--bg-panel);
  border: 2px solid var(--amber);
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(255, 170, 0, 0.3);
  z-index: 10000;
  min-width: 280px;
  max-width: 320px;
  overflow: hidden;
  animation: slideUpFade 0.3s ease;
  display: none;
}
.submenu-container.open {
  display: block;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.submenu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(135deg, #2a1a0a 0%, #1a0f00 100%);
  border-bottom: 1px solid var(--amber);
}

.submenu-header span {
  font-family: var(--font-disp);
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.submenu-close {
  background: transparent;
  border: none;
  color: var(--amber);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: all 0.2s;
}
.submenu-close:hover {
  color: var(--red);
  transform: scale(1.2);
}

.submenu-items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 8px;
  max-height: 350px;
  overflow-y: auto;
}

.submenu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #050a0a;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.submenu-btn:hover {
  background: #0a1a1a;
  border-color: var(--green);
  transform: translateX(4px);
}

.submenu-btn:active {
  transform: scale(0.98);
}

.submenu-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.submenu-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.submenu-text strong {
  font-family: var(--font-disp);
  font-size: 10px;
  color: var(--white);
  letter-spacing: 0.05em;
}

.submenu-text small {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--white-dim);
}

/* Scrollbar para submenú */
.submenu-items::-webkit-scrollbar {
  width: 4px;
}
.submenu-items::-webkit-scrollbar-track {
  background: var(--bg-main);
}
.submenu-items::-webkit-scrollbar-thumb {
  background: var(--amber);
  border-radius: 2px;
}

.bottom-section input[type=range] {
  width: 100%;
  accent-color: var(--green);
  cursor: pointer;
}

.bottom-section span {
  font-family: var(--font-disp);
  font-size: 13px;
  color: var(--green);
  text-align: center;
}

.alarm-ctrl {
  min-width: 180px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.alarm-ctrl label {
  width: 100%;
  text-align: center;
  margin-bottom: 2px;
}
.alarm-ctrl .ctrl-btn {
  flex: 1;
  min-width: 70px;
}

/* Control de velocidad de ondas */
.wave-speed-ctrl {
  min-width: 140px;
}
.wave-speed-ctrl label {
  font-family: var(--font-disp);
  font-size: 7px;
  color: var(--white-dim);
  letter-spacing: 0.08em;
  text-align: center;
  margin-bottom: 3px;
}
.wave-speed-btns {
  display: flex;
  align-items: center;
  gap: 3px;
  justify-content: center;
}
.wave-speed-btn {
  background: #0a1a1a;
  border: 1px solid var(--border2);
  color: var(--white-dim);
  font-family: var(--font-disp);
  font-size: 8px;
  padding: 3px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 32px;
}
.wave-speed-btn:hover {
  background: #0f2a2a;
  color: var(--cyan);
  border-color: var(--cyan-dim);
}
.wave-speed-btn.active {
  background: #0a2a2a;
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 232, 255, 0.4);
}
.wave-speed-unit {
  font-family: var(--font-mono);
  font-size: 7px;
  color: var(--white-dim);
  margin-left: 2px;
}

.sound-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  justify-content: center;
}
.sound-btns .ctrl-btn {
  flex: 1 1 45%;
  min-width: 65px;
  font-size: 8px;
  padding: 4px 6px;
}

/* Control de amplitud */
.amp-ctrl { min-width: 100px; }

.amp-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.amp-btn {
  font-family: var(--font-disp);
  font-size: 14px;
  background: #0a1a0a;
  color: var(--green);
  border: 1px solid var(--green-dim);
  width: 28px;
  height: 28px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.1s, transform 0.1s;
  flex-shrink: 0;
}
.amp-btn:hover { background: #152a15; }
.amp-btn:active { transform: scale(0.92); }

.amp-display {
  font-family: var(--font-disp);
  font-size: 20px;
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
  min-width: 34px;
  text-align: center;
  letter-spacing: -0.02em;
}

.ctrl-btn {
  font-family: var(--font-mono);
  font-size: 9px;
  background: #0a1a1a;
  color: var(--white);
  border: 1px solid var(--border2);
  padding: 3px 8px;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
}
.ctrl-btn:hover { background: #152828; }
.ctrl-btn.danger { color: var(--red); border-color: var(--red-dim); }
.ctrl-btn.danger:hover { background: #1a0a0a; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: none;
}
.modal-overlay.open { display: block; }

.settings-modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: #080f0f;
  border: 1px solid var(--border2);
  border-radius: 4px;
  width: 380px;
  max-height: 70vh;
  overflow-y: auto;
  z-index: 101;
  display: none;
  box-shadow: 0 0 40px rgba(0,255,127,0.1);
  transition: transform 0.2s;
}
.settings-modal.open {
  display: block;
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border2);
  font-family: var(--font-disp);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--green);
}
.modal-close { background: none; border: none; color: var(--white-dim); cursor: pointer; font-size: 14px; }
.modal-close:hover { color: var(--red); }

.modal-body { padding: 16px; }

.modal-body .setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
}
.modal-body label { color: var(--white-dim); }
.modal-body input[type=number] {
  background: #0a1a1a;
  color: var(--green);
  border: 1px solid var(--border2);
  padding: 3px 8px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 13px;
  width: 90px;
  text-align: right;
  outline: none;
}
.modal-body input[type=number]:focus { border-color: var(--green-dim); }

.modal-save-btn {
  width: 100%;
  margin-top: 10px;
  font-family: var(--font-disp);
  font-size: 10px;
  background: #0a2a0a;
  color: var(--green);
  border: 1px solid var(--green-dim);
  padding: 8px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: 0.1em;
}
.modal-save-btn:hover { background: #152a15; }

/* Modal de Ayuda */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.help-overlay.open {
  opacity: 1;
}

.help-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: linear-gradient(135deg, #080f0f 0%, #050a0a 100%);
  border: 2px solid var(--green);
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1001;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 0 60px rgba(0, 255, 127, 0.2);
}
.help-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.help-modal-content {
  display: flex;
  flex-direction: column;
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 2px solid var(--green);
  background: rgba(0, 255, 127, 0.05);
  border-radius: 12px 12px 0 0;
}
.help-header h2 {
  font-family: var(--font-disp);
  font-size: 18px;
  color: var(--green);
  letter-spacing: 0.1em;
  margin: 0;
  text-shadow: 0 0 20px rgba(0, 255, 127, 0.4);
}
.help-close {
  background: none;
  border: 2px solid var(--green-dim);
  color: var(--green);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.help-close:hover {
  background: var(--green);
  color: #000;
  transform: scale(1.1);
}

.help-body {
  padding: 24px;
  color: var(--white);
  line-height: 1.6;
}

.help-section {
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(0, 255, 127, 0.03);
  border: 1px solid var(--border2);
  border-radius: 8px;
  border-left: 3px solid var(--green);
}
.help-section h3 {
  font-family: var(--font-disp);
  font-size: 14px;
  color: var(--green);
  letter-spacing: 0.08em;
  margin: 0 0 12px 0;
}
.help-section p {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--white-dim);
  line-height: 1.7;
  margin: 8px 0;
}
.help-section ul {
  margin: 8px 0;
  padding-left: 20px;
}
.help-section li {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--white-dim);
  margin: 6px 0;
  line-height: 1.5;
}
.help-section strong {
  color: var(--green);
}

/* Dedicatoria */
.help-section.dedication {
  background: linear-gradient(135deg, rgba(0, 255, 127, 0.05) 0%, rgba(0, 100, 50, 0.05) 100%);
  border-left-color: var(--green);
  text-align: center;
}
.dedication-text {
  font-size: 12px;
  margin: 10px 0;
}
.dedication-text.highlight {
  color: var(--green);
  font-size: 13px;
  padding: 10px;
  background: rgba(0, 255, 127, 0.05);
  border-radius: 6px;
  border: 1px dashed var(--green-dim);
}

.help-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border2);
  text-align: center;
}
.help-footer p {
  margin: 6px 0;
  font-size: 11px;
}
.year {
  color: var(--amber);
  font-family: var(--font-disp);
  letter-spacing: 0.1em;
}
.developer {
  color: var(--cyan);
}
.developer strong {
  color: var(--green);
  text-shadow: 0 0 10px rgba(0, 255, 127, 0.4);
}

/* Scrollbar para help modal */
.help-modal::-webkit-scrollbar {
  width: 6px;
}
.help-modal::-webkit-scrollbar-track {
  background: var(--bg-main);
}
.help-modal::-webkit-scrollbar-thumb {
  background: var(--green);
  border-radius: 3px;
}

/* ─── ALERTAS ─── */
.alerts-panel {
  position: fixed;
  bottom: 60px;
  right: 12px;
  display: flex;
  flex-direction: column-reverse;
  gap: 4px;
  z-index: 200;
  pointer-events: none;
  max-height: 200px;
  overflow-y: auto;
}

.alert-item {
  background: #0f0505;
  border: 1px solid var(--red);
  color: var(--red-light);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255,59,59,0.3);
  animation: slideInBottom 0.3s ease;
  pointer-events: all;
  cursor: pointer;
  max-width: 300px;
}
.alert-item.warn {
  background: #0f0a00;
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: 0 0 10px rgba(255,170,0,0.2);
}
.alert-item.success {
  background: #051510;
  border-color: var(--green-dim);
  color: var(--green);
  box-shadow: 0 0 10px rgba(0,255,127,0.2);
}

@keyframes slideInBottom {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Panel de notificaciones expandido */
.notifications-panel {
  position: fixed;
  bottom: 140px;
  left: 80px; /* Alineado con la barra lateral */
  width: 300px;
  max-height: 350px;
  background: var(--bg-panel);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
  z-index: 9998;
  display: none;
  overflow: hidden;
}
.notifications-panel.open {
  display: block;
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--border);
}
.notifications-header h4 {
  font-family: var(--font-disp);
  font-size: 10px;
  color: var(--green);
  letter-spacing: 0.1em;
}
.notifications-clear {
  font-size: 8px;
  background: none;
  border: none;
  color: var(--white-dim);
  cursor: pointer;
}
.notifications-clear:hover {
  color: var(--red);
}
.notifications-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 8px;
}
.notification-item {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  background: #050a0a;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 10px;
}
.notification-time {
  color: var(--white-dim);
  min-width: 50px;
  font-size: 9px;
}
.notification-text {
  color: var(--white);
}
.notification-text.positive { color: var(--green); }
.notification-text.negative { color: var(--red-light); }
.notification-text.warning { color: var(--amber); }

/* Indicador de notificaciones en footer */
.notif-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #0f1515;
  border: 1px solid var(--border2);
  border-radius: 4px;
  cursor: pointer;
  font-size: 9px;
  color: var(--white-dim);
}
.notif-indicator:hover {
  background: #152020;
}
.notif-indicator.has-new {
  border-color: var(--amber);
  color: var(--amber);
}
.notif-badge {
  background: var(--red);
  color: var(--white);
  font-size: 8px;
  padding: 1px 4px;
  border-radius: 8px;
  min-width: 14px;
  text-align: center;
}

/* ─── ANIMACIONES ─── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; pointer-events: none; }
}

.alarm-flash { animation: alarmFlash 0.5s infinite; }
@keyframes alarmFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── CONTROLES AMPLITUD POR ONDA ─── */
.wave-amp-ctrl {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  pointer-events: all;
}
.wave-amp-btn {
  background: #0a1a10;
  border: 1px solid #0f3020;
  color: var(--green-dim);
  font-size: 9px;
  width: 18px; height: 16px;
  cursor: pointer;
  border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  line-height: 1;
}
.wave-amp-btn:hover { background: #103020; color: var(--green); }
.wave-amp-val {
  font-family: var(--font-disp);
  font-size: 8px;
  color: var(--green-dim);
  min-width: 22px;
  text-align: center;
}

/* ─── AMPLITUD GLOBAL ─── */
.amp-global-ctrl { min-width: 150px; }
.amp-row {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
}
.amp-bar-wrap { flex: 1; }
.amp-bar-wrap input[type=range] { width: 100%; accent-color: var(--amber); }
.amp-global-btn {
  background: #1a1200;
  border: 1px solid #3a2a00;
  color: var(--amber);
  font-size: 11px;
  width: 20px; height: 20px;
  cursor: pointer;
  border-radius: 2px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.amp-global-btn:hover { background: #2a1f00; }
.amp-global-val {
  font-family: var(--font-disp);
  font-size: 13px;
  color: var(--amber);
  text-align: center;
  display: block;
  text-shadow: 0 0 8px var(--amber);
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ─── DATOS CLÍNICOS (MODO TEST) ────────────────────────────────── */
.clinical-data-panel {
  background: var(--bg-panel);
  border-top: 2px solid var(--amber);
  padding: 16px;
  margin-top: 0;
  max-height: 350px;
  overflow-y: auto;
  animation: slideDown 0.3s ease;
}

#clinicalDataMonitor {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 40vh;
  border-top: 3px solid var(--amber);
  box-shadow: 0 -5px 30px rgba(255, 170, 0, 0.2);
  z-index: 50;
}

#clinicalDataExams,
#clinicalDataTreatments {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 40vh;
  border-top: 3px solid var(--amber);
  box-shadow: 0 -5px 30px rgba(255, 170, 0, 0.2);
  z-index: 50;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.clinical-data-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.clinical-data-title {
  font-family: var(--font-disp);
  font-size: 14px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(255, 170, 0, 0.3);
}

.clinical-data-close {
  background: #2a1a0a;
  border: 1px solid var(--amber);
  color: var(--amber);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.clinical-data-close:hover {
  background: #3a2a0a;
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.4);
}

.clinical-data-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clinical-data-section {
  background: #050a0a;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  border-left: 3px solid var(--green);
}

.clinical-data-section:nth-child(2) { border-left-color: var(--cyan); }
.clinical-data-section:nth-child(3) { border-left-color: var(--purple); }
.clinical-data-section:nth-child(4) { border-left-color: var(--red); }
.clinical-data-section:nth-child(5) { border-left-color: var(--yellow); }

.clinical-data-label {
  font-family: var(--font-disp);
  font-size: 9px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  opacity: 0.9;
}

.clinical-data-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--white-dim);
  line-height: 1.6;
  padding-left: 8px;
  border-left: 2px solid var(--border2);
}

.clinical-data-diagnosis {
  background: linear-gradient(135deg, #0a2a1a 0%, #051510 100%);
  border-left-color: var(--green) !important;
  border-color: var(--green-dim);
}

.clinical-data-diagnosis .clinical-data-label {
  color: var(--green);
  font-size: 10px;
}

.clinical-data-diagnosis .clinical-data-text {
  color: var(--green);
  font-weight: 600;
  border-left-color: var(--green-dim);
  font-size: 12px;
}

.diagnosis-text {
  color: var(--green) !important;
  text-shadow: 0 0 5px rgba(0, 255, 127, 0.2);
}

/* Condiciones compuestas en datos clínicos */
.clinical-data-compound {
  background: linear-gradient(135deg, #2a0a0a 0%, #1a0505 100%);
  border-color: var(--red) !important;
}
.clinical-data-compound .clinical-data-label {
  color: var(--red);
}
.compound-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.compound-item {
  padding: 8px;
  background: rgba(255, 59, 59, 0.1);
  border-left: 2px solid var(--red);
  border-radius: 4px;
}
.compound-item strong {
  color: var(--red);
  font-size: 11px;
  font-family: var(--font-disp);
  letter-spacing: 0.05em;
}
.compound-item small {
  color: var(--white-dim);
  font-size: 9px;
  font-family: var(--font-mono);
}

/* Diagnóstico oculto */
.diagnosis-hidden {
  filter: blur(10px);
  user-select: none;
  opacity: 0.1;
  transition: all 0.3s ease;
  pointer-events: none;
}

.revealed {
  filter: blur(0);
  user-select: text;
  opacity: 1;
  transition: all 0.3s ease;
}

/* Botón de revelar diagnóstico */
.reveal-diagnosis-btn {
  background: linear-gradient(135deg, #2a1a0a 0%, #1a0f00 100%);
  border: 2px solid var(--amber);
  color: var(--amber);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-disp);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(255, 170, 0, 0.3);
  vertical-align: middle;
}

.reveal-diagnosis-btn:hover {
  background: linear-gradient(135deg, #3a2a0a 0%, #2a1f00 100%);
  box-shadow: 0 0 20px rgba(255, 170, 0, 0.6);
  transform: scale(1.1);
}

.reveal-diagnosis-btn.revealed {
  background: linear-gradient(135deg, #0a2a1a 0%, #051510 100%);
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 15px rgba(0, 255, 127, 0.4);
}

/* Panel de datos clínicos en exámenes y tratamientos */
#clinicalDataExams .clinical-data-section,
#clinicalDataTreatments .clinical-data-section {
  max-width: 800px;
}

/* ─── MODAL DE DATOS CLÍNICOS (MODO TEST) ─── */
.clinical-data-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1002;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.clinical-data-overlay.open {
  opacity: 1;
}

.clinical-data-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: linear-gradient(135deg, #080f0f 0%, #050a0a 100%);
  border: 2px solid var(--amber);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 1003;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 0 0 60px rgba(255, 170, 0, 0.3);
}

.clinical-data-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.clinical-data-modal .clinical-data-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 2px solid var(--amber);
  background: linear-gradient(135deg, rgba(255, 170, 0, 0.1) 0%, rgba(255, 170, 0, 0.05) 100%);
  border-radius: 12px 12px 0 0;
}

.clinical-data-modal .clinical-data-title {
  font-family: var(--font-disp);
  font-size: 16px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.1em;
  text-shadow: 0 0 15px rgba(255, 170, 0, 0.4);
}

.clinical-data-modal .clinical-data-close {
  background: #2a1a0a;
  border: 2px solid var(--amber);
  color: var(--amber);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.clinical-data-modal .clinical-data-close:hover {
  background: #3a2a0a;
  box-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
  transform: scale(1.1);
}

.clinical-data-modal .clinical-data-content {
  padding: 20px;
}

.clinical-data-modal .clinical-data-section {
  margin-bottom: 16px;
}

/* Responsive para modal de datos clínicos */
@media (max-width: 768px) {
  .clinical-data-modal {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
  }
  
  .clinical-data-modal .clinical-data-header {
    padding: 12px 16px;
  }
  
  .clinical-data-modal .clinical-data-title {
    font-size: 13px;
  }
  
  .clinical-data-modal .clinical-data-content {
    padding: 12px;
  }
  
  .clinical-data-modal .clinical-data-section {
    padding: 10px;
    margin-bottom: 10px;
  }
}

/* ===============================================================
   RESPONSIVE - DISPOSITIVOS MÓVILES
   =============================================================== */

/* Tablet y móvil grande (max-width: 1024px) */
@media (max-width: 1024px) {
  .monitor-grid {
    grid-template-columns: 1fr 180px;
  }
  
  .param-value {
    font-size: 32px;
  }
  
  .param-value-bp {
    font-size: 22px;
  }
}

/* Móvil (max-width: 768px) */
@media (max-width: 768px) {
  /* Layout principal - sin header para más espacio */
  html, body {
    overflow: auto;
  }

  body {
    grid-template-columns: 50px 1fr;
    grid-template-rows: 1fr auto;
    grid-template-areas:
      "sidebar main"
      "sidebar footer";
  }
  
  /* Ocultar header en móvil */
  .top-bar {
    display: none;
  }
  
  /* Mini-Monitor en móvil */
  .mini-monitor {
    gap: 4px;
    padding: 0 4px;
  }
  
  .mini-wave-panel {
    min-width: 80px;
    max-width: none;
  }
  
  .mini-param {
    width: 45px;
    padding: 4px 4px;
  }
  
  .mini-param-value {
    font-size: 11px;
  }
  
  .mini-param-label {
    font-size: 4px;
  }
  
  .mini-param-unit {
    font-size: 4px;
  }

  /* Botón de ayuda en móvil */
  .sidebar-tab.help-tab-btn {
    display: flex !important;
  }
  
  .sidebar-tab.help-tab-btn .tab-label {
    display: block;
    font-size: 5px;
  }
  
  .sidebar-tab.help-tab-btn .tab-icon {
    font-size: 14px;
  }
  
  /* Modal de ayuda en móvil */
  .help-modal {
    width: 95%;
    max-width: 95%;
    max-height: 90vh;
  }
  
  .help-header h2 {
    font-size: 14px;
  }
  
  .help-body {
    padding: 16px;
  }
  
  .help-section h3 {
    font-size: 12px;
  }
  
  .help-section p,
  .help-section li {
    font-size: 10px;
  }

  /* Submenú STEMI en móvil */
  .submenu-container {
    position: fixed;
    bottom: 100px;
    left: 10px;
    right: 10px;
    min-width: auto;
    max-width: none;
    max-height: 50vh;
    z-index: 10001;
  }
  
  .submenu-items {
    max-height: 40vh;
  }
  
  .submenu-btn {
    padding: 12px 14px;
  }
  
  .submenu-text strong {
    font-size: 11px;
  }
  
  .submenu-text small {
    font-size: 9px;
  }

  /* Cabecera más compacta */
  .top-bar {
    padding: 0 10px;
    height: 56px;
  }

  .hospital-name {
    font-size: 8px;
  }

  .bed-id {
    font-size: 8px;
  }
  
  .patient-name {
    font-size: 11px;
  }
  
  .patient-info {
    font-size: 8px;
  }
  
  .clock {
    font-size: 14px;
  }
  
  .date {
    font-size: 8px;
  }
  
  /* Sidebar izquierda con solo iconos */
  .sidebar-tabs {
    grid-area: sidebar;
    flex-direction: column;
    border-right: 1px solid var(--border2);
    border-bottom: none;
    padding: 6px 0;
    gap: 3px;
    width: 50px;
    min-width: 50px;
  }
  
  .sidebar-tab {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 6px;
  }
  
  .sidebar-tab .tab-icon {
    font-size: 18px;
  }
  
  .sidebar-tab .tab-label {
    display: none; /* Ocultar labels en móvil */
  }
  
  .sidebar-spacer {
    display: block;
    flex: 1;
  }
  
  /* Badge de notificaciones más pequeño */
  .sidebar-tab.notif-tab-btn .notif-tab-badge {
    top: 2px;
    right: 2px;
    font-size: 6px;
    min-width: 12px;
    padding: 1px 3px;
  }
  
  /* Panel principal */
  .app-main {
    grid-area: main;
    overflow: visible;
  }
  
  /* Grid del monitor - mantener 2 columnas (ondas | params) */
  .monitor-grid {
    grid-template-columns: 1fr 140px;
    grid-template-rows: 1fr;
    overflow: hidden;
    height: 100%;
  }
  
  .waveforms-column {
    border-right: 1px solid var(--border2);
    border-bottom: none;
    max-height: none;
    height: 100%;
  }
  
  .wave-panel {
    min-height: 50px;
    max-height: 33.33%;
    flex: 1 1 0;
  }
  
  .wave-label .lead-name {
    font-size: 7px;
  }
  
  .wave-label .wave-speed {
    font-size: 6px;
  }
  
  .ecg-gain-btn {
    font-size: 6px;
    padding: 1px 2px;
  }
  
  /* Columna de parámetros - vertical a la derecha */
  .params-column {
    flex-direction: column;
    flex-wrap: nowrap;
    min-width: 140px;
    width: 140px;
    padding: 2px;
    gap: 0;
    height: 100%;
    overflow-y: auto;
  }
  
  .param-card {
    flex: 1 1 0;
    min-height: 50px;
    max-height: 16.66%;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 3px 4px;
  }
  
  .param-card:last-child {
    border-bottom: none;
  }
  
  .param-label {
    font-size: 6px;
    letter-spacing: 0.08em;
  }
  
  .param-value {
    font-size: 18px;
  }
  
  .param-value-bp {
    font-size: 12px;
  }
  
  .param-value-map {
    font-size: 9px;
  }
  
  .param-unit {
    font-size: 6px;
  }
  
  .param-sublabel {
    font-size: 5px;
    display: none;
  }
  
  .param-sublabel2 {
    font-size: 5px;
    display: none;
  }
  
  .param-limits {
    font-size: 5px;
    display: none;
  }
  
  .nibp-btn {
    font-size: 5px;
    padding: 1px 3px;
    margin-top: 2px;
  }
  
  /* Ocultar controles de amplitud en móvil */
  .wave-amp-ctrl {
    display: none;
  }
  
  /* Ocultar botones de sonido, alarma y velocidad en móvil */
  .sound-ctrl,
  .wave-speed-ctrl {
    display: none;
  }
  
  /* Ocultar botón MEDIR AHORA en móvil */
  .nibp-btn {
    display: none;
  }
  
  /* Footer - solo selector de patología */
  .bottom-bar {
    grid-area: footer;
    height: auto;
    min-height: 60px;
    padding: 8px;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .bottom-section {
    flex-shrink: 0;
  }
  
  .pathology-section {
    min-width: 150px;
  }
  
  .pathology-section select {
    min-width: 150px;
    font-size: 9px;
  }
  
  .sound-ctrl {
    min-width: 200px;
  }
  
  .sound-btns-row {
    flex-wrap: wrap;
  }
  
  .ctrl-btn {
    font-size: 8px;
    padding: 4px 6px;
    min-width: 60px;
  }
  
  .wave-speed-ctrl {
    min-width: 120px;
  }
  
  .wave-speed-btn {
    font-size: 7px;
    padding: 3px 4px;
    min-width: 28px;
  }
  
  .wave-speed-unit {
    font-size: 6px;
  }
  
  /* Notificaciones */
  .notif-indicator {
    min-width: 100px;
  }

  .notif-indicator span:nth-child(2) {
    display: none;
  }

  /* Indicador fijo en móvil */
  .notif-indicator-fixed {
    bottom: 90px;
    right: 20px;
    width: 60px;
    height: 60px;
  }

  .notif-indicator-fixed .notif-icon {
    font-size: 26px;
  }

  /* Paneles de exámenes y tratamientos - 2 columnas en móvil */
  .exams-container,
  .treatments-container {
    grid-template-columns: 140px 1fr;
    height: 100%;
  }
  
  .exams-sidebar,
  .treatments-sidebar {
    border-right: 1px solid var(--border2);
    border-bottom: none;
    max-height: none;
    height: 100%;
    padding: 8px;
    overflow-y: auto;
  }
  
  .exams-title,
  .treatments-title {
    font-size: 9px;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  
  .exams-result,
  .treatment-result {
    padding: 8px;
    overflow-y: auto;
    height: 100%;
  }
  
  .exam-btn,
  .tx-btn {
    font-size: 8px;
    padding: 5px 6px;
  }
  
  .category-header {
    font-size: 8px;
    padding: 6px 8px;
  }
  
  .category-items {
    padding: 4px;
    gap: 3px;
  }
  
  .exam-result-card,
  .treatment-card {
    padding: 10px;
    margin-bottom: 8px;
  }
  
  .exam-result-title {
    font-size: 11px;
  }
  
  .exam-value-row {
    padding: 5px 8px;
  }
  
  .treatment-name {
    font-size: 12px;
  }
  
  .treatment-section-title {
    font-size: 9px;
  }
  
  .treatment-section-content {
    font-size: 10px;
    padding: 6px;
  }
  
  .administer-btn {
    padding: 10px 12px;
    font-size: 11px;
  }
  
  /* Panel de datos clínicos */
  .clinical-data-panel {
    position: fixed !important;
    bottom: 60px !important;
    left: 0 !important;
    right: 0 !important;
    max-height: 60vh !important;
    z-index: 1000;
  }
  
  #clinicalDataExams,
  #clinicalDataTreatments {
    left: 0 !important;
  }
  
  .clinical-data-title {
    font-size: 12px;
  }
  
  .clinical-data-label {
    font-size: 8px;
  }
  
  .clinical-data-text {
    font-size: 9px;
  }
  
  .clinical-data-close {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  
  .reveal-diagnosis-btn {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  
  /* Modal */
  .settings-modal {
    width: 90%;
    max-width: 90%;
    max-height: 80vh;
  }
  
  .modal-body {
    max-height: 60vh;
  }
  
  /* Alertas */
  .alerts-panel {
    bottom: 70px;
    left: 10px;
    right: 10px;
    max-width: none;
  }
  
  .alert-item {
    font-size: 10px;
    padding: 8px;
  }
  
  /* Panel de notificaciones */
  .notifications-panel {
    bottom: 160px;
    left: 70px; /* Alineado con barra lateral en móvil */
    right: 10px;
    width: auto;
    max-height: 40vh;
  }

  .notification-item {
    font-size: 9px;
  }
  
  /* Evolución */
  .evolution-panel {
    height: 150px;
  }
  
  .evolution-time {
    font-size: 8px;
  }
  
  .evolution-text {
    font-size: 9px;
  }
}

/* Móvil pequeño (max-width: 480px) */
@media (max-width: 480px) {
  .top-center {
    display: none;
  }
  
  /* Sidebar más compacta */
  .sidebar-tabs {
    width: 45px;
    min-width: 45px;
  }
  
  .sidebar-tab {
    width: 38px;
    height: 38px;
    border-radius: 5px;
  }
  
  .sidebar-tab .tab-icon {
    font-size: 16px;
  }
  
  /* Parámetros más compactos */
  .monitor-grid {
    grid-template-columns: 1fr 120px;
  }
  
  .params-column {
    min-width: 120px;
    width: 120px;
  }
  
  .param-card {
    min-height: 45px;
    padding: 2px 3px;
  }
  
  .param-label {
    font-size: 5px;
  }
  
  .param-value {
    font-size: 16px;
  }
  
  .param-value-bp {
    font-size: 11px;
  }
  
  .param-value-map {
    font-size: 8px;
  }
  
  .param-unit {
    font-size: 5px;
  }
  
  .nibp-btn {
    font-size: 4px;
    padding: 1px 2px;
  }
  
  /* Waves más compactas */
  .wave-panel {
    min-height: 45px;
  }
  
  .wave-label .lead-name {
    font-size: 6px;
  }
  
  /* Footer más compacto */
  .bottom-bar {
    padding: 6px;
  }
  
  .ctrl-btn {
    font-size: 7px;
    padding: 3px 4px;
    min-width: 50px;
  }
  
  .pathology-section select {
    font-size: 8px;
    min-width: 100px;
  }
}

/* Modo landscape en móvil */
@media (max-width: 768px) and (orientation: landscape) {
  .waveforms-column {
    max-height: 45vh;
  }
  
  .params-column {
    max-height: 55vh;
    overflow-y: auto;
  }
  
  .param-card {
    flex: 0 1 calc(33.333% - 4px);
    min-height: 55px;
  }
  
  .param-value {
    font-size: 18px;
  }
  
  .clinical-data-panel {
    max-height: 40vh !important;
  }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 360px) {
  .param-card {
    flex: 0 1 100%;
  }
  
  .param-value {
    font-size: 18px;
  }
  
  .sidebar-tab {
    width: 42px;
    height: 42px;
  }
}

/* Prevenir zoom en iOS */
@media (max-width: 768px) {
  * {
    touch-action: manipulation;
  }
  
  input, select, button {
    font-size: 16px !important; /* Previene zoom en iOS */
  }
}

/* ===============================================================
   MEJORAS TÁCTILES PARA MÓVIL
   =============================================================== */

/* Feedback visual al tocar */
@media (max-width: 768px) {
  button:active,
  .ctrl-btn:active,
  .tx-btn:active,
  .exam-btn:active,
  .sidebar-tab:active,
  .param-card:active {
    transform: scale(0.95);
    opacity: 0.8;
    transition: all 0.1s;
  }
  
  /* Botones más grandes para dedos */
  .ctrl-btn,
  .tx-btn,
  .exam-btn {
    min-height: 44px; /* Tamaño mínimo recomendado para táctil */
  }
  
  /* Áreas de scroll horizontal */
  .bottom-bar,
  .sidebar-tabs {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
  }
  
  .bottom-bar::-webkit-scrollbar,
  .sidebar-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
  }
  
  /* Hacer que los paneles sean más fáciles de cerrar */
  .clinical-data-close {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Mejorar visibilidad de enlaces/botones */
  a, button, [onclick] {
    -webkit-tap-highlight-color: rgba(0, 255, 127, 0.3);
    tap-highlight-color: rgba(0, 255, 127, 0.3);
  }
}

/* Soporte para safe areas en iPhone X+ */
@supports (padding: max(0px)) {
  @media (max-width: 768px) {
    .top-bar {
      padding-left: max(10px, env(safe-area-inset-left));
      padding-right: max(10px, env(safe-area-inset-right));
      padding-top: max(0px, env(safe-area-inset-top));
    }
    
    .bottom-bar {
      padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .sidebar-tabs {
      padding-left: max(4px, env(safe-area-inset-left));
      padding-right: max(4px, env(safe-area-inset-right));
    }
  }
}
