/* Acceso */
.as-causas { display: flex; flex-direction: column; }
.as-causa { border-bottom: 1px solid var(--raya-2); }
.as-causa:last-child { border-bottom: 0; }
.as-causa.es-destacada { background: var(--acento-suave); box-shadow: inset 3px 0 0 var(--acento); }
.as-causa-cab { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; padding: 13px 16px; }
.as-que { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.as-que h3 { font-size: 16px; line-height: 1.25; }
.as-causa.e-mal .as-que h3 { color: var(--mal); }
.as-detalle { color: var(--tinta-2); max-width: 78ch; }
.as-meta { display: flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--tinta-2); }
.as-boton { align-self: center; }
.as-causa-det { padding: 0 16px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.as-causa-det .tabla-caja { background: var(--hoja); }
.as-par { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.as-todo { display: inline-block; padding: 1px 7px; border: 1px dashed var(--tinta-3); border-radius: var(--r); font-size: 12.5px; color: var(--tinta-2); }
.as-btns { white-space: nowrap; }
.as-btns .boton { margin-right: 6px; padding: 3px 9px; font-size: 12.5px; }
table.as-tabla td { white-space: normal; max-width: none; vertical-align: middle; }
table.as-tabla td .tenue { font-size: 11.5px; }
.as-otros { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 12.5px; }
.as-esperadas { margin-top: 10px; }
.as-esperadas details.plegable { border: 1px solid var(--raya); border-radius: var(--r); background: var(--hoja-2); padding: 0 14px; }
.as-esperadas details.plegable > .plegable-dentro { padding-left: 0; }
.as-esp-t { display: inline-flex; align-items: center; gap: 8px; }
.as-esp-t i { width: 14px; height: 12px; border-radius: 2px; }
.as-aviso { font-size: 12.5px; margin-bottom: 8px; }

/* matriz */
.as-leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--tinta-2); margin-bottom: 8px; }
.as-ley { display: inline-flex; align-items: center; gap: 5px; }
.as-ley b { font: 600 11px/1 var(--cifra); color: var(--tinta); }
.as-vacio-muestra { display: inline-block; width: 12px; height: 12px; border: 1px dashed var(--tinta-3); border-radius: 2px; }
.as-nota { font-size: 12.5px; margin-bottom: 8px; color: var(--tinta-2); }
.as-matriz { max-height: 78vh; }
table.as-m { border-collapse: separate; border-spacing: 0; font-size: 12.5px; min-width: 100%; }
table.as-m th, table.as-m td { border-bottom: 1px solid var(--raya-2); }
table.as-m th.as-esq, table.as-m th.as-suj { position: sticky; left: 0; z-index: 2; background: var(--hoja); text-align: left; min-width: 176px; max-width: 220px; padding: 5px 10px; font-weight: 400; border-right: 1px solid var(--raya); }
table.as-m th.as-esq { z-index: 3; vertical-align: bottom; color: var(--tinta-3); background: var(--hoja-2); }
table.as-m thead th { background: var(--hoja-2); position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--raya); }
table.as-m thead th.as-esq { z-index: 4; }
table.as-m th.as-col { width: 40px; min-width: 40px; padding: 6px 0 8px; vertical-align: bottom; }
.as-rot { background: none; border: 0; padding: 0 4px; color: var(--tinta-2); font-size: 12px; max-height: 168px; overflow: hidden; }
.as-rot span { display: block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-height: 160px; }
.as-rot:hover { color: var(--acento); }
th.as-vacia .as-rot { color: var(--tinta-3); font-style: italic; }
th.as-vacia { background: repeating-linear-gradient(135deg, var(--esperado-suave) 0 3px, transparent 3px 7px), var(--hoja-2); }
td.as-vacia { background: repeating-linear-gradient(135deg, var(--esperado-suave) 0 3px, transparent 3px 7px); }
table.as-m td { text-align: center; padding: 3px 2px; height: 30px; }
td.as-hueco::after { content: ''; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--raya); vertical-align: middle; }
td.as-vacia.as-hueco::after, td.as-vacia { }
tr.as-gr th { text-align: left; background: var(--hoja-2); font: 600 12px/1 var(--titulo); color: var(--tinta-2); padding: 7px 10px; position: sticky; left: 0; }
tr.as-pie th, tr.as-pie td { background: var(--hoja-2); border-bottom: 0; }
.as-nadie { font-size: 11px; color: var(--tinta-3); font-style: italic; }
tr.es-sel th.as-suj, tr.es-sel td { background: var(--acento-suave); }
.as-nom { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--tinta); text-align: left; max-width: 200px; font-size: 12.5px; }
button.as-nom:hover { color: var(--acento); text-decoration: underline; }
.as-nom span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-nom-rol { max-width: none; font-weight: 500; }
.as-sin { display: block; font-size: 11px; color: var(--tinta-3); padding-left: 17px; }
.as-marca { display: inline-flex; align-items: center; gap: 1px; background: none; border: 1px solid transparent; border-radius: var(--r); padding: 3px 3px; vertical-align: middle; }
.as-marca:hover { border-color: var(--acento); }
.as-marca + .as-marca { margin-left: 2px; }
.as-letra { font: 600 10px/1 var(--cifra); color: var(--tinta-2); }
.as-marca.k-vencida .as-letra { color: var(--mal); }
.as-marca.k-vencida { background: var(--mal-suave); }
.as-marca.k-gracia, .as-marca.k-caduca, .as-marca.k-revisar { background: var(--atencion-suave); }
.as-marca.k-emergencia { box-shadow: inset 0 0 0 1px var(--atencion); }
.as-marca .marca { vertical-align: 0; }

