/* ============================================================
   TERMAP — Sistema de Gestión de Incidentes
   CSS Principal — Versión 2.0
   Fuentes: Inter + JetBrains Mono via Google Fonts
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

/* ============================================================
   VARIABLES GLOBALES
============================================================ */
:root {
    --bg-deep:        #020b16;
    --bg-dark:        #04111f;
    --bg-card:        rgba(6, 16, 30, 0.72);
    --bg-card-solid:  #061320;
    --border-subtle:  rgba(255, 255, 255, 0.07);
    --border-glow:    rgba(59, 130, 246, 0.35);
    --accent-blue:    #3b82f6;
    --accent-cyan:    #06b6d4;
    --accent-green:   #10b981;
    --accent-red:     #ef4444;
    --accent-amber:   #f59e0b;
    --text-primary:   #e2eaf5;
    --text-muted:     #6b8caa;
    --text-dim:       #3d5670;
    --radius-sm:      10px;
    --radius-md:      16px;
    --radius-lg:      24px;
    --radius-pill:    999px;
    --blur-glass:     saturate(180%) blur(28px);
    --shadow-float:   0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06);
    --shadow-glow:    0 0 30px rgba(59, 130, 246, 0.18);
    --font-body:      'Inter', 'Segoe UI', sans-serif;
    --font-mono:      'JetBrains Mono', monospace;
    --transition:     all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ============================================================
   BASE
============================================================ */
html, body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
}

/* ============================================================
   ██╗      ██████╗  ██████╗ ██╗███╗   ██╗
   ██║     ██╔═══██╗██╔════╝ ██║████╗  ██║
   ██║     ██║   ██║██║  ███╗██║██╔██╗ ██║
   ██║     ██║   ██║██║   ██║██║██║╚██╗██║
   ███████╗╚██████╔╝╚██████╔╝██║██║ ╚████║
   PANTALLA DE LOGIN
============================================================ */

.login-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 15% 10%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 85% 90%, rgba(6, 182, 212, 0.10) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(16, 185, 129, 0.04) 0%, transparent 60%),
        linear-gradient(160deg, #010811 0%, #021223 50%, #030f1e 100%);
    color: #ffffff;
}

.login-layout {
    flex: 1;
    min-height: auto;
    padding: 14px 20px 8px;
}

.login-shell {
    min-height: calc(100vh - 112px);
    border-radius: 28px;
    overflow: hidden;
    background: rgba(4, 12, 26, 0.70);
    border: 1px solid rgba(59, 130, 246, 0.10);
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(59, 130, 246, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.06);
    backdrop-filter: blur(20px);
}

/* Panel izquierdo — branding */
.login-brand-panel {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 3rem;
    background: linear-gradient(175deg, rgba(5, 18, 38, 0.95) 0%, rgba(3, 10, 22, 0.98) 100%);
    overflow: hidden;
}

.login-brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 25% 18%, rgba(59, 130, 246, 0.14) 0%, transparent 28%),
        radial-gradient(circle at 78% 80%, rgba(6, 182, 212, 0.10) 0%, transparent 25%),
        radial-gradient(circle at 60% 40%, rgba(16, 185, 129, 0.05) 0%, transparent 30%);
    pointer-events: none;
}

/* Malla decorativa sutil */
.login-brand-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
}

.login-brand-content {
    position: relative;
    z-index: 1;
    max-width: 540px;
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.4rem;
    padding: 0.5rem 1rem 0.5rem 0.7rem;
    border-radius: var(--radius-pill);
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #93c5fd;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.login-brand-badge::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
    flex-shrink: 0;
}

.login-brand-logo {
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(59, 130, 246, 0.12),
        inset 0 1px 0 rgba(255,255,255,0.05);
    margin-bottom: 2.2rem;
    border: 1px solid rgba(255,255,255,0.06);
}

.login-brand-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.9rem;
    color: #ffffff;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.login-brand-text {
    font-size: 1rem;
    line-height: 1.75;
    color: #7fa8c9;
    max-width: 480px;
    margin-bottom: 2rem;
    font-weight: 300;
}

.login-brand-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.login-brand-tags span {
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #8fb5d4;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.82rem;
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* Panel derecho — formulario */
.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, rgba(4, 14, 28, 0.97) 0%, rgba(2, 8, 18, 0.99) 100%);
}

.login-form-wrapper {
    width: 100%;
    max-width: 480px;
}

.mobile-login-header { margin-bottom: 1.5rem; }

.mobile-login-logo {
    max-width: 260px;
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
}

.login-form-card {
    padding: 2rem 2rem 1.8rem;
    border-radius: 22px;
    background: rgba(7, 18, 36, 0.90);
    border: 1px solid rgba(59, 130, 246, 0.12);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.35),
        0 0 25px rgba(59, 130, 246, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.05);
}

.login-form-top { margin-bottom: 1.5rem; }

.login-overline {
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.72rem;
    font-weight: 700;
}

.login-form-title {
    font-size: 1.9rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.4px;
}

.login-form-subtitle {
    color: #5e7e98;
    font-size: 0.95rem;
    font-weight: 300;
}

