/*
 * Qt source-faithful visual corrections, 2026-11-17.
 * Source: uploaded ERPSYSTEM/ui/styles/modern_main_window.css,
 * ui/modern_main_layout.py::ModernSidebar,
 * modules/customers/views/customer_management_window.py::_create_ui,
 * _create_toolbar, _create_customers_tab, _apply_styles.
 * Loaded after module-specific parity sheets. No data, permission, tenant,
 * route, or business behavior is changed. Master panel is not targeted.
 */

/* Qt's ModernSidebar places a real 'لوحة التحكم' heading above the button list.
   In Cloud the original .side-label is hidden in Qt desktop mode. */
.qt-sidebar-title{display:none}
@media (min-width:651px){
 body.qt-desktop-mode .qt-sidebar-title{
  display:flex;align-items:center;justify-content:center;flex:0 0 auto;
  min-height:40px;margin:0 8px 8px;padding:7px 12px;
  background:#244875;color:#fff;border-bottom:1px solid #6d89aa;
  font:700 18px Arial,Tahoma,sans-serif;text-align:center;
 }
 body.qt-desktop-mode .qt-native-nav{gap:4px}
 body.qt-desktop-mode .qt-sidebar-button{
  height:44px;min-height:44px;max-height:44px;flex-basis:44px;
  border-radius:7px;padding:0 8px;line-height:1.15;
 }
}
@media (min-width:901px){
 body.qt-desktop-mode .qt-sidebar-button{
  font-family:Arial,Tahoma,sans-serif;font-size:22px;font-weight:700;
 }
}

/* Customer and supplier window tabs use the original QTabBar style:
   #F7F9FC inactive, white selected, navy 3px underline. */
body.qt-desktop-mode :is(.qt-native-customers,.qt-native-suppliers) .qt-native-tabs{
 direction:rtl;justify-content:flex-start;gap:3px;
 border-bottom:1px solid #d9e3ef;
}
body.qt-desktop-mode :is(.qt-native-customers,.qt-native-suppliers) .qt-native-tabs .qt-native-action{
 min-width:105px;min-height:36px;height:36px;
 padding:8px 20px;border:1px solid #d9e3ef;border-radius:0;
 border-bottom:1px solid #d9e3ef;
 background:#f7f9fc;color:#244875;font-weight:800;
}
body.qt-desktop-mode :is(.qt-native-customers,.qt-native-suppliers) .qt-native-tabs .qt-native-action.active{
 background:#fff;color:#173e70;border-color:#d9e3ef;
 border-bottom:3px solid #244875;
}

/* The Qt CustomerWindow header is 62px, toolbar contents are LTR in
   the physical screen, and the module title is at the right. */
@media (min-width:1151px){
 body.qt-desktop-mode .qt-native-customers .qt-native-module-header{
  min-height:62px;height:62px;padding:7px 12px 7px 10px;
  direction:ltr;gap:7px;flex-wrap:nowrap;
 }
 body.qt-desktop-mode .qt-native-customers .qt-native-command-row{
  direction:ltr;gap:7px;flex-wrap:nowrap;min-width:0;
 }
 body.qt-desktop-mode .qt-native-customers .qt-native-module-heading{
  direction:rtl;min-width:300px;text-align:right;align-items:flex-start;
 }
}

/* Customer QTableWidget explicitly right-aligns the Name and Notes cells;
   all other data cells remain centered by the original Qt code. */
body.qt-desktop-mode .qt-native-customers .qt-native-table tbody td:nth-child(2),
body.qt-desktop-mode .qt-native-customers .qt-native-table tbody td:nth-child(9){
 text-align:right;
}

/* Native CustomerWindow QSS rowAction='edit' and rowAction='delete'. */
body.qt-desktop-mode .qt-native-customers .qt-native-row-actions .qt-native-action.secondary{
 color:#1768b5;background:#eaf3ff;border:1px solid #9cc8f4;
 font-size:11px;font-weight:800;
}
body.qt-desktop-mode .qt-native-customers .qt-native-row-actions .qt-native-action.secondary:hover:not(:disabled){
 background:#ddeeff;color:#1768b5;border-color:#9cc8f4;
}
body.qt-desktop-mode .qt-native-customers .qt-native-row-actions .qt-native-action.danger{
 color:#c9372c;background:#fff0ef;border:1px solid #f3b1ac;
 font-size:11px;font-weight:800;
}
body.qt-desktop-mode .qt-native-customers .qt-native-row-actions .qt-native-action.danger:hover:not(:disabled){
 background:#ffe3e0;color:#c9372c;border-color:#f3b1ac;
}

