/* Estuario – Visor de Calidad de Agua */
.eca {
    --eca-navy: #001B38;
    --eca-blue: #213776;
    --eca-line: #E3E7EC;
    --eca-soft: #F6F8FA;
    --eca-muted: #5E6B78;
    --eca-accent: #0387CA;
    color: #1E2A36;
    font-size: 15px;
    line-height: 1.45;
}
.eca *, .eca *::before, .eca *::after { box-sizing: border-box; }

.eca-toolbar {
    display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end;
    padding: 14px 16px; background: var(--eca-soft); border: 1px solid var(--eca-line);
    border-bottom: 0; border-radius: 10px 10px 0 0;
}
.eca-field { display: flex; flex-direction: column; gap: 4px; min-width: 180px; flex: 1 1 180px; margin: 0; }
.eca-field span { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--eca-muted); }
.eca select {
    width: 100%; height: 38px; padding: 0 10px; font: inherit; color: inherit;
    border: 1px solid #C9D1DA; border-radius: 6px; background: #fff;
}
.eca select:focus-visible, .eca button:focus-visible, .eca [tabindex]:focus-visible { outline: 2px solid var(--eca-accent); outline-offset: 2px; }
.eca-check { display: flex; align-items: center; gap: 6px; height: 38px; margin: 0; font-weight: 500; cursor: pointer; white-space: nowrap; }

.eca-mapwrap { position: relative; border: 1px solid var(--eca-line); border-radius: 0 0 10px 10px; overflow: hidden; }
.eca-map { position: absolute; inset: 0; }
.eca-loading {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.85); font-weight: 600; color: var(--eca-blue); z-index: 4; text-align: center; padding: 16px;
}
.eca-loading[hidden] { display: none; }
.eca-legend {
    position: absolute; left: 10px; bottom: 28px; z-index: 3; max-width: 260px;
    background: rgba(255,255,255,.95); border-radius: 8px; padding: 10px 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.18); font-size: 13px;
}
.eca-legend-title { font-weight: 700; margin-bottom: 6px; color: var(--eca-navy); }
.eca-legend-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.eca-legend-note { margin-top: 6px; font-size: 11px; color: var(--eca-muted); }
.eca-sw, .eca-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--eca-blue); flex: none; }
.eca-dot { width: 11px; height: 11px; border-width: 1.5px; margin-right: 8px; vertical-align: -1px; }
.eca-meta { margin: 8px 2px 18px; font-size: 13px; color: var(--eca-muted); }
.eca-muted { color: var(--eca-muted); font-size: 13px; margin: 0; }

.eca-popup .mapboxgl-popup-content { padding: 8px 10px; font-size: 13px; border-radius: 6px; }

/* Detalle */
.eca-detail { border: 1px solid var(--eca-line); border-radius: 10px; padding: 16px 18px; margin: 0 0 22px; background: #fff; box-shadow: 0 2px 10px rgba(0,27,56,.06); }
.eca-detail[hidden] { display: none; }
.eca-detail-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.eca-detail h3 { margin: 0; font-size: 22px; color: var(--eca-navy); }
.eca-detail h4 { margin: 0 0 8px; font-size: 15px; color: var(--eca-blue); }
.eca-close { border: 0; background: transparent; font-size: 28px; line-height: 1; cursor: pointer; color: var(--eca-muted); padding: 0 6px; height: 36px; }
.eca-close:hover { color: var(--eca-navy); background: transparent; }
.eca-detail-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 24px; }
.eca-kv { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0; }
.eca-kv th, .eca-kv td { padding: 5px 0; border: 0; border-bottom: 1px solid var(--eca-line); text-align: left; background: none; }
.eca-kv th { font-weight: 500; color: var(--eca-muted); padding-right: 12px; }
.eca-kv td { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.eca-note { font-size: 13px; background: #FFF8E1; border-radius: 6px; padding: 8px 10px; margin: 10px 0 0; }
.eca-note[hidden] { display: none; }
.eca-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.eca-chart-head h4 { margin: 0; }
.eca-chart-head select { max-width: 300px; }
.eca-chart svg { display: block; overflow: visible; }
.eca-grid { stroke: #EDF0F3; stroke-width: 1; }
.eca-tick { font-size: 11px; fill: var(--eca-muted); font-variant-numeric: tabular-nums; }
.eca-line { fill: none; stroke: var(--eca-accent); stroke-width: 1.6; stroke-linejoin: round; }
.eca-pt { fill: var(--eca-accent); stroke: #fff; stroke-width: 1; }
.eca-pt-cens { fill: #fff; stroke: var(--eca-accent); stroke-width: 1.4; }
.eca-pt-on { fill: #FFB000; stroke: var(--eca-navy); stroke-width: 1.5; }
.eca-ref { stroke: #C0392B; stroke-dasharray: 5 4; stroke-width: 1.2; }
.eca-ref-t { font-size: 11px; fill: #C0392B; font-weight: 600; }
.eca-chart-note { margin-top: 4px; font-size: 12px; }

/* Tabla */
.eca-table-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 0 0 10px; }
.eca-table-head h3 { margin: 0; font-size: 20px; color: var(--eca-navy); }
.eca-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.eca-actions button {
    font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 6px; cursor: pointer;
    border: 1px solid var(--eca-blue); background: #fff; color: var(--eca-blue); line-height: 1.2;
}
.eca-actions button:hover { background: var(--eca-blue); color: #fff; }
.eca-tablewrap { overflow-x: auto; border: 1px solid var(--eca-line); border-radius: 10px; max-height: 620px; overflow-y: auto; }
.eca-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; margin: 0; }
.eca-table th, .eca-table td { padding: 8px 12px; border: 0; border-bottom: 1px solid var(--eca-line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; background: #fff; }
.eca-table thead th {
    position: sticky; top: 0; z-index: 2; background: var(--eca-soft); text-align: right; vertical-align: bottom;
    font-weight: 600; color: var(--eca-navy); cursor: pointer; white-space: normal; min-width: 92px; line-height: 1.25;
}
.eca-table thead th small { display: block; font-weight: 400; color: var(--eca-muted); font-size: 11.5px; }
.eca-table thead th[aria-sort="ascending"]::after { content: " ▲"; font-size: 10px; }
.eca-table thead th[aria-sort="descending"]::after { content: " ▼"; font-size: 10px; }
.eca-table th:first-child, .eca-table td:first-child { position: sticky; left: 0; text-align: left; z-index: 1; }
.eca-table thead th:first-child { z-index: 3; min-width: 190px; }
.eca-table thead th:nth-child(2), .eca-table tbody td:nth-child(2) { text-align: left; }
.eca-table tbody th { font-weight: 600; text-align: left; color: #1E2A36; }
.eca-table tbody tr { cursor: pointer; }
.eca-table tbody tr:hover th, .eca-table tbody tr:hover td { background: #F0F6FB; }
.eca-table .eca-col-on { background: #EAF5FB; }
.eca-table thead .eca-col-on { background: #D7ECF7; }
.eca-table tr.eca-row-on th, .eca-table tr.eca-row-on td { background: #FFF6D6; }
.eca-nowrap { white-space: nowrap; }
.eca-foot { margin-top: 8px; font-size: 12px; }

@media (max-width: 760px) {
    .eca-detail-grid { grid-template-columns: 1fr; }
    .eca-field { min-width: 100%; }
    .eca-legend { left: 6px; bottom: 24px; font-size: 12px; padding: 8px 10px; max-width: 210px; }
    .eca-mapwrap { height: 440px !important; }
    .eca-chart-head { flex-direction: column; align-items: stretch; }
    .eca-chart-head select { max-width: none; }
}