.form-label {
    color: #c5d8ec;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.form-control {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    color: #ffffff;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.form-control::placeholder { color: #3d5670; }

.form-control:focus {
    background: rgba(59, 130, 246, 0.06);
    color: #ffffff;
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 0 20px rgba(59, 130, 246, 0.08);
    outline: none;
}

.login-btn {
    border: none;
    color: #ffffff;
    padding: 0.9rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35), 0 0 0 1px rgba(255,255,255,0.05);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.login-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 35px rgba(37, 99, 235, 0.45); }
.login-btn:hover::before { opacity: 1; }
.login-btn:active { transform: translateY(0); }

/* ── Footer login ── */
.site-footer {
    width: 100%;
    padding: 0.85rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(2, 8, 18, 0.96);
    backdrop-filter: blur(10px);
}

.site-footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-footer-left {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.site-footer-left a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 400;
    transition: color 0.2s;
}

.site-footer-left a:hover { color: var(--accent-cyan); }

.site-footer-right {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.site-footer-credit-text { color: var(--text-dim); font-size: 0.78rem; letter-spacing: 0.5px; }
.site-footer-credit-brand { font-size: 0.88rem; color: #bdd4ec; font-weight: 600; }

/* ── Alertas ── */
.custom-alert {
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.alert-info.custom-alert    { background: rgba(59,130,246,0.12);  color: #93c5fd; border-left: 3px solid #3b82f6; }
.alert-warning.custom-alert { background: rgba(245,158,11,0.12);  color: #fcd34d; border-left: 3px solid #f59e0b; }
.alert-danger.custom-alert  { background: rgba(239,68,68,0.12);   color: #fca5a5; border-left: 3px solid #ef4444; }
.alert-success.custom-alert { background: rgba(16,185,129,0.12);  color: #6ee7b7; border-left: 3px solid #10b981; }

/* ── Modal login ── */
.custom-modal {
    background: #07111f;
    color: var(--text-primary);
    border: 1px solid rgba(59, 130, 246, 0.18);
    border-radius: 20px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.5), 0 0 40px rgba(59,130,246,0.08);
}

.custom-modal .modal-title { color: #ffffff; font-weight: 700; }
.custom-modal .modal-body  { color: #8fb5d4; font-size: 0.95rem; }

.modal-btn {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    transition: var(--transition);
}
.modal-btn:hover { transform: translateY(-1px); color: #fff; box-shadow: 0 6px 20px rgba(37,99,235,0.35); }

/* Responsive login */
@media (max-width: 991.98px) {
    .login-layout { padding: 12px; }
    .login-shell { min-height: auto; }
    .login-form-panel { min-height: calc(100vh - 28px); padding: 1.25rem; }
    .login-form-card  { padding: 1.5rem; border-radius: 20px; }
    .login-form-title { font-size: 1.65rem; }
}
@media (max-width: 768px) {
    .site-footer { padding: 0.85rem 1rem; }
    .site-footer-content { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}


/* ============================================================
   ███╗   ███╗ █████╗ ██████╗  █████╗
   ████╗ ████║██╔══██╗██╔══██╗██╔══██╗
   ██╔████╔██║███████║██████╔╝███████║
   ██║╚██╔╝██║██╔══██║██╔═══╝ ██╔══██║
   ██║ ╚═╝ ██║██║  ██║██║     ██║  ██║
   VISTA MAPA / OPERADOR
============================================================ */

html, body {
    width: 100%;
    height: 100%;
}

body.map-view {
    margin: 0; padding: 0; overflow: hidden;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-body);
}

#map {
    position: absolute;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 1;
}


/* ============================================================
   ENCABEZADO — Floating minimalista con gradientes
============================================================ */
.termap-header {
    position: fixed;
    top: 18px; left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 1360px;
    /* Glassmorphism elegante */
    background: linear-gradient(
        135deg,
        rgba(4, 12, 24, 0.88) 0%,
        rgba(6, 18, 36, 0.82) 50%,
        rgba(4, 14, 28, 0.88) 100%
    );
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    /* Borde con gradiente */
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px 10px 16px;
    z-index: 1000;
    /* Sombra flotante dramática */
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.55),
        0 8px 20px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255,255,255,0.04),
        inset 0 1px 0 rgba(255,255,255,0.07);
}

/* Línea de acento superior */
.termap-header::before {
    content: "";
    position: absolute;
    top: 0; left: 15%; right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.5), rgba(6,182,212,0.4), transparent);
    border-radius: var(--radius-pill);
}

/* Branding */
.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(59,130,246,0.4));
}

.header-brand span {
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    letter-spacing: 2px;
    /* Degradado de texto sutil */
    background: linear-gradient(90deg, #e2eaf5 0%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Búsqueda central */
.termap-search-container {
    flex: 0 1 340px;
    position: relative;
}

.termap-search-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-pill);
    padding: 9px 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-body);
    transition: var(--transition);
}

.termap-search-input::placeholder { color: var(--text-dim); }

.termap-search-input:focus {
    background: rgba(59,130,246,0.08);
    border-color: rgba(59,130,246,0.45);
    box-shadow: 0 0 20px rgba(59,130,246,0.15);
}

/* Nav derecha */
.nav-box {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.nav-box .d-flex {
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.18);
    border-radius: var(--radius-pill);
    padding: 5px 14px 5px 10px;
    gap: 7px;
}

.logout-btn {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.5);
    color: #f87171;
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

.logout-btn:hover {
    background: rgba(239,68,68,0.15);
    border-color: #ef4444;
    color: #fca5a5;
    box-shadow: 0 0 20px rgba(239,68,68,0.2);
}

/* ── Header admin simple ── */
.termap-header-logout {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.5);
    color: #f87171;
    padding: 7px 20px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.termap-header-logout:hover {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}


/* ============================================================
   CONTROLES DEL MAPA — Botones flotantes verticales
============================================================ */
.map-controls {
    position: fixed;
    top: 110px; left: 20px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.map-btn {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(8,20,36,0.85) 0%, rgba(4,12,22,0.92) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.09);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
}

.map-btn:hover {
    background: linear-gradient(145deg, rgba(37,99,235,0.35) 0%, rgba(59,130,246,0.25) 100%);
    color: #93c5fd;
    border-color: rgba(59,130,246,0.4);
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 12px 28px rgba(37,99,235,0.35), 0 0 20px rgba(59,130,246,0.15);
}


/* ============================================================
   PANEL FILTROS — CORREGIDO z-index y posición
   (Siempre DEBAJO del header, nunca encima)
============================================================ */
#filtrosPanel {
    position: fixed;
    /* Justo debajo del header (header: top:18px + padding 12px + logo 46px + 12px + margen) */
    top: 110px;
    left: 20px;
    z-index: 890;
    background: linear-gradient(160deg, rgba(6,16,30,0.95) 0%, rgba(4,12,22,0.98) 100%);
    border: 1px solid rgba(59,130,246,0.18);
    border-radius: 20px;
    padding: 1.1rem 1.2rem;
    width: 250px;
    display: none;
    box-shadow:
        0 20px 50px rgba(0,0,0,0.6),
        0 0 30px rgba(59,130,246,0.08),
        inset 0 1px 0 rgba(255,255,255,0.06);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

#filtrosPanel.show {
    display: block;
    animation: slideDown 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

#filtrosPanel label {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

#filtrosPanel select,
#filtrosPanel input[type=date] {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-radius: 10px;
    padding: 7px 11px;
    font-size: 0.83rem;
    margin-bottom: 10px;
    font-family: var(--font-body);
    transition: border-color 0.2s;
}

