/* Retoques comunes del backoffice (hito 22): tablas que no recortan y cabecera estrecha. */

/* Celda de acciones de una fila: los botones pasan a otra línea en vez de recortarse. */
.mud-table .celda-acciones { white-space: normal; text-align: right; }
.celda-acciones > .acciones { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.25rem; }

/* La tabla desplaza en horizontal dentro de su caja, nunca la página. */
.mud-table-container { overflow-x: auto; }

/* Objetivos táctiles: botones pequeños de tablas con al menos 36 px de alto en pantallas táctiles/estrechas. */
@media (max-width: 959px) {
  .mud-table .acciones .mud-button-root { min-height: 36px; }
}

/* Tablas en tarjetas (móvil): el valor puede partirse y no se sale de la tarjeta. */
@media (max-width: 599px) {
  .mud-table .mud-table-cell { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
  .mud-table .celda-acciones { justify-content: flex-start; }
  .mud-table .celda-acciones > .acciones { justify-content: flex-start; }
}

/* Texto largo en una celda (detalle de auditoría): ancho razonable y parte la línea en vez de estirar la fila. */
.mud-table .celda-detalle { min-width: 16rem; max-width: 34rem; overflow-wrap: anywhere; }
@media (max-width: 599px) { .mud-table .celda-detalle { min-width: 0; max-width: none; } }

/* Celdas más compactas en horizontal para que quepan las acciones; columnas secundarias que se ocultan entre 600 y 1279 px (en tarjetas móviles se ven). */
.mud-table .mud-table-root .mud-table-row .mud-table-cell { padding-left: 10px; padding-right: 10px; }
@media (min-width: 600px) and (max-width: 1279px) { .mud-table .col-extra { display: none; } }

/* Botones de acción con icono: el texto se oculta entre 600 y 1279 px (queda el nombre accesible en aria-label y title). */
@media (min-width: 600px) and (max-width: 1279px) {
  .mud-table .acciones .btn-txt { display: none; }
  .mud-table .acciones.acciones-iconos { flex-wrap: nowrap; }
  .mud-table .acciones .mud-button-icon-start { margin-right: 0; margin-left: 0; }
  .mud-table .acciones .mud-button-root { min-width: 32px; padding-left: 5px; padding-right: 5px; }
}
@media (min-width: 600px) and (max-width: 1100px) { .mud-table .mud-table-root .mud-table-row .mud-table-cell { padding-left: 7px; padding-right: 7px; } }

/* ---------------- Explorador de catálogo (hito 23) ---------------- */
.exp { display: flex; flex-direction: column; gap: 0.5rem; --exp-borde: var(--color-warm-200, #e8e4df); --exp-sel: #cdeef2; --exp-hover: #efeae3; --exp-sel-borde: var(--color-brand-600, #2399a6); }
.exp :focus-visible { outline: 3px solid var(--color-brand-600, #2399a6); outline-offset: -2px; border-radius: 4px; }
.exp-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.exp-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem; padding: 0.375rem; border: 1px solid var(--exp-borde); border-radius: 0.5rem; background: #fff; }
.exp-acciones .mud-button-root, .exp-barra .mud-button-root { min-height: 36px; min-width: 36px; }
.exp-separador { width: 1px; align-self: stretch; margin: 0.125rem 0.25rem; background: var(--exp-borde); }
.exp-aviso { display: flex; align-items: center; gap: 0.375rem; margin: 0; min-height: 1.5rem; font-size: 0.875rem; color: #7a5200; }
.exp-boton-arbol { display: none !important; }

.exp-migas { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; flex: 1 1 12rem; }
.exp-miga { min-height: 36px; padding: 0 0.5rem; border: 0; background: transparent; border-radius: 4px; font: inherit; font-weight: 600; color: var(--color-warm-900, #2f2c28); cursor: pointer; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-miga:hover { background: var(--color-warm-100, #f5f3f0); }
.exp-miga[aria-current] { color: var(--color-brand-700, #1b7a85); }
.exp-miga-sep { color: var(--color-warm-500, #9b9085); }

.exp-cuerpo { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.exp-panel-arbol { border: 1px solid var(--exp-borde); border-radius: 0.5rem; background: #fff; max-height: 34rem; overflow: auto; padding: 0.25rem; }
.exp-panel-lista { border: 1px solid var(--exp-borde); border-radius: 0.5rem; background: #fff; min-width: 0; container-type: inline-size; container-name: explista; }

/* Árbol */
.exp-arbol { display: flex; flex-direction: column; }
.exp-nodo { display: flex; align-items: center; gap: 0.25rem; min-height: 36px; padding-right: 0.5rem; border-radius: 6px; cursor: pointer; user-select: none; white-space: nowrap; }
.exp-nodo:hover { background: var(--exp-hover); }
.exp-nodo-sel:hover { background: var(--exp-sel); }
.exp-nodo-sel { background: var(--exp-sel); color: var(--color-brand-700, #1b7a85); font-weight: 600; box-shadow: inset 3px 0 0 var(--exp-sel-borde); }
.exp-nodo-off { opacity: 0.45; cursor: not-allowed; }
.exp-nodo-sobre, .exp-fila-sobre { background: #d6f1f4 !important; outline: 2px dashed var(--exp-sel-borde); outline-offset: -2px; }
.exp-nodo-nombre { overflow: hidden; text-overflow: ellipsis; }
.exp-chevron, .exp-chevron-hueco { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 36px; flex: none; }
.exp-chevron { border: 0; background: transparent; cursor: pointer; border-radius: 4px; color: var(--color-warm-700, #5f5a52); }
.exp-chevron:hover { background: var(--color-warm-100, #f5f3f0); }
.exp-icono-raiz { color: var(--color-warm-700, #5f5a52); }
.exp-candado { color: var(--color-warm-500, #9b9085); margin-left: auto; }
.exp-apagado { color: var(--color-warm-500, #9b9085); text-decoration: line-through; text-decoration-thickness: 1px; }
.exp-selector { max-height: 50vh; overflow: auto; border: 1px solid var(--exp-borde); border-radius: 0.5rem; padding: 0.25rem; }

/* Lista de contenido */
.exp-cab, .exp-fila { display: grid; grid-template-columns: minmax(0, 1fr) 7rem 6rem 11rem 6.5rem 6rem; align-items: center; column-gap: 0.5rem; padding: 0 0.75rem; }
.exp-cab { min-height: 36px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-warm-700, #5f5a52); border-bottom: 1px solid var(--exp-borde); background: var(--color-warm-50, #faf8f6); border-radius: 0.5rem 0.5rem 0 0; }
.exp-lista { min-height: 12rem; max-height: 32rem; overflow: auto; }
.exp-fila { min-height: 48px; border-bottom: 1px solid var(--color-warm-100, #f5f3f0); cursor: default; user-select: none; }
.exp-fila:hover { background: var(--exp-hover); }
.exp-fila-sel, .exp-fila-sel:hover { background: var(--exp-sel); color: var(--color-brand-700, #1b7a85); box-shadow: inset 3px 0 0 var(--exp-sel-borde); }
.exp-fila .c-nom { display: flex; align-items: center; gap: 0.5rem; min-width: 0; padding: 0.25rem 0; }
.exp-textos { display: flex; flex-direction: column; min-width: 0; }
.exp-nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-sub { display: none; font-size: 0.8125rem; color: var(--color-warm-700, #5f5a52); gap: 0.25rem 0.5rem; flex-wrap: wrap; }
.exp-fila .c-aca { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.exp-fila .c-med, .exp-fila .c-pre, .exp-fila .c-img, .exp-fila .c-est, .exp-cab span { font-size: 0.875rem; }
.exp-fila .c-resto { color: var(--color-warm-700, #5f5a52); }
.exp-fila .c-img.exp-elementos { grid-column: span 1; white-space: nowrap; }
.exp-insignias { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; margin-left: auto; padding-left: 0.5rem; }
.exp-chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0 0.5rem; min-height: 22px; border: 1px solid var(--color-warm-300, #d9d4cc); border-radius: 999px; font-size: 0.75rem; line-height: 1; white-space: nowrap; background: #fff; color: var(--color-warm-900, #2f2c28); }
.exp-chip-ok { border-color: #8bc99a; background: #eefaf1; color: #1f6b35; }
.exp-chip-bloqueo { background: var(--color-warm-100, #f5f3f0); }
.exp-chip-bloqueo .mud-icon-root { font-size: 0.9rem; }
.exp-chip-mod { border-color: #e2b45a; background: #fff6e0; color: #7a5200; }
.exp-chip-master { border-color: var(--color-brand-400, #2fb6c4); background: var(--exp-sel); color: var(--color-brand-700, #1b7a85); }
.exp-vacio { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; min-height: 12rem; padding: 1.5rem; text-align: center; color: var(--color-warm-700, #5f5a52); }
.exp-pie { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.375rem 0.75rem; font-size: 0.8125rem; color: var(--color-warm-700, #5f5a52); border-top: 1px solid var(--exp-borde); }
.exp-pie-ruta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lista media (junto al árbol a 1024 px): sin las columnas de acabados e imágenes, que pasan a la segunda línea. */
@container explista (max-width: 760px) {
  .exp-cab, .exp-fila { grid-template-columns: minmax(0, 1fr) 6.5rem 5.5rem 5.5rem; }
  .exp-cab .c-aca, .exp-cab .c-img, .exp-fila .c-aca, .exp-fila .c-img { display: none; }
  .exp-fila-producto .exp-sub { display: flex; }
  .exp-fila-producto .exp-sub .s-med, .exp-fila-producto .exp-sub .s-pre { display: none; }
  .exp-fila-carpeta .exp-sub { display: flex; }
}
/* Lista estrecha (móvil): una columna; todo el detalle va debajo del nombre. */
@container explista (max-width: 520px) {
  .exp-cab { display: none; }
  .exp-fila { grid-template-columns: minmax(0, 1fr); padding: 0.25rem 0.75rem; }
  .exp-fila .c-med, .exp-fila .c-pre, .exp-fila .c-aca, .exp-fila .c-img, .exp-fila .c-est { display: none; }
  .exp-fila-producto .exp-sub .s-med, .exp-fila-producto .exp-sub .s-pre { display: inline; }
  .exp-fila-carpeta .exp-sub { display: flex; }
  .exp-fila { min-height: 56px; }
  .exp-insignias { padding-left: 0.25rem; }
  .exp-chip-txt { display: none; }
}

/* Móvil: el árbol pasa a un desplegable encima de la lista. */
@media (max-width: 759px) {
  .exp-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .exp-boton-arbol { display: inline-flex !important; }
  .exp-panel-arbol { display: none; max-height: 16rem; }
  .exp-panel-arbol.abierto { display: block; }
  .exp-btn-txt { display: none; }
  .exp-acciones { gap: 0.25rem; padding: 0.25rem; }
  .exp-acciones .mud-button-icon-start, .exp-barra .mud-button-icon-start { margin: 0; }
  .exp-acciones .mud-button-root, .exp-barra .mud-button-root { min-width: 44px; padding-left: 0.5rem; padding-right: 0.5rem; }
}
@media (min-width: 760px) and (max-width: 1279px) { .exp-cuerpo { grid-template-columns: 13.5rem minmax(0, 1fr); } }
@media (min-width: 760px) and (max-width: 1100px) { .exp-btn-txt { display: none; } .exp-acciones .mud-button-icon-start, .exp-barra .mud-button-icon-start { margin: 0; } }

/* Tarjetas de masters y diálogo de sincronización */
.exp-tarjetas { list-style: none; padding: 0; margin: 0; }
.exp-sync-titulo { margin: 0.5rem 0 0.25rem; font-size: 0.9375rem; font-weight: 600; color: var(--color-warm-900, #2f2c28); }
.exp-sync-lista { list-style: none; margin: 0; padding: 0; max-height: 10rem; overflow: auto; border: 1px solid var(--color-warm-200, #e8e4df); border-radius: 6px; font-size: 0.9375rem; }
.exp-sync-lista li { display: flex; flex-wrap: wrap; gap: 0.125rem 0.5rem; padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--color-warm-100, #f5f3f0); }
.exp-sync-lista li:last-child { border-bottom: 0; }
.exp-sync-tipo { color: var(--color-warm-700, #5f5a52); }
.exp-sync-ruta { font-weight: 500; overflow-wrap: anywhere; }
.exp-sync-sobrescribir { display: flex; align-items: flex-start; gap: 0.5rem; margin-top: 0.75rem; min-height: 36px; cursor: pointer; }
.exp-sync-sobrescribir input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--color-brand-600, #2399a6); flex: none; }
.exp-sync-texto { font-size: 0.9375rem; }
