/* Elegir especialidades y competencias desde el portal (Tropa, Compañía, Avanzada y Clan).
   Un solo módulo para los cuatro portales: toma los colores de cada uno con variables.
   Si el portal no define ninguna, usa un morado neutro. */
.pe-sec, .pe-modal, .pe-toast {
  --pe-a: var(--acento, var(--pio-borgona, var(--cam-rojo, #5b3a8c)));
  --pe-a-osc: var(--acento-osc, var(--pio-borgona-osc, var(--cam-rojo-osc, #43296a)));
  --pe-sol: var(--sol, var(--pio-mostaza, var(--cam-mostaza, #f0b831)));
  --pe-tinta: var(--tinta, var(--pio-berenjena, var(--cam-tinta, #241f33)));
  --pe-suave: var(--suave, var(--cam-gris, #5a5470));
  --pe-papel: #fff;
  --pe-linea: rgba(36, 31, 51, .16);
  --pe-ok: #166534; --pe-ok-fondo: #ecfdf3;
  --pe-radio: 16px;
  color: var(--pe-tinta);
  font-family: inherit;
}
.pe-sec *, .pe-modal *, .pe-toast { box-sizing: border-box; }

/* ───────── Bloque dentro del portal ───────── */
.pe-sec { display: grid; gap: 12px; }
.pe-intro { margin: 0; font-size: .92rem; line-height: 1.45; color: var(--pe-suave); }
.pe-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pe-it { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 4px 12px; align-items: start; padding: 10px 12px; border: 1px solid var(--pe-linea); border-radius: 14px; background: #fff; border-left: 5px solid var(--pe-sol); }
.pe-it.pe-ok { border-color: #16a34a; background: var(--pe-ok-fondo); }
.pe-emb { width: 60px; height: 60px; display: grid; place-items: center; grid-row: 1 / span 3; }
.pe-emb img { width: 60px; height: 60px; object-fit: contain; }
.pe-emb img.pe-off { filter: grayscale(1) opacity(.55); }
.pe-emb .pe-ico { width: 52px; height: 52px; border-radius: 50%; background: #241f20; color: var(--pe-sol); display: grid; place-items: center; font-size: 1.3rem; }
.pe-t { margin: 0; font-weight: 800; font-size: 1.02rem; line-height: 1.25; overflow-wrap: anywhere; }
.pe-sub { margin: 0; font-size: .82rem; color: var(--pe-suave); }
.pe-chip { display: inline-block; margin-top: 2px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 800; background: #fdf3d3; color: #6b4a00; }
.pe-it.pe-ok .pe-chip { background: #bbf7d0; color: var(--pe-ok); }
.pe-plan { margin: 4px 0 0; font-size: .86rem; line-height: 1.4; overflow-wrap: anywhere; }
.pe-plan b { font-weight: 800; }
.pe-ase { margin: 2px 0 0; font-size: .82rem; color: var(--pe-suave); }
.pe-acc { grid-column: 2; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; }
.pe-vacio { margin: 0; padding: 16px; text-align: center; border: 2px dashed var(--pe-linea); border-radius: 14px; font-size: .92rem; color: var(--pe-suave); background: rgba(255, 255, 255, .6); }
.pe-nota { margin: 0; font-size: .8rem; color: var(--pe-suave); line-height: 1.4; }

/* ───────── Botones ───────── */
.pe-btn { appearance: none; border: 2px solid var(--pe-a); background: #fff; color: var(--pe-a); font: inherit; font-weight: 800; font-size: .95rem; min-height: 44px; padding: 8px 16px; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pe-btn:hover { background: #faf7ff; }
.pe-btn-p { background: var(--pe-a); color: #fff; }
.pe-btn-p:hover { background: var(--pe-a-osc); }
.pe-btn-g { border-color: transparent; background: transparent; color: var(--pe-suave); text-decoration: underline; min-height: 40px; padding: 6px 10px; font-weight: 700; }
.pe-btn-peligro { border-color: #b91c1c; color: #b91c1c; }
.pe-btn[disabled] { opacity: .55; cursor: not-allowed; }
.pe-btn-lg { width: 100%; min-height: 50px; font-size: 1.02rem; }
.pe-sec .pe-btn:focus-visible, .pe-modal .pe-btn:focus-visible, .pe-modal input:focus-visible, .pe-modal select:focus-visible,
.pe-modal textarea:focus-visible, .pe-modal .pe-tarj:focus-visible, .pe-modal .pe-chipbtn:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 2px; }

/* ───────── Ventana ───────── */
body.pe-abierto { overflow: hidden; }
.pe-modal { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: flex-end; justify-content: center; background: rgba(20, 14, 36, .6); }
.pe-hoja { width: 100%; max-height: 94vh; max-height: 94dvh; display: flex; flex-direction: column; background: #fffdf9; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .35); overflow: hidden; }
.pe-cab { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--pe-linea); background: #fff; }
.pe-cab h2 { margin: 0; flex: 1; font-size: 1.12rem; font-weight: 800; line-height: 1.2; }
.pe-x { appearance: none; border: 0; background: #f1ecf7; width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--pe-tinta); }
.pe-cuerpo { padding: 14px 16px 8px; overflow-y: auto; display: grid; gap: 14px; align-content: start; -webkit-overflow-scrolling: touch; }
.pe-pie { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--pe-linea); background: #fff; }
@media (min-width: 720px) {
  .pe-modal { align-items: center; padding: 24px; }
  .pe-hoja { max-width: 760px; border-radius: 22px; max-height: 90vh; }
}

/* Catálogo */
.pe-buscar { width: 100%; min-height: 46px; padding: 10px 14px; border: 2px solid var(--pe-linea); border-radius: 12px; font: inherit; font-size: 1rem; background: #fff; color: var(--pe-tinta); }
.pe-areas { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-chipbtn { appearance: none; border: 2px solid var(--pe-linea); background: #fff; color: var(--pe-tinta); font: inherit; font-weight: 700; font-size: .85rem; min-height: 40px; padding: 4px 11px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.pe-chipbtn i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.pe-chipbtn[aria-pressed="true"] { border-color: var(--pe-a); background: var(--pe-a); color: #fff; }
.pe-cuenta { margin: 0; font-size: .82rem; color: var(--pe-suave); }
.pe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pe-tarj { appearance: none; position: relative; display: grid; justify-items: center; align-content: start; gap: 6px; padding: 10px 6px 10px; min-height: 140px; border: 2px solid var(--pe-linea); border-radius: 14px; background: #fff; color: var(--pe-tinta); font: inherit; cursor: pointer; text-align: center; }
.pe-tarj:hover { border-color: var(--pe-a); }
.pe-tarj img { width: 76px; height: 76px; object-fit: contain; }
.pe-tarj b { font-size: .84rem; line-height: 1.2; overflow-wrap: anywhere; }
.pe-tarj small { font-size: .72rem; color: var(--pe-suave); }
.pe-tarj[disabled] { opacity: .55; cursor: not-allowed; background: #f4f1f8; }
.pe-tarj .pe-ya { position: absolute; top: 6px; right: 6px; background: var(--pe-ok); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 800; padding: 1px 7px; }
.pe-tarj-otra { border-style: dashed; }
.pe-tarj .pe-ico { width: 60px; height: 60px; border-radius: 50%; background: #241f20; color: var(--pe-sol); display: grid; place-items: center; font-size: 1.5rem; }
.pe-h4 { margin: 0; font-size: .98rem; font-weight: 800; }
.pe-camp { display: grid; grid-template-columns: 1fr; gap: 10px; }
.pe-camp .pe-tarj { grid-template-columns: 72px minmax(0, 1fr); justify-items: start; text-align: left; align-items: center; min-height: 92px; padding: 10px 12px; gap: 4px 12px; }
.pe-camp .pe-tarj img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; grid-row: 1 / span 2; }
.pe-camp .pe-tarj .pe-ico { width: 72px; height: 72px; grid-row: 1 / span 2; }
.pe-camp .pe-tarj b { font-size: 1rem; align-self: end; }
.pe-camp .pe-tarj small { font-size: .82rem; align-self: start; }
@media (min-width: 720px) { .pe-camp { grid-template-columns: 1fr 1fr; } }
.pe-ideas { display: grid; grid-template-columns: 1fr; gap: 8px; }
.pe-idea { appearance: none; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 12px; border: 1px solid #e8dfcb; border-left: 5px solid var(--pe-sol); border-radius: 14px; background: #fff; color: var(--pe-tinta); font: inherit; font-weight: 800; font-size: .92rem; text-align: left; cursor: pointer; }
.pe-idea .pe-ico { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #241f20; color: var(--pe-sol); display: grid; place-items: center; font-size: 1.05rem; }
.pe-idea[disabled] { opacity: .55; cursor: not-allowed; }
@media (min-width: 720px) { .pe-ideas { grid-template-columns: 1fr 1fr; } }

/* Formulario */
.pe-eleg { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: #f6f1fb; border: 1px solid var(--pe-linea); }
.pe-eleg img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.pe-eleg .pe-ico { flex: none; width: 56px; height: 56px; border-radius: 50%; background: #241f20; color: var(--pe-sol); display: grid; place-items: center; font-size: 1.4rem; }
.pe-eleg b { display: block; font-size: 1.05rem; line-height: 1.2; overflow-wrap: anywhere; }
.pe-eleg small { color: var(--pe-suave); font-size: .82rem; }
.pe-cam { display: grid; gap: 6px; }
.pe-cam > label, .pe-cam > .pe-lab { font-weight: 800; font-size: .9rem; }
.pe-cam .pe-ayuda { margin: 0; font-size: .8rem; color: var(--pe-suave); line-height: 1.35; }
.pe-cam input[type=text], .pe-cam input[type=email], .pe-cam select, .pe-cam textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 2px solid var(--pe-linea); border-radius: 12px; font: inherit; font-size: 1rem; background: #fff; color: var(--pe-tinta); }
.pe-cam textarea { min-height: 76px; resize: vertical; line-height: 1.4; }
.pe-pilar { display: grid; gap: 6px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--pe-linea); background: #fff; }
.pe-pilar > label { font-weight: 800; font-size: .95rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pe-pilar .pe-req { font-size: .7rem; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: #fdf3d3; color: #6b4a00; }
.pe-pilar textarea { width: 100%; min-height: 64px; padding: 10px 12px; border: 2px solid var(--pe-linea); border-radius: 12px; font: inherit; font-size: .98rem; resize: vertical; line-height: 1.4; background: #fff; color: var(--pe-tinta); }
.pe-pilar .pe-ayuda { margin: 0; font-size: .8rem; color: var(--pe-suave); }
.pe-caja { padding: 12px; border-radius: 14px; background: #fff8e1; border: 1px solid #f0d58a; font-size: .86rem; line-height: 1.45; color: #5a4300; }
.pe-bloq { padding: 10px 12px; border-radius: 12px; background: #eef2ff; border: 1px solid #c7d2fe; font-size: .86rem; color: #312e81; }
.pe-err { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-weight: 700; font-size: .9rem; }
.pe-toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100001; max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 14px; background: #1f2937; color: #fff; font-weight: 700; font-size: .92rem; line-height: 1.35; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.pe-toast[hidden] { display: none; }
@media (prefers-reduced-motion: no-preference) { .pe-hoja { animation: pe-sube .22s ease-out; } @keyframes pe-sube { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } } }
