/* ==========================================================================
   NTRX CONTROL — SISTEMA DE DISEÑO v2.0
   Paleta: Navy oscuro (#0d1117), Azul eléctrico (#1a8cff), Cian (#00d4ff)
   Fuentes: Outfit (UI), Share Tech Mono (telemetría), Inter (Formularios Técnicos)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   NSF — SISTEMA DE DISEÑO INSPIRADO EN NET SOFT PRO
   Fondo claro (#f1f5f9) + Sidebar oscuro navy + Barra estado + Footer
   ========================================================================== */

/* ─── BARRA DE ESTADO SECUNDARIA ─── */
.status-bar-secondary {
    display: flex;
    align-items: center;
    height: 38px;
    background: #292C3E;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 0 16px;
    gap: 0;
    flex-shrink: 0;
    overflow: hidden;
}
.sb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    white-space: nowrap;
}
.sb-separator {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sb-icon {
    font-size: 11px;
    color: #4a5568;
}
.sb-label {
    font-size: 9px;
    font-weight: 700;
    color: #4a5568;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
.sb-value {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    font-family: var(--font-mono);
}
.sb-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.3);
}
.sb-pill[data-status="ok"] {
    background: rgba(34,197,94,0.15);
    color: #4ade80;
    border-color: rgba(34,197,94,0.3);
}
.sb-pill[data-status="connected"] {
    background: rgba(34,197,94,0.15);
    color: #4ade80;
    border-color: rgba(34,197,94,0.3);
}
.sb-pill[data-status="inactive"] {
    background: rgba(251,191,36,0.12);
    color: #fbbf24;
    border-color: rgba(251,191,36,0.3);
}
.sb-pill[data-status="disconnected"] {
    background: rgba(239,68,68,0.12);
    color: #f87171;
    border-color: rgba(239,68,68,0.25);
}

/* ─── FOOTER INFERIOR FIJO ─── */
.nsf-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 30px;
    background: #0f408e; /* Blue footer matching image */
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 0 16px;
    flex-shrink: 0;
    font-size: 11px;
    color: #e0f2fe;
    gap: 16px;
    font-family: 'Inter', sans-serif;
}
.nsf-footer-left,
.nsf-footer-center,
.nsf-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.nsf-footer-center { flex: 1; justify-content: center; }
.nsf-footer-sep { color: rgba(255,255,255,0.3); font-size: 10px; }
.nsf-footer-bar strong { color: #ffffff; font-weight: 600; }
.nsf-footer-sys-ok {
    color: #86efac;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}
.nsf-footer-sys-ok i { font-size: 10px; }

/* ─── LAYOUT PRINCIPAL NSF (3 columnas: sidebar dark + main light + sidebar info) ─── */
.nsf-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f4f6f9; /* fondo claro tipo NET SOFT PRO */
    font-family: 'Inter', sans-serif;
}

/* Panel de contenido principal - FONDO CLARO */
.nsf-main {
    flex: 1;
    background: #f4f6f9;
    overflow-y: auto;
    min-width: 0;
}

/* Panel lateral derecho - INFO OSCURO */
.nsf-sidebar {
    width: 240px;
    min-width: 240px;
    background: #0d111a;
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.nsf-sidebar-header {
    padding: 14px 16px 10px;
    font-size: 10px;
    font-weight: 800;
    color: #4a5568;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.2);
}
.nsf-sidebar-body {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nsf-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.15);
}
.nsf-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
}
.nsf-info-label {
    font-size: 11px;
    color: #4a5568;
    font-weight: 500;
    flex-shrink: 0;
}
.nsf-info-val {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    font-family: var(--font-mono);
    text-align: right;
    word-break: break-all;
}
.nsf-divider {
    height: 1px;
    background: rgba(255,255,255,0.05);
    margin: 6px 0;
}

/* ─── HERO BANNER (Inicio) ─── */
.nsf-hero {
    position: relative;
    height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}
.nsf-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover !important;
    background-position: center !important;
}
.nsf-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(10,13,20,0.85) 0%, rgba(10,13,20,0.5) 60%, rgba(10,13,20,0.2) 100%);
}
.nsf-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    height: 100%;
}
.nsf-hero-logo {
    height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 0 16px rgba(26,140,255,0.5));
}
.nsf-hero-title {
    font-size: 20px;
    font-weight: 800;
    color: #f0f4ff;
    margin: 0 0 4px 0;
    letter-spacing: 0.3px;
}
.nsf-hero-sub {
    font-size: 11px;
    color: #00d4ff;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.nsf-hero-stats {
    position: absolute;
    bottom: 14px;
    right: 20px;
    z-index: 2;
    display: flex;
    gap: 8px;
}
.nsf-stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(10,13,20,0.75);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
    color: #94a3b8;
    backdrop-filter: blur(4px);
}
.nsf-stat-chip i { color: #1a8cff; font-size: 10px; }

/* ─── SECCIONES DE CONTENIDO ─── */
.nsf-section {
    margin: 0;
    padding: 20px 24px;
    background: #f1f5f9;
}
.nsf-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
}
.nsf-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.nsf-section-title i {
    color: #1a8cff;
    font-size: 16px;
}
.nsf-section-title h2 {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

/* ─── TABLA NSF ─── */
.nsf-table-wrap {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.nsf-table {
    width: 100%;
    border-collapse: collapse;
}
.nsf-table thead tr {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}
.nsf-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.nsf-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}
.nsf-table tbody tr:last-child { border-bottom: none; }
.nsf-table tbody tr:hover { background: #f8fafc; }
.nsf-table td {
    padding: 11px 14px;
    font-size: 13px;
    color: #334155;
    vertical-align: middle;
}
.nsf-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    gap: 12px;
    color: #94a3b8;
}
.nsf-empty-state i { font-size: 32px; color: #cbd5e1; }
.nsf-empty-state p { font-size: 13px; color: #64748b; }

/* ─── STEPPER WIZARD ─── */
.nsf-stepper {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    gap: 0;
    flex-shrink: 0;
}
.nsf-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}
.nsf-step-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.nsf-step.active .nsf-step-circle {
    background: #1a8cff;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(26,140,255,0.2);
}
.nsf-step.active { color: #1e293b; }
.nsf-step.done .nsf-step-circle {
    background: #22c55e;
    color: #ffffff;
}
.nsf-step-line {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin: 0 12px;
    min-width: 24px;
}

/* ─── FOOTER DE ACCIONES (plantillas) ─── */
.nsf-footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--bg-header, #0f1420);
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    gap: 16px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.18);
}
.nsf-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(26,140,255,0.13);
    color: #60a5fa;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid rgba(26,140,255,0.25);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.2px;
}

/* Input de nombre de sesión dentro del footer oscuro */
.nsf-footer-actions .nsf-input {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #e2e8f0;
    font-size: 13px;
    border-radius: 7px;
    padding: 7px 12px;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.nsf-footer-actions .nsf-input:focus {
    border-color: #1a8cff;
    background: rgba(26,140,255,0.08);
    box-shadow: 0 0 0 3px rgba(26,140,255,0.15);
    color: #f1f5f9;
}
.nsf-footer-actions .nsf-input::placeholder { color: #64748b; }

/* Label de sesión en footer oscuro */
.nsf-footer-actions label {
    color: #94a3b8 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* Botón INICIAR MONITOREO — verde prominente */
.nsf-footer-actions .nsf-btn-action {
    background: linear-gradient(135deg, #16a34a, #15803d);
    border: none;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 9px 22px;
    border-radius: 8px;
    letter-spacing: 0.4px;
    box-shadow: 0 2px 10px rgba(22,163,74,0.30);
    transition: background 0.18s, box-shadow 0.18s, transform 0.1s;
}
.nsf-footer-actions .nsf-btn-action:hover {
    background: linear-gradient(135deg, #15803d, #166534);
    box-shadow: 0 4px 16px rgba(22,163,74,0.45);
    transform: translateY(-1px);
}
.nsf-footer-actions .nsf-btn-action:active {
    transform: translateY(0);
    box-shadow: 0 1px 6px rgba(22,163,74,0.25);
}

/* ─── FORMULARIO NSF ─── */
.nsf-page-title-bar {
    padding: 20px 24px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}
.nsf-page-title {
    font-size: 17px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 4px 0;
}
.nsf-page-sub {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}
.nsf-form-section {
    margin: 16px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.nsf-form-section-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.nsf-form-icon {
    font-size: 18px;
    color: #1a8cff;
    margin-top: 2px;
    flex-shrink: 0;
}
.nsf-form-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1b62cc;
    text-transform: uppercase;
    margin: 0 0 3px 0;
}
.nsf-form-desc {
    font-size: 11px;
    color: #64748b;
    margin: 0;
}
.nsf-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 18px 20px;
}
.nsf-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.nsf-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nsf-required { color: #ef4444; }
.nsf-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.nsf-input:focus {
    border-color: #1b62cc;
    box-shadow: 0 0 0 3px rgba(27,98,204,0.12);
    background: #ffffff;
}
.nsf-input::placeholder { color: #9ca3af; }
.nsf-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    color: #1e293b;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    appearance: auto;
    transition: border-color 0.15s;
}
.nsf-select:focus { 
    border-color: #1b62cc; 
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(27,98,204,0.12);
}
.nsf-help {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}
.nsf-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}
.nsf-check-label input[type="checkbox"] { accent-color: #1a8cff; }
.nsf-form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 16px 20px 20px;
}

/* ─── BOTONES NSF ─── */
.nsf-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: #1b62cc;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
    white-space: nowrap;
}
.nsf-btn-primary:hover {
    background: #1755b3;
    box-shadow: 0 4px 12px rgba(27,98,204,0.35);
    transform: translateY(-1px);
}
.nsf-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.nsf-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.nsf-btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: #1b62cc;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    white-space: nowrap;
}
.nsf-btn-action:hover {
    background: #1755b3;
    box-shadow: 0 6px 16px rgba(27,98,204,0.3);
    transform: translateY(-1px);
}

/* ─── AJUSTE DEL APP-CONTENT PARA BARRA Y FOOTER ─── */
.app-content {
    /* La altura ya la maneja flex; solo aseguramos que los tabs respeten el nuevo espacio */
}

/* ─── TAB-HOME sin padding para usar nsf-layout completo ─── */
#tab-home.active,
#tab-plantillas.active,
#tab-config.active {
    padding: 0;
    overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   MÓDULO LAS — Grabación y Visualización
   ══════════════════════════════════════════════════════════ */

/* ─── Grid de estado de grabación ─── */
.las-status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 4px;
}
.las-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
}
.las-stat-label {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}
.las-stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── Punto parpadeante de grabación ─── */
.las-rec-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.las-rec-dot.inactive { background: #94a3b8; }
.las-rec-dot.active {
    background: #ef4444;
    animation: las-blink 1s ease-in-out infinite;
}
@keyframes las-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.2; }
}

