/* Histórico RPT: se apoya en el diseño de los buscadores (funcionarios.css) y añade pestañas, tarjetas de resumen y tablas de cambios */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.h-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 0 0 16px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { font-family: var(--sans); font-size: 0.88rem; font-weight: 600; padding: 9px 16px; min-height: 40px; border-radius: 999px; border: none; background: transparent; color: var(--text-muted); cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.seg button:focus-visible, .h-vista button:focus-visible, .h-tabs button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.h-vista { display: inline-flex; gap: 4px; border-bottom: 1px solid var(--border); }
.h-vista button, .h-tabs button { font-family: var(--sans); font-size: 0.92rem; font-weight: 600; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--text-muted); padding: 10px 14px; cursor: pointer; white-space: nowrap; min-height: 44px; }
.h-vista button[aria-selected="true"], .h-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--primary); }
.h-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 18px 0 14px; scrollbar-width: thin; }
.cnt { display: inline-block; margin-left: 7px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.h-resumen { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin: 0 0 18px; }
.h-resumen h2 { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; margin: 0 0 8px; }
.h-resumen p { margin: 0 0 6px; font-size: 0.92rem; }
.h-resumen p:last-child { margin-bottom: 0; }
.h-estado { margin: 0 0 14px; padding: 12px 16px; border-radius: 10px; background: var(--primary-tint); border: 1px solid var(--border); font-size: 0.9rem; }
.h-estado.error { background: var(--accent-tint); color: var(--text); }
.h-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 14px; }
.h-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.h-kpi b { display: block; font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.h-kpi span { color: var(--text-muted); font-size: 0.82rem; }
.pos { color: var(--ok-text, #1F6B4E); } .neg { color: var(--accent-text); } .org { color: var(--primary); }
html[data-theme="dark"] .pos { color: #7FD3AE; }
.h-notice { background: var(--primary-tint); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; font-size: 0.9rem; margin: 0 0 4px; }
.h-tabla th, .h-tabla td { vertical-align: top; }
.h-tabla td.mono, .mono { font-variant-numeric: tabular-nums; font-weight: 600; }
.h-tabla tbody tr[tabindex] { cursor: pointer; }
.h-tabla tbody tr[tabindex]:hover { background: var(--primary-tint); }
.h-tabla tbody tr[tabindex]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ch { display: block; margin: 0 0 4px; font-size: 0.86rem; }
.ch s { color: var(--text-muted); }
.pill-org { background: var(--primary-tint); color: var(--primary); }
.pill-baja { background: var(--accent-tint); color: var(--accent-text); }
.h-tabla.hist th[scope="row"] { width: 26%; font-weight: 600; background: var(--surface-2); }
.h-tabla.hist td.chg { background: var(--accent-tint); font-weight: 600; }
.small { font-size: 0.82rem; }
.h-export { display: flex; justify-content: flex-end; margin: 12px 0 0; }
.h-evo { margin: 18px 0 0; }
.h-evo h2 { font-family: var(--serif); font-size: 1.05rem; margin: 0 0 8px; }
.h-nota { margin: 30px 0 0; font-size: 0.88rem; color: var(--text-muted); max-width: 820px; }
.h-nota h2 { font-family: var(--serif); font-size: 1rem; color: var(--text); margin: 0 0 8px; }
.h-nota li { margin: 0 0 6px; }
#hLista:focus { outline: none; }
#hModal .modal { max-width: 920px; width: calc(100% - 24px); }
@media (max-width: 760px) { .h-top { flex-direction: column; align-items: stretch; } .seg { display: flex; } .seg button { flex: 1; padding: 9px 8px; } .h-vista { width: 100%; } .h-vista button { flex: 1; padding: 10px 6px; } }
/* Tabla de evolución de un puesto: se ajusta al ancho para ver todas las RPT sin desplazarse en horizontal */
.h-tabla.hist { min-width: 0; width: 100%; }
.h-tabla.hist td { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  /* En pantallas estrechas cada dato se apila: su nombre y, debajo, el valor en cada RPT */
  .h-tabla.hist, .h-tabla.hist tbody, .h-tabla.hist tr, .h-tabla.hist th, .h-tabla.hist td { display: block; width: 100%; }
  .h-tabla.hist thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .h-tabla.hist tr { border-bottom: 1px solid var(--border); padding: 8px 0; }
  .h-tabla.hist th[scope="row"] { width: 100%; background: none; padding: 2px 8px; font-size: 0.8rem; color: var(--text-muted); border: 0; }
  .h-tabla.hist td { padding: 3px 8px; border: 0; font-size: 0.88rem; }
  .h-tabla.hist td::before { content: attr(data-v) ": "; font-weight: 600; color: var(--text-muted); }
  .h-tabla.hist td.chg { border-radius: 6px; }
  #hModal .modal-body { padding-left: 10px; padding-right: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
