/* FIXED STYLE: source-summary-real-table */

/*
  Tổng hợp nguồn là bảng dữ liệu thật:
  - không grid-gap giữa các ô;
  - không nền theo từng ô;
  - không chấm màu / vạch trang trí;
  - header + body + tổng dùng cùng một hệ cột.
*/
.order-summary-panel{
  background:#fff !important;
  border-color:#edf0f2 !important;
  box-shadow:0 1px 3px rgba(15,23,42,.04) !important;
}
.order-summary-panel > .flex:first-child h3{
  color:#6b7280 !important;
  letter-spacing:.045em;
}
.order-summary-panel .summary-panel-icon{
  color:#94a3b8 !important;
  opacity:.9;
}

.order-summary-panel .summary-compact-table{
  display:table !important;
  width:100% !important;
  table-layout:fixed !important;
  border-collapse:collapse !important;
  border-spacing:0 !important;
  column-gap:0 !important;
  grid-template-columns:none !important;
}
.order-summary-panel .summary-compact-table thead{
  display:table-header-group !important;
  width:auto !important;
}
.order-summary-panel .summary-compact-table tbody{
  display:table-row-group !important;
  width:auto !important;
}
.order-summary-panel .summary-compact-table tr{
  display:table-row !important;
  width:auto !important;
}
.order-summary-panel .summary-compact-table th,
.order-summary-panel .summary-compact-table td{
  display:table-cell !important;
  width:auto !important;
  min-width:0 !important;
  padding:0 !important;
  box-sizing:border-box;
  white-space:nowrap !important;
  vertical-align:middle;
  background:#fff !important;
  box-shadow:none !important;
  font-variant-numeric:tabular-nums;
  font-feature-settings:"tnum" 1,"lnum" 1;
}

/* 40 + 12 + 16 + 16 + 16 = 100% */
.order-summary-panel .summary-compact-table th:nth-child(1),
.order-summary-panel .summary-compact-table td:nth-child(1){width:40% !important;}
.order-summary-panel .summary-compact-table th:nth-child(2),
.order-summary-panel .summary-compact-table td:nth-child(2){width:12% !important;}
.order-summary-panel .summary-compact-table th:nth-child(3),
.order-summary-panel .summary-compact-table td:nth-child(3),
.order-summary-panel .summary-compact-table th:nth-child(4),
.order-summary-panel .summary-compact-table td:nth-child(4),
.order-summary-panel .summary-compact-table th:nth-child(5),
.order-summary-panel .summary-compact-table td:nth-child(5){width:16% !important;}

.order-summary-panel .summary-compact-table thead th{
  padding:8px 5px !important;
  color:#6b7280 !important;
  background:#f8fafc !important;
  border-bottom:1px solid #dfe3e8 !important;
  font-size:11px;
  line-height:1.2;
  font-weight:650 !important;
}
.order-summary-panel .summary-compact-table thead th:first-child{
  padding-left:7px !important;
  text-align:left !important;
  color:#374151 !important;
  font-weight:700 !important;
}
.order-summary-panel .summary-compact-table thead th:nth-child(n+2){
  text-align:right !important;
}
.order-summary-panel .summary-compact-table thead th::before{
  content:none !important;
  display:none !important;
}

.order-summary-panel .summary-compact-table tbody tr:not(.summary-total-row) > td{
  padding:11px 5px !important;
  color:#374151 !important;
  background:#fff !important;
  border-bottom:1px solid #edf0f2 !important;
  font-size:12px;
  line-height:1.25;
  font-weight:600 !important;
}
.order-summary-panel .summary-compact-table tbody tr:not(.summary-total-row) > td:first-child{
  padding-left:7px !important;
  text-align:left !important;
}
.order-summary-panel .summary-compact-table tbody tr:not(.summary-total-row) > td:nth-child(n+2){
  text-align:right !important;
}
.order-summary-panel .summary-compact-table .source-summary-link{
  display:block;
  width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#1f2937 !important;
  font-weight:700 !important;
}

/* Theme không được đổi màu từng cột ở thân bảng. */
#tab-da-giao .order-summary-panel .summary-compact-table tbody td,
#tab-don-tam .order-summary-panel .summary-compact-table tbody td{
  color:#374151 !important;
}
#tab-da-giao .order-summary-panel .summary-compact-table tbody tr.summary-total-row > td,
#tab-don-tam .order-summary-panel .summary-compact-table tbody tr.summary-total-row > td{
  color:#111827 !important;
}

/* TỔNG là footer bảng: một dải nền liền mạch, không chia thành các ô rời. */
.order-summary-panel .summary-compact-table tbody tr.summary-total-row > td{
  padding:11px 5px !important;
  background:#f8fafc !important;
  border-top:1.5px solid #cfd5dc !important;
  border-bottom:0 !important;
  font-size:12px;
  line-height:1.25;
  font-weight:800 !important;
}
.order-summary-panel .summary-compact-table tbody tr.summary-total-row > td:first-child{
  padding-left:7px !important;
  text-align:left !important;
}
.order-summary-panel .summary-compact-table tbody tr.summary-total-row > td:nth-child(n+2){
  text-align:right !important;
}