/* ─── Drop zone para carga de archivos ─── */
.las-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.las-dropzone:hover,
.las-dropzone.dragover {
    border-color: #1b62cc;
    background: #eff6ff;
}
.las-dropzone.dragover i { color: #1b62cc !important; }

/* ─── Chips de curvas ─── */
.las-curve-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.las-curve-chip.selected {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1b62cc;
}
.las-curve-chip .chip-swatch {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ─── Columnas del log plot ─── */
.las-chart-col {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}
.las-chart-col-header {
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #334155;
}
.las-chart-col canvas { width: 100% !important; flex: 1; }

/* ─── Tabs LAS también sin padding ─── */
#tab-las-record.active,
#tab-las-viewer.active { padding: 0; overflow: hidden; }



/* Ajuste del ch-channels-grid dentro del layout NSF (fondo claro) */
.nsf-main .ch-channels-grid {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

/* Ajustar canal items para fondo claro */
.nsf-main .ch-channel-item {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}
.nsf-main .ch-channel-item:hover { background: #f1f5f9; border-color: #bfdbfe; }
.nsf-main .ch-channel-item.ch-active { background: #eff6ff; border-color: #93c5fd; }
.nsf-main .ch-channel-name { color: #1e293b; }
.nsf-main .ch-opt-btn { background: #f1f5f9; border-color: #d1d5db; color: #374151; }
.nsf-main .ch-opt-btn.active { background: #dbeafe; border-color: #1a8cff; color: #1a8cff; }

/* ─── Código WITS en la lista de canales ─── */
.ch-wits-code {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #1b62cc;
    background: rgba(27, 98, 204, 0.10);
    border: 1px solid rgba(27, 98, 204, 0.20);
    border-radius: 4px;
    padding: 1px 5px;
    margin-right: 6px;
    letter-spacing: 0.3px;
    vertical-align: middle;
    flex-shrink: 0;
}
.nsf-main .ch-wits-code {
    color: #1b62cc;
    background: rgba(27, 98, 204, 0.09);
    border-color: rgba(27, 98, 204, 0.20);
}

/* Panel nuevo-canal dentro de NSF — ahora usa .nsf-form-section, sin sobrescrituras necesarias */
.nsf-main #panel-new-channel .nsf-input,
.nsf-main #panel-new-channel input[type="text"] {
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #1e293b;
    font-family: 'Inter', sans-serif;
}
.nsf-main #panel-new-channel input::placeholder { color: #9ca3af; }


:root {
    --bg-deepnav:   #0a0d14;
    --bg-sidebar:   #0d111a;
    --bg-header:    #0f1420;
    --bg-main:      #111827;
    --bg-card:      #161d2e;
    --bg-card-alt:  #1a2236;
    --bg-input:     #0d111a;
    --bg-table-row: #141c2b;
    --bg-table-hover: #1c2540;

    --border:       rgba(255,255,255,0.07);
    --border-active:rgba(26,140,255,0.45);

    --blue:         #1a8cff;
    --cyan:         #00d4ff;
    --green:        #22c55e;
    --orange:       #f97316;
    --red:          #ef4444;
    --yellow:       #fbbf24;
    --purple:       #8b5cf6;

    --text-primary: #f0f4ff;
    --text-secondary:#8898aa;
    --text-muted:   #4a5568;
    --text-accent:  #00d4ff;

    --font-ui:      'Outfit', sans-serif;
    --font-mono:    'Share Tech Mono', monospace;

    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    14px;
    --sidebar-w:    200px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    overflow: hidden;
    background: #f1f5f9;
    color: #1e293b;
    font-family: var(--font-ui);
    font-size: 14px;
}

/* ---- Custom scrollbars ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.main-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-width: 0;
}

/* ==========================================================================
   SIDEBAR DE NAVEGACIÓN
   ========================================================================== */
.app-sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: #00609C; /* MySQL Blue */
    border-right: none;
    box-shadow: 2px 0 5px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: 10;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Logo en el tope */
.logo-area {
    padding: 24px 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: padding 0.25s;
}

.logo-text {
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 28px;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(255,255,255,0.2);
    margin-bottom: 4px;
}

.logo-subtext {
    font-size: 9px;
    color: rgba(255,255,255,0.7);
    text-align: center;
    letter-spacing: 1.5px;
    line-height: 1.2;
}

/* Navegación */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    transition: padding 0.25s, align-items 0.25s;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #ffffff;
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s, width 0.25s, height 0.25s, padding 0.25s, justify-content 0.25s;
}

.nav-btn i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    transition: font-size 0.25s;
}

.nav-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}

.nav-btn.active {
    background: #004B7A; /* Darker blue */
    color: #ffffff;
    font-weight: 700;
    border-right: none;
}

/* Sidebar Colapsada (Solo iconos) */
.app-sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}
.app-sidebar.collapsed .logo-area {
    padding: 16px 4px;
}
.app-sidebar.collapsed .logo-text,
.app-sidebar.collapsed .logo-subtext {
    display: none;
}
.app-sidebar.collapsed .logo-area::after {
    content: 'Nx';
    font-family: var(--font-ui);
    font-weight: 800;
    font-size: 18px;
    color: #ffffff;
    letter-spacing: 0.5px;
}
.app-sidebar.collapsed .sidebar-nav {
    padding: 12px 4px;
    align-items: center;
}
.app-sidebar.collapsed .nav-btn {
    padding: 10px 0;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    gap: 0;
}
.app-sidebar.collapsed .nav-btn span {
    display: none;
}
.app-sidebar.collapsed .nav-btn i {
    font-size: 18px;
    margin: 0;
    width: auto;
}
.app-sidebar.collapsed .sidebar-footer {
    display: none;
}

.badge-red {
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
    box-shadow: 0 0 8px rgba(239,68,68,0.5);
}

/* Footer del sidebar */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 12px;
    background: transparent;
    color: #ffffff;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.status-lbl { color: rgba(255,255,255,0.7); }

.status-val.online {
    color: var(--green);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    text-shadow: 0 0 8px rgba(34,197,94,0.4);
}

.status-val.online i { font-size: 10px; }

.timezone-val {
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 4px;
}

.last-update {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    color: var(--text-muted);
}
.last-update .val {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    margin-top: 2px;
}

/* ==========================================================================
   HEADER SUPERIOR
   ========================================================================== */
/* == APP HEADER: estilo imagen de referencia == */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 48px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Badge "SNP" verde */
.snp-badge {
    background: #14a85a;
    color: #fff;
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    padding: 3px 9px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Título del pozo */
.well-title-container {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
}
.well-title-text {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.well-title-controls { display: flex; align-items: center; position: relative; }
.well-select-hidden {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0; left: 0;
    cursor: pointer;
    font-size: 14px;
}
.well-title-arrow { font-size: 9px; color: #666; pointer-events: none; }

/* Legacy selector */
.well-selector-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 5px 14px 5px 12px;
    position: relative;
}
.well-select {
    appearance: none;
    background: transparent;
    border: none;
    color: #1e293b;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    padding-right: 4px;
}
.well-select option { background: var(--bg-sidebar); }
.select-arrow { font-size: 9px; color: var(--text-secondary); pointer-events: none; }
.indicator-dot { font-size: 9px; }
.indicator-dot.active { color: var(--green); text-shadow: 0 0 5px var(--green); }

/* Badge de conexión */
.connection-badge-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 4px 11px;
    font-size: 11px;
    color: #475569;
}

/* == ZONA CENTRAL DE ICONOS == */
.header-center-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
}

/* Botones de icono del header (pequeños) */
.hdr-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    padding: 0;
}
.hdr-icon-btn:hover {
    background: #f8fafc;
    color: #1b62cc;
    border-color: #cbd5e1;
}

/* Píldora central bloqueada */
.header-well-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(26,140,255,0.07);
    border: 1px solid rgba(26,140,255,0.25);
    border-radius: 20px;
    padding: 4px 14px;
    color: #1a8cff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    margin: 0 8px;
}

/* Select de historial */
.hdr-select {
    appearance: none;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #1e293b;
    font-family: var(--font-ui);
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
    outline: none;
}
.hdr-select option { background: #ffffff; color: #1e293b; }

/* Derecha del header */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    color: #777;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.header-icon-btn:hover { background: rgba(255,255,255,0.09); color: #ddd; }

/* Legacy */
.header-center { flex: 1; display: flex; justify-content: center; }
.gateway-ip-badge {
    background: rgba(26,140,255,0.05);
    border: 1px solid rgba(26,140,255,0.2);
    color: var(--blue);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.gateway-ip-badge:hover { background: rgba(26,140,255,0.1); box-shadow: 0 0 10px rgba(26,140,255,0.2); }
.notif-btn, .help-btn {
    position: relative;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
}
.notif-btn:hover, .help-btn:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.08);
}
.notif-btn .badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-header);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

