/* ==========================================================================
   CITOFONÍA VIRTUAL — DESIGN SYSTEM: ORBITAL TITANIUM (CLEAN SCI-FI)
   Estilo Aeroespacial / Futurista Minimalista · Anti-Fatiga Visual
   ========================================================================== */

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

:root {
  /* Lienzo y Superficies (Fondo Claro Espacial / Titanium Glass) */
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-glass: rgba(255, 255, 255, 0.88);
  --bg-surface-elevated: #ffffff;
  --bg-input: #f1f5f9;
  --bg-input-hover: #e2e8f0;

  /* Tipografía y Contraste Óptico (Deep Obsidian & Slate) */
  --text-main: #0f172a;       /* Titulares y lectura de alto contraste */
  --text-body: #334155;       /* Texto de párrafo y etiquetas */
  --text-muted: #64748b;      /* Metadatos y telemetría secundaria */
  --text-dim: #94a3b8;        /* Indicadores pasivos */

  /* Acentos de Energía (Warp Cobalt & Quantum Cyan) */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --primary-glow: rgba(37, 99, 235, 0.25);

  --cyan: #0284c7;
  --cyan-hover: #0369a1;
  --cyan-soft: rgba(2, 132, 199, 0.08);
  --cyan-glow: rgba(2, 132, 199, 0.25);

  /* Acentos de Estado (Plasma Emerald, Stellar Amber, Reactor Crimson) */
  --success: #059669;
  --success-hover: #047857;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;
  --success-glow: rgba(5, 150, 105, 0.25);

  --warning: #d97706;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --danger-glow: rgba(220, 38, 38, 0.25);

  /* Estructura & Bordes de Precisión Micro-métrica */
  --border-subtle: rgba(226, 232, 240, 0.9);
  --border-strong: rgba(203, 213, 225, 0.9);
  --border-focus: #0284c7;

  /* Sombras y Elevación Aeroespacial */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-card: 0 4px 6px -1px rgba(15, 23, 42, 0.04), 0 12px 24px -4px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-elevated: 0 20px 35px -8px rgba(15, 23, 42, 0.08), 0 8px 16px -4px rgba(15, 23, 42, 0.03);
  --shadow-modal: 0 25px 50px -12px rgba(15, 23, 42, 0.25);

  /* Radio de Curvatura de Hardware */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

/* -------------------------------------------------------------
   RESET & BASE GLOBAL
   ------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-canvas);
  background-image: 
    radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.06) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(56, 189, 248, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.5rem 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Tipografía de Telemetría Numérica */
.font-mono,
.apt-hero-number,
.stat-val,
.call-timer,
.apt-num {
  font-family: 'Space Grotesk', monospace, sans-serif !important;
  letter-spacing: -0.03em;
}

/* -------------------------------------------------------------
   CONTENEDOR PRINCIPAL & CABECERA
   ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

header {
  text-align: center;
  padding: 0.5rem 0 1rem 0;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  color: var(--primary);
  margin-bottom: 0.65rem;
}

.logo-badge svg {
  width: 28px;
  height: 28px;
  stroke-width: 2px;
}

h1 {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

/* -------------------------------------------------------------
   TARJETAS GLASSMORPHIC TITANIUM
   ------------------------------------------------------------- */
.card {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.card-title svg {
  width: 20px;
  height: 20px;
  stroke: var(--primary);
  stroke-width: 2px;
}

/* -------------------------------------------------------------
   SISTEMA DE BOTONES AEROESPACIALES
   ------------------------------------------------------------- */
.btn {
  width: 100%;
  padding: 0.9rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  outline: none;
}

.btn svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.2px;
}

.btn:active {
  transform: scale(0.98);
}

/* Primario (Warp Blue) */
.btn-primary,
.btn-flat-active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover,
.btn-flat-active:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.38);
  transform: translateY(-1px);
}

/* Atender Voz (Quantum Emerald) */
.btn-answer,
.btn-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 14px var(--success-glow);
}

.btn-answer:hover,
.btn-success:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.38);
  transform: translateY(-1px);
}

/* Rechazar / Colgar (Reactor Crimson) */
.btn-reject,
.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-reject:hover,
.btn-danger:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.38);
  transform: translateY(-1px);
}

/* Voy en Camino (Quantum Cyan) */
.btn-on-my-way {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 14px var(--cyan-glow);
}

.btn-on-my-way:hover {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%) !important;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.38);
  transform: translateY(-1px);
}