#filtrosPanel select:focus,
#filtrosPanel input[type=date]:focus {
    border-color: rgba(59,130,246,0.45);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

#filtrosPanel select option {
    background: #061320;
    color: var(--text-primary);
}

.btn-filtro-apply {
    width: 100%;
    background: linear-gradient(135deg, rgba(37,99,235,0.3) 0%, rgba(59,130,246,0.2) 100%);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.35);
    border-radius: 10px;
    padding: 8px;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.5px;
}

.btn-filtro-apply:hover {
    background: linear-gradient(135deg, rgba(37,99,235,0.5) 0%, rgba(59,130,246,0.35) 100%);
    box-shadow: 0 6px 20px rgba(59,130,246,0.2);
}

.btn-filtro-reset {
    width: 100%;
    background: transparent;
    color: var(--text-dim);
    border: none;
    font-size: 0.76rem;
    cursor: pointer;
    margin-top: 4px;
    text-decoration: none;
    transition: color 0.2s;
    padding: 4px;
}
.btn-filtro-reset:hover { color: var(--text-muted); }


/* ============================================================
   PANEL FORMULARIO NUEVO INCIDENTE
============================================================ */
.incident-panel {
    position: fixed;
    top: 96px; right: 20px;
    width: 420px;
    max-height: calc(100vh - 190px);
    overflow-y: auto;
    background: linear-gradient(160deg, rgba(6,16,30,0.92) 0%, rgba(4,12,22,0.96) 100%);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 24px;
    z-index: 950;
    padding: 22px;
    box-shadow:
        -15px 25px 55px rgba(0,0,0,0.65),
        0 0 40px rgba(59,130,246,0.06),
        inset 0 1px 0 rgba(255,255,255,0.07);
    opacity: 0; visibility: hidden;
    transform: translateX(70px) scale(0.96);
    transition: all 0.45s cubic-bezier(0.23, 1, 0.32, 1);
}

.incident-panel.show {
    opacity: 1; visibility: visible;
    transform: translateX(0) scale(1);
}

.incident-panel::-webkit-scrollbar { width: 4px; }
.incident-panel::-webkit-scrollbar-thumb {
    background: rgba(59,130,246,0.25);
    border-radius: 10px;
}

.btn-cerrar {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    border-radius: 50%;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    flex-shrink: 0;
}

.btn-cerrar:hover {
    color: #fff;
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.5);
    transform: rotate(90deg);
    box-shadow: 0 0 15px rgba(239,68,68,0.25);
}

/* Inputs del formulario */
.termap-input {
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    color: #ffffff !important;
    border-radius: 11px !important;
    padding: 10px 14px !important;
    font-size: 0.9rem !important;
    font-family: var(--font-body) !important;
    transition: var(--transition);
}

.termap-input:focus {
    background: rgba(59,130,246,0.06) !important;
    border-color: rgba(59,130,246,0.5) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.10) !important;
    transform: translateY(-1px);
}

.termap-input::placeholder { color: rgba(255,255,255,0.25) !important; }