/* User chỉ còn Nguồn | SL | Thu: phân lại đúng 100% cho 3 cột đang thấy. */
body[data-auth-role="user"] .order-summary-panel .summary-compact-table th:nth-child(1),
body[data-auth-role="user"] .order-summary-panel .summary-compact-table td:nth-child(1){width:58% !important;}
body[data-auth-role="user"] .order-summary-panel .summary-compact-table th:nth-child(2),
body[data-auth-role="user"] .order-summary-panel .summary-compact-table td:nth-child(2){width:14% !important;}
body[data-auth-role="user"] .order-summary-panel .summary-compact-table th:nth-child(4),
body[data-auth-role="user"] .order-summary-panel .summary-compact-table td:nth-child(4){width:28% !important;}

.order-summary-panel .summary-compact-table td[colspan="5"]{
  display:table-cell !important;
  width:auto !important;
  text-align:center !important;
  padding:16px 8px !important;
}

@media (max-width:620px){
  .order-summary-panel{padding:14px !important;}
  .order-summary-panel > .flex:first-child{margin-bottom:10px !important;}
}


/* Empty summary stays centered as one table-wide state. */
.order-summary-panel .summary-compact-table tbody tr.order-summary-empty-row > td{
  height:76px !important;
  padding:0 8px !important;
  text-align:center !important;
  vertical-align:middle !important;
  background:#fff !important;
  border-top:0 !important;
  border-bottom:0 !important;
}
.order-summary-empty-state{
  width:100%;
  min-height:76px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#9ca3af;
  font-size:11px;
  line-height:1.4;
  font-weight:500;
  text-align:center;
}


/* Orders P2/P3: mobile cards and summary stay legible without touching data.
   Only the summary's existing overflow-x-auto parent scrolls sideways. */
@media (max-width:620px){
  #tab-da-giao .order-summary-panel .summary-compact-table,
  #tab-don-tam .order-summary-panel .summary-compact-table{
    min-width:0 !important;
    width:100% !important;
  }
  body[data-auth-role="user"] #tab-da-giao .order-summary-panel .summary-compact-table,
  body[data-auth-role="user"] #tab-don-tam .order-summary-panel .summary-compact-table{
    min-width:0 !important;
  }
  #tab-da-giao #completedTimeFilterButton,
  #tab-don-tam #pendingTimeFilterButton{
    min-height:44px;
    font-size:12px;
  }
  #tab-da-giao .order-time-option,
  #tab-don-tam .order-time-option{
    min-height:40px;
    display:flex;
    align-items:center;
  }
}
/* SPEC-TAPHOA-ORDER-CARD-MOBILE-DENSITY-20261015:
   On phones the name and amount share one baseline like the desktop card.
   Preserve 2-line wrapping only for unusually long customer names. */
@media (max-width:480px){
  #completedOrderListContainer > .allow-fast-click,
  #completedOrderListContainer > .order-timeline-day-group > .allow-fast-click,
  #pendingOrderListContainer > .allow-fast-click,
  #pendingOrderListContainer > .order-timeline-day-group > .allow-fast-click{
    padding:11px 12px;
    margin-bottom:8px;
  }
  #completedOrderListContainer > .allow-fast-click > .pointer-events-none,
  #completedOrderListContainer > .order-timeline-day-group > .allow-fast-click > .pointer-events-none,
  #pendingOrderListContainer > .allow-fast-click > .pointer-events-none,
  #pendingOrderListContainer > .order-timeline-day-group > .allow-fast-click > .pointer-events-none{
    gap:10px;
  }
  #completedOrderListContainer .order-card-title-row,
  #pendingOrderListContainer .order-card-title-row{
    grid-template-columns:minmax(0,1fr) max-content;
    column-gap:8px;
    row-gap:0;
    align-items:baseline;
  }
  #completedOrderListContainer .order-card-title-row > p:first-child,
  #pendingOrderListContainer .order-card-title-row > p:first-child{
    white-space:normal;
    overflow-wrap:anywhere;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden;
  }
  #completedOrderListContainer .order-card-total,
  #pendingOrderListContainer .order-card-total{
    grid-column:2;
    grid-row:1;
    justify-self:end;
    align-self:baseline;
    font-variant-numeric:tabular-nums;
  }
  #completedOrderListContainer .order-product-preview,
  #pendingOrderListContainer .order-product-preview{
    margin-top:3px;
    padding-top:3px;
  }
}

/* 2026-10-08 UI-100: four/five-column finance summary fits its own card.
   Earlier min-width 430px was removed; do not retain the old overflow-x-auto
   scrolling viewport when fixed-layout columns fit the available width. */
@media(max-width:620px){
  #tab-da-giao .order-summary-panel,
  #tab-don-tam .order-summary-panel{min-width:0 !important;}
  #tab-da-giao .order-summary-panel .overflow-x-auto,
  #tab-don-tam .order-summary-panel .overflow-x-auto{
    min-width:0 !important;
    max-width:100% !important;
    overflow-x:clip !important;
  }
  #tab-da-giao .order-summary-panel .summary-compact-table,
  #tab-don-tam .order-summary-panel .summary-compact-table{
    box-sizing:border-box !important;
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    table-layout:fixed !important;
  }
}
