:root {
    --bg: #08111f;
    --bg-elev: rgba(10, 20, 38, 0.84);
    --bg-card: rgb(234, 236, 239, 1.0);
    --muted-card: rgba(218, 220, 227, 1.0);
    --muted-card-text: #797f87;
    --text-card: #000;
    --text-info-card: darkblue;
    --line: rgba(130, 178, 255, 0.16);
    --text: #ecf4ff;
    --muted: #90a7c6;
    --gold: #D4AF37;
    --accent: #3da1ff;
    --success: #1ec892;
    --warning: #f8bc3a;
    --danger: #ff5c80;
    --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    --radius: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, Segoe UI, Arial, sans-serif; background: var(--bg); color: var(--text); height: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.glass-panel { backdrop-filter: blur(18px); background: var(--bg-elev); border: 1px solid var(--line); box-shadow: var(--shadow); }
.theme-dark { min-height: 100vh; }
.login-page {
    background: url('/img/skyline.png') no-repeat center center fixed;
    background-size: cover;
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 32px; background: linear-gradient(rgba(8, 17, 31, 0.9), rgba(8, 17, 31, 0.0)); position: relative; }
.branding-top-left { position: absolute; top: 32px; left: 32px; }
.branding-top-left img { width: 190px; height: auto; }
.login-container { display: flex; align-items: stretch; gap: 40px; max-width: 1000px; width: 100%; }
.login-info { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 20px; }
.info-line-1 { font-size: 1.0rem; font-weight: 300; color: var(--accent); letter-spacing: 0.2em; margin: 0 0 10px; font-family: 'Arial', sans-serif; }
.info-line-2 { font-size: 2.4rem; font-weight: 700; margin: 0 0 20px; font-family: 'Arial', sans-serif; }
.info-line-3 { font-size: 1rem; color: var(--muted); line-height: 1.6; margin-bottom: 40px; font-family: 'Arial', sans-serif; }
.info-grid { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-top: auto; padding-top: 10px; }
.info-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(61, 161, 255, 0.1);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 1.4rem;
    color: var(--text);
}
.text-upper { font-weight: 400; font-size: 1.0rem; color: var(--text); }
.text-lower { color: var(--muted); font-size: 0.9rem; }
.login-card { width: min(480px, 100%); border-radius: 28px; padding: 32px; flex-shrink: 0; }
.brand-row {
    align-items: center;
    margin-bottom: 18px;
}
.brand-badge {
    width: 100%;
    display: flex;
    justify-content: center;
}
.brand-badge img { width: 155px; height: auto; }
.eyebrow { margin: 0 0 6px; color: var(--gold); text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; }
.login-card h1 { margin: 0; font-size: 2rem; }
.login-copy { color: var(--muted); line-height: 1.6; margin-bottom: 24px; }
.login-form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.input-container { position: relative; display: flex; align-items: center; }
.input-container i { position: absolute; left: 16px; color: var(--muted); pointer-events: none; }
.input { width: 100%; border-radius: 14px; border: 1px solid var(--muted); background: rgba(7, 15, 29, 0.95); color: var(--text); padding: 14px 16px 14px 44px; transition: border-color 0.2s, box-shadow 0.2s; }
.input[type="password"] { width: 100%; border-radius: 14px; border: 1px solid var(--muted); background: rgba(7, 15, 29, 0.95); color: var(--text); padding: 14px 16px 14px 44px; transition: border-color 0.2s, box-shadow 0.2s; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(61, 161, 255, 0.2); }
.btn-primary, .btn-inline, .btn-ghost { border: 0; border-radius: 14px; cursor: pointer; transition: .2s ease; }
.btn-primary { background: linear-gradient(135deg, #1f7ef1, #42b3ff); color: white; padding: 14px 18px; display: inline-flex; gap: 10px; align-items: center; justify-content: center; }
.btn-inline, .btn-ghost { background: rgba(61, 161, 255, 0.70); color: var(--text); padding: 10px 12px; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary:hover, .btn-inline:hover, .btn-ghost:hover, .rail-btn:hover, .btn-location:hover { transform: translateY(-1px); }

.btn-location {
    background: rgba(61, 161, 255, 0.15);
    border: 1px solid var(--line);
    color: var(--accent);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-location:hover {
    background: var(--accent);
    color: white;
}

.detail-transcript {
    margin: 12px 0 0;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
    font-size: 0.9em;
    color: var(--muted-card-text);
}

/* AI Notes Styling */
.ai-notes-box {
    background: rgba(61, 161, 255, 0.08);
    border: 1px solid rgba(61, 161, 255, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ai-notes-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #103765;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ai-notes-header i {
    color: var(--accent);
    font-size: 1.1rem;
}

.ai-notes-body {
    font-size: 1rem;
    line-height: 1.5;
    color: #333;
    margin-bottom: 12px;
}

.ai-notes-footer {
    font-size: 0.8rem;
    color: var(--muted-card-text);
    font-style: italic;
    border-top: 1px solid rgba(61, 161, 255, 0.15);
    padding-top: 8px;
}
.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; }
.alert.danger { background: rgba(255, 92, 128, 0.12); border: 1px solid rgba(255, 92, 128, 0.25); color: #ffd8e1; }
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.top-filters {
    position: relative; inset: auto; z-index: 1010;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 10px 20px; border-bottom: 1px solid var(--line); border-radius: 0;
    background: linear-gradient(180deg, rgba(18, 32, 58, 0.92), rgba(10, 20, 38, 0.82));
}
.top-filters::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(61, 161, 255, 0.5), transparent);
}
.brand-inline { display: flex; align-items: center; gap: 0; }
.brand-inline .logo { width: 94px; height: 75px; padding-right: 14px; object-fit: contain; object-position: center; flex-shrink: 0; transform: scale(1.15); transform-origin: center; }
.brand-titles { display: flex; flex-direction: column; line-height: 1.15; padding-left: 14px; border-left: 1px solid var(--line); }
.brand-title { font-size: 1.02rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text); }
.brand-sub { font-size: 0.72rem; color: var(--muted); letter-spacing: 0.05em; }

.header-center { display: flex; align-items: center; gap: 16px; }
.live-badge {
    display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
    border: 1px solid var(--line); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em;
    text-transform: uppercase; white-space: nowrap; transition: all 0.3s ease;
}
.live-badge .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); transition: background 0.3s ease; }
.live-badge.is-live { background: rgba(30, 200, 146, 0.12); border-color: rgba(30, 200, 146, 0.35); color: var(--success); }
.live-badge.is-live .live-dot { background: var(--success); animation: livePulse 1.8s infinite; }
.live-badge.is-off { background: rgba(144, 167, 198, 0.08); color: var(--muted); }
.live-badge.is-off .live-dot { background: var(--muted); animation: none; }
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(30, 200, 146, 0.55); }
    70% { box-shadow: 0 0 0 7px rgba(30, 200, 146, 0); }
    100% { box-shadow: 0 0 0 0 rgba(30, 200, 146, 0); }
}