.termap-input option {
    background-color: #06121e !important;
    color: #ffffff !important;
    padding: 8px;
}

.termap-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    margin-left: 2px;
    display: block;
}

/* Botones formulario */
.btn-soft-blue {
    background: rgba(59,130,246,0.1);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 11px;
    transition: var(--transition);
    font-size: 0.88rem;
}
.btn-soft-blue:hover {
    background: rgba(59,130,246,0.22);
    color: #bfdbfe;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(59,130,246,0.18);
}

.btn-primary-tactical {
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    border: none;
    border-radius: 11px;
    box-shadow: 0 8px 22px rgba(37,99,235,0.38);
    transition: var(--transition);
    color: #fff;
    font-weight: 600;
}
.btn-primary-tactical:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #22d3ee 100%);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(37,99,235,0.5);
    color: #fff;
}

.btn-cancel-tactical {
    background: rgba(255,255,255,0.02);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 11px;
    transition: var(--transition);
}
.btn-cancel-tactical:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-primary);
    transform: translateY(-1px);
}

#folioDisplay {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 1px;
    color: var(--accent-blue);
}

.picking-mode { cursor: crosshair !important; }


/* ============================================================
   BARRA DE ESTADO INFERIOR — Rediseñada minimalista
============================================================ */
.termap-status-bar {
    position: fixed;
    bottom: 20px; left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(
        135deg,
        rgba(4, 12, 24, 0.90) 0%,
        rgba(6, 18, 36, 0.86) 50%,
        rgba(4, 12, 24, 0.90) 100%
    );
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    padding: 10px 36px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255,255,255,0.06);
    z-index: 1000;
    color: var(--text-muted);
    display: flex;
    gap: 36px;
    align-items: center;
    font-size: 0.85rem;
    box-shadow:
        0 12px 35px rgba(0,0,0,0.5),
        0 0 0 1px rgba(255,255,255,0.03),
        inset 0 1px 0 rgba(255,255,255,0.06);
    white-space: nowrap;
}

/* Línea de acento inferior */
.termap-status-bar::after {
    content: "";
    position: absolute;
    bottom: 0; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.3), rgba(6,182,212,0.25), transparent);
    border-radius: var(--radius-pill);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 7px;
}

.status-item .fw-bold { color: var(--text-primary); font-weight: 500; }

/* Divisores entre items */
.status-item + .status-item {
    padding-left: 36px;
    border-left: 1px solid rgba(255,255,255,0.06);
    margin-left: -36px;
}

/* Reloj monospace */
#liveClock {
    font-family: var(--font-mono) !important;
    font-size: 0.88rem !important;
    letter-spacing: 2px;
    color: var(--text-muted) !important;
}


/* ============================================================
   TOAST / MENSAJES EMERGENTES — Con diseño completo
============================================================ */
#termap-toast {
    position: fixed;
    bottom: 80px; right: 24px;
    z-index: 9999;
    min-width: 300px;
    max-width: 380px;
    border-radius: 16px;
    padding: 0;
    font-size: 0.88rem;
    display: none;
    animation: toastIn 0.35s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
    box-shadow:
        0 20px 50px rgba(0,0,0,0.5),
        0 0 0 1px rgba(255,255,255,0.06);
    font-family: var(--font-body);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Toast interno */
#termap-toast.success {
    background: linear-gradient(135deg, rgba(4,24,16,0.97) 0%, rgba(5,20,14,0.99) 100%);
    border: 1px solid rgba(16,185,129,0.35);
    color: #6ee7b7;
}

#termap-toast.error {
    background: linear-gradient(135deg, rgba(24,4,4,0.97) 0%, rgba(20,5,5,0.99) 100%);
    border: 1px solid rgba(239,68,68,0.35);
    color: #fca5a5;
}

/* Barra de acento superior del toast */
#termap-toast.success::before,
#termap-toast.error::before {
    content: "";
    display: block;
    height: 3px;
    width: 100%;
}

#termap-toast.success::before {
    background: linear-gradient(90deg, #059669, #10b981, #34d399);
}

#termap-toast.error::before {
    background: linear-gradient(90deg, #dc2626, #ef4444, #f87171);
}

/* Contenido del toast se mete con padding */
#termap-toast > * { padding: 12px 16px; }

/* Si el contenido es texto directo (no elemento), usamos padding en el propio toast */
#termap-toast {
    padding: 3px 0 0; /* solo espacio para la barra */
}

/* Truco: el mensaje HTML se coloca dentro del wrapper */
.toast-body {
    padding: 12px 16px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.55;
}

.toast-icon {
    width: 22px; height: 22px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
    margin-top: 1px;
}

.success .toast-icon {
    background: rgba(16,185,129,0.18);
    color: #34d399;
    border: 1px solid rgba(16,185,129,0.3);
}

.error .toast-icon {
    background: rgba(239,68,68,0.18);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.3);
}


/* ============================================================
   MODALES — Diseño completo y elegante
============================================================ */
#modalDetalle .modal-content,
#modalEditar  .modal-content {
    background: linear-gradient(160deg, rgba(7,18,34,0.98) 0%, rgba(4,12,24,0.99) 100%);
    border: 1px solid rgba(59,130,246,0.16);
    border-radius: 22px;
    color: var(--text-primary);
    box-shadow:
        0 30px 80px rgba(0,0,0,0.65),
        0 0 60px rgba(59,130,246,0.08),
        inset 0 1px 0 rgba(255,255,255,0.06);
    overflow: hidden;
}

