/* ASSURE · diseño B, «Vidrio sobre obra».
   Va después de assure.css y sólo cambia la forma: el marco (riel de iconos a
   la izquierda en vez de barra arriba), la foto de cada tema, el vidrio del
   claro y la barra inferior del celular. Los colores de estado, la tipografía
   y los componentes siguen saliendo de tokens.css y assure.css.
   app-glass.css no se toca: lo que haga falta se pisa desde acá. */

/* ---------- foto: una por tema --------------------------------------- */
/* Oscuro: los tanques del kit de marca, en gris, desenfocados y con velo.
   Claro: la planta de día, casi natural; el velo es más denso arriba, donde
   va el título sobre el cielo. */
.ag-root .ag-bg.b-foto-claro { display: none; }
.ag-root.ag-light .ag-bg.b-foto-oscuro { display: none; }
.ag-root.ag-light .ag-bg.b-foto-claro { display: block; }
.ag-root .ag-bg.b-foto-oscuro { inset: -20px; opacity: 1; filter: grayscale(1) brightness(0.55) blur(4px); }
.ag-root .ag-bg.b-foto-oscuro + .ag-bg + .ag-shade { background: rgba(5, 5, 5, 0.5); }
.ag-root.ag-light .ag-bg.b-foto-claro,
.ag-root.ag-light:has(.ag-app) .ag-bg.b-foto-claro {
  inset: 0; opacity: 1; filter: grayscale(0.55) brightness(1.04) contrast(0.96) blur(0.6px);
  background-position: 100% 100%; transform: scale(1.14); transform-origin: 100% 0;
}
.ag-root.ag-light .ag-bg.b-foto-oscuro + .ag-bg + .ag-shade,
.ag-root.ag-light:has(.ag-app) .ag-shade {
  background:
    linear-gradient(180deg, rgba(246, 249, 250, 0.5) 0%, rgba(246, 249, 250, 0.16) 16%, rgba(246, 249, 250, 0.04) 100%),
    linear-gradient(140deg, rgba(190, 236, 228, 0.3) 0%, rgba(240, 244, 246, 0) 48%, rgba(196, 216, 240, 0.3) 100%);
}

/* ---------- vidrio del tema claro ------------------------------------- */
/* Blanco al 84 % con filo y sombra suave: se lee como hoja, y la foto asoma
   alrededor y apenas a través. */
.ag-root.ag-light:has(.b-app) {
  --ag-panel: rgba(255, 255, 255, 0.84);
  --ag-panel-line: rgba(18, 44, 52, 0.11);
  --ag-card: rgba(255, 255, 255, 0.9);
  --ag-ctl: rgba(255, 255, 255, 0.82);
  --ag-ctl-on: rgba(18, 44, 52, 0.08);
  --ag-line: rgba(18, 44, 52, 0.1);
  --ag-sombra: 0 1px 2px rgba(18, 44, 52, 0.05), 0 14px 34px rgba(18, 44, 52, 0.09);
}
.ag-light .b-app .ag-panel, .ag-light .b-app .kpi { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), var(--ag-sombra); }
/* En claro el estado va en pastilla sobre su tono suave: un punto de color
   sobre blanco sólo no alcanza para separarlo del texto de la fila. */
