/* Actividades: lo que Sofía acordó con las personas y lo que hará. Mismos tokens y componentes que el resto de Sofía (--ln, --r1…r3, --tx*, --e*, .hoja, .chip, .boton).
   El color vive solo en la raya inclinada de la marca: amarillo = acordada o por hacer · celeste = en marcha o esperando a la persona · negro = pide a una persona · beige = terminó. */

/* ---------- El estado de una actividad (lo usa también Hoy) ---------- */
.act-estado {
  --c: var(--amarillo); display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.1rem 0.75rem 0.1rem 0.6rem; border: 1px solid var(--bd); border-radius: 99px;
  font-size: 0.75rem; font-weight: 700; line-height: 1.7; white-space: nowrap; color: var(--tx); background: transparent;
}
.act-estado::before { content: ""; width: 3px; height: 0.95em; flex: none; background: var(--c); transform: skewX(-22deg); border-radius: 1px; }
.act-estado[data-c="mes"] { --c: var(--celeste); }
.act-estado[data-c="calma"] { --c: var(--beige); color: var(--tx-2); }
.act-estado[data-c="ya"] { background: var(--tx); color: var(--fondo); border-color: var(--tx); }
.act-estado[data-c="ya"]::before { background: var(--fondo); }

/* ---------- Vistas (chips con su contador) ---------- */
.act-vistas { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.act-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.35rem; padding: 0.2rem 0.5rem 0.2rem 0.9rem; border: 1px solid var(--ln); border-radius: 99px; background: var(--r1); color: var(--tx);
  font-size: var(--paso--1); font-weight: 600; line-height: 1.2; cursor: pointer; white-space: nowrap; transition: border-color 0.16s, background-color 0.16s, color 0.16s;
}
.act-chip:not(:has(.act-chip-n)) { padding-right: 0.9rem; }
.act-chip:hover { border-color: var(--bd); background: var(--r3); }
.act-chip:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.act-chip[aria-pressed="true"] { background: var(--tx); color: var(--fondo); border-color: var(--tx); }
.act-chip-n { min-width: 1.6rem; padding: 0 0.45rem; border-radius: 99px; background: var(--r3); color: var(--tx); font-size: 0.75rem; font-weight: 800; line-height: 1.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.act-chip-n:empty { display: none; }
.act-chip[data-atencion] .act-chip-n:not([data-cero]) { background: var(--tx); color: var(--fondo); }
.act-chip[aria-pressed="true"] .act-chip-n { background: var(--fondo); color: var(--tx); }
.act-chip-n[data-cero] { opacity: 0.6; font-weight: 600; }

/* ---------- Barra: búsqueda, filtros y forma de ver ---------- */
.act-ajuste { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--e3); }
.act-ajuste small { flex: 1 1 18rem; min-width: 0; }
.act-barra { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2) var(--e3); }
.act-buscar { position: relative; flex: 1 1 14rem; max-width: 26rem; display: block; }
.act-buscar > .icono { position: absolute; left: 0.85rem; top: 50%; translate: 0 -50%; width: 1.05rem; height: 1.05rem; color: var(--tx-3); pointer-events: none; }
.act-buscar input { padding-left: 2.5rem; border-radius: 99px; }
.act-filtros-boton { gap: 0.5rem; }
.act-filtros-n { min-width: 1.35rem; padding: 0 0.4rem; border-radius: 99px; background: var(--tx); color: var(--fondo); font-size: 0.6875rem; font-weight: 800; line-height: 1.35rem; text-align: center; }
.act-modos { margin-left: auto; }
.act-filtros { gap: var(--e3); padding: var(--e4); }
.act-filtros-rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: var(--e3); }

