:root {
    --bg-dark: #070a12;
    --card-dark: #0f172a;
    --card-light: #182238;
    --border-color: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --color-red: #ef4444;
    --color-green: #10b981;
    --color-blue: #3b82f6;
    --color-orange: #f97316;
    --color-yellow: #eab308;
    --color-purple: #a855f7;
    --color-cyan: #06b6d4;
}

[data-theme="light"] {
    --bg-dark: #f1f5f9;
    --card-dark: #ffffff;
    --card-light: #f8fafc;
    --border-color: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
}

/* APLICACIÓN GLOBAL DE FUENTE MONTSERRAT */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    user-select: none;
}

/* OCULTAR BARRAS DE DESPLAZAMIENTO EN TODO EL SISTEMA */
html, body, div, main, aside, section, article {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE y Edge */
}

::-webkit-scrollbar {
    display: none !important; /* Chrome, Safari, Opera */
    width: 0px !important;
    height: 0px !important;
}

.hide-scrollbar {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.hide-scrollbar::-webkit-scrollbar {
    display: none !important;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* ANIMACIONES OPTIMIZADAS CON GPU */
@keyframes popIn {
    from { opacity: 0; transform: scale3d(0.96, 0.96, 1); }
    to { opacity: 1; transform: scale3d(1, 1, 1); }
}

@keyframes slideUp {
    from { transform: translate3d(0, 100%, 0); }
    to { transform: translate3d(0, 0, 0); }
}

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

@keyframes pulsePin {
    0% { transform: scale(0.95); opacity: 1; }
    50% { transform: scale(1.25); opacity: 0.7; }
    100% { transform: scale(0.95); opacity: 1; }
}

@keyframes blinkBicolor {
    0%, 49% { background-color: #ef4444; color: #ffffff; }
    50%, 100% { background-color: #10b981; color: #ffffff; }
}

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

.animated-pop { 
    animation: popIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
    will-change: transform, opacity;
}

/* PANTALLA DE CARGA CENTRADA */
.loading-screen {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 18, 0.97);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    color: #ffffff;
    text-align: center;
}

.spinner-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 18px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.12);
    border-left-color: var(--color-red);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    will-change: transform;
}

.loading-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ffffff;
}

.loading-status {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-blue);
    margin-top: 6px;
    letter-spacing: 0.8px;
}

