/* M26-D2 — mobile-first Finance, DMS and Cash Custodian workflow polish. */
:root {
  --nx-mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  --nx-touch-target: 44px;
  --nx-mobile-panel: rgba(255, 255, 255, .96);
  --nx-mobile-line: rgba(15, 23, 42, .10);
}

body.nx-m26-shell .nx-mobile-workflow-strip {
  display: none;
}

@media (max-width: 991.98px) {
  body.nx-m26-shell {
    -webkit-tap-highlight-color: rgba(8, 164, 200, .18);
  }

  body.nx-m26-shell .mobile-dock,
  body.nx-m26-shell .nx-m26-mobile-dock,
  body.nx-m26-shell [data-mobile-dock] {
    display: none !important;
  }

  body.nx-m26-shell .app-main {
    padding-bottom: calc(1.1rem + var(--nx-mobile-safe-bottom)) !important;
  }

  body.nx-m26-shell .page-header,
  body.nx-m26-shell .card,
  body.nx-m26-shell .nx-panel,
  body.nx-m26-shell .finance-card {
    border-radius: 16px !important;
  }

  body.nx-m26-shell .page-header {
    position: relative;
    overflow: visible;
  }

  body.nx-m26-shell .page-header__actions,
  body.nx-m26-shell .voucher-actions,
  body.nx-m26-shell .nx-actions,
  body.nx-m26-shell [data-mobile-actions],
  body.nx-m26-shell .card-actions {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(44px, max-content));
    justify-content: start;
    gap: .45rem;
  }

  body.nx-m26-shell .page-header__actions .btn,
  body.nx-m26-shell .voucher-actions .btn,
  body.nx-m26-shell .nx-actions .btn,
  body.nx-m26-shell [data-mobile-actions] .btn,
  body.nx-m26-shell .card-actions .btn {
    min-width: var(--nx-touch-target);
    min-height: var(--nx-touch-target);
    padding: .55rem .65rem;
  }

  body.nx-m26-shell .nx-mobile-workflow-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .5rem;
    margin: .75rem 0 1rem;
  }

  body.nx-m26-shell .nx-mobile-workflow-strip a {
    display: flex;
    min-height: 54px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: .18rem;
    border: 1px solid var(--nx-mobile-line);
    border-radius: 1rem;
    background: var(--nx-mobile-panel);
    color: var(--ac-text, #17212b);
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .06);
  }

  body.nx-m26-shell .nx-mobile-workflow-strip a i {
    font-size: 1.08rem;
  }

  body.nx-m26-shell .nx-mobile-workflow-strip a span {
    font-size: .68rem;
    font-weight: 800;
    line-height: 1.05;
    text-align: center;
  }

  body.nx-m26-shell .document-preview,
  body.nx-m26-shell .dms-preview,
  body.nx-m26-shell .source-document-preview,
  body.nx-m26-shell [data-document-preview] {
    min-height: 68vh !important;
    max-height: calc(100vh - 7.8rem) !important;
    border-radius: 1rem;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.nx-m26-shell iframe.document-preview,
  body.nx-m26-shell iframe.dms-preview,
  body.nx-m26-shell iframe.source-document-preview,
  body.nx-m26-shell iframe[data-document-preview] {
    width: 100% !important;
    min-height: 72vh !important;
  }

  body.nx-m26-shell img.document-preview,
  body.nx-m26-shell img.dms-preview,
  body.nx-m26-shell img.source-document-preview,
  body.nx-m26-shell img[data-document-preview] {
    width: 100% !important;
    height: auto !important;
    object-fit: contain;
  }

  body.nx-m26-shell .table-responsive table,
  body.nx-m26-shell .nx-table-scroll table {
    min-width: 760px;
  }

  body.nx-m26-shell .form-control,
  body.nx-m26-shell .form-select,
  body.nx-m26-shell .select2-container .select2-selection--single {
    min-height: var(--nx-touch-target);
    font-size: 16px;
  }

  body.nx-m26-shell .modal-dialog,
  body.nx-m26-shell .offcanvas {
    max-width: 100%;
  }

  body.nx-m26-shell .nx-mobile-sticky-submit {
    position: sticky;
    bottom: calc(.65rem + var(--nx-mobile-safe-bottom));
    z-index: 1010;
    margin-top: 1rem;
    padding: .7rem;
    border: 1px solid var(--nx-mobile-line);
    border-radius: 1rem;
    background: rgba(255,255,255,.94);
    box-shadow: 0 18px 34px rgba(15, 23, 42, .14);
    backdrop-filter: blur(14px);
  }
}

/* Purchase Voucher AI Review — pane-width repair for 100% desktop zoom.
   The source scan remains visible on the left, so the voucher form pane is much
   narrower than the browser viewport. These high-specificity rules make the
   right-side voucher pane behave correctly at normal 100% zoom. */