/* ==========================================================================
   TAB: INICIO (HOME) - FONDO CON DIFUMINADO
   ========================================================================== */
/* ==========================================================================
   TAB: INICIO (HOME) - SPLIT LAYOUT PREMIUM
   ========================================================================== */
#tab-home {
    position: relative;
    z-index: 1;
    overflow: hidden;
    background: var(--bg-main);
}

.home-split-layout {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 48px);
}

/* Panel izquierdo con la imagen limpia de fondo */
.home-hero-panel {
    flex: 1.2;
    position: relative;
    background: url('bg-home.jpg') center/cover no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px;
    border-right: 1px solid var(--border);
}

.home-hero-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(10, 13, 20, 0.4) 0%, rgba(17, 24, 39, 0.8) 100%);
    z-index: 1;
}

.home-hero-logo-top {
    position: relative;
    z-index: 2;
    align-self: flex-start;
}

.home-hero-logo-img {
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(26,140,255,0.45));
}

.home-hero-bottom-gradient {
    position: relative;
    z-index: 2;
}

.home-hero-tagline {
    font-family: var(--font-ui);
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.home-hero-subtitle {
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--text-accent);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Panel derecho con plantillas y el boton nuevo integrado */
.home-templates-panel {
    flex: 1.5;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    padding: 40px;
    overflow: hidden;
}

.home-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.home-panel-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
}

.home-panel-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.home-btn-new-template {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(26,140,255,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
}

.home-btn-new-template:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,140,255,0.4);
}

.home-panel-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.home-templates-scroll {
    flex: 1;
    overflow-y: auto;
}

.home-templates-table {
    width: 100%;
}

.hero-logo {
    display: flex;
    flex-direction: column;
}
.user-info {
    display: flex;
    flex-direction: column;
}
.u-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.u-role { font-size: 11px; color: var(--text-secondary); }

#status-led {
    color: var(--text-muted);
    font-size: 9px;
}
#status-led.connected { color: var(--green); }
#status-led.listening { color: var(--yellow); animation: blink 1s infinite alternate; }
#status-led.connecting { color: var(--blue); animation: blink 0.5s infinite alternate; }
#status-led.disconnected { color: var(--red); }

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.15s;
}

.header-icon-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-active);
    background: rgba(26,140,255,0.08);
}

/* ==========================================================================
   ÁREA DE CONTENIDO PRINCIPAL
   ========================================================================== */
.app-content {
    flex: 1;
    overflow: hidden;
    padding: 0;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
}

/* Pestañas que sí usan padding/scroll */
.tab-pane {
    display: none;
    animation: fade-in 0.2s ease;
    padding: 28px;
    overflow-y: auto;
}

.tab-pane.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;  /* permite que los hijos shrink correctamente */
}

/* El tab de canvas ocupa TODO el alto disponible sin padding ni scroll general */
#tab-canvas.active {
    overflow: hidden;
    padding: 0;
}

/* ==========================================================================
   PESTAÑA HOME
   ========================================================================== */
.welcome-section {
    margin-bottom: 28px;
}

.welcome-section h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.welcome-section .subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Tarjeta de acción (Nueva Plantilla) */
.quick-action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid rgba(26,140,255,0.2);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 32px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.quick-action-card:hover {
    background: var(--bg-card-alt);
    border-color: rgba(26,140,255,0.5);
    transform: translateY(-1px);
}

.action-left {
    display: flex;
    align-items: center;
    gap: 18px;
}

.action-icon-wrapper {
    position: relative;
    width: 48px;
    height: 48px;
    background: rgba(26,140,255,0.1);
    border: 1px solid rgba(26,140,255,0.25);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    font-size: 20px;
}

.badge-plus {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: var(--blue);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.action-text h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.action-text p {
    font-size: 12px;
    color: var(--text-secondary);
}

.action-arrow {
    color: var(--blue);
    font-size: 16px;
}

/* Sección de Plantillas Recientes */
.templates-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.templates-table {
    width: 100%;
    border-collapse: collapse;
}

.templates-table thead tr {
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
}

.templates-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.templates-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}

.templates-table tbody tr:last-child { border-bottom: none; }

.templates-table tbody tr:hover {
    background: var(--bg-table-hover);
}

.templates-table td {
    padding: 13px 16px;
    font-size: 13.5px;
    color: var(--text-primary);
    vertical-align: middle;
}

/* Celda de nombre con ícono */
.template-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.template-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    padding: 7px;
}

.template-icon.bg-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }
.template-icon.bg-green  { background: rgba(34,197,94,0.12); color: #4ade80; }
.template-icon.bg-orange { background: rgba(249,115,22,0.12); color: #fb923c; }
.template-icon.bg-blue   { background: rgba(26,140,255,0.12); color: #60a5fa; }

.t-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}

.t-badge {
    display: inline-block;
    background: rgba(26,140,255,0.15);
    color: var(--blue);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

.t-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 1px;
}

/* Acciones de tabla */
.btn-table-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-ui);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-table-action:hover {
    background: rgba(26,140,255,0.1);
    border-color: var(--border-active);
    color: var(--blue);
}

.btn-table-more {
    padding: 5px 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    border-radius: 4px;
    transition: color 0.15s;
}

.btn-table-more:hover { color: var(--text-primary); }

/* Estado vacío de la tabla */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.empty-state i {
    font-size: 36px;
    color: var(--border-active);
    opacity: 0.5;
}

.empty-state p {
    font-size: 13.5px;
    text-align: center;
    line-height: 1.5;
}

.empty-state strong {
    color: var(--blue);
}


/* ==========================================================================
   PESTAÑA DATA TERMINAL (GRID)
   ========================================================================== */
.grid-controls, .canvas-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.grid-controls h2, .canvas-controls h2 {
    font-size: 18px;
    font-weight: 600;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.controls-right label { color: var(--text-secondary); }

.controls-right select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 13px;
    padding: 5px 10px;
}

.update-rate { font-size: 12px; }

/* Grid de tarjetas */
.digital-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.grid-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 116px;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, border-color 0.15s;
}

/* Barra de color en la parte superior */
.grid-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.grid-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.12);
}

.card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.card-value {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
    margin-top: auto;
}

.card-unit {
    font-size: 11px;
    color: var(--text-muted);
}

/* Colores por canal */
#card-Hole_Depth::before { background: var(--yellow); }
#card-Hole_Depth .card-value { color: var(--yellow); }

#card-Bit_Depth::before { background: #fffb55; }
#card-Bit_Depth .card-value { color: #fffb55; }

#card-BPOS::before { background: var(--green); }
#card-BPOS .card-value { color: var(--green); }

#card-WOB::before { background: var(--cyan); }
#card-WOB .card-value { color: var(--cyan); }

#card-HKLA::before { background: #e0e0e0; }
#card-HKLA .card-value { color: #e0e0e0; }

#card-RPMC::before { background: var(--yellow); }
#card-RPMC .card-value { color: var(--yellow); }
#card-RPMC {
    height: auto !important;
    min-height: 220px !important;
    overflow: visible !important;
    cursor: default !important;
}

.gauge-wrapper {
  width: 100%;
  max-width: 260px;
  background: #0b1a2a;
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  margin: 0 auto;
}

.gauge-label {
  margin-top: 10px;
  color: #ddd;
  font-weight: bold;
  font-size: 16px;
}

#card-TQA::before { background: #d946ef; }
#card-TQA .card-value { color: #d946ef; }

#card-SPPA::before { background: var(--orange); }
#card-SPPA .card-value { color: var(--orange); }

#card-ROP::before { background: var(--green); }
#card-ROP .card-value { color: var(--green); }

#card-GASA::before { background: var(--red); }
#card-GASA .card-value { color: var(--red); }

#card-H2S::before { background: var(--purple); }
#card-H2S .card-value { color: #c084fc; }

#card-MDIA::before { background: var(--cyan); }
#card-MDOA::before { background: var(--blue); }
#card-MFIA::before { background: var(--green); }
#card-MFOA::before { background: var(--orange); }
#card-ACTC::before { background: #00e5b8; }
#card-ACTC .card-value { color: #00e5b8; }

.grid-card.main-highlight {
    background: rgba(251,191,36,0.03);
}

/* ==========================================================================
   PESTAÑA CANVAS (REGISTRO VERTICAL)
   ========================================================================== */
