/* MapDrop v3.0 - Estilos con paleta MapLecture */

/* ═══════════════════════════════════════════════════════════
   VARIABLES Y RESET
   ═══════════════════════════════════════════════════════════ */

:root {
    --verde-principal: #6db38a;
    --verde-oscuro: #3d7a5a;
    --verde-titulo: #2e4d31;
    --verde-muy-claro: #f0f7f4;
    --verde-claro: #dff0ec;
    --verde-borde: #b2d8c8;
    --blanco: #ffffff;
    --texto-oscuro: #1a1a1a;
    --texto-medio: #555;
    --gris-claro: #f4faf7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--blanco);
    color: var(--texto-oscuro);
    line-height: 1.5;
    font-size: 0.94rem;
}

/* ═══════════════════════════════════════════════════════════
   BANNER SUPERIOR
   ═══════════════════════════════════════════════════════════ */

.top-banner {
    background: linear-gradient(135deg, var(--verde-principal) 0%, var(--verde-oscuro) 100%);
    color: white;
    padding: 10px 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.banner-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.banner-inner h1 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.banner-inner .separator {
    font-size: 1.1rem;
    opacity: 0.6;
}

.banner-inner p {
    font-size: 0.82rem;
    opacity: 0.9;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT PRINCIPAL
   ═══════════════════════════════════════════════════════════ */

.main-container {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: calc(100vh - 46px);
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR MAPLECTURE
   ═══════════════════════════════════════════════════════════ */

.sidebar-maplecture {
    background: var(--verde-muy-claro);
    padding: 12px 16px 24px 16px;
    border-right: 1px solid var(--verde-claro);
    /* Sin max-height → crece con el contenido principal */
}

.logo-section {
    text-align: center;
    margin-bottom: 8px;
    padding-top: 0;
}

.logo-square {
    width: 140px;
    height: 140px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.09);
}

.brand-tagline {
    text-align: center;
    color: var(--verde-oscuro);
    font-size: 0.78rem;
    font-style: italic;
    margin-bottom: 10px;
}

.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--verde-borde), transparent);
    margin: 16px 0;
}

/* ─── Multi-station slots ─── */

#stationsContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 4px;
}

.station-slot {
    background: white;
    border: 1px solid var(--verde-borde);
    border-radius: 8px;
    overflow: hidden;
}

.station-slot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    background: var(--verde-muy-claro);
    border-bottom: 1px solid var(--verde-claro);
}

.station-slot-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--verde-titulo);
}

.station-remove-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}

.station-remove-btn:hover {
    color: #a71d2a;
}

.station-dropzone {
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.station-dropzone:hover,
.station-dropzone.drag-over {
    background: var(--verde-claro);
}

.station-drop-text {
    color: var(--verde-oscuro);
    font-size: 0.82rem;
    margin-top: 6px;
    line-height: 1.5;
}

.station-drop-text small {
    color: var(--texto-medio);
}

.station-files-list {
    max-height: 150px;
    overflow-y: auto;
    padding: 6px 10px;
    border-top: 1px solid var(--verde-claro);
    background: var(--gris-claro);
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--verde-principal), var(--verde-oscuro));
    color: white;
    border: none;
    padding: 9px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.84rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(61, 122, 90, 0.28);
}

.btn-secondary {
    background: white;
    color: var(--verde-oscuro);
    border: 1px solid var(--verde-borde);
    padding: 9px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--gris-claro);
    border-color: var(--verde-principal);
}

.file-item {
    background: white;
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 5px;
    border-left: 2px solid var(--verde-principal);
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-item .file-name {
    color: var(--texto-oscuro);
    font-weight: 500;
}

.file-item .file-remove {
    color: #dc3545;
    cursor: pointer;
    font-size: 1.2rem;
}

/* SENAMHI Search */
.senamhi-search h3 {
    color: var(--verde-titulo);
    font-size: 1rem;
    margin-bottom: 10px;
}

.search-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--verde-borde);
    border-radius: 4px;
    font-size: 0.84rem;
    margin-bottom: 8px;
}

.search-input:focus {
    outline: none;
    border-color: var(--verde-principal);
    box-shadow: 0 0 0 3px rgba(109, 179, 138, 0.1);
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
}

/* ── Resultado de búsqueda SENAMHI (rediseñado) ── */
.search-result-item {
    background: white;
    padding: 9px 10px;
    border-radius: 6px;
    margin-bottom: 6px;
    border-left: 3px solid var(--verde-principal);
    font-size: 0.8rem;
    transition: box-shadow 0.15s;
}

.search-result-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sri-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 3px;
}

.sri-name {
    font-weight: 700;
    color: var(--verde-titulo);
    font-size: 0.82rem;
    line-height: 1.3;
}

.sri-code {
    font-size: 0.7rem;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

.sri-meta {
    display: flex;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--texto-medio);
    margin-bottom: 2px;
    flex-wrap: wrap;
}

.sri-coords {
    font-size: 0.7rem;
    color: var(--verde-oscuro);
    margin-bottom: 3px;
}

.sri-vars {
    font-size: 0.7rem;
    color: #888;
    font-style: italic;
    margin-bottom: 7px;
    line-height: 1.4;
}

.sri-actions {
    display: flex;
    gap: 5px;
}

.sri-btn-import {
    flex: 1;
    padding: 5px 8px;
    background: var(--verde-principal);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sri-btn-import:hover {
    background: var(--verde-oscuro);
}

.sri-btn-map {
    padding: 5px 8px;
    background: transparent;
    color: var(--verde-oscuro);
    border: 1px solid var(--verde-borde);
    border-radius: 4px;
    font-size: 0.74rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.sri-btn-map:hover {
    background: var(--verde-muy-claro);
}

/* Support Section */
.support-section h4 {
    color: var(--verde-titulo);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.support-section p {
    font-size: 0.8rem;
    color: var(--texto-medio);
    margin-bottom: 10px;
    line-height: 1.4;
}

.support-link {
    display: block;
    background: white;
    color: var(--verde-oscuro);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 4px;
    margin-bottom: 6px;
    border: 1px solid var(--verde-borde);
    font-size: 0.82rem;
    transition: all 0.2s;
}

.support-link:hover {
    background: var(--gris-claro);
    border-color: var(--verde-principal);
}

/* ═══════════════════════════════════════════════════════════
   CONTENIDO PRINCIPAL
   ═══════════════════════════════════════════════════════════ */

.main-content {
    background: white;
    padding: 0;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 3px;
    background: var(--verde-muy-claro);
    padding: 8px 16px 0;
    border-bottom: 1px solid var(--verde-claro);
}

.tab {
    background: transparent;
    border: none;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--verde-oscuro);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--verde-principal);
}

.tab.active {
    color: var(--verde-titulo);
    border-bottom-color: var(--verde-principal);
    font-weight: 700;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 22px 26px;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Welcome Screen */
.welcome-screen {
    text-align: center;
    max-width: 520px;
    margin: 60px auto;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 14px;
}

.welcome-screen h2 {
    color: var(--verde-titulo);
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.welcome-screen p {
    color: var(--texto-medio);
    font-size: 0.88rem;
    margin-bottom: 22px;
}

.features-list {
    list-style: none;
    text-align: left;
    display: inline-block;
}

.features-list li {
    padding: 8px 0;
    color: var(--texto-oscuro);
}

/* ═══════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════ */

.footer {
    background: var(--verde-titulo);
    color: white;
    padding: 20px 24px;
    margin-top: 30px;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto 20px;
}

.footer-left h3 {
    color: var(--verde-principal);
    margin-bottom: 10px;
}

.footer-left p {
    margin: 5px 0;
    opacity: 0.9;
}

.footer-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-right a {
    color: var(--verde-borde);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-right a:hover {
    color: var(--verde-principal);
}

.footer-bottom {
    border-top: 1px solid rgba(109, 179, 138, 0.3);
    padding-top: 20px;
    text-align: center;
}

.disclaimer {
    font-size: 0.8rem;
    opacity: 0.8;
    max-width: 800px;
    margin: 10px auto 0;
    line-height: 1.5;
}


/* ═══════════════════════════════════════════════════════════
   VALIDACIÓN — LAYOUT MULTI-ESTACIÓN
   ═══════════════════════════════════════════════════════════ */

/* Badge superior */
.val-badge {
    display: inline-block;
    background: #17a2b8;
    color: white;
    padding: 3px 11px;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

/* Flexbox de cards — ancho fijo, nunca se estira */
.val-cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

/* Card individual de estación */
.val-card {
    flex: 0 0 200px;           /* ancho fijo, nunca crece ni encoge */
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    background: white;
    border: 1px solid #d4e9e0;
    border-left: 3px solid var(--verde-principal);
    border-radius: 6px;
    padding: 12px 14px;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.val-card:hover {
    box-shadow: 0 3px 10px rgba(109,179,138,0.13);
}

.val-card-nombre {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--texto-oscuro);
    margin-bottom: 3px;
}

.val-card-tipo {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--verde-oscuro);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.val-card-meta, .val-card-ubic, .val-card-periodo {
    font-size: 0.77rem;
    color: var(--texto-medio);
    margin-bottom: 3px;
}

.val-card-coords {
    font-size: 0.72rem;
    color: #666;
    margin-bottom: 5px;
    padding: 4px 6px;
    background: #f9f9f9;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.3px;
}

.val-card-pct {
    font-size: 0.77rem;
    font-weight: 600;
    margin-top: auto;
    padding-top: 9px;
}

.val-card-pct span {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
}

.val-card-pct.pct-ok  span { background: #d4edda; color: #155724; }
.val-card-pct.pct-warn span { background: #fff3cd; color: #856404; }

/* Tabla resumen */
.val-summary-wrap {
    margin: 18px 0 0;
}

.val-summary-title {
    color: var(--verde-titulo);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.val-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.val-summary-table th {
    background: var(--verde-muy-claro);
    color: var(--verde-titulo);
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--verde-borde);
    white-space: nowrap;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.val-summary-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.val-summary-table tr:last-child td { border-bottom: none; }
.val-summary-table tr:hover td { background: var(--gris-claro); }

/* Mini barra de progreso en la tabla */
.val-pct-bar-wrap {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
    min-width: 80px;
}

.val-pct-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s;
}

.val-pct-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--texto-medio);
}

/* Tip box */
.val-tip-box {
    background: #e8f4fd;
    border: 1px solid #bee5f7;
    border-left: 3px solid #17a2b8;
    border-radius: 5px;
    padding: 9px 14px;
    font-size: 0.8rem;
    color: #0c5464;
    margin-top: 16px;
    line-height: 1.5;
}

.pisco-excel-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: #1565c0;
    border: 1.5px solid #1565c0;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.pisco-excel-dl-btn:hover {
    background: #1565c0;
    color: white;
    box-shadow: 0 3px 10px rgba(21, 101, 192, 0.3);
}
.pisco-excel-dl-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.val-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    color: var(--verde-oscuro);
    border: 1.5px solid var(--verde-principal);
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.val-download-btn:hover {
    background: var(--verde-principal);
    color: white;
    box-shadow: 0 3px 10px rgba(109, 179, 138, 0.3);
}
.val-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Acordeón de archivos */
.archivos-accordion {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 16px;
}

.archivos-summary {
    padding: 9px 16px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.84rem;
    color: var(--texto-oscuro);
    list-style: none;
    user-select: none;
}

.archivos-summary::-webkit-details-marker {
    display: none;
}

.archivos-summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
}

details[open] .archivos-summary::before {
    transform: rotate(90deg);
}

.archivos-content {
    border-top: 1px solid #e0e0e0;
    padding: 10px 16px;
    background: var(--gris-claro);
    max-height: 180px;
    overflow-y: auto;
}

.archivo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.archivo-row:last-child {
    border-bottom: none;
}

.archivo-icono {
    font-size: 0.95rem;
}

.archivo-row .archivo-nombre {
    flex: 1;
    color: var(--texto-oscuro);
    font-size: 0.82rem;
}

.archivo-info {
    color: var(--texto-medio);
    font-size: 0.78rem;
    white-space: nowrap;
}

/* Contenido de validación */
.validacion-content-box {
    background: white;
    padding: 16px;
    border-radius: 4px;
    border: 1px solid #e4e4e4;
}

.validacion-content-box h3 {
    color: var(--texto-oscuro);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.validacion-info {
    color: var(--texto-medio);
    font-size: 0.86rem;
    line-height: 1.55;
    margin-bottom: 18px;
}

/* Estadísticas en cajas */
.stats-resumen {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-box {
    background: var(--gris-claro);
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}

.stat-completitud {
    background: linear-gradient(135deg, #e8f5e9 0%, #f0f7f4 100%);
    border: 1px solid var(--verde-claro);
}

.stat-box .stat-label {
    font-size: 0.76rem;
    color: var(--texto-medio);
    margin-bottom: 5px;
    font-weight: 500;
}

.stat-box .stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--texto-oscuro);
}

.stat-value-big {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--verde-principal);
}

/* Barra de progreso */
.progress-bar-container {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--verde-principal) 0%, var(--verde-oscuro) 100%);
    transition: width 0.5s ease;
}

/* Badge de estado */
.estado-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 0.8rem;
}

