:root {
  /* Paleta del flyer "La sombra como derecho urbano" */
  --orange: #EF5A24;
  --orange-2: #F8914F;
  --orange-grad: linear-gradient(100deg, #EC5420 0%, #F8914F 100%);
  --yellow: #FFE600;
  --sun: #FFD400;
  --teal: #2EC7B7;          /* acento del flyer (fondos, badges) */
  --purple: #561A4E;        /* Juárez Limpio */

  --brand: #0B7A70;         /* turquesa oscuro: botones y texto (contraste AA) */
  --brand-600: #08635B;
  --brand-50: #E3F7F4;
  --ink: #2A1B28;
  --ink-2: #5A4A57;
  --muted: #7A6B76;
  --line: #EEDFD3;
  --bg: #FFF8F1;
  --card: #ffffff;
  --sand: #FFF0E3;

  --c-suficiente: #0E8F82;
  --c-parcial: #F2B705;
  --c-sin_sombra: #D62839;
  --c-no_seguro: #6b7280;
  --c-new: var(--purple);

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 24px rgba(23, 37, 47, .12);
  --shadow-lg: 0 14px 40px rgba(23, 37, 47, .22);
  --panel-w: 400px;
  --topbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Outfit, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }

/* ---------- Barra superior ---------- */
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: var(--orange-grad);
  color: #fff;
  z-index: 1100;
  box-shadow: 0 2px 10px rgba(120,40,0,.25);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 46px; height: 46px; display: grid; place-items: center; flex: none; }
