/* OLCOT · V3.0.342 — Botones comunes y acciones de confirmación con ancho para su texto.
   La capa mantiene el estándar frente a estilos históricos cargados después.
   No modifica display/visibility: respeta permisos, estados y botones ocultos. */
@layer olcot-buttons {
  :root {
    --olcot-button-height:28px;
    --olcot-button-font-size:10.5px;
    --olcot-button-icon-size:14px;
    --olcot-button-bg:#dce8f3;
    --olcot-button-hover:#cddfec;
    --olcot-button-border:#aac2d7;
    --olcot-button-text:#284d6b;
    --olcot-button-focus:#337da7;
    --olcot-delete-bg:#f5dddd;
    --olcot-delete-hover:#efcccc;
    --olcot-delete-border:#cf8b91;
    --olcot-delete-text:#a12430;
    --olcot-delete-focus:#bd4450;
  }
  :root:is([data-theme="dark"],.dark),body.dark {
    --olcot-button-bg:#142638;
    --olcot-button-hover:#1c344a;
    --olcot-button-border:#3f5b75;
    --olcot-button-text:#c8def3;
    --olcot-button-focus:#80b6df;
    --olcot-delete-bg:#391e28;
    --olcot-delete-hover:#462532;
    --olcot-delete-border:#8a3c49;
    --olcot-delete-text:#ff9ba2;
    --olcot-delete-focus:#ed8d98;
  }

  :where(button,input[type="button"],input[type="submit"],input[type="reset"],
    a.btn,a.btn-primary,a.btn-secondary,a.btn-save,a.btn-cerrar,a.btn-delete,
    a.v2-btn,a.v2-row-btn,a.v2-icon-btn,a.v2-icon-action,
    a.v2-btn-form-primary,a.v2-btn-form-secondary,a.v2-btn-form-danger,
    .cot-mobile-more>summary,.v2-cot-mobile-more>summary) {
    box-sizing:border-box!important;
    appearance:none!important;
    -webkit-appearance:none!important;
    width:auto!important;
    min-width:60px!important;
    max-width:100%!important;
    height:var(--olcot-button-height)!important;
    min-height:var(--olcot-button-height)!important;
    max-height:none!important;
    padding:0 10px!important;
    border:1px solid var(--olcot-button-border)!important;
    border-radius:7px!important;
    background:var(--olcot-button-bg)!important;
    color:var(--olcot-button-text)!important;
    font-family:"Segoe UI",Arial,sans-serif!important;
    font-size:var(--olcot-button-font-size)!important;
    font-weight:600!important;
    line-height:1.15!important;
    letter-spacing:0!important;
    text-align:center!important;
    text-decoration:none!important;
    text-transform:none!important;
    white-space:nowrap!important;
    vertical-align:middle!important;
    align-items:center!important;
    justify-content:center!important;
    gap:5px!important;
    box-shadow:none!important;
    filter:none!important;
    transform:none!important;
    cursor:pointer!important;
    transition:background-color .14s ease,border-color .14s ease,color .14s ease,box-shadow .14s ease!important;
  }

  /* Quitar una fila también es destructivo; activar/desactivar un usuario no. */
  :is(.btn-delete,.btn-danger,.v2-btn-form-danger,.v2-cleanup-danger-btn,
    [data-eliminar],[data-eliminar-contacto],[data-cleanup-delete-selected],
    [data-master-delete],[data-provider-delete],[data-tipdoc-delete],
    [data-admin-person-delete]):not(.btn-estado-usuario) {
    --olcot-button-bg:var(--olcot-delete-bg)!important;
    --olcot-button-hover:var(--olcot-delete-hover)!important;
    --olcot-button-border:var(--olcot-delete-border)!important;
    --olcot-button-text:var(--olcot-delete-text)!important;
    --olcot-button-focus:var(--olcot-delete-focus)!important;
  }

  :where(button,input[type="button"],input[type="submit"],input[type="reset"],
    a.btn,a.btn-primary,a.btn-secondary,a.btn-save,a.btn-cerrar,a.btn-delete,
    a.v2-btn,a.v2-row-btn,a.v2-icon-btn,a.v2-icon-action,
    a.v2-btn-form-primary,a.v2-btn-form-secondary,a.v2-btn-form-danger,
    .cot-mobile-more>summary,.v2-cot-mobile-more>summary):hover:not(:disabled):not(.is-disabled) {
    background:var(--olcot-button-hover)!important;
    border-color:var(--olcot-button-focus)!important;
  }
  :where(button,input[type="button"],input[type="submit"],input[type="reset"],
    a.btn,a.v2-btn,a.v2-row-btn,a.v2-icon-btn,a.v2-icon-action,
    .cot-mobile-more>summary,.v2-cot-mobile-more>summary):focus-visible {
    outline:2px solid var(--olcot-button-focus)!important;
    outline-offset:2px!important;
  }
  :where(button,.cot-mobile-more>summary,.v2-cot-mobile-more>summary):is(
    .active,.activo,.lpv2-btn-active,.is-active,
    [aria-pressed="true"],[aria-selected="true"],[aria-expanded="true"]) {
    box-shadow:inset 0 0 0 1px var(--olcot-button-focus)!important;
    border-color:var(--olcot-button-focus)!important;
  }
  :where(button,input[type="button"],input[type="submit"],input[type="reset"]):disabled,
  :where(button,a.v2-btn,a.v2-row-btn).is-disabled {
    opacity:.52!important;
    cursor:not-allowed!important;
    box-shadow:none!important;
  }
  button:not([data-panel-color])>:is(b,strong) {
    font:inherit!important;
    color:inherit!important;
  }
  :where(button,a.v2-icon-btn,a.v2-icon-action) svg {
    width:var(--olcot-button-icon-size)!important;
    height:var(--olcot-button-icon-size)!important;
    flex-shrink:0!important;
  }

  /* Acciones de icono, navegación y campos: cuadrados con la misma altura. */
  :where(button[aria-label],.v2-icon-btn,.v2-icon-action,.v2-mini-add,
    .v2-client-view-btn,.v2-search-clear,.v2-date-button,.v2-link-count,
    .lpv2-icon-btn,.lpv2-filter-icon,.lpv2-money,.lp-moneda-btn,
    .bac-v2-icon,.bac-v2-filter-btn,.btn-limpiar-busqueda,.btn-close-window,
    .fp-anios-anterior,.fp-anios-siguiente,.olcot-password-toggle,
    .v2-search button,.v2-master-search button,.v2-search-control button,
    .lpv2-search button,.v2-client-search button,.buscar-wrapper button,
    .v2-pager button,.lpv2-pager button,.v2-page-arrow,
    [data-page],[data-v2-page],[data-cli-page],[data-art-page],[data-lp-page],
    [data-cot-page],[data-cliente-page],[data-cotart-page],
    [data-cleanup-prev],[data-cleanup-next],
    #cotPrev,#cotNext,#clientesPrev,#clientesNext,#acotPrev,#acotNext,
    #winCotizacionForm .cot-precios td .btn-delete,
    .cot-mobile-more>summary,.v2-cot-mobile-more>summary):not(:where(
      .v2-cliente-close-toolbar,.bac-v2-select-action,[data-olcot-close-button="1"],
      .v2-system-dialog-actions button,.cot-confirm-overlay button,
      .swal2-actions button,.modal-confirmacion-roja__acciones button)) {
    width:var(--olcot-button-height)!important;
    min-width:var(--olcot-button-height)!important;
    padding:0!important;
    font-size:var(--olcot-button-icon-size)!important;
    flex-shrink:0!important;
  }
  /* Las acciones con texto conservan el ancho automático y el relleno común,
     aunque Cerrar tenga aria-label. No se encogen al compartir una fila. */
  :where(.v2-cliente-close-toolbar,.bac-v2-select-action,[data-olcot-close-button="1"],
    .v2-system-dialog-actions button,.cot-confirm-overlay button,
    .swal2-actions button,.modal-confirmacion-roja__acciones button) {
    flex-shrink:0!important;
  }
  :where(.v2-system-dialog-actions,.swal2-actions,.modal-confirmacion-roja__acciones,
    .cot-confirm-overlay>div>div:last-child) {
    flex-wrap:wrap!important;
  }

  /* Acciones centradas dentro del pie de cada tarjeta. */
  :where(#amv2Host .lpv2-card>.amv2-edit,#acotCards .acot-card>.acot-card-foot) {
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
    align-self:stretch!important;
    width:100%!important;
    min-width:0!important;
  }
  :where(.v2-date-days button,.fp-anios-grid button) {
    width:100%!important;
    min-width:0!important;
    padding:0!important;
  }
  .v2-panel-swatches button {
    width:100%!important;
    min-width:0!important;
    padding:3px!important;
  }
  .olcot-login-submit {
    width:100%!important;
  }
  .olcot-password-toggle {
    top:50%!important;
    transform:translateY(-50%)!important;
  }

  @media (max-width:820px),(pointer:coarse) {
    :root {
      --olcot-button-height:32px;
      --olcot-button-font-size:clamp(10px,2.8vw,11px);
      --olcot-button-icon-size:16px;
    }
    .v2-theme-soft {
      width:var(--olcot-button-height)!important;
      min-width:var(--olcot-button-height)!important;
      padding:0!important;
    }
    .botonera-cotizacion-principal>button {
      min-width:0!important;
      padding:0 4px!important;
      white-space:normal!important;
    }
  }
  .cot-mobile-more-menu>button,.v2-cot-mobile-more-menu>button {
    width:100%!important;
    min-width:0!important;
  }
  @media (max-width:560px) {
    #winCotizacionForm .cot-header-actions>button {
      width:100%!important;
      min-width:0!important;
    }
  }
  body.v2-cot-mobile #formCotizacion table.cot-precios tbody td:nth-child(7) .btn-delete {
    width:auto!important;
    min-width:76px!important;
    padding:0 9px!important;
    font-size:0!important;
  }
  body.v2-cot-mobile #formCotizacion table.cot-precios tbody td:nth-child(7) .btn-delete::after {
    font-size:var(--olcot-button-font-size)!important;
    font-weight:600!important;
  }
  @media (prefers-reduced-motion:reduce) {
    :where(button,input[type="button"],input[type="submit"],input[type="reset"]) {
      transition:none!important;
    }
  }
}