/* ---------- Cuerpo: la lista o la agenda, y «qué está haciendo Sofía» ---------- */
.act-cuerpo { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--e4); align-items: start; }
.act-principal { container: actp / inline-size; min-width: 0; }
.act-contenido { display: flex; flex-direction: column; gap: var(--e4); min-width: 0; }
.act-contenido[aria-busy="true"] { opacity: 0.55; transition: opacity 0.2s 0.15s; }
.act-total { margin: 0; }
.act-sofia { gap: 0; padding: 0; min-width: 0; }
.act-sofia > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); min-height: 2.9rem; padding: 0.6rem var(--e4); list-style: none; cursor: pointer; border-radius: var(--radio); font-size: var(--paso-1); font-weight: 300; letter-spacing: -0.02em; }
.act-sofia > summary::-webkit-details-marker { display: none; }
.act-sofia > summary b { font-weight: 800; }
.act-sofia > summary::after { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border-right: 2px solid var(--tx-2); border-bottom: 2px solid var(--tx-2); rotate: 45deg; translate: 0 -25%; transition: rotate 0.2s var(--salida); }
.act-sofia[open] > summary::after { rotate: -135deg; translate: 0 25%; }
.act-sofia > summary:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.act-sofia[open] > summary { border-bottom: 1px solid var(--ln); border-radius: var(--radio) var(--radio) 0 0; }
.act-sofia > #act-registro { padding: var(--e3) var(--e4) var(--e4); }
.act-sofia .registro { max-height: 22rem; }
@container principal (min-width: 56rem) {
  .act-cuerpo[data-modo="lista"] { grid-template-columns: minmax(0, 1fr) 21rem; }
  .act-cuerpo[data-modo="lista"] > .act-principal { grid-column: 1; grid-row: 1; }
  .act-cuerpo[data-modo="lista"] > .act-sofia { grid-column: 2; grid-row: 1; position: sticky; top: var(--e4); }
  .act-cuerpo[data-modo="lista"] .act-sofia .registro { max-height: calc(100dvh - 12rem); }
}
/* Con el panel de una actividad abierto a un lado, ese lado es suyo: la lista usa el ancho que queda */
html[data-inspector="lateral"] .act-cuerpo[data-modo="lista"] { grid-template-columns: minmax(0, 1fr); }
html[data-inspector="lateral"] .act-cuerpo > .act-sofia { display: none; }
/* El panel comparte altura con esta zona: aunque la lista sea corta, el panel tiene sitio para leerse */
html[data-inspector="lateral"] .act-cuerpo { min-height: min(46rem, calc(100dvh - 11rem)); align-content: start; }
@media (prefers-reduced-motion: reduce) { .act-sofia > summary::after, .act-contenido[aria-busy="true"] { transition: none; } }

