:root {
  --crema: #FFF8E2;
  --crema-2: #FFECAF;
  --verde: #1C372A;
  --verde-2: #2F5C43;
  --verde-suave: #EAF2EC;
  --terracota: #D08444;
  --terracota-osc: #9A5824;
  --gris-texto: #5C6B5F;
  --gris-suave: #9AA79D;
  --borde: #E8DDB8;
  --blanco: #FFFFFF;
  --fuente: 'Figtree', 'Gibson', -apple-system, 'Segoe UI', Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: var(--fuente);
  background: var(--crema);
  color: var(--verde);
  overscroll-behavior-y: none;
}

.vista { display: none; min-height: 100dvh; }
.vista.activa { display: block; }

/* ---------- HOME ---------- */
.home-header { text-align: center; padding: 34px 22px 10px; }
.logo { width: min(290px, 74vw); height: auto; display: block; margin: 0 auto 14px; }
.home-header h1 {
  font-size: 27px; font-weight: 700; color: var(--terracota);
  letter-spacing: .5px; margin-top: 4px; text-transform: uppercase;
}
.fechas { font-size: 13px; color: var(--gris-texto); margin-top: 6px; font-weight: 500; }
.intro {
  font-size: 14px; line-height: 1.55; color: var(--gris-texto);
  max-width: 560px; margin: 14px auto 0;
}

.cards {
  display: grid; gap: 12px; padding: 8px 16px 28px;
  max-width: 640px; margin: 0 auto;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }

.card-pab {
  display: flex; align-items: center; gap: 14px;
  background: var(--blanco); border: 1px solid var(--borde);
  border-radius: 16px; padding: 15px 16px; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  text-align: left; width: 100%; font-family: inherit;
}
.card-pab:active { transform: scale(.98); }
.card-icono {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.card-pab h3 { font-size: 16px; font-weight: 600; color: var(--verde); }
.card-pab p { font-size: 13px; color: var(--gris-suave); margin-top: 2px; }
.card-flecha { margin-left: auto; color: var(--terracota); flex-shrink: 0; }

.home-footer { text-align: center; padding: 0 24px 40px; }
.home-footer p { font-size: 13.5px; color: var(--gris-suave); }

.home-footer p.credito, .pab-footer p.credito { margin-top: 14px; font-size: 10px; color: var(--gris-suave); }
.credito a { color: var(--terracota); font-weight: 600; text-decoration: none; }
.credito a:hover { text-decoration: underline; }
.pab-footer { text-align: center; padding: 0 24px 36px; }

/* ---------- BUSCADOR ---------- */
.buscador-wrap { position: relative; max-width: 640px; margin: 14px auto; padding: 0 16px; z-index: 30; }
.buscador-wrap.compacto { margin: 10px auto 0; }
.buscador {
  display: flex; align-items: center; gap: 10px;
  background: var(--blanco); border: 1px solid var(--borde);
  border-radius: 24px; padding: 11px 16px; color: var(--gris-suave);
}
.buscador input {
  border: none; outline: none; flex: 1; font-size: 15px;
  font-family: inherit; color: var(--verde); background: transparent;
}
.buscador input::placeholder { color: var(--gris-suave); }

.resultados {
  position: absolute; left: 16px; right: 16px; top: calc(100% + 6px);
  background: var(--blanco); border: 1px solid var(--borde); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(28, 55, 42, .12);
  overflow: hidden; display: none;
}
.resultados.abierto { display: block; }
.resultado {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 16px; cursor: pointer; border: none; background: none;
  font-family: inherit; text-align: left;
  border-bottom: 1px solid #F4EDD5;
}
.resultado:last-child { border-bottom: none; }
.resultado:active { background: var(--crema); }
.resultado b { font-size: 14.5px; font-weight: 600; color: var(--verde); display: block; }
.resultado span { font-size: 12.5px; color: var(--gris-suave); }
.resultado .mini-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--verde);
  color: var(--crema-2); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.sin-resultados { padding: 14px 16px; font-size: 13.5px; color: var(--gris-suave); }

.resultado .mini-avatar.con-logo, .emp-card .mini-avatar.con-logo, .avatar.con-logo {
  background: var(--blanco); border: 1px solid var(--borde); overflow: hidden;
}
.mini-avatar img, .avatar img {
  width: 100%; height: 100%; object-fit: contain;
  padding: 4px; box-sizing: border-box; border-radius: 50%;
}

