/* Pulse · sección «Actividad» (todo con prefijo act- para no chocar con el resto) */
main:has(.actividad) { max-width: 1240px; }
.actividad { --act-gris: #e2e7ec; --act-rejilla: #e9edf1; --act-pend: #d9902b; --act-pend-texto: #8a5600; --act-pend-fondo: #fff6e6; }
.act-oculto { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Cabecera */
.act-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.act-cab h1 { margin: 0; }
.act-sub { margin: 2px 0 0; }
.act-descargas { display: flex; align-items: center; gap: 6px; }
.act-descargas button { width: auto; min-width: 64px; }
.act-impresion { display: none; }

/* Filtros */
.act-filtros { padding: 12px 14px; }
.act-presets { margin-bottom: 10px; }
.act-fila { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.act-campo { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 13px; font-weight: 600; color: var(--texto-suave); position: relative; }
.act-campo input, .act-campo select { min-height: 40px; padding: 6px 10px; font-size: 15px; color: var(--texto); font-weight: 400; }
.act-fecha input { width: 150px; }
.act-ancho select { min-width: 220px; max-width: 320px; }
.act-etq { font-size: 13px; font-weight: 600; color: var(--texto-suave); }
.act-segmentado { display: inline-flex; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.act-segmentado button { border: 0; border-radius: 0; min-height: 40px; padding: 6px 14px; font-size: 14px; background: #fff; }
.act-segmentado button + button { border-left: 1px solid var(--borde); }
.act-segmentado button[aria-checked="true"] { background: var(--azul); color: #fff; font-weight: 600; }
.act-casilla { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; font-size: 14px; color: var(--texto); cursor: pointer; }
.act-casilla input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--azul); }
.act-campo-casilla { min-height: 40px; }

/* Selector de personas */
.act-personas { position: relative; }
.act-personas summary { list-style: none; cursor: pointer; min-height: 40px; display: flex; align-items: center; padding: 6px 34px 6px 10px; border: 1px solid var(--borde); border-radius: 8px; background: #fff; color: var(--texto); font-weight: 400; font-size: 15px; min-width: 190px; position: relative; }
.act-personas summary::-webkit-details-marker { display: none; }
.act-personas summary::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--texto-suave); border-bottom: 2px solid var(--texto-suave); transform: translateY(-70%) rotate(45deg); }
.act-personas summary:focus-visible { outline: 3px solid #7fb3d5; outline-offset: 2px; }
.act-personas-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: 280px; max-height: 60vh; overflow: auto; background: #fff; border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 30, 50, .16); padding: 10px; }
.act-personas-menu fieldset { border: 0; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.act-personas-menu .act-casilla { padding: 6px 4px; border-radius: 6px; }
.act-personas-menu .act-casilla:hover { background: var(--fondo); }
.act-personas-atajos { display: flex; gap: 6px; }
.act-personas-atajos button { flex: 1; }
#act-per-aplicar { width: 100%; }

/* KPIs */
.act-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.act-kpi { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-kpi-t { font-size: 13px; font-weight: 600; color: var(--texto-suave); }
.act-kpi b { font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.25; }
.act-kpi-s { font-size: 12.5px; color: var(--texto-suave); }
.act-kpi-pend { background: var(--act-pend-fondo); border-color: #f0c47a; box-shadow: inset 4px 0 0 var(--act-pend); }
.act-kpi-pend b, .act-kpi-pend .act-kpi-t { color: var(--act-pend-texto); }
.act-kpi-pend a { color: var(--act-pend-texto); font-weight: 600; }

/* Bloques */
.act-bloque { padding: 16px; }
.act-bloque-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.act-bloque-cab h2 { margin: 0; }
.act-bloque-cab .nota { margin: 0; }
.act-vacio { text-align: center; padding: 28px 12px; }
.act-vacio p { margin: 4px 0; }
#act-cuerpo.act-recargando { opacity: .55; transition: opacity .15s; pointer-events: none; }
.act-hueso { background: linear-gradient(90deg, #eef2f5 0%, #f7f9fa 50%, #eef2f5 100%); background-size: 200% 100%; animation: act-brillo 1.2s linear infinite; border-color: #eef2f5; min-height: 78px; }
.act-hueso-graf { min-height: 300px; }
@keyframes act-brillo { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .act-hueso { animation: none; } #act-cuerpo.act-recargando { transition: none; } }

/* Leyenda */
.act-leyenda { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.act-ley { width: auto; min-height: 32px; padding: 4px 10px; border-radius: 999px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; background: #fff; }
.act-ley small { color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.act-ley[aria-pressed="false"] { color: var(--texto-suave); background: var(--fondo); border-style: dashed; }
.act-ley[aria-pressed="false"] span { text-decoration: line-through; }
.act-ley[aria-pressed="false"] .act-muestra { opacity: .3; }
.act-ley-todo { color: var(--azul); border-color: transparent; text-decoration: underline; }
.act-muestra { display: inline-block; flex: none; width: 11px; height: 11px; border-radius: 3px; background: var(--c); }
.act-rayas { background: repeating-linear-gradient(135deg, var(--act-pend, #d9902b) 0 3px, #f6dcb0 3px 6px) !important; }

/* Barras */
.act-barras { position: relative; }
.act-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
.act-svg { display: block; font: 11px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.act-rejilla { stroke: var(--act-rejilla); stroke-width: 1; }
.act-base { stroke: #b9c4cd; stroke-width: 1; }
.act-eje { fill: var(--texto-suave); font-size: 11px; font-variant-numeric: tabular-nums; }
.act-eje-suave { fill: #8c99a4; font-size: 10px; }
.act-eje-hoy { fill: var(--azul); font-weight: 700; }
.act-col { cursor: pointer; outline: none; }
.act-col-fondo { fill: transparent; }
.act-finde .act-col-fondo { fill: #f6f8fa; }
.act-col:hover .act-col-fondo, .act-col:focus-visible .act-col-fondo { fill: #edf2ff; }
.act-col:focus-visible .act-col-fondo { stroke: #7fb3d5; stroke-width: 2; }

/* Reparto: donut + tabla */
.act-reparto { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.act-donut { display: flex; justify-content: center; padding-top: 6px; }
.act-donut svg { max-width: 100%; height: auto; }
.act-donut-v { font-size: 22px; font-weight: 700; fill: var(--texto); font-variant-numeric: tabular-nums; }
.act-donut-s { font-size: 12px; fill: var(--texto-suave); }
.act-buscar input { min-height: 38px; padding: 6px 10px; width: 220px; font-size: 14px; }
.act-tabla { overflow-x: auto; }
.act-t { width: 100%; font-size: 14px; }
.act-t th, .act-t td { padding: 7px 6px; vertical-align: middle; }
.act-t thead th { font-size: 13px; }
.act-t tfoot th, .act-t tfoot td { border-bottom: 0; border-top: 2px solid var(--borde); font-weight: 700; color: var(--texto); }
.act-num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.act-orden { border: 0; background: none; padding: 0; min-height: 0; font: inherit; color: inherit; font-weight: 600; cursor: pointer; }
th.act-num .act-orden { text-align: right; }
.act-orden:hover { color: var(--texto); }
.act-nombre { display: flex; align-items: flex-start; gap: 8px; }
.act-nombre .act-muestra { margin-top: 5px; }
.act-nombre small { display: block; color: var(--texto-suave); font-size: 12.5px; }
.act-fila-btn { border: 0; background: none; padding: 0; min-height: 0; text-align: left; font: inherit; color: var(--texto); cursor: pointer; }
.act-fila-btn:hover { color: var(--azul); text-decoration: underline; }
.act-col-barra { width: 28%; min-width: 90px; }
.act-barrita { display: block; height: 8px; border-radius: 4px; background: #eef2f5; overflow: hidden; }
.act-barrita > span { display: block; height: 100%; background: var(--c); border-radius: 4px; }
.act-tr-pend td { color: var(--act-pend-texto); font-weight: 600; }

/* Calendario */
.act-mesnav { display: flex; align-items: center; gap: 8px; }
.act-mesnav button { width: 40px; min-height: 36px; padding: 0; font-size: 20px; line-height: 1; }
#act-cal-mes { min-width: 150px; text-align: center; font-weight: 600; }
.act-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.act-cal-sem { font-size: 12px; font-weight: 600; color: var(--texto-suave); padding: 2px 6px; }
.act-corto { display: none; }
.act-dia { min-height: 104px; border: 1px solid var(--borde); border-radius: 8px; padding: 6px; background: #fff; display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--texto); min-width: 0; }
button.act-dia { cursor: pointer; }
button.act-dia:hover { border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul); }
.act-fuera { background: transparent; border-style: dashed; opacity: .45; }
.act-norango { background: var(--fondo); }
.act-dia-hoy { border-color: var(--azul); }
.act-dia-hoy .act-dia-n { background: var(--azul); color: #fff; border-radius: 999px; padding: 0 6px; }
.act-dia-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.act-dia-n { font-weight: 700; font-size: 13px; }
.act-dia-j { font-size: 12px; color: var(--texto-suave); font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-dia-mini { display: flex; height: 4px; border-radius: 2px; overflow: hidden; gap: 1px; background: #fff; }
.act-dia-mini > span { background: var(--c); }
.act-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.act-chip { display: flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 1.3; padding: 1px 6px 1px 0; border-radius: 4px; background: #f3f5f8; box-shadow: inset 3px 0 0 var(--c); padding-left: 7px; min-width: 0; }
.act-chip-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-chip-h { color: var(--texto-suave); font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-chip-pend { background: var(--act-pend-fondo); color: var(--act-pend-texto); font-weight: 600; }
.act-chip-mas { font-size: 11px; color: var(--texto-suave); padding-left: 2px; }

/* Línea de tiempo (Gantt) */
.act-g-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.act-g { --etq: 168px; min-width: 760px; position: relative; }
.act-g-fila { display: grid; grid-template-columns: var(--etq) minmax(0, 1fr); align-items: center; min-height: 40px; border-bottom: 1px solid var(--act-rejilla); }
.act-g-etq { position: sticky; left: 0; z-index: 2; background: #fff; padding: 4px 10px 4px 0; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.act-g-etq > span { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-g-etq small { font-size: 12px; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.act-pend-txt { color: var(--act-pend-texto); font-weight: 600; }
.act-g-aviso { margin: 0 0 8px; font-size: 14px; }
.act-g-pista { position: relative; height: 22px; border-radius: 4px;
  background-image: repeating-linear-gradient(90deg, var(--act-rejilla) 0 1px, transparent 1px calc(100% / var(--horas))); background-color: #fbfcfd; }
.act-g-tramo, .act-g-pausa { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.act-g-tramo { background: var(--c); box-shadow: 0 0 0 1px #fff; cursor: default; }
.act-g-tramo:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px #fff, 0 0 0 3px rgba(15, 30, 50, .25); z-index: 1; }
.act-g-pausa { background: repeating-linear-gradient(135deg, #e2e7ec 0 4px, #f1f4f6 4px 8px); top: 5px; bottom: 5px; }
.act-g-atenuado { opacity: .16; }
.act-g-regla { min-height: 22px; border-bottom: 0; position: sticky; top: 0; }
.act-g-horas { position: relative; height: 18px; }
.act-g-horas span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.act-g-horas span:first-child { transform: none; }
.act-g-horas span:last-child { transform: translateX(-100%); }
.act-g-dia { padding: 12px 0 4px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--borde); position: sticky; left: 0; }
.act-g-mas { margin-top: 10px; width: auto; }
.act-g-det { --etq: 0px; min-width: 520px; margin: 6px 0 10px; }
.act-g-det .act-g-etq { padding: 0; }

/* Diálogo de detalle de día */
.act-dialogo h2 { text-transform: none; }
.act-det { border-top: 1px solid var(--borde); padding-top: 6px; margin-top: 6px; }
.act-det h3 { margin: 6px 0 2px; }

/* Responsive */
@media (max-width: 1100px) { .act-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .act-reparto { grid-template-columns: 1fr; }
  .act-donut svg { width: 180px; }
  .act-buscar, .act-buscar input { width: 100%; }
  .act-bloque-cab { align-items: stretch; }
  .act-dia { min-height: 64px; padding: 4px; }
  .act-chips { display: none; }
  .act-dia-mini { height: 6px; margin-top: auto; }
  .act-dia-j { font-size: 11px; }
  .act-largo { display: none; } .act-corto { display: inline; }
  .act-g { --etq: 110px; }
  .act-col-barra { display: none; }
}
@media (max-width: 560px) {
  .act-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .act-kpi { padding: 10px 12px; }
  .act-kpi b { font-size: 18px; }
  .act-fila { display: grid; grid-template-columns: 1fr 1fr; }
  .act-fecha input { width: 100%; }
  .act-ancho, #act-personas-caja { grid-column: 1 / -1; }
  .act-ancho select { max-width: none; min-width: 0; width: 100%; }
  .act-personas summary { width: 100%; }
  .act-personas-menu { width: 100%; }
  .act-campo-casilla { grid-column: 1 / -1; min-height: 0; }
  .act-presets { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-left: -2px; }
  .act-presets button { flex: none; }
  .act-descargas { width: 100%; }
  .act-descargas button { flex: 1; }
  .act-dia-j { display: none; }
  .act-cal { gap: 3px; }
}

/* PDF: impresión limpia de lo que se ve */
@media print {
  body.act-imprimiendo { background: #fff; display: block; }
  body.act-imprimiendo .cabecera, body.act-imprimiendo .menu, body.act-imprimiendo .aviso, body.act-imprimiendo .tip,
  body.act-imprimiendo .act-filtros, body.act-imprimiendo .act-descargas, body.act-imprimiendo .act-buscar,
  body.act-imprimiendo .act-mesnav button, body.act-imprimiendo .act-g-mas, body.act-imprimiendo .act-g-aviso,
  body.act-imprimiendo .act-bloque-cab .nota, body.act-imprimiendo .act-bloque > p.nota, body.act-imprimiendo .act-recorte,
  body.act-imprimiendo .act-ley-todo, body.act-imprimiendo .act-bloque-cab .act-casilla { display: none !important; }
  body.act-imprimiendo main { max-width: none; padding: 0; }
  body.act-imprimiendo .act-impresion { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--azul); padding-bottom: 8px; margin-bottom: 10px; font-size: 14px; }
  body.act-imprimiendo .act-imp-logo { height: 34px; width: auto; }
  body.act-imprimiendo .act-impresion b { color: var(--azul); font-size: 20px; }
  body.act-imprimiendo .act-cab h1 { font-size: 20px; }
  body.act-imprimiendo .tarjeta, body.act-imprimiendo .act-kpi { box-shadow: none; break-inside: avoid; }
  body.act-imprimiendo .act-kpis { grid-template-columns: repeat(6, 1fr); }
  body.act-imprimiendo .act-reparto { grid-template-columns: 200px 1fr; }
  body.act-imprimiendo .act-scroll, body.act-imprimiendo .act-g-scroll { overflow: visible; }
  body.act-imprimiendo .act-svg { max-width: 100%; height: auto; }
  body.act-imprimiendo .act-g { min-width: 0; }
  body.act-imprimiendo .act-bloque-cal { break-before: page; }
  body.act-imprimiendo .act-ley { border: 0; padding: 0 6px; }
  body.act-imprimiendo .act-ley[aria-pressed="false"] { display: none; }
  body.act-imprimiendo .act-col-barra { display: table-cell; }
  body.act-imprimiendo .act-chips { display: flex; }
  body.act-imprimiendo .pie { display: block; }
  body.act-imprimiendo * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