/* Barra de acento superior en modales */
#modalDetalle .modal-content::before,
#modalEditar  .modal-content::before {
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.6), rgba(6,182,212,0.5), transparent);
}

#modalDetalle .modal-header,
#modalEditar  .modal-header {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 16px 22px;
    background: rgba(255,255,255,0.01);
}

#modalDetalle .modal-body,
#modalEditar  .modal-body {
    padding: 20px 22px 22px;
}

/* Folio en modal */
#mdFolio {
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--accent-blue);
    letter-spacing: 1px;
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 6px;
    padding: 2px 8px;
    display: inline-block;
}

/* Badge prioridad */
.badge-prioridad {
    padding: 3px 11px;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.badge-alta    { background: rgba(239,68,68,0.12);   color: #f87171;  border: 1px solid rgba(239,68,68,0.3); }
.badge-critica { background: rgba(220,38,38,0.18);   color: #fca5a5;  border: 1px solid rgba(220,38,38,0.4); box-shadow: 0 0 12px rgba(239,68,68,0.2); }
.badge-media   { background: rgba(245,158,11,0.12);  color: #fcd34d;  border: 1px solid rgba(245,158,11,0.3); }
.badge-baja    { background: rgba(16,185,129,0.10);  color: #6ee7b7;  border: 1px solid rgba(16,185,129,0.25); }

/* Labels en modal */
.termap-label-sm {
    font-size: 0.68rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 3px;
    display: block;
}

/* Galería thumbnails */
.thumb-wrap { position: relative; display: inline-block; }

.thumb-wrap img {
    width: 76px; height: 76px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(59,130,246,0.2);
    cursor: pointer;
    transition: var(--transition);
}

.thumb-wrap img:hover {
    border-color: rgba(59,130,246,0.6);
    transform: scale(1.06);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.thumb-wrap .btn-del-img {
    position: absolute; top: -5px; right: -5px;
    background: rgba(239,68,68,0.9);
    color: #fff;
    border: none; border-radius: 50%;
    width: 19px; height: 19px;
    font-size: 0.65rem;
    cursor: pointer;
    display: none;
    align-items: center; justify-content: center;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    transition: var(--transition);
}

.thumb-wrap:hover .btn-del-img { display: flex; }
.thumb-wrap .btn-del-img:hover { background: #dc2626; transform: scale(1.15); }

#imgZoom {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    display: none;
    margin-top: 12px;
    border: 1px solid rgba(59,130,246,0.2);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

/* Botones en modal */
#btnEditarDesdeDetalle {
    background: rgba(37,99,235,0.12);
    color: #93c5fd;
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
    padding: 8px 20px;
    font-size: 0.88rem;
}
#btnEditarDesdeDetalle:hover {
    background: rgba(37,99,235,0.25);
    box-shadow: 0 6px 18px rgba(37,99,235,0.2);
    transform: translateY(-1px);
    color: #bfdbfe;
}

#btnEliminarDesdeDetalle {
    background: rgba(239,68,68,0.08);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 10px;
    font-weight: 600;
    transition: var(--transition);
    padding: 8px 20px;
    font-size: 0.88rem;
}
#btnEliminarDesdeDetalle:hover {
    background: rgba(239,68,68,0.2);
    box-shadow: 0 6px 18px rgba(239,68,68,0.2);
    transform: translateY(-1px);
    color: #fca5a5;
}

/* Inputs modal editar */
.termap-input-dark {
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    color: var(--text-primary) !important;
    border-radius: 10px !important;
    font-family: var(--font-body) !important;
    transition: var(--transition);
}

.termap-input-dark:focus {
    border-color: rgba(59,130,246,0.45) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.10) !important;
    outline: none !important;
}

.termap-input-dark option {
    background: #06121e;
    color: var(--text-primary);
}

/* Botón guardar cambios */
#btnGuardarEdicion {
    background: linear-gradient(135deg, rgba(37,99,235,0.3) 0%, rgba(59,130,246,0.2) 100%) !important;
    border: 1px solid rgba(59,130,246,0.4) !important;
    color: #93c5fd !important;
    border-radius: 10px !important;
    transition: var(--transition) !important;
    font-weight: 700 !important;
}
#btnGuardarEdicion:hover {
    background: linear-gradient(135deg, rgba(37,99,235,0.5) 0%, rgba(59,130,246,0.35) 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(37,99,235,0.25) !important;
}

/* ============================================================
   CONFIRM DIALOG — Modal personalizado TERMAP
============================================================ */
#termap-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(1, 6, 14, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.23, 1, 0.32, 1);
}

#termap-confirm-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

#termap-confirm-box {
    background: linear-gradient(160deg, rgba(7,18,34,0.99) 0%, rgba(4,12,24,1) 100%);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 22px;
    padding: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    box-shadow:
        0 30px 80px rgba(0,0,0,0.7),
        0 0 60px rgba(59,130,246,0.08),
        inset 0 1px 0 rgba(255,255,255,0.07);
    overflow: hidden;
    transform: scale(0.88) translateY(16px);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