/* ---------- PABELLÓN ---------- */
.pab-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 4px; max-width: 900px; margin: 0 auto;
}
.btn-icono {
  background: var(--blanco); border: 1px solid var(--borde); color: var(--verde);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.btn-icono:active { transform: scale(.94); }
.pab-titulo h2 { font-size: 19px; font-weight: 700; }
.pab-titulo p { font-size: 12.5px; color: var(--terracota); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }

.chips {
  display: flex; gap: 7px; overflow-x: auto; padding: 10px 16px 4px;
  max-width: 900px; margin: 0 auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid #CFD9D0; background: var(--blanco); color: var(--verde);
  font-size: 13px; font-weight: 500; font-family: inherit;
  padding: 7px 14px; border-radius: 16px; white-space: nowrap; cursor: pointer;
}
.chip.activo { background: var(--verde); color: var(--crema-2); border-color: var(--verde); }

/* ---------- MAPA ---------- */
.mapa-viewport {
  position: relative; overflow: hidden; touch-action: none;
  background: var(--crema);
  height: min(58dvh, 520px);
  border-top: 1px solid var(--borde); border-bottom: 1px solid var(--borde);
  margin-top: 10px;
}
.mapa-lienzo {
  width: 100%; height: 100%;
  transform-origin: 0 0; will-change: transform;
}
.mapa-lienzo svg { width: 100%; height: 100%; display: block; }

.mapa-controles {
  position: absolute; right: 12px; bottom: 46px;
  display: flex; flex-direction: column; gap: 8px;
}
.btn-zoom {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--borde); background: var(--blanco); color: var(--verde);
  font-size: 22px; line-height: 1; cursor: pointer; font-family: inherit;
  box-shadow: 0 3px 10px rgba(28, 55, 42, .1);
}
.leyenda {
  position: absolute; left: 12px; bottom: 10px;
  display: flex; gap: 14px; font-size: 12px; color: var(--verde);
  background: rgba(255, 248, 226, .88); border-radius: 10px; padding: 6px 10px;
}
.leyenda span { display: flex; align-items: center; gap: 6px; }
.cubo {
  width: 11px; height: 11px; border-radius: 3px; background: #E5DECA;
  border: 1px solid #C9C0A6; display: inline-block;
}
.cubo.ruta { background: var(--verde-2); border-color: var(--verde); }

/* estados de stands dentro del SVG */
.stand.ruta { cursor: pointer; }
.stand.ruta polygon { transition: fill .2s ease, opacity .2s ease; }
.stand.ruta.sel polygon:last-of-type { fill: var(--terracota); stroke: var(--terracota-osc); }
.stand.ruta.dim, .pin.dim { opacity: .3; }
.pin { cursor: pointer; }
.pin.sel circle { fill: var(--terracota-osc); }

/* ---------- LISTA EMPRESAS ---------- */
.lista-empresas {
  max-width: 640px; margin: 0 auto; padding: 14px 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.emp-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--blanco); border: 1px solid var(--borde);
  border-radius: 14px; padding: 12px 14px; cursor: pointer;
  font-family: inherit; text-align: left; width: 100%;
}
.emp-card:active { transform: scale(.985); }
.emp-card.oculta { display: none; }
.emp-card .mini-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--verde);
  color: var(--crema-2); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.emp-card b { font-size: 15px; font-weight: 600; color: var(--verde); display: block; }
.emp-card span { font-size: 12.5px; color: var(--terracota); font-weight: 500; }
.emp-card .flecha { margin-left: auto; color: var(--gris-suave); }

/* ---------- BOTTOM SHEET ---------- */
.velo {
  position: fixed; inset: 0; background: rgba(28, 55, 42, .35);
  opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 90;
}
.velo.abierto { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  background: var(--blanco); border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .3s cubic-bezier(.3,.9,.3,1);
  box-shadow: 0 -12px 40px rgba(28, 55, 42, .18);
  max-width: 640px; margin: 0 auto;
}
.sheet.abierto { transform: translateY(0); }
.sheet-asa { width: 38px; height: 4px; border-radius: 2px; background: #E0DCC8; margin: 4px auto 14px; }
.sheet-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: none; background: var(--crema); }
.sheet-cab { display: flex; align-items: center; gap: 13px; padding-right: 40px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--verde);
  color: var(--crema-2); display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; flex-shrink: 0;
}
.sheet h3 { font-size: 18px; font-weight: 700; }
.sheet-meta { font-size: 13px; color: var(--terracota); font-weight: 600; margin-top: 1px; }
.sheet-tipo { font-size: 12.5px; color: var(--gris-suave); font-weight: 500; margin-top: 10px; text-transform: uppercase; letter-spacing: .6px; }
.sheet-desc { font-size: 14.5px; line-height: 1.6; color: var(--gris-texto); margin-top: 6px; }
.sheet-cats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.sheet-cats span {
  font-size: 12.5px; font-weight: 500; padding: 5px 12px; border-radius: 12px;
  background: var(--verde-suave); color: var(--verde);
}
