:root {
	font-family: 'Nunito', system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  
	/* Paleta clara */
	--rtt-body-bg: #ffffff;
	--rtt-body-fg: #212529;
	--rtt-border: #dee2e6;
  
	/* Accentos */
	--rtt-primary: #1a4fff;
	--rtt-primary-contrast: #ffffff;
  
	/* Colores de estado */
	--rtt-chip-ok-bg:   #e8f9ee;
	--rtt-chip-ok-bd:   #9ad7a8;
	--rtt-chip-ok-fg:   #0f5132;
  
	--rtt-chip-warn-bg: #fff3cd;
	--rtt-chip-warn-bd: #ffecb5;
	--rtt-chip-warn-fg: #664d03;
  
	--rtt-chip-err-bg:  #f8d7da;
	--rtt-chip-err-bd:  #f5c2c7;
	--rtt-chip-err-fg:  #842029;
  }
  
  /* ---- Base ---- */
  body {
	background-color: var(--rtt-body-bg);
	color: var(--rtt-body-fg);
	font-family: 'Nunito', system-ui, sans-serif;
  }
  
  header.app-header {
	position: sticky;
	top: 0;
	z-index: 1030;
	background: #ffffff;
	color: var(--rtt-body-fg);
	padding: .75rem 1rem;
	display: flex;
	align-items: center;
	gap: .75rem;
	border-bottom: 1px solid var(--rtt-border);
	box-shadow: 0 2px 4px rgba(0,0,0,.05);
  }
  header.app-header .title { font-weight: 700; letter-spacing: 0.3px; }
  
  i.right3 { margin-right: 3px; }
  
  /* ---- Chips de estado ---- */
  .chip {
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	border: 1px solid var(--rtt-chip-warn-bd);
	background: var(--rtt-chip-warn-bg);
	color: var(--rtt-chip-warn-fg);
	white-space: nowrap;
	transition: all .25s ease-in-out;
  }
  .chip.ok   { background: var(--rtt-chip-ok-bg);   border-color: var(--rtt-chip-ok-bd);   color: var(--rtt-chip-ok-fg); }
  .chip.warn { background: var(--rtt-chip-warn-bg); border-color: var(--rtt-chip-warn-bd); color: var(--rtt-chip-warn-fg); }
  .chip.err  { background: var(--rtt-chip-err-bg);  border-color: var(--rtt-chip-err-bd);  color: var(--rtt-chip-err-fg); }
  
  /* Estados duplicados (header/paneles) */
  #agentStatus, #comStatus,
  #agentStatus_state, #agentStatus_state2,
  #comStatus_state, #comStatus_state2 {
	text-align: center;
	min-width: 200px;
	display: inline-block;
	padding: 4px 10px;
	border-radius: 999px;
	border: 1px solid var(--rtt-chip-ok-bd);
	background: var(--rtt-chip-ok-bg);
	color: var(--rtt-chip-ok-fg);
	font-size: 13px;
	font-weight: 600;
	transition: all .25s ease-in-out;
  }
  #agentStatus.warn, #comStatus.warn,
  #agentStatus_state.warn, #agentStatus_state2.warn,
  #comStatus_state.warn, #comStatus_state2.warn {
	background: var(--rtt-chip-warn-bg);
	border-color: var(--rtt-chip-warn-bd);
	color: var(--rtt-chip-warn-fg);
  }
  #agentStatus.err, #comStatus.err,
  #agentStatus_state.err, #agentStatus_state2.err,
  #comStatus_state.err, #comStatus_state2.err {
	background: var(--rtt-chip-err-bg);
	border-color: var(--rtt-chip-err-bd);
	color: var(--rtt-chip-err-fg);
  }
  
  /* ---- Contenedores principales ---- */
  #load-agent, #load-config { animation: fadeIn 1.5s; }
  #load-agent { height: calc(100vh - 150px); }
  .hidden { display: none !important; }
  
  /* ---- Tabs y estilos de card header ---- */
  .card-header .nav-tabs .nav-link { color: #6c757d; font-weight: normal; }
  .card-header .nav-tabs .nav-link.active { color: #000 !important; font-weight: bold; }
  .card-header .nav-tabs .nav-link:focus { box-shadow: none; }
  
  /* Alturas de tab/scroll */
  #leftPanel .tab-pane { height: calc(100vh - 239px); }
  .info-scrollable   { height: calc(100vh - 330px); overflow-y: auto; overflow-x: hidden; }
  .info-scrollable2  { height: calc(100vh - 393px); }
  
  /* Scrollbar fino */
  .info-scrollable::-webkit-scrollbar       { width: 6px; }
  .info-scrollable::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,.2); border-radius: 4px; }
  
  .list-group-item { padding: .35rem .75rem; border: none; border-bottom: none; }
  .fw-bold { font-weight: 800 !important; }
  
  /* Imagen hover en Info */
  #tab-info img { transition: transform 0.3s ease; }
  #tab-info img:hover { transform: scale(1.05); }
  
  /* ---- Textarea monitor ---- */
  #log {
	height: calc(100vh - 470px);
	width: 100%;
	resize: vertical;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	border: 1px solid var(--rtt-border);
	border-radius: 0.5rem;
  }
  @media (max-width: 992px) { #log { height: 300px; } }
  
  /* ---- Footer ---- */
  footer.app-footer {
	background-color: var(--rtt-body-bg);
	font-size: .75rem;
	color: #6c757d;
	padding: .3rem 1rem;
	text-align: center;
	border-top: 1px solid var(--rtt-border);
  }
  
  /* ---- Wifi table ---- */
  #tblWifis tbody tr.selected { 
	background-color: #e7f1ff !important; 
  }
  
  /* El card ocupado: ya no usamos opacity aquí */
  #wifiCard.busy { 
	position: relative; 
	pointer-events: none;  /* bloquea clicks por defecto */
  }
  
  /* Overlay que difumina y bloquea */
  #wifiCard .busy-overlay { 
	position: absolute; 
	inset: 0; 
	display: flex; 
	align-items: center; 
	justify-content: center; 
	background: rgba(255,255,255,.5); 
	z-index: 5;                  /* por debajo de la alerta */
  }
  
  /* Spinner igual que antes */
  .spinner_wifi { 
	width: 2.25rem; 
	height: 2.25rem; 
	border: .3rem solid #ddd; 
	border-top-color: #666; 
	border-radius: 50%; 
	animation: spi 1s linear infinite; 
  }
  
  @keyframes spi { 
	to { transform: rotate(360deg); } 
  }
  
  /* Valor clave-valor */
  .kv-val { 
	min-width: 6ch; 
	text-align: right; 
  }
  
  /* 👇 NUEVO: alerta por encima del overlay */
  #wifiAlert {
	position: relative;
	z-index: 10;          /* > 5 de la overlay */
	pointer-events: auto; /* permite seleccionar texto, etc. */
  }

  /* ---- Lista de WiFis escaneadas ---- */