#termap-confirm-overlay.visible #termap-confirm-box {
    transform: scale(1) translateY(0);
}

/* Línea de acento superior */
#termap-confirm-box::before {
    content: "";
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(239,68,68,0.7), rgba(248,113,113,0.5), transparent);
}

.confirm-inner {
    padding: 24px 26px 22px;
}

.confirm-icon-wrap {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.25);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
    animation: confirmPulse 2s ease-in-out infinite;
}

@keyframes confirmPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.2); }
    50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.confirm-icon-wrap svg {
    color: #f87171;
}

.confirm-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 6px;
    font-family: var(--font-body);
}

.confirm-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0 0 22px;
    font-family: var(--font-body);
}

.confirm-folio {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-blue);
    background: rgba(59,130,246,0.1);
    border: 1px solid rgba(59,130,246,0.2);
    border-radius: 5px;
    padding: 1px 7px;
    display: inline;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding: 14px 26px 18px;
}

.confirm-btn-cancel {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition);
    letter-spacing: 0.2px;
}
.confirm-btn-cancel:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}

.confirm-btn-ok {
    flex: 1;
    padding: 10px 0;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(185,28,28,0.55) 0%, rgba(239,68,68,0.35) 100%);
    border: 1px solid rgba(239,68,68,0.45);
    color: #fca5a5;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-body);
    transition: var(--transition);
    letter-spacing: 0.2px;
    position: relative;
    overflow: hidden;
}
.confirm-btn-ok::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 60%);
    pointer-events: none;
}
.confirm-btn-ok:hover {
    background: linear-gradient(135deg, rgba(185,28,28,0.75) 0%, rgba(239,68,68,0.55) 100%);
    border-color: rgba(239,68,68,0.7);
    color: #fecaca;
    box-shadow: 0 0 20px rgba(239,68,68,0.25);
    transform: translateY(-1px);
}


/* ============================================================
   HEADER — Mejoras de tamaño y animaciones
============================================================ */
.termap-header {
    padding: 12px 28px 12px 20px !important;
    animation: headerReveal 0.6s cubic-bezier(0.23, 1, 0.32, 1) both;
}

@keyframes headerReveal {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Logo más grande y con brillo animado */
.header-brand img {
    height: 46px !important;
    filter: drop-shadow(0 0 10px rgba(59,130,246,0.45)) !important;
    transition: var(--transition) !important;
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(59,130,246,0.4)); }
    50%       { filter: drop-shadow(0 0 18px rgba(59,130,246,0.7)) drop-shadow(0 0 30px rgba(6,182,212,0.25)); }
}

.header-brand img:hover {
    transform: scale(1.08) rotate(-2deg);
    filter: drop-shadow(0 0 20px rgba(59,130,246,0.8)) !important;
}

/* Texto TERMAP más grande */
.header-brand span {
    font-size: 1.35rem !important;
    letter-spacing: 3px !important;
    animation: textShimmer 4s ease-in-out infinite;
}

@keyframes textShimmer {
    0%, 100% { background-position: 0% 50%; }
    50%       { background-position: 100% 50%; }
}

/* Search más grande */
.termap-search-container {
    flex: 0 1 380px !important;
}

.termap-search-input {
    padding: 11px 22px !important;
    font-size: 0.92rem !important;
}

/* Nav-box con indicador animado */
.nav-box .d-flex {
    position: relative;
    overflow: hidden;
}

.nav-box .d-flex::before {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(16,185,129,0.06), transparent);
    animation: navShine 3.5s ease-in-out infinite;
}

@keyframes navShine {
    0%   { left: -100%; }
    60%  { left: 160%; }
    100% { left: 160%; }
}

/* Logout animado */
.logout-btn {
    position: relative;
    overflow: hidden;
}

.logout-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(239,68,68,0.06), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.logout-btn:hover::before {
    transform: translateX(100%);
}

/* Indicador online animado */
@keyframes blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

.status-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #10b981;
    animation: blink 1.8s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(16,185,129,0.6);
}


/* ============================================================
   MAP BUTTONS — Animaciones de entrada y hover mejorado
============================================================ */
.map-btn {
    width: 50px !important;
    height: 50px !important;
    border-radius: 16px !important;
    position: relative;
    overflow: hidden;
}

.map-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 60%);
    pointer-events: none;
}

.map-controls .map-btn:nth-child(1) { animation: btnSlideIn 0.5s 0.1s cubic-bezier(0.23,1,0.32,1) both; }
.map-controls .map-btn:nth-child(2) { animation: btnSlideIn 0.5s 0.2s cubic-bezier(0.23,1,0.32,1) both; }
.map-controls .map-btn:nth-child(3) { animation: btnSlideIn 0.5s 0.3s cubic-bezier(0.23,1,0.32,1) both; }
.map-controls .map-btn:nth-child(4) { animation: btnSlideIn 0.5s 0.4s cubic-bezier(0.23,1,0.32,1) both; }

@keyframes btnSlideIn {
    from { opacity: 0; transform: translateX(-18px); }
    to   { opacity: 1; transform: translateX(0); }
}

.map-btn:active {
    transform: scale(0.93) !important;
    transition: transform 0.1s !important;
}