/* Qt entry widgets focus border: scoped to the native party windows rather
   than globally altering POS, invoice, or master-owner controls. */
body.qt-desktop-mode :is(.qt-native-customers,.qt-native-suppliers)
 :is(input:not([type=checkbox]),select):focus-visible{
 border:2px solid #2e73b9;outline:none;background:#fff;
}

/* Preserve source desktop proportions on smaller browser viewports:
   the native scroll containers own horizontal overflow, not the shell. */
body.qt-desktop-mode .qt-native-customers .qt-native-table-scroll,
body.qt-desktop-mode .qt-native-suppliers .qt-native-table-scroll{
 min-width:0;overflow:auto;overscroll-behavior:contain;
}

/*
 * 2026-11-18 — supplier-only Qt source geometry.
 * Based on ERPSYSTEM/modules/suppliers/views/suppliers_window.py
 * _create_toolbar / _create_suppliers_tab / _apply_styles, plus
 * NewSupplierDialog and views/payment_dialog.py. Scoped to suppliers;
 * no customer, POS, accounting, tenant or Master Owner layout changed.
 */
@media (min-width:1151px){
 body.qt-desktop-mode .qt-native-suppliers .qt-native-module-header{
  min-height:62px;height:62px;box-sizing:border-box;direction:ltr;
  padding:7px 12px 7px 10px;gap:7px;flex-wrap:nowrap;
  background:#fff;border:1px solid #d9e3ef;border-radius:8px;
 }
 body.qt-desktop-mode .qt-native-suppliers .qt-native-command-row{
  direction:ltr;gap:7px;flex-wrap:nowrap;min-width:0;
 }
 body.qt-desktop-mode .qt-native-suppliers .qt-native-module-heading{
  min-width:300px;direction:rtl;text-align:right;align-items:flex-start;
 }
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-module-main{
 background:#fff;padding:6px;border-radius:7px;min-width:0;
 border:1px solid #d9e3ef;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-summary{
 display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;
 direction:rtl;margin:0;min-height:76px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-summary-card{
 min-width:0;min-height:76px;box-sizing:border-box;
 border-radius:8px;border:1px solid #d9e3ef;
 padding:8px 12px 7px;display:flex;flex-direction:column;
 align-items:flex-start;justify-content:center;gap:1px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-summary-card span{
 font-size:10px;font-weight:800;line-height:1.35;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-summary-card strong{
 font-size:18px;font-weight:900;line-height:1.45;min-width:0;
 overflow-wrap:anywhere;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-filters{
 direction:rtl;min-height:68px;box-sizing:border-box;
 padding:8px 10px;gap:7px;background:#fff;
 border:1px solid #d9e3ef;border-radius:8px;
}
@media (min-width:1151px){
 body.qt-desktop-mode .qt-native-suppliers .qt-native-filters input:first-child{
  flex:2 1 360px;min-width:360px;max-width:520px;
 }
 body.qt-desktop-mode .qt-native-suppliers .qt-native-filters select{
  flex:0 0 135px;min-width:135px;max-width:135px;
 }
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-filters :is(input,select,button){
 box-sizing:border-box;min-height:36px;border-radius:6px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-table-scroll{
 overflow:auto;overscroll-behavior:contain;
 border:1px solid #c8d5e4;border-radius:6px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-table{
 width:100%;border-collapse:separate;border-spacing:0;
 background:#fff;color:#173e70;direction:rtl;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-table thead th{
 position:sticky;top:0;height:39px;box-sizing:border-box;
 padding:7px 5px;background:#244875;color:#fff;
 border-inline-start:1px solid #3d5f89;font-weight:800;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-table tbody tr{
 height:40px;min-height:40px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-table tbody tr:nth-child(even){
 background:#f8fafd;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-table tbody td{
 padding:5px;color:#173e70;border-bottom:1px solid #dde5ef;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-table tbody td:nth-child(2){
 text-align:right;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-row-actions{
 display:flex;align-items:center;justify-content:center;gap:4px;
 background:transparent;border:0;min-width:124px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-row-actions .qt-native-action.secondary{
 color:#1768b5;background:#eaf3ff;border:1px solid #9cc8f4;
 font-size:11px;font-weight:800;min-height:28px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-row-actions .qt-native-action.danger{
 color:#c9372c;background:#fff0ef;border:1px solid #f3b1ac;
 font-size:11px;font-weight:800;min-height:28px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-pagination{
 min-height:52px;box-sizing:border-box;padding:6px 10px;gap:7px;
 background:#fff;border:1px solid #d9e3ef;border-radius:8px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-pagination button{
 min-height:34px;min-width:82px;
}
body.qt-desktop-mode .qt-native-supplier-dialog{
 width:min(640px,calc(100vw - 32px));max-height:calc(100dvh - 48px);
 box-sizing:border-box;background:#f7f9fc;direction:rtl;
}
body.qt-desktop-mode .qt-native-supplier-dialog .qt-native-edit-form>.form-grid{
 gap:8px;direction:rtl;
}
body.qt-desktop-mode .qt-native-supplier-dialog .qt-native-field :is(input,select){
 min-height:32px;box-sizing:border-box;border-radius:5px;
 border:1px solid #c8d1e1;background:#fff;
}
body.qt-desktop-mode .qt-native-supplier-dialog .qt-native-field textarea{
 height:70px;min-height:56px;max-height:70px;resize:vertical;
 border:1px solid #c8d1e1;border-radius:5px;background:#fff;
}
body.qt-desktop-mode .qt-supplier-invoice-pay-dialog{
 width:min(600px,calc(100vw - 32px));max-height:calc(100dvh - 32px);
 direction:rtl;overflow:auto;
}
body.qt-desktop-mode .qt-native-supplier-report-dialog{
 width:min(1000px,calc(100vw - 32px));max-height:calc(100dvh - 32px);
 direction:rtl;overflow:auto;
}
@media (max-width:1050px){
 body.qt-desktop-mode .qt-native-suppliers .qt-native-summary{
  grid-template-columns:repeat(2,minmax(0,1fr));height:auto;
 }
 body.qt-desktop-mode .qt-native-suppliers .qt-native-filters{
  height:auto;flex-wrap:wrap;
 }
}
@media (max-width:560px){
 body.qt-desktop-mode .qt-native-suppliers .qt-native-summary{
  grid-template-columns:minmax(0,1fr);
 }
 body.qt-desktop-mode .qt-native-suppliers .qt-native-table-scroll{
  max-width:100%;overflow-x:auto;
 }
 body.qt-desktop-mode .qt-native-suppliers .qt-native-pagination{
  height:auto;flex-wrap:wrap;
 }
}

/* Source: Qt SupplierWindow._create_payments_tab, account/payment panels.
   Only supplier finance geometry is affected. */
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-actions{
 direction:ltr;display:flex;justify-content:flex-start;align-items:center;
 flex-wrap:wrap;gap:6px;min-height:46px;padding:5px 8px;
 box-sizing:border-box;background:#fff;border:1px solid #d7e1ec;border-radius:8px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-actions .qt-native-action{
 min-height:34px;flex:0 0 auto;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-actions .qt-native-action:first-child{
 min-width:140px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-toolbar,
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-filters{
 direction:rtl;background:#fff;border:1px solid #d7e1ec;
 border-radius:8px;box-sizing:border-box;padding:7px 10px;gap:7px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-filters input[type=date]{
 width:112px;min-width:112px;max-width:112px;min-height:32px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-filters input:not([type=date]){
 min-width:145px;max-width:185px;flex:1 1 145px;min-height:32px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-table{
 min-height:210px;background:#fff;border:1px solid #cfd9e5;
 border-radius:6px;overflow:auto;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-table .qt-native-table{
 width:100%;border-collapse:collapse;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-table .qt-native-table thead th{
 background:#244875;color:#fff;border-inline-start:1px solid #365b86;
 padding:8px 5px;font-weight:800;white-space:nowrap;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-table .qt-native-table tbody tr{
 height:32px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-table .qt-native-table tbody tr:nth-child(even){
 background:#f8fafc;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-table .qt-native-table tbody td{
 padding:5px;color:#102844;border-bottom:1px solid #e7edf4;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-ledger-stats{
 direction:ltr;gap:8px;padding:6px 8px;background:#fff;
 border:1px solid #d7e1ec;border-radius:8px;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-ledger-stat{
 min-height:72px;min-width:0;border:1px solid #d6e0eb;border-radius:7px;
 background:#f8fafc;display:flex;flex-direction:column;align-items:center;
 justify-content:center;gap:1px;padding:4px 6px;text-align:center;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-ledger-stat small{
 color:#244875;font-size:10px;font-weight:800;
}
body.qt-desktop-mode .qt-native-suppliers .qt-native-ledger-stat strong{
 color:#244875;font-size:13px;font-weight:900;overflow-wrap:anywhere;
}
@media(max-width:680px){
 body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-filters input[type=date]{
  width:auto;min-width:0;max-width:100%;flex:1 1 145px;
 }
 body.qt-desktop-mode .qt-native-suppliers .qt-native-supplier-finance-actions{
  direction:rtl;
 }
}