/* Secundario / Titanio Neutro */
.btn-secondary {
  background: #ffffff !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

/* Silenciar Micrófono */
.btn-mute {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}

.btn-mute.muted {
  background: #fffbeb !important;
  border-color: #f59e0b !important;
  color: #b45309 !important;
}

/* Estado Bloqueado */
.btn-flat-locked,
.btn:disabled {
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
  border: 1px solid #cbd5e1 !important;
  cursor: not-allowed !important;
  opacity: 0.75;
  transform: none !important;
}

/* -------------------------------------------------------------
   FORMULARIOS Y CAMPOS DE ENTRADA
   ------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-body);
  letter-spacing: -0.01em;
}

.label-required::after {
  content: " *";
  color: var(--danger);
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  background: #ffffff;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3.5px rgba(2, 132, 199, 0.15);
}

input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

/* -------------------------------------------------------------
   INSIGNIAS (BADGES) Y STATUS LED
   ------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-success {
  background: var(--success-soft);
  color: #065f46;
  border: 1px solid var(--success-border);
}

.badge-warning {
  background: var(--warning-soft);
  color: #92400e;
  border: 1px solid var(--warning-border);
}

.badge-danger {
  background: var(--danger-soft);
  color: #991b1b;
  border: 1px solid var(--danger-border);
}

.badge-info {
  background: var(--cyan-soft);
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-primary {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-neutral {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

/* -------------------------------------------------------------
   ALERTAS Y CAJAS DE FEEDBACK
   ------------------------------------------------------------- */
.alert-box {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  line-height: 1.4;
}

.alert-info {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0369a1;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert-danger {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* -------------------------------------------------------------
   TARJETA HERO DE APARTAMENTO PROTEGIDO (RESIDENTE)
   ------------------------------------------------------------- */
.apt-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  box-shadow: var(--shadow-sm);
}

.apt-hero-info {
  display: flex;
  align-items: center;
  gap: 0.95rem;
}

.apt-hero-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.apt-hero-icon svg {
  width: 24px;
  height: 24px;
}

.apt-hero-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
}

.apt-hero-number {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-main);
}

/* -------------------------------------------------------------
   FILAS DE RESIDENTES (COHABITANTES)
   ------------------------------------------------------------- */
.resident-list-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 260px;
  overflow-y: auto;
}

.resident-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.resident-item-row:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.resident-item-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.resident-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 800;
  font-family: 'Space Grotesk', sans-serif;
}

.resident-item-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}

