:root {
  --bg: #0f1419;
  --bg-card: #1a2332;
  --bg-elevated: #243044;
  --text: #e8edf4;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --danger: #ef4444;
  --border: #2d3a4f;
  --nav-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --radius: 12px;
  --sheet-radius: 20px 20px 0 0;
  --map-toolbar-h: 48px;
  --map-toolbar-gap: 12px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Auth — inicio, login y registro */
.auth-page {
  --auth-accent: #38bdf8;
  --auth-accent-warm: #fbbf24;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  position: relative;
  overflow: hidden;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.auth-page > .auth-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.auth-page > .monuments {
  position: fixed;
  z-index: 0;
}

.auth-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.auth-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #0c1929 0%, #1a1a2e 40%, #16213e 100%);
}

.monuments {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 45%;
  opacity: 0.35;
  background:
    linear-gradient(transparent 60%, #0f1419 100%),
    linear-gradient(#334155, #334155) 12% 100% / 3% 35% no-repeat,
    linear-gradient(#475569, #475569) 10% 65% / 7% 8% no-repeat,
    radial-gradient(ellipse 40% 30% at 50% 100%, transparent 55%, #475569 56%) 45% 100% / 18% 40% no-repeat,
    linear-gradient(#64748b, #64748b) 78% 100% / 2% 28% no-repeat,
    linear-gradient(#64748b, #64748b) 74% 72% / 10% 4% no-repeat,
    linear-gradient(#64748b, #64748b) 76% 80% / 8% 3% no-repeat;
}

.auth-scene__gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 18, 32, 0.35) 0%, rgba(8, 18, 32, 0.15) 45%, rgba(8, 18, 32, 0.65) 100%),
    linear-gradient(105deg, rgba(8, 18, 32, 0.45) 0%, transparent 50%, rgba(14, 165, 233, 0.1) 100%);
  pointer-events: none;
}

.auth-layout {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 440px;
  opacity: 1;
}

.auth-card {
  background: #1a2332;
  border: 1px solid var(--border);
}

.auth-card h1 {
  color: #fff;
}

.auth-back {
  position: fixed;
  top: calc(14px + var(--safe-top));
  left: 16px;
  z-index: 6;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.88rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
  transition: background 0.2s, border-color 0.2s;
}

.auth-back:hover {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(56, 189, 248, 0.45);
  color: #fff;
}

.auth-page .auth-card:not(.auth-layout .auth-card) {
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.auth-layout .auth-card {
  position: relative;
  width: 100%;
  background: #1a2332;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px 32px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.auth-card__badge {
  position: absolute;
  top: -14px;
  right: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(251, 191, 36, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.auth-logo h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  background: linear-gradient(135deg, #fff 0%, #bae6fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.auth-card .subtitle {
  color: rgba(148, 163, 184, 0.95);
  margin: 0 0 26px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.auth-page--register .auth-card {
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(251, 191, 36, 0.1) inset;
}

.auth-submit {
  margin-top: 4px;
  min-height: 48px;
  font-size: 1rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
}

.auth-error {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fecaca;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Página de bienvenida */
.auth-layout--welcome {
  max-width: 520px;
}

.welcome-panel {
  text-align: center;
  padding: 8px 4px;
}

.welcome-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 10px 18px 10px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

.welcome-brand__icon {
  font-size: 1.75rem;
  line-height: 1;
}

.welcome-brand__name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.welcome-title {
  margin: 0 0 16px;
  font-size: clamp(1.75rem, 5.5vw, 2.35rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.4);
}

.welcome-lead {
  margin: 0 0 28px;
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(226, 232, 240, 0.92);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-features {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.welcome-features li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(241, 245, 249, 0.95);
  backdrop-filter: blur(10px);
}

.welcome-features li span:first-child {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 340px;
  margin: 0 auto;
}

.welcome-cta {
  min-height: 52px;
  font-size: 1.05rem;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(14, 165, 233, 0.4);
}

.welcome-cta-secondary {
  min-height: 52px;
  font-size: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  backdrop-filter: blur(8px);
}

.welcome-cta-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(56, 189, 248, 0.4);
}

.welcome-hint {
  margin: 20px 0 0;
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.85);
}

.auth-page .field input {
  background: rgba(8, 18, 32, 0.65);
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-page .field input:focus {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.auth-footer a {
  font-weight: 600;
  color: var(--auth-accent);
}

.auth-footer a:hover {
  color: #7dd3fc;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--accent-dim);
  border-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  color: #0f1419;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.danger.outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.btn.block {
  width: 100%;
}

.btn.sm {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Map layout */
.map-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
  overflow: hidden;
  touch-action: manipulation;
}

#map {
  flex: 1;
  width: 100%;
  min-height: 0;
  z-index: 1;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font: inherit;
}

#map.pick-cursor,
.leaflet-container.pick-cursor {
  cursor: crosshair !important;
}

/* Capa que captura toques al colocar marcador (móvil + escritorio) */
.map-pick-overlay {
  position: absolute;
  inset: 0;
  z-index: 10000 !important;
  cursor: crosshair;
  background: rgba(56, 189, 248, 0.12);
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

body.pick-mode .map-toolbar,
body.pick-mode .nav-drawer,
body.pick-mode .nav-backdrop,
body.pick-mode .map-actions,
body.pick-mode .pick-banner {
  z-index: 10001;
  pointer-events: auto;
}

body.nav-open {
  overflow: hidden;
}

body.pick-mode .sheet,
body.pick-mode .sheet-backdrop {
  display: none !important;
}

.pick-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 88px);
  z-index: 2800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: #0f1419;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  font-weight: 600;
  font-size: 0.9rem;
}

.pick-banner[hidden] {
  display: none !important;
}

.pick-banner p {
  margin: 0;
  flex: 1;
  line-height: 1.35;
}

.pick-banner .btn {
  background: rgba(15, 20, 25, 0.25);
  color: #fff;
  flex-shrink: 0;
  min-height: 44px;
}

/* Zoom Leaflet debajo de la barra de búsqueda (no tapado por el buscador) */
.map-page .leaflet-top.leaflet-right {
  top: calc(var(--map-toolbar-gap) + var(--safe-top) + var(--map-toolbar-h) + 8px);
  right: 12px;
  z-index: 1001;
}

.map-page .leaflet-control-zoom {
  border: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.map-page .leaflet-control-zoom a {
  width: 40px;
  height: 40px;
  line-height: 40px;
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

.map-toolbar {
  position: absolute;
  top: calc(var(--map-toolbar-gap) + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 1000;
  pointer-events: none;
  max-width: calc(100% - 24px);
}

.map-toolbar > * {
  pointer-events: auto;
}

.toolbar-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.menu-btn {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn[aria-expanded='true'] {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.15);
}

.menu-btn__icon {
  display: block;
  width: 20px;
  height: 14px;
  background:
    linear-gradient(var(--text) 0 0) top / 100% 2px no-repeat,
    linear-gradient(var(--text) 0 0) center / 100% 2px no-repeat,
    linear-gradient(var(--text) 0 0) bottom / 100% 2px no-repeat;
}

.menu-btn__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--accent);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-wrap input {
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  font-size: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1100;
}

.search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

.search-item:hover {
  background: var(--bg-elevated);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2400;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-backdrop[hidden]:not(.open) {
  display: none;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  z-index: 2500;
  padding: calc(16px + var(--safe-top)) 16px 24px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.nav-drawer__title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-drawer__close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.nav-drawer__label {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.filter-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.filter-chip__dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--kind-color, var(--accent));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--kind-color, var(--accent)) 25%, transparent);
}

.filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
}

.filter-chip[data-filter='danger'].active { border-color: #ef4444; color: #ef4444; }
.filter-chip[data-filter='police'].active { border-color: #3b82f6; color: #3b82f6; }
.filter-chip[data-filter='hospital'].active { border-color: #a855f7; color: #a855f7; }
.filter-chip[data-filter='safe_zone'].active { border-color: #22c55e; color: #22c55e; }
.filter-chip[data-filter='interest'].active { border-color: #f59e0b; color: #f59e0b; }

.nav-drawer__label--spaced {
  margin-top: 20px;
}

.proximity-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.proximity-toggle__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.proximity-toggle__title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.proximity-toggle__hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.proximity-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.proximity-toggle__switch {
  flex-shrink: 0;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background 0.2s;
}

.proximity-toggle__switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s;
}

.proximity-toggle__input:checked + .proximity-toggle__switch {
  background: var(--accent);
}

.proximity-toggle__input:checked + .proximity-toggle__switch::after {
  transform: translateX(20px);
}

.proximity-toggle__input:focus-visible + .proximity-toggle__switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.map-actions {
  position: absolute;
  right: 12px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--bg-card);
  color: var(--text);
  font-size: 1.4rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  border: 1px solid var(--border);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.fab__icon {
  display: block;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.fab--locate {
  color: var(--accent);
  background: var(--bg-card);
}

.fab--locate:active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent);
}

.fab--locate.is-locating .fab__icon {
  animation: locate-pulse 0.9s ease-in-out infinite;
}

@keyframes locate-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.92);
  }
}

.fab.primary {
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  color: #0f1419;
  font-size: 1.75rem;
}

.fab.primary .fab__icon {
  width: auto;
  height: auto;
}

.map-status {
  position: absolute;
  left: 12px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  z-index: 1000;
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  max-width: calc(100% - 100px);
}

body.pick-mode .map-status {
  display: none;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 2000;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.bottom-nav a.active {
  color: var(--accent);
}

.bottom-nav .icon {
  font-size: 1.35rem;
}

/* Sheets */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

body.sheet-open .sheet-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(92dvh, 92vh);
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom));
  background: var(--bg-card);
  border-radius: var(--sheet-radius);
  z-index: 3100;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 8px;
}

.sheet-header {
  padding: 0 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.sheet-body {
  padding: 0 16px 20px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.location-label {
  margin: 0 0 16px;
  font-size: 0.85rem;
}

.kind-picker {
  border: none;
  margin: 0 0 16px;
  padding: 0;
}

.kind-picker legend {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.kind-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.kind-btn {
  min-height: 48px;
  padding: 12px 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border-left: 4px solid var(--kind-color, var(--accent));
}

.kind-btn.active {
  border-color: var(--kind-color, var(--accent));
  background: color-mix(in srgb, var(--kind-color, var(--accent)) 18%, var(--bg));
  color: var(--text);
}

.kind-btn--wide {
  grid-column: 1 / -1;
}

.custom-marker-fields {
  display: none;
  margin-bottom: 16px;
}

.custom-marker-fields.is-open {
  display: block;
}

.custom-marker-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.custom-marker-row input[type="color"] {
  width: 52px;
  height: 48px;
  padding: 4px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
}

.field textarea {
  font-size: 16px;
  min-height: 100px;
}

.req {
  color: var(--danger);
}

.sheet-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* Marker pins */
.ts-marker-icon {
  background: none !important;
  border: none !important;
}

.ts-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.ts-marker__head {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 12%;
  transform: rotate(-45deg);
  background: linear-gradient(145deg, color-mix(in srgb, var(--marker-color) 88%, #fff), var(--marker-color));
  border: 2.5px solid #fff;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--marker-color) 45%, transparent);
}

.ts-marker__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  color: #fff;
}

.ts-marker__icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.ts-marker__point {
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--marker-color);
}

/* Detail */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.kind-danger { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.kind-police { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.kind-hospital { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.kind-safe_zone { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.kind-interest { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.kind-custom {
  background: color-mix(in srgb, var(--badge-color, #64748b) 22%, transparent);
  color: var(--badge-color, #64748b);
}

.detail-header h2 {
  margin: 8px 0 0;
  font-size: 1.25rem;
}

.detail-desc {
  color: var(--text-muted);
  line-height: 1.5;
}

.detail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
  gap: 12px;
}

.author-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.avatar-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-elevated);
}

.date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.votes-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.btn-vote {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.btn-vote.confirm.active {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.btn-vote.dispute.active {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.detail-actions .btn {
  flex: 1;
}

.owner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.owner-actions .btn {
  flex: 1 1 auto;
  min-width: calc(50% - 4px);
}

.marker-list-item__info {
  flex: 1;
  min-width: 0;
}

.marker-list-item__info strong {
  display: block;
  margin-top: 4px;
}

.marker-list-item__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.marker-list-item__actions .btn {
  flex: 1 1 auto;
}

.report-box {
  margin-top: 12px;
  font-size: 0.9rem;
}

.report-box textarea {
  width: 100%;
  margin: 8px 0;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  resize: vertical;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Profile page */
.profile-page {
  padding: 20px 16px calc(var(--nav-h) + var(--safe-bottom) + 24px);
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
}

.profile-header {
  text-align: center;
  margin-bottom: 24px;
}

.profile-header img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.avatar-pick {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  overflow: hidden;
}

.avatar-pick.selected {
  border-color: var(--accent);
}

.avatar-pick img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
}

.marker-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.marker-list-item.inactive {
  opacity: 0.55;
}

.section-title {
  font-size: 1rem;
  margin: 28px 0 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Public profile */
.public-page {
  padding: 24px 16px calc(var(--nav-h) + var(--safe-bottom) + 24px);
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
}

.public-card {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  margin-bottom: 24px;
}

.public-card img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin-bottom: 12px;
}

.marker-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.marker-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Toast */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 5000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  border: 1px solid var(--border);
  max-width: min(92%, 360px);
  text-align: center;
}

body.pick-mode #toast {
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 150px);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo span,
.logo__icon {
  font-size: 1.5rem;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .auth-layout {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 768px) {
  .auth-layout--welcome {
    max-width: 560px;
  }

  .auth-page--login .auth-layout,
  .auth-page--register .auth-layout {
    max-width: 420px;
  }
}

/* Móvil pequeño */
@media (max-width: 380px) {
  .map-toolbar {
    left: 8px;
    right: 8px;
    max-width: calc(100% - 16px);
  }

  .map-page .leaflet-top.leaflet-right {
    right: 8px;
  }

  .kind-grid {
    grid-template-columns: 1fr;
  }

  .fab {
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 767px) {
  .map-status {
    display: none;
  }

  .detail-actions {
    flex-direction: column;
  }

  .detail-actions .btn {
    width: 100%;
  }

  .votes-row {
    grid-template-columns: 1fr;
  }

  .auth-page {
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
  }

  .profile-page,
  .public-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .avatar-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .marker-list-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (min-width: 768px) {
  :root {
    --nav-h: 64px;
  }

  .map-toolbar {
    left: 24px;
    right: auto;
    width: min(420px, calc(100% - 48px));
    max-width: 420px;
  }

  .map-page .leaflet-top.leaflet-right {
    right: 24px;
  }

  .map-actions {
    right: 24px;
  }

  .map-status {
    display: block;
  }

  .kind-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .sheet {
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    max-width: 480px;
    padding-bottom: 24px;
    border-radius: var(--sheet-radius);
  }

  .sheet.open {
    transform: translateX(-50%) translateY(0);
  }

  .pick-banner {
    left: 50%;
    transform: translateX(-50%);
    max-width: 420px;
    right: auto;
    width: calc(100% - 48px);
  }
}