.estado-valido {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.estado-revisar {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.loading {
    text-align: center;
    padding: 30px;
    color: var(--verde-oscuro);
    font-size: 0.95rem;
}

.error {
    text-align: center;
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
}

/* ═══════════════════════════════════════════════════════════
   ENCABEZADO DE ESTACIÓN (usado en tab PP)
   ═══════════════════════════════════════════════════════════ */

.estacion-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 12px 0;
}

.estacion-header {
    background: linear-gradient(135deg, #f0f7f4 0%, #ffffff 100%);
    border-left: 3px solid var(--verde-principal);
    padding: 14px 18px;
    margin-bottom: 16px;
    border-radius: 4px;
}

.estacion-badge {
    display: inline-block;
    background: #17a2b8;
    color: white;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    margin-bottom: 7px;
    letter-spacing: 0.5px;
}

.estacion-nombre {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--texto-oscuro);
    margin: 5px 0;
}

.estacion-ubicacion {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    color: var(--texto-medio);
    font-size: 0.82rem;
    margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════
   PRECIPITACIONES — SUB-TABS MULTI-ESTACIÓN
   ═══════════════════════════════════════════════════════════ */

.pp-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 10px 16px 0;
    background: var(--verde-muy-claro);
    border-bottom: 2px solid var(--verde-claro);
}

.pp-subtab-btn {
    padding: 7px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--verde-oscuro);
    border-radius: 3px 3px 0 0;
    transition: all 0.2s;
    white-space: nowrap;
}

.pp-subtab-btn:hover {
    background: white;
    color: var(--verde-titulo);
}

.pp-subtab-btn.active {
    background: white;
    color: var(--verde-titulo);
    border-bottom-color: var(--verde-principal);
    font-weight: 700;
}

.pp-subtab-content {
    display: none;
}

.pp-subtab-content.active {
    display: block;
}

/* ═══════════════════════════════════════════════════════════
   PRECIPITACIONES — MÉTRICAS Y COMPONENTES
   ═══════════════════════════════════════════════════════════ */

/* Grid de tarjetas de métricas */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0 20px;
}

/* Tarjeta de métrica individual */
.metric-card {
    background: white;
    border: 1px solid #d4e9e0;
    border-left: 3px solid var(--verde-principal);
    border-radius: 6px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

.metric-card:hover {
    box-shadow: 0 3px 10px rgba(109, 179, 138, 0.13);
}

/* Valor principal grande */
.metric-value {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--texto-oscuro);
    line-height: 1.1;
    margin: 4px 0;
}

/* Etiqueta superior */
.metric-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--verde-oscuro);
}

/* Subtexto descriptivo */
.metric-sub {
    font-size: 0.76rem;
    color: var(--texto-medio);
    margin-top: 3px;
}

/* Caja de advertencia estadística */
.warning-box {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-left: 3px solid #f9a825;
    border-radius: 5px;
    padding: 10px 14px;
    margin: 16px 0;
    font-size: 0.84rem;
    color: #5c4a00;
    line-height: 1.5;
}

/* Botón de descarga */
.download-btn {
    display: inline-block;
    background: white;
    color: var(--verde-oscuro);
    border: 1.5px solid var(--verde-principal);
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.download-btn:hover {
    background: var(--verde-principal);
    color: white;
    box-shadow: 0 3px 10px rgba(109, 179, 138, 0.3);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive para métricas */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════
   TEMPERATURA — COMPONENTES ESPECÍFICOS
   ═══════════════════════════════════════════════════════════ */

/* Grid de métricas con más columnas para temperatura */
.temp-metrics-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

/* Gráfico de temperatura — altura razonable */
.temp-chart {
    height: 320px;
    margin-bottom: 28px;
}

/* Título de sección dentro del tab */
.temp-section-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--verde-titulo);
    margin: 24px 0 4px;
}

.temp-subtitle {
    font-size: 0.8rem;
    color: var(--texto-medio);
    margin: 0 0 10px;
}

/* Tabla mensual — textos alineados al centro excepto el mes */
.temp-table td, .temp-table th {
    text-align: center;
}
.temp-table td:first-child,
.temp-table th:first-child {
    text-align: left;
}

/* Pantalla vacía (sin archivos de temperatura) */
.temp-empty, .temp-no-data {
    max-width: 480px;
    margin: 60px auto;
    text-align: center;
    color: var(--texto-medio);
}

.temp-empty-icon {
    font-size: 3rem;
    margin-bottom: 14px;
}

.temp-no-data p {
    font-size: 0.9rem;
    margin-bottom: 12px;
    line-height: 1.6;
}

.temp-hint {
    background: var(--verde-muy-claro);
    border: 1px solid var(--verde-borde);
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 0.82rem !important;
    color: var(--verde-oscuro) !important;
    text-align: left;
    line-height: 1.7 !important;
}

/* ═══════════════════════════════════════════════════════════
   MAPA — LAYOUT Y PANEL LATERAL
   ═══════════════════════════════════════════════════════════ */

.mapa-layout {
    display: flex;
    min-height: 520px;          /* fallback en pantallas pequeñas */
    height: calc(100vh - 88px); /* por si body.mapa-activo no aplica aún */
}

.mapa-sidebar {
    width: 270px;
    min-width: 220px;
    flex-shrink: 0;
    background: var(--verde-muy-claro);
    border-right: 1px solid var(--verde-claro);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.mapa-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
}

/* ── Modo full-height: se activa cuando el tab "mapa" está abierto ── */
body.mapa-activo {
    overflow: hidden;
}

