/* TT_MOBILE_PAGE_LAYOUT_FINAL_V1 */
/* Nguyên tắc: card rộng, khối nhiều cột cuộn ngang trong chính nó, không chồng đè */

@media (max-width:899px){

  html,
  body{
    width:100%!important;
    max-width:100%!important;
    overflow-x:hidden!important;
    background:#f3f6fa!important;
  }

  *{
    box-sizing:border-box!important;
  }

  .app,
  main.page,
  .page{
    width:100vw!important;
    max-width:100vw!important;
    min-width:0!important;
    margin:0!important;
    padding-left:6px!important;
    padding-right:6px!important;
    padding-bottom:112px!important;
    overflow-x:hidden!important;
  }

  .page > section,
  .page > div,
  .card,
  .card.pad{
    max-width:100%!important;
    min-width:0!important;
  }

  .card,
  .card.pad{
    border-radius:18px!important;
  }

  /* ===== HEADER / MENU 6 NÚT ===== */
  .tabs.tt-tabs-6-v1{
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    height:74px!important;
    overflow:hidden!important;
  }

  .tabs.tt-tabs-6-v1 .tab{
    min-width:0!important;
    font-size:9.5px!important;
    padding:5px 1px 7px!important;
  }

  .tabs.tt-tabs-6-v1 .tab .ico{
    font-size:16px!important;
  }


  /* =======================================================
     BÁN HÀNG / TẠO ĐƠN
     ======================================================= */
  .tt-sale-page-v3{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
    padding:0 0 112px!important;
  }

  .tt-sale-head-v3,
  .tt-sale-head-compact-v4{
    display:block!important;
    width:100%!important;
    text-align:center!important;
    margin:0 0 10px!important;
    padding:0!important;
  }

  .tt-sale-head-v3 h1{
    font-size:28px!important;
    line-height:1.12!important;
    margin:8px 0 8px!important;
  }

  .tt-sale-staff-card-v4{
    position:static!important;
    width:100%!important;
    max-width:100%!important;
    margin:0 0 10px!important;
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
    gap:6px!important;
    padding:7px 10px!important;
    border-radius:999px!important;
    white-space:nowrap!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
  }

  .tt-sale-layout-v3{
    display:flex!important;
    flex-direction:column!important;
    width:100%!important;
    max-width:100%!important;
    gap:12px!important;
    overflow:visible!important;
  }

  .tt-sale-left-v3,
  .tt-sale-slip-v3{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    display:block!important;
    position:static!important;
    transform:none!important;
    overflow:visible!important;
  }

  .tt-sale-toolbar-v3,
  .tt-sale-toolbar-premium-v2{
    width:100%!important;
    max-width:100%!important;
    padding:12px!important;
    border-radius:18px!important;
    overflow:hidden!important;
    margin:0 0 10px!important;
  }

  .tt-sale-customer-top-v2,
  .tt-sale-customer-info-v2,
  .tt-sale-control-row-v2{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    width:100%!important;
    max-width:100%!important;
  }

  .tt-inline-v3{
    display:grid!important;
    grid-template-columns:1fr auto!important;
    gap:8px!important;
    width:100%!important;
  }

  .tt-field-v3,
  .tt-field-v3 label,
  .tt-field-v3 input,
  .tt-field-v3 select,
  .tt-search-v3,
  .tt-search-v3 input{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  .tt-sale-product-list-v3{
    width:100%!important;
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:8px!important;
    overflow:visible!important;
    padding-bottom:8px!important;
  }

  .tt-sale-product-v3{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    display:grid!important;
    grid-template-columns:58px minmax(0,1fr) auto 42px!important;
    gap:10px!important;
    align-items:center!important;
    padding:10px!important;
    border-radius:16px!important;
    overflow:hidden!important;
    text-align:left!important;
  }

  .tt-sale-thumb-v3{
    width:54px!important;
    height:54px!important;
    border-radius:14px!important;
    overflow:hidden!important;
  }

  .tt-sale-product-main-v3{
    min-width:0!important;
    overflow:hidden!important;
  }

  .tt-sale-product-main-v3 b,
  .tt-sale-product-main-v3 span{
    display:block!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .tt-sale-product-v3 strong{
    white-space:nowrap!important;
    font-size:14px!important;
  }

  .tt-sale-slip-v3{
    order:3!important;
  }

  .tt-slip-card-v3{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    position:static!important;
    transform:none!important;
    margin:0!important;
    padding:14px!important;
    border-radius:18px!important;
    overflow:hidden!important;
  }

  .tt-slip-title-v3,
  .tt-slip-customer-v3,
  .tt-slip-total-v3,
  .tt-slip-note-v3{
    width:100%!important;
    max-width:100%!important;
  }

  .tt-slip-pay-v3,
  .tt-slip-edit-v3{
    display:grid!important;
    grid-template-columns:1fr 1fr!important;
    gap:8px!important;
  }

  .tt-slip-row-v3{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  .tt-slip-row-top-v3,
  .tt-slip-price-v3{
    display:flex!important;
    gap:8px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    white-space:nowrap!important;
  }

  .tt-sale-submit-v3,
  .tt-sale-clear-v3{
    width:100%!important;
    max-width:100%!important;
  }


  /* =======================================================
     ĐƠN HÀNG
     ======================================================= */
  .tt-orders-page-v1,
  .tt-orders-dashboard-v2{
    width:100vw!important;
    max-width:100vw!important;
    margin:0!important;
    padding:14px 6px 112px!important;
    overflow-x:hidden!important;
  }

  .tt-orders-kpis-v1,
  .tt-orders-kpis-v2{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:0 0 8px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tt-orders-kpis-v1 > div,
  .tt-orders-kpis-v2 > div{
    flex:0 0 98px!important;
    min-width:98px!important;
    max-width:98px!important;
    min-height:88px!important;
    padding:10px!important;
    overflow:hidden!important;
  }

  .tt-orders-kpis-v1 span,
  .tt-orders-kpis-v2 span{
    font-size:12px!important;
    line-height:1.12!important;
    white-space:normal!important;
  }

  .tt-orders-kpis-v1 b,
  .tt-orders-kpis-v2 b{
    font-size:18px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
  }

  .tt-orders-filter-v2{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:10px!important;
    border-radius:18px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tt-orders-filter-v2 label{
    flex:0 0 260px!important;
    min-width:260px!important;
    max-width:260px!important;
  }

  .tt-orders-filter-v2 label:first-child{
    flex-basis:310px!important;
    min-width:310px!important;
  }

  .tt-orders-filter-v2 button{
    flex:0 0 96px!important;
    min-width:96px!important;
  }

  .tt-orders-debt-summary-v1,
  .tt-orders-card-v1,
  .tt-orders-card-v2{
    width:100%!important;
    max-width:100%!important;
    margin:0 0 12px!important;
    border-radius:18px!important;
    overflow:hidden!important;
  }

  .tt-orders-debt-summary-grid-v1{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tt-orders-debt-customer-v1{
    flex:0 0 158px!important;
    min-width:158px!important;
    max-width:158px!important;
    overflow:hidden!important;
  }

  .tt-orders-table-head-v1,
  .tt-orders-table-head-v2{
    display:none!important;
  }

  .tt-orders-row-v1,
  .tt-orders-row-v2{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    padding:16px 14px!important;
    border-radius:0!important;
    border-left:0!important;
    border-right:0!important;
    overflow:hidden!important;
  }

  .tt-orders-row-v1 > span,
  .tt-orders-row-v2 > span{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    margin-bottom:8px!important;
    overflow:hidden!important;
  }

  .tt-orders-row-v1 b,
  .tt-orders-row-v2 b,
  .tt-orders-row-v1 em,
  .tt-orders-row-v2 em{
    display:block!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  .ord-status,
  .pay-status{
    display:inline-flex!important;
    width:auto!important;
    max-width:100%!important;
    white-space:nowrap!important;
  }


  /* =======================================================
     HÀNG HÓA
     ======================================================= */
  #ttGoodsV33,
  .goods33-shell,
  .goods33-page,
  .goods33-wrap{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow-x:hidden!important;
  }

  #ttGoodsV33 .goods33-tabs,
  .goods33-tabs,
  .stocktake-tabs-v2,
  .stw-tabs,
  .tt-kiot-tabs{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:8px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  #ttGoodsV33 .goods33-tabs button,
  .goods33-tabs button,
  .stocktake-tabs-v2 button,
  .stw-tabs button,
  .tt-kiot-tabs button{
    flex:0 0 auto!important;
    min-width:150px!important;
    white-space:nowrap!important;
  }

  #ttGoodsV33 .goods33-toolbar,
  .goods33-toolbar,
  .goods33-actions,
  .goods33-filterbar,
  .stw-toolbar,
  .stocktake-toolbar{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:8px 0!important;
    -webkit-overflow-scrolling:touch!important;
  }

  #ttGoodsV33 .goods33-toolbar input,
  .goods33-toolbar input,
  .goods33-search input{
    min-width:260px!important;
  }

  #ttGoodsV33 .goods33-toolbar button,
  .goods33-toolbar button,
  .goods33-actions button{
    flex:0 0 auto!important;
    min-width:92px!important;
  }

  #ttGoodsV33 .goods33-layout,
  .goods33-layout,
  .stocktake-layout,
  .stw-layout{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  #ttGoodsV33 .goods33-sidebar,
  .goods33-sidebar,
  .stocktake-sidebar,
  .stw-sidebar,
  .goods33-filter-panel,
  .stocktake-filter-panel{
    position:static!important;
    transform:none!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0 0 12px!important;
    overflow:hidden!important;
    border-radius:18px!important;
  }

  #ttGoodsV33 .goods33-main,
  .goods33-main,
  .stocktake-main,
  .stw-main{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow:hidden!important;
  }

  #ttGoodsV33 table,
  .goods33-table,
  .stocktake-table,
  .stw-table{
    min-width:680px!important;
  }

  #ttGoodsV33 .goods33-table-wrap,
  .goods33-table-wrap,
  .stocktake-table-wrap,
  .stw-table-wrap,
  .goods33-card,
  .stocktake-card{
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch!important;
  }

  #ttGoodsV33 .goods33-product-row,
  .goods33-product-row{
    max-width:100%!important;
    overflow:hidden!important;
  }


  /* =======================================================
     KHÁCH HÀNG
     ======================================================= */
  .tt-customers-page-v1,
  .tt-customers-page-compact-v1{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
    padding:0 0 112px!important;
  }

  .tt-customers-head-v1{
    display:block!important;
    width:100%!important;
  }

  .tt-customers-head-v1 > div:last-child{
    display:flex!important;
    gap:8px!important;
    overflow-x:auto!important;
    padding:8px 0!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tt-customers-head-v1 button{
    flex:0 0 auto!important;
  }

  .tt-customers-subtabs-v1{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    overflow-x:auto!important;
    padding:6px 0!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tt-customers-subtabs-v1 button{
    flex:0 0 auto!important;
    white-space:nowrap!important;
  }

  .tt-customers-tools-v1{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:10px!important;
    border-radius:18px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tt-customers-tools-v1 > div{
    flex:0 0 260px!important;
    min-width:260px!important;
    max-width:260px!important;
  }

  .tt-customers-tools-v1 input,
  .tt-customers-tools-v1 select,
  .tt-customers-tools-v1 button{
    width:100%!important;
    min-width:0!important;
  }

  .tt-customers-card-v1{
    width:100%!important;
    max-width:100%!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    border-radius:18px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .tt-customers-profile-head-v1,
  .tt-customers-table-head-v1,
  .tt-customers-profile-row-v2,
  .tt-customers-row-v1{
    min-width:640px!important;
  }


  /* =======================================================
     NHÂN VIÊN
     ======================================================= */
  .staff36-shell,
  .staff36-page,
  .staff36-card,
  .staff36-panel,
  .staff36-list{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  .staff36-head,
  .staff36-toolbar{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .staff36-head button,
  .staff36-toolbar button,
  .staff36-toolbar input,
  .staff36-toolbar select{
    flex:0 0 auto!important;
    min-width:150px!important;
  }

  .staff36-kpis{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .staff36-kpis > *,
  .staff36-kpi{
    flex:0 0 104px!important;
    min-width:104px!important;
    max-width:104px!important;
  }

  .staff36-person,
  .staff36-row{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
    padding:14px!important;
    border-radius:18px!important;
  }

  .staff36-actions,
  .staff36-status,
  .staff36-state,
  .staff36-money{
    display:flex!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    width:100%!important;
    margin-top:8px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  .staff36-actions button,
  .staff36-person button,
  .staff36-row button{
    flex:0 0 auto!important;
    min-width:112px!important;
    max-width:none!important;
  }
}

/* TT_ORDERS_MOBILE_KPI_3X2_FULLCARD_V2 */
@media (max-width:899px){

  html body #app .tt-orders-page-v1{
    padding:14px 10px 112px!important;
    overflow-x:hidden!important;
    box-sizing:border-box!important;
  }

  html body #app .tt-orders-page-v1 *,
  html body #app .tt-orders-page-v1 *::before,
  html body #app .tt-orders-page-v1 *::after{
    box-sizing:border-box!important;
  }

  /* Header + các card chính full giống module Bán hàng */
  html body #app .tt-orders-head-v1,
  html body #app .tt-orders-filter-v2,
  html body #app .tt-orders-debt-summary-v1,
  html body #app .tt-orders-card-v1{
    width:100%!important;
    max-width:100%!important;
    margin:0 0 14px!important;
    border-radius:18px!important;
    overflow:hidden!important;
  }

  /* KPI đúng logic: 2 hàng, mỗi hàng 3 ô */
  html body #app .tt-orders-kpis-v1,
  html body #app .tt-orders-kpis-v2{
    width:100%!important;
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-flow:row!important;
    gap:8px!important;
    margin:0 0 14px!important;
    padding:0!important;
    overflow:visible!important;
  }

  html body #app .tt-orders-kpis-v1 > div,
  html body #app .tt-orders-kpis-v2 > div{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:76px!important;
    padding:9px 8px!important;
    border-radius:16px!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-kpis-v1 > div span,
  html body #app .tt-orders-kpis-v2 > div span{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:11px!important;
    line-height:1.15!important;
    font-weight:800!important;
  }

  html body #app .tt-orders-kpis-v1 > div b,
  html body #app .tt-orders-kpis-v2 > div b{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    margin-top:8px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:20px!important;
    line-height:1.05!important;
    font-weight:950!important;
  }

  /* Tổng công nợ thường dài, giảm cỡ chữ để không vỡ ô */
  html body #app .tt-orders-kpis-v1 > div:nth-child(6) b,
  html body #app .tt-orders-kpis-v2 > div:nth-child(6) b{
    font-size:18px!important;
    letter-spacing:-.4px!important;
  }

  /* Bộ lọc full card, không lòi phải */
  html body #app .tt-orders-filter-v2{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    padding:14px!important;
  }

  html body #app .tt-orders-filter-v2 label,
  html body #app .tt-orders-filter-v2 input,
  html body #app .tt-orders-filter-v2 select,
  html body #app .tt-orders-filter-v2 button{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  /* Công nợ full card */
  html body #app .tt-orders-debt-summary-v1{
    padding:14px!important;
  }

  html body #app .tt-orders-debt-summary-head-v1{
    display:block!important;
    margin-bottom:12px!important;
  }

  html body #app .tt-orders-debt-summary-head-v1 button{
    width:100%!important;
    max-width:100%!important;
    margin-top:10px!important;
  }

  html body #app .tt-orders-debt-summary-grid-v1{
    display:grid!important;
    grid-auto-flow:column!important;
    grid-auto-columns:minmax(210px,210px)!important;
    gap:10px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:0 0 6px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  /* Danh sách đơn full card */
  html body #app .tt-orders-card-v1{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-table-head-v1{
    display:none!important;
  }

  html body #app .tt-orders-row-v1{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    width:100%!important;
    padding:14px!important;
  }

  html body #app .tt-orders-row-v1 > span{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
}

/* TT_ORDERS_MOBILE_KPI_3X2_FULLCARD_V2 */
@media (max-width:899px){

  html body #app .tt-orders-page-v1{
    padding:14px 10px 112px!important;
    overflow-x:hidden!important;
    box-sizing:border-box!important;
  }

  html body #app .tt-orders-page-v1 *,
  html body #app .tt-orders-page-v1 *::before,
  html body #app .tt-orders-page-v1 *::after{
    box-sizing:border-box!important;
  }

  /* Header + các card chính full giống module Bán hàng */
  html body #app .tt-orders-head-v1,
  html body #app .tt-orders-filter-v2,
  html body #app .tt-orders-debt-summary-v1,
  html body #app .tt-orders-card-v1{
    width:100%!important;
    max-width:100%!important;
    margin:0 0 14px!important;
    border-radius:18px!important;
    overflow:hidden!important;
  }

  /* KPI đúng logic: 2 hàng, mỗi hàng 3 ô */
  html body #app .tt-orders-kpis-v1,
  html body #app .tt-orders-kpis-v2{
    width:100%!important;
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-flow:row!important;
    gap:8px!important;
    margin:0 0 14px!important;
    padding:0!important;
    overflow:visible!important;
  }

  html body #app .tt-orders-kpis-v1 > div,
  html body #app .tt-orders-kpis-v2 > div{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:76px!important;
    padding:9px 8px!important;
    border-radius:16px!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-kpis-v1 > div span,
  html body #app .tt-orders-kpis-v2 > div span{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:11px!important;
    line-height:1.15!important;
    font-weight:800!important;
  }

  html body #app .tt-orders-kpis-v1 > div b,
  html body #app .tt-orders-kpis-v2 > div b{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    margin-top:8px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:20px!important;
    line-height:1.05!important;
    font-weight:950!important;
  }

  /* Tổng công nợ thường dài, giảm cỡ chữ để không vỡ ô */
  html body #app .tt-orders-kpis-v1 > div:nth-child(6) b,
  html body #app .tt-orders-kpis-v2 > div:nth-child(6) b{
    font-size:18px!important;
    letter-spacing:-.4px!important;
  }

  /* Bộ lọc full card, không lòi phải */
  html body #app .tt-orders-filter-v2{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    padding:14px!important;
  }

  html body #app .tt-orders-filter-v2 label,
  html body #app .tt-orders-filter-v2 input,
  html body #app .tt-orders-filter-v2 select,
  html body #app .tt-orders-filter-v2 button{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  /* Công nợ full card */
  html body #app .tt-orders-debt-summary-v1{
    padding:14px!important;
  }

  html body #app .tt-orders-debt-summary-head-v1{
    display:block!important;
    margin-bottom:12px!important;
  }

  html body #app .tt-orders-debt-summary-head-v1 button{
    width:100%!important;
    max-width:100%!important;
    margin-top:10px!important;
  }

  html body #app .tt-orders-debt-summary-grid-v1{
    display:grid!important;
    grid-auto-flow:column!important;
    grid-auto-columns:minmax(210px,210px)!important;
    gap:10px!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    padding:0 0 6px!important;
    -webkit-overflow-scrolling:touch!important;
  }

  /* Danh sách đơn full card */
  html body #app .tt-orders-card-v1{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-table-head-v1{
    display:none!important;
  }

  html body #app .tt-orders-row-v1{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    width:100%!important;
    padding:14px!important;
  }

  html body #app .tt-orders-row-v1 > span{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
}

