/* ═══ Buscadores (funcionarios y laborales) — diseño Fresco: lateral con recuentos y resultados en tarjetas ═══ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
main.fx-main { display: grid; grid-template-columns: 21rem minmax(0, 1fr); gap: 1.75rem; align-items: start; max-width: 82rem; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
main.fx-main > * { min-width: 0; }
.search-panel[hidden] { display: none !important; }
.fx-side { position: sticky; top: 4.75rem; max-height: calc(100dvh - 5.5rem); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.35rem 1.1rem 1.1rem; box-shadow: var(--shadow); }
.fx-sec { padding: 0.9rem 0 0.8rem; border-bottom: 1px solid var(--border); }
.fx-sec:last-child { border-bottom: 0; }
.fx-sec > h2, .fx-det > summary { font-family: var(--serif); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.02em; margin: 0 0 0.55rem; line-height: 1.2; color: var(--text); }
.fx-det > summary { cursor: pointer; list-style: none; min-height: 2rem; display: flex; align-items: center; justify-content: space-between; margin: 0; }
.fx-det > summary::-webkit-details-marker { display: none; }
.fx-det > summary::after { content: "+"; color: var(--primary); font-size: 1.3rem; line-height: 1; }
.fx-det[open] > summary::after { content: "−"; }
.fx-det[open] > summary { margin-bottom: 0.55rem; }
.fx-side .field-inline { margin: 0 0 0.6rem; }
.fx-side .field-label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin: 0 0 0.25rem; letter-spacing: 0.01em; }
.fx-side .field-hint { display: block; font-weight: 400; font-size: 0.74rem; line-height: 1.3; margin-top: 0.1rem; }
.fx-side input, .fx-side select { width: 100%; min-height: 2.75rem; max-width: 100%; text-overflow: ellipsis; }
.fx-side .search-actions { display: flex; gap: 0.5rem; margin: 0.4rem 0 0; flex-wrap: wrap; }
.fx-side .search-actions .btn { flex: 1; min-height: 2.75rem; justify-content: center; }
.fx-oculto { display: none !important; }
.fx-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.fx-pill { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.75rem; padding: 0 0.8rem; border: 1px solid var(--border-f); background: var(--surface); color: var(--text); border-radius: 999px; font-family: var(--sans); font-weight: 600; font-size: 0.93rem; cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease-out; }
.fx-pill b { font-weight: 600; font-variant-numeric: lining-nums tabular-nums; color: var(--text-muted); }
.fx-pill:active:not(:disabled) { transform: scale(0.97); }
.fx-pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.fx-pill[aria-pressed="true"] b { color: #D5EFEC; }
html[data-theme="dark"] .fx-pill[aria-pressed="true"] { color: #06292A; } html[data-theme="dark"] .fx-pill[aria-pressed="true"] b { color: #0F4A4C; }
.fx-pill:disabled { opacity: 0.4; cursor: default; }
@media (hover: hover) and (pointer: fine) { .fx-pill:not(:disabled):not([aria-pressed="true"]):hover { border-color: var(--primary); } }
.fx-ninguno { color: var(--text-muted); font-size: 0.9rem; }
.fx-hist { display: flex; align-items: flex-end; gap: 2px; height: 3.2rem; padding: 0 0.875rem; margin-bottom: 0.1rem; }
.fx-hist i { flex: 1; background: var(--primary); opacity: 0.85; border-radius: 3px 3px 0 0; min-height: 2px; }
.fx-hist i.f { opacity: 0.2; }
.fx-dos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 0.6rem; }
.fx-side .nivel-field > .field-label { display: none; }
/* resultados */
main.fx-main > section:not(.search-panel) { min-width: 0; }
.results-head { display: flex; align-items: center; gap: 0.75rem 1.1rem; flex-wrap: wrap; margin: 0 0 0.75rem; }
#resultsCount { font-family: var(--serif); font-size: 1.15rem; margin-right: auto; letter-spacing: -0.02em; color: var(--text); }
#resultsCount strong { font-size: 2.3rem; letter-spacing: -0.035em; font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.results-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.fx-orden { min-width: 12rem; max-width: 100%; min-height: 2.75rem; border: 1px solid var(--border-f); background: var(--surface); border-radius: 12px; padding: 0 0.7rem; color: var(--text); }
.fx-fbtn { display: none; background: var(--primary); color: #fff; border: 0; border-radius: 999px; min-height: 2.75rem; padding: 0 1.1rem; font-weight: 700; font-family: var(--sans); }
html[data-theme="dark"] .fx-fbtn { color: #06292A; }
.fchips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.9rem; }
.fchips[hidden] { display: none; }
.fchip { border-radius: 999px !important; background: var(--primary-tint) !important; color: var(--text) !important; border: 1px solid var(--border) !important; }
.table-wrap, .table-scroll { min-width: 0 !important; max-width: 100%; border: 0 !important; background: transparent !important; box-shadow: none !important; overflow: visible !important; padding: 0 !important; }
table.results, table.results tbody { display: block; width: 100%; min-width: 0 !important; max-width: 100%; }
table.results thead { display: none; }
table.results tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(18.5rem, 1fr)); gap: 0.8rem; }
table.results tbody tr { display: grid; grid-template-columns: auto auto minmax(0, 1fr); grid-template-areas: "cmp pue ocu" "nom nom nom" "con con con" "prv prv prv" "grp niv pro"; gap: 0.35rem 0.6rem; align-items: center; background: var(--surface); border: 1px solid var(--border-f); border-radius: var(--radius); padding: 0.9rem 1rem 1rem; cursor: pointer; transition: border-color 140ms ease, transform 140ms ease-out; }
table.results tbody tr:active { transform: scale(0.99); }
table.results tbody tr:hover { background: var(--surface) !important; }
@media (hover: hover) and (pointer: fine) { table.results tbody tr:hover { border-color: var(--primary); } }
table.results tbody td { display: block; border: 0 !important; padding: 0 !important; background: transparent !important; min-width: 0; }
table.results tbody td:nth-child(1) { grid-area: cmp; } table.results tbody td:nth-child(2) { grid-area: pue; } table.results tbody td:nth-child(9) { grid-area: ocu; justify-self: end; max-width: 100%; text-align: right; } table.results tbody td:nth-child(9) .pill { display: inline-block; white-space: normal; text-align: right; max-width: 12rem; }
table.results tbody td:nth-child(3) { grid-area: nom; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; line-height: 1.18; letter-spacing: -0.02em; margin-top: 0.15rem; }
table.results tbody td:nth-child(4) { grid-area: con; font-size: 0.92rem; color: var(--text-muted); } table.results tbody td:nth-child(5) { grid-area: prv; font-size: 0.9rem; color: var(--text-muted); }
table.results tbody td:nth-child(6) { grid-area: grp; margin-top: 0.3rem; } table.results tbody td:nth-child(7) { grid-area: niv; margin-top: 0.3rem; font-weight: 600; font-size: 0.85rem; }
table.results tbody td:nth-child(8) { grid-area: pro; justify-self: end; margin-top: 0.3rem; font-size: 0.8rem; color: var(--text-muted); text-align: right; }
body[data-buscador="funcionarios"] table.results tbody td:nth-child(7)::before { content: "Nivel "; font-weight: 400; color: var(--text-muted); }
body[data-buscador="laborales"] table.results tbody td:nth-child(7)::after { content: " h/sem"; font-weight: 400; color: var(--text-muted); }
table.results .row-open { font-family: var(--sans); font-weight: 700; font-variant-numeric: lining-nums tabular-nums; color: var(--text-muted) !important; font-size: 0.86rem; background: none; border: 0; padding: 0; text-decoration: none; }
table.results .pill, table.results .pill-vacante { border-radius: 999px; }
table.results td.compare-cell input { width: 1.25rem; height: 1.25rem; accent-color: var(--primary); }
.empty-state { background: var(--surface); border: 1px dashed var(--border-f); border-radius: var(--radius); padding: 2.5rem 1.25rem; }
.pagination { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; padding: 1.25rem 0 0.5rem; }
.pagination button { border: 1px solid var(--border-f); background: var(--surface); border-radius: 999px; min-height: 2.75rem; padding: 0 1.1rem; font-weight: 700; color: var(--text); }
.pagination button:disabled { opacity: 0.35; }
@media (max-width: 1000px) {
  main.fx-main { grid-template-columns: minmax(0, 1fr); }
  .fx-fbtn { display: inline-flex; align-items: center; }
  .fx-side { position: static; max-height: none; overflow: visible; overscroll-behavior: auto; }   /* sin esto, en móvil el panel abierto es un contenedor de desplazamiento sin nada que desplazar y con «contain» se traga el gesto: la página no baja */
  .fx-side:not([data-abierto]) { display: none; }
}
@media (max-width: 560px) { main.fx-main { padding: 1rem 1rem 3rem; } table.results tbody { grid-template-columns: minmax(0, 1fr); } }