body.mapa-activo .main-container {
    height: calc(100vh - 46px); /* solo resta el banner */
    overflow: hidden;
}

body.mapa-activo .sidebar-maplecture {
    height: 100%;
    overflow-y: auto;
}

body.mapa-activo .main-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.mapa-activo .tabs-container {
    flex-shrink: 0;
}

body.mapa-activo .tab-content.active {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

body.mapa-activo .mapa-layout {
    height: 100%;
    min-height: 0;
}

.mapa-panel-header {
    padding: 12px 14px 8px;
    border-bottom: 1px solid var(--verde-borde);
    background: white;
}

.mapa-panel-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--verde-titulo);
}

.mapa-legend-list {
    padding: 8px 0;
}

.mapa-legend-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #eef4f1;
    transition: background 0.15s;
}

.mapa-legend-item:hover {
    background: white;
}

.mapa-legend-dot {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    margin-top: 1px;
}

.mapa-legend-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.78rem;
    color: var(--texto-oscuro);
    min-width: 0;
}

.mapa-legend-info strong {
    font-size: 0.8rem;
    line-height: 1.3;
}

.mapa-legend-info span {
    color: var(--texto-medio);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mapa-sin-coords {
    padding: 10px 12px;
    margin: 8px 10px;
    background: #fff3cd;
    border: 1px solid #ffe082;
    border-radius: 4px;
    font-size: 0.76rem;
    color: #856404;
}

.mapa-legend-item--clickable {
    cursor: pointer;
}

.mapa-divider {
    height: 1px;
    background: var(--verde-borde);
    margin: 6px 0;
}

/* ═══════════════════════════════════════════════════════════
   ISOYETAS — CONTROLES DEL PANEL LATERAL
   ═══════════════════════════════════════════════════════════ */

.isoy-section {
    padding: 10px 12px 14px;
}

.isoy-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--verde-titulo);
    margin-bottom: 8px;
}

.isoy-warning {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 0.74rem;
    color: #7a5800;
    margin-bottom: 10px;
    line-height: 1.45;
}

.isoy-group-label {
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--texto-medio);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 5px;
}

/* ─── Radio de variable ─── */
.isoy-radio-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 6px;
}

.isoy-radio-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--texto-oscuro);
    cursor: pointer;
    padding: 3px 4px;
    border-radius: 4px;
    transition: background 0.12s;
}

.isoy-radio-item:hover {
    background: var(--verde-muy-claro);
}

.isoy-radio-item input[type="radio"] {
    accent-color: var(--verde-principal);
    cursor: pointer;
}

/* ─── Sub-selectores ─── */
.isoy-subselector {
    margin-bottom: 6px;
}

.isoy-select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--verde-borde);
    border-radius: 4px;
    font-size: 0.78rem;
    color: var(--texto-oscuro);
    background: white;
    cursor: pointer;
    outline: none;
}

.isoy-select:focus {
    border-color: var(--verde-principal);
}

/* ─── Selector de método ─── */
.isoy-method-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.isoy-method-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border: 1px solid var(--verde-borde);
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--texto-oscuro);
    background: white;
    transition: border-color 0.15s, background 0.15s;
}

.isoy-method-item:hover {
    border-color: var(--verde-principal);
    background: var(--verde-muy-claro);
}

.isoy-method-item--locked {
    opacity: 0.65;
    cursor: pointer;
    background: #f8f8f8;
}

.isoy-method-item--locked:hover {
    border-color: #bbb;
    background: #f0f0f0;
}

.isoy-method-radio {
    accent-color: var(--verde-principal);
    flex-shrink: 0;
}

.isoy-method-radio--lock {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.isoy-method-name {
    flex: 1;
    font-weight: 500;
}

.isoy-method-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--verde-oscuro);
    color: white;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.04em;
}

/* ─── Tarjeta de información de método (hover) ─── */
.isoy-method-card {
    display: none;
    position: absolute;
    left: calc(100% + 8px);
    top: 0;
    width: 210px;
    background: white;
    border: 1px solid var(--verde-borde);
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    z-index: 1200;
    pointer-events: none;
}

.isoy-method-item:hover .isoy-method-card {
    display: block;
}

.isoy-card-inner {
    padding: 10px 12px;
    font-size: 0.74rem;
    line-height: 1.5;
    color: var(--texto-oscuro);
}

.isoy-card-inner strong {
    display: block;
    font-size: 0.76rem;
    color: var(--verde-titulo);
    margin-bottom: 5px;
}

.isoy-card-inner p {
    margin-bottom: 4px;
    color: var(--texto-medio);
}

.isoy-card-use {
    color: var(--verde-oscuro) !important;
    font-weight: 500;
}

.isoy-card-ref {
    font-style: italic;
    font-size: 0.68rem !important;
    color: #999 !important;
    margin-top: 4px !important;
}

/* ─── Botones ─── */
.isoy-btn-generate {
    width: 100%;
    padding: 7px 10px;
    background: var(--verde-principal);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 5px;
}

.isoy-btn-generate:hover {
    background: var(--verde-oscuro);
}

.isoy-btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.isoy-btn-clear {
    width: 100%;
    padding: 5px 10px;
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 5px;
    font-size: 0.76rem;
    cursor: pointer;
    transition: background 0.15s;
}

.isoy-btn-clear:hover {
    background: #fff0f0;
}

/* ─── Leyenda de isoyetas en el mapa ─── */
.isoy-leyenda-leaflet {
    background: rgba(255,255,255,0.94);
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 0.76rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 130px;
}

.isoy-leyenda-title {
    font-weight: 700;
    color: var(--verde-titulo);
    margin-bottom: 6px;
    font-size: 0.75rem;
}

.isoy-leyenda-swatch {
    display: inline-block;
    width: 18px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ─── Tooltip de isoyetas ─── */
.isoy-tooltip {
    background: rgba(0,0,0,0.72);
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 0.75rem;
    padding: 2px 7px;
}

/* ─── Fila de leyenda con hint ─── */
.isoy-leyenda-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    padding: 3px 4px;
    border-radius: 4px;
    cursor: default;
    transition: background 0.15s;
}

.isoy-leyenda-row:hover {
    background: rgba(109,179,138,0.12);
}

.isoy-leyenda-val {
    flex: 1;
    font-size: 0.76rem;
    color: #333;
}

.isoy-leyenda-hint {
    font-size: 0.68rem;
    color: var(--verde-principal);
    font-weight: 700;
    opacity: 0.7;
    font-style: normal;
}

/* ─── Modales educativos ─── */
.edu-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    animation: fadeIn 0.2s;
}

.edu-modal-overlay.edu-modal-visible {
    display: flex;
    justify-content: center;
    align-items: center;
}

.edu-modal-dialog {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    animation: slideUp 0.3s;
}

.edu-modal-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.edu-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.edu-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

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

.edu-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--verde-principal);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edu-ico {
    font-size: 1.8rem;
}

.edu-modal-content {
    color: #333;
    line-height: 1.6;
    font-size: 0.9rem;
}

.edu-modal-content p {
    margin-bottom: 12px;
}

.edu-modal-content ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.edu-modal-content li {
    margin-bottom: 6px;
}

.edu-modal-content strong {
    color: var(--verde-principal);
}

.edu-modal-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85rem;
}

.edu-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.help-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: var(--verde-principal);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: help;
    margin-left: 6px;
    transition: all 0.2s;
}

.help-icon:hover {
    background: var(--verde-oscuro);
    transform: scale(1.1);
}

/* ─── Leyenda de estaciones en SENAMHI Explorer ─── */
.exp-leyenda-leaflet {
    background: rgba(255,255,255,0.97);
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px 10px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 0.7rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    width: 160px;
    max-height: 500px;
    overflow-y: auto;
}

.exp-leyenda-title {
    font-weight: 700;
    color: var(--verde-titulo);
    margin-bottom: 6px;
    font-size: 0.7rem;
    padding-bottom: 3px;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
}

.exp-leyenda-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    padding: 3px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}

.exp-leyenda-row:hover {
    background: rgba(109,179,138,0.12);
}

.exp-leyenda-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.15);
}

.exp-leyenda-label {
    flex: 1;
    color: #333;
    font-size: 0.68rem;
    line-height: 1.1;
    word-break: break-word;
    cursor: help;
    text-decoration: underline dotted;
    text-decoration-color: rgba(0,0,0,0.2);
    text-underline-offset: 2px;
}

.exp-leyenda-help {
    font-size: 0.6rem;
    color: var(--verde-principal);
    font-weight: 700;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.1s;
    width: 14px;
    text-align: center;
}

.exp-leyenda-row:hover .exp-leyenda-help {
    opacity: 1;
}

/* Tooltip personalizado para leyenda */
.exp-leyenda-tooltip {
    display: none;
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 0.65rem;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    z-index: 1000;
    pointer-events: none;
    transform: translateY(100%);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    margin-top: 2px;
}

.exp-leyenda-row {
    position: relative;
}

/* Scrollbar para leyenda */
.exp-leyenda-leaflet::-webkit-scrollbar {
    width: 5px;
}

.exp-leyenda-leaflet::-webkit-scrollbar-track {
    background: transparent;
}

.exp-leyenda-leaflet::-webkit-scrollbar-thumb {
    background: rgba(109,179,138,0.4);
    border-radius: 3px;
}

.exp-leyenda-leaflet::-webkit-scrollbar-thumb:hover {
    background: rgba(109,179,138,0.6);
}

