/* Tele-Nexo — consultorio de bolsillo (mobile-first) */
.tele-nexo-page {
  min-height: 100dvh;
  background: #030712;
  color: #f8fafc;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.tele-nexo-page * {
  box-sizing: border-box;
}

/* Permisos amigables */
.tn-perm {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(2, 6, 23, 0.88);
  backdrop-filter: blur(14px);
}

@media (min-width: 480px) {
  .tn-perm {
    align-items: center;
    padding: 1rem;
  }
}

.tn-perm-card {
  width: 100%;
  max-width: 420px;
  padding: 1.5rem 1.25rem 2rem;
  border-radius: 1.5rem 1.5rem 0 0;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-bottom: none;
  background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  box-shadow: 0 -12px 48px rgba(14, 165, 233, 0.15);
}

@media (min-width: 480px) {
  .tn-perm-card {
    border-radius: 1.25rem;
    border-bottom: 1px solid rgba(56, 189, 248, 0.35);
  }
}

.tn-perm-icon {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

.tn-perm h2 {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
}

.tn-perm p {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #94a3b8;
  text-align: center;
}

.tn-perm-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Lobby móvil */
.tn-lobby {
  padding: 1rem 1rem 2rem;
  max-width: 480px;
  margin: 0 auto;
}

.tn-lobby-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.tn-lobby h1 {
  margin-top: 0.75rem;
  font-size: 1.35rem;
  font-weight: 800;
}

.tn-field {
  margin-top: 1rem;
}

.tn-field label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.tn-field input,
.tn-field select {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #0f172a;
  color: #fff;
  font-size: 1rem;
}

.tn-btn {
  min-height: 52px;
  width: 100%;
  margin-top: 0.5rem;
  border: none;
  border-radius: 0.85rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.tn-btn--primary {
  background: linear-gradient(135deg, #0ea5e9, #06b6d4);
  color: #042f2e;
  box-shadow: 0 8px 28px rgba(14, 165, 233, 0.35);
}

.tn-btn--ghost {
  background: rgba(255, 255, 255, 0.06);
  color: #bae6fd;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.tn-data-hint {
  margin-top: 0.75rem;
  font-size: 0.7rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Sala inmersiva */
.tn-room {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
}

.tn-room--active {
  display: block;
}

.tn-video-remote {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0a;
}

.tn-video-local {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  width: 28vw;
  min-width: 96px;
  max-width: 120px;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 0.85rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
  z-index: 60;
}

.tn-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: max(0.5rem, env(safe-area-inset-top)) 0.75rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 70;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
}

.tn-sala-code {
  font-family: ui-monospace, monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: #7dd3fc;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
}

.tn-quality {
  font-size: 0.6rem;
  color: #86efac;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: rgba(22, 101, 52, 0.4);
}

/* Controles glassmorphism */
.tn-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: 1rem;
  z-index: 80;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75), transparent);
}

.tn-ctrl {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.1s;
}

.tn-ctrl:active {
  transform: scale(0.94);
}

.tn-ctrl--off {
  background: rgba(190, 24, 93, 0.55);
  border-color: #fb7185;
}

.tn-ctrl--hangup {
  width: 64px;
  height: 64px;
  background: rgba(220, 38, 38, 0.85);
  border-color: #fca5a5;
}

.tn-ctrl--scribe-on {
  background: rgba(109, 40, 217, 0.55);
  border-color: #c4b5fd;
  box-shadow: 0 0 24px rgba(167, 139, 250, 0.45);
}

/* Panel Escriba — solo médico */
.tn-scribe {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 340px);
  z-index: 90;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(24px);
  border-left: 1px solid rgba(167, 139, 250, 0.25);
}

.tn-scribe--open {
  transform: translateX(0);
}

.tn-scribe-head {
  padding: max(0.75rem, env(safe-area-inset-top)) 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tn-scribe-head h3 {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c4b5fd;
}

.tn-scribe-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: #e9d5ff;
  -webkit-overflow-scrolling: touch;
}

.tn-scribe-log p {
  margin-bottom: 0.5rem;
}

.tn-scribe-foot {
  padding: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.65rem;
  color: #64748b;
}

.tn-status {
  position: absolute;
  left: 0.75rem;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  z-index: 75;
  max-width: 70%;
  font-size: 0.65rem;
  color: #cbd5e1;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

/* Modal fin de consulta */
.tn-end {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  flex-direction: column;
  background: #0f172a;
  overflow: hidden;
}

.tn-end--open {
  display: flex;
}

.tn-end-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 6rem;
  -webkit-overflow-scrolling: touch;
}

.tn-end h2 {
  font-size: 1rem;
  font-weight: 800;
  color: #38bdf8;
}

.tn-end-section {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.8rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.tn-end-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem 1rem max(1rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(56, 189, 248, 0.2);
}

.tn-hidden {
  display: none !important;
}

body.tn-in-call {
  overflow: hidden;
}
