/* ============================================================
   ALERTA TEMPRANA COMUNAL - ESTILOS
   Comuna Ecosocialista Unidos Venceremos
   Responsive: Móvil + PC
   ============================================================ */

/* ============ VARIABLES ============ */
:root {
    --bg-1: #0b1d4d;
    --bg-2: #0d47a1;
    --bg-3: #1a237e;
    --panel-bg: rgba(255, 255, 255, 0.08);
    --panel-bg-hover: rgba(255, 255, 255, 0.12);
    --panel-border: rgba(255, 255, 255, 0.15);
    --texto: #ffffff;
    --texto-suave: rgba(255, 255, 255, 0.78);
    --texto-dim: rgba(255, 255, 255, 0.55);
    --rojo: #e53935;
    --naranja: #FB8C00;
    --amarillo: #FDD835;
    --verde: #43A047;
    --azul-acento: #42a5f5;
    --sombra: 0 4px 20px rgba(0, 0, 0, 0.35);
    --radio: 14px;
    --radio-sm: 8px;
}

/* ============ RESET ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-3) 100%);
    background-attachment: fixed;
    color: var(--texto);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; }
a { color: var(--azul-acento); }

/* ============ HEADER (TAMAÑO AUMENTADO) ============ */
header {
    background: rgba(0, 0, 0, 0.35);
    padding: 22px 15px 18px;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

header h1 {
    font-size: 1.85em;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

header .subtitulo {
    font-size: 1.1em;
    opacity: 0.92;
    font-weight: 400;
    margin-bottom: 4px;
}

header .dominio {
    font-size: 0.85em;
    opacity: 0.7;
    margin-top: 4px;
    letter-spacing: 0.3px;
}

/* ============ LÍNEA DE MONITOREO EN TIEMPO REAL ============ */
.monitoreo-linea {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 12px auto 0;
    padding: 8px 18px;
    background: rgba(66, 165, 245, 0.15);
    border: 1px solid rgba(66, 165, 245, 0.35);
    border-radius: 30px;
    font-size: 0.95em;
    color: #bbdefb;
    font-weight: 500;
    max-width: fit-content;
}

.radar-punto {
    position: relative;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.radar-punto::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #42a5f5;
    border-radius: 50%;
    box-shadow: 0 0 8px #42a5f5;
}

.radar-punto::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 2px solid #42a5f5;
    border-radius: 50%;
    animation: radarPulse 1.8s ease-out infinite;
}

@keyframes radarPulse {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

#monitoreoTexto {
    transition: opacity 0.3s ease;
    min-width: 220px;
    text-align: left;
}

#monitoreoTexto.cambiando {
    opacity: 0.3;
}

/* ============ ALERTA BANNER ============ */
.alerta {
    display: none;
    padding: 14px 18px;
    text-align: center;
    font-weight: bold;
    font-size: 1em;
    color: #fff;
    box-shadow: var(--sombra);
    animation: parpadeo 1.5s infinite;
}
.alerta.rojo { background: var(--rojo); }
.alerta.naranja { background: var(--naranja); color: #000; }
.alerta.amarillo { background: var(--amarillo); color: #000; }
.alerta.verde { background: var(--verde); }

@keyframes parpadeo {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.75; }
}

/* ============ CONTENEDOR ============ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 15px;
}

/* ============ TABS PRINCIPALES (CON INDICADOR DE SCROLL) ============ */
.tabs-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding: 4px 4px 8px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.tabs::-webkit-scrollbar { height: 5px; }
.tabs::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
.tabs::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }

/* Gradientes laterales que indican que hay más contenido */
.tabs-wrapper::before,
.tabs-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 8px;
    width: 40px;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease;
}

.tabs-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-2) 0%, transparent 100%);
    opacity: 0;
}

.tabs-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-2) 0%, transparent 100%);
    opacity: 1;
}

.tabs-wrapper.has-start::before { opacity: 1; }
.tabs-wrapper.has-end::after { opacity: 0; }

/* Flechas de navegación en los costados */
.tabs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-60%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    font-weight: bold;
    z-index: 10;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, background 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.tabs-arrow:hover { background: var(--azul-acento); }
.tabs-arrow.visible { opacity: 1; pointer-events: auto; }
.tabs-arrow.left { left: 4px; }
.tabs-arrow.right { right: 4px; }

.tab {
    flex: 0 0 auto;
    padding: 11px 16px;
    background: var(--panel-bg);
    color: var(--texto);
    border-radius: var(--radio-sm) var(--radio-sm) 0 0;
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.25s ease;
    border: 1px solid transparent;
    border-bottom: none;
}

.tab:hover { background: var(--panel-bg-hover); }

.tab.act {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--panel-border);
    border-bottom: 3px solid var(--amarillo);
    color: #fff;
    font-weight: 600;
}

