
/* V302 — Audit & hardening toàn bộ giao diện DESKTOP.
   - <1100px: không đụng mobile hiện tại
   - 1100–1535px: tối ưu desktop hẹp / Windows Scale 125%
   - >=1536px: giữ bố cục rộng hiện tại, chỉ chống tràn/chồng chữ
*/

/* -------------------- DESKTOP CHUNG -------------------- */
@media (min-width:1100px){
  .v293-desktop-lists{
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
  }

  .v293-desktop-lists > *,
  .v293-desktop-lists main,
  .v293-desktop-lists section,
  .v293-desktop-lists article{
    min-width:0;
  }

  /* Không để các khung nội dung bị bó giữa màn hình lớn */
  .v293-desktop-lists .max-w-4xl,
  .v293-desktop-lists .max-w-5xl,
  .v293-desktop-lists .max-w-6xl,
  .v293-desktop-lists .max-w-7xl{
    width:100%!important;
    max-width:none!important;
  }

  /* Toolbar / filter tự xuống dòng khi thiếu chỗ */
  .v293-desktop-lists [class*="items-center"][class*="justify-between"],
  .v293-desktop-lists [class*="items-end"][class*="justify-between"]{
    min-width:0;
  }

  .v293-desktop-lists input,
  .v293-desktop-lists select,
  .v293-desktop-lists textarea,
  .v293-desktop-lists [data-slot="select-trigger"]{
    min-width:0!important;
    max-width:100%;
  }

  /* Bảng: chống chồng chữ và giữ số tiền/mã ổn định */
  .v293-desktop-lists [class*="overflow-x-auto"],
  .v293-desktop-lists .responsive-report-table{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  .v293-desktop-lists table{
    width:100%!important;
    max-width:100%!important;
  }

  .v293-desktop-lists th{
    white-space:nowrap!important;
  }

  .v293-desktop-lists td{
    min-width:0!important;
  }

  .v293-desktop-lists td .tabular,
  .v293-desktop-lists td [class*="font-mono"],
  .v293-desktop-lists td[class*="text-right"]{
    white-space:nowrap!important;
  }

  .v293-desktop-lists td button,
  .v293-desktop-lists td a{
    max-width:100%;
  }

  /* Phân trang luôn gọn và không lệch */
  .v293-desktop-lists .v285-pagination,
  .v293-desktop-lists .v289-ncc-pagination,
  .v293-desktop-lists .v296-revenue-pagination,
  .v293-desktop-lists .v299-detail-pagination{
    width:100%!important;
    min-width:0!important;
  }

  /* Dashboard/KPI không bị bó giữa */
  .v293-desktop-lists .v235-revenue-kpi-grid,
  .v293-desktop-lists [class*="kpi-grid"]{
    width:100%!important;
    max-width:none!important;
  }

  /* Công nợ NCC */
  .v293-desktop-lists .v287-ncc-filterbar{
    width:100%!important;
    min-width:0!important;
  }

  .v293-desktop-lists .v275-supplier-debt-row{
    width:100%!important;
    min-width:0!important;
  }

  /* Nhà cung cấp */
  .v293-desktop-lists .v285-supplier-toolbar,
  .v293-desktop-lists .v285-supplier-tools{
    min-width:0!important;
  }
}

/* -------------------- DESKTOP HẸP / SCALE 125% -------------------- */
@media (min-width:1100px) and (max-width:1535px){

  .v293-desktop-lists{
    --v302-gap:10px;
  }

  /* Giảm padding vừa đủ, không làm chữ nhỏ quá */
  .v293-desktop-lists table{
    font-size:11.25px!important;
  }

  .v293-desktop-lists thead th{
    font-size:9.75px!important;
    padding-left:8px!important;
    padding-right:8px!important;
  }

  .v293-desktop-lists tbody td{
    padding-left:8px!important;
    padding-right:8px!important;
  }

  /* Các thanh lọc không ép cột */
  .v293-desktop-lists [class*="flex"][class*="gap-3"],
  .v293-desktop-lists [class*="flex"][class*="gap-4"]{
    gap:8px!important;
  }

  .v293-desktop-lists [class*="flex-wrap"]{
    row-gap:8px!important;
  }

  /* Báo cáo doanh thu: bảng nhiều cột được cuộn ngang an toàn,
     không co chữ đến mức khó đọc. */
  .v197-revenue-report .responsive-report-table{
    overflow-x:auto!important;
    scrollbar-width:thin;
  }

  .v197-revenue-report .responsive-report-table table{
    min-width:980px!important;
  }

  /* Riêng Khách hàng/Nhân viên ở >1100 vẫn là desktop:
     cho min-width hợp lý để không bóp chữ. */
  .v298-report-customer-section .responsive-report-table table{
    min-width:1050px!important;
  }

  .v298-report-employee-section .responsive-report-table table{
    min-width:1120px!important;
  }

  /* Danh sách đơn báo cáo */
  .v199-report-orders-desktop{
    overflow-x:auto!important;
    max-width:100%!important;
  }

  .v199-report-orders-desktop table{
    min-width:980px!important;
  }

  /* Tồn kho / sản phẩm / đơn hàng nhiều cột:
     ưu tiên đọc đúng hơn là ép chữ. */
  .v271-products-table-wrap{
    overflow-x:auto!important;
  }

  .v271-products-table{
    min-width:1120px!important;
  }

  /* Công nợ NCC: thanh lọc tự chia 2 hàng nếu thiếu chỗ */
  .v287-ncc-filterbar{
    grid-template-columns:
      minmax(200px,1.3fr)
      minmax(140px,.75fr)
      minmax(140px,.75fr)
      auto!important;
  }

  .v287-ncc-filterbar .v288-export-actions{
    grid-column:auto!important;
  }

  /* Các nút thao tác không chồng chữ */
  .v293-desktop-lists td > .flex{
    flex-wrap:nowrap!important;
  }

  .v293-desktop-lists td > .flex button,
  .v293-desktop-lists td > .flex a{
    flex:0 0 auto!important;
    white-space:nowrap!important;
  }

  /* Modal tạo/sửa đơn */
  .order-dialog-content{
    width:min(96vw,1480px)!important;
    max-width:min(96vw,1480px)!important;
  }

  .order-dialog-content .order-dialog-body{
    min-width:0!important;
    max-width:100%!important;
  }
}

/* -------------------- FULL HD / 2K -------------------- */
@media (min-width:1536px) and (max-width:2399px){
  .v293-desktop-lists{
    width:100%!important;
    max-width:none!important;
  }

  .v293-desktop-lists table{
    font-size:12px!important;
  }

  /* Không ép min-width ở màn hình rộng */
  .v197-revenue-report .responsive-report-table table,
  .v298-report-customer-section .responsive-report-table table,
  .v298-report-employee-section .responsive-report-table table,
  .v199-report-orders-desktop table,
  .v271-products-table{
    min-width:100%!important;
  }
}

/* -------------------- 2K / ULTRAWIDE -------------------- */
@media (min-width:2400px){
  .v293-desktop-lists{
    width:100%!important;
    max-width:none!important;
  }

  .v293-desktop-lists table{
    font-size:12.5px!important;
  }

  .v293-desktop-lists thead th{
    font-size:10.5px!important;
  }

  /* Tận dụng chiều rộng nhưng không kéo nút thao tác quá xa */
  .v293-desktop-lists td:last-child,
  .v293-desktop-lists th:last-child{
    white-space:nowrap!important;
  }

  .v197-revenue-report .responsive-report-table table,
  .v298-report-customer-section .responsive-report-table table,
  .v298-report-employee-section .responsive-report-table table,
  .v199-report-orders-desktop table,
  .v271-products-table{
    min-width:100%!important;
  }
}
