:root {
  --azul: #00558C;
  --azul-osc: #003F69;
  --azul-claro: #E2EEF6;
  --verde: #009370;
  --verde-osc: #007A5C;
  --verde-tinta: #00573F;
  --verde-claro: #E3F4EE;
  --maiz: #F5B83D;
  --noche: #0B2A3A;
  --tinta: #0A1A2E;
  --tinta-2: #3A5A6E;
  --tinta-3: #5E7888;
  --fondo: #EEF1EC;
  --papel: #FFFFFF;
  --papel-2: #F7F9F6;
  --linea: #DDE5DF;
  --linea-2: #C9D6CE;
  --alerta: #A83131;
  --radio: 14px;
  --sombra: 0 8px 28px rgba(10, 26, 46, 0.10);
  --titulo: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --texto: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--texto); color: var(--tinta); background: var(--fondo); line-height: 1.5; }
img { max-width: 100%; display: block; }
a { color: var(--azul); }
a:hover { color: var(--azul-osc); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--maiz); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
h1, h2, h3 { line-height: 1.1; margin: 0; }
.titulo { font-family: var(--titulo); font-weight: 700; letter-spacing: 0.01em; }
[hidden] { display: none !important; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 10px; border: 0; font-weight: 700; font-size: 16px; text-decoration: none; transition: background-color .15s ease, transform .1s ease; }
.btn:active { transform: translateY(1px); }
.btn-primario { background: var(--verde-osc); color: #fff; }
.btn-primario:hover { background: var(--verde-tinta); color: #fff; }
.btn-azul { background: var(--azul); color: #fff; }
.btn-azul:hover { background: var(--azul-osc); color: #fff; }
.btn-maiz { background: var(--maiz); color: #2B2200; }
.btn-maiz:hover { background: #E8A92A; color: #2B2200; }
.btn-borde { background: transparent; color: var(--azul); border: 1.5px solid var(--azul); }
.btn-borde-claro { background: transparent; color: #fff; border: 1.5px solid #fff; }
.btn-borde-claro:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-chico { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--linea-2); background: var(--papel); color: var(--tinta-2); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: #fff; }
.etiqueta { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--verde-claro); color: var(--verde-tinta); white-space: nowrap; }
.etiqueta-azul { background: var(--azul-claro); color: var(--azul); }
.etiqueta-gris { background: #ECEFEC; color: var(--tinta-2); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; background: var(--tinta); }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }

.tarjeta { background: var(--papel); border-radius: var(--radio); padding: 16px; }

/* ---------- WEB PÚBLICA ---------- */
.pub-header { position: sticky; top: 0; z-index: 30; background: var(--azul); color: #fff; }
.pub-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.pub-header .logo img { height: 52px; width: auto; }
.pub-nav { display: flex; align-items: center; gap: 24px; }
.pub-nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 15px; }
.pub-nav a:hover { color: #CFE4F2; }
.pub-nav .btn { background: #fff; color: var(--azul); min-height: 42px; border-radius: 21px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.hero { background: var(--noche); }
.hero img { width: 100%; height: auto; max-height: 82vh; object-fit: cover; object-position: center 30%; }
.hero-band { background: var(--noche); color: #fff; padding: 32px 0 72px; }
.hero-band .wrap { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.hero-band p { margin: 0; max-width: 640px; font-size: 19px; color: #DCE7F2; }
.hero-band .acciones { display: flex; gap: 12px; flex-wrap: wrap; }

.etapas { position: relative; margin-top: -36px; }
.etapas ol { list-style: none; margin: 0; padding: 22px 28px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; background: var(--papel); border-radius: 16px; box-shadow: var(--sombra); }
.etapas li { border-top: 4px solid var(--linea-2); padding-top: 10px; }
.etapas li.actual { border-color: var(--verde-osc); }
.etapas .f { display: block; font-size: 13px; color: var(--tinta-3); }
.etapas li.actual .f { color: var(--verde-osc); font-weight: 700; }
.etapas .n { font-family: var(--titulo); font-weight: 700; font-size: 26px; color: var(--tinta-2); }
.etapas li.actual .n { color: var(--tinta); }

.seccion { padding: 72px 0 0; }
.seccion-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.seccion-cab h2 { font-family: var(--titulo); font-size: 52px; }
.seccion-cab p { margin: 0; color: var(--tinta-2); }

.equipos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.equipo { background: var(--papel); border-radius: 18px; overflow: hidden; }
.equipo-cab { display: flex; align-items: center; gap: 16px; padding: 20px 24px; }
.equipo-cab img { width: 64px; height: 72px; object-fit: contain; }
.equipo-cab h3 { font-family: var(--titulo); font-size: 34px; }
.equipo-cab span { font-size: 15px; }
.equipo ul { list-style: none; margin: 0; padding: 4px 24px 18px; }
.equipo li button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 0; border: 0; border-bottom: 1px solid #EDF3EF; background: none; text-align: left; }
.equipo li:last-child button { border-bottom: 0; }
.equipo li button:hover .nom { color: var(--azul); }
.equipo .nom { flex-grow: 1; font-weight: 600; font-size: 16px; }
.equipo .loc { font-size: 14px; color: var(--tinta-3); }

.posts-pub { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.post-pub { background: var(--papel); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; }
.post-pub .foto { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; background: #D9E2D6; }
.post-pub .cuerpo { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.post-pub .cab { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 700; }
.post-pub p { margin: 0; }
.post-pub .meta { font-size: 13px; color: var(--tinta-3); }
.vacio { background: var(--papel); border-radius: 16px; padding: 28px; color: var(--tinta-2); }

.cta-prode { margin-top: 72px; background: var(--azul); color: #fff; border-radius: 20px; padding: 44px 48px; display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.cta-prode h2 { font-family: var(--titulo); font-size: 48px; }
.cta-prode p { margin: 10px 0 0; max-width: 620px; font-size: 17px; color: #DCE7F2; }

.pub-footer { margin-top: 72px; background: var(--tinta); color: #C9D6E0; padding: 32px 0; font-size: 14px; }
.pub-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.pub-footer strong { font-family: var(--titulo); font-size: 24px; color: #fff; }

/* Modal ficha pública */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(10, 26, 46, .55); }
.modal-cerrar { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255,255,255,.9); font-size: 22px; line-height: 1; }

/* ---------- FICHA (pública y portal) ---------- */
.ficha-marco { border-radius: 18px; padding: 10px; }
.ficha-int { background: var(--papel); border-radius: 12px; overflow: hidden; }
.ficha-portada { position: relative; height: 180px; display: flex; align-items: flex-end; justify-content: space-between; padding: 16px; color: #fff; }
.ficha-portada img { width: 92px; height: 104px; object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0,0,0,.25)); }
.ficha-portada .equipo-nom { font-family: var(--titulo); font-weight: 700; font-size: 22px; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.ficha-cuerpo { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.ficha-cuerpo h2 { font-family: var(--titulo); font-size: 40px; }
.ficha-cuerpo .lugar { color: var(--tinta-2); font-size: 15px; }
.estado { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 600; background: #F4F1E6; color: #5A4A12; }
.estado::before { content: ''; width: 10px; height: 10px; border-radius: 5px; background: #C59A2C; flex-shrink: 0; }
.estado.ok { background: var(--verde-claro); color: var(--verde-tinta); }
.estado.ok::before { background: var(--verde-osc); }
.datos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: #E4EAE0; border-radius: 10px; overflow: hidden; margin: 0; }
.datos div { background: var(--papel-2); padding: 10px 12px; }
.datos dt { font-size: 12px; color: var(--tinta-3); }
.datos dd { margin: 0; font-weight: 700; font-size: 15px; }
.filas { display: flex; flex-direction: column; gap: 10px; font-size: 15px; margin: 0; }
.filas div { display: flex; justify-content: space-between; gap: 12px; }
.filas dt { color: var(--tinta-3); }
.filas dd { margin: 0; font-weight: 700; text-align: right; }
.ia { display: flex; justify-content: space-between; align-items: flex-end; border-top: 1px solid #EDF3EF; padding-top: 12px; gap: 12px; }
.ia small { display: block; font-size: 12px; color: var(--tinta-3); }
.ia strong { font-family: var(--titulo); font-size: 30px; }

/* ---------- PORTAL ---------- */
.app { min-height: 100vh; }
.app-top { position: sticky; top: 0; z-index: 30; background: var(--azul); color: #fff; }
.app-top .barra { max-width: 720px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.app-top .logo img { height: 48px; width: auto; }
.app-top .acciones { display: flex; align-items: center; gap: 8px; }
.icono-btn { width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255,255,255,.14); color: #fff; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icono-btn:hover { background: rgba(255,255,255,.24); color: #fff; }
.marcador { max-width: 720px; margin: 0 auto; padding: 0 16px 14px; }
.marcador div.in { background: rgba(255,255,255,.1); border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.marcador .eq { display: flex; align-items: center; gap: 8px; font-family: var(--titulo); font-weight: 700; font-size: 20px; }
.marcador .eq img { width: 30px; height: 34px; object-fit: contain; }
.marcador .etapa { text-align: center; font-size: 12px; color: #DCE7F2; line-height: 1.3; }
.marcador .etapa strong { display: block; color: #fff; font-size: 14px; }

.app-main { max-width: 720px; margin: 0 auto; padding: 16px 16px 112px; display: flex; flex-direction: column; gap: 14px; }
.app-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--papel); border-top: 1px solid var(--linea); padding-bottom: env(safe-area-inset-bottom); }
.app-nav ul { max-width: 720px; margin: 0 auto; padding: 0; list-style: none; display: flex; justify-content: space-around; }
.app-nav a { min-width: 64px; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--tinta-3); text-decoration: none; }
.app-nav a[aria-current="page"] { color: var(--azul); font-weight: 700; }
.app-nav svg, .icono-btn svg { width: 22px; height: 22px; }

.demo-banda { background: #FFF6DE; color: #5A4A12; font-size: 13px; padding: 8px 16px; text-align: center; }
.demo-banda select { margin-left: 6px; padding: 4px 6px; border-radius: 6px; border: 1px solid #D9C48A; background: #fff; font-size: 13px; }
.demo-banda button { margin-left: 6px; background: none; border: 0; text-decoration: underline; color: #5A4A12; font-size: 13px; }

.compositor { display: flex; align-items: center; gap: 12px; background: var(--papel); border-radius: var(--radio); padding: 12px; text-decoration: none; color: var(--tinta-3); }
.compositor:hover { color: var(--tinta-2); }
.compositor span.t { flex-grow: 1; }
.filtros { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }

.post { background: var(--papel); border-radius: var(--radio); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.post.fijada { border: 1.5px solid #9DBAD8; }
.post.oculta { opacity: .6; border: 1.5px dashed var(--alerta); }
.post .fijo { font-size: 12px; font-weight: 700; color: var(--azul); display: flex; align-items: center; gap: 6px; }
.post-cab { display: flex; align-items: center; gap: 10px; }
.post-cab .q { flex-grow: 1; min-width: 0; }
.post-cab .n { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; }
.post-cab .n a { color: inherit; text-decoration: none; }
.post-cab .n a:hover { text-decoration: underline; }
.post-cab .m { font-size: 13px; color: var(--tinta-3); }
.post p.texto { margin: 0; font-size: 15px; white-space: pre-line; overflow-wrap: anywhere; }
.galeria { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.galeria.una { grid-template-columns: 1fr; }
.galeria img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #D9E2D6; }
.galeria.una img { aspect-ratio: auto; max-height: 420px; }
.post-acc { display: flex; gap: 6px; border-top: 1px solid #EDF3EF; padding-top: 8px; }
.post-acc button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--tinta-2); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.post-acc button:hover { background: var(--papel-2); }
.post-acc button[aria-pressed="true"] { color: var(--verde-osc); }
.comentarios { display: flex; flex-direction: column; gap: 8px; }
.comentario { background: #F4F7F3; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.comentario strong { margin-right: 4px; }
.comentar { display: flex; gap: 8px; }
.comentar input { flex-grow: 1; min-width: 0; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--linea-2); border-radius: 10px; background: var(--papel-2); font-size: 15px; }
.mod { display: flex; flex-wrap: wrap; gap: 6px; background: #FFF6DE; border-radius: 10px; padding: 8px; }
.mod span { width: 100%; font-size: 12px; font-weight: 700; color: #5A4A12; }

.campo label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.campo input[type="email"], .campo input[type="text"], .campo input[inputmode], .campo textarea { width: 100%; min-height: 48px; padding: 12px 14px; border: 1.5px solid var(--linea-2); border-radius: 10px; background: var(--papel-2); font-size: 16px; }
.campo textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.campo input:focus, .campo textarea:focus { border-color: var(--azul); outline: none; box-shadow: 0 0 0 3px rgba(0,85,140,.15); }
.ayuda { font-size: 13px; color: var(--tinta-3); margin: 6px 0 0; }
.error { font-size: 14px; color: var(--alerta); margin: 6px 0 0; }
.miniaturas { display: flex; gap: 8px; flex-wrap: wrap; }
.miniaturas .m { position: relative; width: 88px; height: 88px; }
.miniaturas .m img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; }
.miniaturas .m button { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; border-radius: 14px; border: 0; background: var(--tinta); color: #fff; font-size: 16px; line-height: 1; }
.agregar-foto { width: 88px; height: 88px; border-radius: 10px; border: 1.5px dashed #7A9AAA; background: var(--papel); color: var(--azul); font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.aviso { background: var(--azul-claro); border-radius: 12px; padding: 14px; display: flex; gap: 10px; font-size: 14px; }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; background: var(--fondo); }
.login-cab { background: linear-gradient(165deg, var(--azul) 0%, var(--azul) 55%, var(--verde-osc) 100%); color: #fff; padding: 36px 24px 84px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.login-cab .logo { width: min(330px, 80vw); }
.login-cab .vs { display: flex; align-items: center; gap: 14px; font-family: var(--titulo); font-weight: 700; font-size: 22px; color: #CFE4F2; }
.login-cab .vs img { height: 70px; width: auto; }
.login-cab p { margin: 0; color: #E3EFF7; max-width: 340px; }
.login-caja { width: min(420px, calc(100% - 40px)); margin: -48px auto 0; background: var(--papel); border-radius: 16px; padding: 28px 22px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 8px 28px rgba(0,85,140,.12); }
.login-caja h1 { font-size: 22px; }
.login-pie { padding: 28px 24px 40px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.codigo { letter-spacing: .5em; text-align: center; font-size: 22px !important; font-weight: 700; }

/* Prode */
.instancias { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.instancias li { background: var(--papel); border-radius: 10px; padding: 8px 10px; color: var(--tinta-3); font-size: 12px; }
.instancias li strong { display: block; color: var(--tinta-2); font-size: 14px; }
.instancias li.abierta { background: var(--azul); color: #CFE4F2; }
.instancias li.abierta strong { color: #fff; }
.elegir-equipo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.elegir-equipo button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border-radius: 12px; border: 1.5px solid var(--linea-2); background: var(--papel); }
.elegir-equipo button img { width: 56px; height: 64px; object-fit: contain; }
.elegir-equipo button span { font-family: var(--titulo); font-weight: 700; font-size: 20px; text-align: center; line-height: 1.1; }
.elegir-equipo button[aria-pressed="true"] { border-width: 3px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 48px; height: 48px; border-radius: 10px; border: 1.5px solid var(--linea-2); background: var(--papel); font-size: 22px; color: var(--azul); }
.stepper input { flex-grow: 1; min-width: 0; height: 48px; text-align: center; font-family: var(--titulo); font-weight: 700; font-size: 28px; border: 1.5px solid var(--linea-2); border-radius: 10px; }
.opciones { display: flex; flex-direction: column; gap: 8px; }
.opciones button { min-height: 48px; text-align: left; padding: 10px 14px; border-radius: 10px; border: 1.5px solid var(--linea-2); background: var(--papel-2); font-size: 15px; }
.opciones button.bien { border-color: var(--verde-osc); background: var(--verde-claro); color: var(--verde-tinta); font-weight: 700; }
.opciones button.mal { border-color: var(--alerta); background: #F7E8E8; color: var(--alerta); }
.ranking { list-style: none; margin: 0; padding: 0; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid #EDF3EF; }
.ranking li.yo { background: var(--azul-claro); border-radius: 8px; }
.ranking .pos { width: 28px; font-family: var(--titulo); font-weight: 700; font-size: 22px; color: var(--azul); }
.ranking .q { flex-grow: 1; }

/* Mapa */
#mapa { height: calc(100vh - 260px); min-height: 380px; border-radius: var(--radio); z-index: 1; }
.leaflet-container { font-family: var(--texto); }
.pin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }

.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); z-index: 60; background: var(--tinta); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; box-shadow: var(--sombra); max-width: calc(100vw - 32px); }

@media (max-width: 860px) {
  .equipos, .posts-pub { grid-template-columns: 1fr; }
  .etapas ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seccion-cab h2 { font-size: 40px; }
  .cta-prode { padding: 32px 24px; }
  .cta-prode h2 { font-size: 38px; }
  .pub-nav a:not(.btn) { display: none; }
  .hero img { max-height: none; aspect-ratio: 4 / 3.4; object-position: 50% 20%; }
}
@media (min-width: 900px) {
  .app-main { padding-bottom: 48px; }
  .app-nav { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--linea); }
  .app-nav a { flex-direction: row; min-height: 52px; gap: 8px; font-size: 14px; }
  .toast { bottom: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#vista:focus { outline: none; }
.equipo .loc, .app-main .nom .loc { font-weight: 400; }
.posts-pub { align-items: start; }