/* altura reservada mientras llegan los datos (evita saltos de diseño) */
#fxProv { min-height: 12.6rem; } #fxGrupo, #fxOcup { min-height: 6.3rem; } .results-head { min-height: 3.5rem; } #resultsCount { min-height: 3.5rem; }
@media (max-width: 1000px) { #fxProv, #fxGrupo, #fxOcup { min-height: 0; } }

/* sin saltos de diseño: el bloque principal no se pinta hasta tener la estructura final (con plazo de seguridad de 4 s) */
html.fx-pre main.container:not(.fx-main) { visibility: hidden; animation: fxVer 0s linear 4s forwards; }
@keyframes fxVer { to { visibility: visible; } }
main.fx-cargando .table-wrap { min-height: 200vh; }

/* «Ordenar por» visible */
.fx-ordenar { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.2rem 0.25rem 0.2rem 0.85rem; border: 1px solid var(--border-f); border-radius: 999px; background: var(--surface); }
.fx-orden-lbl { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 700; font-size: 0.88rem; color: var(--text); white-space: nowrap; }
.fx-orden-lbl svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: var(--primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fx-ordenar .fx-orden { border: 0; background: var(--primary-tint); border-radius: 999px; font-weight: 600; min-width: 0; }
@media (max-width: 560px) { .results-actions { width: 100%; } .fx-ordenar { width: 100%; } .fx-ordenar .fx-orden { flex: 1; } }
/* comparación en pantallas estrechas: concepto a todo el ancho y los puestos en columnas debajo */
@media (max-width: 640px) {
  #compareOverlay .modal, #compareOverlay .modal-card { width: calc(100vw - 1rem) !important; max-width: none !important; margin: 0.5rem auto; }
  #compareBody { overflow-x: hidden; }
  table.compare-table, table.compare-table thead, table.compare-table tbody { display: block; width: 100%; }
  table.compare-table tr { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 0.1rem 0.6rem; padding: 0.5rem 0.25rem; border-bottom: 1px solid var(--border); }
  table.compare-table th, table.compare-table td { display: block; border: 0 !important; padding: 0.1rem 0 !important; white-space: normal !important; background: none !important; min-width: 0; overflow-wrap: anywhere; font-size: 0.84rem; }
  table.compare-table tr > :first-child { grid-column: 1 / -1; font-size: 0.74rem; color: var(--text-muted); }
  table.compare-table thead tr > :first-child:empty { display: none; }
}

/* ── Correcciones de móvil (14 nov 2026) ── */
/* Laborales: Jornada mínima/máxima. Cada campo heredaba min-width: 200px y los dos juntos no cabían: se montaban las etiquetas y la página se ensanchaba (en móvil el navegador alejaba el zoom; en ordenador el panel lateral se desplazaba de lado) */
.fx-side .fx-dos > .field-inline { min-width: 0; }
.fx-side .fx-dos > .field-inline > .field-label { white-space: normal; }
/* Ficha y comparación: botón cerrar de 44 px y, al llegar al final de la ficha, el fondo no se desplaza */
.modal-close { width: 44px; height: 44px; }
.modal-overlay { overscroll-behavior: contain; }
/* Barra de comparación en móvil: los 3 puestos se apilaban, desbordaban la forma de píldora y tapaban hasta el 44 % de la pantalla. Ahora chips solo con el nº de puesto, que caben en una o dos filas */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .compare-bar { left: 10px; right: 10px; transform: none; bottom: 10px; border-radius: 18px; padding: 6px 6px 6px 8px; gap: 8px; }
  #compareChips { display: flex; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; gap: 6px; }
  .compare-bar .chip { flex: none; white-space: nowrap; }
  .compare-bar .chip-nom { display: none; }   /* en móvil, solo el nº de puesto: así se ven siempre los 3 seleccionados */
  .compare-bar #btnCompare { flex: none; }
}
/* Móviles estrechos: los números en una fila y «Comparar» debajo, a todo el ancho */
@media (max-width: 400px) {
  .compare-bar { flex-wrap: wrap; padding: 6px; }
  #compareChips { flex-basis: 100%; flex-wrap: nowrap; justify-content: space-between; }
  .compare-bar .chip { padding-left: 10px; }
  .compare-bar .chip button { min-width: 34px; }
  .compare-bar #btnCompare { flex: 1 1 100%; min-height: 40px; }
}