/* ---------- Lista operativa ---------- */
.act-lista { display: flex; flex-direction: column; gap: var(--e4); }
.act-grupo-titulo { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.15rem 0.7rem; margin: 0 0 var(--e2); font-size: var(--paso-0); font-weight: 800; letter-spacing: 0; line-height: 1.3; }
.act-grupo-sub { font-weight: 500; font-size: var(--paso--1); color: var(--tx-2); }
.act-grupo-n { margin-left: auto; min-width: 1.5rem; padding: 0 0.45rem; border: 1px solid var(--ln); border-radius: 99px; font-size: 0.75rem; font-weight: 700; line-height: 1.35rem; text-align: center; color: var(--tx-2); }
.act-filas { list-style: none; margin: 0; padding: 0; overflow: hidden; border: 1px solid var(--bd); border-radius: var(--radio); background: var(--fondo); }
.act-fila { --c: var(--amarillo); position: relative; }
.act-fila[data-c="mes"] { --c: var(--celeste); }
.act-fila[data-c="ya"] { --c: var(--tx); }
.act-fila[data-c="calma"] { --c: var(--beige); }
.act-fila + .act-fila { border-top: 1px solid var(--ln); }
.act-fila::before { content: ""; position: absolute; left: 0.5rem; top: 0.85rem; width: 3px; height: 1.3rem; background: var(--c); transform: skewX(-22deg); border-radius: 1px; pointer-events: none; }
.act-fila-boton {
  display: grid; grid-template-columns: 5.6rem minmax(0, 1fr) auto; align-items: start; gap: 0.35rem 1rem; width: 100%; padding: 0.8rem 1rem 0.8rem 1.35rem;
  border: 0; background: transparent; color: var(--tx); text-align: left; cursor: pointer; transition: background-color 0.14s;
}
.act-fila-boton:hover { background: var(--r3); }
.act-fila-boton:focus-visible { outline: 2px solid var(--foco); outline-offset: -3px; }
.act-fila[aria-current="true"] { background: var(--r3); }
.act-fila[aria-current="true"]::after { content: ""; position: absolute; inset: 0; border: 2px solid var(--tx); border-radius: 0; pointer-events: none; }
.act-hora { display: flex; flex-direction: column; gap: 0.1rem; padding-top: 0.05rem; font-variant-numeric: tabular-nums; }
.act-hora b { font-size: var(--paso-0); font-weight: 800; line-height: 1.25; white-space: nowrap; }
.act-hora small { font-size: 0.75rem; color: var(--tx-2); }
.act-datos { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.act-persona { font-weight: 800; font-size: var(--paso-0); line-height: 1.3; overflow-wrap: anywhere; }
.act-sub { font-size: var(--paso--1); color: var(--tx-2); line-height: 1.4; overflow-wrap: anywhere; }
.act-vacante { color: var(--tx); }
.act-proxima { font-size: var(--paso--1); color: var(--tx-3); line-height: 1.4; overflow-wrap: anywhere; }
.act-lado { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.act-canal { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; color: var(--tx-3); }
.act-canal .icono { width: 0.95rem; height: 0.95rem; }
@container actp (max-width: 38rem) {
  .act-fila-boton { grid-template-columns: minmax(0, 1fr); gap: 0.3rem; padding-right: 0.85rem; }
  .act-hora { flex-direction: row; align-items: baseline; gap: 0.5rem; }
  .act-lado { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 0.4rem 0.6rem; margin-top: 0.15rem; }
}
.act-vacio .vacio { padding: var(--e3) 0; }

/* ---------- Agenda de la semana ---------- */
.act-agenda { display: flex; flex-direction: column; gap: var(--e3); }
.act-ag-cabeza { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e2) var(--e4); }
.act-ag-titulo { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; margin: 0; font-size: var(--paso-1); font-weight: 700; letter-spacing: 0; }
.act-ag-nav { display: flex; align-items: center; gap: 0.4rem; }
.act-ag-flecha { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0; border: 1px solid var(--bd); border-radius: 50%; background: transparent; color: var(--tx); cursor: pointer; }
.act-ag-flecha:hover { border-color: var(--tx); background: var(--r3); }
.act-ag-flecha:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
.act-ag-flecha .icono { width: 1.05rem; height: 1.05rem; }
.act-ag-semana { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.45rem; }
.act-ag-dia { display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; padding: 0.55rem 0.6rem; border: 1px solid var(--ln); border-radius: 0.9rem; background: var(--r1); }
.act-ag-dia[data-hoy] { border-color: var(--tx); background: var(--fondo); }
.act-ag-dia[data-vacio] { flex-direction: row; align-items: center; justify-content: space-between; gap: 0.6rem; padding-block: 0.4rem; }
.act-ag-dia-t { display: flex; align-items: baseline; gap: 0.4rem; margin: 0; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0; color: var(--tx-2); text-transform: capitalize; }
.act-ag-num { font-size: 1.15rem; font-weight: 800; color: var(--tx); line-height: 1; }
.act-ag-hoy { padding: 0 0.45rem; border-radius: 99px; background: var(--tx); color: var(--fondo); font-size: 0.6875rem; font-weight: 800; line-height: 1.3rem; text-transform: none; }
.act-ag-nada { margin: 0; font-size: 0.75rem; color: var(--tx-3); }
.act-ag-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.act-ag-item {
  --c: var(--amarillo); display: flex; flex-direction: column; gap: 0.05rem; width: 100%; padding: 0.35rem 0.5rem 0.35rem 0.6rem; border: 1px solid var(--ln); border-left: 3px solid var(--c);
  border-radius: 0.55rem; background: var(--fondo); color: var(--tx); font-size: 0.75rem; line-height: 1.3; text-align: left; cursor: pointer; transition: background-color 0.14s, border-color 0.14s;
}
.act-ag-item[data-c="mes"] { --c: var(--celeste); }
.act-ag-item[data-c="ya"] { --c: var(--tx); border-left-width: 5px; }
.act-ag-item[data-c="calma"] { --c: var(--beige); }
.act-ag-item:hover { background: var(--r3); border-color: var(--bd); border-left-color: var(--c); }
.act-ag-item:focus-visible { outline: 2px solid var(--foco); outline-offset: 1px; }
.act-ag-item[aria-current="true"] { outline: 2px solid var(--tx); outline-offset: 1px; }
.act-ag-hora { font-weight: 800; font-variant-numeric: tabular-nums; }
.act-ag-nom { font-weight: 600; overflow-wrap: anywhere; }
.act-ag-est { color: var(--tx-2); }
.act-ag-sinhora { padding: 0.55rem 0.6rem; border: 1px dashed var(--bd); border-radius: 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; }
.act-ag-sinhora .act-ag-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
@container actp (min-width: 50rem) {
  .act-ag-semana { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.4rem; align-items: stretch; }
  .act-ag-dia, .act-ag-dia[data-vacio] { flex-direction: column; align-items: stretch; justify-content: flex-start; min-height: 8rem; padding: 0.55rem; }
}

/* ---------- El panel de una actividad ---------- */
.act-sec { display: flex; flex-direction: column; gap: var(--e2); min-width: 0; padding-top: var(--e4); border-top: 1px solid var(--ln); }
.act-sec-estado { padding-top: 0; border-top: 0; }
.act-sec h3 { margin: 0; font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tx-2); line-height: 1.3; }
.act-sec p { max-width: none; }
.act-estado-fila { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); }
.act-ayuda { color: var(--tx); line-height: 1.5; }
.act-que-sigue { font-size: var(--paso-0); line-height: 1.5; }
.act-cita { margin: 0; padding: 0.65rem 0.9rem; border-left: 3px solid var(--celeste); border-radius: 0 0.7rem 0.7rem 0; background: var(--r1); font-size: var(--paso-0); line-height: 1.5; overflow-wrap: anywhere; }
.act-datos-det { margin: 0; display: grid; gap: 0.5rem; }
.act-dato { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.6rem; font-size: var(--paso--1); line-height: 1.45; }
.act-dato dt { color: var(--tx-2); font-weight: 600; }
.act-dato dd { margin: 0; overflow-wrap: anywhere; }
.act-dato a { font-weight: 700; }
.act-historial { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.act-historial > li { display: grid; grid-template-columns: 7.4rem minmax(0, 1fr); gap: 0.1rem 0.7rem; padding: 0.55rem 0; border-bottom: 1px solid var(--ln); font-size: var(--paso--1); line-height: 1.4; }
.act-historial > li:last-child { border-bottom: 0; }
.act-h-hora { grid-row: span 3; color: var(--tx-2); font-variant-numeric: tabular-nums; font-size: 0.75rem; }
.act-h-que, .act-h-det, .act-h-actor { grid-column: 2; overflow-wrap: anywhere; }
.act-h-det { color: var(--tx-2); }

/* Por dónde va: acordada → programada → enviándose → entregada → terminada (esperar la respuesta no es terminar) */
.act-camino { list-style: none; margin: var(--e2) 0 0; padding: 0; display: flex; }
.act-camino > li { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; text-align: center; }
.act-camino > li + li::before { content: ""; position: absolute; top: 0.5rem; left: -50%; right: 50%; height: 2px; background: var(--ln); }
.act-camino-punto { position: relative; z-index: 1; width: 1rem; height: 1rem; border: 2px solid var(--bd); border-radius: 50%; background: var(--fondo); }
.act-camino-t { display: flex; flex-direction: column; font-size: 0.6875rem; font-weight: 600; line-height: 1.25; color: var(--tx-3); }
.act-camino-t small { font-size: 0.625rem; font-weight: 700; color: var(--tx); }
.act-camino > li[data-e="hecho"]::before, .act-camino > li[data-e="actual"]::before { background: var(--tx); }
.act-camino > li[data-e="hecho"] .act-camino-punto { background: var(--tx); border-color: var(--tx); }
.act-camino > li[data-e="actual"] .act-camino-punto { background: var(--amarillo); border-color: var(--tx); box-shadow: 0 0 0 3px var(--fondo), 0 0 0 4px var(--tx); }
.act-camino > li[data-e="hecho"] .act-camino-t, .act-camino > li[data-e="actual"] .act-camino-t { color: var(--tx); }
.act-camino > li[data-e="actual"] .act-camino-t { font-weight: 800; }

/* Formularios del panel (reprogramar, cancelar, completar, agendar) */
.act-form.hoja { gap: var(--e3); padding: var(--e4); background: var(--r1); }
.act-form h3 { margin: 0; font-size: var(--paso-0); font-weight: 800; letter-spacing: 0; }
.act-form-fila { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e3); }
.act-form-error { display: flex; align-items: flex-start; gap: var(--e2); margin: 0; color: var(--tx); font-weight: 700; font-size: var(--paso--1); line-height: 1.4; }
.act-form-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--tx); color: var(--fondo); font-size: 0.75rem; font-weight: 800; }
.act-form-error[hidden] { display: none; }
.act-form-panel { display: flex; flex-direction: column; gap: var(--e4); }
.act-persona-elegida { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); padding: 0.4rem 0.4rem 0.4rem 0.9rem; border: 1px solid var(--bd); border-radius: 0.8rem; background: var(--sup); }
.act-persona-res { margin-top: var(--e2); }
.act-persona-res ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--ln); border-radius: 0.8rem; overflow: hidden; }
.act-persona-res li + li { border-top: 1px solid var(--ln); }
.act-persona-res button { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; width: 100%; padding: 0.55rem 0.8rem; border: 0; background: transparent; color: var(--tx); text-align: left; cursor: pointer; }
.act-persona-res button:hover, .act-persona-res button:focus-visible { background: var(--r3); }
.act-persona-res small { color: var(--tx-2); }