@media (min-width: 992px){
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid{
    grid-template-columns: repeat(6,minmax(0,1fr)) !important;
    gap:.58rem .62rem !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--series{grid-column:1 / 3 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--nature{grid-column:3 / 5 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--date{grid-column:5 / 7 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--supplier{grid-column:1 / 5 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--inline-payment{grid-column:5 / 7 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--contact{grid-column:1 / 4 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--due{grid-column:4 / 6 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--status{grid-column:6 / 7 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--type{grid-column:1 / 3 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--currency{grid-column:3 / 4 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--invoice{grid-column:4 / 5 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--requested{grid-column:5 / 7 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-field--number{grid-column:1 / 3 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .form-label{
    min-height:.82rem !important;
    line-height:.82rem !important;
    font-size:.66rem !important;
    letter-spacing:.055em !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .form-control,
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .form-select,
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .combo-input,
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .purchase-readonly-field{
    min-height:38px !important;
    height:38px !important;
    font-size:.82rem !important;
    padding:.42rem .56rem !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .input-group{
    min-width:0 !important;
    flex-wrap:nowrap !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .input-group > .form-control,
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .input-group > .form-select{
    width:1% !important;
    min-width:0 !important;
    flex:1 1 0 !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .input-group > .btn,
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .input-group > .input-group-text,
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-header-grid .combo-toggle{
    flex:0 0 36px !important;
    width:36px !important;
    min-width:36px !important;
    max-width:36px !important;
    height:38px !important;
    padding:0 !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .purchase-header-payment-toggle{
    min-height:38px !important;
    padding:.28rem .48rem !important;
    gap:.38rem !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .purchase-header-payment-toggle label strong{font-size:.72rem !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .purchase-header-payment-toggle label span{font-size:.60rem !important;}
}

@media (min-width: 768px){
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row{
    grid-template-columns: repeat(12,minmax(0,1fr)) !important;
    gap:.48rem .50rem !important;
    padding:.62rem .66rem !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-description{grid-column:1 / 11 !important;grid-row:1 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-actions{grid-column:11 / 13 !important;grid-row:1 !important;align-self:end !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-qty{grid-column:1 / 3 !important;grid-row:2 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-unit{grid-column:3 / 5 !important;grid-row:2 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-rate{grid-column:5 / 7 !important;grid-row:2 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-net{grid-column:7 / 9 !important;grid-row:2 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-vat-rate{grid-column:9 / 10 !important;grid-row:2 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-vat-amount{grid-column:10 / 11 !important;grid-row:2 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-cell-total{grid-column:11 / 13 !important;grid-row:2 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row > td.pv35-line-context-cell{grid-column:1 / -1 !important;grid-row:3 !important;}
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .pv35-line-context-grid{
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap:.48rem !important;
    padding:.48rem !important;
    overflow:hidden !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .voucher-line-row.is-line-details-open .pv35-line-context-grid{
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .pv35-context-group--account,
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .pv35-context-group--so{
    min-width:0 !important;
    max-width:100% !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .voucher-lines-table .pv35-cell-actions .remove-row{
    min-width:38px !important;
    width:38px !important;
    height:34px !important;
    justify-self:end !important;
  }
}

@media (min-width: 992px) and (max-width: 1599.98px){
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .purchase-total-strip{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
  body.nx-m26-shell .purchase-screen--voucher.pv-ai-review-workspace .pv-ai-kpi-grid{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
  }
}

/* Finance Review supplier picker overlay repair.
   The Finance Review workbench uses rounded cards/accordions. Some of those
   containers clip absolutely-positioned combo dropdowns, so the supplier search
   result list appeared underneath or behind the page. Keep the dropdown above
   the review form while preserving the picker backend and hidden field. */
body:has(#expenseCorrectionForm) .review-card,
body:has(#expenseCorrectionForm) .accordion,
body:has(#expenseCorrectionForm) .accordion-item,
body:has(#expenseCorrectionForm) .accordion-collapse,
body:has(#expenseCorrectionForm) .accordion-body,
body:has(#expenseCorrectionForm) .card-body {
  overflow: visible !important;
}

body:has(#expenseCorrectionForm) .card-body:has(.supplier-combobox.open),
body:has(#expenseCorrectionForm) .accordion-item:has(.supplier-combobox.open),
body:has(#expenseCorrectionForm) .accordion-collapse:has(.supplier-combobox.open),
body:has(#expenseCorrectionForm) .accordion-body:has(.supplier-combobox.open) {
  position: relative !important;
  z-index: 6000 !important;
}

body:has(#expenseCorrectionForm) .supplier-combobox.open {
  z-index: 7000 !important;
  isolation: auto !important;
}

body:has(#expenseCorrectionForm) .supplier-combobox.open .combo-shell {
  z-index: 7001 !important;
}

body:has(#expenseCorrectionForm) .supplier-combobox.open .combo-panel {
  z-index: 7002 !important;
  max-height: min(360px, calc(100vh - 190px)) !important;
  box-shadow: 0 24px 52px rgba(15,23,42,.22) !important;
}

@media (max-width: 767.98px){
  body:has(#expenseCorrectionForm) .supplier-combobox.open .combo-panel {
    max-height: min(320px, calc(100vh - 150px)) !important;
  }
}
