/* --- CORE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primario: #003399;
    --color-secundario: #002266;
    --color-acento: #ff9800;
    --color-fondo: #f4f6f9;
    --color-texto: #333333;
    --color-borde: #dde2e9;
}

body {
    font-family: 'Segoe UI', 'Roboto', Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: var(--color-texto);
    background-color: var(--color-fondo);
}

a { text-decoration: none; }

/* --- LAYOUT --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-header {
    background-color: #ffffff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-bottom: 3px solid var(--color-primario);
    margin-bottom: 20px;
}

.logo-container img { max-height: 80px; width: auto; }

.title-container h1 {
    color: var(--color-texto);
    font-size: 24px;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: right;
}

.title-container strong { color: var(--color-primario); font-weight: 800; }

/* --- NAV --- */
.nav-menu {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: 10px; margin-bottom: 20px; padding: 0 10px;
}

.nav-btn {
    background-color: var(--color-primario);
    color: white;
    padding: 10px 18px;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    box-shadow: 0 4px 6px rgba(0,51,153,0.2);
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.nav-btn:hover {
    background-color: white;
    color: var(--color-primario);
    border-color: var(--color-primario);
    transform: translateY(-2px);
}

.nav-btn.logout {
    background-color: #d32f2f;
    box-shadow: 0 4px 6px rgba(211, 47, 47, 0.2);
}

.nav-btn.logout:hover {
    background-color: white;
    color: #d32f2f;
    border-color: #d32f2f;
}

/* --- GRID SYSTEM --- */
.main-grid {
    display: flex; gap: 15px; align-items: flex-start;
    width: 100%; padding: 0 10px; overflow-x: visible;
}

.col-pizarra, .col-cargas {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.03);
    border: 1px solid var(--color-borde);
    overflow: hidden;
}

.col-pizarra { flex: 6; }
.col-cargas { flex: 4; }

h3 {
    background-color: #f8f9fa;
    color: var(--color-primario);
    padding: 12px; margin: 0;
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; text-align: center;
    border-bottom: 1px solid var(--color-borde);
    letter-spacing: 0.5px;
}

/* --- DATA TABLES --- */
table { width: 100%; border-collapse: collapse; table-layout: auto; }

.main-grid table tr { height: 38px; }

th {
    background-color: var(--color-primario);
    color: white; padding: 8px;
    text-align: left; font-size: 11px;
    font-weight: 600; white-space: nowrap;
}

td {
    padding: 0 8px; border-bottom: 1px solid #eee;
    font-size: 12px; vertical-align: middle;
    white-space: nowrap; font-weight: 700;
    height: 38px;
}

td:first-child, th:first-child {
    width: 1%; text-align: center; color: #888;
    font-weight: bold; font-size: 10px;
}

