/* Etapas de las convocatorias: la tabla dentro de cada tarjeta (sitio) y sus pantallas del panel.
   Funciona con los colores del sitio y también sola (cada variable tiene un valor de respaldo). */

.etp, .etp-adm, .etp-tip {
  --e-head: var(--green-800, #18583A);
  --e-ink: var(--ink, #333);
  --e-soft: var(--ink-soft, #5A646C);
  --e-line: var(--line, #DDE5E9);
  --e-ok: #1F8A4C;
  --e-amber: #F2B705;
  --e-amber-bg: #FFF4CC;
  --e-blue: #5B8FD0;
  --e-blue-bg: #E8F1FB;
}
.etp {
  background: #fff; color: var(--e-ink);
  border: 1px solid var(--e-line); border-radius: 18px; padding: 16px 16px 8px;
  box-shadow: 0 14px 30px -22px rgba(20, 60, 40, .45);
  text-align: left;
}
.etp__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Iconos de etapa ---------- */
.etp-ic {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid transparent; box-sizing: border-box;
}
.etp-ic svg { width: 20px; height: 20px; }
.etp-ic--sm { width: 22px; height: 22px; border-width: 1.5px; }
.etp-ic--sm svg { width: 14px; height: 14px; }
.etp-ic--concluida { background: var(--e-ok); border-color: var(--e-ok); color: #fff; }
.etp-ic--final { background: #17703C; border-color: #17703C; color: #fff; }
.etp-ic--en_evaluacion { background: var(--e-amber); border-color: #D9A300; color: #3B2F00; }
.etp-ic--programada { background: var(--e-amber-bg); border: 2px dashed #D9A300; color: #7A5A00; }
.etp-ic--pendiente { background: var(--e-blue-bg); border-color: var(--e-blue); color: #2B5C9A; }
.etp-ic--no_aplica { background: #EEF1F3; border-color: #D3DADF; color: #8A949B; }
.etp-ic--sm.etp-ic--programada { border-width: 1.5px; }
button.etp-ic { margin: 0; padding: 0; font: inherit; line-height: 1; cursor: pointer; -webkit-appearance: none; appearance: none; }
button.etp-ic:hover { filter: brightness(.95); }
button.etp-ic:focus-visible { outline: 3px solid var(--sky-400, #87CEEB); outline-offset: 2px; }

/* ---------- Globito con el significado del icono (aparece al tocarlo y se oculta solo) ---------- */
.etp-tip {
  position: absolute; z-index: 90; box-sizing: border-box; width: max-content; max-width: min(240px, calc(100vw - 16px));
  display: block; padding: 9px 13px; border: 1px solid var(--e-line); border-radius: 12px; background: #fff; color: var(--e-ink);
  box-shadow: 0 10px 26px -12px rgba(20, 40, 30, .45); font-size: .82rem; line-height: 1.3; text-align: left; pointer-events: none;
}
.etp-tip[hidden] { display: none; }
.etp-tip__fase { display: block; color: var(--e-soft); font-size: .72rem; }
.etp-tip__estado { display: block; margin-top: 1px; color: var(--e-head); font-size: .92rem; }
.etp-tip__sig { display: block; margin-top: 2px; color: var(--e-soft); font-size: .78rem; }

/* ---------- Tabla ---------- */
.etp__wrap { overflow-x: auto; }
.etp__tabla { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.etp__tabla thead th {
  background: var(--e-head); color: #fff; font-weight: 700; font-size: .78rem; line-height: 1.25; text-align: center;
  padding: 12px 8px; vertical-align: middle;
}
.etp__tabla thead th:first-child { text-align: left; padding-left: 16px; border-top-left-radius: 12px; }
.etp__tabla thead th:last-child { border-top-right-radius: 12px; }
.etp__th-estado { text-align: left !important; }
.etp__tabla tbody th, .etp__tabla tbody td { padding: 14px 8px; border-bottom: 1px solid var(--e-line); vertical-align: top; }
.etp__tabla tbody tr:last-child th, .etp__tabla tbody tr:last-child td { border-bottom: 0; }
.etp__tabla tbody tr:hover > * { background: #F6FBF8; }

.etp__conv { text-align: left; padding-left: 16px !important; font-weight: 400; min-width: 210px; max-width: 300px; }
.etp__titulo { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: var(--e-head); font-size: .92rem; line-height: 1.3; letter-spacing: -.005em; }
.etp__meta { display: block; margin-top: 5px; color: var(--e-soft); font-size: .78rem; }
.etp__meta .badge-new { margin-left: 6px; padding: 1px 8px; font-size: .68rem; }

.etp__estado { min-width: 150px; }
.etp__estado small { display: block; margin-top: 6px; color: var(--e-soft); font-size: .76rem; line-height: 1.3; }
.etp-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: .76rem; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.etp-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.etp-pill--pendiente { background: #F1F3F5; color: #3D4750; box-shadow: inset 0 0 0 1px #D3DADF; }
.etp-pill--concluido { background: #1F8A4C; color: #fff; }

.etp__fase { text-align: center; min-width: 84px; }
.etp__fase > * { margin-left: auto; margin-right: auto; }
.etp__fecha { display: block; margin-top: 6px; color: var(--e-soft); font-size: .74rem; font-weight: 700; }
.etp-pdf {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; padding: 4px 10px; border-radius: 999px;
  border: 1.5px solid #9BB8D6; background: #fff; color: #1D4E89; font-size: .72rem; font-weight: 800; text-decoration: none; white-space: nowrap;
}
.etp-pdf + .etp-pdf { margin-left: 4px; }
.etp-pdf svg { width: 13px; height: 13px; flex: none; }
.etp-pdf:hover { background: #EAF2FB; border-color: #1D4E89; }
/* El botón dice qué es: Excel en verde, Word en azul oscuro, otros en gris (el PDF queda como estaba). */
.etp-pdf--excel { border-color: #8cc7a3; color: #1d7a45; }
.etp-pdf--excel:hover { background: #E3F4EA; border-color: #1d7a45; }
.etp-pdf--word { border-color: #9fb3dd; color: #2456a6; }
.etp-pdf--word:hover { background: #E8EEFA; border-color: #2456a6; }
.etp-pdf--otro, .etp-pdf--comprimido, .etp-pdf--presentacion, .etp-pdf--imagen { border-color: #c3cad1; color: #444f59; }
.etp-pdf:focus-visible, .etp-gob:focus-visible { outline: 3px solid var(--sky-400, #87CEEB); outline-offset: 2px; }

.etp__gob { text-align: center; min-width: 118px; }
.etp-gob {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px;
  background: var(--green-600, #2A8250); color: #fff; font-size: .76rem; font-weight: 700; line-height: 1.2; text-decoration: none;
}
.etp-gob:hover { background: var(--green-700, #1F6B43); }
.etp-gob svg { width: 14px; height: 14px; flex: none; }
.etp__nada { color: var(--e-soft); }

/* ---------- Cuadro del PDF ---------- */
.etp-dlg .doc-dlg__marco { background: #fff; }
.etp-dlg__btns { display: flex; flex-wrap: wrap; gap: 8px; }
.etp-dlg__btns .btn { padding: .5rem .9rem; font-size: .85rem; }
.etp-dlg__btns .btn svg { width: 16px; height: 16px; }
.etp-dlg__btns [hidden] { display: none; }

/* ---------- Pantallas medianas y celulares: cada convocatoria pasa a ser una ficha ---------- */
@media (max-width: 1200px) {
  .etp { padding: 14px; }
  .etp__wrap { overflow: visible; }
  .etp__tabla, .etp__tabla tbody { display: block; }
  .etp__tabla thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .etp__tabla tbody tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0 0 14px; overflow: hidden;
    border: 1px solid var(--e-line); border-radius: 14px; background: #fff;
  }
  .etp__tabla tbody tr:last-child { margin-bottom: 4px; }
  .etp__tabla tbody tr:hover > * { background: transparent; }
  .etp__tabla tbody th, .etp__tabla tbody td { padding: 12px; border-bottom: 0; }
  .etp__conv { grid-column: 1 / -1; max-width: none; min-width: 0; padding: 14px 14px 6px !important; background: #F4FAF6 !important; }
  .etp__titulo { -webkit-line-clamp: 4; font-size: .98rem; }
  .etp__estado { grid-column: 1 / -1; min-width: 0; padding: 10px 14px 12px !important; background: #F4FAF6 !important; border-bottom: 1px solid var(--e-line) !important; }
  .etp__estado small { display: inline; margin: 0 0 0 8px; }
  .etp__fase { min-width: 0; border-bottom: 1px solid var(--e-line) !important; border-right: 1px solid var(--e-line) !important; }
  .etp__fase:nth-of-type(3n+1) { border-right: 0 !important; } /* la tercera columna de etapas (3.ª y 6.ª) no lleva línea a la derecha */
  .etp__fase::before { content: attr(data-label); display: block; margin-bottom: 8px; color: var(--e-soft); font-size: .72rem; font-weight: 700; line-height: 1.2; }
  .etp__gob { grid-column: 1 / -1; min-width: 0; padding: 12px 14px 14px !important; text-align: left; }
  .etp-gob { width: 100%; justify-content: center; padding: 10px 14px; font-size: .86rem; }
}
@media (max-width: 560px) {
  .etp__tabla tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .etp__fase:nth-of-type(3n+1) { border-right: 1px solid var(--e-line) !important; }
  .etp__fase:nth-of-type(odd) { border-right: 0 !important; } /* con dos columnas: 2.ª, 4.ª y 6.ª etapa */
}
.etp-mas { margin: 16px 0 0; text-align: center; }

/* ---------- Panel (Etapas de convocatorias) ---------- */
.etp-adm__mini { display: inline-flex; gap: 5px; }
.etp-adm__resumen { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 10px; }
.etp-adm__tira { display: inline-flex; gap: 5px; }
.etp-adm__f { padding: 16px 0; border-top: 1px solid var(--e-line); }
.etp-adm__f:first-child { border-top: 0; padding-top: 4px; }
.etp-adm__cab { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.etp-adm__cab strong { flex: 1; min-width: 0; font-size: 1rem; }
.etp-adm__est { font-size: .84rem; font-weight: 700; white-space: nowrap; }
.etp-adm__est--concluida, .etp-adm__est--final { color: #17703C; }
.etp-adm__est--en_evaluacion { color: #8A6400; }
.etp-adm__est--programada { color: #1D4E89; }
.etp-adm__est--pendiente, .etp-adm__est--no_aplica { color: var(--e-soft); }
.etp-adm__ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.etp-adm__ctl .input[type="date"] { width: auto; min-width: 11rem; }
.etp-adm__ctl .input[type="file"] { width: auto; max-width: 100%; }
.etp-adm__na { display: inline-flex; align-items: center; gap: 7px; color: var(--e-soft); font-size: .9rem; cursor: pointer; }
.etp-adm__gobfecha { color: var(--e-soft); font-size: .9rem; }
.etp-adm__docs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.etp-adm__docs li { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 4px 4px 12px; border: 1px solid var(--e-line); border-radius: 10px; background: #F6F8F9; font-size: .88rem; }
.etp-adm__doc { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.etp-adm__doc svg { width: 16px; height: 16px; flex: none; }
.etp-adm__docs small { color: var(--e-soft); }
.etp-adm__quitar { color: #B3261E; }
.etp-adm__nota { margin: 8px 0 0; color: var(--e-soft); font-size: .82rem; }
.etp-adm__defecto { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.etp-adm .etp-pill, .card .etp-pill, .etp-adm .btn { white-space: nowrap; }
.etp-adm .field { margin-bottom: 0; }

/* Panel: cada etapa es un bloque que se abre y se cierra */
details.etp-adm__f.vx-grupo { padding: 0; border: 1px solid var(--line, #DCE5E0); margin: 0 0 10px; }
details.etp-adm__f.vx-grupo > summary { gap: 12px; }
details.etp-adm__f.vx-grupo > summary .etp-adm__est { flex: none; }
details.etp-adm__f .etp-adm__ctl { margin-top: 2px; }
.etp-adm .vx-item .etp-adm__mini { display: inline-flex; gap: 3px; }
