/* ══════════════════════════════════════════════════════════════
   VIBRA PULSE — Signos vitales vivos de la organización
   ══════════════════════════════════════════════════════════════ */

/* ── Tab button en bottom nav ── */
.bn-tab[data-tab="pulse"] .bn-icon { font-size: 1.2rem; }

/* ══ Panel contenedor ══ */
#panelPulse {
  position: absolute;
  inset: 0;
  background: #040208;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  flex-direction: column;
  gap: 0;
  padding-bottom: 80px;
  z-index: 10;
  -webkit-overflow-scrolling: touch;
}
#panelPulse.active { display: flex; }

/* ══ Header ══ */
.vp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(12px);
}
.vp-header-left { display: flex; flex-direction: column; gap: 2px; }
.vp-title {
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: .02em;
}
.vp-subtitle {
  font-family: var(--mono);
  font-size: .62rem;
  color: rgba(255,255,255,.4);
  letter-spacing: .08em;
}
.vp-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.vp-live-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,230,118,.12);
  border: 1px solid rgba(0,230,118,.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: .62rem;
  color: #00e676;
  letter-spacing: .08em;
}
.vp-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #00e676;
  animation: vp-blink 1s ease-in-out infinite;
}
@keyframes vp-blink {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.7); }
}
.vp-bpm-badge {
  font-family: var(--mono);
  font-size: .7rem;
  color: #f06292;
  background: rgba(240,98,146,.1);
  border: 1px solid rgba(240,98,146,.25);
  border-radius: 20px;
  padding: 3px 10px;
  letter-spacing: .05em;
}

/* ══ Heartbeat colectivo ══ */
.vp-collective {
  margin: 12px 14px 6px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}
.vp-collective-label {
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(255,255,255,.35);
  letter-spacing: .1em;
  padding: 10px 14px 4px;
  text-transform: uppercase;
}
#vpCollectiveCanvas {
  width: 100%;
  height: 80px;
  display: block;
}
.vp-collective-overlay {
  position: absolute;
  top: 10px; right: 12px;
  text-align: right;
}
.vp-collective-val {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: #f06292;
  line-height: 1;
}
.vp-collective-sub {
  font-family: var(--mono);
  font-size: .58rem;
  color: rgba(255,255,255,.35);
  letter-spacing: .06em;
}

