
:root {
  
  --paper: #ffffff;
  --paper-2: #f6f6f8;
  --paper-3: #fbfbfc;
  --line: #e6e6ea;
  --line-soft: #eeeef1;
  --head: #1a1a1c;
  --text: #3a3a3f;
  --muted: #6a6b70;
  --faint: #6e6e75;
  
  --brand-gray: #565757;
  --grafito: #2e2e34;
  --red: #d7141b;
  --red-deep: #b8141a;
  --red-bright: #ed1c24;
  --red-tint: rgba(215, 20, 27, 0.08);
  --red-tint-2: rgba(215, 20, 27, 0.14);
  
  --aviso-bg: #eef2f7;
  --aviso-borde: #d3dde8;
  --aviso-txt: #34506e;
  --aviso-ico: #4a6a8c;
  --ok-bg: #e8f5ec;
  --ok-borde: #bfe3cc;
  --ok-txt: #0f6b36;
  
  --campo-borde: #8a8b92;
  
  --r: 18px;
  --r-sm: 12px;
  
  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-body: "Hanken Grotesk", system-ui, sans-serif;
  --f-mono: "Space Mono", ui-monospace, monospace;
  
  --i-aviso: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9L1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E");
  --i-reloj: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
  --i-tilde: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
  --i-circulo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100dvh;
  background: var(--paper-2);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

main {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 calc(40px + env(safe-area-inset-bottom));
}

h1 {
  margin: 0;
  color: var(--head);
  font-family: var(--f-display);
  font-size: clamp(1.9rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

h1:focus { outline: none; }

.kicker {
  margin: 0 0 8px;
  color: var(--faint);
  font-family: var(--f-mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.logo {
  display: block;
  width: 28px;
  height: 28px;
  flex: none;
}

#pantalla-login .logo { margin-bottom: 22px; }

.encabezado { margin-bottom: 20px; }
.encabezado .kicker { margin-bottom: 8px; }
#saludo { font-size: clamp(1.6rem, 5vw, 1.8rem); }

.barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  margin-bottom: 18px;
}

button, input { font: inherit; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}



.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 26px -12px rgba(215, 20, 27, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.boton:hover {
  background: var(--red-deep);
  box-shadow: 0 14px 28px -12px rgba(215, 20, 27, 0.7);
  transform: translateY(-2px);
}

.boton:active { transform: none; }

.boton:hover .ico-avanzar { transform: translateX(3px); }


.boton.secundario {
  background: var(--paper);
  color: var(--head);
  border-color: var(--line);
  box-shadow: none;
}

.boton.secundario .ico { color: var(--red); }

.boton.secundario:hover {
  background: var(--paper);
  border-color: var(--brand-gray);
  box-shadow: none;
}

.boton.chico {
  min-height: 44px;
  padding: 0 18px;
}

.boton:disabled,
.boton:disabled:hover {
  background: var(--line);
  border-color: transparent;
  color: var(--muted);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.boton:disabled .ico-avanzar { transform: none; }

.texto {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--head);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.texto .ico { color: var(--red); }
.texto:hover { background: var(--red-tint); }
.texto:hover .ico-atras { transform: translateX(-3px); }
.barra .texto:first-child { margin-left: -14px; }
.barra .texto:last-child { margin-right: -14px; }



input {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 6px 0 16px;
  padding: 0 14px;
  border: 1.5px solid var(--campo-borde);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--head);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-tint-2);
}

label {
  color: var(--head);
  font-size: 0.95rem;
  font-weight: 600;
}

.campo { position: relative; }
.campo input { padding-right: 52px; }

.ojo {
  position: absolute;
  top: 6px;
  right: 2px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--brand-gray);
  cursor: pointer;
}

.ojo:hover { color: var(--red); }
.ojo > .ico { grid-area: 1 / 1; }
.ojo .ojo-raya { display: none; }
.ojo[aria-pressed="true"] .ojo-raya { display: block; }

#pantalla-login {
  width: min(420px, calc(100% - 32px));
  margin-top: 8vh;
  padding: 28px 24px 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
}

#pantalla-login h1 { margin-bottom: 18px; }
#pantalla-login .boton { width: 100%; }



.tarjetas {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 720px) {
  .tarjetas { grid-template-columns: 1fr 1fr; }
}

.tarjeta {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  min-height: 176px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--head);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.tarjeta.principal { border: 1.5px solid var(--red); }

.tarjeta::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 22px;
  right: 22px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: transparent;
  transition: background 0.2s ease;
}


.tarjeta.principal::before,
.tarjeta:focus-visible::before { background: var(--red); }

@media (hover: hover) {
  .tarjeta:hover {
    transform: translateY(-4px);
    box-shadow: 0 28px 50px -28px rgba(20, 20, 30, 0.35);
  }
  .tarjeta:not(.principal):hover { border-color: #cfcfd6; }
  .tarjeta:hover::before { background: var(--red); }
  .tarjeta:hover .flecha { transform: translateX(3px); }
}

.tarjeta:active { transform: scale(0.99); }

.tarjeta-arriba {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.capsula {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--red-tint-2);
  border-radius: var(--r-sm);
  background: var(--red-tint);
  color: var(--red);
}

.ico-grande { width: 22px; height: 22px; }
.flecha { color: var(--faint); }

.tarjeta-abajo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.tarjeta-titulo {
  font-family: var(--f-display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}



.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 28px;
  margin: 0;
  padding: 4px 11px;
  border: 1px solid var(--aviso-borde);
  border-radius: 999px;
  background: var(--aviso-bg);
  color: var(--aviso-txt);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}


.badge.ok {
  background: var(--ok-bg);
  border-color: var(--ok-borde);
  color: var(--ok-txt);
}


.badge.alerta { border-color: #b9c8d9; }

.badge.ok::before,
.badge.alerta::before,
.aviso::before,
.equipo::before {
  content: "";
  flex: none;
  background: currentColor;
  -webkit-mask: var(--i-aviso) center / contain no-repeat;
  mask: var(--i-aviso) center / contain no-repeat;
}

.badge.ok::before,
.badge.alerta::before {
  width: 14px;
  height: 14px;
}

.badge.ok::before {
  -webkit-mask-image: var(--i-tilde);
  mask-image: var(--i-tilde);
}

.badge.alerta::before {
  -webkit-mask-image: var(--i-reloj);
  mask-image: var(--i-reloj);
}

.chips,
.equipos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip,
.equipo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--head);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.chip { min-height: 44px; }
.equipo { min-height: 48px; }

.chip:hover,
.equipo:hover { border-color: var(--brand-gray); }


.chip[aria-pressed="true"],
.equipo[aria-pressed="true"] {
  background: var(--grafito);
  border-color: var(--grafito);
  color: #fff;
}

.equipo::before {
  width: 16px;
  height: 16px;
  color: var(--faint);
  -webkit-mask-image: var(--i-circulo);
  mask-image: var(--i-circulo);
}

.equipo[aria-pressed="true"]::before {
  color: #fff;
  -webkit-mask-image: var(--i-tilde);
  mask-image: var(--i-tilde);
}



.mapa-caja {
  position: relative;
  margin-bottom: 8px;
}

.mapa {
  height: min(46dvh, 420px);
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  isolation: isolate;
  background: var(--paper);
}

@media (min-width: 721px) {
  .mapa { height: min(62dvh, 560px); }
}

.mapa-estado {
  position: absolute;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--line-soft), var(--line), var(--line-soft)) 0 0 / 200% 100%;
  animation: brillo 1.6s linear infinite;
}