/* ============================================================
   TOAST — Animación de salida mejorada
============================================================ */
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(12px) scale(0.95); }
}

#termap-toast.hiding {
    animation: toastOut 0.3s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}


/* ============================================================
   PANEL LATERAL (FORM) — Animación de entrada
============================================================ */
#formPanel {
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                opacity  0.35s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

/* ============================================================
   VISTA USUARIO — estilos extraídos de usuario/index.blade.php
============================================================ */

/* Modal detalle / editar */
#modalDetalle .modal-content,
#modalEditar .modal-content {
    background:#0d1b2a;border:1px solid #1e3a5f;border-radius:16px;color:#cfe2f3;
}
#modalDetalle .modal-header,
#modalEditar .modal-header { border-bottom:1px solid #1e3a5f; }
.badge-prioridad{padding:4px 12px;border-radius:20px;font-size:.72rem;font-weight:700;letter-spacing:1px;}
.badge-alta    {background:rgba(255,77,77,.2); color:#ff4d4d;border:1px solid #ff4d4d;}
.badge-critica {background:rgba(255,0,0,.2);   color:#ff0000;border:1px solid #ff0000;}
.badge-media   {background:rgba(255,193,7,.15);color:#ffc107;border:1px solid #ffc107;}
.badge-baja    {background:rgba(0,255,136,.1); color:#00ff88;border:1px solid #00ff88;}

/* Galería de imágenes */
.thumb-wrap { position:relative; display:inline-block; }
.thumb-wrap img {
    width:80px;height:80px;object-fit:cover;border-radius:8px;
    border:2px solid #1e3a5f;cursor:pointer;transition:border-color .2s, transform .2s;
}
.thumb-wrap img:hover{border-color:#4b8de5;transform:scale(1.05);}
.thumb-wrap .btn-del-img {
    position:absolute;top:-6px;right:-6px;background:#ff4d4d;color:#fff;
    border:none;border-radius:50%;width:20px;height:20px;font-size:.65rem;
    cursor:pointer;display:none;align-items:center;justify-content:center;line-height:1;
}
.thumb-wrap:hover .btn-del-img{display:flex;}

/* Zoom de imagen */
#imgZoom{max-width:100%;max-height:65vh;border-radius:10px;display:none;margin-top:12px;border:1px solid #1e3a5f;}

/* Panel filtros */
#filtrosPanel{
    position:fixed;top:80px;left:70px;z-index:950;
    background:#0d1b2a;border:1px solid #1e3a5f;border-radius:14px;
    padding:1.2rem;width:260px;display:none;box-shadow:0 8px 30px rgba(0,0,0,.5);
}
#filtrosPanel.show{display:block;animation:slideUp .25s ease;}
#filtrosPanel label{font-size:.73rem;color:#8fb0d2;letter-spacing:.5px;margin-bottom:3px;display:block;}
#filtrosPanel select,#filtrosPanel input[type=date]{
    width:100%;background:#0a1628;border:1px solid #1e3a5f;color:#cfe2f3;
    border-radius:8px;padding:6px 10px;font-size:.82rem;margin-bottom:10px;
}
.btn-filtro-apply{width:100%;background:#1a3f7a;color:#e0eeff;border:1px solid #3b6fc4;
    border-radius:8px;padding:7px;font-weight:700;cursor:pointer;transition:background .2s, transform .1s;
    box-shadow: 0 2px 8px rgba(59,111,196,0.18);}
.btn-filtro-apply:hover{background:#1e4d8c;}
.btn-filtro-apply:active{transform:scale(0.98);background:#163260;}
.btn-filtro-reset{width:100%;background:transparent;color:#8fb0d2;border:none;
    font-size:.78rem;cursor:pointer;margin-top:4px;text-decoration:underline;}

.picking-mode{cursor:crosshair !important;}

/* Folio display */
#folioDisplay{font-family:monospace;font-size:.8rem;letter-spacing:1px;color:#4b8de5;}

/* Inputs modal editar */
.termap-input-dark{
    background:#0a1628!important;border:1px solid #1e3a5f!important;
    color:#cfe2f3!important;border-radius:8px;
}
.termap-label-sm{font-size:.72rem;color:#8fb0d2;letter-spacing:.5px;font-weight:600;margin-bottom:3px;display:block;}

/* ══════════════════════════════════════
   PANEL ESTADÍSTICAS TÁCTICO
══════════════════════════════════════ */
#statsPanel {
    position: fixed;
    left: 8px;
    bottom: 44px;
    width: 210px;
    z-index: 850;
    background: linear-gradient(160deg, rgba(4,12,24,0.95) 0%, rgba(2,8,18,0.97) 100%);
    border: 1px solid rgba(59,130,246,0.18);
    border-radius: 14px;
    padding: 11px 13px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.04);
    display: block;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
#statsPanel::-webkit-scrollbar { display: none; }
#statsPanel.export-hidden { display: none !important; }

.stats-cat-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s cubic-bezier(0.23,1,0.32,1), opacity 0.25s ease;
    opacity: 0;
}
.stats-cat-body.open {
    max-height: 300px;
    opacity: 1;
}
.stats-cat-toggle {
    cursor: pointer; user-select: none;
    display: flex; align-items: center; justify-content: space-between;
}
.stats-cat-toggle .toggle-arrow {
    font-size: .6rem; color: #4b8de5;
    transition: transform 0.25s ease;
    display: inline-block;
}
.stats-cat-toggle.open .toggle-arrow { transform: rotate(90deg); }
.stats-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 9px; padding-bottom: 7px;
    border-bottom: 1px solid rgba(59,130,246,0.15);
}
.stats-title {
    color: #4b8de5; font-weight: 700; font-size: .7rem;
    letter-spacing: 1.5px; text-transform: uppercase;
}
.stats-close {
    background: none; border: none; color: #6b8caa;
    cursor: pointer; font-size: 1rem; padding: 0; line-height:1;
    transition: color .2s;
}
.stats-close:hover { color: #fff; }

.stats-totals {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 9px;
}
.stat-card {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
    border-radius: 9px; padding: 7px 8px; text-align: center;
}
.stat-card .stat-num {
    font-size: 1.25rem; font-weight: 700; color: #fff;
    font-family: 'JetBrains Mono', monospace; line-height: 1;
}
.stat-card .stat-lbl {
    font-size: .58rem; color: #6b8caa; letter-spacing: 1px;
    text-transform: uppercase; margin-top: 3px;
}
.stat-card.accent-blue  { border-color: rgba(59,130,246,0.3);  }
.stat-card.accent-green { border-color: rgba(16,185,129,0.3);  }
.stat-card.accent-blue  .stat-num { color: #4b8de5; }
.stat-card.accent-green .stat-num { color: #10b981; }

.stats-section-title {
    font-size: .6rem; color: #4b8de5; letter-spacing: 1.5px;
    text-transform: uppercase; font-weight: 700;
    margin-bottom: 5px; margin-top: 9px;
}
.priority-bar-wrap { margin-bottom: 5px; }
.priority-bar-header {
    display: flex; justify-content: space-between;
    font-size: .66rem; margin-bottom: 3px;
}
.priority-bar-header .lbl { color: #8fb0d2; }
.priority-bar-header .cnt { color: #fff; font-weight: 700; font-family: monospace; }
.priority-bar-bg {
    height: 6px; background: rgba(255,255,255,0.06);
    border-radius: 3px; overflow: hidden;
}
.priority-bar-fill {
    height: 100%; border-radius: 3px;
    transition: width .8s cubic-bezier(0.23,1,0.32,1);
}

.cat-item {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cat-item:last-child { border-bottom: none; }
.cat-icon { font-size: .9rem; width: 22px; text-align: center; flex-shrink: 0; }
.cat-name { font-size: .75rem; color: #8fb0d2; flex: 1; }
.cat-count {
    font-size: .75rem; font-weight: 700; color: #fff;
    font-family: monospace; background: rgba(59,130,246,0.12);
    border: 1px solid rgba(59,130,246,0.2); border-radius: 6px;
    padding: 1px 7px;
}

/* ══════════════════════════════════════
   MARCADORES — animación de pulso crítico
══════════════════════════════════════ */
@keyframes markerPulse {
    0%   { transform: scale(1);   opacity: 1; }
    50%  { transform: scale(1.5); opacity: 0.4; }
    100% { transform: scale(2);   opacity: 0; }
}

/* ══════════════════════════════════════
   GRID de escaneo — overlay táctico
══════════════════════════════════════ */
#tactical-grid {
    position: fixed; inset: 0; z-index: 2; pointer-events: none;
    background-image:
        linear-gradient(rgba(59,130,246,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59,130,246,0.025) 1px, transparent 1px);
    background-size: 60px 60px;
}

/* ══════════════════════════════════════
   CORNER BRACKETS — esquinas tácticas
══════════════════════════════════════ */
.corner-bracket {
    position: fixed; width: 20px; height: 20px; z-index: 3; pointer-events: none;
}
.corner-bracket.tl { top: 8px;  left: 8px;  border-top: 2px solid rgba(59,130,246,0.5); border-left: 2px solid rgba(59,130,246,0.5); }
.corner-bracket.tr { top: 8px;  right: 8px; border-top: 2px solid rgba(59,130,246,0.5); border-right: 2px solid rgba(59,130,246,0.5); }
.corner-bracket.bl { bottom: 8px; left: 8px;   border-bottom: 2px solid rgba(59,130,246,0.5); border-left: 2px solid rgba(59,130,246,0.5); }
.corner-bracket.br { bottom: 8px; right: 8px;  border-bottom: 2px solid rgba(59,130,246,0.5); border-right: 2px solid rgba(59,130,246,0.5); }

/* ══════════════════════════════════════
   STATUS BAR — badge crítico
══════════════════════════════════════ */
.status-critical-badge {
    background: rgba(255,0,0,0.15); border: 1px solid rgba(255,0,0,0.4);
    border-radius: 20px; padding: 2px 10px; font-size: .72rem; font-weight: 700;
    color: #ff4d4d; letter-spacing: 1px; font-family: monospace;
    animation: criticalBlink 2s ease-in-out infinite;
}
@keyframes criticalBlink {
    0%,100% { opacity:1; box-shadow: 0 0 8px rgba(255,0,0,0.3); }
    50%     { opacity:.7; box-shadow: 0 0 16px rgba(255,0,0,0.5); }
}