/* ─── Tarjeta de interpretación ─── */
.isoy-interp-card {
    position: absolute;
    bottom: 170px;
    right: 16px;
    z-index: 900;
    width: 240px;
    pointer-events: none;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.18));
}

.isoy-interp-inner {
    background: white;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border-left: 4px solid #ccc;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.isoy-interp-ico {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 1px;
}

.isoy-interp-text strong {
    display: block;
    font-size: 0.78rem;
    color: #1a1a1a;
    margin-bottom: 4px;
    line-height: 1.3;
}

.isoy-interp-text p {
    font-size: 0.72rem;
    color: #555;
    line-height: 1.45;
    margin: 0;
}

/* Colores por clase de interpretación */
.interp-muy-seco    { border-left-color: #e0c080; }
.interp-seco        { border-left-color: #f9a825; }
.interp-moderado    { border-left-color: #74add1; }
.interp-lluvioso    { border-left-color: #4393c3; }
.interp-muy-lluvioso{ border-left-color: #2166ac; }
.interp-extremo     { border-left-color: #d73027; }

/* ─── Botones Pro (descarga) ─── */
.isoy-download-section {
    margin-top: 4px;
}

.isoy-download-note {
    font-size: 0.72rem;
    color: var(--texto-medio);
    line-height: 1.45;
    margin-bottom: 7px;
}

.isoy-download-note strong {
    color: var(--verde-oscuro);
}

.isoy-btn-pro {
    width: 100%;
    padding: 6px 10px;
    background: #f5f5f5;
    color: #888;
    border: 1px dashed #ccc;
    border-radius: 5px;
    font-size: 0.78rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    transition: background 0.15s;
}

.isoy-btn-pro:hover {
    background: #efefef;
}

/* ─── Tarjetas educativas ─── */
.isoy-edu-section {
    border-top: 1px solid var(--verde-borde);
    padding: 8px 0 4px;
    margin-top: 4px;
}

.isoy-edu-card {
    border-bottom: 1px solid var(--verde-claro);
}

.isoy-edu-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.77rem;
    font-weight: 600;
    color: var(--verde-titulo);
    text-align: left;
    gap: 6px;
    transition: background 0.15s;
}

.isoy-edu-toggle:hover {
    background: white;
}

.isoy-edu-arrow {
    font-size: 0.7rem;
    color: var(--verde-principal);
    flex-shrink: 0;
}

.isoy-edu-body {
    padding: 6px 14px 10px 14px;
    background: white;
}

.isoy-edu-body p {
    font-size: 0.74rem;
    color: var(--texto-medio);
    line-height: 1.55;
    margin: 0;
}

/* ─── Modal Kriging ─── */
.kriging-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.kriging-modal-inner {
    background: white;
    border-radius: 8px;
    padding: 24px 28px;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    position: relative;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--texto-oscuro);
}

.kriging-modal-inner strong {
    display: block;
    font-size: 0.95rem;
    color: var(--verde-titulo);
    margin-bottom: 8px;
    margin-top: 4px;
}

.kriging-modal-inner p {
    color: var(--texto-medio);
    margin-bottom: 14px;
}

.kriging-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
}

.kriging-modal-link {
    display: inline-block;
    background: var(--verde-principal);
    color: white;
    padding: 6px 14px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.15s;
}

.kriging-modal-link:hover {
    background: var(--verde-oscuro);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .sidebar-maplecture {
        border-right: none;
        border-bottom: 1px solid var(--verde-claro);
        max-height: none;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }

    .mapa-layout {
        flex-direction: column;
        height: auto;
    }

    .mapa-sidebar {
        width: 100%;
        min-width: unset;
        border-right: none;
        border-bottom: 1px solid var(--verde-claro);
    }

    .mapa-main {
        height: 400px;
    }
}

/* ═══════════════════════════════════════════════════════════
   RED SENAMHI — BOTÓN TOGGLE + DOTS EN MAPA
   ═══════════════════════════════════════════════════════════ */

.mapa-red-section {
    padding: 8px 12px 6px;
    border-bottom: 1px solid var(--verde-borde);
    display: flex;
    align-items: center;
    gap: 8px;
}

.mapa-red-btn {
    padding: 5px 10px;
    background: white;
    border: 1px solid var(--verde-borde);
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--verde-titulo);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.mapa-red-btn:hover {
    background: var(--verde-muy-claro);
    border-color: var(--verde-principal);
}

.mapa-red-btn.active {
    background: #e3f0ff;
    border-color: #3498db;
    color: #1a5276;
}

.mapa-red-hint {
    font-size: 0.68rem;
    color: var(--texto-medio);
    line-height: 1.3;
}

/* Dot de estación SENAMHI en el mapa */
.sena-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1.5px solid;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.sena-dot:hover {
    opacity: 1;
    transform: scale(1.3);
}

/* Cluster badge */
.sena-cluster {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.85);
    border: 2px solid white;
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Marcador destacado al buscar desde sidebar */
.sena-highlight-marker {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.25);
    border: 3px solid #e74c3c;
    animation: pulse-sena 1.4s ease-in-out infinite;
}

@keyframes pulse-sena {
    0%   { transform: scale(1);   opacity: 1; }
    50%  { transform: scale(1.5); opacity: 0.6; }
    100% { transform: scale(1);   opacity: 1; }
}

/* Botón de importar dentro del popup SENAMHI en el mapa */
.sena-import-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 7px 10px;
    background: var(--verde-principal);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}

.sena-import-btn:hover {
    background: var(--verde-oscuro);
}

/* ═══════════════════════════════════════════════════════════
   DIÁLOGO DE IMPORTACIÓN SENAMHI
   ═══════════════════════════════════════════════════════════ */

.import-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
}

.import-overlay.visible {
    opacity: 1;
}

.import-dialog {
    background: white;
    border-radius: 10px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.22);
    font-family: 'Segoe UI', Arial, sans-serif;
    transform: translateY(12px);
    transition: transform 0.25s;
}

.import-overlay.visible .import-dialog {
    transform: translateY(0);
}

.idlg-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--verde-claro);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.idlg-title {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.idlg-ico {
    font-size: 1.4rem;
    line-height: 1;
    margin-top: 2px;
}

.idlg-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--verde-titulo);
    line-height: 1.2;
}

.idlg-meta {
    font-size: 0.76rem;
    color: var(--texto-medio);
    margin-top: 2px;
}

.idlg-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 2px;
    flex-shrink: 0;
}

.idlg-close:hover { color: #333; }

.idlg-body {
    padding: 18px 20px 20px;
}

.idlg-variables {
    background: var(--verde-muy-claro);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.idlg-vars-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--verde-oscuro);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.idlg-vars-val {
    font-size: 0.78rem;
    color: var(--texto-oscuro);
}

.idlg-steps {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 16px;
}

.idlg-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.idlg-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--verde-principal);
    color: white;
    font-weight: 700;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.idlg-step-body {
    flex: 1;
    min-width: 0;
}

.idlg-step-body strong {
    display: block;
    font-size: 0.84rem;
    color: var(--texto-oscuro);
    margin-bottom: 5px;
}

.idlg-step-body p {
    font-size: 0.76rem;
    color: var(--texto-medio);
    margin-bottom: 8px;
    line-height: 1.45;
}

.idlg-senamhi-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #e8f4fd;
    border: 1px solid #9ecfea;
    color: #1a5276;
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.15s;
}

.idlg-senamhi-link:hover {
    background: #d1eaf9;
}

/* Drop zone dentro del diálogo */
.idlg-dropzone {
    border: 2px dashed var(--verde-borde);
    border-radius: 8px;
    padding: 22px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: white;
}

.idlg-dropzone:hover,
.idlg-dropzone.drag-over {
    border-color: var(--verde-principal);
    background: var(--verde-muy-claro);
}

.idlg-drop-ico {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.idlg-drop-text {
    font-size: 0.8rem;
    color: var(--texto-medio);
    line-height: 1.5;
}

.idlg-drop-text small {
    font-size: 0.72rem;
    color: #aaa;
}

/* Estados de importación */
.idlg-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 0.78rem;
    line-height: 1.4;
    display: none;
}

.idlg-status:not(:empty) { display: block; }

.idlg-status--loading {
    background: #e8f4fd;
    color: #1a5276;
}

.idlg-status--success {
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    color: #1e8449;
}

.idlg-status--error {
    background: #fff0f0;
    border: 1px solid #f5b7b1;
    color: #922b21;
}

/* Tip al pie del diálogo */
.idlg-tip {
    background: #fffde7;
    border: 1px solid #ffe082;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 0.74rem;
    color: #7a5800;
    line-height: 1.5;
}

.idlg-tip strong {
    color: #5d4037;
}

/* ── Sección Carga Automática ─────────────────────────────────── */
.idlg-auto-section {
    background: linear-gradient(135deg, #f0f9f4 0%, #e8f5e9 100%);
    border: 1.5px solid #a5d6a7;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 4px;
}

.idlg-auto-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.idlg-auto-badge {
    background: #2e7d32;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.idlg-auto-header strong {
    font-size: 0.84rem;
    color: #1b5e20;
}

.idlg-auto-desc {
    font-size: 0.78rem;
    color: #388e3c;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

/* Mini pasos dentro de la sección auto */
.idlg-auto-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.idlg-auto-step {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 0.76rem;
    color: #2e5c30;
    line-height: 1.4;
}

.idlg-as-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #4caf50;
    color: #fff;
    font-size: 0.67rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.idlg-year-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.idlg-year-row label {
    font-size: 0.76rem;
    color: #4a6741;
    font-weight: 600;
    white-space: nowrap;
}

.idlg-year-input {
    width: 90px;
    padding: 4px 8px;
    border: 1px solid #a5d6a7;
    border-radius: 5px;
    font-size: 0.8rem;
    color: #2e4d31;
    background: #fff;
    outline: none;
}
.idlg-year-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76,175,80,0.15);
}