/* TT_ORDERS_MOBILE_FINAL_3X2_THIN_DEBT_V3 */
@media (max-width:899px){

  html body #app .tt-orders-page-v1{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:14px 10px 112px!important;
    overflow-x:hidden!important;
    box-sizing:border-box!important;
  }

  html body #app .tt-orders-page-v1 *,
  html body #app .tt-orders-page-v1 *::before,
  html body #app .tt-orders-page-v1 *::after{
    box-sizing:border-box!important;
  }

  /* Sửa tiêu đề Đơn hàng bị che/cắt */
  html body #app .tt-orders-head-v1{
    width:100%!important;
    max-width:100%!important;
    margin:0 0 16px!important;
    padding:0 2px!important;
    display:block!important;
    overflow:visible!important;
  }

  html body #app .tt-orders-head-v1 h1{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    margin:0 0 8px!important;
    padding:0!important;
    font-size:30px!important;
    line-height:1.15!important;
    font-weight:950!important;
    letter-spacing:-.5px!important;
    overflow:visible!important;
    white-space:normal!important;
  }

  html body #app .tt-orders-head-v1 p{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    margin:0!important;
    padding:0!important;
    font-size:15px!important;
    line-height:1.45!important;
    color:#64748b!important;
    white-space:normal!important;
    overflow:visible!important;
  }

  html body #app .tt-orders-create-v1{
    width:100%!important;
    max-width:100%!important;
    margin-top:10px!important;
  }

  /* KPI: hàng 1 = Tổng đơn / Chờ duyệt / Đang xử lý; hàng 2 = Hoàn tất / Đơn còn nợ / Tổng công nợ */
  html body #app .tt-orders-kpis-v1,
  html body #app .tt-orders-kpis-v2{
    width:100%!important;
    max-width:100%!important;
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-flow:row!important;
    gap:8px!important;
    margin:0 0 14px!important;
    padding:0!important;
    overflow:visible!important;
  }

  html body #app .tt-orders-kpis-v1 > div,
  html body #app .tt-orders-kpis-v2 > div{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:76px!important;
    padding:9px 8px!important;
    border-radius:16px!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-kpis-v1 > div span,
  html body #app .tt-orders-kpis-v2 > div span{
    display:block!important;
    width:100%!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:11px!important;
    line-height:1.15!important;
    font-weight:800!important;
  }

  html body #app .tt-orders-kpis-v1 > div b,
  html body #app .tt-orders-kpis-v2 > div b{
    display:block!important;
    width:100%!important;
    margin-top:8px!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    font-size:20px!important;
    line-height:1.05!important;
    font-weight:950!important;
  }

  html body #app .tt-orders-kpis-v1 > div:nth-child(6) b,
  html body #app .tt-orders-kpis-v2 > div:nth-child(6) b{
    font-size:18px!important;
    letter-spacing:-.4px!important;
  }

  /* Card full ngang */
  html body #app .tt-orders-filter-v2,
  html body #app .tt-orders-debt-summary-v1,
  html body #app .tt-orders-card-v1{
    width:100%!important;
    max-width:100%!important;
    margin:0 0 14px!important;
    border-radius:18px!important;
    overflow:hidden!important;
  }

  /* Bộ lọc */
  html body #app .tt-orders-filter-v2{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    padding:14px!important;
  }

  html body #app .tt-orders-filter-v2 label,
  html body #app .tt-orders-filter-v2 input,
  html body #app .tt-orders-filter-v2 select,
  html body #app .tt-orders-filter-v2 button{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  /* Công nợ cần thu: danh sách dọc card mỏng */
  html body #app .tt-orders-debt-summary-v1{
    padding:14px!important;
  }

  html body #app .tt-orders-debt-summary-head-v1{
    display:block!important;
    margin:0 0 12px!important;
  }

  html body #app .tt-orders-debt-summary-head-v1 b{
    display:block!important;
    font-size:20px!important;
    line-height:1.15!important;
    margin-bottom:4px!important;
  }

  html body #app .tt-orders-debt-summary-head-v1 span{
    display:block!important;
    font-size:13px!important;
    line-height:1.35!important;
  }

  html body #app .tt-orders-debt-summary-head-v1 button{
    width:100%!important;
    height:44px!important;
    margin-top:12px!important;
    border-radius:14px!important;
  }

  html body #app .tt-orders-debt-summary-grid-v1{
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-auto-flow:row!important;
    gap:8px!important;
    width:100%!important;
    max-width:100%!important;
    padding:0!important;
    overflow:visible!important;
  }

  html body #app .tt-orders-debt-customer-v1{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    min-height:58px!important;
    padding:10px 12px!important;
    border-radius:15px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:10px!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-debt-customer-v1 div{
    min-width:0!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-debt-customer-v1 b,
  html body #app .tt-orders-debt-customer-v1 span,
  html body #app .tt-orders-debt-customer-v1 em{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }

  html body #app .tt-orders-debt-customer-v1 b{
    font-size:15px!important;
    line-height:1.15!important;
    font-weight:900!important;
  }

  html body #app .tt-orders-debt-customer-v1 span,
  html body #app .tt-orders-debt-customer-v1 em{
    font-size:12px!important;
    line-height:1.25!important;
  }

  html body #app .tt-orders-debt-customer-v1 strong{
    min-width:72px!important;
    max-width:96px!important;
    text-align:right!important;
    font-size:16px!important;
    line-height:1.1!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    color:#b91c1c!important;
  }

  /* Danh sách đơn full card */
  html body #app .tt-orders-card-v1{
    width:100%!important;
    max-width:100%!important;
    overflow:hidden!important;
  }

  html body #app .tt-orders-table-head-v1{
    display:none!important;
  }

  html body #app .tt-orders-row-v1{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:10px!important;
    width:100%!important;
    padding:14px!important;
  }

  html body #app .tt-orders-row-v1 > span{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
}