/* HEADER */
.main-header {
    height: 54px;
    background: #04070d;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-left, .header-right { display: flex; align-items: center; gap: 0.8rem; }

.btn-menu-hamburger {
    background: var(--card-dark);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 7px 9px;
    border-radius: 6px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-menu-hamburger:hover { background: #1e293b; border-color: var(--color-blue); }
.btn-menu-hamburger span { display: block; width: 18px; height: 2px; background: var(--text-main); border-radius: 2px; }

.badge-cba { background: var(--color-red); color: white; padding: 4px 8px; font-weight: 800; font-size: 0.75rem; border-radius: 4px; }
.header-title { font-weight: 800; font-size: 0.95rem; letter-spacing: 0.5px; }

.digital-clock-card {
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: #020408;
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-weight: 800;
    color: var(--color-orange);
}
.digital-clock-card span#liveClockDisplay { font-size: 1.15rem; letter-spacing: 1px; }
.clock-unit { font-size: 0.62rem; color: var(--text-muted); font-weight: 800; }

.btn-logout-modern { 
    background: var(--color-red); 
    color: white; 
    border: none; 
    padding: 6px 12px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-size: 0.72rem; 
    font-weight: 800; 
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease;
    will-change: transform;
}
.btn-logout-modern:hover { background: #dc2626; transform: scale(1.03); }
.btn-logout-modern:active { transform: scale(0.97); }

.status-banner { background: #16a34a; color: #fff; font-size: 0.72rem; font-weight: 800; padding: 4px 10px; border-radius: 6px; }
.user-tag { font-size: 0.75rem; color: var(--color-green); font-weight: 800; }

/* MENÚ LATERAL */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 2000; }
.sidebar-menu {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: #0b1120;
    border-right: 1px solid var(--border-color);
    z-index: 2001;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    will-change: transform;
}
.sidebar-menu.active { transform: translate3d(320px, 0, 0); }
.sidebar-header { padding: 14px 16px; background: #0f172a; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.sidebar-header h3 { font-size: 0.9rem; color: var(--color-blue); font-weight: 800; }
.btn-close-sidebar { background: transparent; border: none; color: var(--text-main); font-size: 1.4rem; cursor: pointer; }
.sidebar-body { padding: 14px; overflow-y: auto; flex: 1; }
.sidebar-group { margin-bottom: 18px; }
.sidebar-group-title { font-size: 0.65rem; font-weight: 800; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.8px; }

.sidebar-btn {
    width: 100%;
    text-align: left;
    background: var(--card-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 11px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 8px;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease, border-color 0.15s ease;
    will-change: transform;
}
.sidebar-btn:hover { background: #1e293b; border-color: var(--color-blue); transform: translate3d(3px, 0, 0); }

/* PORTAL & VISTAS */
.view-main { padding: 0.8rem; height: calc(100vh - 54px); overflow-y: auto; }
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { position: relative; background: var(--card-dark); border: 1px solid var(--border-color); border-radius: 12px; padding: 2rem; width: 100%; max-width: 480px; }

.login-title { text-align: center; font-size: 1.2rem; font-weight: 800; margin-bottom: 0.3rem; color: #ffffff; }
.login-sub { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 1.2rem; font-weight: 600; }

.portal-card {
    flex: 1;
    min-width: 200px;
    padding: 20px;
    background: #0f172a;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease, border-color 0.15s ease;
    text-align: center;
    will-change: transform;
}
.portal-card:hover {
    border-color: var(--color-red);
    transform: translate3d(0, -3px, 0);
    background: #182238;
}
.portal-card:active { transform: translate3d(0, 0, 0); }
.portal-card h3 { font-size: 0.95rem; color: #ffffff; font-weight: 800; }

.form-group { margin-bottom: 0.85rem; display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.7rem; color: var(--text-muted); font-weight: 800; }
.form-input { background: #04070d; border: 1px solid var(--border-color); color: var(--text-main); padding: 9px 12px; border-radius: 6px; font-size: 0.82rem; width: 100%; outline: none; font-weight: 600; }
.form-input:focus { border-color: var(--color-blue); }
.form-row { display: flex; gap: 0.5rem; align-items: center; }

.btn-submit { 
    width: 100%; 
    background: var(--color-blue); 
    color: white; 
    border: none; 
    padding: 10px; 
    border-radius: 6px; 
    font-weight: 800; 
    cursor: pointer; 
    transition: background-color 0.15s ease, transform 0.15s ease;
    will-change: transform;
}
.btn-submit:hover { background: #2563eb; transform: translate3d(0, -1px, 0); }
.btn-submit:active { transform: translate3d(0, 0, 0); }
.btn-cancel { background: var(--border-color); color: var(--text-main); border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 0.72rem; }

/* VISTA MONITOR CUARTEL - 3 COLUMNAS */
.cuartel-three-columns { display: grid; grid-template-columns: 1.1fr 1.3fr 1.1fr; gap: 0.8rem; height: calc(100vh - 74px); }
.quadrant-card { background: var(--card-dark); border: 1px solid var(--border-color); border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; }
.quadrant-header { background: #0a0f1d; padding: 10px 14px; font-size: 0.8rem; font-weight: 800; color: var(--text-muted); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; letter-spacing: 0.5px; }
.quadrant-body { padding: 10px; flex: 1; overflow-y: auto; }

/* PERSONAL VERTICAL */
.personal-vertical-list { display: flex; flex-direction: column; gap: 8px; }
.vol-card-vertical {
    background: #090e1a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease, border-color 0.15s ease;
    will-change: transform;
}
.vol-card-vertical:hover { border-color: var(--color-blue); transform: translate3d(3px, 0, 0); background: #111a2e; }
.vol-logo { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }
.vol-info { display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.vol-rul { font-size: 0.65rem; color: var(--text-muted); font-weight: 800; }
.vol-nombre { font-size: 0.85rem; font-weight: 800; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vol-cargo { font-size: 0.68rem; color: var(--color-orange); font-weight: 800; }

.btn-delete-vol {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-red);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-delete-vol:hover { background: var(--color-red); color: #ffffff; }

/* MATERIAL MAYOR / CARROS (ESTILO SAN CARLOS) */
.company-group-block { margin-bottom: 12px; background: #0a0f1d; padding: 10px; border-radius: 8px; border: 1px solid var(--border-color); }
.company-group-title { font-size: 0.72rem; font-weight: 800; color: var(--color-blue); margin-bottom: 8px; letter-spacing: 0.5px; }
.dispatch-fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 8px; width: 100%; }

.unit-card-san-carlos {
    position: relative;
    background: #10b981;
    color: #ffffff;
    height: 98px;
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    border: none !important;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}
.unit-card-san-carlos:hover { transform: translate3d(0, -3px, 0); }
.unit-card-san-carlos:active { transform: translate3d(0, 0, 0); }

.unit-card-photo-placeholder {
    width: 100%;
    height: 52px;
    background: #04070d;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.unit-card-photo-placeholder img { width: 100%; height: 100%; object-fit: contain !important; }

.unit-card-id { font-size: 0.9rem; font-weight: 900; letter-spacing: 0.5px; }
.unit-card-status { font-size: 0.58rem; font-weight: 800; width: 100%; text-align: center; background: rgba(0,0,0,0.45); padding: 2px 0; border-radius: 4px; }

.unit-card-san-carlos.fuera { background: #475569 !important; color: #cbd5e1; }
.unit-card-san-carlos.sin-maquinista { background: #0284c7 !important; color: #ffffff; }
.unit-card-san-carlos.trayecto { animation: blinkBicolor 1s infinite; }
.unit-card-san-carlos.emergencia { background: #ef4444 !important; }

/* REGISTRO DE LLAMADOS */
.active-call-card-modern {
    background: #090e1a;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--color-red);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease;
    will-change: transform;
}
.active-call-card-modern:hover { border-color: var(--color-blue); border-left-color: var(--color-red); transform: translate3d(2px, 0, 0); }

/* CONSOLA CENTRALISTA */
.central-layout-wrapper { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0.8rem; height: calc(100vh - 74px); }
.dispatch-overview-panel { background: var(--card-dark); border: 1px solid var(--border-color); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; }
.panel-header-custom { background: #0a0f1d; color: var(--text-muted); padding: 8px 12px; font-weight: 800; font-size: 0.78rem; border-radius: 6px; margin-bottom: 10px; border: 1px solid var(--border-color); letter-spacing: 0.5px; }

.btn-trigger-dispatch-red {
    width: 100%;
    background: #ef4444;
    color: white;
    border: none;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 900;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease;
    will-change: transform;
}
.btn-trigger-dispatch-red:hover { background: #dc2626; transform: translate3d(0, -2px, 0); }
.btn-trigger-dispatch-red:active { transform: translate3d(0, 0, 0); }

.alarm-declaration-box { margin-top: 8px; background: #04070d; border: 1px dashed var(--color-orange); padding: 10px; border-radius: 8px; }
.btn-alarm { width: 100%; background: var(--color-orange); color: white; border: none; padding: 8px; font-weight: 800; border-radius: 6px; cursor: pointer; font-size: 0.75rem; }
.btn-req-66-global { width: 100%; margin-top: 6px; background: #d97706; color: white; border: none; padding: 8px; font-weight: 800; border-radius: 6px; cursor: pointer; font-size: 0.75rem; }
.btn-req-66-card { background: #d97706; color: white; border: none; padding: 5px 9px; border-radius: 5px; font-weight: 800; cursor: pointer; font-size: 0.7rem; transition: background-color 0.15s ease; }
.btn-req-66-card:hover { background: #b45309; }
.btn-63-card { background: var(--color-green); color: white; border: none; padding: 5px 9px; border-radius: 5px; font-weight: 800; cursor: pointer; font-size: 0.7rem; transition: background-color 0.15s ease; }
.btn-63-card:hover { background: #059669; }
.btn-add-unit-card { background: var(--color-blue); color: #ffffff; border: none; padding: 5px 9px; border-radius: 5px; font-weight: 800; cursor: pointer; font-size: 0.7rem; transition: background-color 0.15s ease; }
.btn-add-unit-card:hover { background: #2563eb; }
.btn-add-temp { background: var(--color-blue); color: white; border: none; padding: 6px 12px; font-size: 0.72rem; font-weight: 800; border-radius: 6px; cursor: pointer; }

/* LAYOUT PASO 2: MAPA MÁS GRANDE Y CUADRADO EN DESPACHO */
.step2-split-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    align-items: center;
    margin-top: 8px;
}

.step2-inputs-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #04070d;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.step2-map-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.step2-instructions-box {
    margin-top: 6px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.25);
    padding: 10px;
    border-radius: 6px;
}

/* CONTENEDOR AMPLIO Y COMPLETAMENTE CUADRADO PARA MAPA EN PASO 2 */
.central-map-preview-full {
    width: 100%;
    max-width: 520px;
    height: 520px;
    border-radius: 12px;
    position: relative;
    cursor: crosshair;
    background: #020408;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* CONTENEDOR AMPLIO Y CUADRADO PARA EL MODAL "VER MAPA" */
.modal-mapa-ampliado {
    max-width: 740px !important;
    width: 92%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.map-container-quadrant-large {
    width: 100%;
    max-width: 680px;
    height: 680px;
    position: relative;
    overflow: hidden;
    background: #020408;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* MODAL SLIDE UP DESPACHO PASOS */
.slide-up-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 3000;
    display: flex;
    align-items: flex-end;
}
.slide-up-card {
    width: 100%;
    height: 94vh;
    background: #090e1a;
    border-top: 3px solid var(--color-red);
    border-radius: 18px 18px 0 0;
    padding: 20px;
    animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    flex-direction: column;
    will-change: transform;
}
.step-slide-body { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
.step-badge-header { font-size: 0.88rem; font-weight: 800; color: var(--color-blue); margin-bottom: 14px; background: rgba(59,130,246,0.12); padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(59,130,246,0.25); letter-spacing: 0.5px; }

/* PASO 1 CLAVES */
.grid-claves-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; overflow-y: auto; padding: 4px; }
.btn-clave-step {
    padding: 12px 8px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 800;
    color: white;
    border: none;
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}
.btn-clave-step:hover { transform: translate3d(0, -3px, 0); }
.btn-clave-step.active-selected { outline: 3px solid #ffffff !important; transform: scale(1.03); }

/* MAPAS Y PREVIEW */
.map-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #020408;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.map-image-full { width: 100%; height: 100%; object-fit: contain !important; display: block; pointer-events: none; }

.map-pin { position: absolute; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; z-index: 50; pointer-events: none; }
.pin-pulse { width: 16px; height: 16px; background: var(--color-red); border: 2px solid #ffffff; border-radius: 50%; animation: pulsePin 1.4s infinite; }
.pin-label { background: #090e1a; color: #ffffff; font-size: 0.72rem; padding: 4px 8px; border-radius: 6px; font-weight: 800; border: 1px solid var(--color-red); margin-top: 2px; }

/* PASO 3 CARROS MÁS GRANDES */
.matrix-large-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; width: 100%; }
.unit-card-large {
    position: relative;
    background: #10b981;
    color: #ffffff;
    height: 125px;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    border: none !important;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}
.unit-card-large:hover { transform: translate3d(0, -3px, 0); }
.unit-card-large .unit-card-photo-placeholder { height: 70px; }
.unit-card-large .unit-card-id { font-size: 1.05rem; }

/* MODALES SÓLIDOS Y AMPLIOS CON X */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.82); display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 1rem; }
.modal-card { position: relative; background: var(--card-dark); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.5rem; width: 100%; max-width: 440px; }

.step-dispatch-card {
    position: relative;
    max-width: 980px !important;
    width: 94%;
    max-height: 90vh;
    overflow-y: auto;
    background: #090e1a;
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: 14px;
}

.btn-modal-x {
    position: absolute;
    top: 14px;
    right: 14px;
    background: #1e293b;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease;
    will-change: transform;
}
.btn-modal-x:hover { background: var(--color-red); color: white; border-color: var(--color-red); transform: rotate(90deg); }

.btn-delete-unit-modal {
    width: 100%;
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-red);
    border: 1px solid var(--color-red);
    padding: 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 12px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-delete-unit-modal:hover { background: var(--color-red); color: #ffffff; }

/* ESTILOS FICHA FÍSICA PARTE DE OPERACIONES FINALES (POF) */
.pof-paper-template {
    background: #ffffff;
    color: #000000;
    padding: 20px;
    border-radius: 6px;
    font-family: 'Montserrat', sans-serif;
}
.pof-header-title { font-size: 1rem; font-weight: 900; text-align: center; color: #000; }
.pof-header-subtitle { font-size: 0.72rem; font-weight: 700; text-align: center; color: #475569; margin-bottom: 10px; }
.pof-sub-header { font-size: 0.72rem; font-weight: 900; background: #e2e8f0; color: #0f172a; padding: 4px 8px; margin-top: 8px; }
.pof-section-grid { display: grid; gap: 8px; font-size: 0.72rem; padding: 6px; border: 1px solid #cbd5e1; }

/* TABLA ASISTENCIA DIGITAL */
.asistencia-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; text-align: left; }
.asistencia-table th { background: #0a0f1d; color: var(--color-blue); padding: 8px; border: 1px solid var(--border-color); }
.asistencia-table td { padding: 8px; border: 1px solid var(--border-color); background: #04070d; }

/* CONSOLA MAQUINISTA */
.maquinista-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; height: calc(100vh - 74px); }
.maquinista-map-panel, .maquinista-controls-panel { background: var(--card-dark); border-radius: 10px; border: 1px solid var(--border-color); padding: 12px; display: flex; flex-direction: column; }
.driver-info-box { background: #04070d; padding: 10px; border-radius: 6px; border: 1px solid var(--border-color); }
.maq-dispatch-info-box { background: #04070d; border: 1px solid var(--border-color); border-left: 4px solid var(--color-red); padding: 10px; border-radius: 6px; margin-top: 8px; }
.radio-keys-compact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.btn-radio-short { 
    background: #090e1a; 
    color: #ffffff; 
    border: 1px solid var(--border-color); 
    padding: 10px 0; 
    font-size: 0.92rem; 
    font-weight: 800; 
    border-radius: 6px; 
    cursor: pointer; 
    text-align: center; 
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease, border-color 0.15s ease;
    will-change: transform;
}
.btn-radio-short:hover { background: #1e293b; border-color: var(--color-blue); transform: translate3d(0, -2px, 0); }
.btn-radio-short:active { transform: translate3d(0, 0, 0); }

.claves-scroll-container { max-height: 540px; overflow-y: auto; padding-right: 6px; }
.clave-item-card { background: #04070d; border: 1px solid var(--border-color); padding: 12px 14px; border-radius: 8px; margin-bottom: 8px; display: flex; align-items: center; gap: 14px; }
.clave-badge-num { background: var(--color-blue); color: white; font-weight: 800; font-size: 0.85rem; padding: 6px 12px; border-radius: 6px; min-width: 90px; text-align: center; }
.clave-desc-txt { font-size: 0.82rem; color: var(--text-main); font-weight: 600; }

.anb-scroll-container { max-height: 560px; overflow-y: auto; padding-right: 6px; }
.anb-category-title { font-size: 0.85rem; font-weight: 800; color: var(--color-green); letter-spacing: 0.5px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.anb-grid-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }

.anb-pdf-card { 
    background: #04070d; 
    border: 1px solid var(--border-color); 
    color: var(--text-main); 
    padding: 14px; 
    border-radius: 8px; 
    text-decoration: none; 
    font-size: 0.82rem; 
    font-weight: 800; 
    display: block; 
    text-align: center; 
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.15s ease, border-color 0.15s ease;
    will-change: transform;
}
.anb-pdf-card:hover { border-color: var(--color-green); background: #0f172a; transform: translate3d(0, -2px, 0); }

.dispatch-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 4000; display: flex; align-items: center; justify-content: center; }
.alert-box { position: relative; background: var(--card-dark); border: 2px solid var(--color-red); border-radius: 12px; padding: 1.8rem; text-align: center; width: 90%; max-width: 480px; }
.alert-title { color: var(--color-red); font-size: 1.25rem; margin-bottom: 0.6rem; font-weight: 900; }
.alert-code { font-size: 2rem; font-weight: 900; margin-bottom: 0.6rem; color: #ffffff; }
.alert-details { font-size: 0.88rem; text-align: left; margin-bottom: 1rem; }
.alert-timer { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 800; }

.progress-bar { width: 100%; height: 6px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; overflow: hidden; }
.progress-fill { width: 100%; height: 100%; background: var(--color-red); border-radius: 3px; }

.toast-container { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 10000; }
.toast-msg { background: #04070d; color: #ffffff; border: 1px solid #26334d; border-left: 4px solid var(--color-blue); padding: 10px 14px; border-radius: 6px; font-size: 0.8rem; font-weight: 800; }

@media (max-width: 900px) {
    .step2-split-layout {
        grid-template-columns: 1fr;
    }
    .central-map-preview-full {
        height: 360px !important;
    }
    .map-container-quadrant-large {
        height: 380px !important;
    }
}
/* =========================================================
   CENTRAL DE ALARMAS Y TELECOMUNICACIONES · ARC
   CAPA VISUAL 2026: temas consistentes + responsive + PWA
   ========================================================= */
:root {
    --surface-0: #070a12;
    --surface-1: #0b1120;
    --surface-2: #0f172a;
    --surface-3: #182238;
    --surface-input: #04070d;
    --surface-hover: #1e293b;
    --overlay-bg: rgba(0,0,0,0.72);
}

[data-theme="light"] {
    --surface-0: #eef2f7;
    --surface-1: #ffffff;
    --surface-2: #ffffff;
    --surface-3: #f8fafc;
    --surface-input: #f8fafc;
    --surface-hover: #e2e8f0;
    --overlay-bg: rgba(15,23,42,0.32);
}

/* Sustituye superficies oscuras que antes estaban fijas y no obedecían al tema. */
[data-theme="light"] .main-header,
[data-theme="light"] .sidebar-header,
[data-theme="light"] .sidebar-menu,
[data-theme="light"] .portal-card,
[data-theme="light"] .quadrant-header,
[data-theme="light"] .company-group-block,
[data-theme="light"] .panel-header-custom,
[data-theme="light"] .active-call-card-modern,
[data-theme="light"] .vol-card-vertical,
[data-theme="light"] .alarm-declaration-box,
[data-theme="light"] .driver-info-box,
[data-theme="light"] .maq-dispatch-info-box,
[data-theme="light"] .radio-key-card,
[data-theme="light"] .anb-pdf-card,
[data-theme="light"] .toast-msg,
[data-theme="light"] .digital-clock-card,
[data-theme="light"] .form-input,
[data-theme="light"] [style*="background:#04070d"],
[data-theme="light"] [style*="background: #04070d"],
[data-theme="light"] [style*="background:#090e1a"],
[data-theme="light"] [style*="background: #090e1a"],
[data-theme="light"] [style*="background:#0a0f1d"],
[data-theme="light"] [style*="background: #0a0f1d"] {
    background: var(--surface-3) !important;
    color: var(--text-main);
}

[data-theme="light"] .login-title,
[data-theme="light"] .portal-card h3,
[data-theme="light"] .vol-nombre,
[data-theme="light"] .alert-code,
[data-theme="light"] [style*="color:#ffffff"],
[data-theme="light"] [style*="color: #ffffff"] {
    color: var(--text-main) !important;
}

[data-theme="light"] .sidebar-btn:hover,
[data-theme="light"] .portal-card:hover,
[data-theme="light"] .vol-card-vertical:hover,
[data-theme="light"] .anb-pdf-card:hover {
    background: var(--surface-hover) !important;
}

/* Estado de conexión */
.system-health-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 9px 11px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--card-dark);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
}
.health-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-green);
    box-shadow: 0 0 10px rgba(16,185,129,.55);
    flex: 0 0 auto;
}
.health-dot.offline {
    background: var(--color-red);
    box-shadow: 0 0 10px rgba(239,68,68,.55);
}

/* Centro de administración */
.admin-center-card { max-width: 760px; }
.admin-title { color: var(--color-blue); font-size: 1.05rem; font-weight: 900; letter-spacing: .4px; }
.admin-subtitle { color: var(--text-muted); font-size: .72rem; margin: 4px 0 16px; }
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.admin-stat {
    background: var(--card-light);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    padding: 14px 10px;
    text-align: center;
}
.admin-stat strong { display: block; font-size: 1.15rem; color: var(--color-blue); }
.admin-stat span { display: block; margin-top: 4px; font-size: .6rem; color: var(--text-muted); font-weight: 800; }
.admin-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.admin-action {
    border: 1px solid var(--border-color);
    background: var(--card-light);
    color: var(--text-main);
    border-radius: 8px;
    padding: 12px;
    font-weight: 800;
    font-size: .72rem;
    cursor: pointer;
}
.admin-action:hover { border-color: var(--color-blue); transform: translateY(-1px); }
.admin-info-box {
    margin-top: 14px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: grid;
    gap: 6px;
    color: var(--text-muted);
    font-size: .72rem;
}

.unit-photo-preview {
    width: 100%;
    height: 110px;
    border: 1px dashed var(--border-color);
    background: var(--surface-input);
    border-radius: 8px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.unit-photo-preview img { display: none; width: 100%; height: 100%; object-fit: contain; }

/* Mejor experiencia táctil */
button, .portal-card, .unit-card-san-carlos, .sidebar-btn { touch-action: manipulation; }
button:focus-visible, .portal-card:focus-visible, .form-input:focus-visible { outline: 2px solid var(--color-blue); outline-offset: 2px; }

/* Tablets */
@media (max-width: 1100px) {
    .header-title { font-size: .78rem; }
    .status-banner { display: none; }
    .cuartel-three-columns { grid-template-columns: 1fr 1fr; height: auto; min-height: calc(100vh - 74px); }
    .cuartel-three-columns .quadrant-card:last-child { grid-column: 1 / -1; min-height: 320px; }
    .central-layout-wrapper { grid-template-columns: 1fr; height: auto; }
    .dispatch-overview-panel { min-height: 420px; }
    .maquinista-grid { grid-template-columns: 1fr; height: auto; }
}

/* Móviles */
@media (max-width: 700px) {
    body { overflow-x: hidden; }
    .main-header {
        height: auto;
        min-height: 58px;
        padding: 8px 10px;
        position: sticky;
        gap: 8px;
        flex-wrap: wrap;
    }
    .header-left { min-width: 0; flex: 1; gap: .45rem; }
    .header-title { font-size: .67rem; line-height: 1.2; white-space: normal; }
    .header-right { width: 100%; justify-content: space-between; gap: 6px; }
    .user-tag { max-width: 42vw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .digital-clock-card { padding: 4px 7px; }
    .btn-logout-modern { padding: 6px 8px; font-size: .62rem; }
    .view-main { height: auto; min-height: calc(100vh - 58px); padding: .55rem; }
    .login-container { min-height: 100dvh; padding: .7rem; }
    .login-card { padding: 1.15rem; }
    .portal-card { min-width: 100%; }
    .cuartel-three-columns { display: flex; flex-direction: column; height: auto; }
    .quadrant-card { min-height: 300px; }
    .central-layout-wrapper, .maquinista-grid { display: flex; flex-direction: column; height: auto; }
    .dispatch-overview-panel { min-height: 0; }
    .form-row { flex-direction: column; align-items: stretch; }
    .modal-overlay { padding: 10px; align-items: flex-start; overflow-y: auto; }
    .modal-card { max-width: 100%; margin: 10px 0; padding: 1.1rem; }
    .slide-up-card { padding: 1rem; }
    .admin-stat-grid { grid-template-columns: 1fr 1fr; }
    .admin-actions-grid { grid-template-columns: 1fr; }
    .toast-container { left: 10px; right: 10px; bottom: 10px; }
    .toast-msg { width: 100%; }
    .dispatch-fleet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .unit-card-san-carlos { min-width: 0; }
}

@media (max-width: 390px) {
    .dispatch-fleet-grid { grid-template-columns: 1fr; }
    .admin-stat-grid { grid-template-columns: 1fr; }
    .clock-unit { display: none; }
}

.discord-access-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid rgba(88,101,242,.45);
    background: rgba(88,101,242,.08);
    border-radius: 9px;
    margin: 8px 0 2px;
    text-align: left;
}
.discord-access-panel > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.discord-access-panel strong { font-size: .72rem; color: #818cf8; }
.discord-access-panel span { font-size: .64rem; color: var(--text-muted); line-height: 1.3; }
.discord-login-btn {
    flex: 0 0 auto;
    border: none;
    background: #5865f2;
    color: #fff;
    padding: 8px 11px;
    border-radius: 7px;
    font-size: .65rem;
    font-weight: 900;
    cursor: pointer;
}
@media (max-width:700px) {
    .discord-access-panel { flex-direction: column; align-items: stretch; }
    .discord-login-btn { width: 100%; }
}


/* Reloj operacional CAT */
.digital-clock-card{position:relative;display:flex;align-items:center;gap:9px;min-width:168px;padding:6px 10px;border-radius:10px;background:linear-gradient(145deg,#05070b,#0d1119);border:1px solid rgba(239,68,68,.28);box-shadow:inset 0 0 18px rgba(239,68,68,.035),0 5px 18px rgba(0,0,0,.18)}
.clock-status-dot{width:7px;height:7px;border-radius:50%;background:#ef4444;box-shadow:0 0 10px rgba(239,68,68,.8);flex:0 0 auto}
.clock-stack{display:flex;flex-direction:column;line-height:1}
.digital-clock-card span#liveClockDisplay{font-size:1.05rem;letter-spacing:1.5px;color:#f8fafc}
#liveClockDate{margin-top:4px;font-family:system-ui,sans-serif;font-size:.52rem;letter-spacing:.055em;color:#94a3b8;font-weight:800}
.clock-unit{margin-left:auto;color:#ef4444;font-size:.56rem}

/* Biblioteca documental local */
.anb-library-modal{max-width:1080px!important;width:94%!important;max-height:88vh!important}
.anb-library-head{display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--border-color);padding-bottom:13px;margin-bottom:14px}
.anb-library-kicker{display:block;color:#ef4444;font-size:.62rem;font-weight:900;letter-spacing:.12em;margin-bottom:4px}
.anb-library-head h3{font-size:1.18rem;font-weight:950;color:var(--text-main);margin:0}
.anb-library-badge{font-size:.58rem;font-weight:900;letter-spacing:.08em;padding:6px 9px;border-radius:999px;color:#fecaca;background:rgba(185,28,28,.14);border:1px solid rgba(239,68,68,.24)}
.anb-library-note{font-size:.78rem;color:var(--text-muted);margin-bottom:16px}
.anb-category-title{margin:18px 0 8px!important;padding-left:9px;border-left:3px solid #dc2626;color:var(--text-main)!important;letter-spacing:.055em}
.anb-pdf-card{position:relative;border-color:rgba(239,68,68,.16)!important;background:linear-gradient(145deg,rgba(127,29,29,.07),rgba(255,255,255,.015))!important}
.anb-pdf-card:hover{border-color:rgba(239,68,68,.42)!important;transform:translateY(-2px)}


/* ===== AJUSTE FINAL UI 2026-09-22 ===== */
/* X del menú: círculo real, sin heredar forma rectangular de botones generales. */
.sidebar-header > .btn-close-sidebar{
  appearance:none!important;-webkit-appearance:none!important;
  width:32px!important;height:32px!important;min-width:32px!important;max-width:32px!important;
  flex:0 0 32px!important;padding:0!important;margin:0!important;
  display:flex!important;align-items:center!important;justify-content:center!important;
  box-sizing:border-box!important;border-radius:9999px!important;
  border:1px solid #475569!important;background:#182238!important;color:#f8fafc!important;
  font-size:20px!important;font-weight:700!important;line-height:1!important;
  box-shadow:0 3px 10px rgba(0,0,0,.16)!important;
}
.sidebar-header > .btn-close-sidebar:hover{background:#ef4444!important;border-color:#ef4444!important;color:#fff!important;transform:scale(1.05)}
html[data-theme="light"] .sidebar-header > .btn-close-sidebar{background:#eef2f7!important;border-color:#cbd5e1!important;color:#0f172a!important}
html[data-theme="light"] .sidebar-header > .btn-close-sidebar:hover{background:#fee2e2!important;border-color:#f87171!important;color:#dc2626!important}

/* Llamados/novedades de Central con más espacio visible. */
.central-command-layout{grid-template-rows:minmax(0,1fr) minmax(180px,auto) auto!important}
.central-operations-strip{min-height:180px!important}
.central-live-calls #editLlamadosContainer{max-height:158px!important;overflow:auto!important}
.central-change-key-row{margin-top:8px!important}
.btn-central-change-key{min-height:38px!important;border-radius:10px!important;padding:8px 14px!important;font-weight:900!important}

/* Reclasificación: ventana compacta, legible y sin desplegable gigante. */
#modalReclasificarEmergencia .cat-reclass-card{width:min(560px,92vw)!important;max-width:560px!important;padding:24px!important;border-radius:18px!important}
#modalReclasificarEmergencia .cat-reclass-current{padding:10px 12px!important;border:1px solid var(--border-color)!important;border-radius:10px!important;background:color-mix(in srgb,var(--card-dark) 88%,transparent)!important}
#modalReclasificarEmergencia select,#modalReclasificarEmergencia input{width:100%!important;min-height:44px!important;border-radius:10px!important}
#modalReclasificarEmergencia .modal-actions{margin-top:16px!important}

/* Tema día: overlays, alertas, administración y botones conservan contraste. */
html[data-theme="light"] .dispatch-overlay{background:rgba(71,85,105,.42)!important}
html[data-theme="light"] .alert-box{background:linear-gradient(155deg,#fff,#f1f5f9)!important;color:#0f172a!important;border-color:#fca5a5!important;box-shadow:0 28px 80px rgba(15,23,42,.20)!important}
html[data-theme="light"] .alert-box .alert-details,
html[data-theme="light"] .alert-box .alert-details strong{color:#334155!important}
html[data-theme="light"] .admin-center-card,
html[data-theme="light"] .modal-card,
html[data-theme="light"] .step-dispatch-card{background:#fff!important;color:#0f172a!important}
html[data-theme="light"] .admin-action,
html[data-theme="light"] .btn-radio-short{background:#172033!important;color:#fff!important;border-color:#334155!important}
html[data-theme="light"] .admin-action:hover,
html[data-theme="light"] .btn-radio-short:hover{background:#26344d!important;color:#fff!important}
html[data-theme="light"] .sidebar-menu{background:#f8fafc!important}
html[data-theme="light"] .sidebar-header{background:#eef2f7!important}
html[data-theme="light"] .sidebar-btn{background:#fff!important;color:#0f172a!important;border-color:#cbd5e1!important}
html[data-theme="light"] .sidebar-btn:hover{background:#e2e8f0!important;border-color:#3b82f6!important}
html[data-theme="light"] #view-portal{background:linear-gradient(145deg,#dfe6ee,#f1f5f9)!important}
html[data-theme="light"] #view-portal .login-card{background:rgba(255,255,255,.96)!important;color:#0f172a!important}
html[data-theme="light"] #view-portal .login-title{color:#0f172a!important}
html[data-theme="light"] .loading-screen{background:radial-gradient(circle at 20% 20%,rgba(59,130,246,.10),transparent 32%),radial-gradient(circle at 82% 24%,rgba(239,68,68,.07),transparent 30%),linear-gradient(145deg,#e6edf5,#f8fafc)!important;color:#0f172a!important}
html[data-theme="light"] .loading-title{color:#0f172a!important}
html[data-theme="light"] .loading-status{color:#475569!important}

/* Estado del material: emergencia operativa se presenta como EN EL LUGAR. */
.unit-card-status{letter-spacing:.02em}

@media(max-width:900px){
  .central-operations-strip{min-height:160px!important}
}

/* =========================================================
   MAPAS OPERACIONALES · BLOQUE ÚNICO Y ESTABLE
   No agregar overrides posteriores para estos contenedores.
   ========================================================= */

/* VER MAPA: centrado, contenido y sin recortar la imagen. */
#modalMapaMonitor {
    align-items: center !important;
    justify-content: center !important;
}
#modalMapaMonitor .modal-mapa-ampliado {
    width: min(92vw, 780px) !important;
    max-width: 780px !important;
    padding: 18px !important;
    margin: auto !important;
    box-sizing: border-box !important;
}
#modalMapaMonitor .map-container-quadrant-large {
    width: min(100%, 680px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 auto !important;
    position: relative !important;
    overflow: hidden !important;
    background: #020408 !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
}
#modalMapaMonitor .map-container-quadrant-large > .map-image-full {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* DESPACHO PASO A PASO: ocupa toda la pantalla como antes. */
#modalDespachoPasos.slide-up-modal-overlay {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
}
#modalDespachoPasos.slide-up-modal-overlay.hidden {
    display: none !important;
}
#modalDespachoPasos > .slide-up-card {
    width: 100% !important;
    max-width: none !important;
    height: 94vh !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}
#modalDespachoPasos .step-slide-body {
    width: 100% !important;
    min-width: 0 !important;
}
#modalDespachoPasos #stepContent2 .step2-split-layout {
    width: 100% !important;
    grid-template-columns: 320px minmax(0, 1fr) !important;
    gap: 16px !important;
    align-items: center !important;
}
#modalDespachoPasos #stepContent2 .step2-map-column {
    width: 100% !important;
    min-width: 0 !important;
    align-items: center !important;
}
#modalDespachoPasos #centralMapContainer {
    width: min(100%, 680px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    max-width: 680px !important;
    max-height: min(68vh, 680px) !important;
    margin: 10px auto !important;
    position: relative !important;
    overflow: hidden !important;
    flex: none !important;
}
#modalDespachoPasos #centralMapContainer > .map-image-full {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

/* MAQUINISTA: conserva su marco operacional. */
#view-maquinista .map-container {
    width: min(100%, 680px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    max-height: 68vh !important;
    margin: 10px auto !important;
    position: relative !important;
    overflow: hidden !important;
}
#view-maquinista .map-container > .map-image-full {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
}

@media (max-width: 900px) {
    #modalMapaMonitor .modal-mapa-ampliado {
        width: 94vw !important;
    }
    #modalMapaMonitor .map-container-quadrant-large,
    #modalDespachoPasos #centralMapContainer,
    #view-maquinista .map-container {
        width: min(100%, 560px) !important;
        height: auto !important;
        aspect-ratio: 1 / 1 !important;
        max-height: none !important;
    }
    #modalDespachoPasos #stepContent2 .step2-split-layout {
        grid-template-columns: 1fr !important;
    }
}

