.map-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.container.wide { width: 100%; padding: 0 1rem; }
.nav-mini a { color: #fff; text-decoration: none; font-weight: 500; }
.map-layout { flex: 1; display: grid; grid-template-columns: 380px 1fr; min-height: 0; }
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; z-index: 0; } /* contiene los z-index internos de Leaflet */

/* Sidebar */
.sidebar { background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; z-index: 500; }
.sidebar-handle { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 2; }
.tab { flex: 1; padding: .9rem; background: none; border: 0; font: 600 .95rem var(--font); color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: 1rem 1rem .5rem; }
.summary div { background: var(--tint); border-radius: 10px; padding: .5rem; text-align: center; }
.summary b { display: block; font-size: 1.3rem; color: var(--primary); }
.summary span { font-size: .75rem; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: .5rem 1rem; }
.chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: .3rem .7rem; font: 500 .82rem var(--font); cursor: pointer; }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip .n { opacity: .65; margin-left: .2rem; }
.toolbar { display: flex; gap: .5rem; padding: .3rem 1rem .8rem; }
.toolbar select { padding: .45em .6em; font-size: .85rem; }
.report-list { list-style: none; margin: 0; padding: 0 .6rem 1rem; }
.report-item { padding: .8rem; border-radius: 10px; cursor: pointer; display: grid; grid-template-columns: 2.2rem 1fr; gap: .6rem; border-bottom: 1px solid var(--border); }
.report-item:hover, .report-item.sel { background: var(--tint); }
.report-item .ic { width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; }
.report-item .desc { margin: .15rem 0; font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { font-size: .78rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; color: #fff; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

/* Marcadores */
.pin { width: 32px; height: 32px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.pin span { transform: rotate(45deg); line-height: 0; color: #fff; }
.pin.resuelto { opacity: .55; }
.pin.new { background: var(--accent) !important; width: 40px; height: 40px; animation: bounce .6s ease; }
@keyframes bounce { 0% { transform: rotate(-45deg) translate(0,-20px); } 100% { transform: rotate(-45deg); } }
.leaflet-popup-content { margin: 12px 14px; min-width: 220px; font-family: var(--font); }
.popup h4 { margin: 0 0 .3rem; font-size: 1rem; }
.popup p { margin: .3rem 0; }
.popup img { border-radius: 8px; margin: .3rem 0; max-height: 180px; object-fit: cover; width: 100%; }
.popup .note { background: #e8f5e9; padding: .4rem .6rem; border-radius: 8px; font-size: .85rem; }
.popup .fuzz { font-size: .74rem; color: var(--muted); }
.btn-vote { margin-top: .4rem; }

/* Controles flotantes */
.fab { position: absolute; right: 1.2rem; bottom: 1.6rem; z-index: 800; box-shadow: var(--shadow); font-size: 1.05rem; padding: .95em 1.6em; }
.place-banner, .place-confirm { position: absolute; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 800; background: var(--primary-dark); color: #fff;
  border-radius: 14px; padding: .7rem 1rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; justify-content: center; box-shadow: var(--shadow); max-width: 94%; }
.place-banner .btn-ghost, .place-confirm .btn-ghost { color: #fff; }
.veda-note { position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 800; background: #fff; padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow); }
.map-wrap.placing #map { cursor: crosshair; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000; display: grid; place-items: center; padding: 1rem; }
.modal-card { background: #fff; border-radius: 18px; padding: 1.6rem; width: min(560px, 100%); max-height: 92dvh; overflow-y: auto; position: relative; }
.modal-card h2 { margin: 0 0 .3rem; }
.modal-close { position: absolute; top: .8rem; right: .8rem; border: 0; background: var(--tint); width: 2.2rem; height: 2.2rem; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem; }
.cat-grid label { border: 2px solid var(--border); border-radius: 10px; padding: .5rem .6rem; font-weight: 500; font-size: .88rem; cursor: pointer; display: flex; gap: .4rem; align-items: center; }
.cat-grid input { position: absolute; opacity: 0; pointer-events: none; }
.cat-grid label:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, #fff); }
.cat-grid label:has(input:focus-visible) { outline: 3px solid var(--accent); }
.preview { max-height: 160px; border-radius: 10px; margin-top: .4rem; object-fit: cover; }
.contact-box { background: var(--tint); border-radius: 12px; padding: .8rem 1rem; }
.contact-box summary { cursor: pointer; font-weight: 600; }
.modal-actions { display: flex; justify-content: space-between; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; }
.done { text-align: center; padding: 1rem 0; }

/* Móvil: el mapa ocupa todo y la lista es un "bottom sheet" */
@media (max-width: 820px) {
  .map-layout { grid-template-columns: 1fr; position: relative; }
  .sidebar { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; border-radius: 18px 18px 0 0; border-right: 0;
    box-shadow: 0 -6px 24px rgba(0,0,0,.15); transition: height .25s ease; z-index: 900; }
  .sidebar.collapsed { height: 64px; overflow: hidden; }
  .sidebar.expanded { height: 85%; }
  .sidebar-handle { display: block; width: 44px; height: 5px; background: #ccc; border-radius: 3px; margin: 8px auto 0; flex-shrink: 0; cursor: pointer; padding: 6px 0; background-clip: content-box; }
  .fab { bottom: calc(42% + 1rem); transition: bottom .25s ease; }
  .sidebar.collapsed ~ .map-wrap .fab { bottom: calc(64px + 1rem); }
  .sidebar.expanded ~ .map-wrap .fab { display: none; }
  .map-wrap { position: absolute; inset: 0; }
}

/* íconos */
.ico { flex-shrink: 0; vertical-align: -3px; }
.chip { display: inline-flex; align-items: center; gap: .3rem; }
.popup h4 { display: flex; align-items: center; gap: .4rem; }
.meta .votes { display: inline-flex; align-items: center; gap: .2rem; }
.modal-close { display: grid; place-items: center; }
.done-ic { color: #2e7d32; display: flex; justify-content: center; }
.done-ic .ico { width: 56px; height: 56px; }

.sidebar-handle { border: 0; }