/* ============ SUB-TABS ============ */
.sub-tabs {
    display: flex;
    gap: 3px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--panel-border);
}

.sub-tab {
    flex: 0 0 auto;
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--texto-suave);
    border-radius: 6px 6px 0 0;
    font-size: 0.85em;
    white-space: nowrap;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.sub-tab:hover { background: rgba(255, 255, 255, 0.1); color: var(--texto); }
.sub-tab.act {
    background: rgba(66, 165, 245, 0.2);
    color: #fff;
    border-color: var(--azul-acento);
    border-bottom: 2px solid var(--azul-acento);
    font-weight: 600;
}

.sub-panel { display: none; }
.sub-panel.act { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ PANELS ============ */
.panel {
    display: none;
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 0 var(--radio) var(--radio) var(--radio);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--panel-border);
    min-height: 400px;
    animation: fadeIn 0.3s ease;
}
.panel.act { display: block; }

.panel h2 {
    font-size: 1.25em;
    margin-bottom: 12px;
    color: #fff;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
}
.panel h3 { font-size: 1.05em; margin: 15px 0 10px; color: var(--amarillo); }
.sub-h { color: var(--texto-suave); font-size: 0.9em; font-style: italic; margin: 8px 0; }

/* ============ STATS GRID (NÚMEROS Y TEXTO MÁS GRANDES) ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat {
    background: rgba(0, 0, 0, 0.28);
    padding: 20px 12px;
    border-radius: var(--radio-sm);
    text-align: center;
    border: 1px solid var(--panel-border);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--amarillo), var(--azul-acento));
    opacity: 0.6;
}

.stat:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.3);
}

.stat .n {
    display: block;
    font-size: 2.8em;
    font-weight: 800;
    color: var(--amarillo);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(253, 216, 53, 0.3);
}

.stat small {
    color: var(--texto);
    font-size: 0.95em;
    display: block;
    font-weight: 500;
    letter-spacing: 0.3px;
    opacity: 0.95;
}

/* ============ CARDS ============ */
.card {
    background: rgba(0, 0, 0, 0.25);
    padding: 12px;
    margin-bottom: 10px;
    border-radius: var(--radio-sm);
    border-left: 5px solid var(--verde);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: transform 0.2s, background 0.2s;
}
.card:hover { background: rgba(0, 0, 0, 0.35); transform: translateX(3px); }
.card.rojo { border-left-color: var(--rojo); background: rgba(229, 57, 53, 0.12); }
.card.naranja { border-left-color: var(--naranja); background: rgba(251, 140, 0, 0.12); }
.card.amarillo { border-left-color: var(--amarillo); background: rgba(253, 216, 53, 0.08); }
.card.verde { border-left-color: var(--verde); }

.card.vzla {
    box-shadow: 0 0 0 2px rgba(255, 214, 0, 0.4);
    animation: vzlaPulse 3s infinite;
}
@keyframes vzlaPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 214, 0, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(207, 20, 43, 0.5); }
}

.card .mag {
    font-size: 1.9em;
    font-weight: bold;
    min-width: 65px;
    text-align: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    line-height: 1;
    flex-shrink: 0;
}
.card .info { flex: 1; min-width: 0; }
.card .lugar { font-weight: 600; font-size: 1em; margin-bottom: 4px; word-wrap: break-word; }
.card .meta { font-size: 0.82em; color: var(--texto-suave); margin-top: 3px; }

/* ============ BADGES ============ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge.rojo { background: var(--rojo); color: #fff; }
.badge.naranja { background: var(--naranja); color: #000; }
.badge.amarillo { background: var(--amarillo); color: #000; }
.badge.verde { background: var(--verde); color: #fff; }

.tsu-tag {
    margin-top: 6px;
    padding: 5px 10px;
    background: rgba(33, 150, 243, 0.25);
    border-left: 3px solid #2196f3;
    border-radius: 4px;
    font-size: 0.85em;
    color: #bbdefb;
    font-weight: 600;
}

.bandera-vzla {
    display: inline-flex;
    width: 18px;
    height: 12px;
    margin-right: 5px;
    vertical-align: middle;
    border-radius: 2px;
    overflow: hidden;
}
.bandera-vzla i { flex: 1; display: block; }

.fuentes-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72em;
    font-weight: bold;
    margin-left: 5px;
}
.fuentes-badge.confirmado { background: var(--verde); color: #fff; }
.fuentes-badge.uno { background: rgba(255,255,255,0.15); color: var(--texto-suave); }

.punto-fuente {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.fuente-usgs { background: #2196f3; }
.fuente-emsc { background: #e53935; }
.fuente-cenad { background: #FDD835; }

/* ============ MAPA ============ */
.mapa-wrap {
    position: relative;
    border-radius: var(--radio);
    overflow: hidden;
    border: 1px solid var(--panel-border);
    margin-bottom: 10px;
}
#mapa2d, #mapa3d { height: 500px; width: 100%; background: #0a1929; }
.mapa-controles {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 500;
    display: flex;
    gap: 5px;
}
.mapa-controles button {
    padding: 8px 14px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,0.2);
}
.mapa-controles button.act { background: var(--azul-acento); border-color: var(--azul-acento); }
.mapa-leyenda {
    background: rgba(0, 0, 0, 0.6);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.82em;
    margin-top: 8px;
}

