/* CV AGH — estilos propios de la web. Los tokens y componentes .agh-* vienen del design system. */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font-family: var(--font-body); }
a { color: var(--link); }
a:hover { color: var(--red-press); }
a.agh-btn { text-decoration: none; }
h1, h2, h3 { text-wrap: balance; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Barra superior */
.barra { background: var(--surface); border-bottom: 1px solid var(--line); }
.barra-in { max-width: 1320px; margin: 0 auto; padding: 0 24px; min-height: 72px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.barra-marca { display: flex; align-items: center; border-radius: var(--radius-sm); padding: 4px 6px; margin-left: -6px; transition: background-color .15s; }
.barra-marca:hover { background: var(--beige); }
.barra-marca img { height: 48px; width: auto; display: block; }
.barra-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.barra-nav .agh-btn:not([aria-current]) { border-color: transparent; }
.barra-usuario { width: 36px; height: 36px; border-radius: 104px; background: var(--beige); color: var(--ink); display: grid; place-items: center; font-size: 13px; font-weight: 600; }

/* Contenedor */
.app { max-width: 1320px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 28px; outline: none; }
.app-estrecha { max-width: 1180px; }
.cabecera { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.cabecera h1 { margin: 0; color: var(--ink); }
.cabecera p { margin: 0; font-size: 17px; line-height: 28px; }
.fila { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.col { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.col-estrecha { flex: 1 1 380px; }
.col-ancha { flex: 999 1 560px; }
.pie-acciones { border-top: 1px solid var(--line); padding-top: 24px; display: flex; justify-content: flex-end; align-items: center; gap: 16px; flex-wrap: wrap; }
.ayuda { font-size: 14px; color: var(--text-muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.panel-beige { background: var(--beige); border-color: transparent; }
.lista-vacantes { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; padding: 2px; }
.agh-vacancy { text-align: left; font: inherit; color: inherit; width: 100%; }
.descripcion { white-space: pre-line; font-size: 15px; line-height: 25px; max-height: 360px; overflow: auto; }
.segmentado { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 104px; padding: 3px; width: fit-content; }
.segmentado button { font: inherit; font-size: 14px; font-weight: 600; height: 34px; padding: 0 16px; border: 0; border-radius: 104px; cursor: pointer; background: transparent; color: var(--ink); }
.segmentado button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.esqueleto { height: 64px; border-radius: var(--radius-sm); background: var(--beige); animation: latido 1.4s ease-in-out infinite; }
@keyframes latido { 50% { opacity: .5; } }

/* Login */
.login { max-width: 440px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 24px; }
.login img { height: 64px; width: auto; align-self: flex-start; }
.login form { display: flex; flex-direction: column; gap: 16px; }

/* Procesando */
.carga { display: flex; flex-wrap: wrap; gap: 56px; align-items: center; }
.carga-marca { flex: 0 1 300px; min-height: 300px; display: grid; place-items: center; background: var(--beige); border-radius: var(--radius-md); }
.respira { animation: respira 2.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes respira { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.86); opacity: .55; } }
.gira { animation: gira 1.1s linear infinite; transform-origin: center; transform-box: fill-box; }
@keyframes gira { to { transform: rotate(360deg); } }
.fases { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.fase { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.fase + .fase { border-top: 1px solid var(--line); }
.fase-actual { background: var(--red-soft); }
.fase-nombre { font-weight: 600; color: var(--ink); }
.fase-pendiente .fase-nombre { color: var(--text-muted); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.chips .agh-file { padding: 8px 14px; }
@media (prefers-reduced-motion: reduce) { .respira, .gira, .esqueleto { animation: none; } }

/* Revisión */
.revision { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.revision-izq { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.revision-der { flex: 1 1 500px; min-width: 0; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.requisitos { display: flex; flex-wrap: wrap; gap: 24px; }
.requisitos > div { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.requisitos ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 22px; }
.requisitos li { display: flex; gap: 10px; }
.requisitos li svg { flex: none; margin-top: 1px; }
.progreso { height: 6px; border-radius: 104px; background: var(--beige); overflow: hidden; }
.progreso span { display: block; height: 100%; background: var(--red); transition: width .2s; }
.controles-cambios { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtros button { font: inherit; font-size: 13px; font-weight: 600; height: 32px; padding: 0 14px; border-radius: 104px; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); }
.filtros button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.grupo-cambios { display: flex; flex-direction: column; gap: 12px; }
.agh-change { cursor: default; }
.agh-change.foco { outline: 2px solid var(--focus); outline-offset: 2px; }
.agh-change-col p { white-space: pre-line; }
.agh-btn[aria-pressed="true"]:not(.agh-btn-primary) { background: var(--ink); color: var(--paper); }
.pie-fijo { position: sticky; bottom: 0; z-index: 2; background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-overlay); margin: 0 -24px -64px; }
.pie-fijo-in { padding: 14px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.aviso-pendientes { margin-left: auto; font-size: 14px; color: var(--warning); font-weight: 600; }

/* Vista previa del Word */

/* Descargar */
.resumen-lista { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.resumen-lista li { display: flex; justify-content: space-between; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.resumen-lista li + li { border-top: 1px solid var(--line); }
.resumen-lista strong { color: var(--ink); }

/* Historial */
.filtros-historial { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filtros-historial > * { flex: 1 1 200px; }
.tabla-caja { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.tabla { border-collapse: collapse; width: 100%; min-width: 900px; font-size: 14px; }
.tabla th { text-align: left; padding: 14px 16px; color: var(--text-muted); }
.tabla td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.tabla td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.tabla .acciones { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.vacio { background: var(--beige); border-radius: var(--radius-md); padding: 48px 32px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }

/* Aviso emergente */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: var(--radius-sm); box-shadow: var(--shadow-overlay); font-size: 14px; z-index: 10; max-width: calc(100vw - 32px); }

@media (max-width: 640px) {
  .app { padding: 24px 16px 48px; }
  .barra-in { padding: 0 16px; }
  .agh-change-cols { grid-template-columns: 1fr; }
  .pie-fijo { margin: 0 -16px -48px; }
}

/* Interlineado más holgado que el de los componentes base del design system. */
body { line-height: 1.65; }
.agh-change-col p { line-height: 23px; }
.agh-change-why { line-height: 21px; }
.agh-notice { line-height: 22px; }
textarea.agh-field { line-height: 24px; }
.agh-field-help { line-height: 20px; }
.agh-vacancy-meta { line-height: 20px; }
.tabla td { line-height: 22px; }
.resumen-lista li { line-height: 22px; }

/* ---------- Revisión: estado de cada tarjeta ---------- */
.agh-change { border-left-width: 4px; }
.agh-change-accepted { border-left-color: var(--accepted); }
.agh-change-rejected { border-left-color: var(--line-strong); }
.agh-change:has(.agh-badge-edited) { border-left-color: var(--edited); }
.agh-change:has(.agh-badge-pending) { border-left-color: var(--warning); }
.agh-change.foco { outline: 0; box-shadow: 0 0 0 2px var(--line-strong); }
.agh-change:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.agh-change-actions [data-accion="accepted"][aria-pressed="true"] { background: var(--accepted); border-color: var(--accepted); color: var(--surface); }
.agh-change-actions [data-accion="rejected"][aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.agh-change-why { border-top: 0; padding-top: 0; }
.lista-cambio { margin: 4px 0 0; padding-left: 18px; font-size: 14px; line-height: 22px; display: flex; flex-direction: column; gap: 4px; }
.chips-cambio { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.chip { display: inline-block; font-size: 13px; line-height: 22px; padding: 0 8px; border-radius: var(--radius-sm); background: var(--paper); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
ins.chip { background: var(--diff-add); border-color: var(--accepted); text-decoration: underline; text-underline-offset: 3px; }
del.chip { background: var(--diff-del); color: var(--text-muted); }
.agh-score-compacto { padding: 16px 20px; }
.agh-score-compacto .agh-score-num { font-size: 40px; }
.plegable { padding: 0; gap: 0; }
.plegable > summary { cursor: pointer; padding: 16px 20px; color: var(--ink); list-style-position: inside; }
.plegable > summary:hover { background: var(--paper); }
.plegable > .requisitos { padding: 4px 20px 20px; }
.doc-cambio { outline: 1px dashed transparent; outline-offset: 1px; transition: outline-color .15s, background-color .15s; }
.doc-cambio:hover { outline-color: var(--line-strong); }
#error-revision:empty { display: none; }

/* Aviso emergente con acción */
.toast { display: flex; align-items: center; gap: 16px; }
.toast-accion { font: inherit; font-weight: 600; background: transparent; border: 0; color: var(--paper); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 4px; }

/* ---------- Pantallas medianas y móvil ---------- */
@media (max-width: 1100px) {
  .revision-der { position: static; order: -1; }
  .agh-doc { max-height: 70vh; }
}
@media (max-width: 640px) {
  .agh-doc { padding: 8px; }
  .pie-fijo-in a[href="#/historial"] { display: none; }
  .aviso-pendientes { order: -1; flex-basis: 100%; margin: 0; }
  .display-l { font-size: 28px; }
  .display-xl { font-size: 36px; }
}

/* Zonas táctiles de 44 px en pantallas táctiles */
@media (pointer: coarse) {
  .agh-btn-sm, .filtros button, .segmentado button { height: 44px; }
  .barra-usuario { width: 44px; height: 44px; }
}

/* Tachado de lo propuesto cuando se mantiene el original (funciones y listas). */
.agh-change-rejected .agh-change-col-new :is(li, .chip) { text-decoration: line-through; color: var(--text-muted); }

/* ---------- Vista previa del Word: hoja A4 a escala de la plantilla AGH ----------
   Las medidas en cqw son relativas al ancho de texto de la hoja (425 pt en el Word):
   11 pt = 2,588cqw · 14 pt = 3,294cqw · 22 pt = 5,176cqw · margen lateral de 85 pt = 20cqw. */
.agh-doc { max-width: none; max-height: calc(100vh - 160px); overflow: auto; padding: 14px; background: var(--rejected-soft); border: 1px solid var(--line); box-shadow: none; font-family: var(--font-doc); }
.doc-hoja { container-type: inline-size; background: var(--doc-paper); color: var(--doc-ink); box-shadow: 0 1px 3px rgba(0,0,0,.18); padding: 0 14.3% 9%; border-top: 4px solid var(--doc-red); line-height: 1.15; text-align: justify; }
.doc-hoja > * { font-size: 2.588cqw; }
.doc-hoja p { margin: 0; }
.doc-cab { display: flex; justify-content: flex-end; padding: 9.2cqw 0 7cqw; margin-right: -6.4cqw; }
.doc-cab img { height: 11.25cqw; width: auto; display: block; }
.doc-hoja .doc-nombre { font-size: 5.176cqw; font-weight: 700; color: var(--doc-red); margin-left: -4.94cqw; line-height: 1.2; text-align: left; }
.doc-hoja .doc-cargo { font-size: 3.294cqw; font-weight: 700; margin-left: -4.94cqw; line-height: 1.3; text-align: left; }
.doc-hoja .doc-perfil { margin-top: 1.8em; }
.doc-hoja .doc-sec { font-size: 3.294cqw; display: grid; grid-template-columns: 20cqw 38.8cqw 1fr; align-items: start; margin: 1.9em -20cqw 1.4em; text-align: left; }
.doc-sec-titulo { font-weight: 700; line-height: 1.25; padding: 0 2cqw 0 .3em; }
.doc-sec-linea { height: max(1.5px, .47cqw); background: var(--doc-red); margin-top: .62em; }
.doc-sec-linea:first-child { margin-left: 2.1cqw; margin-right: .5em; }
.doc-sec-linea:last-child { margin-right: 1.1cqw; }
.doc-hoja .doc-negrita { font-weight: 700; margin-top: 1em; margin-bottom: .6em; }
.doc-hoja ul { list-style: none; margin: 0; padding: 0; }
.doc-guion > li, .doc-check > li, .doc-aster > li { position: relative; padding-left: 2.1em; }
.doc-guion > li::before { content: "-"; position: absolute; left: .4em; }
.doc-check > li::before { content: "✓"; position: absolute; left: .3em; }
.doc-check > li { margin-bottom: .45em; }
.doc-aster > li::before { content: "∗"; position: absolute; left: .3em; }
.doc-hoja .doc-aster { margin: 1em 0 0 1.6em; }
.doc-aster > li > .doc-guion { margin: .9em 0 .2em 2.1em; }
.doc-hoja .doc-col3 { columns: 3; column-gap: 2em; padding-left: 2.5em; text-align: left; }
.doc-col3 > li { break-inside: avoid; }
.doc-hoja .doc-idioma { margin-top: 1.6em; margin-bottom: .4em; }
.doc-idioma span { color: #595959; }
.doc-nivel { display: grid; grid-template-columns: repeat(3, 1fr); width: 85%; margin-left: 15%; border: 1px solid var(--doc-red); font-family: Tahoma, Verdana, sans-serif; font-weight: 700; text-align: center; }
.doc-nivel span { font-size: .73em; padding: .25em 0; color: var(--doc-red); background: var(--doc-paper); }
.doc-nivel span + span { border-left: 1px solid var(--doc-red); }
.doc-nivel span.on { background: var(--doc-red); color: #fff; }
.doc-puesto { margin-top: 1.8em; }
.doc-puesto-cab { display: grid; grid-template-columns: 51.8% 1fr; text-align: left; }
.doc-hoja .doc-cambio { cursor: pointer; border-radius: 2px; }

/* Varios archivos del candidato */
.lista-archivos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lista-archivos .agh-file { padding: 10px 14px; }
.agh-drop-compacta { padding: 14px 16px; gap: 6px; }

/* Vista previa "Original": el archivo tal como se subió. */
.archivos-orig { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.doc-archivo { display: block; width: 100%; height: calc(100vh - 220px); min-height: 520px; border: 0; background: var(--doc-paper); }
.doc-archivo-enlace { display: block; cursor: zoom-in; }
.doc-archivo-img { display: block; width: 100%; height: auto; background: var(--doc-paper); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.doc-texto { margin: 0; padding: 28px 32px; white-space: pre-wrap; overflow-wrap: anywhere; text-align: left; background: var(--doc-paper); color: var(--doc-ink); box-shadow: 0 1px 3px rgba(0,0,0,.18); font-family: var(--font-body); font-size: 14px; line-height: 1.6; }