.wifi-scan-list .list-group-item {
cursor: pointer;
}
.wifi-scan-list .list-group-item:hover {
background-color: #f1f5ff;
}
.wifi-signal-icon i {
font-size: 1.2rem;
}
/* Colores según intensidad */
.wifi-signal-strong { 	
border: 1px solid var(--rtt-chip-ok-bd);
background: var(--rtt-chip-ok-bg);
color: var(--rtt-chip-ok-fg); 
}
.wifi-signal-medium { 	
background: var(--rtt-chip-warn-bg);
border: 1px solid var(--rtt-chip-warn-bd);
color: var(--rtt-chip-warn-fg);
}
.wifi-signal-weak {
background: var(--rtt-chip-err-bg);
border: 1px solid var(--rtt-chip-err-bd);
color: var(--rtt-chip-err-fg);
}

/* Contenedor badge para el icono WiFi */
.wifi-badge {
padding: 4px 8px;
border-radius: 12px;
display: inline-flex;
align-items: center;
justify-content: center;
}

#wifiScanCard .card-body {
max-height: 100px;       /* altura máxima */
overflow-y: auto;         /* scroll vertical */
overflow-x: hidden;       /* sin scroll horizontal */
}

  /* ---- Gate ---- */
  #gateSection {}
  .gate-card { width: 100%; max-width: 760px; border-radius: 10px; display: flex; flex-direction: column; justify-content: start !important; }
  #hashInput::placeholder { color: #e74a3b; opacity: 1; }
  .gate-card .card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
  #gateForm input { text-align: center; }
  #gateAlert { max-width: 400px; margin: 15px auto 0 auto; }
  
  /* ---- Layout flexible Left/Right + Rail ---- */
  #load-config.nowrap { flex-wrap: nowrap !important; } /* activado cuando el rail está colapsado */
  #leftPanel, #rightPanel { min-width: 0; transition: max-width .25s ease, flex .25s ease, width .25s ease; position: relative; }
  
  /* Panel izquierdo ocupa el resto cuando right está colapsado */
  #leftPanel.fill { flex: 1 1 auto !important; max-width: none !important; width: auto !important; }
  
  /* ====== RIGHT PANEL: ESTADO COLAPSADO (RAIL) ====== */
  /*  ✅ CAMBIO SOLICITADO: rail a 40px y sin padding */
  #rightPanel.collapsed {
	max-width: 40px !important;   /* antes 56px */
	flex: 0 0 40px !important;    /* antes 56px */
	width: 40px !important;       /* antes 56px */
	align-self: stretch;
	padding: 0 !important;        /* sin padding en rail */
	overflow: hidden;             /* evita scroll interno en rail */
	/* opcionales:
	background: #f8f9fa;
	border-left: 1px solid #ddd;
	*/
  }
  
  /* En colapsado, mostrar SOLO header del primer card y ocultar el resto de tarjetas */
  #rightPanel.collapsed .card { margin-bottom: 0 !important; }
  #rightPanel.collapsed .card:not(:first-child) { display: none !important; }
  #rightPanel.collapsed .card:first-child .card-body,
  #rightPanel.collapsed .card:first-child .card-footer { display: none !important; }
  /* Oculta el texto "Monitor" pero deja el icono/botón */
  #rightPanel.collapsed .card:first-child .card-header .header-text { display: none !important; }
  /* Header compacto centrado para el icono */
  #rightPanel.collapsed .card:first-child .card-header {
	display: flex; align-items: center; justify-content: center; padding: .5rem;
  }
  #rightPanel.collapsed #toggleRight { margin: 0; }
  
  /* ====== MODO MÓVIL: SIEMPRE EXPANDIDO ====== */
  @media (max-width: 991.98px) {
	/* Volvemos a permitir wrap en la fila */
	#load-config.nowrap { flex-wrap: wrap !important; }
  
	/* Columnas al 100% apiladas */
	#leftPanel.fill { flex: 0 0 100% !important; max-width: 100% !important; width: 100% !important; }
  
	/* Ignorar colapsado en móvil: right ocupa 100% y muestra todo */
	#rightPanel.collapsed {
	  max-width: none !important;
	  flex: 0 0 100% !important;
	  width: 100% !important;
	  align-self: auto !important;
	  padding: 1rem !important;       /* restaura padding */
	  /* opcional:
	  background: transparent !important;
	  border-left: none !important;
	  */
	}
	#rightPanel.collapsed .card:not(:first-child) { display: block !important; }
	#rightPanel.collapsed .card:first-child .card-body,
	#rightPanel.collapsed .card:first-child .card-footer { display: block !important; }
	#rightPanel.collapsed .card:first-child .card-header .header-text { display: inline !important; }
	#rightPanel.collapsed .card:first-child .card-header { justify-content: flex-start; }
  }
  
  /* ===== Fix móvil: pantalla completa para Gate y limpieza de alturas ===== */
  @media (max-width: 768px) {
	.container-fluid, .tab-content,
	main.container-fluid, .container-fluid.my-3 { padding: 0 !important; margin: 0 !important; }
  
	#gateSection { padding: 0 !important; margin: 0 !important; }
	.gate-card {
	  width: 100% !important; max-width: 100% !important; height: 100% !important;
	  margin: 0 !important; border-radius: 0 !important; box-shadow: none !important; justify-content: start !important;
	}
	.gate-card .card-header, .gate-card .card-footer { border-radius: 0 !important; }
	.gate-card .card-body { flex: 1; padding: 1.25rem !important; display: flex; flex-direction: column; justify-content: center; }
  
	#hashInput { max-width: 100% !important; width: 100% !important; }
	#gateAlert { max-width: 100% !important; margin-left: 0 !important; margin-right: 0 !important; }
  
	.card-header.itc-manager .nav-tabs .nav-link { padding: .5rem .75rem !important; display: flex; align-items: center; justify-content: center; font-size: 0; }
	.card-header.itc-manager .nav-tabs .nav-link i { font-size: 1.3rem; margin-right: 0 !important; }
  
	header.app-header i.fab.fa-usb, #openLicenseModal { display: none !important; }
	header.app-header { padding: .5rem .75rem !important; }
	header.app-header .title { font-size: 1rem; }
  
	/* Chips compactos en header móvil */
	#agentStatus, #comStatus {
	  font-size: 0 !important;
	  width: 14px; height: 14px; border-radius: 50%; padding: 0; min-width: 14px; margin: 0 4px !important;
	}
  
	/* Limpieza de alturas fijas y scrolls internos */
	.card, .card.h-100, #leftPanel, #rightPanel, #leftPanel .card, #rightPanel .card { height: auto !important; }
	#leftPanel .tab-pane, .tab-content, .tab-pane { height: auto !important; min-height: 0 !important; overflow: visible !important; }
	.info-scrollable, .info-scrollable2 { height: auto !important; max-height: none !important; overflow: visible !important; }
  
	/* Columnas al 100% */
	.row.g-3 > [class*="col-"] { flex: 0 0 100% !important; max-width: 100% !important; }
  
	/* Imágenes fluidas */
	#tab-info img { max-width: 100%; height: auto; }
  }
  
/* --- Estado de actividad del Monitor --- */
#toggleRight.active i {
color: #4E73DF !important; /* rojo Bootstrap danger */
animation: pulseRed 1.2s ease-in-out infinite;
}

@keyframes pulseRed {
0%, 100% { opacity: 1; transform: scale(1); }
50%      { opacity: .6; transform: scale(1.15); }
}
  
.sensor-3d-wrapper {
width: 100%;
height: 300px;       /* o 300px, lo que quieras fijo */
position: relative;
}

#sensorCanvas {
width: 100%;
height: 100%;
display: block;
}
  
.grecaptcha-badge {
visibility: hidden;
}

/* ---- Sync table busy overlay (igual que wifiCard) ---- */
#syncCard.busy {
position: relative;
pointer-events: none; /* bloquea clicks mientras carga */
}

/* Overlay centrado */
#syncCard .busy-overlay {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255,255,255,.5);
z-index: 5;
}

/* Por si quieres que alertas/botones queden por encima del overlay */
#syncTableAlert {
position: relative;
z-index: 10;
pointer-events: auto;
}

/* ---- Sync table ---- */
#tblSync tbody tr.selected {
background-color: #e7f1ff !important;
}
  