:root {
  --brand: #242C4F;
  --bg: #EEF1F5;
  --surface: #FFFFFF;
  --text: #0A0C10;
  --text2: #5B6472;
  --line: #E2E7EE;
  --onTime: #22C55E;
  --minor: #A16207;
  --major: #EF4444;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --maxw: 480px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: clip;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #dfe4ea;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  max-width: var(--maxw);
  min-width: 0;
  margin: 0 auto;
  height: 100dvh;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(16,24,40,.10);
  position: relative;
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px calc(10px);
  padding-top: max(14px, env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid transparent;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  width: 20px; height: 20px; border-radius: 6px; background: var(--brand);
  display: inline-block; position: relative; top: 3px;
}
.brand-name { font-weight: 800; font-size: 24px; letter-spacing: -.02em; }
h1.brand-name { margin: 0; }
.brand-tag {
  font-size: 11px; font-weight: 700; color: var(--text2);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; position: relative; top: -2px;
}
.topbar-spacer { flex: 1; }
.iconbtn {
  border: none; background: rgba(0,0,0,.05); color: var(--text);
  width: 34px; height: 34px; border-radius: 999px; font-size: 24px; line-height: 1;
  cursor: pointer; display: grid; place-items: center;
}
.settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  color: var(--brand);
  background: rgba(36,44,79,.09);
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.settings-btn:focus-visible, .nearby-scope:focus-visible { outline: 3px solid rgba(36,44,79,.42); outline-offset: 3px; }
.hidden { display: none !important; }

/* Main scroll area */
#view {
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 14px 90px;
}

