/**
 * NEW MODAL — cristal global (última capa CSS)
 * 1) Icono header  2) Botón Atrás  3) Pie Cancelar/Guardar
 * ESTRATEGIA GLOBAL: re-mapeo de variables --manto-btn-gris-ok-* dentro del
 * header y del footer. Las custom properties se heredan del contenedor, así que
 * cualquier regla legacy (por específica que sea, con #id) que use esos tokens
 * resuelve a cristal sin parchar modal por modal.
 * No toca danger / .ani-serio-v2-del / botones del body / páginas.
 */

/* ——— tokens garantizados (red de seguridad si tokens.css llega cacheado) ——— */
:root {
  --manto-modal-cristal-bg: linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%);
  --manto-modal-cristal-bg-active: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 55%, #cbd5e1 100%);
  --manto-modal-cristal-bg-header: linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%);
  --manto-modal-cristal-bg-foot: linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%);
  --manto-modal-cristal-border: 1px solid #94a3b8;
  --manto-modal-cristal-border-hover: 1px solid #64748b;
  --manto-modal-cristal-color: #0f172a;
  --manto-modal-cristal-shadow: inset 0 1px 0 rgba(255, 255, 255, 1), inset 0 -1px 0 rgba(100, 116, 139, 0.28);
  --manto-modal-cristal-shadow-hover: inset 0 1px 0 rgba(255, 255, 255, 1), inset 0 -1px 0 rgba(100, 116, 139, 0.34);
  --manto-modal-cristal-rad: 12px;
}

/* ——— FIX GLOBAL POR VARIABLES ———
   SOLO en los 3 controles (icono header, Atrás, botones del pie): gris-ok →
   cristal vía variables. Las custom properties definidas en el propio elemento
   ganan a las heredadas, así cualquier regla legacy con #id que use
   var(--manto-btn-gris-ok-*) sobre estos controles resuelve a cristal.
   IMPORTANTE: no aplicar al contenedor (.manto-header-serio-v1 /
   .ani-serio-v2-footer-shell): algunas bandas se pintan con gris-ok y
   quedarían blancas (regresión del 30/07). */