tr:nth-child(even) { background-color: #f8faff; }
tr:hover { background-color: #eef2f7; }

.cambio-color { color: var(--color-primario); font-weight: bold; }

/* Status Highlights */
tr.alerta-roja { background-color: #ffe6e6 !important; }
tr.alerta-roja td { border-bottom: 1px solid #dcb4b4 !important; }

tr.alerta-taller { background-color: #fff8e1 !important; }
tr.alerta-taller td { border-bottom: 1px solid #ffe0b2 !important; }

/* --- TAGS & BADGES --- */
.marca-base {
    display: inline-block; padding: 1px 6px;
    border-radius: 4px; font-weight: 800;
    font-size: 0.95em; line-height: 1.2;
    margin: 0 2px; border: 1px solid transparent;
}

.marca-x   { background-color: #e3f2fd; color: #1565c0; border-color: #bbdefb; }
.marca-xx  { background-color: #f3e5f5; color: #7b1fa2; border-color: #e1bee7; }
.marca-xxx { background-color: #fff3e0; color: #ef6c00; border-color: #ffe0b2; }
.marca-roja { background-color: #ffebee; color: #c62828; border-color: #ffcdd2; font-weight: 800; }

.marca-taller {
    color: #e65100; font-weight: 800;
    background-color: rgba(255, 167, 38, 0.2);
    padding: 0 4px; border-radius: 4px;
}

.marca-asterisco {
    color: #d500f9; font-weight: 900;
    font-size: 1.4em; vertical-align: middle;
    line-height: 1; margin-right: 2px;
}

.marca-caja {
    background-color: #e0f7fa; color: #006064;
    border: 1px solid #b2ebf2; padding: 2px 6px;
    border-radius: 4px; font-weight: 800;
    text-transform: uppercase; display: inline-block;
}

.btn-ver-carga {
    background-color: #007bff; color: white;
    padding: 2px 6px; border-radius: 4px;
    font-weight: bold; cursor: pointer;
    font-size: 0.95em; box-shadow: 0 2px 2px rgba(0,0,0,0.2);
    transition: transform 0.1s; display: inline-block;
}
.btn-ver-carga:active { transform: scale(0.95); }

/* Modal Tags */
.tag-estado {
    display: inline-block; padding: 2px 6px;
    border-radius: 4px; font-weight: bold;
    font-size: 11px; min-width: 45px;
    text-align: center; margin-right: 8px;
}

.tag-dispo { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.tag-x     { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.tag-xx    { background: #f3e5f5; color: #7b1fa2; border: 1px solid #e1bee7; }
.tag-xxx   { background: #fff3e0; color: #ef6c00; border: 1px solid #ffe0b2; }
.tag-xxxx  { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.tag-taller{ background: #37474f; color: #fff; border: 1px solid #263238; }

/* --- FLOATING ACTIONS --- */
.btn-flotante-whatsapp, .btn-flotante-normas {
    position: fixed; width: 60px; height: 60px;
    border-radius: 50%; display: flex;
    justify-content: center; align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer; z-index: 1000;
    transition: transform 0.3s, background 0.3s;
    border: 2px solid white;
}

.btn-flotante-whatsapp {
    bottom: 90px; right: 20px;
    background-color: #25D366; color: white; font-size: 32px;
}
.btn-flotante-whatsapp:hover { background-color: #128C7E; transform: scale(1.1); }

.btn-flotante-normas {
    bottom: 20px; right: 20px;
    background-color: #ff9800; color: white; font-size: 24px;
}
.btn-flotante-normas:hover { background-color: #e65100; transform: scale(1.1); }

.btn-flotante-refresh {
    position: fixed; right: 20px;
    background-color: #0288d1; color: white;
    width: 60px; height: 60px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer; z-index: 1000;
    transition: transform 0.5s ease, background 0.3s;
    border: 2px solid white; font-size: 24px;
}
.btn-flotante-refresh:hover {
    background-color: #01579b; transform: rotate(180deg);
}

/* --- MODALS & OVERLAYS --- */
.modal-overlay {
    display: none; position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000; justify-content: center;
    align-items: center; padding: 20px;
}

.modal-content {
    background-color: #fff; width: 100%;
    max-width: 800px; max-height: 90vh;
    border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    overflow: hidden; position: relative;
}

.modal-header {
    background-color: var(--color-primario);
    color: white; padding: 15px 20px;
    display: flex; justify-content: space-between; align-items: center;
}

.modal-header h2 { margin: 0; font-size: 18px; color: white; border: none; padding: 0; }
.btn-cerrar-modal { background: none; border: none; color: white; font-size: 24px; cursor: pointer; font-weight: bold; }

.modal-body { padding: 20px; overflow-y: auto; font-size: 13px; line-height: 1.6; }

.normas-seccion { margin-bottom: 25px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.normas-titulo {
    color: var(--color-primario); font-weight: 800;
    text-transform: uppercase; margin-bottom: 10px;
    font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.lista-estados li { margin-bottom: 8px; list-style: none; }
.info-box {
    background-color: #f8f9fa; border-left: 4px solid var(--color-primario);
    padding: 10px; margin: 10px 0;
    font-style: italic; color: #555;
}

/* --- COMPONENTS & AUTH --- */
.aviso-offline {
    background-color: #fff3cd; color: #856404;
    border: 1px solid #ffeeba; padding: 10px; 
    margin: 0 10px 15px 10px; text-align: center;
    font-size: 12px; font-weight: bold; border-radius: 4px;
}

.footer { text-align: center; margin-top: auto; padding: 20px; font-size: 11px; color: #999; }

.login-wrapper {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; width: 100%; background-color: var(--color-fondo);
}
.login-box {
    background: white; width: 100%; max-width: 380px; padding: 40px;
    border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    text-align: center; border-top: 4px solid var(--color-primario);
}
.login-box img { max-width: 180px; margin-bottom: 20px; }
.btn-login {
    width: 100%; padding: 12px; background: var(--color-primario);
    color: white; border: none; border-radius: 4px; font-weight: bold;
    margin-top: 15px; cursor: pointer;
}
.btn-login:hover { background: var(--color-secundario); }
.form-group { text-align: left; margin-bottom: 15px; }
.form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .main-header { flex-direction: column; text-align: center; gap: 10px; }
    .title-container h1 { text-align: center; font-size: 18px; }
    
    .main-grid {
        flex-direction: row; gap: 5px; overflow-x: auto;
        -webkit-overflow-scrolling: touch; padding-bottom: 10px;
    }

    .col-pizarra, .col-cargas {
        flex: 0 0 auto; min-width: 70vw; border-radius: 4px;
    }
    .col-cargas { min-width: 50vw; }

    .main-grid table tr, .main-grid table td { height: 38px; }
    th, td { font-size: 11px; padding: 0 4px; }
    
    .nav-menu { gap: 5px; }
    .nav-btn { padding: 8px 12px; font-size: 10px; flex: 1 1 auto; text-align: center; }
}

/* --- ALERTS UI --- */
div:where(.swal2-icon) {
    border: none !important; background: transparent !important;
    box-shadow: none !important; margin: 10px auto 0 auto !important;
}

.swal2-icon-custom-content {
    font-size: 1.2em; color: var(--color-primario);
    animation: palpitar 2s infinite ease-in-out; padding: 5px;
}

@keyframes palpitar {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- APP LOCK (KEEPER) --- */
#pantalla-instalacion {
    display: none; position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: #003399; z-index: 99999;
    flex-direction: column; justify-content: center;
    align-items: center; color: white;
    text-align: center; padding: 30px; box-sizing: border-box;
}

.keeper-content {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 30px 20px; border-radius: 15px;
    max-width: 400px; width: 100%;
    backdrop-filter: blur(10px);
}

.keeper-icon img {
    width: 80px; height: auto; background: white;
    padding: 10px; border-radius: 15px;
    margin-bottom: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.keeper-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.keeper-text { font-size: 14px; line-height: 1.6; margin-bottom: 20px; opacity: 0.9; }

.install-step {
    background: white; color: #333;
    padding: 12px; border-radius: 8px;
    margin-bottom: 10px; font-size: 13px; font-weight: bold;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.install-step i { color: #003399; font-size: 16px; }