.ag-light .b-app .estado { padding: 3px 10px 3px 8px; border-radius: 99px; background: var(--f-sin-soft); }
/* Tintas más profundas sobre fondos opacos: el contraste no depende de la foto. */
.ag-light .estado.e-pendiente { color: #4b5055; background: var(--f-sin-soft); }
.ag-light .estado.e-encarga { color: #08568d; background: var(--f-curso-soft); }
.ag-light .estado.e-terminado { color: #2032bd; background: var(--f-hecho-soft); }
.ag-light .estado.e-aprobado, .ag-light .estado.e-cerrado { color: #09652d; background: var(--f-firmado-soft); }
.ag-light .estado.e-rechazado { color: #b40925; background: var(--f-rechazo-soft); }
.ag-light .estado.e-bloqueado, .ag-light .estado.e-devuelto { color: #784b00; background: var(--f-espera-soft); }

/* ---------- el marco: barra de secciones arriba ------------------------- */
/* Galo pidió el 12/11 volver a la barra de arriba, como antes, conservando el
   resto del diseño B. La cáscara redonda de antes no vuelve: el vidrio está
   en la barra y en cada panel, y la foto se ve alrededor. La barra es una
   sola pieza de vidrio pegajosa con dos renglones: marca, proyecto y
   controles arriba; las secciones, con ícono y nombre, abajo. */
.b-app {
  margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none !important;
  backdrop-filter: none; -webkit-backdrop-filter: none; overflow: visible;
  display: block; padding: 16px 22px 0; min-height: 100vh; box-sizing: border-box;
}
.b-app .ag-top {
  position: sticky; top: 12px; z-index: 30;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  padding: 10px 12px; border-radius: 20px;
  background: var(--ag-panel); border: 1px solid var(--ag-panel-line);
  backdrop-filter: blur(22px) saturate(1.15); -webkit-backdrop-filter: blur(22px) saturate(1.15);
  box-shadow: inset 0 1px 0 var(--ag-filo, rgba(255, 255, 255, 0.05)), var(--ag-sombra, 0 12px 32px rgba(0, 0, 0, 0.3));
}
.b-app .ag-top .ag-brand { display: inline-flex; margin-right: 4px; }
.b-app .ag-top .ag-brand .ag-tile { width: 42px; height: 42px; border-radius: 12px; }
.b-app .ag-top .ag-proj { background: var(--ag-ctl); }
.b-app .ag-top .menu-btn { display: inline-flex; }
.b-app .ag-top .right { margin-left: auto; }
/* Las secciones van en el segundo renglón, a lo ancho y centradas. */
.b-app .ag-top .b-nav {
  /* «safe»: si las secciones no entran, arranca desde la izquierda. Con «center» a secas el
     desborde se repartía a los dos lados y «Inicio» quedaba cortado y fuera de alcance. */
  order: 10; flex: 1 1 100%; margin: 0; justify-content: safe center;
  padding: 4px; gap: 2px; border-radius: 14px; border: 1px solid var(--ag-ctl-line);
  background: var(--ag-ctl); backdrop-filter: none; -webkit-backdrop-filter: none;
}
/* Cuando las secciones no entran, el borde del lado que sigue se funde: se ve que hay más. */
.b-app .ag-top .b-nav.hay-der { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.b-app .ag-top .b-nav.hay-izq { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent); }
.b-app .ag-top .b-nav.hay-izq.hay-der { -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent); }
.b-app .b-nav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ag-nav);
}
.b-app .b-nav a:hover { color: var(--ag-ink); background: var(--ag-hover); text-decoration: none; }
.b-app .b-nav a.on { background: var(--ag-ctl-on); color: var(--ag-ink); }
.ag-light .b-app .b-nav a.on { background: var(--ag-pri); color: var(--ag-pri-ink); }
.b-app .b-nav a svg { flex: none; }
.b-app .b-nav .n { margin-left: 0; }
.ag-light .b-app .b-nav a.on .n { background: rgba(255, 255, 255, 0.2); color: inherit; }
.b-app .ag-main { padding: 26px 0 30px; gap: 22px; }
.b-app .ag-title { font-size: 40px; line-height: 44px; text-wrap: balance; }

/* ---------- tablet y celular -------------------------------------------- */
/* Hasta 1100 px las secciones pasan a la barra de cinco: la tablet también
   necesita tenerlas a mano. Más abre el mismo menú que el botón de arriba. */
.b-tab-mas { cursor: pointer; }
@media (max-width: 1100px) {
  .b-app { padding: 12px 16px 0; }
  .b-app .ag-top .b-nav { display: none; }
  .b-app .ag-top .menu-btn { display: none; }
  .b-app .ag-top .ag-proj .nom { max-width: 150px !important; }
  .b-app .ag-main { padding: 20px 0 104px; }
  .b-app .ag-title { font-size: 32px; line-height: 36px; }

  .tabbar {
    display: block; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 6px; border-radius: 20px; border: 1px solid var(--ag-panel-line);
    background: var(--ag-panel); backdrop-filter: blur(22px) saturate(1.15); -webkit-backdrop-filter: blur(22px) saturate(1.15);
    box-shadow: inset 0 1px 0 var(--ag-filo, rgba(255, 255, 255, 0.05)), 0 12px 32px rgba(0, 0, 0, 0.35);
  }
  .ag-light .tabbar { background: rgba(255, 255, 255, 0.9); box-shadow: inset 0 1px 0 #fff, 0 12px 32px rgba(18, 44, 52, 0.16); }
  .tabbar nav { gap: 2px; }
  .tabbar a { min-height: 52px; border-radius: 14px; font-weight: 650; min-width: 0; }
  .tabbar a.on { background: var(--ag-ctl-on); color: var(--ag-ink); }
  .ag-light .tabbar a.on { background: var(--ag-pri); color: var(--ag-pri-ink); }
}
@media (min-width: 761px) and (max-width: 1100px) {
  /* La barra queda cerca del pulgar sin estirarse por toda la tablet. */
  .tabbar { max-width: 640px; margin-inline: auto; }
  /* Son 66 px de barra (52 + 12 de relleno + 2 de borde), 10 hasta el
     borde de abajo y otros 10 de aire: la firma no pisa las pestañas.
     Pisamos el static de assure.css sólo en tablet; el celular sigue igual. */
  .b-app .fld-pie-fijo {
    position: sticky; bottom: calc(66px + 10px + 10px + env(safe-area-inset-bottom));
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  }
}
@media (max-width: 760px) {
  .b-app { padding: 10px 12px 0; }
  .b-app .ag-top { top: 8px; padding: 8px 10px; gap: 8px; }
  .b-app .ag-top .ag-brand .ag-tile { width: 38px; height: 38px; border-radius: 11px; }
  .b-app .ag-top .ag-brand small { display: none; }
  .b-app .ag-top .ag-proj { order: 3; flex: 1 1 100%; justify-content: flex-start; }
  .b-app .ag-top .right .ag-icon:not(.ag-theme) { display: none; }
  .b-app .ag-main { padding: 16px 0 104px; gap: 16px; }
  .b-app .ag-title { font-size: 30px; line-height: 34px; }
}

/* app.js reemplaza texto, title y className del indicador. El contenedor
   conserva el tamaño; los avisos largos se recortan sólo a la vista, sin
   ensanchar la cabecera ni perder el texto completo para el lector de pantalla. */
.b-app .fld-cab .b-cola-chip {
  display: block; width: 28ch; max-width: 100%; min-width: 0;
  margin-top: 4px; font-size: 13px; line-height: 1.4;
}
.b-app .fld-cab .b-cola-chip [data-cola] {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- menú Más ---------------------------------------------------- */
/* En celular sube desde abajo como hoja; en pantallas grandes sale al lado
   del riel. Mismo vidrio que los paneles. */
.sheet .caja { background: var(--ag-page); }
.ag-light .sheet .caja { background: #f6f8f9; }
.sheet .caja a.on { background: var(--ag-ctl-on); }
.ag-light .sheet .caja a.on { background: var(--ag-pri); color: var(--ag-pri-ink); }
@media (max-width: 760px) {
  .sheet .caja { inset: auto 0 0 0; width: auto; max-height: 86vh; border-right: 0; border-top: 1px solid var(--ag-line); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
}

@media print {
  .b-app .ag-top, .tabbar { display: none !important; }
  .b-app { display: block; padding: 0; }
}

/* ---------- cabecera: el proyecto como sobretítulo, el buscador a la vista ---------- */
.b-app .ag-top .ag-proj {
  height: 36px; padding: 0 12px; border-radius: 11px; gap: 8px;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 650;
}
.b-app .ag-avatar { text-decoration: none; color: var(--ag-ink); }
.b-app .ag-top .ag-proj .nom { font-family: var(--font-sans) !important; letter-spacing: 0.08em; }
.b-buscar { position: relative; display: flex; align-items: center; width: clamp(200px, 22vw, 300px); }
.b-buscar svg { position: absolute; left: 13px; color: var(--ag-muted); pointer-events: none; }
.b-buscar input {
  width: 100%; height: 44px; padding: 0 14px 0 40px; border-radius: 11px; box-sizing: border-box;
  border: 1px solid var(--ag-ctl-line); background: var(--ag-ctl); color: var(--ag-ink); font: inherit;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.b-buscar input::placeholder { color: var(--ag-muted); opacity: .85; }
.b-buscar input:focus-visible { outline: 2px solid var(--f-foco); outline-offset: 2px; }
.b-buscar-ico { display: none !important; }
@media (max-width: 1100px) { .b-buscar { display: none; } .b-buscar-ico { display: inline-flex !important; } }

/* sobretítulo y rótulos de la familia B */
.b-over { font-size: 11px; line-height: 16px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ag-muted); }
.b-cap { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ag-muted); }
.b-ink { color: var(--ag-ink); }
.b-link { font-weight: 650; text-decoration: none; }
.b-head .b-over { margin-bottom: 6px; }

/* ---------- Inicio ---------------------------------------------------- */
.b-inicio { display: grid; gap: 22px; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: stretch; }
.b-inicio > .b-heroe { grid-column: 1 / 8; }
.b-inicio > .b-cifras { grid-column: 8 / 13; }
.b-inicio > .b-atencion { grid-column: 1 / 6; }
.b-inicio > .b-seguir { grid-column: 6 / 13; }
.b-inicio > .b-libera { grid-column: 1 / 13; }
.b-inicio:not(:has(.b-atencion)) > .b-seguir { grid-column: 1 / 13; }
.b-inicio .ag-panel { display: flex; flex-direction: column; gap: 14px; }

.b-heroe { flex-direction: row !important; align-items: center; gap: 32px !important; padding: 28px 30px; }
.b-heroe-txt { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.b-titular { margin: 0; font-size: 34px; line-height: 40px; font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; }
.b-titular b { font-weight: 700; }
/* El titular lleva a la lista, pero se lee como titular: sin subrayado. Al apuntarlo
   o llegar con el teclado aparece, para que se note que se puede tocar. */
.b-titular a { color: inherit; text-decoration: none; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.b-titular a:hover, .b-titular a:focus-visible { text-decoration: underline; }
.b-acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.b-cifras { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.b-cifras > :last-child { grid-column: 1 / -1; }
.b-cifra { gap: 6px !important; padding: 18px 20px; color: var(--ag-ink); text-decoration: none; }
.b-cifra:hover { text-decoration: none; }
.b-num { font-size: 36px; line-height: 40px; font-weight: 400; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.b-cifra .estado { font-size: 13px; align-self: flex-start; }

.b-lista { display: flex; flex-direction: column; }
.b-aten { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--ag-line); color: var(--ag-ink); text-decoration: none; }
.b-aten:first-child { border-top: 0; padding-top: 2px; }
.b-aten:hover { text-decoration: none; }
.b-aten:hover b { text-decoration: underline; }
.b-aten > svg:last-child { color: var(--ag-muted); flex: none; }
.b-tono { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 11px; flex: none; }
.b-aten.mal .b-tono { color: var(--f-rechazo); background: color-mix(in srgb, var(--f-rechazo) 14%, transparent); }
.b-aten.info .b-tono, .b-aten.ok .b-tono { color: var(--f-hecho); background: color-mix(in srgb, var(--f-hecho) 14%, transparent); }
.b-aten-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.b-aten-txt .ag-muted { font-size: 13px; line-height: 18px; }

.b-seguir .fila-pend .ir { color: var(--ag-muted); }

.b-segs { display: flex; gap: 6px; text-decoration: none; }
.b-seg-col { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; gap: 5px; }
.b-seg-codigo { font-family: var(--font-mono); font-size: 11px; line-height: 14px; font-variant-numeric: tabular-nums; color: var(--ag-muted); text-align: center; overflow-wrap: anywhere; }
.b-seg { position: relative; flex: none; height: 30px; border-radius: 7px; background: var(--ag-track); overflow: hidden; }
.b-seg > span { position: absolute; left: 0; right: 0; bottom: 0; background: color-mix(in srgb, var(--f-hecho) 55%, transparent); }
.b-seg.listo > span { background: var(--f-firmado); }
.b-seg.trabado { background: color-mix(in srgb, var(--f-rechazo) 16%, transparent); box-shadow: inset 0 0 0 1.5px var(--f-rechazo); }
.b-seg.trabado > span { background: color-mix(in srgb, var(--f-rechazo) 35%, transparent); }
.b-pills { display: flex; flex-wrap: wrap; gap: 8px 14px; }

@media (max-width: 1240px) {
  .b-inicio > * { grid-column: 1 / 13 !important; }
  .b-cifras { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .b-cifras > :last-child { grid-column: auto; }
}
@media (max-width: 760px) {
  .b-inicio { gap: 16px; }
  .b-heroe { flex-direction: column !important; align-items: flex-start; gap: 18px !important; padding: 20px; }
  .b-heroe .ring { width: 112px !important; height: 112px !important; }
  .b-heroe .ring svg { width: 112px; height: 112px; }
  .b-heroe .ring .txt { font-size: 32px !important; }
  .b-titular { font-size: 26px; line-height: 32px; }
  .b-acciones .ag-btn { flex: 1 1 100%; }
  .b-cifras { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .b-cifras > :last-child { grid-column: 1 / -1; }
  .b-num { font-size: 30px; line-height: 34px; }
  .b-segs { gap: 4px; }
  .b-segs-muchos .b-seg-codigo { display: none; }
}

/* ---------- Protocolos: resumen con barra y pestañas por estado ---------- */
.b-resumen { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 32px; }
.b-res-num { display: flex; flex-direction: column; gap: 4px; flex: 0 1 180px; }
.b-res-num .b-num small { font-size: 15px; color: var(--ag-muted); }
.b-res-der { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.b-barra { display: flex; gap: 2px; height: 10px; border-radius: 99px; background: var(--ag-track); overflow: hidden; }
.b-barra > span { display: block; height: 100%; }
.b-barra .s-ok { background: var(--f-firmado-fill, var(--f-firmado)); }
.b-barra .s-rech { background: var(--f-rechazo); }
.b-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.b-tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 11px;
  border: 1px solid var(--ag-ctl-line); background: var(--ag-ctl); color: var(--ag-muted);
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
.b-tab:hover { text-decoration: none; color: var(--ag-ink); background: var(--ag-hover); }
.b-tab b { color: var(--ag-ink); font-variant-numeric: tabular-nums; }
.b-tab.on { color: var(--ag-ink); border-color: var(--ag-line2); background: var(--ag-ctl-on); }
.ag-light .b-tab.on { background: #fff; box-shadow: 0 2px 8px rgba(18, 44, 52, 0.1); }
.ag-light .b-app .b-tab .estado { padding: 0; background: none; }
@media (max-width: 760px) {
  .b-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .b-tabs::-webkit-scrollbar { display: none; }
}

/* ---------- cifras: vidrio neutro, el color va en un punto ---------------- */
/* En el diseño B las tarjetas de cifras no se pintan: el número va en tinta,
   el rótulo arriba como sobretítulo y la familia se dice con un punto de su
   color. Así lo único con color pleno en la pantalla son los estados y los
   avisos, que es lo que hay que mirar. La elegida (filtro activo) se marca
   con un borde más fuerte y relleno blanco, como las pestañas. */
.b-app :is(.kpi.tono-signal, .kpi.tono-ok, .kpi.tono-info, .kpi.tono-red, .kpi.tono-amb, .kpi.tono-neutro, .tar-firmas .tar) {
  border: 1px solid var(--ag-panel-line);
  background-color: var(--ag-panel);
  background-image: none;
  --ag-sombra: 0 1px 2px rgba(0, 0, 0, 0.06), 0 14px 34px rgba(0, 0, 0, 0.12);
  box-shadow: inset 0 1px 0 var(--ag-filo, rgba(255, 255, 255, 0.05)), var(--ag-sombra);
  border-radius: 20px;
}
.ag-light .b-app :is(.kpi.tono-signal, .kpi.tono-ok, .kpi.tono-info, .kpi.tono-red, .kpi.tono-amb, .kpi.tono-neutro, .tar-firmas .tar) {
  --ag-sombra: 0 1px 2px rgba(18, 44, 52, 0.05), 0 14px 34px rgba(18, 44, 52, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), var(--ag-sombra);
}
.b-app .kpi .v, .ag-light .b-app .kpi .v, .b-app .tar-firmas .tar .n { color: var(--ag-ink); }
.b-app .kpi .v { font-size: 36px; line-height: 40px; font-weight: 400; letter-spacing: -0.01em; }
.b-app .tar-firmas .tar .n { font-family: var(--font-sans); font-weight: 400; font-size: 32px; line-height: 36px; letter-spacing: -0.01em; }
.b-app .kpi .et, .ag-light .b-app .kpi .et {
  min-height: 0; color: var(--ag-muted); font-size: 11px; line-height: 16px; font-weight: 650;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.b-app .kpi .chip, .ag-light .b-app .kpi .chip {
  width: 8px; height: 8px; border-radius: 50%; background: var(--c); background-image: none; box-shadow: none;
}
.b-app .kpi .chip svg { display: none; }
.b-app .kpi.tono-neutro .chip { background: var(--ag-muted); }
.b-app .tar-firmas .tar .t { display: inline-flex; align-items: center; gap: 8px; }
.b-app .tar-firmas .tar:is(.f-avance, .f-curso, .f-hecho, .f-firmado, .f-espera, .f-rechazo, .rota) .t::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none;
}
.b-app .tar-firmas .tar.on, .b-app .kpi.on {
  border-color: var(--ag-line2); background-color: var(--ag-ctl-on);
  box-shadow: inset 0 0 0 1px var(--ag-line2), var(--ag-sombra);
}
.ag-light .b-app .tar-firmas .tar.on, .ag-light .b-app .kpi.on {
  background-color: #ffffff; border-color: var(--ag-ink);
  box-shadow: inset 0 0 0 1px var(--ag-ink), 0 2px 8px rgba(18, 44, 52, 0.1);
}

/* ---------- tablas densas: celdas más justas y texto largo en dos renglones ---------- */
/* El riel le saca 118 px al contenido. Para que las tablas densas no pidan
   scroll a 1440, la celda baja a 12 px de lado y el texto largo (el nombre
   del protocolo, la descripción) puede partirse en dos renglones. */
.b-app .ag-table th { padding: 10px 12px; }
.b-app .ag-table td { padding: 0 12px; height: 58px; }
.b-app .ag-table td.col-prosa, .b-app .ag-table th.col-prosa { white-space: normal; min-width: 180px; }
.b-app .ag-table td.col-prosa { padding-top: 8px; padding-bottom: 8px; line-height: 1.3; }

/* ---------- celular: las tablas se vuelven fichas ------------------------ */
/* Cada fila es una tarjeta de dos columnas y cada celda lleva arriba el
   rótulo de su columna (lo pone diseno-b.js desde el encabezado). La casilla
   de selección no va: en celular no se imprime por lote. */
@media (max-width: 760px) {
  .b-app .ag-title .sub { display: block; font-size: 15px; line-height: 20px; margin-top: 4px; }
  .b-app .tabla-caja:has(table.b-fichas) { overflow: visible; margin: 0; padding: 0; }
  .b-app table.b-fichas, .b-app table.b-fichas tbody { display: block; width: 100%; min-width: 0 !important; }
  .b-app table.b-fichas thead { display: none; }
  .b-app table.b-fichas tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px;
    padding: 14px 2px; border-bottom: 1px solid var(--ag-line); background: none !important; box-shadow: none !important;
  }
  .b-app table.b-fichas tr:last-child { border-bottom: 0; }
  .b-app table.b-fichas td {
    display: block; height: auto; min-width: 0; padding: 0; border: 0; white-space: normal;
    text-align: left !important; overflow-wrap: anywhere; background: none !important; box-shadow: none !important;
  }
  .b-app table.b-fichas td:empty, .b-app table.b-fichas:not([data-sel-tactil]) td.col-sel { display: none; }
  .b-app table.b-fichas[data-sel-tactil] td.col-sel { display: flex; align-items: center; grid-column: 1 / -1; }
  .b-app table.b-fichas td[data-r]::before {
    content: attr(data-r); display: block; margin-bottom: 3px;
    font-family: var(--font-sans); font-size: 11px; line-height: 16px; font-weight: 650;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--ag-muted);
  }
  /* El texto largo (el nombre del protocolo, la descripción) va a lo ancho. */
  .b-app table.b-fichas td.col-prosa, .b-app table.b-fichas td:not([data-r]) { grid-column: 1 / -1; }
  .b-app table.b-fichas td .ag-bar { min-width: 60px !important; }
  .b-app table.b-fichas:not(.tabla-protocolos, .tabla-firmas, .tabla-punch) td :is(span, div, b, a, small) { white-space: normal !important; text-overflow: clip !important; max-width: none !important; }
  .b-app table.b-fichas:not(.tabla-protocolos, .tabla-firmas, .tabla-punch) td :is(span, div):not(.ag-bar):not(.ag-bar *) { overflow: visible !important; }
  .b-app table.b-fichas td:is([data-r="Descripción"], [data-r="Protocolo"], [data-r="Instrumento"], [data-r="Subsistema"], [data-r="Cadena de firmas"], [data-r="Qué falta"]) { grid-column: 1 / -1; }
  .b-app table.b-fichas td .col-sec { display: block !important; }
}

/* ---------- estados de cada vista: vacío, error, sin permiso ------------- */
.b-app .vacio .ico { width: 56px; height: 56px; border-radius: 16px; }
.b-app .vacio .ico.b-t-warn { color: var(--f-espera); background: color-mix(in srgb, var(--f-espera) 16%, transparent); border-color: transparent; }
.b-app .vacio .ico.b-t-mal { color: var(--f-rechazo); background: color-mix(in srgb, var(--f-rechazo) 16%, transparent); border-color: transparent; }
.b-app .vacio p { margin: 0; max-width: 520px; }
.b-estado { margin-top: 8px; }
.b-estado .vacio { padding-block: 72px; }
.b-estado-tit { margin: 0; font-size: 22px; line-height: 28px; font-weight: 620; color: var(--ag-ink); text-wrap: balance; }
.b-estado-acc { justify-content: center; gap: 10px; margin-top: 6px; }
@media (max-width: 760px) {
  .b-estado .vacio { padding: 40px 4px; }
  .b-estado-acc { align-self: stretch; }
  .b-estado-acc .ag-btn, .b-app .vacio > .ag-btn { flex: 1 1 100%; }
}

/* ---------- perfil activo y perfiles adicionales (migración 22) ---------- */
.b-perfil { position: relative; display: inline-flex; align-items: center; }
.b-perfil svg { position: absolute; left: 12px; color: var(--ag-muted); pointer-events: none; }
.b-perfil select {
  height: 44px; padding: 0 34px 0 38px; border-radius: 11px; border: 1px solid var(--ag-ctl-line);
  background: var(--ag-ctl); color: var(--ag-ink); font: inherit; font-weight: 650; cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat;
}
.b-perfil select:focus-visible { outline: 2px solid var(--f-foco); outline-offset: 2px; }
.b-extras { margin-top: 6px; font-size: 13px; }
.b-extras summary { cursor: pointer; color: var(--ag-link); font-weight: 600; white-space: nowrap; }
.b-extras-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--ag-line); background: var(--ag-card); }
.b-extras-form label { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.b-extras-form .ag-btn { align-self: flex-start; margin-top: 4px; }
@media (max-width: 760px) {
  .b-perfil { order: 4; flex: 1 1 100%; }
  .b-perfil select { width: 100%; }
}

/* ---------- movimiento y respuesta al puntero -------------------------- */
/* Sin esta preferencia no agregamos movimiento ni escondemos contenido.
   El toque tiene respuesta al apretar; el realce al pasar queda para mouse. */
@media (prefers-reduced-motion: no-preference) {
  .ag-root :is(.ag-btn, .ag-icon, .b-tab, .tabbar a, .b-nav a) {
    transition: background-color 120ms ease-out, transform 80ms ease-out;
  }
  .ag-root :is(.ag-btn, .ag-icon, .b-tab, .tabbar a, .b-nav a):active:not(:disabled):not([aria-disabled="true"]) {
    transform: translateY(1px) scale(.98);
  }

  /* El arco lo interpola GSAP: otra transición encima atrasaría el avance. */
  .b-app .ring .arco { transition: none; }

  /* Anulamos el hover heredado en pantallas táctiles, donde puede quedar pegado. */
  @media (hover: none) {
    .b-app a.kpi:hover, .b-app .tar-firmas a.tar:hover { transform: none; }
  }

  @media (hover: hover) {
    .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy, a.b-aten, a.fila-pend) {
      transition: transform 160ms ease-out, box-shadow 160ms ease-out;
    }
    .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy, a.b-aten, a.fila-pend):hover {
      transform: translateY(-2px);
    }
    /* Repetimos el filo y la sombra del vidrio; la última capa la alarga.
       La tarjeta de proyecto contiene los enlaces Entrar y Editar. */
    .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy):hover {
      box-shadow: inset 0 1px 0 var(--ag-filo, rgba(255, 255, 255, 0.05)), var(--ag-sombra), 0 20px 40px -20px rgba(0, 0, 0, 0.16);
    }
    .ag-light .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy):hover {
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), var(--ag-sombra), 0 20px 40px -20px rgba(18, 44, 52, 0.12);
    }
    /* El filtro activo conserva su borde interior, también al levantarlo. */
    .b-app :is(a.kpi.on, .tar-firmas a.tar.on):hover {
      box-shadow: inset 0 0 0 1px var(--ag-line2), var(--ag-sombra), 0 20px 40px -20px rgba(0, 0, 0, 0.16);
    }
    .ag-light .b-app :is(a.kpi.on, .tar-firmas a.tar.on):hover {
      box-shadow: inset 0 0 0 1px var(--ag-ink), 0 2px 8px rgba(18, 44, 52, 0.1), 0 20px 40px -20px rgba(18, 44, 52, 0.12);
    }
    /* Estas filas no tenían sombra: alcanza con una capa tenue al pasar. */
    .b-app :is(a.b-aten, a.fila-pend):hover { box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.18); }
    .ag-light .b-app :is(a.b-aten, a.fila-pend):hover { box-shadow: 0 8px 18px -12px rgba(18, 44, 52, 0.14); }

    .ag-root .tabbar a:not(.on):hover { background-color: var(--ag-hover); }
    .b-app .b-link {
      text-decoration: none;
      background-image: linear-gradient(currentColor, currentColor);
      background-position: left bottom;
      background-repeat: no-repeat;
      background-size: 0 1px;
      transition: background-size 200ms ease-out;
    }
    .b-app .b-link:hover { text-decoration: none; background-size: 100% 1px; }

    /* El marco recorta la foto, así el zoom no tapa texto ni tarjetas vecinas. */
    .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy a, a.b-aten, a.fila-pend):has(img),
    .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy a, a.b-aten, a.fila-pend) :has(> img) { overflow: hidden; }
    .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy a, a.b-aten, a.fila-pend) img { transition: transform 160ms ease-out; }
    .b-app :is(a.kpi, a.b-cifra, .tar-firmas a.tar, .proys .proy a, a.b-aten, a.fila-pend):hover img { transform: scale(1.02); }
  }
}

/* ---------- Inicio: cuatro hijos, cuatro columnas ----------------------- */
.b-seguir .fila-pend { grid-template-columns: 30px minmax(0, 1fr) auto 20px; }
.b-seguir .fila-pend .qu b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-seguir .fila-pend .av {
  display: flex; width: clamp(60px, 12vw, 170px); max-width: 170px; min-width: 0;
}
.b-seguir .fila-pend .av .ag-bar { flex: 1; min-width: 0; }
.b-seguir .fila-pend .ir { min-width: 0; justify-self: end; }

/* ---------- Tipografía: TAG y códigos en Sofia Sans Semi Condensed ------------------------------------- */
.ag-mono, .ag-table td, .ctrl-f > .num, .ctrl-f .val .inp, .ctrl-f .val .u,
.ren .nro, .val .inp, .val .u, .tar-firmas .tar .n, .inp.cod, .codigo, code.en,
.proy .mini b, .ss .l1 b, .ss .aviso-n, .gi-leyenda b, .ag-esp, .ag-proj,
.ag-nav .n, .ag-btn .k {
  font-variant-numeric: tabular-nums;
}
.ag-mono { letter-spacing: 0.01em; }

/* Los anclajes (#p162, #firmas, #c3…) caen debajo de la cabecera fija, no tapados por ella.
   --alto-cabecera la mide public/assure/diseno-b.js. */
html { scroll-padding-top: calc(var(--alto-cabecera, 0px) + 12px); }

/* ===== Jerarquía de controles (22/11) =====================================
   Cinco niveles, cada uno con una sola forma, para que no se confunda un botón
   con una pestaña ni con un cartel:
   1. Acción principal: relleno, una por panel. «Firmar» y «Emitir» también: el
      verde queda para los estados («Firmado»), no para los botones.
   2. Acción secundaria: con borde (.ag-btn tal cual).
   3. Acción de fila: dentro de una tabla, texto de color sin borde; lo que borra
      queda gris hasta que se apunta.
   4. Pestañas y filtros: subrayado bajo la opción elegida, nunca forma de botón.
   5. Carteles: pastilla de color sin borde; la especialidad, una letra de color
      sin caja. No reaccionan al pasar el mouse. */

/* 1 · una sola forma para la acción principal */
.b-app .ag-btn.ok, .ag-light .b-app .ag-btn.ok { background: var(--ag-pri); border-color: var(--ag-pri); color: var(--ag-pri-ink); }
.b-app .ag-btn.ok:hover { background: var(--ag-pri-hover); filter: none; }

/* 3 · acciones de fila */
.b-app .ag-table td .ag-btn.sm:not(.pri):not(.ok):not(.on) {
  background: transparent; border-color: transparent; color: var(--ag-link); padding: 0 8px;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.b-app .ag-table td .ag-btn.sm.danger { color: var(--ag-red); }
.b-app .ag-table td .ag-btn.sm:not(.pri):not(.ok):not(.on):hover { background: var(--ag-hover); text-decoration: none; }
.b-app .ag-table td .ag-icon { background: transparent; border-color: transparent; color: var(--ag-muted); backdrop-filter: none; -webkit-backdrop-filter: none; }
.b-app .ag-table td .ag-icon:hover { background: var(--ag-hover); color: var(--ag-ink); }
.b-app .ag-table td .ag-icon.danger:hover, .b-app .ag-table td .ag-icon.danger:focus-visible {
  color: var(--ag-red); background: color-mix(in srgb, var(--ag-red) 12%, transparent);
}

/* 4 · pestañas (b-tabs) y filtros segmentados (ag-seg): subrayado */
.b-app .b-tabs { gap: 2px 22px; border-bottom: 1px solid var(--ag-line2); }
.b-app .b-tab, .ag-light .b-app .b-tab {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; box-shadow: none;
  padding: 0 2px; margin-bottom: -1px; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.b-app .b-tab:hover { background: none; color: var(--ag-ink); }
.b-app .b-tab.on, .ag-light .b-app .b-tab.on { background: none; box-shadow: none; border-bottom-color: var(--ag-ink); color: var(--ag-ink); }
.b-app .b-tab .estado { padding: 0; background: none; }
.b-app .ag-seg {
  gap: 18px; padding: 0; border: 0; border-bottom: 1px solid var(--ag-line2); border-radius: 0;
  background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.b-app .ag-seg > button, .b-app .ag-seg > a, .b-app .ag-seg > .ag-btn {
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; box-shadow: none;
  padding: 0 2px; margin-bottom: -1px; min-height: 40px; height: auto; display: inline-flex; align-items: center;
  color: var(--ag-muted); font-weight: 600; text-decoration: none;
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
.b-app .ag-seg > :hover { background: none; color: var(--ag-ink); }
.b-app .ag-seg > .on, .b-app .ag-seg > [aria-selected="true"], .b-app .ag-seg > [aria-pressed="true"], .b-app .ag-seg > [aria-current] {
  background: none; color: var(--ag-ink); border-bottom-color: var(--ag-ink);
}

/* 5 · carteles: un chip que no se toca es una pastilla, no un botón */
.b-app span.ag-chip:not(:is(a, label, button) *) {
  height: auto; min-height: 24px; padding: 2px 10px; border-color: transparent; border-radius: 99px;
  background: var(--ag-track); font-size: 13px; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.b-app .ag-esp { width: auto; min-width: 16px; height: auto; border: 0; border-radius: 0; background: none; font-weight: 700; }

/* ===== Navegación en cinco secciones (22/11, propuesta C) ===================
   La barra muestra Inicio, Protocolos, Subsistemas, Indicadores e Ingeniería. Las que
   tienen más de una pantalla abren un menú chico; adentro, las mismas pantallas van como
   subpestañas debajo del título (.b-subnav, el mismo subrayado que pestañas y filtros). */
.b-app .ag-top .b-nav { overflow: visible; }
.b-app .b-secc { position: relative; }
.b-app .b-secc > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 0 12px 0 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ag-nav);
}
.b-app .b-secc > summary::-webkit-details-marker { display: none; }
.b-app .b-secc > summary:hover { color: var(--ag-ink); background: var(--ag-hover); }
.b-app .b-secc > summary.on { background: var(--ag-ctl-on); color: var(--ag-ink); }
.ag-light .b-app .b-secc > summary.on { background: var(--ag-pri); color: var(--ag-pri-ink); }
.b-app .b-secc > summary:focus-visible { outline: 2px solid var(--ag-blue); outline-offset: 2px; }
.b-app .b-secc-chev { display: inline-flex; opacity: .7; transition: transform .15s ease; }
.b-app .b-secc[open] .b-secc-chev { transform: rotate(180deg); }
.b-app .b-secc-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; min-width: 210px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: 14px;
  background: var(--ag-page, #0b0d10); border: 1px solid var(--ag-panel-line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.ag-light .b-app .b-secc-menu { background: #fff; box-shadow: 0 16px 40px rgba(18, 44, 52, 0.16); }
.b-app .b-nav .b-secc-menu a {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px;
  padding: 0 12px; border-radius: 10px; color: var(--ag-ink); font-weight: 600;
}
.b-app .b-nav .b-secc-menu a:hover { background: var(--ag-hover); }
.b-app .b-nav .b-secc-menu a.on, .ag-light .b-app .b-nav .b-secc-menu a.on { background: var(--ag-ctl-on); color: var(--ag-ink); }
.b-app .b-punto { width: 7px; height: 7px; border-radius: 50%; background: var(--ag-amb, #f59f00); flex: none; }
/* Subpestañas: mismo subrayado que .ag-seg, un poco más pegadas al título. */
.b-app .b-subnav { margin-top: -8px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.b-app .b-subnav::-webkit-scrollbar { display: none; }
.b-app .b-subnav > a { white-space: nowrap; gap: 6px; }
.b-app .b-subnav .n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--ag-muted); }
/* Tablet y celular: dentro de un proyecto la barra de abajo trae las cinco secciones, así
   que el resto (configuración, cambiar de proyecto) vuelve al botón ☰ de arriba. */
@media (max-width: 1100px) {
  .ag-root:has(.tabbar-secciones) .b-app .ag-top .menu-btn { display: inline-flex; }
}
/* Cinco secciones en un celular de 375 px: unos 67 px por botón. */
.tabbar-secciones a { padding-inline: 2px; letter-spacing: -0.01em; }

/* ===== Celular: cabecera de un solo renglón (22/11) ===========================
   Eran tres renglones fijos (unos 190 px): un cuarto de la pantalla tapado todo el tiempo.
   Queda ☰, el logo, el proyecto y buscar; el tema, la cuenta, el perfil y salir están en ☰. */
@media (max-width: 760px) {
  .b-app .ag-top { flex-wrap: nowrap; padding: 6px 8px; gap: 6px; }
  .b-app .ag-top .ag-word { display: none; }
  .b-app .ag-top .ag-brand { margin-right: 0; flex: none; }
  .b-app .ag-top .ag-proj { order: 0; flex: 0 1 auto; min-width: 0; }
  .b-app .ag-top .right { margin-left: auto; gap: 6px; flex: none; }
  .b-app .ag-top #tema, .b-app .ag-top .ag-avatar, .b-app .ag-top .right form[action="/logout"],
  .b-app .ag-top .b-perfil, .b-app .ag-top a[href="/cambiar-empresa"] { display: none !important; }
}
.sheet .caja .hoja-perfil { padding: 4px 14px 8px; }

/* ---------- celular: listas compactas y controles plegables ---------- */
@media (min-width: 761px) {
  .b-app details[data-pliegue-celular],
  .b-app .b-acciones-contenido, .b-app .b-filtros-contenido { display: contents; }
  .b-app details[data-pliegue-celular]::details-content { display: contents; }
  .b-app details[data-pliegue-celular] > summary { display: none; }
}
@media (max-width: 760px) {
  .b-app details[data-pliegue-celular] > summary {
    min-height: 44px; list-style: none; cursor: pointer;
  }
  .b-app details[data-pliegue-celular] > summary::-webkit-details-marker { display: none; }
  .b-app .b-acciones-mas { position: relative; margin-left: auto; order: 1; }
  .b-app .b-acciones-mas > summary { min-width: 44px; padding: 0 12px; font-size: 24px; }
  .b-app .b-acciones-contenido {
    position: absolute; z-index: 20; right: 0; top: calc(100% + 6px);
    display: flex; flex-direction: column; gap: 6px; padding: 8px;
    width: max-content; max-width: calc(100vw - 40px);
    background: var(--ag-card); border: 1px solid var(--ag-line); border-radius: 12px;
  }
  .b-app .b-acciones-contenido .ag-btn { min-height: 44px; justify-content: flex-start; }
  .b-app .filtros:has(> .b-filtros-mas), .b-app .b-buscar-punch {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%;
  }
  .b-app .b-buscar-punch > .buscar { grid-column: 1; grid-row: 1; }
  .b-app .b-filtros-mas { min-width: 0; }
  .b-app .b-filtros-mas:not([open]) { grid-column: 2; grid-row: 1; }
  .b-app .b-filtros-mas[open] { grid-column: 1 / -1; }
  .b-app .b-filtros-contenido {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px;
  }
  .b-app .b-filtros-contenido > :is(.selcap, .campo) { flex: 1 1 100%; }
  .b-app .filtros:has(.b-filtros-mas) :is(.inp, .ag-btn),
  .b-app .ag-acts:has(.b-acciones-mas) > .ag-btn,
  .b-app .b-filtros-contenido :is(.inp, .sel, .chipf, .ag-btn) { min-height: 44px; }
  .b-app .b-cifras-tira {
    grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: 140px;
    overflow-x: auto; scroll-snap-type: x proximity; gap: 10px; padding-bottom: 8px;
  }
  .b-app .b-cifras-tira > .tar { scroll-snap-align: start; min-width: 0; padding: 12px; }
  .b-app #encabezado > .cuerpo > .b-datos-equipo { order: 1; }
  .b-app .b-datos-equipo > .portada { margin-top: 10px; }
  .b-app #encabezado :is(.inp, .ta, .ag-btn, summary) { min-height: 44px; }
  .b-app .b-heroe .b-acciones .ag-btn { min-height: 44px; }
  .b-app .b-inicio-dossier { display: none; }

  /* Sólo estas tres listas reemplazan el esquema general con rótulos.
     La fila expandida de Punch sigue siendo un bloque completo. */
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas, .tabla-punch) > tbody > tr:not(.fila-edit) {
    gap: 2px 6px; padding: 6px 0; align-items: center;
  }
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas, .tabla-punch) > tbody > tr > td::before { display: none; }
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas, .tabla-punch) > tbody > tr:not(.fila-edit) > td {
    min-width: 0; font-size: 12px; line-height: 18px;
  }
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas) .col-tag .fila-link {
    display: flex; align-items: center; min-height: 44px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas) td.col-proto {
    grid-area: proto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas, .tabla-punch) td.col-tag { grid-area: tag; }
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas, .tabla-punch) td.col-estado {
    grid-area: estado; justify-self: end; text-align: right !important;
  }
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas, .tabla-punch) .col-estado :is(.estado, .ag-chip) {
    max-width: 136px; white-space: normal !important; overflow-wrap: anywhere;
  }
  .b-app table.b-fichas.tabla-protocolos .col-estado .ag-chip { height: auto; min-height: 24px; }
  .b-app table.b-fichas.tabla-protocolos > tbody > tr {
    grid-template-columns: 44px minmax(0, 1fr) auto auto;
    grid-template-areas: "sel tag tag estado" "proto proto proto proto" "sub sub esp avance";
  }
  .b-app table.b-fichas.tabla-protocolos:not([data-sel-tactil]) > tbody > tr {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "tag tag estado" "proto proto proto" "sub esp avance";
  }
  .b-app table.b-fichas.tabla-protocolos td.col-sel { grid-area: sel; }
  .b-app table.b-fichas.tabla-protocolos .fila-check { width: 44px; height: 44px; margin: 0; }
  .b-app table.b-fichas.tabla-protocolos td.col-esp { grid-area: esp; }
  .b-app table.b-fichas.tabla-protocolos .col-esp .ag-esp {
    width: auto; height: auto; border: 0; background: none; font-size: 11px;
  }
  .b-app table.b-fichas.tabla-protocolos .col-esp .ag-esp::before { content: "·"; margin-right: 6px; }
  .b-app table.b-fichas.tabla-protocolos td.col-sub { grid-area: sub; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .b-app table.b-fichas.tabla-protocolos td.col-avance { grid-area: avance; justify-self: end; }
  .b-app table.b-fichas.tabla-protocolos td.col-avance .fila { gap: 4px !important; }
  .b-app table.b-fichas.tabla-protocolos td.col-avance .ag-bar { min-width: 32px !important; width: 32px; }
  .b-app table.b-fichas.tabla-protocolos td.col-carga { display: none; }

  .b-app table.b-fichas.tabla-firmas > tbody > tr {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .8fr);
    grid-template-areas: "tag tag estado" "proto proto proto" "calidad inspeccion sub";
  }
  .b-app table.b-fichas.tabla-firmas td.col-esp { display: none; }
  .b-app table.b-fichas.tabla-firmas td.col-calidad { grid-area: calidad; }
  .b-app table.b-fichas.tabla-firmas td.col-inspeccion { grid-area: inspeccion; }
  .b-app table.b-fichas.tabla-firmas td.col-sub { grid-area: sub; font-size: 11px; }
  .b-app table.b-fichas.tabla-firmas .qfirmo { display: block; min-width: 0; }
  .b-app table.b-fichas.tabla-firmas .qfirmo > * {
    display: block; font-size: 11px; line-height: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  .b-app table.b-fichas.tabla-punch > tbody > tr:not(.fila-edit) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "codigo estado" "descripcion descripcion" "tag resp" "acciones acciones";
    cursor: pointer; padding-block: 3px; gap: 2px 6px;
  }
  .b-app table.b-fichas.tabla-punch td.col-codigo { grid-area: codigo; font-weight: 700; }
  .b-app table.b-fichas.tabla-punch td.col-descripcion { grid-area: descripcion; }
  .b-app table.b-fichas.tabla-punch .col-descripcion > .lin:first-child {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
    white-space: normal; overflow: hidden; line-height: 18px;
  }
  .b-app table.b-fichas.tabla-punch .col-descripcion > .lin + .lin,
  .b-app table.b-fichas.tabla-punch .col-tag > .lin + .lin,
  .b-app table.b-fichas.tabla-punch td.col-compromiso { display: none; }
  .b-app table.b-fichas.tabla-punch td.col-resp { grid-area: resp; }
  .b-app table.b-fichas.tabla-punch .col-resp .lin::before { content: "· "; }
  .b-app table.b-fichas.tabla-punch :is(.col-tag, .col-resp) .lin {
    display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .b-app table.b-fichas.tabla-punch td.acc {
    grid-area: acciones; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
  }
  .b-app table.b-fichas.tabla-punch td.acc > * + * { margin-left: 0; }
  .b-app table.b-fichas.tabla-punch td.acc .ag-btn { min-height: 44px; padding-inline: 8px; }
  .b-app table.b-fichas.tabla-punch > tbody > tr.fila-edit { display: block; padding: 12px 0; }
  .b-app table.b-fichas.tabla-punch > tbody > tr.fila-edit > td { display: block; width: 100%; }
}

/* ---------- administrador: alta, estados y acciones de fila ---------- */
.b-app .b-usuarios-alta { gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.b-app .b-usuarios-alta > .campo { min-width: 180px; }
.b-app .b-usuarios-empresa { flex: 1 1 280px; }
.b-app .b-usuarios-perfil { width: 190px; }
.b-app .b-usuarios-alta small { font-size: 13px; }
.b-usuarios-filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.b-usuarios-filtros[hidden], #tUsuarios tr[hidden] { display: none; }
.b-usuarios-filtros > .campo { flex: 1 1 220px; }
.b-usuarios-filtros > p { margin: 0 0 10px; }
.b-app #tUsuarios .b-estado-tranquilo { color: var(--ag-muted); background: transparent; }
.b-app #tUsuarios .b-estado-atencion { color: var(--ag-amb); background: var(--f-espera-soft); }
.b-app #tUsuarios .b-estado-error { color: var(--ag-red); background: var(--f-rechazo-soft); }
/* El menú flota sobre la tabla sin estirar la fila; mientras está abierto, la caja
   de la tabla deja ver lo que sobresale para que no se recorte en las últimas filas. */
.b-app .b-mas { display: inline-block; vertical-align: middle; text-align: left; position: relative; }
.b-app .tabla-caja:has(.b-mas[open]) { overflow: visible; }
.b-app .b-mas > summary { cursor: pointer; color: var(--ag-link); padding: 8px; font-size: 13px; }
.b-app .b-mas > summary:focus-visible { outline: 2px solid var(--f-foco); outline-offset: 2px; border-radius: 4px; }
.b-app .b-mas-menu { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 180px; padding: 6px; border: 1px solid var(--ag-line); border-radius: 10px; background: var(--ag-page); box-shadow: 0 12px 32px rgba(0,0,0,.35); }
.b-app #tUsuarios .b-mas-menu form { display: block; margin: 0; }
.b-app #tUsuarios .b-mas-menu .ag-btn { width: 100%; justify-content: flex-start; white-space: nowrap; }
.b-app #tUsuarios .b-mas-menu .ag-btn.danger { color: var(--ag-red); }
@media (max-width: 640px) {
  .b-app .b-usuarios-alta { flex-direction: column; align-items: stretch; }
  .b-app .b-usuarios-alta > .campo,
  .b-app .b-usuarios-alta > button { width: 100%; min-width: 0; flex: none; box-sizing: border-box; }
  .b-app .b-usuarios-alta .inp,
  .b-app .b-usuarios-alta .sel { width: 100%; min-width: 0; box-sizing: border-box; }
}

/* ---------- Inicio en una sola pantalla (escritorio) ----------------------
   En escritorio el Inicio entra entero, sin scroll: saludo en un renglón, avance y
   cifras compactos, las dos listas se quedan con el alto que sobra (diseno-b.js
   esconde las filas que no entran enteras y suma su cuenta al «Y N más») y la
   tira de liberación abajo. En tablet y celular sigue la página con scroll. */
.b-saludo-linea { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.b-mas-pend[hidden], .b-mas-avisos[hidden] { display: none; }
.b-mas-avisos { align-self: flex-start; padding: 0; border: 0; background: none; color: var(--ag-link); font: inherit; font-size: 14px; cursor: pointer; }
@media (min-width: 1100px) and (min-height: 740px) {
  .b-app .ag-main:has(> .b-inicio) { gap: 16px; padding-bottom: 24px; }
  .b-saludo { min-height: 0; }
  .b-saludo-linea .ag-title { font-size: 30px; line-height: 36px; order: 1; }
  .b-saludo-linea .b-over { order: 2; margin: 0; }

  .b-inicio {
    gap: 16px;
    height: calc(100dvh - var(--alto-cabecera, 0px) - 26px - 40px - 16px - 24px);
    min-height: 480px;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .b-inicio > .b-heroe { grid-column: 1 / 7 !important; grid-row: 1; }
  .b-inicio > .b-cifras { grid-column: 7 / 13 !important; grid-row: 1; }
  .b-inicio > .b-atencion { grid-column: 1 / 6 !important; grid-row: 2; }
  .b-inicio > .b-seguir { grid-column: 6 / 13 !important; grid-row: 2; }
  .b-inicio:not(:has(.b-atencion)) > .b-seguir { grid-column: 1 / 13 !important; }
  .b-inicio > .b-libera { grid-column: 1 / 13 !important; grid-row: 3; }

  .b-heroe { padding: 18px 24px; gap: 24px !important; }
  .b-heroe .ring { width: 128px !important; height: 128px !important; }
  .b-heroe .ring svg { width: 128px; height: 128px; }
  .b-heroe .ring .txt { font-size: 36px !important; }
  .b-heroe-txt { gap: 6px; }
  .b-titular { font-size: 28px; line-height: 34px; }
  .b-acciones { margin-top: 4px; }

  .b-cifras { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .b-cifras > :last-child { grid-column: auto; }
  .b-cifra { padding: 14px 16px; gap: 4px !important; }
  .b-num { font-size: 32px; line-height: 36px; }

  .b-atencion, .b-seguir { min-height: 0; overflow: hidden; gap: 10px !important; }
  .b-atencion > .b-lista, .b-seguir > .pend { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  .b-atencion.b-aten-todos > .b-lista { overflow: auto; }
  .b-aten { padding: 8px 4px; }
  .b-tono { width: 30px; height: 30px; border-radius: 9px; }
  .b-aten-txt .ag-muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .b-seguir .fila-pend { padding: 8px 10px; }
  .b-mas-pend { margin: 0 !important; }

  .b-libera { display: grid !important; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px 20px !important; padding: 14px 20px; }
  .b-libera > .b-libera-cab { grid-column: 1; grid-row: 1; gap: 16px; }
  .b-libera > .b-pills { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .b-libera > .b-segs { grid-column: 1 / -1; grid-row: 2; }
  .b-libera .b-seg { height: 22px; border-radius: 6px; }
  .b-libera .b-seg-col { gap: 3px; }
}
/* Notebook con la barra del navegador (≈ 1512×790): un escalón más compacto para que
   las listas conserven tres o cuatro filas. */
@media (min-width: 1100px) and (min-height: 740px) and (max-height: 860px) {
  .b-heroe { padding: 14px 20px; gap: 20px !important; }
  .b-heroe .ring { width: 104px !important; height: 104px !important; }
  .b-heroe .ring svg { width: 104px; height: 104px; }
  .b-heroe .ring .txt { font-size: 30px !important; }
  .b-titular { font-size: 24px; line-height: 30px; }
  .b-heroe .b-acciones .ag-btn { min-height: 38px; height: 38px; }
  .b-cifra { padding: 10px 14px; }
  .b-num { font-size: 28px; line-height: 32px; }
  .b-atencion, .b-seguir { padding-top: 14px; padding-bottom: 14px; }
  .b-aten { padding: 6px 4px; }
  .b-seguir .fila-pend { padding: 6px 10px; }
  .b-libera { padding: 10px 20px; gap: 8px 20px !important; }
  .b-libera .b-seg { height: 16px; }
}

/* ---------- Inicio en una pantalla: tablet apaisada y ventanas medianas ----------
   Entre 761 y 1099 px de ancho (con la barra de secciones abajo) el Inicio también
   entra entero si hay 600 px de alto: avance en una franja, cifras en tres fichas
   chicas, las listas lado a lado sin la barrita de avance y la tira sin códigos. */
@media (min-width: 761px) and (max-width: 1099.98px) and (min-height: 600px) {
  .b-app .ag-main:has(> .b-inicio) { gap: 12px; padding-bottom: 88px; }
  .b-saludo-linea .ag-title { font-size: 24px; line-height: 30px; order: 1; }
  .b-saludo-linea .b-over { order: 2; margin: 0; }

  .b-inicio {
    gap: 10px;
    height: calc(100dvh - var(--alto-cabecera, 0px) - 20px - 30px - 12px - 92px);
    min-height: 420px;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }
  .b-inicio > .b-heroe { grid-column: 1 / 13 !important; grid-row: 1; }
  .b-inicio > .b-cifras { grid-column: 1 / 13 !important; grid-row: 2; }
  .b-inicio > .b-atencion { grid-column: 1 / 6 !important; grid-row: 3; }
  .b-inicio > .b-seguir { grid-column: 6 / 13 !important; grid-row: 3; }
  .b-inicio:not(:has(.b-atencion)) > .b-seguir { grid-column: 1 / 13 !important; }
  .b-inicio > .b-libera { grid-column: 1 / 13 !important; grid-row: 4; }
  .b-inicio .ag-panel { gap: 8px; }

  .b-heroe { flex-direction: row !important; align-items: center; padding: 10px 16px; gap: 16px !important; }
  .b-heroe .ring { width: 72px !important; height: 72px !important; }
  .b-heroe .ring svg { width: 72px; height: 72px; }
  .b-heroe .ring .txt { font-size: 22px !important; }
  .b-heroe-txt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 14px; flex: 1; }
  .b-heroe-txt > .b-over { grid-column: 1 / -1; }
  .b-titular { font-size: 20px; line-height: 26px; }
  .b-heroe .b-acciones { margin: 0; flex-wrap: nowrap; }
  .b-heroe .b-acciones .ag-btn { height: 36px; min-height: 36px; flex: none; }
  .b-inicio-dossier { display: none !important; }

  .b-cifras { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .b-cifras > :last-child { grid-column: auto; }
  .b-cifra { display: grid !important; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 10px !important; padding: 8px 12px; }
  .b-cifra > .b-over { grid-column: 1 / -1; }
  .b-cifra .b-num { font-size: 24px; line-height: 28px; }
  .b-cifra .b-cap { display: none; }
  .b-cifra .estado { font-size: 12px; justify-self: start; }

  .b-atencion, .b-seguir { min-height: 0; overflow: hidden; padding: 12px 14px; }
  .b-atencion > .b-lista, .b-seguir > .pend { flex: 1 1 auto; min-height: 0; overflow: hidden; }
  .b-atencion.b-aten-todos > .b-lista { overflow: auto; }
  .b-aten { padding: 5px 2px; gap: 10px; }
  .b-aten b { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .b-tono { width: 26px; height: 26px; border-radius: 8px; }
  .b-aten-txt .ag-muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; line-height: 16px; }
  .b-seguir .fila-pend { padding: 5px 6px; gap: 10px; grid-template-columns: 22px minmax(0, 1fr) auto 14px; }
  .b-seguir .fila-pend .qu span { font-size: 12px; }
  .b-seguir .fila-pend .av { width: auto; }
  .b-seguir .fila-pend .av .ag-bar { display: none; }
  .b-mas-pend { margin: 0 !important; font-size: 13px !important; }

  .b-libera { display: grid !important; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 14px !important; padding: 10px 14px; }
  .b-libera > .b-libera-cab { grid-column: 1; grid-row: 1; gap: 12px; }
  .b-libera > .b-pills { grid-column: 2; grid-row: 1; justify-content: flex-end; font-size: 12px; }
  .b-libera > .b-segs { grid-column: 1 / -1; grid-row: 2; gap: 4px; }
  .b-libera .b-seg { height: 10px; border-radius: 4px; }
  .b-libera .b-seg-codigo { display: none; }
}

/* Subsistemas y Catálogo */
.b-app .ag-btn:is(:disabled,[aria-disabled="true"]),
.b-app .ag-btn:is(.ok,.pri):is(:disabled,[aria-disabled="true"]),
.ag-light .b-app .ag-btn:is(:disabled,[aria-disabled="true"]),
.ag-light .b-app .ag-btn:is(.ok,.pri):is(:disabled,[aria-disabled="true"]) {
  background: var(--ag-ctl); border-color: var(--ag-ctl-line); color: var(--ag-muted);
  cursor: not-allowed; box-shadow: none; filter: none;
}
.b-app .sub-detalle > nav { padding: 10px; min-width: 0; }
.b-app #detalle { scroll-margin-top: calc(var(--alto-cabecera, 0px) + 12px); }
.b-app .b-mas-menu form { display: block; margin: 0; }
.b-app .b-mas-menu .ag-btn { width: 100%; justify-content: flex-start; white-space: nowrap; }
.b-app .b-mas-menu .ag-btn.danger { color: var(--ag-red); }
.b-app .acta-mas .b-mas-menu { min-width: 280px; padding: 12px; }
.b-app .acta-mas textarea { width: 100%; height: auto; }
.b-app .acta-mas .ag-btn { margin-top: 10px; }
.b-app .aviso strong { display: inline; font-weight: 600; }
.b-app .acta-fase { font-size: 12px; margin-top: 4px; }
.b-app #tctrl [aria-disabled="true"] { pointer-events: none; color: var(--ag-muted); background: var(--ag-ctl); }
.b-app #tctrl [hidden], .b-app [data-catalogo-filtros][hidden],
.b-app [data-catalogo-panel][hidden], .b-app #catalogo-vacio[hidden],
.b-app table.tabla-catalogo > tbody > tr[hidden] { display: none; }
.b-app .catalogo-movil { display: none; }
.b-app .catalogo-origen { font-size: 12px; }
.b-app .tabla-catalogo .col-titulo > .fila { flex-wrap: wrap; }
@media (min-width: 901px) {
  .b-app .sub-detalle > nav {
    position: sticky; top: calc(var(--alto-cabecera, 0px) + 12px);
    max-height: calc(100dvh - var(--alto-cabecera, 0px) - 24px); overflow-y: auto; align-self: start;
  }
}
@media (max-width: 900px) {
  .b-app .sub-detalle > nav { padding: 0; }
  .b-app .sub-detalle > nav .ss { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; }
  .b-app .sub-detalle > nav .ss > a { min-width: 200px; width: 240px; flex: none; scroll-snap-align: center; }
  /* En la tira la barra quedaba inline y su relleno se veía como un bloque alto. */
  .b-app .sub-detalle > nav .ss .ag-bar { display: block; flex: none; }
}
@media (max-width: 640px) {
  .b-app .acta-mas { flex-basis: 100%; }
  .b-app .acta-mas .b-mas-menu { position: static; min-width: min(280px, 100%); width: 100%; box-sizing: border-box; }
  .b-app table.tabla-catalogo, .b-app table.tabla-catalogo > tbody { display: block; width: 100%; min-width: 0; }
  .b-app table.tabla-catalogo > thead { display: none; }
  .b-app table.tabla-catalogo > tbody > tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "codigo titulo acciones" "fase fase acciones";
    gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--ag-line);
  }
  .b-app table.tabla-catalogo > tbody > tr > td {
    display: block; grid-column: auto; min-width: 0; padding: 0; height: auto; border: 0;
    white-space: normal; overflow-wrap: anywhere; text-align: left;
  }
  .b-app table.tabla-catalogo > tbody > tr > td::before { display: none; }
  .b-app table.tabla-catalogo > tbody > tr > .col-codigo { grid-area: codigo; font-weight: 700; }
  .b-app table.tabla-catalogo > tbody > tr > .col-titulo { grid-area: titulo; }
  .b-app table.tabla-catalogo > tbody > tr > .col-fase { grid-area: fase; font-size: 12px; }
  .b-app table.tabla-catalogo > tbody > tr > .acc { grid-area: acciones; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .b-app table.tabla-catalogo .acc > * { margin: 0; min-height: 36px; }
  .b-app table.tabla-catalogo > tbody > tr > :is(.col-rev, .col-aplica, .col-controles, .col-usos),
  .b-app table.tabla-catalogo .col-titulo .catalogo-origen { display: none; }
  .b-app table.tabla-catalogo .catalogo-movil { display: inline; }
  .b-app table.tabla-catalogo .col-fase .ag-chip { font-size: 12px; height: auto; min-height: 24px; }
}
.b-app .ctrl-tipo-fijo { display: inline-flex; align-items: center; height: 36px; padding: 0 2px; color: var(--ag-muted); font-size: 14px; white-space: nowrap; }

/* ---------- Accesibilidad ---------- */
/* El h1 ocupa exactamente la antigua .l1: conserva su flex y hereda la tipografía. */
.fld-h1 { margin: 0; font: inherit; }
.fld-h2 { margin: 0; font: inherit; }
.vacio h2 { color: var(--ag-ink); font-size: 18px; }
.gi-bloque h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ag-muted); font-weight: 650; }

/* Sólo tinta oscura: #ffa4b2 da 6,734:1 sobre #333334, 7,569:1 sobre
   #2a2b2c y 7,777:1 sobre rgba(22,24,26,.5) encima de #3a3a3a (#28292a).
   Sobre el fondo rojo suave de estado más hover sobre #333334: 4,624:1.
   --f-rechazo sigue siendo la tinta de puntos, barras, bordes y rellenos. */
.ag-root:not(.ag-light) { --f-rechazo-texto: #ffa4b2; }
.ag-root:not(.ag-light) .t-red,
.ag-root:not(.ag-light) .ag-chip.t-red,
.ag-root:not(.ag-light) .e-rechazado,
.ag-root:not(.ag-light) .estado.e-rechazado,
.ag-root:not(.ag-light) .ag-btn.danger,
.ag-root:not(.ag-light) .ag-icon.danger,
.ag-root:not(.ag-light) .b-app .ag-table td .ag-btn.sm.danger,
.ag-root:not(.ag-light) .b-app .ag-table td .ag-icon.danger,
.ag-root:not(.ag-light) .b-app .ag-table td .ag-icon.danger:hover,
.ag-root:not(.ag-light) .b-app .ag-table td .ag-icon.danger:focus-visible,
.ag-root:not(.ag-light) .b-app .b-mas-menu .ag-btn.danger,
.ag-root:not(.ag-light) .b-app #tUsuarios .b-mas-menu .ag-btn.danger,
.ag-root:not(.ag-light) .b-app #tUsuarios .estado.b-estado-error {
  color: var(--f-rechazo-texto);
}
/* Evitar que currentColor aclare también los indicadores y su fondo. */
.ag-root:not(.ag-light) .ag-dot.t-red::before,
.ag-root:not(.ag-light) .t-red .ag-dot::before,
.ag-root:not(.ag-light) .estado.e-rechazado::before,
.ag-root:not(.ag-light) .estado.t-red::before,
.ag-root:not(.ag-light) .estado.b-estado-error::before { background: var(--f-rechazo); }
.ag-root:not(.ag-light) .estado.empresa-estado.e-rechazado { background: color-mix(in srgb, var(--f-rechazo) 14%, transparent); }

.tabla-caja:focus-visible { outline: 2px solid var(--f-foco); outline-offset: 2px; }
.b-extras > summary, details > summary.ag-muted, .gi-reglas > summary {
  min-height: 32px; padding-block: 6px; align-content: center;
}
details.pliegue > summary { min-height: 32px; display: flex; align-items: center; }
@media (max-width: 1100px) {
  details.pliegue > summary { min-height: 44px; }
}

/* El main reemplaza al formulario como ítem del grid, con el mismo ancho. */
.entrar .entrada-form { position: relative; z-index: 2; min-width: 0; }
@media (max-width: 980px) {
  .entrar .entrada-form { width: 100%; max-width: 480px; justify-self: center; }
}

/* Fondos sólidos: activo #f1f2f3 / #333334 = 11,260:1;
   inactivo #b4b8bc / #050505 = 10,213:1, independientemente de la foto. */
.ag-root:not(.ag-light) .tabbar { background: #050505; }
.ag-root:not(.ag-light) .tabbar a.on { background: #333334; }
.tabbar a { font-size: 12px; }
@media (max-width: 640px) {
  .b-app .fila-link, .b-app td a.ag-mono, .b-app td a.lin {
    display: inline-block; min-height: 32px; padding-block: 9px; margin-block: -9px;
  }
  /* Estos TAG ya tienen un blanco táctil de 44 px y conservan su alineación. */
  .b-app table.b-fichas:is(.tabla-protocolos, .tabla-firmas) .col-tag .fila-link {
    display: flex; padding-block: 0; margin-block: 0;
  }
  .check-area { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; cursor: pointer; }
}

/* ---------- Qué se carga acá (23/11/2026) ----------
   Una franja arriba de cada módulo de carga y las tres categorías de
   liberación como pastillas en Protocolos. Cada área tiene su familia de
   color: Ingeniería celeste, Calidad verde agua, Precomisionado ámbar,
   Comisionado verde; los módulos de apoyo van en gris. */
.b-app .carga-aviso { --c: var(--ag-muted); --cs: var(--ag-track);
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border: 1px solid var(--ag-line2); border-left: 3px solid var(--c); border-radius: 12px;
  background: var(--ag-card); font-size: 14px; }
.b-app .carga-aviso p { margin: 0; line-height: 1.45; }
.b-app .carga-aviso .carga-no { color: var(--ag-muted); }
.b-app .carga-chip { flex: none; padding: 3px 10px; border-radius: 99px; background: var(--cs); color: var(--c);
  font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.b-app .fam-curso   { --c: var(--f-curso);   --cs: var(--f-curso-soft); }
.b-app .fam-avance  { --c: var(--f-avance);  --cs: var(--f-avance-soft); }
.b-app .fam-espera  { --c: var(--f-espera);  --cs: var(--f-espera-soft); }
.b-app .fam-firmado { --c: var(--f-firmado); --cs: var(--f-firmado-soft); }
.b-app .b-cats { display: flex; flex-wrap: wrap; gap: 8px; }
.b-app .b-cats > a { --c: var(--ag-muted);
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--ag-line2); border-radius: 99px; color: var(--ag-muted);
  font-weight: 600; font-size: 14px; text-decoration: none; }
.b-app .b-cats > a:hover { color: var(--ag-ink); }
.b-app .b-cats > a:focus-visible { outline: 2px solid var(--f-foco); outline-offset: 2px; }
.b-app .b-cats > a[class*="cat-"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.b-app .b-cats > a.cat-calidad        { --c: var(--f-avance); }
.b-app .b-cats > a.cat-precomisionado { --c: var(--f-espera); }
.b-app .b-cats > a.cat-comisionado    { --c: var(--f-firmado); }
.b-app .b-cats > a.on { background: var(--ag-ctl-on); color: var(--ag-ink); border-color: var(--c); }
.b-app .b-cats > a:not([class*="cat-"]).on { border-color: var(--ag-ink); }
.b-app .b-cats .cat-fase { color: var(--ag-muted); font-weight: 500; }
.b-app .fld-cab .cat-nombre { font-weight: 600; color: var(--ag-ink); }
@media (max-width: 640px) {
  .b-app .carga-aviso { flex-direction: column; align-items: flex-start; gap: 8px; }
  .b-app .b-cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .b-app .b-cats > a { flex: none; padding: 0 14px; }
}