html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:not(.ani-serio-v2-del):not(.btn-danger),
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save:not(.ani-serio-v2-del):not(.btn-danger),
html body .kpi-det-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body .kpi-det-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body .kpi-det-bit-box.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel,
html body .kpi-det-bit-box.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save,
html body .pes-rv-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body .pes-rv-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body .pes-ap-box.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body .pes-ap-box.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body #_panel-ia.modo-final.pes-pebble-vida-20260418 .manto-header-serio-v1 .serio-v1-icon-box,
html body #_panel-ia.modo-final.pes-pebble-vida-20260418 .manto-header-serio-v1 .serio-v1-btn-back {
  --manto-btn-gris-ok-bg: var(--manto-modal-cristal-bg, linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%));
  --manto-btn-gris-ok-bg-active: var(--manto-modal-cristal-bg-active, linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 55%, #cbd5e1 100%));
  --manto-btn-gris-ok-border: var(--manto-modal-cristal-border, 1px solid #94a3b8);
  --manto-btn-gris-ok-border-hover: var(--manto-modal-cristal-border-hover, 1px solid #64748b);
  --manto-btn-gris-ok-shadow: var(--manto-modal-cristal-shadow, inset 0 1px 0 #fff, inset 0 -1px 0 rgba(100, 116, 139, 0.28));
  --manto-btn-gris-ok-shadow-hover: var(--manto-modal-cristal-shadow-hover, inset 0 1px 0 #fff, inset 0 -1px 0 rgba(100, 116, 139, 0.34));
  --manto-btn-gris-ok-color: var(--manto-modal-cristal-color, #0f172a);
}

/* 1) Icono header */
html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body .kpi-det-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body .pes-rv-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body .pes-ap-box.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body #m-bitacora.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box,
html body.light .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-icon-box {
  border: var(--manto-modal-cristal-border, 1px solid #94a3b8) !important;
  background: var(--manto-modal-cristal-bg-header, linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%)) !important;
  background-image: var(--manto-modal-cristal-bg-header, linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%)) !important;
  box-shadow: var(--manto-modal-cristal-shadow, inset 0 1px 0 #fff, inset 0 -1px 0 rgba(100, 116, 139, 0.28)) !important;
}

/* 2) Botón Atrás */
html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only,
html body .kpi-det-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body .pes-rv-bit-box.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body .pes-ap-box.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only,
html body #m-bitacora.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only,
html body.light .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back,
html body.light .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only {
  border: var(--manto-modal-cristal-border, 1px solid #94a3b8) !important;
  background: var(--manto-modal-cristal-bg-header, linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%)) !important;
  background-image: var(--manto-modal-cristal-bg-header, linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%)) !important;
  box-shadow: var(--manto-modal-cristal-shadow, inset 0 1px 0 #fff, inset 0 -1px 0 rgba(100, 116, 139, 0.28)) !important;
  color: var(--manto-modal-cristal-color, #0f172a) !important;
  -webkit-text-fill-color: var(--manto-modal-cristal-color, #0f172a) !important;
}

html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back:hover,
html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only:hover,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only:hover,
html body #m-bitacora.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only:hover {
  border: var(--manto-modal-cristal-border-hover, 1px solid #64748b) !important;
  box-shadow: var(--manto-modal-cristal-shadow-hover, inset 0 1px 0 #fff, inset 0 -1px 0 rgba(100, 116, 139, 0.34)) !important;
}

html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back:active,
html body .modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only:active,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only:active,
html body #m-bitacora.bitacora-serio-v2.modal-nuevo .manto-header-serio-v1 .serio-v1-btn-back.serio-v1-btn-back--ico-only:active {
  background: var(--manto-modal-cristal-bg-active, linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 55%, #cbd5e1 100%)) !important;
  background-image: var(--manto-modal-cristal-bg-active, linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 55%, #cbd5e1 100%)) !important;
}

/* 3) Pie — Cancelar / Cerrar / Guardar / Exportar (no danger).
   Selectores con #id (incl. #m-bitacora #form-bitacora, doble id) para
   empatar/superar reglas scoped de styles.css. */
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:not(.ani-serio-v2-del):not(.btn-danger),
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save:not(.ani-serio-v2-del):not(.btn-danger),
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.btn-gris-ok.bit-bitacora-foot-save,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell button.btn.bitacora-btn.bit-bitacora-foot-cancel,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell button.btn.bitacora-btn.btn-gris-ok.bit-bitacora-foot-save,
html body #m-bitacora #form-bitacora .ani-serio-v2-footer-shell__row.bit-bitacora-footer-row > .btn.bitacora-btn.bit-bitacora-foot-cancel,
html body #m-bitacora #form-bitacora .ani-serio-v2-footer-shell__row.bit-bitacora-footer-row > .btn.bitacora-btn.btn-gris-ok.bit-bitacora-foot-save,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.bitacora-btn.bit-bitacora-foot-cancel,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.bitacora-btn.btn-gris-ok.bit-bitacora-foot-save,
html body #m-dia-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.bitacora-btn.bit-bitacora-foot-cancel,
html body #m-lec-edit.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.bitacora-btn.bit-bitacora-foot-cancel,
html body #m-leche-lote.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.bitacora-btn.bit-bitacora-foot-cancel,
html body .kpi-det-bit-box.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel,
html body .kpi-det-bit-box.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save,
html body.light .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:not(.ani-serio-v2-del),
html body.light .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save:not(.ani-serio-v2-del),
html body.light .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.btn-gris-ok.bit-bitacora-foot-save,
html body.light #m-bitacora #form-bitacora .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel,
html body.light #m-bitacora #form-bitacora .ani-serio-v2-footer-shell .bit-bitacora-foot-save,
html body.light #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel,
html body.light #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save {
  border: var(--manto-modal-cristal-border, 1px solid #94a3b8) !important;
  background: var(--manto-modal-cristal-bg-foot, linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%)) !important;
  background-image: var(--manto-modal-cristal-bg-foot, linear-gradient(180deg, #ffffff 0%, #f1f5f9 55%, #e2e8f0 100%)) !important;
  box-shadow: var(--manto-modal-cristal-shadow, inset 0 1px 0 #fff, inset 0 -1px 0 rgba(100, 116, 139, 0.28)) !important;
  color: var(--manto-modal-cristal-color, #0f172a) !important;
  -webkit-text-fill-color: var(--manto-modal-cristal-color, #0f172a) !important;
}

html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:not(.ani-serio-v2-del):hover,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save:not(.ani-serio-v2-del):hover,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.btn-gris-ok.bit-bitacora-foot-save:hover,
html body #m-bitacora #form-bitacora .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:hover,
html body #m-bitacora #form-bitacora .ani-serio-v2-footer-shell .bit-bitacora-foot-save:hover,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:hover,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save:hover {
  border: var(--manto-modal-cristal-border-hover, 1px solid #64748b) !important;
  box-shadow: var(--manto-modal-cristal-shadow-hover, inset 0 1px 0 #fff, inset 0 -1px 0 rgba(100, 116, 139, 0.34)) !important;
}

html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:not(.ani-serio-v2-del):active,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save:not(.ani-serio-v2-del):active,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .btn.btn-gris-ok.bit-bitacora-foot-save:active,
html body #m-bitacora #form-bitacora .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:active,
html body #m-bitacora #form-bitacora .ani-serio-v2-footer-shell .bit-bitacora-foot-save:active,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel:active,
html body #m-lec.lec-milk-form-modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save:active {
  background: var(--manto-modal-cristal-bg-active, linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 55%, #cbd5e1 100%)) !important;
  background-image: var(--manto-modal-cristal-bg-active, linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 55%, #cbd5e1 100%)) !important;
}

html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-cancel-lbl,
html body .modal.bitacora-serio-v2.modal-nuevo .ani-serio-v2-footer-shell .bit-bitacora-foot-save-lbl {
  color: var(--manto-modal-cristal-color, #0f172a) !important;
  -webkit-text-fill-color: var(--manto-modal-cristal-color, #0f172a) !important;
}