.btn-delete-item {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-delete-item:hover {
  background: #fee2e2;
  color: #dc2626;
}

.btn-delete-item svg {
  width: 18px;
  height: 18px;
}

/* -------------------------------------------------------------
   PANTALLA VISITANTE: SELECCIÓN DE MODO (VISITANTE / DOMICILIO)
   ------------------------------------------------------------- */
.choice-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.choice-card-btn {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.choice-card-btn:hover {
  border-color: var(--primary);
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -3px rgba(37, 99, 235, 0.12);
}

.choice-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.choice-icon svg {
  width: 26px;
  height: 26px;
  stroke-width: 2px;
}

.choice-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.choice-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.btn-back-mode {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
}

.btn-back-mode:hover {
  background: var(--primary-soft);
}

/* -------------------------------------------------------------
   PANTALLA DE LLAMADA WEBRTC ENTRANTE / ACTIVA
   ------------------------------------------------------------- */
.call-card {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-elevated);
}

.call-avatar {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 2px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  position: relative;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
  will-change: transform;
}

.call-avatar svg {
  width: 40px;
  height: 40px;
  stroke-width: 2px;
}

.call-avatar.ringing {
  animation: pulse-ring 1.8s infinite cubic-bezier(0.45, 0, 0.2, 1);
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 0 14px rgba(37, 99, 235, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.call-timer {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  display: inline-block;
}

/* Ondas de Audio (Sound Wave Visualizer) con contención estricta para evitar parpadeos */
.wave-container {
  display: none;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  gap: 5px;
  contain: strict;
}

.wave-container.active {
  display: flex;
  visibility: visible;
  height: 32px;
}

.wave-bar {
  width: 4px;
  background: linear-gradient(180deg, #0284c7 0%, #2563eb 100%);
  border-radius: 4px;
  height: 8px;
  animation: wavePulse 1.2s infinite ease-in-out;
  will-change: transform;
}

.wave-bar:nth-child(2) { animation-delay: 0.15s; height: 16px; }
.wave-bar:nth-child(3) { animation-delay: 0.3s; height: 26px; }
.wave-bar:nth-child(4) { animation-delay: 0.45s; height: 20px; }
.wave-bar:nth-child(5) { animation-delay: 0.6s; height: 12px; }
.wave-bar:nth-child(6) { animation-delay: 0.75s; height: 18px; }

@keyframes wavePulse {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1.2); }
}

/* -------------------------------------------------------------
   PANTALLA HERO: CONFIRMACIÓN "VOY EN CAMINO"
   ------------------------------------------------------------- */
.hero-on-my-way {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 50%, #047857 100%);
  border: 2px solid #34d399;
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
  box-shadow: 0 12px 36px rgba(5, 150, 105, 0.4);
  animation: heroPopIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  color: #ffffff;
}

@keyframes heroPopIn {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.hero-icon-badge {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  animation: pulse-ring-success 2s infinite ease-in-out;
  will-change: transform;
}

@keyframes pulse-ring-success {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 16px rgba(52, 211, 153, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero-on-my-way h2 {
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.hero-on-my-way p {
  font-size: 1rem;
  color: #d1fae5;
  margin: 0;
  line-height: 1.45;
  max-width: 380px;
}

.hero-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.hero-progress-fill {
  height: 100%;
  background: #34d399;
  width: 100%;
  border-radius: 4px;
  animation: progressDrain 3s linear forwards;
}

@keyframes progressDrain {
  from { width: 100%; }
  to { width: 0%; }
}

.btn-hero-close {
  background: #ffffff !important;
  color: #065f46 !important;
  font-weight: 800 !important;
  font-size: 0.95rem !important;
  padding: 0.85rem 1.5rem !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15) !important;
  border: none !important;
  cursor: pointer;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.15s ease;
}

.btn-hero-close:active {
  transform: scale(0.98);
}

/* -------------------------------------------------------------
   PWA PORTERÍA INTERNA: MARCACIÓN RÁPIDA
   ------------------------------------------------------------- */
.grid-apts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

@media (max-width: 480px) {
  .grid-apts {
    grid-template-columns: repeat(2, 1fr);
  }
}

.btn-apt-call {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.35rem 0.85rem;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  gap: 0.45rem;
  box-shadow: var(--shadow-sm);
}

.btn-apt-call:hover {
  border-color: var(--primary);
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.btn-apt-call:active {
  transform: scale(0.97);
}

.apt-num {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
}

.apt-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.apt-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.apt-icon svg {
  width: 20px;
  height: 20px;
}

/* -------------------------------------------------------------
   SELECTOR DE APARTAMENTOS (BOTONERA TÁCTIL VISITANTE / DOMICILIO)
   ------------------------------------------------------------- */
.apt-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0.4rem 0 0.85rem 0;
}

.btn-apt-select {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.5rem;
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: var(--shadow-sm);
  gap: 0.15rem;
}

.btn-apt-select:hover {
  border-color: var(--primary);
  background: #f8fafc;
  transform: translateY(-1px);
}

.btn-apt-select:active {
  transform: scale(0.96);
}

.btn-apt-select.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25), 0 4px 12px rgba(37, 99, 235, 0.12);
}

.btn-apt-select .apt-sel-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
}

.btn-apt-select.selected .apt-sel-num {
  color: var(--primary);
}

.btn-apt-select .apt-sel-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.btn-apt-select.selected .apt-sel-lbl {
  color: #1d4ed8;
}

/* -------------------------------------------------------------
   PANEL ADMIN: TABLAS Y ACCIONES
   ------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.stat-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0.25rem 0;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}


.btn-action {
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-action svg {
  width: 15px;
  height: 15px;
}

.btn-test-ring {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #bae6fd;
}
.btn-test-ring:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-qr {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}
.btn-qr:hover {
  background: #7c3aed;
  color: #ffffff;
}

.btn-edit {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #cbd5e1;
}
.btn-edit:hover {
  background: #e2e8f0;
}

.btn-delete {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.btn-delete:hover {
  background: #dc2626;
  color: #ffffff;
}

/* -------------------------------------------------------------
   MODALES Y DIÁLOGOS
   ------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.25rem;
}

.modal-sheet,
.modal-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-desc {
  font-size: 0.88rem;
  color: var(--text-body);
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* -------------------------------------------------------------
   REGISTRO DE ACTIVIDAD / TELEMETRÍA (LOG)
   ------------------------------------------------------------- */
.event-log {
  max-height: 180px;
  overflow-y: auto;
  font-family: 'Space Grotesk', monospace, sans-serif;
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.log-entry {
  padding: 0.4rem 0.65rem;
  background: #f8fafc;
  border-radius: 6px;
  border-left: 3px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  color: var(--text-body);
}

.log-time {
  color: var(--text-muted);
  font-size: 0.75rem;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