.log-headers {
    display: flex;
    background: rgba(0,0,0,0.25);
    border-bottom: 1px solid var(--border);
    min-height: 56px;
    flex-shrink: 0;
}

.track-header {
    flex: 1;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6px 8px;
    text-align: center;
}

.track-header:last-child { border-right: none; }

.header-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.4px;
}

.header-channels {
    display: flex;
    justify-content: space-around;
    gap: 4px;
    font-size: 9px;
    font-weight: 500;
    flex-wrap: wrap;
}

.canvas-viewport {
    flex: 1;
    overflow-y: auto;
    background: #060a10;
}

#vertical-log-canvas {
    display: block;
    width: 100%;
}

/* ==========================================================================
   PESTAÑA CONFIGURACIÓN
   ========================================================================== */
.config-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 840px;
    margin: 0 auto;
}

.config-container h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 26px;
}

.config-card-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-card-section h3 i { color: var(--cyan); }

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 9px 12px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    transition: border-color 0.15s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(26,140,255,0.1);
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: var(--text-muted);
}

.check-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
}

.check-group label {
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
}

.config-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid var(--border);
    padding-top: 18px;
}

/* Botones generales */
.btn-primary, .btn-secondary {
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.btn-primary {
    background: var(--blue);
    border: 1px solid var(--blue);
    color: #fff;
}

.btn-primary:hover {
    background: #1a7de8;
    box-shadow: 0 0 12px rgba(26,140,255,0.35);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.15);
}

/* ==========================================================================
   TOASTS
   ========================================================================== */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius-sm);
    padding: 12px 18px;
    color: var(--text-primary);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: slide-in 0.2s ease;
    transition: opacity 0.3s;
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes blink {
    from { opacity: 0.3; }
    to   { opacity: 1; }
}

/* ==========================================================================
   WIDGET IP DEL GATEWAY (HEADER)
   ========================================================================== */
.gateway-ip-widget {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(26,140,255,0.07);
    border: 1px solid rgba(26,140,255,0.25);
    border-radius: 20px;
    padding: 5px 12px 5px 10px;
    font-size: 13px;
    font-weight: 500;
    transition: border-color 0.2s;
    position: relative;
}

.gateway-ip-widget:hover {
    border-color: rgba(26,140,255,0.5);
}

.gateway-label {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.gateway-ip-value {
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: var(--cyan);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.gateway-edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 11px;
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.gateway-edit-btn:hover {
    color: var(--blue);
    background: rgba(26,140,255,0.12);
}

/* Formulario inline de edición */
.gateway-edit-form {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 2px;
}

.gateway-edit-form.hidden { display: none; }

.gateway-ip-input {
    background: var(--bg-input);
    border: 1px solid var(--border-active);
    border-radius: var(--radius-sm);
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 3px 8px;
    width: 120px;
    outline: none;
    box-shadow: 0 0 0 3px rgba(26,140,255,0.12);
    transition: border-color 0.15s;
}

.gateway-ip-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}

.gateway-apply-btn,
.gateway-cancel-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.gateway-apply-btn {
    background: var(--green);
    color: #fff;
}

.gateway-apply-btn:hover {
    background: #16a34a;
    box-shadow: 0 0 8px rgba(34,197,94,0.4);
}

.gateway-cancel-btn {
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.gateway-cancel-btn:hover {
    background: rgba(239,68,68,0.1);
    color: var(--red);
    border-color: rgba(239,68,68,0.3);
}

/* ==========================================================================
   SELECCIÓN DE PLANTILLAS
   ========================================================================== */
.templates-view-layout {
    display: flex;
    gap: 28px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.templates-cards-area {
    flex: 2;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
}

.templates-config-area {
    flex: 1;
    min-width: 320px;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.section-header-title {
    margin-bottom: 20px;
}

.section-header-title h2 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.section-header-title p {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    align-content: flex-start;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.template-card:hover {
    border-color: rgba(26,140,255,0.4);
    background: var(--bg-card-alt);
    transform: translateY(-2px);
}

.template-card.selected {
    border-color: var(--blue);
    background: rgba(26,140,255,0.06);
    box-shadow: 0 4px 20px rgba(26,140,255,0.15);
}

.card-radio {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.template-card.selected .card-radio {
    background: var(--blue);
    border-color: var(--blue);
}

.template-card.selected .card-radio::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: #fff;
}

.tcard-icon-area {
    width: 64px;
    flex-shrink: 0;
}

.mock-bars {
    width: 100%;
    height: 80px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mock-bars.custom i {
    font-size: 24px;
    color: var(--blue);
}

.tcard-info {
    flex: 1;
}

.tcard-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.badge-rec {
    display: inline-block;
    background: rgba(26,140,255,0.2);
    color: #60a5fa;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.tcard-info p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 12px;
}

.tcard-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.tcard-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Checklist de Canales */
.channels-checklist {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding-right: 8px;
}

.channel-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    cursor: pointer;
}

.channel-check-item:hover {
    background: rgba(255,255,255,0.03);
}

.channel-check-item.active {
    border-color: rgba(26,140,255,0.4);
    background: rgba(26,140,255,0.05);
}

.channel-check-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.channel-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
    cursor: inherit;
}

.cc-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.cc-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.cc-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.cc-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Formulario Config Plantilla */
.t-config-form {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.t-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ==========================================================================
   SELECTOR DE CANALES (TAB PLANTILLAS REDISEÑADO)
   ========================================================================== */
.ch-selector-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.ch-selector-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.ch-selector-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.ch-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--blue);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(26,140,255,0.4);
}

.ch-selector-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 42px;
}

.ch-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-self: center;
}

.btn-sm {
    font-size: 12px;
    padding: 6px 12px;
    gap: 5px;
}

/* Grid de canales 3 columnas */
.ch-channels-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px 24px;
    padding: 20px 28px;
    align-content: flex-start;
}

/* Cada item de canal - Minimalista sin bordes */
.ch-channel-item {
    transition: opacity 0.2s;
}

.ch-channel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ch-channel-main {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    flex: 1;
    min-width: 0;
}

/* Checkbox estilizado */
.ch-checkbox {
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ch-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ch-checkbox-box {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    cursor: pointer;
}

.ch-checkbox input:checked + .ch-checkbox-box {
    background: var(--blue);
    border-color: var(--blue);
}

.ch-checkbox-box::after {
    content: '';
    width: 5px;
    height: 10px;
    border: 2px solid transparent;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg) translateY(-2px);
    opacity: 0;
}

.ch-checkbox input:checked + .ch-checkbox-box::after {
    opacity: 1;
}

/* Nombre y Descripción */
.ch-channel-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: normal; /* Permitir dos líneas si es muy largo en 3 columnas */
}

/* Panel de Opciones Laterales (Gráfica / Número) */
.ch-view-options {
    display: flex;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* Dropdown Menu Items */
.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.ch-channel-item.ch-active .ch-view-options {
    opacity: 1;
    pointer-events: auto;
}

.ch-opt-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}

.ch-opt-btn:hover {
    background: rgba(255,255,255,0.08);
}

.ch-opt-btn.active {
    background: rgba(26,140,255,0.15);
    border-color: var(--blue);
    color: var(--blue);
    box-shadow: 0 0 8px rgba(26,140,255,0.25);
}

.ch-opt-num {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Footer del selector */
.ch-selector-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
    flex-shrink: 0;
    gap: 16px;
}

.ch-footer-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ch-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--cyan);
    font-family: var(--font-mono);
    background: rgba(0,212,255,0.08);
    border: 1px solid rgba(0,212,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
}

.ch-footer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    :root { --sidebar-w: 60px; }

    .sidebar-logo { display: none; }
    .logo-area { padding: 14px 10px; }

    .nav-btn span { display: none; }
    .nav-btn { justify-content: center; padding: 12px; }

    .sidebar-footer { display: none; }

    .config-grid { grid-template-columns: 1fr; }
    .digital-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ==========================================================================
   MODALES (CURVE CONFIG, ETC)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    animation: modalPop 0.2s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   PESTAÑA PLANTILLAS — SELECTOR DE CANALES
   ========================================================================== */

    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Footer */
.ch-selector-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    gap: 16px;
    flex-wrap: wrap;
}

.ch-footer-info { display: flex; align-items: center; gap: 12px; }

.ch-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(26,140,255,0.1);
    border: 1px solid rgba(26,140,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.ch-footer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-sm { padding: 6px 12px !important; font-size: 12.5px !important; }

/* Puntos de hover del canvas */
.canvas-hover-dot {
    position: absolute !important;
    pointer-events: none !important;
    z-index: 9999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    transform: translate(-5px, -5px);
    width: 10px;
    height: 10px;
}

.canvas-hover-dot .dot-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.canvas-hover-dot .dot-label {
    position: absolute;
    background: #0f172a !important;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2) !important;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}


/* Dropdown Menú en listado de plantillas */
.tpl-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #1e293b !important; /* fondo gris oscuro sólido para legibilidad */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6) !important;
    z-index: 1000 !important;
    min-width: 140px;
    overflow: hidden;
    text-align: left;
}

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease, color 0.15s ease;
    background: transparent;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

.dropdown-item.btn-delete-tpl:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--red) !important;
}

/* ==========================================================================
   SCROLLABLE HEADERS & GROUPED TOOLTIP (NUEVOS)
   ========================================================================== */