.mapa-ayuda { margin: 0 0 8px; }

.mapa.leaflet-container { font-family: var(--f-body); }
.mapa .leaflet-tile-pane { filter: saturate(0.35); }

.mapa .leaflet-control-zoom.leaflet-bar a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  color: var(--head);
}

.mapa .leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.85);
}

.mapa .zona-etiqueta {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--head);
  box-shadow: none;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}



.pie {
  position: sticky;
  bottom: 0;
  z-index: 10;
  margin: 8px -16px 0;
  padding: 14px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(246, 246, 248, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.pie .equipos {
  flex-wrap: nowrap;
  margin: 0 -16px 12px;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pie .equipos::-webkit-scrollbar { display: none; }
.pie .kicker { margin-bottom: 8px; }
.pie .boton { width: 100%; }
.pie .boton + .aviso { margin: 10px 0 0; }



.aviso {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 11px 14px;
  border: 1px solid var(--aviso-borde);
  border-radius: var(--r-sm);
  background: var(--aviso-bg);
  color: var(--aviso-txt);
  font-size: 0.95rem;
  line-height: 1.4;
}

.aviso::before {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--aviso-ico);
}

.aviso:empty { display: none; }

.aviso.caja {
  flex-wrap: wrap;
  align-items: center;
}

.aviso.caja .aviso-texto { flex: 1 1 200px; }

.chips .aviso { width: 100%; margin-bottom: 0; }


.chip.libre {
  border-color: var(--aviso-borde);
  background: var(--aviso-bg);
  color: var(--aviso-txt);
}

.chip.libre:hover { border-color: var(--aviso-ico); }

.chip.libre[aria-pressed="true"] {
  background: var(--aviso-txt);
  border-color: var(--aviso-txt);
  color: #fff;
}




.ubicacion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}


#ubicacion-aviso:empty,
#zona-libre-aviso:empty,
#ubicacion-ok[hidden] { display: none; }



.lista {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fila {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
}

.fila-cab {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.fila h2 {
  margin: 0;
  color: var(--head);
  font-family: var(--f-display);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.fila-cab .badge { flex: none; }

.vacio {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
}



.sk {
  display: block;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--line-soft), var(--line), var(--line-soft)) 0 0 / 200% 100%;
  animation: brillo 1.6s linear infinite;
}

.sk-ancho { width: 62%; height: 18px; margin-bottom: 14px; }
.sk-medio { width: 38%; }
.sk-corto { width: 90px; margin-bottom: 14px; }
.sk-titulo { width: 55%; height: 28px; margin-bottom: 22px; }
.sk-bloque { height: 150px; margin-bottom: 14px; border-radius: var(--r); }

@keyframes brillo {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}



button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
}

input:focus-visible { outline-offset: 2px; }

::selection { background: var(--red-tint-2); }

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



.acciones { display: inline-flex; align-items: center; gap: 4px; }
.barra .acciones .texto:last-child { margin-right: -14px; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
}
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar-iniciales {
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--head);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.avatar-grande { width: 64px; height: 64px; }
.avatar-chip { width: 28px; height: 28px; margin-left: -10px; }

.avatares {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 560px) { .avatares { grid-template-columns: repeat(4, 1fr); } }

.avatar-opcion {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--head);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.avatar-opcion:hover { border-color: var(--brand-gray); }

.avatar-opcion[aria-pressed="true"] {
  border-color: var(--red);
  background: var(--red-tint);
}
.avatar-nombre {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#pantalla-perfil .boton { width: 100%; }
#perfil-ok { margin-bottom: 12px; }
#perfil-ok[hidden] { display: none; }
#companeros-aviso:empty { display: none; }
#companeros-aviso { margin-top: 2px; margin-bottom: 10px; }
.chip.companero { padding-left: 20px; }
.chip.companero .avatar-chip { margin-left: -10px; }

.pila { display: flex; align-items: center; margin: 0 0 10px; padding-left: 8px; }
.avatar-pila {
  width: 30px;
  height: 30px;
  margin-left: -8px;
  border: 2px solid var(--paper);
}


:root {
  --head: #000000;
  --f-display: "Montserrat", system-ui, sans-serif;
  --f-body: "Lato", system-ui, sans-serif;
  --f-mono: "Montserrat", system-ui, sans-serif;
}