/* Filter chips */
.chips { display: flex; gap: 6px; margin: 4px 0 12px; }
.chip {
  flex: 1; border: 1px solid var(--line); background: var(--surface);
  color: var(--text2); border-radius: 999px; padding: 8px 4px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .ci { font-size: 13px; }
.nearby-scope {
  width: 100%;
  padding: 9px 11px;
  color: var(--brand);
  background: transparent;
  border: 1px dashed rgba(36,44,79,.35);
  border-radius: 12px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.nearby-scope::before { content: '⚙ '; }
.nearby-context { margin: 3px 2px 14px; }
.nearby-context h2 { margin: 0; color: var(--text); font-size: 20px; letter-spacing: -.02em; }
.nearby-context p { margin: 4px 0 0; color: var(--text2); font-size: 12px; line-height: 1.45; }

/* Instalación PWA: aviso discreto, con guía sólo bajo demanda. */
.install-guide {
  margin: 0 0 12px;
  overflow: hidden;
  color: var(--brand);
  background: rgba(255,255,255,.66);
  border: 1px solid rgba(36,44,79,.16);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.install-trigger {
  width: 100%;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.install-trigger::after {
  content: '›';
  color: var(--text2);
  font-size: 19px;
  line-height: 1;
  transition: transform .16s ease;
}
.install-guide.is-expanded .install-trigger::after { transform: rotate(90deg); }
.install-trigger-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 9px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}
.install-trigger-copy { display: grid; min-width: 0; gap: 1px; }
.install-trigger-copy strong { font-size: 12px; letter-spacing: -.01em; }
.install-trigger-copy small { color: var(--text2); font-size: 10px; line-height: 1.35; }
.install-trigger:focus-visible, .install-primary:focus-visible { outline: 3px solid rgba(36,44,79,.45); outline-offset: -3px; }
.install-panel {
  margin: 0 8px 8px;
  padding: 10px;
  color: var(--text);
  background: rgba(238,241,245,.72);
  border-radius: 10px;
}
.install-panel-intro { margin: 0; color: var(--text2); font-size: 11px; line-height: 1.4; }
.install-primary {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.install-primary:disabled { cursor: wait; opacity: .7; }
.install-direct-note, .install-footnote { margin: 7px 0 0; color: var(--text2); font-size: 10px; line-height: 1.4; text-align: center; }
.install-steps { display: grid; gap: 6px; margin: 9px 0 0; padding: 0; list-style: none; }
.install-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(36,44,79,.09);
  border-radius: 8px;
}
.install-step-number {
  width: 21px;
  height: 21px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
}
.install-step-copy { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.install-step-copy strong { font-size: 11px; }
.install-step-copy small { color: var(--text2); font-size: 10px; line-height: 1.35; }

@media (prefers-reduced-motion: reduce) {
  .install-trigger::after { transition: none; }
}

/* Cards / rows */
.section-h { font-size: 22px; font-weight: 800; letter-spacing: -.01em; margin: 14px 2px 8px; }
.section-sub { font-size: 13px; font-weight: 600; color: var(--text2); margin: -4px 2px 8px; }

.row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 70px 12px 14px;
  color: var(--text); font: inherit; text-align: left;
  background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer;
  border: 1px solid var(--line);
}
.row:active { transform: scale(.995); }
.row:focus-visible { outline: 3px solid rgba(36,44,79,.42); outline-offset: 3px; }
.row-shell { position: relative; }
.row-line { position: relative; }
.badge {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 16px;
  overflow: hidden; white-space: nowrap; letter-spacing: -.02em;
}
.badge svg { width: 24px; height: 24px; fill: #fff; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; font-weight: 700; }
.row-sub { font-size: 13px; font-weight: 600; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub.live { color: var(--onTime); }
.row-sub.prog { color: var(--minor); }
.row-sub.muted { color: var(--text2); }
.schedule-warning {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: #713f12;
  background: #fffbeb;
  border: 1px solid #fbbf24;
  border-radius: 999px;
}
.schedule-warning-row { max-width: 100%; margin-top: 5px; padding: 4px 7px; }
.schedule-warning-mark {
  width: 15px;
  height: 15px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: #d97706;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
}
.schedule-warning-copy { display: flex; min-width: 0; overflow-wrap: anywhere; }
.schedule-warning-copy strong { font-size: 10px; line-height: 1.2; }
.chev { color: rgba(91,100,114,.5); font-size: 20px; flex-shrink: 0; }
.dist { color: var(--text2); font-weight: 600; }

.go {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 999px;
  background: rgba(0,0,0,.05); display: grid; place-items: center; text-decoration: none;
  color: var(--brand); font-size: 18px;
}
.row-shell .go { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); }
.row .schedule-warning-row { margin: 5px 0 0; }

/* Board */
.board-head {
  background: var(--surface); border-radius: 20px; padding: 16px;
  box-shadow: var(--shadow); margin: 6px 0 14px; border: 1px solid var(--line);
}
.board-head-top { display: flex; align-items: center; gap: 12px; }
.board-title { overflow-wrap: anywhere; font-size: 22px; font-weight: 900; letter-spacing: -.01em; line-height: 1.15; }
.board-sub { font-size: 13px; font-weight: 600; color: var(--text2); margin-top: 2px; }
.starbtn { margin-left: auto; background: none; border: none; cursor: pointer; font-size: 26px; line-height: 1; color: var(--minor); }
.livebar { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--onTime); }
.livedot { width: 8px; height: 8px; border-radius: 999px; background: var(--onTime); }
.board-actions { display: flex; gap: 10px; margin-top: 12px; }
.btn {
  flex: 1; text-align: center; text-decoration: none; border-radius: 999px;
  padding: 10px; font-weight: 700; font-size: 14px; border: none; cursor: pointer;
}
.btn-ghost { background: rgba(36,44,79,.10); color: var(--brand); }

#minimap { height: 190px; border-radius: 16px; overflow: hidden; margin-bottom: 14px; border: 1px solid var(--line); background: #dfe4ea; }
.leaflet-container { background: #e7ebf0; font: inherit; }

.arr {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border-radius: 16px; padding: 12px 14px;
  box-shadow: var(--shadow); margin-bottom: 10px; border: 1px solid var(--line);
}
.arr-main { flex: 1; min-width: 0; }
.arr-dest { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arr-meta { font-size: 12px; font-weight: 600; color: var(--text2); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.arr-eta { font-size: 26px; font-weight: 900; letter-spacing: -.02em; }
.arr-eta small { font-size: 13px; font-weight: 700; color: var(--text2); }
.schedule-card {
  min-width: 0;
  padding: 17px;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow);
}
.schedule-card-kicker { color: #b45309; font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.schedule-card h2 { margin: 5px 0 9px; font-size: 18px; line-height: 1.2; }
.schedule-card p { margin: 7px 0; color: var(--text2); font-size: 12px; line-height: 1.5; }
.schedule-card-link {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 12px;
  padding: 11px 13px;
  overflow-wrap: anywhere;
  color: #fff;
  background: var(--brand);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}
.schedule-card-link-secondary { margin-top: 7px; color: var(--brand); background: rgba(36,44,79,.09); }

/* States */
.state { text-align: center; color: var(--text2); padding: 48px 16px; }
.state .big { font-size: 18px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.spinner {
  width: 26px; height: 26px; border-radius: 999px; margin: 40px auto;
  border: 3px solid rgba(36,44,79,.15); border-top-color: var(--brand);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cta { display: inline-block; margin-top: 14px; background: var(--brand); color: #fff; border: none; border-radius: 999px; padding: 12px 22px; font-weight: 700; font-size: 15px; cursor: pointer; }
.cta:disabled { cursor: wait; opacity: .62; }
.cta-secondary { color: var(--brand); background: rgba(36,44,79,.09); }

/* Selector de ubicación */
.location-bar {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 12px;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.location-pin {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background: var(--brand);
  border-radius: 11px;
  font-size: 15px;
}
.location-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.location-copy strong { font-size: 13px; }
.location-copy span {
  overflow: hidden;
  color: var(--text2);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.location-change {
  padding: 8px 11px;
  color: var(--brand);
  background: rgba(36,44,79,.09);
  border: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.location-state { padding: 42px 16px 54px; }
.location-state p { margin: 8px auto 0; max-width: 320px; line-height: 1.5; }
.location-state-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  color: var(--brand);
  background: rgba(36,44,79,.09);
  border-radius: 16px;
  font-size: 24px;
  font-weight: 900;
}
.location-state-icon svg { width: 23px; height: 23px; }
.location-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.map-location-choice {
  width: 100%;
  margin: 0 0 10px;
  padding: 11px 14px;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.location-bar + .fullmap-wrap, .map-location-choice + .fullmap-wrap { height: calc(100dvh - 198px); }
.fullmap-wrap.with-install-guide { height: calc(100dvh - 246px); }
.location-dialog {
  width: min(100%, 520px);
  max-height: min(92dvh, 760px);
  margin: auto 0 0;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -18px 60px rgba(10,12,16,.25);
}
.location-dialog::backdrop { background: rgba(10,12,16,.56); backdrop-filter: blur(3px); }
.location-dialog-panel { max-height: min(92dvh, 760px); padding: 22px 18px max(24px, env(safe-area-inset-bottom)); overflow-y: auto; }
.location-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.location-dialog-kicker { color: var(--text2); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.location-dialog h2 { margin: 4px 0 18px; font-size: 24px; line-height: 1.15; letter-spacing: -.025em; }
.location-dialog-close {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--text2);
  background: var(--bg);
  border: 0;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
}
.location-gps {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  color: #fff;
  text-align: left;
  background: var(--brand);
  border: 0;
  border-radius: 16px;
  cursor: pointer;
}
.location-gps:disabled { cursor: wait; opacity: .7; }
.location-gps-icon { width: 34px; font-size: 24px; text-align: center; }
.location-gps-icon svg { width: 24px; height: 24px; vertical-align: middle; }
.location-gps-copy { display: flex; flex-direction: column; gap: 2px; }
.location-gps-copy strong { font-size: 15px; }
.location-gps-copy small { color: rgba(255,255,255,.66); font-size: 11px; }
.location-form-error, .location-form-feedback { min-height: 18px; margin: 7px 2px 0; color: var(--major); font-size: 12px; line-height: 1.4; }
.location-form-feedback { color: var(--text2); }
.location-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--text2); font-size: 11px; font-weight: 700; }
.location-divider::before, .location-divider::after { height: 1px; flex: 1; content: ''; background: var(--line); }
.location-form { display: grid; gap: 12px; }
.location-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 800; }
.location-input {
  width: 100%;
  padding: 12px 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  outline: none;
}
.location-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(36,44,79,.12); }
.location-submit {
  padding: 12px 14px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.location-submit:disabled { cursor: wait; opacity: .62; }
.location-results {
  display: grid;
  max-height: min(38dvh, 308px);
  gap: 7px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.location-results[hidden] { display: none; }
.location-result {
  width: 100%;
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  color: var(--text);
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
.location-result-street { font-size: 13px; font-weight: 800; }
.location-result-place { color: var(--text2); font-size: 11px; font-weight: 650; }
.location-result:hover, .location-result[aria-selected="true"] { border-color: var(--brand); background: rgba(36,44,79,.06); }
.location-provider { margin: 14px 2px 0; color: var(--text2); font-size: 10px; line-height: 1.45; }

/* Ajustes de Cercanía */
.settings-dialog {
  width: min(calc(100% - 28px), 470px);
  margin: auto;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(10,12,16,.28);
}
.settings-dialog::backdrop { background: rgba(10,12,16,.56); backdrop-filter: blur(3px); }
.settings-dialog-panel { padding: 22px; }
.settings-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.settings-dialog-kicker { color: var(--text2); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.settings-dialog h2 { margin: 4px 0 5px; font-size: 23px; line-height: 1.14; letter-spacing: -.025em; }
.settings-dialog-head p { margin: 0; color: var(--text2); font-size: 12px; line-height: 1.45; }
.settings-dialog-close {
  width: 36px;
  height: 36px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--text2);
  background: var(--bg);
  border: 0;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
}
.settings-field { display: grid; gap: 7px; margin-top: 20px; }
.settings-field-label { font-size: 13px; font-weight: 900; }
.settings-field small { color: var(--text2); font-size: 11px; line-height: 1.45; }
.settings-select {
  width: 100%;
  min-height: 45px;
  padding: 0 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
}
.settings-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(36,44,79,.12); outline: none; }
.settings-bike-note {
  display: grid;
  gap: 3px;
  margin-top: 18px;
  padding: 12px;
  color: #115e59;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 13px;
  font-size: 12px;
  line-height: 1.4;
}
.settings-bike-note strong { font-size: 12px; }
.settings-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.settings-reset, .settings-save {
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.settings-reset { color: var(--brand); background: rgba(36,44,79,.09); }
.settings-save { color: #fff; background: var(--brand); }
.settings-dialog-close:focus-visible, .settings-reset:focus-visible, .settings-save:focus-visible { outline: 3px solid rgba(36,44,79,.42); outline-offset: 3px; }

/* Tabbar */
.tabbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--text2); font-size: 11px; font-weight: 700;
}
.tab.active { color: var(--brand); }
.tab-ico { width: 24px; height: 24px; }
.tab-ico svg { width: 24px; height: 24px; }

/* big map (Mapa tab) */
#bigmap { position: absolute; inset: 0; bottom: 0; }
.fullmap-wrap { position: relative; height: calc(100dvh - 128px); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.fullmap-wrap #bigmap { border-radius: 16px; }

.footer-note { text-align: center; color: var(--text2); font-size: 11px; padding: 18px 8px 2px; line-height: 1.5; }
.footer-note a { color: var(--text2); }

.security-card {
  margin: 22px 0 4px;
  padding: 18px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0, rgba(34,197,94,.22), transparent 38%),
    var(--brand);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(16,24,40,.16);
}
.security-head { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 14px; align-items: start; }
.security-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #082f1a;
  background: #86efac;
  border: 4px solid rgba(255,255,255,.16);
  border-radius: 14px;
  font-size: 20px;
  font-weight: 900;
}
.security-kicker {
  color: #86efac;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .13em;
}
.security-title h2 { margin: 4px 0 7px; font-size: 20px; line-height: 1.18; letter-spacing: -.02em; }
.security-title > p { margin: 0; color: rgba(255,255,255,.7); font-size: 12px; line-height: 1.5; }
.security-grid { display: grid; gap: 8px; margin-top: 17px; }
.security-fact { padding: 13px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.11); border-radius: 14px; }
.security-fact h3 { margin: 0 0 5px; color: #fff; font-size: 13px; }
.security-fact p { margin: 0; color: rgba(255,255,255,.7); font-size: 11px; line-height: 1.5; }
.security-shared { margin-top: 10px; padding: 14px; color: #d1fae5; background: rgba(34,197,94,.10); border: 1px solid rgba(134,239,172,.22); border-radius: 14px; }
.security-shared h3 { margin: 0 0 8px; color: #86efac; font-size: 13px; }
.security-shared ul { margin: 0; padding-left: 17px; }
.security-shared li { margin: 6px 0; font-size: 11px; line-height: 1.48; }
.security-analytics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.14);
}
.security-analytics-copy { display: flex; flex-direction: column; gap: 3px; }
.security-analytics-copy strong { font-size: 13px; }
.security-analytics-copy span { color: rgba(255,255,255,.64); font-size: 11px; line-height: 1.35; }
.security-analytics-control { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.security-analytics-status { color: rgba(255,255,255,.72); font-size: 9px; white-space: nowrap; }
.security-toggle {
  width: 46px;
  height: 26px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  cursor: pointer;
  transition: background .18s ease;
}
.security-toggle-knob {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.28);
  transition: transform .18s ease;
}
.security-toggle.on { background: #4ade80; }
.security-toggle.on .security-toggle-knob { transform: translateX(20px); }
.security-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.security-toggle:disabled { cursor: not-allowed; opacity: .55; }
.security-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.security-link {
  display: inline-flex;
  padding: 9px 12px;
  color: var(--brand);
  background: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.security-link-secondary { color: #fff; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.14); }
.security-caveat { margin: 10px 0 0; color: rgba(255,255,255,.58); font-size: 10px; }

.privacy-page {
  width: min(680px, calc(100% - 28px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px 48px;
  background: var(--surface);
}
.privacy-hero { padding: 28px 0 20px; border-bottom: 1px solid var(--line); }
.privacy-eyebrow { margin: 0 0 8px; color: var(--brand); font-size: 10px; font-weight: 900; letter-spacing: .13em; }
.privacy-page h1 { margin: 0 0 8px; font-size: clamp(30px, 8vw, 40px); letter-spacing: -.04em; }
.privacy-page h2 { margin: 0 0 10px; font-size: 20px; letter-spacing: -.02em; }
.privacy-page h3 { margin: 0 0 5px; font-size: 14px; }
.privacy-page p { margin: 8px 0; color: var(--text2); line-height: 1.6; }
.privacy-page a { color: var(--brand); }
.privacy-back { font-weight: 700; text-decoration: none; }
.privacy-updated { font-size: 12px; }
.privacy-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.privacy-list { display: grid; gap: 9px; margin: 0; padding-left: 20px; color: var(--text2); line-height: 1.5; }
.privacy-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 16px;
  background: #f2f4f8;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.privacy-choice p { margin-bottom: 0; font-size: 12px; }
.privacy-toggle {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 10px 12px;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.privacy-toggle.is-enabled { color: var(--brand); background: #fff; }
.privacy-toggle:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.privacy-toggle:disabled { cursor: not-allowed; opacity: .62; }
.privacy-github { font-weight: 800; }
.privacy-contact { border-bottom: 0; }

/* Nav superior: oculta en mobile, visible en desktop */
.topnav { display: none; gap: 4px; }
.list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.list .row, .list .arr { margin-bottom: 0; }
.arr-list { display: flex; flex-direction: column; gap: 10px; }
.arr-list .arr { margin-bottom: 0; }
.board-body { display: block; }
.nearby-layout, .nearby-rail, .nearby-results { min-width: 0; }

/* ─────────── Desktop ─────────── */
@media (min-width: 760px) {
  body {
    background:
      radial-gradient(circle at 12% 0, rgba(255,255,255,.82), transparent 30%),
      #dfe4ea;
  }
  #app {
    width: min(calc(100% - 48px), 1480px);
    max-width: none;
    min-height: 100dvh;
    border-inline: 1px solid rgba(255,255,255,.68);
    box-shadow: 0 0 60px rgba(16,24,40,.10);
  }
  .topbar { padding: 18px 28px; }
  .brand-name { font-size: 26px; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topnav .tab {
    flex: none; flex-direction: row; gap: 6px;
    padding: 9px 16px; border-radius: 999px; font-size: 15px;
  }
  .topnav .tab.active { background: rgba(36,44,79,.10); color: var(--brand); }
  #view { padding: 18px 28px 48px; }

  /* El contenido aprovecha el ancho sin convertir tarjetas en renglones interminables. */
  .list { grid-template-columns: 1fr 1fr; gap: 12px; }
  .nearby-layout {
    display: grid;
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }
  .nearby-rail {
    position: sticky;
    top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .nearby-rail > * { width: 100%; min-width: 0; }
  .nearby-rail .chips { display: grid; grid-template-columns: 1fr 1fr; max-width: none; margin: 0; }
  .nearby-rail .chip { min-height: 40px; padding-inline: 10px; }
  .nearby-rail .chip:first-child { grid-column: 1 / -1; }
  .nearby-rail .install-guide { margin: 0; }
  .nearby-rail .location-bar { margin: 0; }
  .nearby-results { min-height: 280px; }
  .nearby-results .list { grid-template-columns: minmax(0, 1fr); }
  .nearby-results .state { padding-top: 34px; }

  .board-head { max-width: 100%; }
  .board-body { display: grid; grid-template-columns: minmax(320px,.88fr) minmax(360px,1.12fr); gap: 24px; align-items: start; }
  .board-body #minimap { height: min(52dvh, 460px); min-height: 340px; position: sticky; top: 20px; margin-bottom: 0; }
  .board-body .arr-list { display: flex; flex-direction: column; gap: 10px; }

  .section-h { font-size: 24px; }
  .state { padding: 64px 16px; }
  #view.map-view {
    min-height: calc(100dvh - 78px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: 24px;
  }
  #view.map-view .location-bar, #view.map-view .map-location-choice { flex: 0 0 auto; }
  #view.map-view .fullmap-wrap,
  #view.map-view .location-bar + .fullmap-wrap,
  #view.map-view .map-location-choice + .fullmap-wrap,
  #view.map-view .fullmap-wrap.with-install-guide {
    height: auto;
    min-height: min(560px, calc(100dvh - 176px));
    flex: 1 1 auto;
    margin-bottom: 0;
    border-radius: 20px;
    box-shadow: 0 14px 32px rgba(16,24,40,.10);
  }
  #view.map-view .fullmap-wrap #bigmap { border-radius: 20px; }
  .security-card { padding: 22px; }
  .security-grid { grid-template-columns: 1fr 1fr; }
  .location-dialog { margin: auto; border-radius: 24px; }
}

@media (min-width: 1080px) {
  .list { grid-template-columns: 1fr 1fr; }
  .nearby-results .list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1240px) {
  .topbar { padding-inline: 36px; }
  #view { padding-inline: 36px; }
  .nearby-layout { grid-template-columns: 288px minmax(0, 1fr); gap: 30px; }
  .nearby-results .list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .security-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