/* Contenedor que permite scroll en las etiquetas de los tracks */
.track-headers-scroll {
    max-height: 85px; /* Muestra ~4 encabezados (aprox 21px c/u) */
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

/* Ocultar scrollbar visualmente pero permitir scroll con rueda */
.track-headers-scroll::-webkit-scrollbar {
    width: 4px;
}
.track-headers-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Tooltip Agrupado Flotante */
.grouped-tooltip {
    background: rgba(13, 17, 26, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
    font-family: var(--font-ui);
    min-width: 220px;
}

.grouped-tooltip-header {
    font-size: 11px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
    margin-bottom: 8px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 1px;
}

.grouped-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.grouped-tooltip-row:last-child {
    margin-bottom: 0;
}

.grouped-tooltip-indicator {
    width: 8px;
    height: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.ch-opt-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary);
}

.ch-opt-btn.active {
    background: rgba(26,140,255,0.15);
    border-color: rgba(26,140,255,0.35);
    color: var(--blue);
}

.ch-opt-num {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Footer */
.ch-selector-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    gap: 16px;
    flex-wrap: wrap;
}

.ch-footer-info { display: flex; align-items: center; gap: 12px; }

.ch-count {
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(26,140,255,0.1);
    border: 1px solid rgba(26,140,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.ch-footer-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-sm { padding: 6px 12px !important; font-size: 12.5px !important; }

/* Puntos de hover del canvas */
.canvas-hover-dot {
    position: absolute !important;
    pointer-events: none !important;
    z-index: 9999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    transform: translate(-5px, -5px);
    width: 10px;
    height: 10px;
}

.canvas-hover-dot .dot-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.canvas-hover-dot .dot-label {
    position: absolute;
    background: #0f172a !important;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2) !important;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono) !important;
    font-size: 11px !important;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}


/* Dropdown Menú en listado de plantillas */
.tpl-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #1e293b !important; /* fondo gris oscuro sólido para legibilidad */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6) !important;
    z-index: 1000 !important;
    min-width: 140px;
    overflow: hidden;
    text-align: left;
}

.dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary) !important;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s ease, color 0.15s ease;
    background: transparent;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

.dropdown-item.btn-delete-tpl:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    color: var(--red) !important;
}

/* ==========================================================================
   SCROLLABLE HEADERS & GROUPED TOOLTIP (NUEVOS)
   ========================================================================== */

/* Contenedor que permite scroll en las etiquetas de los tracks */
.track-headers-scroll {
    max-height: 85px; /* Muestra ~4 encabezados (aprox 21px c/u) */
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

/* Ocultar scrollbar visualmente pero permitir scroll con rueda */
.track-headers-scroll::-webkit-scrollbar {
    width: 4px;
}
.track-headers-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Tooltip Agrupado Flotante (Glassmorphism) */
.grouped-tooltip {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: #ffffff;
    font-family: var(--font-ui);
    min-width: 240px;
}

.grouped-tooltip-header {
    font-size: 13px;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
    margin-bottom: 12px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 1px;
}

.grouped-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.grouped-tooltip-row:last-child {
    margin-bottom: 0;
}

.grouped-tooltip-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.grouped-tooltip-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 16px;
    color: #cbd5e1;
    font-weight: 500;
}

.grouped-tooltip-value {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 700;
    font-size: 14px;
    text-align: right;
    color: #ffffff;
}

/* Tooltip Individual por columna — Estilo Premium */
.track-individual-tooltip {
    position: absolute;
    background: rgba(10, 14, 28, 0.90);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    padding: 8px 12px 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    font-family: 'Outfit', 'Inter', sans-serif;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 220px;
    max-width: 320px;
}
.track-individual-tooltip .tip-header {
    font-size: 11.5px;
    font-weight: 700;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding-bottom: 6px;
    margin-bottom: 6px;
    text-align: left;
    letter-spacing: 0.2px;
}
.track-individual-tooltip .tip-row {
    display: flex;
    align-items: center;
    padding: 3px 0;
    min-width: 0;
}
.track-individual-tooltip .tip-line {
    width: 14px;
    height: 2.5px;
    border-radius: 1px;
    flex-shrink: 0;
    margin-right: 6px;
}
.track-individual-tooltip .tip-name {
    font-size: 11.5px;
    color: #ffffff;
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    padding-right: 8px;
}
.track-individual-tooltip .tip-val {
    font-size: 11.5px;
    font-weight: 700;
    color: #ffffff;
    font-family: 'Share Tech Mono', monospace;
    white-space: nowrap;
    text-align: right;
    flex-shrink: 0;
}
.track-individual-tooltip .tip-unit {
    font-size: 10px;
    opacity: 0.7;
    color: #94a3b8;
    margin-left: 2px;
}

/* ==========================================================================
   CANVAS CONTROLS BAR (barra encima de las gráficas)
   ========================================================================== */
.canvas-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: #111;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
    height: 38px;
}
.canvas-controls-left { display: flex; align-items: center; }
.canvas-controls-right { display: flex; align-items: center; gap: 6px; }
.canvas-title-text {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

/* ==========================================================================
   LOG LAYOUT WRAPPER
   ========================================================================== */
.log-layout-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}
.log-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #292C3E;
    overflow: hidden;
}
.log-headers-row {
    display: flex;
    background: #292C3E;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    min-height: 56px;
}
.log-splitter {
    flex-shrink: 0;
    height: 6px;
    background: rgba(255,255,255,0.04);
    border-top: 1px solid rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    cursor: ns-resize;
    transition: background 0.2s, box-shadow 0.2s;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.log-splitter::after {
    content: '';
    display: block;
    width: 32px;
    height: 2px;
    border-radius: 2px;
    background: rgba(255,255,255,0.18);
    transition: background 0.2s, width 0.2s;
}
.log-splitter:hover {
    background: rgba(26,140,255,0.12);
    box-shadow: 0 0 8px rgba(26,140,255,0.25);
}
.log-splitter:hover::after {
    background: rgba(26,140,255,0.8);
    width: 56px;
}
.log-splitter.dragging {
    background: rgba(26,140,255,0.2);
    box-shadow: 0 0 12px rgba(26,140,255,0.45);
}
.log-splitter.dragging::after {
    background: #1a8cff;
    width: 72px;
}
.canvas-viewport {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}
.log-canvases-row {
    display: flex;
    min-height: 100%;
    width: 100%;
    position: relative;
}

/* ==========================================================================
   TRACK PARAMETER BLOCKS (cabezales de columnas - imagen de referencia)
   ========================================================================== */
.track-param-block {
    display: flex !important;
    flex-direction: column !important;
    border-radius: 0 !important;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08) !important;
    background: #1A1E30;
    margin-bottom: 1px !important;
    box-shadow: none;
    transition: border-color 0.2s;
    min-height: 32px;
}
.track-param-block:first-child { border-left: none !important; }
.track-param-block:hover {
    border-color: rgba(255,255,255,0.25) !important;
    z-index: 1;
}

.param-block-badge {
    display: none !important;  /* oculto, reemplazado por top-row */
}
.param-block-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}
.param-block-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1px 4px;
    font-size: 8.5px;
    font-weight: 700;
    color: #000;
    border-bottom: 1px solid rgba(0,0,0,0.15);
    height: 15px;
    min-height: 15px;
}
.param-block-name-wrap {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 1;
    min-width: 0;
    padding: 0 2px;
    gap: 4px;
}
.param-block-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10.5px;
    font-weight: 700;
    color: inherit;
    max-width: 100%;
}
.param-block-wits {
    font-size: 8px;
    font-weight: 600;
    opacity: 0.8;
    color: inherit;
    letter-spacing: 0.3px;
    white-space: nowrap;
    line-height: 1;
}
.param-block-bottom-row {
    background: #1A1E30;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1px 4px;
    height: 17px;
    min-height: 17px;
    flex: 1;
    gap: 4px;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    overflow: hidden;
}
.param-block-val {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -0.3px;
}
.param-block-unit {
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1;
    opacity: 0.9;
    white-space: nowrap;
    font-family: var(--font-mono);
}

/* ==========================================================================
   KPI SIDEBAR - CUADRÍCULA INDUSTRIAL TIPO IMAGEN DE REFERENCIA
   ========================================================================== */
.kpi-sidebar-wrapper {
    display: flex;
    flex-direction: column;
    width: 340px;
    min-width: 340px;
    background: #1A1E30;
    border-left: 1px solid #3B4259;
    position: relative;
    transition: width 0.3s;
}

.kpi-sidebar-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 12px;
    background: #1A1E30;
    border-bottom: 1px solid #3B4259;
    gap: 12px;
}

.kpi-btn {
    background: transparent;
    border: none;
    color: #8b92a5;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color 0.2s;
}

.kpi-btn:hover {
    color: #ffffff;
}

.widget-properties-panel {
    position: absolute;
    top: 0;
    right: 100%;
    height: max-content;
    max-height: 100vh;
    width: 280px;
    background: #1A1E30;
    border-right: 1px solid #3B4259;
    z-index: 100;
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0,0,0,0.5);
    overflow-y: auto;
}

.wp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid #3d4255;
    background: #232731;
}

.wp-close {
    background: transparent;
    border: none;
    color: #8b92a5;
    cursor: pointer;
    font-size: 16px;
}