/* ============ TSUNAMI ============ */
.tsu-card {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2), rgba(13, 71, 161, 0.3));
    padding: 15px;
    border-radius: var(--radio-sm);
    border-left: 5px solid #2196f3;
    margin-bottom: 12px;
}
.tsu-card .lugar { font-weight: 700; font-size: 1.05em; margin-bottom: 6px; }
.eta-big {
    text-align: center;
    font-size: 1.8em;
    font-weight: bold;
    padding: 15px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 8px;
    margin: 10px 0;
    color: #64b5f6;
    font-family: 'Courier New', monospace;
}
.eta-big .cuenta { color: var(--amarillo); }

/* ============ TABLAS ============ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radio-sm);
    overflow: hidden;
    font-size: 0.88em;
}
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radio-sm); }
table th {
    background: rgba(0, 0, 0, 0.45);
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--amarillo);
    font-size: 0.9em;
    white-space: nowrap;
}
table td { padding: 9px 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); vertical-align: top; }
table tr:hover { background: rgba(255, 255, 255, 0.04); }

/* ============ FILTROS ============ */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0; align-items: center; }
.filtros label { font-size: 0.88em; color: var(--texto-suave); }
.filtros input, .filtros select {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    color: #fff;
    border-radius: 6px;
    font-size: 0.9em;
    min-width: 100px;
}
.filtros input:focus, .filtros select:focus {
    outline: none;
    border-color: var(--azul-acento);
    background: rgba(0, 0, 0, 0.5);
}
.filtros select option { background: var(--bg-1); color: #fff; }

/* ============ BOTONES ============ */
.btn {
    padding: 10px 18px;
    background: var(--azul-acento);
    color: #fff;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
}
.btn:hover { background: #1e88e5; transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-amarillo { background: var(--amarillo); color: #000; }
.btn-amarillo:hover { background: #fbc02d; }
.btn-rojo { background: var(--rojo); }
.btn-rojo:hover { background: #c62828; }
.btn-verde { background: var(--verde); }
.btn-verde:hover { background: #2e7d32; }
.btn-ghost { background: transparent; border: 1px solid var(--panel-border); color: var(--texto); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-grande { padding: 14px 28px; font-size: 1em; width: 100%; max-width: 320px; }

/* ============ CHAT IA ============ */
.chat-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radio);
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 520px;
    border: 1px solid var(--panel-border);
}
.chat-modo {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: 0.82em;
    margin-bottom: 10px;
    text-align: center;
    color: var(--texto-suave);
}
.chat-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.msg {
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 85%;
    font-size: 0.92em;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.msg.user {
    background: var(--azul-acento);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.msg.ia {
    background: rgba(255, 255, 255, 0.12);
    color: var(--texto);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--panel-border);
}
.chat-input { display: flex; gap: 8px; }
.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 25px;
    border: 1px solid var(--panel-border);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 0.95em;
}
.chat-input input:focus { outline: none; border-color: var(--azul-acento); }
.chat-input button {
    padding: 12px 22px;
    border-radius: 25px;
    background: var(--naranja);
    color: #000;
    font-weight: bold;
}
.chat-input button:hover { background: #ffa726; }

/* ============ INFO ============ */
.info-bloque {
    background: rgba(0, 0, 0, 0.25);
    padding: 15px;
    border-radius: var(--radio-sm);
    margin-bottom: 12px;
    border-left: 4px solid var(--azul-acento);
}
.info-bloque h3 { color: var(--amarillo); margin-bottom: 8px; }
.color-ejemplo {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 6px;
}

/* ============ ADMIN ============ */
.admin-box {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: var(--radio);
    border: 2px dashed var(--panel-border);
    margin-top: 20px;
}
.admin-box input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--panel-border);
    color: #fff;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 1em;
}
.admin-result { padding: 12px; border-radius: 6px; margin-top: 10px; font-size: 0.9em; }
.admin-result.ok { background: rgba(67, 160, 71, 0.25); border-left: 4px solid var(--verde); }
.admin-result.warn { background: rgba(251, 140, 0, 0.2); border-left: 4px solid var(--naranja); }

/* ============ ESTADO FUENTES ============ */
.estado-fuente {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    margin-bottom: 8px;
}
.estado-fuente .punto-fuente-grande {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}
.estado-fuente.ok .punto-fuente-grande { background: var(--verde); box-shadow: 0 0 8px var(--verde); }
.estado-fuente.no .punto-fuente-grande { background: var(--rojo); box-shadow: 0 0 8px var(--rojo); }
.estado-fuente .nombre { font-weight: 600; }
.estado-fuente .detalle { font-size: 0.82em; color: var(--texto-suave); }

/* ============ GRÁFICOS ============ */
.grafico-wrap {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: var(--radio-sm);
    margin: 15px 0;
    position: relative;
    min-height: 300px;
}
.grafico-wrap canvas { max-width: 100%; }

/* ============ FOOTER ============ */
footer {
    text-align: center;
    padding: 20px 15px;
    margin-top: 30px;
    font-size: 0.82em;
    color: var(--texto-suave);
    border-top: 1px solid var(--panel-border);
}
footer a { color: var(--azul-acento); text-decoration: none; }

/* ============ RESPONSIVE - TABLET ============ */
@media (max-width: 900px) {
    header h1 { font-size: 1.6em; }
    header .subtitulo { font-size: 1em; }
    .container { padding: 12px; }
    .panel { padding: 15px; }
    #mapa2d, #mapa3d { height: 420px; }
    .chat-container { height: 480px; }
    .stat .n { font-size: 2.4em; }
    .stat small { font-size: 0.9em; }
}

/* ============ RESPONSIVE - MÓVIL ============ */
@media (max-width: 640px) {
    header { padding: 16px 10px 14px; }
    header h1 { font-size: 1.35em; }
    header .subtitulo { font-size: 0.92em; }
    header .dominio { font-size: 0.75em; }
    
    .monitoreo-linea {
        font-size: 0.85em;
        padding: 6px 14px;
    }
    #monitoreoTexto { min-width: 180px; font-size: 0.9em; }
    
    .container { padding: 8px; }
    
    .tabs { gap: 3px; }
    .tab { padding: 9px 12px; font-size: 0.82em; }
    .tabs-arrow { width: 28px; height: 28px; font-size: 0.95em; }
    .tabs-wrapper::before, .tabs-wrapper::after { width: 30px; }
    
    .sub-tab { padding: 7px 11px; font-size: 0.78em; }
    
    .panel {
        padding: 12px;
        border-radius: 0 0 var(--radio-sm) var(--radio-sm);
        min-height: 300px;
    }
    .panel h2 { font-size: 1.05em; }
    .panel h3 { font-size: 0.95em; }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat { padding: 16px 8px; }
    .stat .n { font-size: 2.2em; }
    .stat small { font-size: 0.85em; }
    
    .card { padding: 10px; gap: 8px; }
    .card .mag { font-size: 1.4em; min-width: 52px; padding: 6px; }
    .card .lugar { font-size: 0.92em; }
    .card .meta { font-size: 0.76em; }
    
    #mapa2d, #mapa3d { height: 340px; }
    .mapa-controles button { padding: 6px 10px; font-size: 0.78em; }
    
    .chat-container { height: 440px; padding: 10px; }
    .msg { font-size: 0.88em; max-width: 92%; }
    .chat-input input { padding: 10px 14px; font-size: 0.9em; }
    .chat-input button { padding: 10px 16px; }
    
    table { font-size: 0.78em; }
    table th, table td { padding: 7px 5px; }
    
    .filtros { flex-direction: column; align-items: stretch; }
    .filtros input, .filtros select { width: 100%; }
    
    .btn { padding: 10px 14px; font-size: 0.88em; }
    .btn-grande { padding: 12px 20px; }
    
    .eta-big { font-size: 1.3em; padding: 12px; }
    .tsu-card { padding: 12px; }
    .grafico-wrap { padding: 10px; min-height: 250px; }
    .admin-box { padding: 15px; }
}

/* ============ MÓVIL MUY PEQUEÑO ============ */
@media (max-width: 380px) {
    header h1 { font-size: 1.15em; }
    header .subtitulo { font-size: 0.82em; }
    .tab { padding: 8px 10px; font-size: 0.75em; }
    .sub-tab { padding: 6px 9px; font-size: 0.72em; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat { padding: 12px 6px; }
    .stat .n { font-size: 1.9em; }
    .stat small { font-size: 0.78em; }
    .card .mag { font-size: 1.2em; min-width: 45px; }
    #mapa2d, #mapa3d { height: 280px; }
    .monitoreo-linea { font-size: 0.78em; padding: 5px 10px; }
    #monitoreoTexto { min-width: 150px; }
}

/* ============ UTILIDADES ============ */
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.hidden { display: none !important; }

/* ============ ACCESIBILIDAD ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
:focus-visible { outline: 2px solid var(--amarillo); outline-offset: 2px; }