/* Contratación (Phoca Download) — sistema de diseño V8 / Transparencia.dc.html.
   Usa los tokens de tpl_emser2026 (tokens.css). Lo cargan los overrides tpl_emser2026/html/com_phocadownload/**. */

.em-ct { --ct-mod: var(--em-brand); }
.em-ct-head__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.em-ct-intro > :first-child { margin-top: 0; } .em-ct-intro > :last-child { margin-bottom: 0; } /* descripción de la vigencia (Phoca), 8-oct-2026 */
.em-ct .em-btn__note { color: inherit; font-weight: 600; }
.em-ct .em-btn--white { box-shadow: var(--em-shadow-xs); }

/* ---------- búsqueda global */
.em-ct-search { background: #fff; border-radius: var(--em-radius-l); box-shadow: var(--em-shadow); padding: 18px 20px; margin: 0 0 28px; }
.em-ct-search__row { display: flex; gap: 10px; flex-wrap: wrap; }
.em-ct-search__row .em-input { flex: 1 1 260px; min-width: 0; }
.em-ct-results { margin: 0 0 28px; }

/* ---------- vigencias (tarjetas) */
.em-ct-years { margin: 0 0 28px; }
.em-ct-years .em-h2 { margin-bottom: 14px; }
.em-ct-years__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.em-ct-year {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
  background: var(--em-dark); color: #fff; text-decoration: none;
  border-radius: var(--em-radius-l); padding: 18px 20px; box-shadow: var(--em-shadow);
  transition: transform .18s ease, background .18s ease;
}
.em-ct-year:hover { background: var(--em-brand); color: #fff; transform: translateY(-2px); }
.em-ct-year:focus-visible { outline: 3px solid var(--em-focus); outline-offset: 3px; }
.em-ct-year__num { font-family: var(--em-font-display); font-size: 2.25rem; font-weight: 700; line-height: 1; }
.em-ct-year__meta { font-size: var(--em-fs-sm); font-weight: 700; color: #d6efe2; }
.em-ct-year__upd { font-size: var(--em-fs-xs); color: #c4e0d2; }

/* ---------- filtros */
.em-ct-filters {
  background: #fff; border-radius: var(--em-radius-l); box-shadow: var(--em-shadow);
  padding: 20px 22px; margin: 0 0 20px; display: flex; flex-direction: column; gap: 16px;
}
.em-ct-filters__years ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.em-ct-pill {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 64px; padding: 0 14px;
  border-radius: 12px; background: var(--em-soft); color: var(--em-ink); font-weight: 800; text-decoration: none;
}
.em-ct-pill:hover { background: #d8f0e3; color: var(--em-ink); }
.em-ct-pill.is-active, .em-ct-pill[aria-current="page"] { background: #7a4a06; color: #fff; }
.em-ct-filters__grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); align-items: start; }
.em-ct-fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.em-ct-fs legend { padding: 0; }
.em-ct-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.em-ct-chip { position: relative; display: inline-flex; cursor: pointer; }
.em-ct-chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.em-ct-chip > span {
  display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 6px 12px;
  border-radius: var(--em-pill); background: var(--em-soft); color: var(--em-ink); font-size: var(--em-fs-sm); font-weight: 700;
  border: 2px solid transparent;
}
.em-ct-chip input:checked + span { background: var(--em-dark); color: #fff; }
.em-ct-chip input:focus-visible + span { outline: 3px solid var(--em-focus); outline-offset: 2px; }
.em-ct-chip:hover > span { border-color: rgba(18, 41, 31, .25); }
.em-ct-chip__n { font-weight: 600; }
.em-ct-filters__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
/* búsqueda de la vigencia: ancho completo (el texto de ayuda no se corta) */
.em-ct-fs--q .em-input { width: 100%; }
.em-ct-hint { margin: 6px 0 0; font-size: var(--em-fs-xs); color: var(--em-ink-3); }
/* filtros plegables: en móvil se pliegan (details nativo, sin JS); en escritorio siempre visibles */
.em-ct-more { margin: 0; }
.em-ct-more__sum {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; cursor: pointer;
  border-radius: 12px; background: var(--em-soft); color: var(--em-ink); font-weight: 800; list-style: none;
}
.em-ct-more__sum::-webkit-details-marker { display: none; }
.em-ct-more__sum::after { content: ""; margin-left: auto; width: 10px; height: 10px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .15s; }
.em-ct-more[open] > .em-ct-more__sum::after { transform: rotate(-135deg); }
.em-ct-more__sum:focus-visible { outline: 3px solid var(--em-focus); outline-offset: 2px; }
.em-ct-more__n { font-weight: 600; color: var(--em-ink-3); }
.em-ct-more[open] > .em-ct-filters__grid { margin-top: 14px; }
@media (min-width: 48em) {
  .em-ct-more > .em-ct-more__sum { display: none; }
  .em-ct-more::details-content { content-visibility: visible; display: contents; }
  .em-ct-more > .em-ct-filters__grid { margin-top: 0; }
}

/* ---------- lista de procesos */
.em-ct-count { margin: 0 0 12px; font-size: var(--em-fs-sm); font-weight: 700; color: var(--em-ink-3); }
.em-ct-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.em-ct-item {
  display: flex; gap: 14px 18px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: #fff; border-radius: var(--em-radius); box-shadow: var(--em-shadow-xs);
  padding: 16px 18px; border-left: 4px solid var(--ct-mod);
}
.em-ct-item--minima { --ct-mod: #0a6b78; }
.em-ct-item--directa { --ct-mod: #04693c; }
.em-ct-item--abierta { --ct-mod: #b4530a; }
.em-ct-item--privada { --ct-mod: #7a4a06; }
.em-ct-item--menor { --ct-mod: #5b4bb0; }
.em-ct-item--convenio, .em-ct-item--subasta, .em-ct-item--convocatoria { --ct-mod: #a1314f; }
.em-ct-item--otra { --ct-mod: #5c7065; }
.em-ct-item__body { flex: 1 1 420px; min-width: 0; }
.em-ct-item__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.em-ct-badge {
  display: inline-flex; align-items: center; gap: 6px; border-radius: var(--em-pill); padding: 3px 10px;
  font-size: var(--em-fs-xxs); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; line-height: 1.4;
  background: var(--em-soft); color: var(--em-ink);
}
.em-ct-badge--mod::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ct-mod); }
.em-ct-badge--adjudicado, .em-ct-badge--celebrado, .em-ct-badge--terminado, .em-ct-badge--liquidado { background: #e3f4ea; color: #03532f; }
.em-ct-badge--en_curso, .em-ct-badge--en_ejecucion { background: #e2f3f6; color: #0a5c68; }
.em-ct-badge--desierto, .em-ct-badge--revocado, .em-ct-badge--cancelado, .em-ct-badge--suspendido { background: #fbe9e7; color: #8f2a1a; }
.em-ct-item__title { margin: 0; font-size: 1.0625rem; line-height: 1.35; font-weight: 800; }
.em-ct-item__title a { color: var(--em-ink); text-decoration: none; }
.em-ct-item__title a:hover { color: var(--em-brand); text-decoration: underline; }
.em-ct-item__meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 2px 0; font-size: var(--em-fs-s); color: var(--em-muted); }
.em-ct-item__meta > span + span::before { content: "·"; margin: 0 7px; }
.em-ct-item__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.em-ct-pag { margin-top: 20px; }

/* ---------- ficha del proceso */
.em-ct-proc__title { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); }
.em-ct-proc__obj { max-width: 72ch; font-size: var(--em-fs-base); }
.em-ct-head .em-ct-item__tags { margin-top: 14px; }
.em-ct-sec { margin: 0 0 28px; }
.em-ct-sec > .em-h2 { margin-bottom: 14px; }
.em-ct-ficha { background: #fff; box-shadow: var(--em-shadow-xs); }
.em-ct-ficha dd { overflow-wrap: anywhere; }
.em-ct-sub { margin: 18px 0 10px; font-size: var(--em-fs-sm); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--em-ink-3); }
.em-ct-docs { margin-bottom: 6px; }
.em-ct-doc { flex-wrap: wrap; scroll-margin-top: 120px; }
.em-ct-doc:target, .em-ct-doc:focus { outline: 3px solid var(--em-focus); outline-offset: 2px; }
.em-ct-doc .em-doclist__body { flex: 1 1 260px; min-width: 0; }
.em-ct-doc .em-doclist__title { margin: 0; font-weight: 800; color: var(--em-ink); overflow-wrap: anywhere; }
.em-ct-doc .em-doclist__meta { margin: 3px 0 0; font-size: var(--em-fs-s); color: var(--em-muted); }
.em-ct-doc__fmt {
  flex: none; width: 48px; height: 48px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  font-size: .6875rem; font-weight: 900; letter-spacing: .04em; background: #fbe9e7; color: #8f2a1a;
}
.em-ct-doc__fmt--docx, .em-ct-doc__fmt--doc, .em-ct-doc__fmt--odt { background: #e4ecfb; color: #1d4690; }
.em-ct-doc__fmt--xlsx, .em-ct-doc__fmt--xls, .em-ct-doc__fmt--ods { background: #e3f4ea; color: #03532f; }
.em-ct-doc__fmt--jpg, .em-ct-doc__fmt--jpeg, .em-ct-doc__fmt--png, .em-ct-doc__fmt--gif { background: #f3eefc; color: #5b3aa0; }
.em-ct-proc__foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 8px; }

/* ---------- notas y llamado */
.em-ct-note { margin: 24px 0; padding: 14px 18px; border-radius: var(--em-radius); background: var(--em-soft); color: var(--em-ink-3); font-size: var(--em-fs-sm); }
.em-ct-note p { margin: 0; max-width: 90ch; }
.em-ct-cta { background: #fff; border-radius: var(--em-radius-l); box-shadow: var(--em-shadow-xs); padding: 20px 22px; }
.em-ct-cta p { color: var(--em-ink-3); }

[data-em-ct-results][aria-busy="true"] { opacity: .55; transition: opacity .15s; }

@media (max-width: 640px) {
  .em-ct-filters, .em-ct-search { padding: 16px; border-radius: var(--em-radius); }
  .em-ct-item { padding: 14px; }
  .em-ct-item__actions, .em-ct-item__actions .em-btn { width: 100%; }
  .em-ct-doc__dl { width: 100%; }
  .em-ct-pill { min-width: 56px; }
  /* vigencias en una sola fila desplazable (eran ~220 px de botones antes de los resultados) */
  .em-ct-filters__years ul { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .em-ct-filters__years li { flex: 0 0 auto; scroll-snap-align: start; }
  .em-ct-hint { display: none; }
  .em-ct-js .em-ct-filters__actions > .em-btn--primary { display: none; }
  .em-ct-js .em-ct-filters__actions:not(:has(> :not(.em-btn--primary))) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .em-ct-year { transition: none; }
  .em-ct-year:hover { transform: none; }
}
@media print {
  .em-ct-filters, .em-ct-search, .em-ct-item__actions, .em-ct-proc__foot, .em-ct-cta { display: none; }
  .em-ct-item, .em-ct-ficha { box-shadow: none; border: 1px solid #999; }
}

/* ---------- modo Alto contraste (panel de accesibilidad: html[data-em-contrast=high]).
   a11y.css pinta todo enlace de main en #00341d: aquí las tarjetas de vigencia y el año activo
   son enlaces sobre fondo oscuro, así que se fuerzan a blanco sobre negro (21:1). #em-x sube la especificidad. */
html[data-em-contrast="high"] main a.em-ct-year:not(#em-x),
html[data-em-contrast="high"] main a.em-ct-year:not(#em-x):hover { background: #000 !important; color: #fff !important; text-decoration: none !important; outline: 2px solid #fff; outline-offset: -4px; }
html[data-em-contrast="high"] main a.em-ct-year:not(#em-x) :is(span, strong, small) { color: #fff !important; }
html[data-em-contrast="high"] main a.em-ct-pill:is(.is-active, [aria-current="page"]):not(#em-x) { background: #000 !important; color: #fff !important; text-decoration: none !important; }
html[data-em-contrast="high"] main a.em-ct-pill:not(.is-active):not([aria-current="page"]):not(#em-x) { background: #fff !important; color: #000 !important; outline: 2px solid #000; outline-offset: -2px; }
