/*
 LGFT v4.51.27.11 — Desktop Header Burger + Button Text Lock
 Scope: SCREEN ONLY. Does not alter mobile table-card behaviour, print CSS, login/auth,
 price sync, QR, permissions, database, .env, uploads or docs.

 Purpose:
 1. The mobile burger button must never render on desktop/tablet header layouts.
 2. Desktop button labels must wrap inside the button instead of clipping/overflowing.
*/

@media screen and (min-width: 981px) {
  /* Hard desktop lock: the burger is mobile-only. Previous screen-wide button rules
     turned the hidden button back into inline-flex on desktop. */
  .app-shell-header .mobile-menu-toggle,
  .app-shell-header button.mobile-menu-toggle,
  .app-shell-header [data-mobile-menu-toggle],
  header.topbar.app-shell-header .mobile-menu-toggle,
  header.topbar.app-shell-header button.mobile-menu-toggle,
  header.topbar.app-shell-header [data-mobile-menu-toggle],
  body:not(.mobile-nav-open) .mobile-menu-toggle,
  body:not(.mobile-nav-open) [data-mobile-menu-toggle] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
  }

  /* Keep desktop header/logo/nav in normal desktop flow. */
  .app-shell-header.topbar,
  header.topbar.app-shell-header {
    display: flex !important;
    align-items: center !important;
    gap: 16px !important;
    overflow: visible !important;
  }

  .app-shell-header .brand-wrap,
  header.topbar.app-shell-header .brand-wrap {
    flex: 0 0 auto !important;
    min-width: 240px !important;
    max-width: none !important;
    overflow: visible !important;
  }

  .app-shell-header .brand-home,
  header.topbar.app-shell-header .brand-home {
    display: flex !important;
    align-items: center !important;
    min-width: 0 !important;
    overflow: visible !important;
  }
}

@media screen and (min-width: 761px) {
  /* Desktop button-text containment: do not allow labels to escape the button. */
  .btn,
  a.btn,
  button:not(.mobile-menu-toggle):not([data-mobile-menu-toggle]),
  input[type="submit"],
  input[type="button"],
  input[type="reset"],
  [role="button"],
  .action-btn,
  .pill-action,
  .nav-logout,
  .density-toggle {
    box-sizing: border-box !important;
    max-width: 100% !important;
    min-width: 0 !important;
    width: auto;
    height: auto !important;
    min-height: 34px !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    hyphens: auto !important;
    line-height: 1.16 !important;
    text-align: center !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: .35rem !important;
    vertical-align: middle !important;
  }

  .btn > *,
  a.btn > *,
  button:not(.mobile-menu-toggle):not([data-mobile-menu-toggle]) > *,
  [role="button"] > *,
  .action-btn > *,
  .pill-action > *,
  .nav-logout > *,
  .density-toggle > * {
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  .toolbar-actions,
  .document-actions,
  .form-actions,
  .portal-actions,
  .workflow-actions,
  .button-row,
  .action-row,
  .quick-actions,
  .customer-quick-actions,
  .btn-row,
  .actions,
  .page-actions,
  .card-actions,
  .modal-actions,
  .table-actions,
  .filters-actions,
  .inline,
  .inline-form {
    max-width: 100% !important;
    min-width: 0 !important;
    flex-wrap: wrap !important;
  }

  .toolbar-actions > *,
  .document-actions > *,
  .form-actions > *,
  .portal-actions > *,
  .workflow-actions > *,
  .button-row > *,
  .action-row > *,
  .quick-actions > *,
  .customer-quick-actions > *,
  .btn-row > *,
  .actions > *,
  .page-actions > *,
  .card-actions > *,
  .modal-actions > *,
  .table-actions > *,
  .filters-actions > * {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* Form buttons embedded inside narrow table/action cells still need to shrink and wrap. */
  td .btn,
  td button:not(.mobile-menu-toggle):not([data-mobile-menu-toggle]),
  th .btn,
  th button:not(.mobile-menu-toggle):not([data-mobile-menu-toggle]),
  .table-actions .btn,
  .table-actions button:not(.mobile-menu-toggle):not([data-mobile-menu-toggle]) {
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    padding-left: .65rem !important;
    padding-right: .65rem !important;
  }
}

@media print {
  /* Screen-only patch. Portrait print remains controlled by the existing print stylesheet. */
}