.wp-close:hover { color: #fff; }

.wp-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wp-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wp-section-row {
    display: flex;
    gap: 12px;
}

.wp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.wp-section label, .wp-field label {
    font-size: 11px;
    color: #b0b4c0;
    margin: 0;
}

.wp-select, .wp-input {
    background: #15181e;
    border: 1px solid #3d4255;
    color: #fff;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.wp-select:focus, .wp-input:focus {
    border-color: #1a8cff;
}

.wp-add-btn {
    background: transparent;
    border: none;
    color: #1a8cff;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
}

.wp-add-btn:hover {
    text-decoration: underline;
}

.wp-gauge-list {
    border: 1px solid #3d4255;
    border-radius: 4px;
    min-height: 80px;
    max-height: 180px;
    overflow-y: auto;
    background: #15181e;
}

.wp-gauge-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    font-size: 12px;
    border-bottom: 1px solid #2a2d39;
    cursor: pointer;
    gap: 8px;
    transition: background 0.1s;
}

.wp-gauge-item:last-child {
    border-bottom: none;
}

.wp-gauge-item:hover, .wp-gauge-item.selected {
    background: rgba(26,140,255,0.2);
}

.wp-gauge-item-icon {
    color: #8b92a5;
    font-size: 10px;
}

.wp-gauge-item-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wp-tabs {
    display: flex;
    border-bottom: 1px solid #3d4255;
}

.wp-tab {
    padding: 6px 12px;
    font-size: 12px;
    color: #8b92a5;
    cursor: pointer;
}

.wp-tab.active {
    color: #fff;
    border-bottom: 2px solid #1a8cff;
}

