:root {
    color-scheme: dark;
    --bg: #0b1220;
    --panel: rgba(15, 23, 42, .96);
    --panel-2: rgba(30, 41, 59, .9);
    --text: #e5edf7;
    --muted: #93a4b8;
    --line: rgba(148, 163, 184, .22);
    --sky: #38bdf8;
    --blue: #2563eb;
    --orange: #f97316;
    --danger: #ef4444;
    --radius: 22px;
    --shadow: 0 22px 60px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 10%, rgba(56, 189, 248, .16), transparent 32%),
        radial-gradient(circle at 90% 0%, rgba(251, 146, 60, .13), transparent 28%),
        var(--bg);
    color: var(--text);
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}
.shell {
    display: grid;
    grid-template-columns: 430px 1fr;
    min-height: 100vh;
    padding: 16px;
    gap: 16px;
}
.panel {
    position: relative;
    z-index: 30;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 32px);
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}
.brand__mark {
    width: 38px;
    height: 38px;
    border-radius: 0;
    display: grid;
    place-items: center;
    background: transparent;
    overflow: visible;
    box-shadow: none;
    flex: 0 0 auto;
}
.brand__mark--button {
    border: 0;
    padding: 0;
    background: transparent;
}
.brand__mark--button:hover { transform: scale(1.04); }
.brand__text { flex: 1 1 auto; min-width: 0; }
.brand__mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand h1 { margin: 0; font-size: 28px; letter-spacing: .02em; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.search-card,
.filters,
.list-wrap,
.selected-card { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.input-label { display: block; color: var(--muted); font-size: 12px; margin: 0 0 6px; font-weight: 800; }
.search-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
input, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px 12px;
    background: rgba(2, 6, 23, .65);
    color: var(--text);
    outline: none;
}
input:focus, select:focus { border-color: rgba(56, 189, 248, .7); box-shadow: 0 0 0 4px rgba(56, 189, 248, .12); }
button {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(30, 41, 59, .95);
    color: var(--text);
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
}
button:hover { border-color: rgba(56, 189, 248, .55); }
button.active, #go-btn { background: linear-gradient(135deg, rgba(14, 165, 233, .95), rgba(37, 99, 235, .95)); border-color: transparent; }
button.secondary { background: rgba(15, 23, 42, .72); }
.panel-handle {
    display: none;
    border-radius: 0;
    padding: 10px 12px;
    border-left: 0;
    border-right: 0;
    background: linear-gradient(135deg, rgba(14, 165, 233, .95), rgba(37, 99, 235, .95));
    color: #fff;
    font-size: 13px;
    letter-spacing: .02em;
    box-shadow: 0 10px 24px rgba(14, 165, 233, .18);
}
.filter-drawer{position:fixed;z-index:1200;right:16px;top:16px;bottom:16px;width:0}.filter-drawer>summary{position:absolute;right:0;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:30px;height:78px;border:1px solid var(--line);border-right:0;border-radius:11px 0 0 11px;background:var(--panel);color:#e2e8f0;cursor:pointer;box-shadow:-5px 3px 18px rgba(0,0,0,.3);list-style:none}.filter-drawer>summary::-webkit-details-marker{display:none}.filter-drawer>summary::after{content:'‹';font-size:27px;font-weight:900}.filter-drawer[open]{width:370px}.filter-drawer[open]>summary{right:370px}.filter-drawer[open]>summary::after{content:'›'}.filter-drawer .filters{display:block;width:370px;max-height:calc(100vh - 32px);overflow:auto;margin:0;padding:16px;background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.filter-drawer .filters-grid{margin-bottom:0}
.status-line { color: var(--muted); font-size: 12px; margin-top: 8px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.metric { background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; padding: 11px; }
.metric span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.metric strong { font-size: 24px; }
.selected-card { display: grid; grid-template-columns: 148px 1fr; gap: 12px; background: rgba(2, 6, 23, .18); }
.detail-photo { width: 148px; height: 148px; object-fit: contain; border-radius: 0; border: 1px solid var(--line); background: rgba(255,255,255,.96); cursor: zoom-in; }
.detail-data h2 { margin: 0 0 3px; color: #e0f2fe; font-size: 18px; line-height: 1.15; }
.detail-data p { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.detail-row { font-size: 12px; line-height: 1.35; margin: 3px 0; color: #dbeafe; }
.detail-row b { color: #bae6fd; }
.badge { display: inline-block; background: rgba(56, 189, 248, .12); border: 1px solid rgba(56, 189, 248, .22); color: #bae6fd; border-radius: 999px; padding: 2px 7px; font-size: 11px; font-weight: 900; margin: 3px 4px 0 0; }
.photo-status { color: var(--muted); font-size: 11px; margin-top: 5px; }
.filters-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items:end; margin-bottom: 11px; }
.toggle-row { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; font-weight: 800; padding: 11px 0; }
.toggle-row input { width: auto; margin: 0; }
.photo-checks {
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px 10px;
    background: rgba(2, 6, 23, .46);
}
.photo-checks label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 850;
}
.photo-checks input { width: auto; margin: 0; accent-color: var(--sky); }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.list-wrap { flex: 1; overflow: hidden; display: flex; flex-direction: column; border-bottom: 0; min-height: 130px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.list-head h2 { font-size: 15px; margin: 0; }
.list-head span { background: rgba(56, 189, 248, .12); color: #bae6fd; border: 1px solid rgba(56, 189, 248, .22); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 900; }
.hydrant-list { overflow: auto; padding-right: 4px; }
.hydrant-item { background: rgba(2, 6, 23, .35); border: 1px solid var(--line); border-radius: 15px; padding: 11px 12px; margin-bottom: 9px; cursor: pointer; }
.hydrant-item:hover { border-color: rgba(56, 189, 248, .45); background: rgba(15, 23, 42, .8); }
.hydrant-title { font-weight: 900; margin-bottom: 3px; }
.hydrant-meta { color: var(--muted); font-size: 12.5px; line-height: 1.4; }.result-distance{color:#f8fafc;font-size:13.5px;font-weight:900}
.map-area { position: relative; z-index: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: #111827; }
#map { width: 100%; height: 100%; min-height: calc(100vh - 32px); }
#map.leaflet-container { overflow: hidden; }
.suggestions { position: absolute; z-index: 1100; background: rgba(15, 23, 42, .98); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); max-height: 280px; overflow: auto; width: min(380px, calc(100vw - 36px)); margin-top: 6px; }
.suggestion { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.suggestion:hover { background: rgba(56,189,248,.12); }
.suggestion b { color: #bae6fd; }
.suggestion small { color: var(--muted); }
.hidden { display: none !important; }
.error-box { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 999; max-width: 860px; background: rgba(127, 29, 29, .95); color: #fee2e2; padding: 14px 18px; border-radius: 16px; border: 1px solid rgba(252, 165, 165, .25); box-shadow: var(--shadow); }
.popup-title { font-weight: 900; font-size: 15px; margin-bottom: 5px; }
.popup-row { margin: 3px 0; }
.popup-label { font-weight: 800; }
.popup-photo-link { display:block; }
.popup-photo { display: block; width: 230px; max-width: 100%; height: 230px; object-fit: contain; margin: 8px 0; border-radius: 0; border: 1px solid rgba(15, 23, 42, .22); background: #fff; }
.leaflet-popup-content { min-width: 230px; }
.cluster-custom { background: rgba(14, 165, 233, .88); border: 3px solid rgba(255, 255, 255, .88); color: white; border-radius: 999px; text-align: center; font-weight: 900; box-shadow: 0 12px 26px rgba(0, 0, 0, .33); }
.cluster-custom div { width: 34px; height: 34px; line-height: 29px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: 5px; }
.emergency-marker-wrap{background:transparent!important;border:0!important;overflow:visible!important}.emergency-marker{position:relative;display:grid;place-items:center;width:40px;height:40px;border:4px solid #fff;border-radius:50% 50% 50% 0;background:linear-gradient(145deg,#f97316,#dc2626 68%);box-shadow:0 3px 0 #991b1b,0 7px 18px rgba(127,29,29,.55);transform:rotate(-45deg)}.emergency-marker span{display:block;font-size:21px;line-height:1;transform:rotate(45deg)}.emergency-marker::after{content:'';position:absolute;inset:-9px;border:3px solid rgba(239,68,68,.45);border-radius:50%;animation:emergencyPulse 1.35s ease-out infinite}@keyframes emergencyPulse{0%{transform:scale(.72);opacity:1}100%{transform:scale(1.35);opacity:0}}
.selected-resource-pulse-wrap{background:transparent!important;border:0!important;pointer-events:none!important;overflow:visible!important}.selected-resource-pulse{position:absolute;left:7px;top:7px;width:20px;height:20px;border-radius:50%;background:rgba(34,197,94,.2);border:2px solid rgba(255,255,255,.95);box-shadow:0 0 0 4px rgba(34,197,94,.75),0 0 18px 9px rgba(34,197,94,.65);animation:selectedResourcePulse 1.05s ease-in-out infinite}@keyframes selectedResourcePulse{50%{transform:scale(1.22);background:rgba(34,197,94,.38);box-shadow:0 0 0 8px rgba(34,197,94,.2),0 0 24px 13px rgba(34,197,94,.35)}}

.overlay-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
}
.overlay-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, .82);
}
.overlay-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(94vw, 980px);
    max-height: 92vh;
    overflow: auto;
    background: #0f172a;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 18px 18px 20px;
}
.overlay-modal__dialog--photo {
    width: min(96vw, 1200px);
    padding: 10px;
    background: rgba(2,6,23,.98);
}
.overlay-modal__dialog h2 {
    margin: 0 0 12px;
    color: #e0f2fe;
    font-size: 24px;
}
.overlay-modal__content {
    color: #dbeafe;
    font-size: 15px;
    line-height: 1.55;
}
.overlay-modal__content ul { padding-left: 18px; }
.overlay-modal__content li { margin: 8px 0; }
.overlay-modal__close {
    position: sticky;
    top: 0;
    float: right;
    min-width: 42px;
    padding: 8px 10px;
    font-size: 24px;
    line-height: 1;
    border-radius: 12px;
    z-index: 2;
}
.overlay-modal__image {
    display: block;
    width: 100%;
    max-height: 82vh;
    object-fit: contain;
    background: #fff;
    border-radius: 0;
}
.overlay-modal__caption {
    color: #cbd5e1;
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.summary-card {
    background: rgba(2, 6, 23, .35);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
}
.summary-card h3 { margin: 0 0 8px; font-size: 15px; color: #bae6fd; }
.summary-card ul { margin: 0; padding-left: 18px; }
.summary-card li { margin: 4px 0; }

@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; padding: 0; gap: 0; min-height: 100vh; }
    .panel { border-radius: 0; min-height: auto; max-height: 52vh; overflow: auto; transition: max-height .22s ease, min-height .22s ease; }
    .panel-handle { display: block; position: sticky; top: 0; z-index: 700; }
    .map-area { border-radius: 0; min-height: 48vh; }
    #map { min-height: 48vh; }
    .brand { padding: 12px 14px; }
    .brand__mark { width: 36px; height: 36px; }
    .brand h1 { font-size: 22px; }
    .search-card, .filters, .selected-card { padding: 11px 12px; }
    .metrics { padding: 10px 12px; }
    .selected-card { grid-template-columns: 120px 1fr; }
    .detail-photo { width: 120px; height: 120px; }
    body.panel-collapsed .panel { max-height: 72px; min-height: 72px; overflow: hidden; }
    body.panel-collapsed .brand { padding: 10px 14px; border-bottom: 0; }
    body.panel-collapsed .brand p { display: none; }
    body.panel-collapsed .brand__mark { width: 34px; height: 34px; border-radius: 0; }
    body.panel-collapsed .brand h1 { font-size: 20px; }
    body.panel-collapsed .search-card,
    body.panel-collapsed .metrics,
    body.panel-collapsed .selected-card,
    body.panel-collapsed .filters,
    body.panel-collapsed .list-wrap { display: none; }
    body.panel-collapsed .map-area { min-height: calc(100vh - 110px); }
    body.panel-collapsed #map { min-height: calc(100vh - 110px); }
}
@media (max-width: 560px) {
    .panel { max-height: 58vh; }
    .map-area { min-height: 42vh; }
    #map { min-height: 42vh; }
    .search-row { grid-template-columns: 1fr auto; }
    #clear-btn { grid-column: 1 / 3; padding: 8px 10px; }
    .metrics { grid-template-columns: repeat(3, 1fr); gap: 7px; }
    .metric { padding: 8px; }
    .metric strong { font-size: 19px; }
    .filters-grid { grid-template-columns: 1fr; }
    .button-grid { grid-template-columns: 1fr 1fr; }
    .selected-card { grid-template-columns: 96px 1fr; gap: 9px; }
    .detail-photo { width: 96px; height: 96px; border-radius: 0; }
    .detail-data h2 { font-size: 15px; }
    .detail-row { font-size: 11px; }
    body.panel-collapsed .map-area { min-height: calc(100vh - 108px); }
    body.panel-collapsed #map { min-height: calc(100vh - 108px); }
}

@media (max-width: 560px) { .overlay-modal__dialog{ width:100vw; max-height:100vh; min-height:100vh; border-radius:0; padding:14px 14px 18px;} .overlay-modal__dialog--photo{padding:8px; min-height:100vh;} .overlay-modal__image{max-height:88vh;} }


.help-block {
    background: rgba(2, 6, 23, .24);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 13px;
    margin: 10px 0;
}
.help-block h3 {
    margin: 0 0 6px;
    color: #bae6fd;
    font-size: 16px;
}
.help-block p {
    margin: 0;
}
.modal-note {
    margin-top: 14px;
    padding: 12px 13px;
    border-radius: 14px;
    background: rgba(56, 189, 248, .10);
    border: 1px solid rgba(56, 189, 248, .24);
    color: #dbeafe;
    font-weight: 800;
}
.summary-lead {
    margin: 0 0 14px;
    color: #dbeafe;
}
.summary-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 10px;
    margin: 12px 0 16px;
}
.summary-kpi {
    background: linear-gradient(135deg, rgba(14, 165, 233, .14), rgba(37, 99, 235, .14));
    border: 1px solid rgba(56, 189, 248, .25);
    border-radius: 16px;
    padding: 13px;
}
.summary-kpi span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.summary-kpi strong {
    display: block;
    margin-top: 4px;
    color: #fff;
    font-size: 26px;
}
.summary-card--wide {
    margin-top: 12px;
}



.help-qr-block {
    margin: 16px 0 12px;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(56, 189, 248, .25);
    background: rgba(2, 6, 23, .30);
    text-align: center;
}
.help-qr-block h3 {
    margin: 0 0 6px;
    color: #bae6fd;
    font-size: 16px;
}
.help-qr-block p {
    margin: 0 0 10px;
    color: #dbeafe;
}
.help-qr-img {
    display: block;
    width: min(220px, 72vw);
    height: auto;
    margin: 8px auto 10px;
    padding: 10px;
    background: #fff;
    border-radius: 0;
    border: 1px solid rgba(255,255,255,.18);
}
.help-qr-link {
    display: inline-block;
    color: #bae6fd;
    font-weight: 800;
    font-size: 13px;
    word-break: break-all;
    text-decoration: none;
}
.help-qr-link:hover {
    text-decoration: underline;
}


/* M075I - Ajustes solo celular / safe area.
   No toca la lógica del mapa ni bloquea el movimiento. */
@media (max-width: 760px) {
    body {
        overflow-x: hidden;
    }
    .shell {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .panel {
        width: 100%;
        max-width: 100vw;
        position: relative;
        z-index: 30;
    }
    .map-area {
        width: 100%;
        max-width: 100vw;
        z-index: 1;
        overflow: visible;
    }
    #map.leaflet-container {
        overflow: visible;
    }
    .leaflet-popup {
        max-width: calc(100vw - 32px);
    }
    .leaflet-control-container .leaflet-top.leaflet-left {
        margin-top: 6px;
        margin-left: max(6px, env(safe-area-inset-left));
    }
    .leaflet-control-container .leaflet-top.leaflet-right {
        margin-top: 6px;
        margin-right: max(6px, env(safe-area-inset-right));
    }
    .leaflet-popup-content-wrapper {
        max-width: calc(100vw - 34px);
        max-height: min(72vh, 520px);
        overflow: hidden;
        overflow-y: auto;
    }
    .leaflet-popup-content {
        width: min(250px, calc(100vw - 64px)) !important;
        min-width: 0;
        max-width: calc(100vw - 58px);
        margin: 10px 12px;
        overflow-wrap: anywhere;
    }
    .popup-photo {
        width: 100%;
        height: auto;
        max-width: calc(100vw - 74px);
        max-height: min(34vh, 210px);
    }
    .suggestions {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: calc(100vw - 24px);
    }
    .filter-drawer{right:0;top:76px;bottom:12px}.filter-drawer[open]{width:min(86vw,350px)}.filter-drawer[open]>summary{right:min(86vw,350px)}.filter-drawer .filters{width:min(86vw,350px);max-height:calc(100vh - 88px);border-radius:14px 0 0 14px}.filter-drawer>summary{top:42%}
}

@media (max-width: 560px) {
    .brand {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    .search-card,
    .filters,
    .selected-card,
    .list-wrap {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
    .panel-handle {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        z-index: 31;
    }
}

html, body { overflow-x: hidden; }

/* M076B: filtro técnico oculto. Se conserva el select de Estación en el DOM
   para compatibilidad interna, pero no se muestra en la interfaz. */
.filter-hidden-technical {
    display: none !important;
}

/* M076F: estabilidad escritorio. Evita scroll vertical del documento en PC
   y fija el área del mapa al alto disponible. Celular conserva sus reglas media. */
@media (min-width: 761px) {
    html, body {
        height: 100%;
        overflow: hidden;
    }
    .shell {
        height: 100vh;
        min-height: 100vh;
    }
    .map-area {
        height: calc(100vh - 32px);
        min-height: calc(100vh - 32px);
    }
    #map {
        height: 100%;
        min-height: 100%;
    }
}

/* Cabecera horizontal del visor. */
body.viewer-topbar-ready{display:grid;grid-template-rows:64px minmax(0,1fr);height:100vh;overflow:hidden}.viewer-topbar{position:relative;z-index:1250;display:grid;grid-template-columns:minmax(390px,auto) minmax(430px,650px) 1fr auto;align-items:center;gap:18px;height:64px;padding:0 12px;background:var(--panel);border-bottom:1px solid var(--line);box-shadow:0 4px 18px rgba(0,0,0,.2)}.viewer-topbar .brand{min-width:0;padding:0;border:0;gap:10px}.viewer-topbar .brand__mark{width:40px;height:40px}.viewer-topbar .brand h1{font-size:21px;white-space:nowrap}.viewer-topbar .brand p{font-size:12px;white-space:nowrap}.viewer-topbar .search-card{position:relative;display:flex;align-items:center;gap:9px;padding:0;border:0;min-width:0}.viewer-topbar .search-card>.input-label{flex:0 0 auto;margin:0;font-size:15px;color:var(--text)}.viewer-topbar .search-row{display:grid;grid-template-columns:minmax(240px,1fr) auto auto;gap:7px;flex:1;min-width:0}.viewer-topbar .search-row input,.viewer-topbar .search-row button{height:38px;padding-top:7px;padding-bottom:7px}.viewer-topbar .status-line{display:none}.viewer-topbar .suggestions{top:43px;left:70px;width:min(470px,calc(100vw - 120px));margin:0}.viewer-topbar .edit-launch{position:static;justify-self:end;padding:10px 15px}.viewer-topbar+.shell{height:calc(100vh - 64px);min-height:0;padding:8px;gap:8px}.viewer-topbar+.shell .panel{min-height:0;height:100%;border-radius:14px}.viewer-topbar+.shell .map-area{height:100%;min-height:0}.viewer-topbar+.shell #map{height:100%;min-height:100%}.viewer-topbar~.shell .filter-drawer{top:72px;bottom:8px}.viewer-topbar~.shell .filter-drawer .filters{max-height:calc(100vh - 80px)}
@media(max-width:1100px) and (min-width:761px){.viewer-topbar{grid-template-columns:minmax(300px,auto) minmax(390px,1fr) auto;gap:10px}.viewer-topbar .brand h1{font-size:17px}.viewer-topbar .brand p{display:none}.viewer-topbar .brand__mark{width:34px;height:34px}.viewer-topbar .edit-launch span{display:none}}
@media(max-width:760px){body.viewer-topbar-ready{display:block;height:auto;overflow:auto}.viewer-topbar{position:relative;grid-template-columns:1fr auto;height:auto;min-height:112px;padding:8px;gap:7px}.viewer-topbar .brand{grid-column:1/2}.viewer-topbar .brand h1{font-size:17px;white-space:normal}.viewer-topbar .brand p{display:none}.viewer-topbar .brand__mark{width:32px;height:32px}.viewer-topbar .search-card{grid-column:1/-1;grid-row:2}.viewer-topbar .search-card>.input-label{display:none}.viewer-topbar .search-row{grid-template-columns:1fr auto auto}.viewer-topbar .edit-launch{grid-column:2;grid-row:1;padding:9px}.viewer-topbar+.shell{height:auto;min-height:calc(100vh - 112px);padding:0;gap:0}.viewer-topbar+.shell .panel{height:auto}.viewer-topbar+.shell .map-area{height:auto}.viewer-topbar+.shell #map{min-height:48vh}.viewer-topbar~.shell .filter-drawer{top:120px}.viewer-topbar .suggestions{top:42px;left:0;width:100%}}
@media(min-width:761px){.filter-drawer[open]{width:430px}.filter-drawer[open]>summary{right:430px}.filter-drawer .filters{width:430px}.viewer-topbar~.shell .filter-drawer>summary{top:122px}}

/* Herramientas superiores, temas y pestaña horizontal del menú. */
.viewer-tools{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0}.viewer-tools__label{font-size:13px;font-weight:900}.viewer-tools button{display:flex;align-items:center;gap:5px;height:36px;padding:6px 9px;border-radius:10px}.theme-swatch{display:block;width:17px;height:17px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px rgba(148,163,184,.7)}.theme-swatch--dark{background:#111827}.theme-swatch--light{background:#f8fafc}.theme-choice.active{border-color:var(--sky);box-shadow:0 0 0 2px rgba(56,189,248,.2)}.leaflet-container.marking-emergency{cursor:crosshair!important}
body.theme-light{color-scheme:light;--bg:#e8eef5;--panel:rgba(248,250,252,.98);--panel-2:rgba(255,255,255,.96);--text:#172033;--muted:#526579;--line:rgba(71,85,105,.24);--shadow:0 18px 48px rgba(15,23,42,.18);background:linear-gradient(135deg,#eef4f8,#dfe9f1)}body.theme-light input,body.theme-light select{background:#fff;color:#172033}body.theme-light button{background:#e7edf3;color:#172033}body.theme-light button.active,body.theme-light #go-btn{color:#fff}body.theme-light .hydrant-item{background:rgba(255,255,255,.72)}body.theme-light .right-filters,body.theme-light .filter-drawer .filters{background:rgba(248,250,252,.98)}body.theme-light .suggestions{background:rgba(248,250,252,.99)}body.theme-light .suggestion b,body.theme-light .list-head span{color:#075985}
@media(min-width:761px){.viewer-topbar~.shell .filter-drawer>summary{top:0;right:0;transform:none;width:104px;height:42px;border:1px solid var(--line);border-top:0;border-radius:0 0 10px 10px}.viewer-topbar~.shell .filter-drawer>summary::after{content:'Menú+';font-size:16px}.viewer-topbar~.shell .filter-drawer[open]>summary{right:163px}.viewer-topbar~.shell .filter-drawer[open]>summary::after{content:'Menú−'}.viewer-topbar~.shell .filter-drawer .filters{padding-top:58px}}
@media(max-width:1500px) and (min-width:761px){.viewer-topbar{grid-template-columns:minmax(300px,350px) minmax(350px,1fr) auto auto}.viewer-topbar .brand h1{font-size:17px}.viewer-topbar .brand p{display:none}.viewer-tools button{padding:6px}.theme-choice{font-size:0}.viewer-tools__label{display:none}.viewer-topbar .edit-launch span{display:none}}
@media(max-width:760px){.viewer-tools{grid-column:1/-1;grid-row:3;justify-content:flex-start;overflow-x:auto}.viewer-topbar{min-height:158px}.viewer-topbar+.shell{min-height:calc(100vh - 158px)}.viewer-topbar~.shell .filter-drawer{top:166px}.viewer-tools button{flex:0 0 auto}}
.viewer-topbar .search-row{grid-template-columns:minmax(180px,1fr) auto auto auto auto}
#locate-mobile-btn{display:none}
@media(max-width:760px){body.panel-collapsed .viewer-topbar .search-card{display:flex!important}.viewer-topbar .search-row{grid-template-columns:minmax(0,1fr) 38px auto auto}.viewer-topbar #go-btn{width:38px;padding:0;font-size:0}.viewer-topbar #go-btn::before{content:'🔍';font-size:17px}.viewer-topbar #mark-map-btn,.viewer-topbar #clear-btn{padding-left:8px;padding-right:8px}.viewer-topbar #mark-map-btn{font-size:12px}}
@media(max-width:760px){.viewer-topbar .viewer-tools{display:none}.viewer-topbar{min-height:112px}.viewer-topbar+.shell{min-height:calc(100vh - 112px)}.viewer-topbar~.shell .filter-drawer{top:120px}.viewer-topbar .search-row{width:100%;grid-template-columns:minmax(0,1fr) 38px auto 38px 38px;gap:5px}.viewer-topbar #clear-btn,.viewer-topbar #locate-mobile-btn{grid-column:auto;width:38px;padding:0;font-size:18px}.viewer-topbar #locate-mobile-btn{display:block}.viewer-topbar #mark-map-btn{white-space:nowrap}}

/* Diálogos simplificados y sin pestaña lateral en celulares. */
@media(max-width:760px){
  .filter-drawer>summary{display:none}
  #help-modal .overlay-modal__dialog>h2,
  #help-modal .overlay-modal__content>p,
  #help-modal .help-block,
  #help-modal .overlay-modal__content{display:grid;place-items:center;min-height:calc(100vh - 70px);padding:0}
  #help-modal .help-qr-block{display:grid;place-items:center;text-align:center;gap:12px;width:100%;padding:12px;border:0;background:transparent}
  #help-modal .help-qr-block>h3,#help-modal .help-qr-block>p,#help-modal .help-qr-link{display:block;margin:0}
  #help-modal .help-qr-img{width:min(82vw,330px);max-width:100%;margin:0}
  #help-modal .help-qr-link{max-width:100%;overflow-wrap:anywhere;font-weight:800}
  #summary-modal .overlay-modal__dialog>h2,
  #summary-modal .summary-lead,
  #summary-modal .summary-kpis,
  #summary-modal .summary-grid{display:none}
  #summary-modal .overlay-modal__content{display:flex;flex-direction:column;justify-content:center;min-height:calc(100vh - 70px);gap:14px;padding:0}
  #summary-modal .summary-card--wide{width:100%}
  #summary-modal .modal-note{margin:0}
}

/* La pestaña del visor replica la alineación del editor. */
@media(min-width:761px){.viewer-topbar~.shell .filter-drawer{right:0}.viewer-topbar~.shell .filter-drawer[open]>summary{right:163px}}

/* Miniatura ampliada de la ficha del recurso. */
@media(min-width:761px){.selected-card{grid-template-columns:180px minmax(0,1fr);gap:14px}.detail-photo{width:180px;height:180px}}
@media(max-width:760px){.selected-card{grid-template-columns:140px minmax(0,1fr)}.detail-photo{width:140px;height:140px}}
@media(max-width:560px){.selected-card{grid-template-columns:120px minmax(0,1fr)}.detail-photo{width:120px;height:120px}}

@media(min-width:761px){
  .detail-photo{
    width:100%;
    width:-webkit-fill-available;
    width:stretch;
    height:100%;
    height:-webkit-fill-available;
    min-height:180px;
    align-self:stretch;
    object-fit:contain;
  }
}
.popup-toggle{display:flex;align-items:center;gap:7px;margin-top:7px;color:var(--muted);font-size:12px;font-weight:700;cursor:pointer}.popup-toggle input{width:15px;height:15px;margin:0;accent-color:#22c55e;cursor:pointer}

/* Ficha operativa compacta para celulares. */
@media(max-width:760px){
  .panel .list-wrap{display:none}
  .selected-card{grid-template-columns:1fr}
  .selected-card>.detail-photo,
  .selected-card .photo-status,
  .selected-card .popup-toggle,
  .selected-card .detail-title-id,
  .selected-card #detail-subtitle,
  .selected-card .detail-row--desktop{display:none}
  .selected-card .detail-data h2{font-size:20px;margin-bottom:8px}
  .selected-card .detail-row--mobile-keep{display:block;font-size:14px;margin:5px 0}
  .leaflet-popup .popup-photo-link,
  .leaflet-popup .popup-row--desktop{display:none}
  .leaflet-popup-content-wrapper{max-height:none}
  .leaflet-popup-content{width:min(270px,calc(100vw - 64px))!important}
  .leaflet-popup .popup-title{font-size:20px;margin-bottom:10px}
  .leaflet-popup .popup-row--mobile-keep{display:block;font-size:14px;margin:5px 0}
}