.idlg-auto-btn {
    width: 100%;
    padding: 10px 0;
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.3px;
}
.idlg-auto-btn:hover:not(:disabled) {
    background: #1b5e20;
    transform: translateY(-1px);
}
.idlg-auto-btn:disabled {
    background: #81c784;
    cursor: not-allowed;
    transform: none;
}

/* ── Barra de progreso ──────────────────────────────────────── */
.idlg-auto-progress {
    margin-top: 10px;
}

.idlg-progress-bar-wrap {
    background: #c8e6c9;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 6px;
}

.idlg-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #43a047, #66bb6a);
    border-radius: 20px;
    width: 0%;
    transition: width 0.5s ease;
}

.idlg-progress-bar.done {
    background: linear-gradient(90deg, #2e7d32, #43a047);
}

.idlg-progress-msg {
    font-size: 0.75rem;
    color: #2e7d32;
    font-weight: 500;
    min-height: 16px;
}

/* ── Divisor "o descarga manualmente" ────────────────────────── */
.idlg-divider-or {
    text-align: center;
    position: relative;
    margin: 14px 0 10px;
    color: #aaa;
    font-size: 0.76rem;
}
.idlg-divider-or::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e0e0e0;
    z-index: 0;
}
.idlg-divider-or span {
    position: relative;
    background: #fff;
    padding: 0 10px;
    z-index: 1;
    color: #999;
}

/* ═══════════════════════════════════════════════════════════
   EXPLORADOR SENAMHI — Layout full-height (tab "explorar")
   El explorador ocupa toda la ventana disponible pero NO
   bloquea el scroll del body ni oculta el banner/footer.
   ═══════════════════════════════════════════════════════════ */

/* El tab-content del explorador tiene altura propia */
#explorar-content {
    height: calc(100vh - 96px); /* 52px banner + 44px tabs aprox */
    min-height: 400px;
    padding: 0 !important;
    overflow: hidden;
    display: none; /* oculto por defecto, .active lo muestra */
}

#explorar-content.active {
    display: flex !important;
    flex-direction: column;
}

/* PISCO tab — misma altura que explorador */
#pisco-content {
    height: calc(100vh - 96px);
    min-height: 400px;
    padding: 0 !important;
    overflow: hidden;
    display: none;
}
#pisco-content.active {
    display: flex !important;
}

/* ── Layout del explorador ──────────────────────────────── */
.explorer-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

/* Panel izquierdo */
.explorer-panel {
    width: 300px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    overflow: hidden;
    flex-shrink: 0;
}

/* Mapa del explorador */
.explorer-map {
    flex: 1;
    height: 100%;
    min-height: 0;
    background: #e8f0e9;
}

/* ── Buscador ───────────────────────────────────────────── */
.exp-search-wrap {
    padding: 10px 10px 6px;
    border-bottom: 1px solid #f0f0f0;
}

.exp-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1.5px solid #c8e6c9;
    border-radius: 7px;
    font-size: 0.83rem;
    color: #2e4d31;
    background: #f9fdf9;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.exp-search-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76,175,80,0.12);
    background: #fff;
}