.user-dropdown-container { display: flex; align-items: center; gap: 12px; }
.user-chip {
    display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 5px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); color: var(--text);
    cursor: pointer; transition: all 0.18s ease;
}
.user-chip:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(61, 161, 255, 0.4); }
.user-chip .user-name { font-size: 0.88rem; font-weight: 500; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .fa-chevron-down { font-size: 0.7rem; color: var(--muted); }
.user-initials {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(180deg, var(--accent), #2b8be6); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}
.dropdown { position: relative; }
.dropdown-toggle { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    background: var(--bg-elev);
    backdrop-filter: blur(18px);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    padding: 8px;
    z-index: 1100;
}
.dropdown.show .dropdown-menu { display: flex; }
.dropdown-item {
    padding: 10px 14px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
    color: var(--text);
    font-size: 0.9rem;
}
.dropdown-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--accent); }
.main-content { display: flex; flex: 1; overflow: hidden; position: relative; }
.left-rail { position: relative; top: auto; left: auto; z-index: 1010; width: 114px; border-radius: 0; border-top: 0; border-bottom: 0; padding: 12px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.rail-btn {
    width: 88px;
    height: 78px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 8px;
}
.rail-btn i { font-size: 1.35rem; transition: transform 0.2s ease; }
.rail-btn span { font-size: 0.68rem; font-weight: 500; text-align: center; }
.rail-btn:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line); color: var(--text); }
.rail-btn:hover i { transform: scale(1.08); }
.rail-btn.active {
    border-color: rgba(61, 161, 255, 0.35);
    color: var(--accent);
    background: rgba(61, 161, 255, 0.12);
    box-shadow: inset 0 0 12px rgba(61, 161, 255, 0.12);
}
.rail-footer {
    margin-top: auto;
    padding-top: 16px;
    padding-bottom: 6px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-top: 1px solid var(--line);
}
.rail-footer img { width: 62px; height: auto; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.08); }
.rail-country { font-size: 0.6rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.cr-flag {
    width: 60px;
    height: 36px;
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}
.cr-flag .stripe { width: 100%; flex: 1; }
.cr-flag .stripe.blue { background: #002B7F; }
.cr-flag .stripe.white { background: #FFFFFF; }
.cr-flag .stripe.red { background: #EF3340; flex: 2; }
.floating-panel-stack { position: relative; top: auto; left: auto; bottom: auto; width: 420px; z-index: 1000; pointer-events: auto; transition: width 0.3s ease; }
.floating-panel-stack.collapsed { width: 0; }
.floating-panel-stack.collapsed .side-panel { transform: translateX(-420px); opacity: 0; }
.floating-panel-stack.collapsed .panel-collapse-btn { right: -24px; border-left: 1px solid var(--line); border-radius: 8px; }

.panel-collapse-btn {
    position: absolute;
    top: 50%;
    right: -12px;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    color: var(--muted);
    cursor: pointer;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(18px);
    transition: all 0.2s ease;
}
.panel-collapse-btn:hover {
    color: var(--accent);
    padding-left: 4px;
}
.side-panel { position: absolute; inset: 0; border-radius: 0; border-top: 0; border-bottom: 0; padding: 0; opacity: 0; transform: translateX(-18px); transition: .24s ease; pointer-events: none; overflow: hidden; display: flex; flex-direction: column; }
.side-panel.visible { opacity: 1; transform: translateX(0); pointer-events: auto; }
.panel-wide { width: 760px; }
.map-wrapper { flex: 1; position: relative; background: #000; }
.map-wrapper::before, .map-wrapper::after { content: ""; position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.map-wrapper::before { width: 40px; background: linear-gradient(to right, rgba(8, 17, 31, 0.8), transparent); }
.map-wrapper::after { height: 40px; background: linear-gradient(to bottom, rgba(8, 17, 31, 0.8), transparent); }
#map { position: absolute; inset: 0; }
.panel-header-fixed { padding: 20px 20px 10px; border-bottom: 1px solid var(--line); background: var(--bg-elev); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 1.1rem; }

/* Botones + contador del header del panel de incidentes, con el mismo lenguaje que los chips
   del header superior (glass tenue, borde fino, muted). */
#panel-incidents .panel-head .btn-ghost {
    width: 34px; height: 34px; padding: 0; justify-content: center; font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    color: var(--muted);
    border-radius: 11px;
}
#panel-incidents .panel-head .btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); transform: translateY(-1px); }
#panel-incidents .panel-head .js-register-incident:hover { background: rgba(255, 92, 128, 0.14); border-color: rgba(255, 92, 128, 0.4); }
#panel-incidents .panel-head-buttons { display: flex; gap: 8px; }

/* Selector de niveles como control segmentado: rectangular, ancho parejo, todo en una línea. */
#panel-incidents .criticity-filters { flex-wrap: nowrap; align-items: stretch; gap: 8px; }
#panel-incidents .criticity-pill { flex: 1 1 0; min-width: 0; }
#panel-incidents .criticity-pill span {
    width: 100%; justify-content: center;
    border-radius: 10px; padding: 7px 4px;
    font-size: 0.72rem; font-weight: 600;
}
#panel-incidents .criticity-pill input:checked + span { color: #000; }
#panel-incidents .criticity-filters .pill.danger {
    flex: 0 0 auto; align-self: center; white-space: nowrap;
    border-radius: 10px; padding: 7px 11px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.filters-group {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 12px 6px 14px; border-radius: 14px;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.filters-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.filters-grid { display: flex; gap: 8px; align-items: center; }
.toggle-pill { position: relative; cursor: pointer; }
.toggle-pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-pill i {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 11px;
    color: var(--muted);
    transition: all 0.18s ease;
    font-size: 1.05rem;
}
.toggle-pill:hover i { background: rgba(255, 255, 255, 0.1); color: var(--text); transform: translateY(-1px); }
.toggle-pill input:checked + i {
    background: linear-gradient(180deg, var(--accent), #2b8be6);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(61, 161, 255, 0.35);
}

.layer-combo { position: relative; }
.layer-combo-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 12px;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
    border-radius: 11px; color: var(--muted); cursor: pointer;
    font-size: 0.82rem; font-weight: 600; white-space: nowrap;
    transition: all 0.18s ease;
}
.layer-combo-trigger i:first-child { font-size: 1.05rem; }
.layer-combo-caret { font-size: 0.7rem; opacity: 0.7; transition: transform 0.18s ease; }
.layer-combo:hover .layer-combo-trigger { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.layer-combo.is-open .layer-combo-caret { transform: rotate(180deg); }
.layer-combo.is-on .layer-combo-trigger {
    background: linear-gradient(180deg, var(--accent), #2b8be6);
    color: white; border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(61, 161, 255, 0.35);
}
.layer-combo.is-toggle { cursor: pointer; }
.layer-combo.is-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
/* Cámara fuera de línea: se sigue viendo dónde está, pero se lee de un vistazo que no sirve. */
.camera-marker-offline { filter: grayscale(1); opacity: 0.55; }

/* --- Ficha de cámara del mapa ---
   Va dentro de un InfoWindow de Google, que impone su propio fondo blanco y su tipografía, así
   que los colores se fijan aquí en vez de heredarlos del tema oscuro. */
.camera-card { min-width: 232px; max-width: 280px; color: #0f1a2e; font-size: 13px; line-height: 1.45; }

/* Cabecera: va en la fila del botón de cerrar del InfoWindow, para que el nombre quede a su
   misma altura y no debajo. */
.camera-card-head { display: flex; align-items: center; gap: 8px; color: #0f1a2e; }
.camera-card-icon {
    flex: none; width: 26px; height: 26px; border-radius: 8px;
    display: grid; place-items: center; background: #e8f1fb; color: #1f6fbf; font-size: 12px;
}
.camera-card-name { font-weight: 650; font-size: 13.5px; word-break: break-word; }
.camera-card-meta { display: flex; align-items: center; gap: 6px; }
.camera-card-state {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; letter-spacing: 0.02em; color: #4c5d77;
}
.camera-card-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #1f9d55; }
.camera-card-state.is-offline::before { background: #98a3b3; }
.camera-card-flag {
    padding: 1px 6px; border-radius: 999px;
    background: #fdf1d6; color: #8a5b00; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
}
.camera-card-specs {
    margin: 9px 0 0; padding: 9px 0 0; border-top: 1px solid #e3e9f2;
    display: grid; grid-template-columns: auto 1fr; gap: 4px 12px;
}
.camera-card-specs dt { color: #6b7a91; font-size: 11.5px; }
.camera-card-specs dd { margin: 0; font-variant-numeric: tabular-nums; }
.camera-card-action {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    width: 100%; margin-top: 12px; padding: 8px 12px;
    border: 0; border-radius: 8px; cursor: pointer;
    background: linear-gradient(180deg, var(--accent), #2b8be6); color: #fff;
    font-size: 13px; font-weight: 600;
}
.camera-card-action:hover { filter: brightness(1.06); }
.camera-card-action:disabled { background: #dfe5ee; color: #8d99ab; cursor: not-allowed; }

/* --- Cámaras dentro del panel de evidencia --- */
.incident-cameras { margin-bottom: 12px; }
.incident-cameras-loading, .incident-cameras-empty { color: var(--muted); font-size: 0.82rem; margin: 0 0 8px; }
.incident-cameras-list { display: flex; flex-direction: column; gap: 6px; }
.incident-camera {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 7px 10px; border-radius: 9px; cursor: pointer; text-align: left;
    background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); color: inherit;
}
.incident-camera:hover { background: rgba(61, 161, 255, 0.12); border-color: var(--accent); }
.incident-camera:disabled { opacity: 0.5; cursor: not-allowed; }
.incident-camera-icon {
    flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
    background: rgba(61, 161, 255, 0.16); color: var(--accent); font-size: 0.78rem;
}
.incident-camera.is-assigned .incident-camera-icon { background: rgba(255, 176, 46, 0.18); color: #ffb02e; }
.incident-camera.is-offline .incident-camera-icon { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
.incident-camera-text { flex: 1; min-width: 0; }
.incident-camera-name {
    font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.incident-camera-meta {
    display: flex; align-items: center; gap: 6px; margin-top: 1px;
    font-size: 0.71rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.incident-camera-tag {
    padding: 0 5px; border-radius: 999px; font-size: 0.63rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    background: rgba(255, 176, 46, 0.16); color: #ffb02e;
}
.layer-combo-menu {
    display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
    min-width: 190px; padding: 8px;
    background: var(--bg-elev, #0b1628); border: 1px solid var(--line);
    border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
.layer-combo.is-open .layer-combo-menu { display: block; }
.combo-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 8px; border-radius: 8px; cursor: pointer;
    color: var(--text); font-size: 0.82rem;
}
.combo-row:hover { background: rgba(255, 255, 255, 0.06); }
.combo-row input { accent-color: var(--accent); width: 15px; height: 15px; }
.combo-main { font-weight: 600; }
.combo-group-label {
    font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--muted); font-weight: 600; padding: 8px 8px 4px;
    margin-top: 4px; border-top: 1px solid var(--line);
}
.combo-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.combo-dot.critica { background: #f5334f; }
.combo-dot.alta { background: #ff8c42; }
.combo-dot.media { background: var(--warning); }
.combo-dot.baja { background: var(--success); }

.incident-filters { display: grid; gap: 12px; margin-bottom: 10px; }
.dark-input { background: rgba(0, 0, 0, 0.3) !important; border-color: var(--line) !important; }
.criticity-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.criticity-pill { position: relative; }
.criticity-pill input { position: absolute; opacity: 0; }
.criticity-pill span { display: inline-flex; align-items: center; border-radius: 999px; border: 1px solid var(--line); padding: 6px 12px; color: var(--muted); background: rgba(255,255,255,.02); cursor: pointer; font-size: 0.75rem; transition: all 0.2s; }
.criticity-pill input:checked + span { color: var(--text); border-color: rgba(255, 255, 255, 0.4); }

.criticity-pill.critica input:checked + span { background: #f5334f; color: white; border-color: #f5334f; }
.criticity-pill.alta input:checked + span { background: #ff8c42; color: white; border-color: #ff8c42; }
.criticity-pill.media input:checked + span { background: var(--warning); color: #000; border-color: var(--warning); }
.criticity-pill.baja input:checked + span { background: var(--success); color: white; border-color: var(--success); }
.criticity-pill.all input:checked + span { background: var(--accent); color: white; border-color: var(--accent); }

.scrollable-list { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 14px; }
.case-list { display: grid; gap: 14px; align-content: start; }
.case-card, .prediction-card { border-radius: 20px; padding: 16px; background: var(--bg-card); color: var(--text-info-card); border: 1px solid var(--line); cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.case-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.case-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.case-card.muted { background: var(--muted-card); color: var(--muted-card-text); }
/* Resalta la tarjeta que cambió en vivo (payload Mercure) unos segundos. */
.case-card.just-changed { animation: caseChanged 2.5s ease-out; }
@keyframes caseChanged {
    0% { box-shadow: 0 0 0 2px var(--accent), 0 0 16px 2px rgba(61, 161, 255, 0.55); }
    100% { box-shadow: 0 0 0 0 transparent; }
}
.case-top, .case-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.case-id {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
    font-size: .82rem; font-weight: 700; letter-spacing: .02em;
    color: #103765;
    background: rgba(61, 161, 255, 0.10);
    border: 1px solid rgba(61, 161, 255, 0.22);
    padding: 3px 9px; border-radius: 8px;
}
.case-id i { font-size: .7rem; opacity: .65; }
.case-card h3, .prediction-card h3 { margin: 12px 0 8px; }
.case-card h3 { margin: 10px 0 8px; font-size: .98rem; font-weight: 700; line-height: 1.3; letter-spacing: .01em; color: #0f2b52; }
.case-card p, .prediction-card p { margin: 0 0 10px; color: var(--text-info-card); line-height: 1.5; }

/* Tarjeta de incidente (issue #52): clasificación IA, estado, resumen y última actualización. */
.case-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.case-classification {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 9px; border-radius: 7px; font-size: .72rem; font-weight: 600;
    background: rgba(61, 161, 255, .12); color: #103765;
    border: 1px solid rgba(61, 161, 255, .22);
}
.case-classification i { font-size: .72rem; opacity: .85; }
.case-classification.is-pending {
    background: rgba(120, 127, 135, .12); color: var(--muted-card-text);
    border-color: rgba(120, 127, 135, .24); font-style: italic;
}
.case-status {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 9px; border-radius: 7px; font-size: .72rem; font-weight: 600;
    background: rgba(16, 55, 101, .06); color: var(--text-info-card);
    border: 1px solid rgba(16, 55, 101, .14);
}
.case-status::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent); opacity: .8;
}
.case-summary { margin: 0 0 10px; color: var(--text-info-card); line-height: 1.5; font-size: .9rem; }
.case-meta { border-top: 1px solid rgba(16, 55, 101, .08); padding-top: 9px; margin-top: 2px; }
.case-updated {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
    font-size: .72rem; color: var(--muted-card-text);
    background: rgba(16, 55, 101, .05); border: 1px solid rgba(16, 55, 101, .10);
    padding: 3px 8px; border-radius: 7px;
}
.case-updated i { opacity: .8; }
.case-ago {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: .72rem; font-weight: 600; color: #103765; white-space: nowrap;
}
.case-ago i { font-size: .66rem; opacity: .7; }
.pill { display: inline-flex; align-items: center; padding: 8px 10px; border-radius: 999px; font-size: .82rem; }
.pill.danger { background: rgba(255, 92, 128, .14); color: #ffdce5; }
.pill.info { background: rgba(61, 161, 255, .14); color: #cde6ff; }
.pill.info.black { background: rgba(61, 161, 255, .14); color: var(--text-info-card); }
.priority { border-radius: 7px; padding: 5px 11px; font-size: .72rem; font-weight: 600; color: #000; }
.priority.critica { background: #f5334f; }
.priority.alta { background: #ff8c42; }
.priority.media { background: #f8bc3a; }
.priority.baja { background: #1ec892; }
.incident-closed-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 92, 128, .16);
    color: var(--danger);
    border: 1px solid rgba(255, 92, 128, .35);
    border-radius: 10px;
    font-weight: 600;
    font-size: .9rem;
}
/* El detalle vive siempre dentro de una ventana flotante (issue #55): llena su ventana en vez
   de posicionarse como panel al costado de la lista. */
.incident-detail-card {
    border-radius: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: Arial, sans-serif;
    font-size: 1em;
    background: var(--bg-card);
    color: var(--text-card);
}
.detail-tools {
    display: flex;
    gap: 8px;
}
.incident-detail-card .panel-header-fixed {
    background: var(--muted-card);
    color: var(--text-card);
    border-bottom: 1px solid rgba(0,0,0,0.1);
}
.incident-detail-card .panel-head h2 { color: var(--text-card); }
.incident-detail-card .btn-ghost { color: var(--text-card); }

.incident-detail-card .scrollable-list {
    flex: 1;
    overflow-y: auto;
    align-content: start;
}
.detail-section-v2 {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: 3px solid var(--accent);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.detail-section-v2.is-ia { border-left-color: var(--accent); }
.detail-section-v2.is-device { border-left-color: var(--warning); }
.detail-section-v2.is-agent { border-left-color: var(--success); }
.detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: .92em;
}
.detail-agent {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    color: var(--text-card);
}
.detail-agent strong { font-weight: 600; }
.detail-agent i { color: var(--muted-card-text); }
.detail-section-v2.is-ia .detail-agent i { color: var(--accent); }
.detail-section-v2.is-device .detail-agent i { color: var(--warning); }
.detail-section-v2.is-agent .detail-agent i { color: var(--success); }
.detail-kind {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted-card-text);
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 7px;
    border-radius: 999px;
}
.detail-date { color: var(--muted-card-text); font-size: .8rem; white-space: nowrap; }
.detail-content p {
    margin: 0;
    line-height: 1.5;
    color: var(--text-card);
}
.detail-multimedia {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}
.multimedia-transcript {
    font-style: italic;
    color: var(--text-card);
    font-size: 0.9em;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
.modal-overlay.visible {
    display: flex;
}
.modal-content {
    position: relative;
    padding: 40px 20px 20px;
    max-width: 90%;
    max-height: 90%;
    background: var(--bg-elev);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}
.multimedia-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--muted-card);
    border-radius: 6px;
    color: var(--text-info-card);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}
.multimedia-item:hover {
    background: #d0d2d9;
}
.detail-input-container {
    padding: 16px;
    background: var(--muted-card);
    border-top: 1px solid rgba(0,0,0,0.1);
}

.new-updates-badge {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #007bff;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    z-index: 100;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    gap: 8px;
    border: none;
}
.new-updates-badge.is-visible { display: flex; animation: badgeIn 0.2s ease; }
@keyframes badgeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.new-updates-badge:hover {
    background: #0056b3;
    transform: translateX(-50%) translateY(-2px);
}
.detail-input-container .input {
    background: #fff !important;
    color: #000 !important;
    border-radius: 10px;
}
.detail-input-container {
    position: relative;
}
.detail-spinner {
    position: absolute;
    right: 30px;
    bottom: 28px;
    color: var(--muted-card-text);
    display: none;
}

/* Resumen (IA o denuncia) siempre visible en el header del detalle (issue #53).
   El header del detalle es de fondo claro, así que el texto va en tonos oscuros. */
.detail-summary {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(16, 55, 101, 0.06);
    border: 1px solid rgba(16, 55, 101, 0.15);
}
.detail-summary-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #103765;
    margin-bottom: 6px;
}
.detail-summary-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #333;
    max-height: 8.5em;
    overflow-y: auto;
}
.detail-dates {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
    font-size: 0.74rem;
    color: var(--muted-card-text);
}
.detail-dates i { margin-right: 4px; opacity: 0.8; }

/* Nombre de unidad accionable: se comporta como enlace y centra el mapa (issue #53). */
.detail-agent-name {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    text-align: left;
}
.detail-agent-name:hover { text-decoration: underline; }

/* Campo de nuevo detalle: textarea multilínea + botón enviar (issue #53). */
.detail-input-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.detail-input-form .js-add-detail-input {
    flex: 1;
    min-height: 64px;
    max-height: 160px;
    resize: vertical;
    line-height: 1.4;
    font-family: inherit;
}
.detail-input-form .js-send-detail {
    flex-shrink: 0;
    height: 44px;
    width: 48px;
    padding: 0;
    justify-content: center;
}
.prediction-card { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; }
.prediction-score { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 18px; background: linear-gradient(135deg, #103765, #1d79d5); font-weight: 700; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; }
iframe { width: 100%; min-height: 70vh; border: 0; border-radius: 18px; background: #06101d; }
.settings-grid { display: grid; gap: 16px; }
.login-footer {
    position: absolute;
    bottom: 32px;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 32px;
}
.footer-grid {
    display: flex;
    gap: 40px;
    align-items: center;
    color: var(--muted);
    font-size: 0.9rem;
}
.footer-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-item i {
    color: var(--text);
}
.footer-item a:hover {
    color: var(--text);
    text-decoration: underline;
}
.footer-logo {
    width: 24px;
    height: 24px;
}

/* Google Maps InfoWindow Overrides */
.gm-style-iw-c {
    background-color: #fff !important;
    border: 1px solid var(--line) !important;
}

.gm-style-iw-d {
    overflow: hidden !important;
    color: #111 !important;
}

.gm-style-iw-tc::after {
    background: #fff !important;
}

/* Classic Checklist Modal */
.classic-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
}

.classic-modal-overlay.visible {
    display: flex;
}

.classic-modal {
    background: #fff;
    color: #333;
    width: 600px;
    max-width: 95%;
    max-height: 80vh;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.classic-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.classic-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #222;
}

.classic-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.classic-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8f9fa;
}

.classic-btn {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    transition: all 0.2s;
}

.classic-btn:hover {
    background: #f0f0f0;
}

.classic-btn-primary {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.classic-btn-primary:hover {
    background: #0069d9;
}

.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.closure-form-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.indicators-container {
    display: flex;
    flex-direction: column;
}

.closure-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.closure-form-field label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #444;
}

.closure-form-field textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    background: #f9f9f9;
}

.closure-form-field textarea:focus {
    outline: none;
    border-color: #007bff;
    background: #fff;
}

.checklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    transition: background 0.2s;
}

.checklist-item:hover {
    background: #fcfcfc;
}

.checklist-item-text {
    flex: 1;
    margin-right: 15px;
    font-size: 0.95rem;
}

.checklist-item-actions {
    display: flex;
    gap: 8px;
}

.checklist-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.checklist-action-btn.check:hover {
    background: #e6ffed;
    color: #28a745;
    border-color: #28a745;
}

.checklist-action-btn.reject:hover {
    background: #fff5f5;
    color: #dc3545;
    border-color: #dc3545;
}

.checklist-item.checked {
    background: #f0fff4;
    border-color: #c6f6d5;
}

.checklist-item.checked .checklist-item-text {
    text-decoration: line-through;
    color: #666;
}

.checklist-item.rejected {
    background: #fff5f5;
    border-color: #fed7d7;
}

.checklist-item.rejected .checklist-item-text {
    color: #999;
}

.audit-grid-container {
    width: 100%;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    color: #333;
    background: #fff;
    min-width: 1200px;
}

.audit-table th, .audit-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.audit-table th {
    background: #f4f4f4;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.audit-table tr:nth-child(even) {
    background: #f9f9f9;
}

.audit-table tr:hover {
    background: #f1f1f1;
}

.audit-table .cell-datetime { width: 150px; }
.audit-table .cell-agent { width: 180px; }
.audit-table .cell-type { width: 150px; }
.audit-table .cell-description { min-width: 300px; }

@media (max-width: 1200px) {
    .floating-panel-stack { width: 350px; }
}
@media (max-width: 900px) {
    .app-shell { display: block; overflow: auto; }
    .main-content { flex-direction: column; height: auto; }
    .left-rail { width: 100%; grid-auto-flow: column; justify-content: center; border-left: 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .floating-panel-stack { width: 100%; height: 500px; position: relative; }
    .map-wrapper { height: 400px; width: 100%; }
    .login-container { flex-direction: column; align-items: center; }
    .login-info { text-align: center; }
    .info-grid { justify-content: center; }
    .footer-grid { flex-direction: column; gap: 15px; text-align: center; }
    .login-footer { bottom: 20px; }
}

/* --- Evidencia (attachments) en el panel de detalle --- */
.evidence-section {
    margin: 12px 0;
    padding: 12px 14px;
    background: rgba(61, 161, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.evidence-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #103765;
    font-weight: 600;
}
.evidence-header i { color: var(--accent); }
.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 64px);
    gap: 10px;
}
.evidence-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-elev);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.evidence-thumb:hover { transform: translateY(-2px); border-color: var(--accent); }
.evidence-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.evidence-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--accent);
    font-size: 1.4rem;
}
.evidence-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 17, 31, 0.85);
    color: var(--text);
    border-radius: 6px;
    font-size: 0.65rem;
}
.evidence-cc {
    position: absolute;
    top: 2px;
    left: 2px;
    padding: 1px 4px;
    background: var(--gold);
    color: #000;
    border-radius: 5px;
    font-size: 0.6rem;
    font-weight: 700;
}
.evidence-empty { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }

/* --- Visor modal: badge de fuente + transcript --- */
.modal-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 6px 12px;
    background: rgba(61, 161, 255, 0.15);
    color: var(--text);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}
.modal-source-badge i { color: var(--accent); }
.modal-transcript {
    max-width: 640px;
    margin: 16px auto 0;
    color: #e6eefc;
    font-style: italic;
    text-align: center;
}

/* --- Visor de cámara / stream --- */
/* --- Cámara en ventana flotante ---
   El video se abre en una ventana y no en un modal por la misma razón que las herramientas del
   incidente (#55): mirar una cámara es algo que se hace MIENTRAS se sigue trabajando en el mapa. */
.camera-window { display: flex; flex-direction: column; height: 100%; background: #000; }
.camera-window video { flex: 1; width: 100%; min-height: 0; background: #000; object-fit: contain; }
.camera-window-status:empty { display: none; }
.camera-window-status {
    margin: 0; padding: 6px 10px; background: #121c30; color: #ffb02e; font-size: 0.78rem;
}

/* Contenido de las ventanas flotantes (WinBox) del incidente, issue #55: el detalle y cada
   herramienta llenan su ventana y se adaptan al tamaño que le dé el usuario. */
.winbox .wb-body { overflow: hidden; }
.winbox .incident-detail-card,
.winbox .incident-tool-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 0;
}
.winbox .incident-detail-card .scrollable-list {
    min-height: 0;
}
.winbox .incident-detail-card .detail-input-container {
    flex: 0 0 auto;
}

/* Herramientas del incidente (evidencia, checklist, unidades, cierre): mismo esqueleto de
   cabecera fija + cuerpo con scroll, para que las cuatro ventanas se lean igual. */
.incident-tool-card {
    background: var(--bg-card);
    color: var(--text-card);
    font-family: Arial, sans-serif;
}
.incident-tool-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--muted-card);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
.incident-tool-title {
    font-weight: 700;
    font-size: 0.95rem;
}
/* Las ventanas de herramientas son claras; el pill está pensado para los paneles oscuros. */
.incident-tool-head .pill {
    padding: 4px 10px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-info-card);
}
.incident-tool-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
}
.incident-tool-foot {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Unidades asignadas, agrupadas por institución. */
.units-group + .units-group { margin-top: 14px; }
.units-institution {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.units-count {
    margin-left: auto;
    font-weight: 700;
}
.unit-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.unit-row:hover { background: #f1f2f6; }
.unit-label { flex: 1; font-weight: 600; }
.unit-state {
    padding: 2px 8px;
    border-radius: 999px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
}
.unit-eta {
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
}

/* Ventana sin foco: se apaga al azul oscuro de los paneles de la plataforma (el del menú
   superior y el rail lateral), para que a simple vista se vea cuál es la ventana activa.
   WinBox pinta su cromo con el background de .winbox y marca la enfocada con la clase focus.
   Va opaco y no con --bg-elev: dos ventanas apagadas que se solapan acumularían su
   transparencia y dejarían un parche más oscuro en la intersección. */
.winbox:not(.focus) {
    background: #0a1426;
}
/* Apagada al azul oscuro, la ventana se confunde con el mapa nocturno. Una franja del azul de
   la ventana activa marca el borde superior del header y la vuelve a delimitar. Va como sombra
   interior y no como border-top para no comerle alto a la barra de título. */
.winbox:not(.focus) .wb-header {
    box-shadow: inset 0 3px 0 #0050ff;
}

/* Ventana minimizada con una actualización pendiente de su incidente: se colorea en naranja. */
.winbox.has-update {
    background: #ff8c42 !important;
}
.winbox.has-update .wb-header {
    background: #ff8c42 !important;
    animation: wb-update-pulse 1.1s ease-in-out infinite;
}
@keyframes wb-update-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