.wp-tab-content {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-sidebar {
    flex: 1;
    display: grid;
    /* Grid Auto Flow para que crezca hacia la derecha (columnas) */
    grid-auto-flow: column;
    /* grid-template-rows será definido por JS según Row Count, o 1fr para estirar */
    grid-template-rows: repeat(4, 1fr);
    gap: 0;
    background: var(--kpi-bg-color, #1A1E30);
    overflow-y: auto;
    overflow-x: auto;
    box-sizing: border-box;
    align-content: stretch;
}

/* Tarjetas KPI estilo imagen */
.kpi-sidebar-card {
    background: var(--kpi-bg-color, #1A1E30);
    border: 1px solid transparent;
    border-right: 1px solid #3B4259;
    border-bottom: 1px solid #3B4259;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: background 0.15s;
    text-align: center;
}

.kpi-sidebar-card:hover { background: #323650; }

.kpi-card-title {
    font-size: 11px;
    font-weight: 500;
    color: #FFFFFF;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-card-value {
    font-family: 'Inter', var(--font-mono);
    font-size: 36px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 4px;
}

.kpi-card-unit {
    font-size: 13px;
    color: #FFFFFF;
    font-weight: 500;
}

/* Tarjetas de la cuadrícula (grid) */
.kpi-grid {
    display: contents;
}

/* Animación de alarma */
.alarm-pulse {
    animation: alarm-pulse-anim 0.8s infinite alternate !important;
}
@keyframes alarm-pulse-anim {
    from { color: #ff3b30 !important; text-shadow: 0 0 4px rgba(255,59,48,0.5); }
    to   { color: #fff !important; text-shadow: 0 0 12px #ff3b30, 0 0 20px #ff3b30; }
}
.kpi-sidebar-card.alarm-active {
    border-color: #ff3b30 !important;
    background: rgba(255,59,48,0.12) !important;
    box-shadow: 0 0 8px rgba(255,59,48,0.2);
}

/* Crosshair Regla Horizontal */
#canvas-crosshair {
    height: 2px !important;
    background: #ff3b30 !important;
    box-shadow: 0 0 8px #ff3b30, 0 0 3px #ff3b30;
}

/* ──────────────────────────────────────────────────────────
   GAUGE LIST — Ícono de ojo interactivo
   ────────────────────────────────────────────────────────── */
.wp-gauge-item-icon {
    color: #8b92a5;
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.wp-gauge-item-icon:hover {
    color: #1a8cff;
}

/* ──────────────────────────────────────────────────────────
   BOTÓN ENLACE (btn-link-lock) — Estado activo
   ────────────────────────────────────────────────────────── */
#btn-link-lock {
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

#btn-link-lock.locked, #btn-kpi-link-lock.locked {
    color: #1a8cff !important;
    background: rgba(26,140,255,0.15) !important;
    border-color: rgba(26,140,255,0.35) !important;
}

/* ──────────────────────────────────────────────────────────
   WIDGET PROPERTIES PANEL — Rediseño
   ────────────────────────────────────────────────────────── */
.widget-properties-panel {
    position: absolute;
    top: 0;
    right: 100%;
    bottom: 0;
    width: 300px;
    background: #1a1d27;
    border-right: 1px solid #2e3347;
    z-index: 100;
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 16px rgba(0,0,0,0.6);
    overflow-y: auto;
}

.wp-subheader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #2e3347;
    background: #14171f;
    flex-shrink: 0;
}

.wp-back-btn {
    background: transparent;
    border: none;
    color: #1a8cff;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 0;
}
.wp-back-btn:hover { text-decoration: underline; }

.wp-add-track-btn {
    background: transparent;
    border: none;
    color: #1a8cff;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
}
.wp-add-track-btn:hover { text-decoration: underline; }

/* Lista de canales en modo gráfica */
.wp-channel-list {
    flex-shrink: 0;
    max-height: 240px;
    overflow-y: auto;
    background: #111520;
    border-bottom: 1px solid #2e3347;
}

.wp-ch-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    cursor: pointer;
    border-bottom: 1px solid #1e2330;
    transition: background 0.1s;
    font-size: 12px;
}
.wp-ch-item:last-child { border-bottom: none; }
.wp-ch-item:hover { background: rgba(26,140,255,0.08); }
.wp-ch-item.selected { background: rgba(26,140,255,0.15); border-left: 3px solid #1a8cff; }

.wp-ch-eye {
    color: #6b7a99;
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s;
}
.wp-ch-eye:hover { color: #1a8cff; }

.wp-ch-icon {
    font-size: 11px;
    flex-shrink: 0;
}

.wp-ch-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #c8d0e0;
}

.wp-ch-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Fila Select Curve + Add + Trash */
.wp-curve-select-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #2e3347;
    background: #14171f;
    flex-shrink: 0;
}

.wp-add-btn-solid {
    background: #1a8cff;
    border: none;
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.15s;
}
.wp-add-btn-solid:hover { background: #0070d8; }

.wp-trash-btn {
    background: transparent;
    border: 1px solid #3d4255;
    color: #6b7a99;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.wp-trash-btn:hover { color: #ef4444; border-color: #ef4444; background: rgba(239,68,68,0.1); }

/* Curve Properties section */
.wp-curve-props-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.wp-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #e0e8ff;
    padding: 10px 10px 6px;
    border-bottom: 1px solid #2e3347;
    background: #14171f;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wp-tabs {
    display: flex;
    background: #111520;
    border-bottom: 1px solid #2e3347;
}

.wp-tab {
    flex: 1;
    padding: 7px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7a99;
    cursor: pointer;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.wp-tab:hover { color: #c8d0e0; }
.wp-tab.active { color: #fff; border-bottom-color: #1a8cff; }

.wp-tab-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wp-field-label {
    font-size: 11px;
    color: #6b7a99;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.wp-curve-name-display {
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    color: #c8d0e0;
    background: #0f1219;
    border: 1px solid #2e3347;
    border-radius: 4px;
    padding: 5px 8px;
    margin-bottom: 4px;
}

.wp-two-col {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.wp-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.wp-field label,
.wp-section label,
.wp-tab-body label:not(.wp-check-row) {
    font-size: 10px;
    color: #6b7a99;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0;
}

.wp-input {
    background: #0f1219;
    border: 1px solid #2e3347;
    color: #e0e8ff;
    padding: 5px 7px;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    width: 100%;
}
.wp-input:focus { border-color: #1a8cff; }

.wp-arrows {
    color: #6b7a99;
    font-size: 14px;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.wp-check-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #c8d0e0;
    cursor: pointer;
    margin: 0;
    text-transform: none;
    font-weight: 400;
}
.wp-check-row input { cursor: pointer; accent-color: #1a8cff; }

.wp-sub-title {
    font-size: 11px;
    font-weight: 700;
    color: #e0e8ff;
    border-bottom: 1px solid #2e3347;
    padding-bottom: 4px;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* FIN DEL ARCHIVO CSS */

/* ─── SIMULADOR LAS ─── */
.sim-speed-btn {
    padding: 5px 10px;
    background: #1e3050;
    border: 1px solid #2d4a70;
    border-radius: 6px;
    color: #5a7aaa;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'JetBrains Mono', monospace;
}
.sim-speed-btn:hover {
    background: #2d4a70;
    color: #e0e8ff;
}
.sim-speed-btn.active {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
    box-shadow: 0 0 10px #8b5cf640;
}

.sim-kpi-card {
    background: #0e1726;
    border: 2px solid #1e3050;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    min-height: 80px;
}
.sim-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 10px 10px 0 0;
    background: var(--sim-ch-color, #8b5cf6);
}
.sim-kpi-name {
    font-size: 11px;
    font-weight: 700;
    color: #5a7aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.sim-kpi-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -1px;
}
.sim-kpi-unit {
    font-size: 11px;
    color: #5a7aaa;
    font-weight: 600;
    margin-top: 2px;
}

.sim-stat-card {
    background: #0e1726;
    border: 1px solid #1e3050;
    border-radius: 8px;
    padding: 10px 12px;
    border-left: 3px solid var(--sim-ch-color, #8b5cf6);
}
.sim-stat-mnem {
    font-size: 10px;
    font-weight: 700;
    color: #5a7aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.sim-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 2px;
}
.sim-stat-lbl { color: #5a7aaa; }
.sim-stat-val { color: #e0e8ff; font-weight: 700; }

.sim-track-header {
    flex: 1;
    padding: 8px 12px;
    border-right: 2px solid #1e3050;
    min-width: 0;
    border-top-width: 3px;
    border-top-style: solid;
}
.sim-track-header:last-child { border-right: none; }
.sim-track-hname {
    font-size: 12px;
    font-weight: 700;
    color: #5a7aaa;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}
.sim-track-hval {
    font-family: 'JetBrains Mono', monospace;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
}
.sim-track-hrange {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #5a7aaa;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
}
.sim-canvas-track {
    flex: 1;
    border-right: 2px solid #1e3050;
    position: relative;
    overflow: hidden;
}
.sim-canvas-track:last-child { border-right: none; }
.sim-canvas-track canvas {
    width: 100%;
    height: 100%;
    display: block;
}

@keyframes sim-val-flash {
    0%   { opacity: 1; }
    30%  { opacity: 0.4; }
    100% { opacity: 1; }
}
.sim-val-updated { animation: sim-val-flash 0.4s ease; }

/* ==========================================================================
   TOOLTIP AGRUPADO (Glassmorphism — estilo imagen de referencia)
   ========================================================================== */
.grouped-tooltip {
    background: rgba(10, 14, 28, 0.90);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    padding: 10px 14px 8px;
    min-width: 230px;
    max-width: 320px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
    font-family: 'Outfit', 'Inter', sans-serif;
    pointer-events: none;
    z-index: 9999;
}
.grouped-tooltip-header {
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 8px;
    padding-bottom: 7px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    letter-spacing: 0.2px;
}
.grouped-tooltip-row {
    display: flex;
    align-items: center;
    padding: 3.5px 0;
    gap: 0;
    min-width: 0;
}
.grouped-tooltip-indicator {
    width: 16px;
    height: 2.5px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-right: 8px;
}
.grouped-tooltip-label {
    font-size: 12px;
    color: #94a3b8;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 8px;
}
.grouped-tooltip-value {
    font-size: 12px;
    font-weight: 700;
    color: #f0f4ff;
    font-family: 'Share Tech Mono', monospace;
    white-space: nowrap;
    text-align: right;
}
.grouped-tooltip-unit {
    font-size: 10px;
    opacity: 0.65;
    color: #94a3b8;
    margin-left: 2px;
}

/* Botón de toggle de tooltip en la barra del canvas */
.tooltip-cycle-btn.active-grouped {
    background: rgba(26,140,255,0.15);
    color: #1a8cff;
    border-color: rgba(26,140,255,0.4);
}

/* ==========================================================================
   TOOLTIP BANDAS (4° estilo — barra de color ancho completo)
   ========================================================================== */
.banded-tooltip {
    background: rgba(10, 14, 28, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    padding: 10px 0 2px;
    min-width: 250px;
    max-width: 340px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
    font-family: 'Outfit', 'Inter', sans-serif;
    pointer-events: none;
    overflow: hidden;
}
.banded-tooltip-header {
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
    padding: 0 14px 9px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.2px;
}
.banded-tooltip-row {
    display: flex;
    flex-direction: column;
}
.banded-row-bar {
    height: 2px;
    width: 100%;
    flex-shrink: 0;
}
.banded-row-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 14px 5px;
    gap: 8px;
}
.banded-row-name {
    font-size: 12px;
    color: #94a3b8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.banded-row-value {
    font-size: 12px;
    font-weight: 700;
    color: #f0f4ff;
    font-family: 'Share Tech Mono', monospace;
    white-space: nowrap;
    text-align: right;
}
.banded-row-unit {
    font-size: 10px;
    opacity: 0.65;
    color: #94a3b8;
    margin-left: 2px;
}

/* ==========================================================================
   DRAWER DE ESTADÍSTICAS DEL ANÁLISIS LAS
   ========================================================================== */
.las-stats-drawer {
    position: absolute;
    top: 0;
    right: -420px; /* Oculto por defecto */
    width: 400px;
    height: 100%;
    background: rgba(13, 17, 26, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.las-stats-drawer.open {
    right: 0;
}

.las-stats-drawer .drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    font-weight: 700;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.las-stats-drawer .drawer-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.15s;
}

.las-stats-drawer .drawer-close:hover {
    color: #f87171;
}

.las-stats-drawer .drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.las-stats-drawer .nsf-table th {
    color: #94a3b8;
    border-bottom-color: rgba(255,255,255,0.08);
}

.las-stats-drawer .nsf-table td {
    color: #e2e8f0;
    border-bottom-color: rgba(255,255,255,0.04);
}

.las-stats-drawer .nsf-table tbody tr:hover {
    background: rgba(255,255,255,0.03);
}

/* ══════════════════════════════════════════════════════════════════════
   LAS VIEWER — TARJETAS KPI (Panel superior tipo instrumentos de sondeo)
   ══════════════════════════════════════════════════════════════════════ */
.las-kpi-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 14px 8px 12px;
    background: linear-gradient(135deg, rgba(10, 18, 35, 0.95) 0%, rgba(15, 25, 50, 0.90) 100%);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    cursor: default;
    backdrop-filter: blur(4px);
}

.las-kpi-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.025) 0%, transparent 60%);
    pointer-events: none;
}

.las-kpi-card:hover {
    background: linear-gradient(135deg, rgba(14, 24, 46, 0.98) 0%, rgba(20, 34, 64, 0.95) 100%);
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.las-kpi-label {
    font-family: 'Inter', 'Outfit', sans-serif;
    font-size: 9px;
    font-weight: 800;
    color: #8aa4c8;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.las-kpi-value {
    font-family: 'Share Tech Mono', 'JetBrains Mono', 'Courier New', monospace;
    font-size: 20px;
    font-weight: 400;
    color: #e0eeff;
    line-height: 1;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color 0.12s ease;
}

.las-kpi-unit {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 600;
    color: #4a6080;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

/* Animación de "pulso" cuando el valor cambia al mover el cursor */
@keyframes kpiPulse {
    0%   { opacity: 0.5; }
    50%  { opacity: 1; }
    100% { opacity: 1; }
}

.las-kpi-value.updating {
    animation: kpiPulse 0.15s ease forwards;
}

/* Grid container override para que las tarjetas fluyan naturalmente en 5 columnas */
#las-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 8px !important;
    background: #060a12;
    border-left: 1px solid #1e3050;
    border-right: 1px solid #1e3050;
    border-bottom: 2px solid rgba(26, 140, 255, 0.2);
    padding: 10px 12px;
    max-height: 250px;
    overflow-y: auto;
}

/* Scrollbar personalizado para el KPI grid en overflow */
#las-kpi-grid::-webkit-scrollbar { width: 5px; height: 5px; }
#las-kpi-grid::-webkit-scrollbar-track { background: transparent; }
#las-kpi-grid::-webkit-scrollbar-thumb { background: rgba(26, 140, 255, 0.4); border-radius: 4px; }
#las-kpi-grid::-webkit-scrollbar-thumb:hover { background: rgba(26, 140, 255, 0.6); }

/* ══════════════════════════════════════════════════════════════════════
   LAS FULLSCREEN VIEWER — GRID KPI DE PLANTILLA TODOS
   ══════════════════════════════════════════════════════════════════════ */
#las-fullscreen-kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 10px !important;
    background: #080c14;
    border-bottom: 2px solid #1e3050;
    padding: 14px 20px !important;
}

#las-fullscreen-kpi-grid::-webkit-scrollbar {
    width: 6px;
}
#las-fullscreen-kpi-grid::-webkit-scrollbar-track {
    background: transparent;
}
#las-fullscreen-kpi-grid::-webkit-scrollbar-thumb {
    background: rgba(26, 140, 255, 0.3);
    border-radius: 3px;
}
#las-fullscreen-kpi-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 140, 255, 0.5);
}

/* Efectos visuales de tarjetas en pantalla completa */
#las-fullscreen-viewer .las-kpi-card {
    background: rgba(13, 27, 48, 0.45);
    border: 1px solid rgba(30, 48, 80, 0.8);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
}
#las-fullscreen-viewer .las-kpi-card:hover {
    background: rgba(13, 27, 48, 0.7);
    border-color: #1a8cff;
}
#las-fullscreen-viewer .las-kpi-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 22px;
    font-weight: 700;
}

/* Forzar visualización de la sección gráfica inferior en pantalla completa */
#las-fullscreen-viewer .log-layout-wrapper {
    flex: 1 1 auto !important;
    display: flex !important;
    min-height: 0 !important;
    height: 100% !important;
}

#las-fullscreen-viewer .log-container {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
}

#las-fullscreen-viewer .canvas-viewport {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    height: 100% !important;
}

#las-fullscreen-viewer .log-canvases-row {
    display: flex !important;
    align-items: stretch !important;
    min-height: 100% !important;
}

/* ══════════════════════════════════════════════════════════════
   LAS VIEWER TAB — GEOLOGIST SIDEBAR & CHART SECTION
══════════════════════════════════════════════════════════════ */

/* Panel principal de visualización LAS */
#las-chart-section {
    border-radius: 8px;
    overflow: hidden;
}