/* ── Filtros rápidos ────────────────────────────────────── */
.exp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.exp-filter-btn {
    padding: 3px 9px;
    border: 1.5px solid #c8e6c9;
    border-radius: 20px;
    background: #fff;
    color: #4a6741;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.exp-filter-btn:hover { background: #e8f5e9; }
.exp-filter-btn.active {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}
/* Botón históricas — gris con reloj */
.exp-filter-hist {
    border-color: #bdbdbd;
    color: #757575;
}
.exp-filter-hist:hover { background: #f5f5f5; }
.exp-filter-hist.active {
    background: #757575;
    border-color: #757575;
    color: #fff;
}

/* ── Toggle de capas (históricas, UH, etc.) ─────────────── */
.exp-layer-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #444;
    padding: 4px 2px;
    border-radius: 5px;
    transition: background 0.15s;
    user-select: none;
}
.exp-layer-toggle:hover { background: #f0f7f4; }
.exp-layer-toggle input[type="checkbox"] { cursor: pointer; accent-color: #4caf50; }
.exp-layer-toggle-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
    opacity: 0.8;
}
.exp-layer-status {
    margin-left: auto;
    font-size: 0.66rem;
    color: #00838f;
    font-style: italic;
}

/* ── Tooltip de Unidades Hidrográficas (Leaflet) ─────────── */
.exp-uh-tooltip {
    background: rgba(0, 77, 64, 0.88) !important;
    border: 1px solid #004d40 !important;
    color: #e0f7f4 !important;
    font-size: 0.75rem !important;
    border-radius: 5px !important;
    padding: 4px 8px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25) !important;
}
.exp-uh-tooltip::before { border-right-color: #004d40 !important; }

/* ── Popup de Unidades Hidrográficas ─────────────────────── */
.exp-uh-popup { font-size: 0.8rem; min-width: 190px; }
.exp-uh-popup-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: #00695c;
    padding-bottom: 5px;
    margin-bottom: 7px;
    border-bottom: 2px solid #00838f;
}

/* ── Barra de estadísticas ──────────────────────────────── */
.exp-stats-bar {
    padding: 5px 12px;
    font-size: 0.74rem;
    color: #5d8c5f;
    background: #f5fbf5;
    border-bottom: 1px solid #e8f0e9;
    min-height: 24px;
    display: flex;
    align-items: center;
}

/* ── Lista de resultados ────────────────────────────────── */
.exp-list-wrap {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.exp-list-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.12s;
    user-select: none;
}
.exp-list-item:hover { background: #f0f9f0; }
.exp-list-item:last-child { border-bottom: none; }

.exp-li-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(0,0,0,0.12);
}

.exp-li-body { flex: 1; min-width: 0; }

.exp-li-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #2e4d31;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exp-li-meta {
    font-size: 0.71rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.exp-li-arrow {
    color: #ccc;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Badge de distancia al proyecto en lista principal */
.exp-li-dist {
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 7px;
    white-space: nowrap;
    flex-shrink: 0;
}
.exp-li-dist-near  { background: #c8e6c9; color: #1b5e20; }   /* < 20 km — verde */
.exp-li-dist-mid   { background: #fff9c4; color: #e65100; }   /* 20–60 km — amarillo */
.exp-li-dist-far   { background: #fce4ec; color: #b71c1c; }   /* > 60 km — rojo */

/* Aviso de orden por distancia */
.exp-list-proy-hint {
    padding: 5px 12px;
    font-size: 0.68rem;
    color: #1565c0;
    background: #e3f2fd;
    border-bottom: 1px solid #bbdefb;
}

.exp-empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 0.8rem;
    color: #aaa;
}

.exp-list-more {
    padding: 8px 12px;
    font-size: 0.72rem;
    color: #999;
    background: #fafafa;
    text-align: center;
    border-top: 1px solid #eee;
}

/* ── Hint de uso ────────────────────────────────────────── */
.exp-usage-hint {
    padding: 12px 14px;
    font-size: 0.74rem;
    color: #4a6741;
    background: #f5fbf5;
    border-top: 1px solid #dceade;
    line-height: 1.5;
}
.exp-usage-hint strong { color: #2e5c30; }

.exp-usage-steps {
    margin: 8px 0 0 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.exp-usage-steps li {
    color: #555;
    line-height: 1.45;
}
.exp-usage-steps li strong {
    color: #1b5e20;
    background: #e8f5e9;
    padding: 1px 4px;
    border-radius: 3px;
}

.exp-usage-method {
    margin-top: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #dceade;
    border-radius: 6px;
}
.exp-usage-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}
.exp-badge-rec   { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.exp-badge-manual{ background: #e8eaf6; color: #3949ab; border: 1px solid #9fa8da; } /* "Técnico" → azul índigo */

.exp-usage-scraper-link {
    display: block;
    margin-top: 6px;
    font-size: 0.71rem;
    color: #1565c0;
    text-decoration: none;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    transition: background 0.15s;
}
.exp-usage-scraper-link:hover { background: #bbdefb; }

.exp-usage-tip {
    margin-top: 10px;
    padding: 8px 10px;
    background: #e8f0fe;
    border-left: 3px solid #3f51b5;
    border-radius: 4px;
    color: #283593;
    font-size: 0.71rem;
    line-height: 1.45;
}

/* ── Panel "Mi Proyecto" ──────────────────────────────────── */
.exp-proyecto-section {
    border-top: 1px solid #e0e0e0;
    padding: 10px 10px 6px;
}
.exp-proyecto-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    color: #3d7a5a;
    margin-bottom: 7px;
}
.exp-proyecto-clear {
    background: none;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 0.68rem;
    cursor: pointer;
    padding: 2px 8px;
    color: #aaa;
    transition: all 0.2s;
    line-height: 1.6;
}
.exp-proyecto-clear:hover { border-color: #e57373; color: #c62828; background: #fff5f5; }

.exp-proyecto-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #b2d8c8;
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
    background: #f6fdf9;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
    gap: 3px;
}
.exp-proyecto-drop:hover,
.exp-proyecto-drop.drag-over {
    border-color: #4caf50;
    background: #edf7f2;
}
.exp-proyecto-icon { font-size: 1.3rem; line-height: 1; }
.exp-proyecto-label { font-size: 0.72rem; color: #5a7a5e; line-height: 1.45; }
.exp-proyecto-label small { color: #aaa; font-size: 0.67rem; }

/* Resultado: lista de cercanas */
.exp-proyecto-resultado {
    margin-top: 8px;
    border: 1px solid #dce8dc;
    border-radius: 7px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.exp-proyecto-lista {
    max-height: 280px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #b2d8c8 #f5fbf5;
}
.exp-proyecto-lista::-webkit-scrollbar { width: 5px; }
.exp-proyecto-lista::-webkit-scrollbar-track { background: #f5fbf5; }
.exp-proyecto-lista::-webkit-scrollbar-thumb { background: #b2d8c8; border-radius: 4px; }
.exp-proyecto-titulo {
    font-weight: 700;
    font-size: 0.76rem;
    color: #2e6b42;
    padding: 7px 10px 2px;
    background: #edf7f2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.exp-proyecto-subtitulo {
    font-size: 0.68rem;
    color: #8aab8a;
    padding: 1px 10px 6px;
    background: #edf7f2;
    border-bottom: 1px solid #dce8dc;
}
.exp-cercana-item {
    display: grid;
    grid-template-columns: 16px 10px 1fr auto;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid #f2f6f2;
    cursor: pointer;
    transition: background 0.12s;
}
.exp-cercana-item:last-child { border-bottom: none; }
.exp-cercana-item:hover { background: #f0faf2; }
.exp-cercana-num {
    font-size: 0.63rem;
    color: #ccc;
    text-align: right;
    font-weight: 600;
}
.exp-cercana-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.1);
}
.exp-cercana-nombre {
    font-size: 0.74rem;
    font-weight: 600;
    color: #222;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.exp-cercana-nombre small {
    display: block;
    font-size: 0.66rem;
    font-weight: 400;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.exp-cercana-dist {
    font-size: 0.7rem;
    font-weight: 700;
    color: #2e7d32;
    background: #e8f5e9;
    border-radius: 10px;
    padding: 2px 7px;
    white-space: nowrap;
}

/* ── Cluster del explorador ─────────────────────────────── */
.exp-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.7);
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    width: 36px;
    height: 36px;
    background: #4caf50;
}
.exp-cluster--sm { background: #66bb6a; width: 30px; height: 30px; font-size: 0.7rem; }
.exp-cluster--md { background: #43a047; width: 36px; height: 36px; }
.exp-cluster--lg { background: #2e7d32; width: 44px; height: 44px; font-size: 0.82rem; }

/* ── Popup del explorador ───────────────────────────────── */
.exp-popup {
    font-family: Segoe UI, Arial, sans-serif;
    font-size: 0.81rem;
    min-width: 220px;
}

.exp-popup-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: #1b3a1f;
    padding-bottom: 6px;
    margin-bottom: 8px;
    border-bottom: 2.5px solid #4caf50; /* overridden inline per station */
}

.exp-popup-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.77rem;
    margin-bottom: 10px;
}
.exp-popup-table td { padding: 2px 6px 2px 0; vertical-align: top; }
.exp-popup-table td:first-child {
    color: #777;
    white-space: nowrap;
    padding-right: 8px;
    font-weight: 500;
}
.exp-popup-table td:last-child { font-weight: 500; color: #2e4d31; }

.exp-old-cod { color: #aaa; font-weight: 400; font-size: 0.72rem; }

.exp-dl-btn {
    display: block;
    text-align: center;
    background: #2e7d32;
    color: #fff !important;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.81rem;
    font-weight: 700;
    transition: background 0.2s;
    margin-bottom: 6px;
}
.exp-dl-btn:hover { background: #1b5e20; }

.exp-popup-hint {
    font-size: 0.69rem;
    color: #999;
    text-align: center;
    line-height: 1.4;
}

/* ── Sección descarga directa (para todos los usuarios) ─── */
.exp-manual-section {
    margin: 10px 0 6px;
    padding: 10px 12px;
    background: #f0f7f4;
    border: 1.5px solid #81c784;
    border-radius: 8px;
}
.exp-manual-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2e5c30;
    margin-bottom: 8px;
}
/* Botón primario de apertura en SENAMHI */
.exp-dl-btn-primary {
    display: block;
    text-align: center;
    background: #2e7d32;
    color: #fff !important;
    text-decoration: none;
    padding: 9px 10px;
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 700;
    transition: background 0.2s;
    margin-bottom: 8px;
    letter-spacing: 0.2px;
}
.exp-dl-btn-primary:hover { background: #1b5e20; }
/* Pasos simples para descarga manual */
.exp-manual-steps {
    margin: 0 0 2px 16px;
    padding: 0;
    font-size: 0.72rem;
    color: #444;
    line-height: 1.7;
}
.exp-manual-steps strong { color: #2e5c30; }

/* ── Sección colapsable "Con Scraper" ─────────────────────── */
.exp-scraper-details {
    margin-top: 6px;
    border: 1px solid #c5cae9;
    border-radius: 6px;
    overflow: hidden;
    background: #fafafa;
}
.exp-scraper-summary {
    padding: 7px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #3949ab;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}
.exp-scraper-summary::-webkit-details-marker { display: none; }
.exp-scraper-summary::before {
    content: '▶';
    font-size: 0.6rem;
    transition: transform 0.2s;
    display: inline-block;
}
.exp-scraper-details[open] .exp-scraper-summary::before {
    transform: rotate(90deg);
}
.exp-scraper-summary:hover { background: #e8eaf6; }
.exp-scraper-inner {
    padding: 8px 10px 10px;
    border-top: 1px solid #c5cae9;
}

/* ── Sección "Descargar con Scraper" en popup de estación ── */
.exp-scraper-section {
    margin: 10px 0 6px;
    padding: 10px 12px;
    background: #f0f7f4;
    border: 1.5px solid #81c784;
    border-radius: 8px;
}
/* Modo automático (scraper corriendo) → verde más intenso */
.exp-scraper-auto {
    background: linear-gradient(135deg, #e8f5e9, #f1f8f2);
    border-color: #43a047;
}
.exp-scraper-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2e5c30;
    margin-bottom: 4px;
}
.exp-scraper-hint {
    font-size: 0.68rem;
    color: #558b2f;
    margin-bottom: 8px;
}
.exp-scraper-years {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    color: #444;
}
.exp-scraper-input {
    width: 64px;
    padding: 3px 5px;
    border: 1px solid #aaa;
    border-radius: 4px;
    font-size: 0.78rem;
    text-align: center;
}
.exp-scraper-btn {
    width: 100%;
    padding: 7px;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.exp-scraper-btn:hover:not(:disabled) { background: #1b5e20; }
.exp-scraper-btn:disabled { background: #9e9e9e; cursor: not-allowed; }
.exp-scraper-status {
    margin-top: 6px;
    font-size: 0.71rem;
    line-height: 1.4;
}
.exp-scraper-status.info  { color: #1565c0; }
.exp-scraper-status.ok    { color: #2e7d32; font-weight: 600; }
.exp-scraper-status.error { color: #c62828; }
/* Fila del código + botón copiar */
.exp-scraper-cod-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.exp-scraper-cod-label {
    font-size: 0.72rem;
    color: #555;
}
.exp-scraper-cod {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    background: #e8f5e9;
    padding: 2px 7px;
    border-radius: 4px;
    color: #1b5e20;
    letter-spacing: 0.5px;
    border: 1px solid #c8e6c9;
}
.exp-scraper-copy-btn {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: #fff;
    border: 1px solid #81c784;
    border-radius: 4px;
    color: #2e7d32;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.exp-scraper-copy-btn:hover { background: #e8f5e9; }
/* Pasos numerados */
.exp-scraper-steps {
    margin: 0 0 8px 16px;
    padding: 0;
    font-size: 0.72rem;
    color: #444;
    line-height: 1.6;
}
.exp-scraper-steps code {
    font-family: 'Courier New', monospace;
    background: #e8eaf6;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.78rem;
    color: #283593;
}
/* Enlace de descarga del scraper */
.exp-scraper-link {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    color: #1565c0;
    text-decoration: none;
    padding: 5px;
    background: #e3f2fd;
    border-radius: 5px;
    margin-top: 2px;
    transition: background 0.15s;
}
.exp-scraper-link:hover { background: #bbdefb; }

/* ═══════════════════════════════════════════════════════════
   TAB PISCO — Validación de datos grillados vs estaciones
   ═══════════════════════════════════════════════════════════ */

/* Layout de 2 columnas */
.pisco-layout {
    display: flex;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* En pantallas pequeñas: apilar verticalmente */
@media (max-width: 700px) {
    .pisco-layout {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }
    .pisco-panel {
        width: 100% !important;
        min-width: 0 !important;
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    .pisco-results-area {
        min-height: 400px;
    }
}

/* Panel izquierdo: configuración */
.pisco-panel {
    width: 300px;
    min-width: 280px;
    flex-shrink: 0;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 14px 14px 20px;
    background: #f9fdf9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pisco-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1b3a1f;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--verde-principal);
}
.pisco-intro {
    font-size: 0.77rem;
    color: #555;
    line-height: 1.5;
}

/* Pasos numerados */
.pisco-step {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.pisco-step-num {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    background: var(--verde-principal);
    color: white;
    font-size: 0.74rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.pisco-step-body { flex: 1; }
.pisco-step-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #2e4d31;
    margin-bottom: 6px;
}

/* Zona drag & drop de archivo NC */
.pisco-dropzone {
    border: 2px dashed #81c784;
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    font-size: 0.77rem;
    color: #555;
    background: #fff;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    line-height: 1.4;
}
.pisco-dropzone:hover,
.pisco-drop-hover { border-color: #2e7d32; background: #f1f8f2; }
.pisco-drop-icon { font-size: 1.5rem; }
.pisco-nc-status {
    font-size: 0.71rem;
    margin-top: 5px;
    padding: 3px 6px;
    border-radius: 4px;
    line-height: 1.4;
}
.pisco-status-loading { color: #1565c0; background: #e3f2fd; padding: 6px 10px; border-radius: 5px; font-size: 0.82rem; }
.pisco-status-ok      { color: #1b5e20; background: #e8f5e9; padding: 6px 10px; border-radius: 5px; font-size: 0.82rem; }
.pisco-status-error   { color: #c62828; background: #ffebee; padding: 6px 10px; border-radius: 5px; font-size: 0.82rem; }

/* Selector de estación */
.pisco-sel {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #b2d8c8;
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
}
.pisco-estacion-info {
    margin-top: 5px;
    font-size: 0.71rem;
    color: #444;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
.pisco-est-chip {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #2e7d32;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 600;
}
.pisco-est-chip-gray {
    background: #f5f5f5;
    border-color: #bbb;
    color: #555;
}
.pisco-est-coords { color: #888; }

/* Período */
.pisco-period-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #444;
}
.pisco-year-input {
    width: 68px;
    padding: 4px 5px;
    border: 1px solid #b2d8c8;
    border-radius: 5px;
    font-size: 0.8rem;
    text-align: center;
}

/* Botón analizar */
.pisco-btn-analizar {
    width: 100%;
    padding: 10px;
    background: var(--verde-oscuro);
    color: white;
    border: none;
    border-radius: 7px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 4px;
}
.pisco-btn-analizar:hover:not(:disabled) { background: #1b5e20; }
.pisco-btn-analizar:disabled { background: #9e9e9e; cursor: not-allowed; }

/* Barra de progreso */
.pisco-progreso {
    font-size: 0.74rem;
    color: #1565c0;
    background: #e3f2fd;
    padding: 8px 10px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.pisco-progreso-bar {
    height: 4px;
    background: linear-gradient(90deg, #1565c0 0%, #42a5f5 50%, #1565c0 100%);
    background-size: 200% 100%;
    border-radius: 2px;
    animation: piscoSlide 1.5s linear infinite;
}
@keyframes piscoSlide {
    0%   { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* Caja de referencia */
.pisco-ref-box {
    font-size: 0.71rem;
    color: #555;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    padding: 8px 10px;
    line-height: 1.6;
    margin-top: auto;
}
.pisco-ref-box a { color: #1565c0; }
.pisco-ref-box strong { color: #f57f17; }

/* Panel de resultados */
.pisco-results-area {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    min-width: 0;
}

/* Welcome screen */
.pisco-welcome {
    text-align: center;
    padding: 50px 20px;
    color: #888;
}
.pisco-welcome-icon { font-size: 3rem; margin-bottom: 10px; }
.pisco-welcome h3 { color: #2e4d31; margin-bottom: 8px; }
.pisco-welcome p  { font-size: 0.88rem; margin-bottom: 12px; }
.pisco-welcome-list {
    text-align: left;
    display: inline-block;
    font-size: 0.83rem;
    line-height: 2;
    color: #555;
}

/* Header de resultado */
.pisco-result-header { margin-bottom: 10px; }
.pisco-result-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.pisco-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 10px;
}
.pisco-badge-tipo { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }
.pisco-badge-res  { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.pisco-badge-dist { background: #fff8e1; color: #f57f17; border: 1px solid #ffe082; }

/* Selector de variable (tmax/tmin/tmean) */
.pisco-var-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 10px 0;
}
.pisco-var-tab {
    padding: 4px 12px;
    border: 1px solid #81c784;
    border-radius: 14px;
    background: white;
    font-size: 0.76rem;
    color: #2e7d32;
    cursor: pointer;
    transition: all 0.15s;
}
.pisco-var-tab.active {
    background: #2e7d32;
    color: white;
    border-color: #2e7d32;
}

/* Métricas */
.pisco-metricas-section {
    background: #f0f7f4;
    border: 1px solid #b2d8c8;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}
.pisco-metricas-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #2e4d31;
    margin-bottom: 8px;
}
.pisco-metricas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 4px 10px;
}
.pisco-met-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.77rem;
    padding: 2px 0;
    border-bottom: 1px solid #ddeedd;
}
.pisco-met-label { color: #666; }
.pisco-met-val   { font-weight: 600; color: #1b3a1f; }
.pisco-cal       { font-size: 0.68rem; margin-left: 4px; font-weight: 400; }
.pisco-metricas-nota {
    margin-top: 7px;
    font-size: 0.68rem;
    color: #777;
    font-style: italic;
}
.pisco-tip-hint { color: #4a90a4; font-style: normal; }

/* ── Tooltips educativos en métricas ──────────────────────── */
.pisco-tip {
    position: relative;
    cursor: help;
}
.pisco-tip-icon {
    font-size: 0.68rem;
    color: #4a90a4;
    margin-left: 2px;
    font-style: normal;
}
.pisco-tip:hover .pisco-tip-icon {
    color: #1a6a7a;
}
/* El tooltip en sí (aparece al hacer hover) */
.pisco-tip::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    width: 300px;
    background: #1b3a1f;
    color: #f0faf2;
    font-size: 0.72rem;
    font-weight: 400;
    font-style: normal;
    line-height: 1.45;
    padding: 9px 11px;
    border-radius: 7px;
    white-space: pre-line;       /* respeta los \n en data-tip */
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
/* Pequeña flechita */
.pisco-tip::before {
    content: '';
    position: absolute;
    left: 12px;
    bottom: calc(100% + 1px);
    border: 5px solid transparent;
    border-top-color: #1b3a1f;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.pisco-tip:hover::after,
.pisco-tip:hover::before {
    opacity: 1;
    transform: translateY(0);
}

/* Tabs de gráficos */
.pisco-graf-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 6px;
}
.pisco-graf-tab {
    padding: 5px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background: white;
    font-size: 0.77rem;
    cursor: pointer;
    transition: all 0.15s;
    color: #444;
}
.pisco-graf-tab:hover { background: #f0f7f4; border-color: #81c784; }
.pisco-graf-tab.active {
    background: var(--verde-oscuro);
    color: white;
    border-color: var(--verde-oscuro);
}
.pisco-chart-container {
    width: 100%;
    min-height: 340px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
}
.pisco-error {
    background: #ffebee;
    color: #c62828;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
}

/* ── PISCO: archivos en servidor ─────────────────────────── */
.pisco-files-status {
    margin-top: 6px;
    min-height: 32px;
}

.pisco-files-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pisco-file-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.82rem;
}

.pisco-file-icon { font-size: 1.1rem; flex-shrink: 0; }

.pisco-file-info {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    align-items: center;
}

.pisco-file-info strong { color: #1b5e20; }
.pisco-file-info span  { color: #555; font-size: 0.78rem; }
.pisco-file-res        { color: #888; font-style: italic; }

.pisco-file-size {
    font-size: 0.75rem;
    color: #888;
    flex-shrink: 0;
    white-space: nowrap;
}

.pisco-files-empty,
.pisco-files-error {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.82rem;
    color: #795548;
    line-height: 1.5;
}

.pisco-files-error { background: #ffebee; border-color: #ef9a9a; color: #c62828; }

.pisco-dl-link {
    color: #1565c0;
    text-decoration: none;
    font-weight: 600;
}

.pisco-dl-link:hover { text-decoration: underline; }

/* ── PISCO: mini mapa del proyecto ───────────────────────── */
.pisco-mapa {
    width: 100%;
    box-sizing: border-box;
    height: 200px;
    border-radius: 8px;
    border: 1px solid #c8e6c9;
    margin: 8px 0 6px;
    overflow: hidden;
    position: relative;   /* Leaflet necesita un ancestro posicionado */
    z-index: 0;
    background: #e8f5e9;  /* color verde claro mientras carga */
}

.pisco-coord-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.pisco-coord-row label {
    font-size: 0.78rem;
    color: #555;
    white-space: nowrap;
}

.pisco-coord-input {
    flex: 1;
    border: 1px solid #c8e6c9;
    border-radius: 5px;
    padding: 5px 7px;
    font-size: 0.82rem;
    background: #f9fbe7;
    min-width: 0;
    outline: none;
}

.pisco-coord-input:focus { border-color: #66bb6a; background: #fff; }

.pisco-mapa-hint {
    display: block;
    color: #888;
    font-size: 0.75rem;
    margin-top: 2px;
}

.pisco-nombre-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c8e6c9;
    border-radius: 5px;
    padding: 6px 9px;
    font-size: 0.82rem;
    background: #f9fbe7;
    margin-bottom: 4px;
    outline: none;
}

.pisco-nombre-input:focus { border-color: #66bb6a; background: #fff; }

/* ── PISCO: botón cargar archivo de ubicación ────────────── */
.pisco-archivo-ubic {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.pisco-archivo-btn {
    cursor: pointer;
    background: #f1f8e9;
    border: 1px dashed #8bc34a;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.80rem;
    color: #33691e;
    white-space: nowrap;
    transition: background 0.15s;
}

.pisco-archivo-btn:hover { background: #dcedc8; border-color: #558b2f; }

.pisco-ubic-formats {
    font-size: 0.72rem;
    color: #999;
}

.pisco-ubic-status {
    font-size: 0.78rem;
    color: #555;
    width: 100%;
}

/* ── PISCO: etiqueta de distancia ────────────────────────── */
.pisco-dist-ok {
    font-size: 0.78rem;
    color: #2e7d32;
    background: #e8f5e9;
    border-radius: 4px;
    padding: 3px 8px;
    margin-top: 5px;
    display: inline-block;
}

.pisco-dist-warn {
    font-size: 0.78rem;
    color: #e65100;
    background: #fff3e0;
    border: 1px solid #ffb74d;
    border-radius: 4px;
    padding: 3px 8px;
    margin-top: 5px;
    display: inline-block;
}

/* ── PISCO: marcador del proyecto en el mapa ─────────────── */
.pisco-proj-marker {
    font-size: 20px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* ── PISCO: encabezado de resultados ─────────────────────── */
.pisco-result-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1b3a1f;
    margin-bottom: 6px;
}

.pisco-result-ctx {
    font-size: 0.78rem;
    color: #666;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #e0e0e0;
}

.pisco-badge-est  { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }

/* ── PISCO: valor nulo ───────────────────────────────────── */
.pisco-na { color: #bbb; font-style: italic; }

/* ═══════════════════════════════════════════════════════════
   SISTEMA PREMIUM - MODAL DE CÓDIGO ESPECIAL
   ═══════════════════════════════════════════════════════════ */

.premium-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-in-out;
}

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

.premium-modal-dialog {
    background: white;
    border-radius: 8px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.premium-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--verde-principal) 0%, var(--verde-oscuro) 100%);
    color: white;
    border-bottom: 2px solid var(--verde-oscuro);
}

.premium-modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.premium-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.premium-modal-close:hover {
    transform: scale(1.15);
}

.premium-modal-body {
    padding: 20px;
}

.premium-modal-body p {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.premium-codigo-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--verde-borde);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.premium-codigo-input:focus {
    outline: none;
    border-color: var(--verde-principal);
    box-shadow: 0 0 8px rgba(109, 179, 138, 0.3);
}

.premium-codigo-mensaje {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    min-height: 20px;
    display: none;
}

.premium-codigo-mensaje:not(:empty) {
    display: block;
}

.premium-codigo-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.premium-codigo-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.premium-modal-footer {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #fafafa;
    border-top: 1px solid #eeeeee;
}

.premium-modal-footer .btn-primary,
.premium-modal-footer .btn-secondary {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.9rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Sección de capas geoespaciales ─── */
.geom-section {
    background: var(--gris-claro);
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
    border-left: 4px solid #ff7800;
}

.geom-title {
    font-weight: 700;
    color: #ff7800;
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.geom-desc {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.3;
}

.geom-upload-area {
    border: 2px dashed #ff7800;
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 120, 0, 0.04);
}

.geom-upload-area:hover {
    background: rgba(255, 120, 0, 0.1);
    border-color: #ff9800;
}

.geom-upload-hint {
    color: #666;
    font-size: 0.75rem;
    line-height: 1.4;
    pointer-events: none;
}

.geom-btn-clear {
    background: #ff7800;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}

.geom-btn-clear:hover {
    background: #ff9800;
}

/* Leyenda de tipos de estaciones */
.exp-legend {
    background: var(--gris-claro);
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
    border-left: 4px solid var(--verde-principal);
    max-height: 320px;
    overflow-y: auto;
}

.exp-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.75rem;
    color: var(--texto-oscuro);
    line-height: 1.3;
}

.exp-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.exp-legend-label {
    flex: 1;
    word-break: break-word;
}

/* Scroll bar para leyenda */
.exp-legend::-webkit-scrollbar {
    width: 6px;
}

.exp-legend::-webkit-scrollbar-track {
    background: transparent;
}

.exp-legend::-webkit-scrollbar-thumb {
    background: var(--verde-borde);
    border-radius: 3px;
}

.exp-legend::-webkit-scrollbar-thumb:hover {
    background: var(--verde-principal);
}

/* ═══════════════════════════════════════════════════════
   PHASE 3: INDICADORES Y VALIDACIÓN DE TEMPERATURA
   ═══════════════════════════════════════════════════════ */

.validation-alerts {
    margin-bottom: 20px;
}

.validation-alerts .warning-box {
    animation: slideUp 0.3s ease-out;
}

.validation-alerts .warning-box:not(:last-child) {
    margin-bottom: 8px;
}

/* Estilos para indicadores adicionales */
.temp-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.metric-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--verde-principal);
    border-radius: 6px;
    padding: 14px;
    transition: all 0.2s ease;
}

.metric-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left-color: var(--verde-oscuro);
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--verde-principal);
    margin-bottom: 4px;
}

.metric-sub {
    font-size: 0.75rem;
    color: #999;
    line-height: 1.4;
}

/* Tabla de percentiles */
.val-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.val-summary-table thead {
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
}

.val-summary-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--texto-oscuro);
}

.val-summary-table td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.val-summary-table tbody tr:hover {
    background: #fafafa;
}

/* Estilos responsivos para indicadores */
@media (max-width: 768px) {
    .temp-metrics-grid {
        grid-template-columns: 1fr;
    }

    .val-summary-table {
        font-size: 0.75rem;
    }

    .val-summary-table th,
    .val-summary-table td {
        padding: 6px 4px;
    }
}

/* ══════════════════════════════════════════════════════════
   PISCO — Caracterizar zona
   ══════════════════════════════════════════════════════════ */

/* Fila de botones doble */
.pisco-btns-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.pisco-btns-row button {
    flex: 1 1 auto;
    min-width: 0;
}

/* Botón Caracterizar zona */
.pisco-btn-caract {
    padding: 9px 14px;
    background: linear-gradient(135deg, #1565c0 0%, #0d47a1 100%);
    color: white;
    border: none;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    white-space: nowrap;
}
.pisco-btn-caract:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
.pisco-btn-caract:disabled { opacity: 0.6; cursor: not-allowed; }

/* Tabs de modo (Comparación vs Caracterización) */
.pisco-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    border-bottom: 2px solid #c8e6c9;
    padding-bottom: 0;
}
.pisco-mode-tab {
    padding: 6px 14px;
    background: #f9fafb;
    border: 1px solid #c8e6c9;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-size: 0.8rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-bottom: -2px;
}
.pisco-mode-tab:hover { background: #e8f5e9; color: #1b5e20; }
.pisco-mode-tab.active {
    background: white;
    color: var(--verde-oscuro);
    font-weight: 700;
    border-bottom: 2px solid white;
    border-color: #c8e6c9 #c8e6c9 white;
}

/* Header sección caracterización */
.pisco-caract-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #e8f5e9 100%);
    border: 1px solid #b3e0ff;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.pisco-caract-title {
    font-size: 1rem;
    color: #1a237e;
    margin-bottom: 6px;
}

/* Tarjetas de métricas clave */
.pisco-caract-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
@media (max-width: 600px) {
    .pisco-caract-cards { grid-template-columns: repeat(2, 1fr); }
}
.pisco-ccard {
    background: white;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.12s;
}
.pisco-ccard:hover { transform: translateY(-2px); }
.pisco-ccard-val {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}
.pisco-ccard-label {
    font-size: 0.72rem;
    color: #666;
    line-height: 1.3;
}

/* Percentiles */
.pisco-caract-perc {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.pisco-caract-perc-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 10px;
}
.pisco-caract-perc-row {
    display: flex;
    gap: 8px;
    justify-content: space-around;
    flex-wrap: wrap;
}
.pisco-perc-badge {
    text-align: center;
    flex: 1;
    min-width: 60px;
}
.pisco-perc-label {
    font-size: 0.72rem;
    font-weight: 700;
}
.pisco-perc-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: #222;
    margin: 2px 0;
}
.pisco-perc-sub {
    font-size: 0.65rem;
    color: #888;
}

/* Climatología mensual — barras */
.pisco-caract-clim {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.pisco-caract-clim-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 10px;
}
.pisco-caract-clim-bars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 120px;
}
.pisco-clim-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.pisco-clim-val {
    font-size: 0.62rem;
    color: #555;
    margin-bottom: 2px;
    text-align: center;
    line-height: 1;
}
.pisco-clim-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    background: #f0faf2;
    border-radius: 3px 3px 0 0;
    overflow: hidden;
}
.pisco-clim-bar {
    width: 100%;
    background: linear-gradient(180deg, #42a5f5 0%, #1565c0 100%);
    border-radius: 3px 3px 0 0;
    transition: height 0.4s ease;
    min-height: 2px;
}
.pisco-clim-mes {
    font-size: 0.62rem;
    color: #777;
    margin-top: 3px;
    text-align: center;
}