/* ══ Grid de vitales ══ */
.vp-vitals-label {
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(255,255,255,.35);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 8px 16px 4px;
}
.vp-vitals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 14px;
}
.vp-vital-card {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  padding: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color .3s;
}
.vp-vital-card.critical {
  border-color: rgba(255,82,82,.5);
  animation: vp-card-pulse 1.5s ease-in-out infinite;
}
.vp-vital-card.warning {
  border-color: rgba(255,196,0,.4);
}
@keyframes vp-card-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,82,82,0); }
  50% { box-shadow: 0 0 0 6px rgba(255,82,82,.15); }
}
.vp-vital-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.vp-vital-dept {
  font-family: var(--mono);
  font-size: .6rem;
  color: rgba(255,255,255,.4);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.vp-vital-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #00e676;
  transition: background .3s;
}
.vp-vital-status-dot.warning { background: #ffc400; }
.vp-vital-status-dot.critical {
  background: #ff5252;
  animation: vp-blink 1s ease-in-out infinite;
}
.vp-vital-val {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}
.vp-vital-metric {
  font-family: var(--mono);
  font-size: .58rem;
  color: rgba(255,255,255,.35);
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.vp-vital-delta {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.vp-vital-delta.up { color: #00e676; }
.vp-vital-delta.down { color: #ff5252; }
.vp-vital-delta.flat { color: rgba(255,255,255,.35); }
canvas.vp-ekg {
  width: 100%;
  height: 48px;
  display: block;
  border-radius: 6px;
}
.vp-vital-bg-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  border-radius: 14px;
  transition: opacity .5s;
  pointer-events: none;
}
.vp-vital-card.critical .vp-vital-bg-glow {
  background: radial-gradient(ellipse at 50% 100%, rgba(255,82,82,.08), transparent 70%);
  opacity: 1;
}

/* ══ Panel de anomalías ══ */
.vp-anomalies {
  margin: 14px 14px 0;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  overflow: hidden;
}
.vp-anomalies-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.vp-anomalies-title {
  font-family: var(--mono);
  font-size: .7rem;
  color: rgba(255,255,255,.7);
  font-weight: 600;
  letter-spacing: .05em;
}
.vp-anomaly-count {
  font-family: var(--mono);
  font-size: .62rem;
  color: #ff5252;
  background: rgba(255,82,82,.12);
  border-radius: 10px;
  padding: 2px 8px;
}
.vp-anomaly-list { display: flex; flex-direction: column; }
.vp-anomaly-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  animation: vp-slide-in .3s ease;
}
.vp-anomaly-item:last-child { border-bottom: none; }
@keyframes vp-slide-in {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.vp-anomaly-sev {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vp-anomaly-sev.critical { background: #ff5252; box-shadow: 0 0 6px rgba(255,82,82,.6); }
.vp-anomaly-sev.warning  { background: #ffc400; }
.vp-anomaly-sev.info     { background: #00b0ff; }
.vp-anomaly-text {
  font-family: var(--mono);
  font-size: .65rem;
  color: rgba(255,255,255,.7);
  flex: 1;
  line-height: 1.4;
}
.vp-anomaly-time {
  font-family: var(--mono);
  font-size: .58rem;
  color: rgba(255,255,255,.25);
  white-space: nowrap;
}

/* ══ NERHIA Synthesis ══ */
.vp-synthesis {
  margin: 14px 14px 0;
  background: linear-gradient(135deg, rgba(134,60,255,.08), rgba(0,176,255,.06));
  border: 1px solid rgba(134,60,255,.2);
  border-radius: 16px;
  padding: 14px;
}
.vp-synthesis-label {
  font-family: var(--mono);
  font-size: .58rem;
  color: rgba(134,60,255,.7);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.vp-synthesis-text {
  font-family: var(--sans);
  font-size: .78rem;
  color: rgba(255,255,255,.8);
  line-height: 1.5;
  margin-bottom: 10px;
}
.vp-synthesis-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.vp-synth-stat {
  font-family: var(--mono);
  font-size: .65rem;
  color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.05);
  border-radius: 8px;
  padding: 4px 10px;
}
.vp-synth-stat span {
  color: #fff;
  font-weight: 700;
}

/* ══ Emergency mode overlay ══ */
.vp-emergency {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.vp-emergency.active {
  opacity: 1;
  animation: vp-emergency-flash 2s ease-in-out infinite;
}
@keyframes vp-emergency-flash {
  0%,100% { box-shadow: inset 0 0 0px 0px rgba(255,82,82,0); }
  50% { box-shadow: inset 0 0 40px 10px rgba(255,82,82,.15); }
}
.vp-emergency-banner {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: rgba(255,82,82,.9);
  color: #fff;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-align: center;
  padding: 6px;
  transform: translateY(-100%);
  transition: transform .3s;
}
.vp-emergency.active .vp-emergency-banner { transform: translateY(0); }

/* ══ Historial de frecuencia ══ */
.vp-frequency {
  margin: 14px 14px 0;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  overflow: hidden;
}
.vp-freq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
}
.vp-freq-title {
  font-family: var(--mono);
  font-size: .68rem;
  color: rgba(255,255,255,.7);
  letter-spacing: .05em;
}
.vp-freq-pills {
  display: flex;
  gap: 4px;
}
.vp-freq-pill {
  font-family: var(--mono);
  font-size: .58rem;
  color: rgba(255,255,255,.4);
  background: rgba(255,255,255,.06);
  border: none;
  border-radius: 10px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all .2s;
}
.vp-freq-pill.active {
  background: rgba(134,60,255,.2);
  color: #b088ff;
  border: 1px solid rgba(134,60,255,.3);
}
#vpFrequencyCanvas {
  width: 100%;
  height: 70px;
  display: block;
  padding: 0 10px 10px;
  box-sizing: border-box;
}