.brand-logo svg { width: 46px; height: 46px; stroke: none; fill: none; }
.brand-text { min-width: 0; }
.brand h1 {
  margin: 0; font-family: "Bebas Neue", Outfit, sans-serif; font-weight: 400; font-size: 30px; letter-spacing: .01em;
  line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(120,30,0,.25);
}
.brand-sub { color: var(--yellow); }
.tagline { margin: 3px 0 0; font-size: 13px; font-weight: 500; color: #fff; opacity: .95; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.partners-top { display: flex; align-items: center; gap: 12px; }
.logo-jl-white { height: 40px; width: auto; display: block; }
.logo-chip { background: #fff; border-radius: 10px; padding: 3px 6px; display: grid; place-items: center; }
.logo-chip img { height: 38px; width: auto; display: block; }
.lang-switch { display: inline-flex; background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.6); border-radius: 999px; padding: 3px; }
.lang-btn { border: 0; background: none; color: #fff; font-weight: 800; font-size: 13px; padding: 6px 12px; border-radius: 999px; min-height: 34px; min-width: 42px; }
.lang-btn.is-active { background: #fff; color: var(--orange); }

/* ---------- Disposición ---------- */
.layout { flex: 1; display: flex; min-height: 0; position: relative; }
.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #e9e4da; }
body.is-picking #map { cursor: crosshair; }
body.is-picking .leaflet-marker-icon:not(.leaflet-marker-draggable) { opacity: .45; }

.panel {
  width: var(--panel-w);
  flex: none;
  background: var(--card);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 900;
}
.panel-handle { display: none; }
.tabs { display: flex; gap: 4px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); flex: none; }
.tab {
  flex: 1; border: 0; background: none; padding: 12px 8px; font-weight: 600; font-size: 14px; color: var(--ink-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px; min-height: 44px;
}
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }

/* ---------- Controles sobre el mapa ---------- */
.map-top {
  position: absolute; top: 12px; left: 12px; right: 64px; z-index: 650; /* bajo las ventanas emergentes (700) */
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none;
}
.map-top > * { pointer-events: auto; }
.seg { display: inline-flex; background: var(--card); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.seg-btn { border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2); min-height: 38px; }
.seg-btn.is-active { background: var(--brand); color: #fff; }
.notices { display: flex; flex-direction: column; gap: 6px; max-width: 520px; }
.notice {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; line-height: 1.35;
  padding: 8px 12px; border-radius: 12px; background: var(--card); box-shadow: var(--shadow);
}
.notice-warn { border-left: 4px solid #b45309; }
.notice-err { border-left: 4px solid #b91c1c; }
.notice-demo { border-left: 4px solid #7c3aed; }
.link-btn { border: 0; background: none; color: #6d28d9; font-weight: 700; text-decoration: underline; padding: 4px 0; }
.badge-demo { background: #7c3aed; color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; }

.legend {
  position: absolute; left: 12px; bottom: 24px; z-index: 650; background: var(--card); border-radius: 14px;
  box-shadow: var(--shadow); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px;
}
.legend strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lg-item { display: flex; align-items: center; gap: 8px; }

.fab {
  position: absolute; right: 16px; bottom: 28px; z-index: 850;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--yellow); color: var(--purple); border: 2px solid #fff; border-radius: 999px;
  padding: 16px 24px 16px 20px; font-size: 17px; font-weight: 800; box-shadow: 0 10px 30px rgba(239,90,36,.45);
  min-height: 56px; transition: transform .15s, background .15s;
}
.fab:hover { background: var(--sun); transform: translateY(-1px); }
.fab svg { width: 22px; height: 22px; stroke-width: 2.6; }

.pick-hint {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 860;
  width: min(92%, 460px); background: var(--ink); color: #fff; border-radius: 18px; padding: 14px 16px;
  box-shadow: var(--shadow-lg); text-align: center;
}
.pick-hint p { margin: 0 0 10px; font-weight: 600; }
.pick-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; border: 1.5px solid transparent; padding: 10px 16px; font-weight: 600; font-size: 15px;
  min-height: 46px; transition: background .15s, border-color .15s;
}
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-primary-soft { background: var(--brand-50); color: var(--brand); border-color: #bfe0da; }
.btn-outline { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: #c9c0b1; background: #fdfbf7; }
.btn-light { background: #fff; color: var(--ink); }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.icon-btn { border: 0; background: var(--sand); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }

/* ---------- Marcadores ---------- */
.pin-wrap { background: none; border: 0; }
.pin {
  --c: var(--c-no_seguro);
  width: 34px; height: 34px; margin-top: 1px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--c); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.35);
  display: grid; place-items: center;
}
.pin span { transform: rotate(45deg); display: grid; place-items: center; color: #fff; }
.pin svg { width: 18px; height: 18px; stroke-width: 2.4; }
.pin-suficiente { --c: var(--c-suficiente); }
.pin-parcial { --c: var(--c-parcial); }
.pin-parcial span { color: #3b2a00; }
.pin-sin_sombra { --c: var(--c-sin_sombra); }
.pin-no_seguro { --c: var(--c-no_seguro); }
.pin-new { --c: var(--c-new); animation: bob 1.2s ease-in-out infinite; }
.pin.is-demo { border-style: dashed; border-color: #ede9fe; opacity: .82; }
@keyframes bob { 50% { margin-top: -5px; } }

.dot { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; flex: none; }
.dot svg { width: 15px; height: 15px; stroke-width: 2.4; }
.dot-suficiente { background: var(--c-suficiente); }
.dot-parcial { background: var(--c-parcial); color: #3b2a00; }
.dot-sin_sombra { background: var(--c-sin_sombra); }
.dot-no_seguro { background: var(--c-no_seguro); }

/* ---------- Ventanas emergentes ---------- */
.leaflet-popup-content-wrapper { border-radius: 14px; padding: 0; overflow: hidden; }
.leaflet-popup-content { margin: 0; font-family: inherit; font-size: 14px; }
.pop-head { display: flex; align-items: center; gap: 8px; padding: 10px 36px 10px 12px; color: #fff; }
.pop-head strong { font-size: 14.5px; line-height: 1.25; }
.pop-ic svg { width: 20px; height: 20px; }
.pop-suficiente { background: var(--c-suficiente); }
.pop-parcial { background: var(--c-parcial); color: #2b1f00; }
.pop-sin_sombra { background: var(--c-sin_sombra); }
.pop-no_seguro { background: var(--c-no_seguro); }
.pop-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 10px 12px; }
.pop-dl dt { color: var(--muted); font-size: 12.5px; }
.pop-dl dd { margin: 0; font-weight: 500; }
.pop-comment { margin: 0 12px 10px; padding: 8px 10px; background: var(--sand); border-radius: 8px; font-size: 13.5px; white-space: pre-wrap; }
.pop-img { display: block; width: 100%; height: 150px; object-fit: cover; background: var(--sand); } /* altura fija: el autoajuste del mapa la conoce antes de cargar */
.notices { transition: opacity .15s; }
body.popup-open .notices, body.is-picking .notices { opacity: 0; pointer-events: none; }
.leaflet-container a.leaflet-popup-close-button { color: #fff; top: 6px; right: 6px; font-size: 22px; }

/* ---------- Estadísticas ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-card { border-radius: 14px; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; background: var(--sand); }
.stat-num { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.stat-num small { font-size: 16px; font-weight: 700; }
.stat-lbl { font-size: 12px; color: var(--ink-2); line-height: 1.25; font-weight: 500; }
.stat-num { font-family: "Bebas Neue", Outfit, sans-serif; font-weight: 400; font-size: 40px; letter-spacing: .01em; }
.stat-num small { font-size: 22px; font-weight: 400; }
.stat-total { background: var(--orange-grad); color: #fff; }
.stat-total .stat-lbl { color: #fff; }
.stat-sin { background: #FDE6E8; }
.stat-sin .stat-num { color: #B01F2E; }
.stat-suf { background: var(--brand-50); }
.stat-suf .stat-num { color: var(--brand-600); }

.sec-title { font-family: "Bebas Neue", Outfit, sans-serif; font-weight: 400; font-size: 21px; letter-spacing: .03em; color: var(--orange); margin: 22px 0 8px; }

.partners { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.partners-title { margin: 0 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.partners-logos { display: flex; justify-content: center; align-items: center; gap: 28px; }
.partners-logos img { height: 78px; width: auto; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 128px 1fr 70px; align-items: center; gap: 8px; font-size: 14px; }
.bar-lbl { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.bar-track { height: 12px; background: #eee8dd; border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; transition: width .4s; }
.fill-suficiente, .seg-suficiente, .sw-suficiente { background: var(--c-suficiente); }
.fill-parcial, .seg-parcial, .sw-parcial { background: var(--c-parcial); }
.fill-sin_sombra, .seg-sin_sombra, .sw-sin_sombra { background: var(--c-sin_sombra); }
.fill-no_seguro, .seg-no_seguro, .sw-no_seguro { background: var(--c-no_seguro); }
.bar-val { text-align: right; font-weight: 700; }
.bar-val small { color: var(--muted); font-weight: 500; }

.compare { display: flex; flex-direction: column; gap: 12px; }
.cmp-city { border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.cmp-city.is-dim { opacity: .5; }
.cmp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: 14px; }
.cmp-head span { color: var(--muted); font-size: 13px; }
.stack { display: flex; height: 16px; border-radius: 6px; overflow: hidden; background: #eee8dd; }
.stack span { display: block; height: 100%; }
.stack span + span { border-left: 2px solid #fff; }
.cmp-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; font-weight: 600; }
.cmp-nums span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.recent button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 10px; min-height: 48px;
}
.recent button:hover { background: #fdfbf7; }
.recent-txt { display: flex; flex-direction: column; font-size: 14px; }
.recent-txt small { color: var(--muted); }

.empty { background: var(--sand); padding: 14px; border-radius: 12px; margin: 16px 0 0; font-size: 14px; }
.disclaimer { display: flex; gap: 8px; margin: 20px 0 4px; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; background: #f6f2ea; padding: 10px 12px; border-radius: 12px; }
.disclaimer svg { width: 18px; height: 18px; color: var(--muted); margin-top: 1px; }

/* ---------- Filtros y chips ---------- */
.field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field h3, .field legend, .label { font-size: 14px; font-weight: 700; margin: 0 0 8px; padding: 0; display: block; }
.card-soft { background: #f8f4ed; border-radius: 14px; padding: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.req { color: #b91c1c; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip > span {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; min-height: 42px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 500;
  transition: background .12s, border-color .12s; user-select: none;
}
.chip .dot { width: 20px; height: 20px; }
.chip .dot svg { width: 13px; height: 13px; }
.chip input:checked + span { background: var(--brand-50); border-color: var(--brand); color: var(--brand-600); font-weight: 700; }
.chip input:focus-visible + span { outline: 3px solid #2563eb; outline-offset: 2px; }
.chips-lg .chip > span { min-height: 48px; padding: 10px 18px; font-size: 15px; }
.chips-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chips-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip-tile { display: flex; }
.chip-tile > span {
  flex: 1; flex-direction: column; justify-content: center; text-align: center; border-radius: 14px;
  padding: 10px 6px; min-height: 76px; font-size: 13px; line-height: 1.2; gap: 4px;
}
.emo { font-size: 24px; line-height: 1; font-weight: 400; }

.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cond-card { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); min-height: 64px; cursor: pointer; }
.cond-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cond-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.cond-ic svg { width: 22px; height: 22px; stroke-width: 2.4; }
.cond-lbl { font-weight: 600; font-size: 14px; line-height: 1.25; }
.cond-suficiente .cond-ic { background: var(--c-suficiente); }
.cond-parcial .cond-ic { background: var(--c-parcial); color: #3b2a00; }
.cond-sin_sombra .cond-ic { background: var(--c-sin_sombra); }
.cond-no_seguro .cond-ic { background: var(--c-no_seguro); }
.cond-card:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; background: #fffdf8; }
.cond-suficiente:has(input:checked) { border-color: var(--c-suficiente); box-shadow: 0 0 0 2px var(--c-suficiente) inset; background: #ecf7f4; }
.cond-parcial:has(input:checked) { border-color: #b98500; box-shadow: 0 0 0 2px #b98500 inset; background: #fff8e1; }
.cond-sin_sombra:has(input:checked) { border-color: var(--c-sin_sombra); box-shadow: 0 0 0 2px var(--c-sin_sombra) inset; background: #fdf0e9; }
.cond-no_seguro:has(input:checked) { border-color: var(--c-no_seguro); box-shadow: 0 0 0 2px var(--c-no_seguro) inset; background: #f3f4f6; }
.cond-card:has(input:focus-visible) { outline: 3px solid #2563eb; outline-offset: 2px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; position: relative; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 44px; height: 26px; border-radius: 99px; background: #cfc8bb; position: relative; transition: background .15s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .switch-ui { background: #7c3aed; }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid #2563eb; outline-offset: 2px; }

.prose { font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }
.prose h3 { color: var(--ink); font-size: 15px; margin: 16px 0 6px; }
.prose h3:first-child { margin-top: 0; }
.prose ol { padding-left: 20px; margin: 0; }

/* ---------- Formulario ---------- */
.sheet {
  position: fixed; z-index: 1200; top: var(--topbar-h); right: 0; bottom: 0; width: 460px; max-width: 100%;
  display: flex;
}
.sheet-card { background: var(--card); width: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border-left: 1px solid var(--line); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-head h2 { margin: 0; font-size: 19px; font-weight: 800; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.sheet-foot { flex: none; display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--card); }
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn-primary { flex: 2; font-size: 16px; min-height: 52px; }

.loc-row { display: flex; align-items: center; gap: 10px; background: var(--sand); border-radius: 12px; padding: 8px 8px 8px 12px; }
.loc-pin { color: var(--c-new); display: grid; }
.loc-text { flex: 1; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 600; }
.field.has-error > .loc-row, .field.has-error .chip > span, .field.has-error .cond-card { border-color: #dc2626; }
.field.has-error > legend, .field.has-error > h3 { color: #b91c1c; }
.field.has-error > .loc-row { box-shadow: 0 0 0 2px #dc2626 inset; }

textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 16px; resize: vertical; min-height: 84px; background: #fff;
}
textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50); }

.photo-drop {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px;
  border: 2px dashed #cfc6b6; border-radius: 14px; background: #fcfaf6; color: var(--ink-2); font-weight: 600; cursor: pointer;
}
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-drop svg { width: 26px; height: 26px; }
.photo-preview { display: flex; align-items: center; gap: 12px; }
.photo-preview img { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; }

.privacy-note { display: flex; gap: 10px; background: var(--brand-50); color: #12423e; border-radius: 12px; padding: 12px; font-size: 13px; line-height: 1.45; margin: 4px 0 8px; }
.privacy-note svg { color: var(--brand); width: 20px; height: 20px; }
.form-error { background: #fef2f2; color: #991b1b; border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 14px; margin: 8px 0 0; }

/* ---------- Aviso emergente ---------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--topbar-h) + 14px); transform: translateX(-50%); z-index: 1500;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 14.5px; max-width: min(92vw, 480px); text-align: center;
}
.toast-ok { background: #0b6155; }
.toast-warn { background: #92400e; }

/* ---------- Escritorio: formulario sobre el panel ---------- */
@media (min-width: 861px) {
  body.form-open .fab { display: none; }
}

.sheet-head h2 { font-family: "Bebas Neue", Outfit, sans-serif; font-weight: 400; font-size: 28px; letter-spacing: .02em; color: var(--orange); }

/* Logos del encabezado: solo si hay espacio (siempre visibles en el panel) */
@media (max-width: 1080px) {
  .partners-top { display: none; }
}

/* ---------- Celulares y tabletas ---------- */
@media (max-width: 860px) {
  :root { --topbar-h: 60px; --peek: 104px; }
  .topbar { padding: 0 12px; }
  .brand { gap: 8px; }
  .brand-logo, .brand-logo svg { width: 36px; height: 36px; }
  .brand h1 { font-size: 23px; }
  .brand-sub { display: block; font-size: 17px; }
  .tagline { display: none; }
  .lang-btn { padding: 5px 9px; min-width: 36px; }
  .partners-logos img { height: 64px; }

  .layout { display: block; }
  .map-wrap { position: absolute; inset: 0 0 calc(var(--peek) - 18px) 0; }
  .map-top { left: 10px; top: 10px; right: 56px; }
  .seg-btn { padding: 7px 12px; font-size: 13.5px; min-height: 36px; }
  .notice { font-size: 12px; padding: 6px 10px; gap: 4px 8px; }
  .legend, .leaflet-control-scale { display: none; }

  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: 78dvh;
    border-left: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,.18);
    transform: translateY(calc(100% - var(--peek) - var(--safe-b))); transition: transform .28s ease;
    z-index: 1000;
  }
  .panel.is-open { transform: translateY(0); }
  .panel-handle {
    display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: none;
    padding: 8px 16px 4px; width: 100%; flex: none;
  }
  .handle-bar { width: 44px; height: 5px; border-radius: 99px; background: #cfc8bb; }
  .panel-peek { display: flex; align-items: center; gap: 12px; font-size: 14px; flex-wrap: wrap; justify-content: center; }
  .peek-item { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
  .tabs { padding: 0 8px; }
  .panel-body { padding-bottom: calc(24px + var(--safe-b)); }

  .fab { bottom: calc(var(--peek) - 4px); right: 12px; padding: 14px 20px 14px 16px; }
  .pick-hint { bottom: calc(var(--peek) - 6px); }
  body.form-open .fab, body.form-open .panel { visibility: hidden; }

  .sheet { top: auto; left: 0; right: 0; width: auto; height: 92dvh; }
  .sheet-card { border-radius: 20px 20px 0 0; border-left: 0; }
  .chips-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .chip-tile > span { font-size: 12px; min-height: 72px; padding: 8px 4px; }
  .bar-row { grid-template-columns: 112px 1fr 64px; }
}

@media (max-width: 340px) {
  .chips-grid { grid-template-columns: repeat(2, 1fr); }
  .cond-grid { grid-template-columns: 1fr; }
  .stat-num { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