/* ---------- Pantallas angostas ---------- */
@media (max-width: 899px) { .act-modos { margin-left: 0; } }
@media (max-width: 699px) {
  /* Los contadores caben en una sola fila que se desplaza (nada de seis líneas de botones) */
  .act-vistas { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--e4) * -1); padding: 0.2rem var(--e4) 0.4rem; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .act-chip { flex: 0 0 auto; min-height: 2.75rem; }
  .act-buscar { max-width: none; }
  .act-barra .modo-hoy { width: 100%; }
  .act-barra .modo-boton { flex: 1 1 0; justify-content: center; }
  .act-dato { grid-template-columns: 6.2rem minmax(0, 1fr); }
  .act-historial > li { grid-template-columns: 6.6rem minmax(0, 1fr); }
}
@media (max-width: 420px) { .act-form-fila { grid-template-columns: minmax(0, 1fr); } }
@media (pointer: coarse) { .act-ag-flecha { width: 2.75rem; height: 2.75rem; } .act-ag-item { padding-block: 0.5rem; } }
@media (max-width: 599px) { .encabezado p.act-intro { font-size: var(--paso-0); } }

/* «Qué está haciendo Sofía»: en pantallas anchas pero con poco ancho útil (por ejemplo la agenda) va debajo del contenido, no encima; en celular y tableta va arriba, plegado */
@media (min-width: 900px) { .act-cuerpo > .act-sofia { order: 2; } }
@container principal (min-width: 56rem) { .act-cuerpo[data-modo="lista"] > .act-sofia { order: 0; } }
/* ---------- Quién actúa: lo que prometió la persona · lo que hará Sofía · lo que debe hacer una persona del equipo (4.3) ---------- */
.act-clase {
  --c: var(--amarillo); display: inline-flex; align-items: center; gap: 0.35rem; padding: 0 0.55rem 0 0.45rem; border: 1px solid var(--bd); border-radius: 0.4rem; background: transparent; color: var(--tx);
  font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.04em; line-height: 1.6; text-transform: uppercase; white-space: nowrap; vertical-align: baseline;
}
.act-clase::before { content: ""; width: 3px; height: 0.85em; flex: none; background: var(--c); transform: skewX(-22deg); border-radius: 1px; }
.act-clase[data-clase="persona"] { --c: var(--celeste); border-style: dashed; }
.act-clase[data-clase="rrhh"] { --c: var(--tx); }
.act-prometido { font-size: var(--paso--1); color: var(--tx); line-height: 1.4; overflow-wrap: anywhere; }
.act-prometido b { font-weight: 800; }
.act-prometido-fecha { color: var(--tx-2); }
.act-prometido[data-vencido] b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.act-vencido-txt { font-weight: 800; }
.act-ctxs { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.act-ctx-rot { color: var(--tx-2); font-weight: 600; }
.act-ag-clase { font-size: 0.6875rem; font-weight: 700; color: var(--tx-2); line-height: 1.25; }
.act-ag-item[data-clase="persona"] { border-left-style: dashed; }
.s42-act .act-clase { margin-right: 0.35rem; }