#las-chart-section .log-layout-wrapper {
    height: calc(100vh - 100px); /* Ocupa casi la pantalla completa */
}

/* Modo maximizado exclusivo para el Visor LAS */
body.las-maximized-mode .app-header {
    display: none !important;
}

body.las-maximized-mode .app-footer {
    display: none !important;
}

body.las-maximized-mode .app-sidebar {
    display: none !important;
}

body.las-maximized-mode .app-main-content {
    padding-bottom: 0 !important;
    margin-left: 0 !important;
    height: 100vh !important;
}

body.las-maximized-mode .nsf-layout {
    height: 100vh !important;
    padding: 0 !important;
}

body.las-maximized-mode .nsf-main {
    height: 100vh !important;
    padding: 8px !important;
}

body.las-maximized-mode #las-chart-section .log-layout-wrapper {
    height: calc(100vh - 65px) !important;
}


/* Barra lateral del geólogo */
.las-geologist-sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, #0c101d 0%, #080b18 100%);
    border-left: 1px solid rgba(26, 140, 255, 0.15);
    display: flex;
    flex-direction: column;
    padding: 14px;
    box-sizing: border-box;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1a2a44 transparent;
}

.las-geologist-sidebar::-webkit-scrollbar { width: 4px; }
.las-geologist-sidebar::-webkit-scrollbar-track { background: transparent; }
.las-geologist-sidebar::-webkit-scrollbar-thumb { background: #1a2a44; border-radius: 4px; }

/* Título del sidebar */
.las-geologist-sidebar .sidebar-title {
    font-size: 10px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #1a8cff;
    border-bottom: 1px solid rgba(26, 140, 255, 0.2);
    padding-bottom: 10px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}

/* Tarjeta de placeholder del menú geólogo */
.las-geo-placeholder-card {
    font-size: 11px;
    color: #4a6080;
    text-align: center;
    padding: 24px 12px;
    border: 1px dashed rgba(26, 140, 255, 0.18);
    border-radius: 8px;
    background: rgba(26, 140, 255, 0.02);
    position: relative;
    overflow: hidden;
    line-height: 1.6;
}

.las-geo-placeholder-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    background: conic-gradient(from 0deg, transparent 0%, rgba(26, 140, 255, 0.12) 30%, transparent 60%);
    animation: spin-ring 6s linear infinite;
    pointer-events: none;
}

@keyframes spin-ring {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.las-geo-placeholder-card .geo-icon {
    font-size: 22px;
    color: rgba(26, 140, 255, 0.4);
    display: block;
    margin-bottom: 10px;
}

/* Botones de herramienta futuros del sidebar geólogo */
.geo-tool-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    border: 1px solid rgba(26, 140, 255, 0.12);
    background: rgba(26, 140, 255, 0.04);
    color: #c8d6f0;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    margin-bottom: 6px;
    width: 100%;
    text-align: left;
}

.geo-tool-btn:hover {
    background: rgba(26, 140, 255, 0.12);
    border-color: rgba(26, 140, 255, 0.4);
    color: #e0e8ff;
    transform: translateX(2px);
}

.geo-tool-btn i {
    font-size: 13px;
    color: #1a8cff;
    width: 16px;
    text-align: center;
}

.geo-tool-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive: si la pantalla es pequeña, ocultar sidebar */
@media (max-width: 1024px) {
    .las-geologist-sidebar {
        display: none !important;
    }
}

/* ══════════════════════════════════════════════════════
   ANALÍTICA AVANZADA — Sidebar del Geólogo
   ══════════════════════════════════════════════════════ */

/* Sección contenedora de cada grupo */
.geo-analytics-section {
    background: rgba(255,255,255,0.024);
    border: 1px solid rgba(26,140,255,0.1);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
}

/* Encabezado de sección */
.geo-analytics-header {
    font-size: 10px;
    font-weight: 700;
    color: #1a8cff;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.geo-analytics-header i {
    font-size: 11px;
    width: 14px;
    text-align: center;
}

/* Badge de conteo / estado */
.geo-badge {
    margin-left: auto;
    background: rgba(26,140,255,0.18);
    color: #60a5fa;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.geo-badge-warn {
    background: rgba(245,158,11,0.18);
    color: #fbbf24;
}

.geo-badge-alert {
    background: rgba(239,68,68,0.18);
    color: #f87171;
}

/* Bloque de tipo de fluido */
.geo-fluid-result {
    background: rgba(0,0,0,0.25);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 54px;
}

.geo-fluid-type {
    font-size: 13px;
    font-weight: 700;
    color: #e0e8ff;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

.geo-fluid-confidence {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
}

/* Colores por tipo de fluido */
.geo-fluid-DRY_GAS   { color: #60a5fa; }
.geo-fluid-WET_GAS   { color: #4ade80; }
.geo-fluid-CONDENSATE{ color: #fbbf24; }
.geo-fluid-OIL       { color: #fb923c; }
.geo-fluid-CARBONATE { color: #c084fc; }

/* Grilla de ratios */
.geo-ratios-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.geo-ratio-item {
    background: rgba(0,0,0,0.2);
    border-radius: 5px;
    padding: 5px 7px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.geo-ratio-label {
    font-size: 9px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.geo-ratio-val {
    font-size: 11px;
    font-weight: 700;
    color: #a5b4fc;
    font-family: 'Share Tech Mono', monospace;
}

/* Lista de zonas productoras */
.geo-zones-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1a2a44 transparent;
}

.geo-zone-card {
    background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(16,185,129,0.04));
    border: 1px solid rgba(16,185,129,0.25);
    border-radius: 6px;
    padding: 7px 10px;
    position: relative;
}

.geo-zone-type {
    font-size: 11px;
    font-weight: 700;
    color: #34d399;
    margin-bottom: 3px;
}

.geo-zone-detail {
    font-size: 10px;
    color: #64748b;
    font-family: 'Share Tech Mono', monospace;
}

.geo-zone-depth {
    font-size: 10px;
    color: #60a5fa;
    font-weight: 600;
}

/* Umbrales configurables */
.geo-threshold-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.geo-thresh-label {
    font-size: 10px;
    color: #94a3b8;
    flex: 1;
}

.geo-thresh-input {
    width: 72px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(26,140,255,0.18);
    border-radius: 4px;
    color: #e0e8ff;
    font-size: 11px;
    font-family: 'Share Tech Mono', monospace;
    padding: 3px 6px;
    text-align: right;
}

.geo-thresh-input:focus {
    outline: none;
    border-color: rgba(26,140,255,0.5);
    background: rgba(26,140,255,0.06);
}

/* Lista de alertas */
.geo-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1a2a44 transparent;
}

.geo-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    background: rgba(239,68,68,0.07);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 10px;
    color: #fca5a5;
    line-height: 1.4;
}

.geo-alert-item i {
    color: #f87171;
    font-size: 10px;
    flex-shrink: 0;
    margin-top: 1px;
}

.geo-alert-item.geo-alert-warn {
    background: rgba(245,158,11,0.07);
    border-color: rgba(245,158,11,0.2);
    color: #fde68a;
}

.geo-alert-item.geo-alert-warn i { color: #fbbf24; }

/* Estadísticas de gases */
.geo-stats-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.geo-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.geo-stat-name {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.geo-stat-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.geo-stat-vals {
    font-size: 10px;
    color: #94a3b8;
    font-family: 'Share Tech Mono', monospace;
    text-align: right;
}

.geo-stat-max {
    color: #e0e8ff;
    font-weight: 700;
}

/* Botón analizar */
.geo-analyze-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #1a4a8a, #0f2d5a);
    border: 1px solid rgba(26,140,255,0.35);
    border-radius: 8px;
    color: #60a5fa;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.geo-analyze-btn:hover {
    background: linear-gradient(135deg, #1e5aaa, #122d6a);
    border-color: rgba(26,140,255,0.7);
    color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(26,140,255,0.2);
}

.geo-analyze-btn.running {
    opacity: 0.7;
    cursor: wait;
}

/* Texto de no-dato */
.geo-no-data {
    font-size: 10px;
    color: #334155;
    text-align: center;
    padding: 10px 8px;
    line-height: 1.5;
}

/* ==========================================================================
   NTRX CONTROL — GESTIÓN DE USUARIOS (RBAC) ESTILOS
   ========================================================================== */

/* Badges de Estado y Rol */
.badge-active {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #dcfce7;
    color: #166534;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.badge-inactive {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid #fecaca;
}

.badge-role {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.role-operator {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.role-viewer {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Modal Overlay & Card */
.user-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.user-modal-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.user-modal-header {
    background: #0f172a;
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s;
}

.user-modal-close:hover {
    color: #ffffff;
}

.user-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.user-modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.user-modal-field label {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-modal-footer {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Switch Toggle (Active / Inactive) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.25s;
    border-radius: 22px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background-color: #16a34a;
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

.badge-reset-requested {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 12px;
    border: 1px solid #fecaca;
    animation: badgePulse 1.8s infinite;
}

@keyframes badgePulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}