/* hasta dónde llega */
.as-alc { padding: 14px 16px 16px; }
.as-alc-cab { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.as-alc-cab b { font: 700 18px/1.2 var(--titulo); letter-spacing: -.01em; }
.as-frase { font-size: 14px; max-width: 90ch; margin: 0 0 8px; }
.as-peq { font-size: 12px; }
.as-sumas { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; }
.as-sumas > div { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.as-ef { display: inline-block; font: 600 10.5px/1.5 var(--cifra); padding: 0 6px; border-radius: 2px; white-space: nowrap; }
.as-ef.es-w { background: var(--atencion-suave); color: var(--atencion); border: 1px solid var(--atencion); }
.as-ef.es-r { color: var(--tinta-3); border: 1px solid var(--raya); }
.as-diag-caja { overflow-x: auto; border: 1px solid var(--raya-2); border-radius: var(--r); background: var(--hoja-2); }
.as-diag { min-width: 820px; }
.as-via-cab, .as-via { display: grid; grid-template-columns: 1fr 1.1fr; }
.as-via-cab { grid-template-columns: 190px 190px minmax(190px, 1.1fr) minmax(220px, 1.4fr); font-size: 11.5px; color: var(--tinta-3); padding: 7px 12px; border-bottom: 1px solid var(--raya-2); gap: 0 18px; }
.as-cuerpo { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 0 18px; padding: 10px 12px; }
.as-vias { display: flex; flex-direction: column; gap: 8px; }
.as-via { grid-template-columns: 190px minmax(190px, 1.1fr) minmax(220px, 1.4fr); gap: 18px; align-items: start; padding: 8px 10px; background: var(--hoja); border: 1px solid var(--raya-2); border-radius: var(--r); position: relative; }
.as-via.es-sel { border-color: var(--acento); box-shadow: inset 0 0 0 1px var(--acento); }
.as-c { display: flex; flex-direction: column; gap: 5px; min-width: 0; align-items: flex-start; }
.as-c-tools::before, .as-c-sis::before { content: '→'; position: absolute; margin-left: -16px; margin-top: 2px; color: var(--tinta-3); }
.as-c-quien { align-self: start; background: var(--hoja); border: 1.5px solid var(--tinta); border-radius: var(--r); padding: 8px 10px; }
.as-via-de { font-size: 11px; color: var(--tinta-3); }
.as-sis { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.as-ent { font-size: 11.5px; flex-basis: 100%; }
.as-alm { border-top: 1px dashed var(--raya); padding-top: 4px; margin-top: 2px; }
.as-sub { font: 600 13px/1.3 var(--titulo); margin: 16px 0 6px; color: var(--tinta-2); }
.as-alcance-hint { margin-top: 14px; font-size: 13px; }
.as-alcance-hint p { padding: 8px 12px; border: 1px dashed var(--raya); border-radius: var(--r); }
.as-alcance-hint b { font-weight: 600; color: var(--tinta-2); }

/* lo demás, discreto */
.as-resto .seccion { margin-top: 10px; }
.as-resto details.plegable { border: 1px solid var(--raya); border-radius: var(--r); background: var(--hoja); padding: 0 14px; }
.as-resto details.plegable > .plegable-dentro { padding-left: 0; }
.as-resto details.plegable details.plegable { border: 0; border-top: 1px solid var(--raya-2); border-radius: 0; padding: 0; }
.as-publicar tr.as-falta td { background: var(--mal-suave); }
.as-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.as-tile { border: 1px solid var(--raya-2); border-radius: var(--r); padding: 8px 10px; display: flex; flex-direction: column; background: var(--hoja-2); }
.as-tile b { font-size: 20px; font-weight: 500; }
.as-tile span { font-size: 12px; color: var(--tinta-2); }
.as-tile.e-atencion { background: var(--atencion-suave); }
.as-tile.e-mal { background: var(--mal-suave); }
tr.as-em td { background: var(--atencion-suave); }

@media (max-width: 900px) {
  .as-causa-cab { grid-template-columns: minmax(0, 1fr); }
  .as-boton { align-self: start; }
  table.as-m th.as-esq, table.as-m th.as-suj { min-width: 120px; max-width: 130px; }
  .as-nom { max-width: 110px; }
}
.as-rol-celda { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }

/* ── Hacer: personas, proveedores, sesiones, puerta de ops ─────────── */
.as-acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin: 0 0 12px; }
.as-acciones .boton, .as-btns .boton { min-height: 32px; }
.as-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; white-space: normal; }
td.as-btns { display: table-cell; }
td.as-btns > .boton, td.as-btns > details { margin: 2px 6px 2px 0; vertical-align: middle; }
.as-masivo { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12.5px; }
.as-personas tr.as-baja td, tr.as-baja td { color: var(--tinta-2); }
.as-personas td .tenue { font-size: 11.5px; }
.as-provs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 12px; }
.as-prov { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.as-prov-cab { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.as-prov-cab b { font: 600 15px/1.3 var(--titulo); }
.as-prov-cab .tenue { font-size: 12px; flex-basis: 100%; }
.as-prov-quien { margin: 0; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.as-lleva { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 16px; font-size: 12.5px; }
.as-lleva > div { border: 1px solid var(--raya-2); border-radius: var(--r); padding: 8px 10px; background: var(--hoja-2); }
.as-lleva-t { display: block; font: 600 12.5px/1.3 var(--titulo); margin-bottom: 4px; }
.as-lleva ul { margin: 0; padding-left: 16px; color: var(--tinta-2); }
.as-lleva li + li { margin-top: 2px; }
.as-puerta-nota { margin-top: 10px; }
.as-puerta-banda { padding: 9px 12px; border: 1px dashed var(--raya); border-left: 3px solid var(--acento); border-radius: var(--r); background: var(--hoja); font-size: 13px; margin: 0 0 6px; }
.as-ficha { display: flex; flex-direction: column; gap: 8px; }
.as-ficha .as-peq { margin: 0; }
.as-ficha .as-lleva { grid-template-columns: minmax(0, 1fr); }
.as-lleva-caja { margin-top: 2px; }
.as-pasos { margin: 0; padding-left: 18px; }
.as-pasos li + li { margin-top: 3px; }
.as-nota-larga { margin-top: 14px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; max-width: 80ch; }
.as-nota-larga p { margin: 0; }
.as-sub:first-child { margin-top: 4px; }
@media (max-width: 900px) {
  .as-acciones .boton { min-height: 36px; }
  .as-prov { padding: 10px 12px; }
}

/* lo visto (D7: apunta quién y cuándo; no cierra nada) */
.as-visto { margin: 0; font-size: 12px; color: var(--tinta-2); }
td .as-visto { margin-top: 2px; font-size: 11.5px; }
.as-causa.es-vista .as-que h3 { color: var(--tinta-2); }

/* un mando del prototipo, no del producto */
.as-mando { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; border: 1px dashed var(--acento); border-radius: var(--r); padding: 2px 6px; background: var(--acento-suave); margin: 2px 6px 2px 0; }
.as-mando-t { font: 500 10.5px/1.6 var(--cifra); color: var(--acento); white-space: nowrap; }
.as-mando .boton { margin: 0; }

/* el interruptor de «crear cuentas desde Zentzu» (D9) */
.as-interruptor { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; padding: 8px 10px; border: 1px solid var(--raya-2); border-radius: var(--r); background: var(--hoja-2); }
.as-sw { flex: none; position: relative; width: 40px; min-width: 40px; height: 24px; margin-top: 1px; padding: 0; border: 1px solid var(--tinta-3); border-radius: 12px; background: var(--hoja); cursor: pointer; }
.as-sw:hover { border-color: var(--acento); }
.as-sw-p { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--tinta-3); transition: left .12s; }
.as-sw.es-on { background: var(--acento-suave); border-color: var(--acento); }
.as-sw.es-on .as-sw-p { left: 19px; background: var(--acento); }
.as-sw.sin-permiso { opacity: .6; border-style: dashed; cursor: not-allowed; }
@media (max-width: 900px) { .as-sw { height: 28px; width: 46px; min-width: 46px; } .as-sw-p { width: 20px; height: 20px; } .as-sw.es-on .as-sw-p { left: 22px; } }

/* El alcance de un rol (no va dentro de la caja que se desliza): en pantallas estrechas sus tres columnas se apilan. */
@media (max-width: 700px) {
  .as-alc > .as-via-cab { display: none; }
  .as-alc > .as-via { grid-template-columns: minmax(0, 1fr); }
  .as-alc > .as-via .as-c-tools::before, .as-alc > .as-via .as-c-sis::before { display: none; }
}

/* En pantalla estrecha cada persona y cada grupo es una tarjeta: quién arriba, lo demás debajo con su rótulo, las acciones al final. Sin desplazamiento. */
@media (max-width: 700px) {
  .tabla-caja:has(> table.as-personas, > table.as-grupos) { overflow-x: visible; background: none; }
  .tabla-caja table.as-personas, .tabla-caja table.as-grupos, .tabla-caja table.as-personas tbody, .tabla-caja table.as-grupos tbody { display: block; }
  .tabla-caja table.as-personas thead, .tabla-caja table.as-grupos thead { display: none; }
  .tabla-caja table.as-personas tr, .tabla-caja table.as-grupos tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; padding: 12px; margin: 0 0 8px; background: var(--hoja); border: 1px solid var(--raya-2); border-radius: var(--r); }
  .tabla-caja table.tabla.as-personas td:nth-child(n), .tabla-caja table.tabla.as-grupos td:nth-child(n) { display: block; position: static; padding: 0; border: 0; max-width: none; min-width: 0; box-shadow: none; background: none; overflow: visible; white-space: normal; }
  .tabla-caja table.as-personas td[data-label]::before, .tabla-caja table.as-grupos td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--tinta-3); margin-bottom: 2px; }
  /* personas: [persona | estado] / entra por / [grupos | permisos] / acciones */
  table.as-personas td:nth-child(1) { grid-column: 1; }
  table.as-personas td:nth-child(3) { grid-column: 2; grid-row: 1; justify-self: end; }
  table.as-personas td:nth-child(2) { grid-column: 1 / -1; }
  table.as-personas td:nth-child(4) { grid-column: 1; }
  table.as-personas td:nth-child(5) { grid-column: 2; justify-self: end; text-align: right; }
  table.as-personas td:nth-child(6), table.as-grupos td:nth-child(5) { grid-column: 1 / -1; }
  /* grupos: grupo / de dónde sale / miembros | permisos / acciones */
  table.as-grupos td:nth-child(1), table.as-grupos td:nth-child(2), table.as-grupos td:nth-child(3) { grid-column: 1 / -1; }
  table.as-grupos td:nth-child(4) { grid-column: 1 / -1; text-align: left; }
}

.as-ver-bajas { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 12.5px; color: var(--tinta-2); cursor: pointer; }
