/* NewlineWork final table/layout stabilization — 2026-10-07
   Loaded last to neutralize legacy max-content/nowrap conflicts without
   removing feature-specific tables or print layouts. */

:root{
  --nw-table-line:#dde5ef;
  --nw-table-line-soft:#edf1f6;
  --nw-table-head:#f3f6fa;
  --nw-table-head-text:#46566d;
  --nw-table-text:#27364a;
  --nw-table-muted:#748196;
  --nw-table-even:#fbfcfe;
  --nw-blue:#2563eb;
  --nw-blue-soft:#eff6ff;
  --nw-teal:#0f8f78;
  --nw-teal-soft:#ecfdf7;
  --nw-violet:#6d55c7;
  --nw-violet-soft:#f5f3ff;
  --nw-orange:#c66a12;
  --nw-orange-soft:#fff7ed;
}
html,body{
  max-width:100%!important;
  overflow-x:hidden!important;
}
#app,.app-shell,.clean-shell,.app-shell>main,main,#content{
  min-width:0!important;
  max-width:100%!important;
}
#content{
  overflow-x:clip!important;
}
.grid,.grid>*,
.card,.panel,.panel-head,.toolbar,
.table-wrap,.table-wrap>*{
  min-width:0!important;
}
.card{
  border-color:#e3e9f1!important;
}
.panel-head{
  align-items:flex-start!important;
}
.panel-head>div{
  min-width:0!important;
}
.panel-head h3{
  color:#25364b!important;
  line-height:1.3!important;
  letter-spacing:-.02em!important;
}
.panel-head small{
  display:block!important;
  margin-top:4px!important;
  color:#7a8798!important;
  line-height:1.45!important;
}

/* Global table system */
.table-wrap{
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  overflow-y:visible!important;
  border:1px solid var(--nw-table-line)!important;
  border-radius:12px!important;
  background:#fff!important;
  -webkit-overflow-scrolling:touch;
  scrollbar-gutter:stable;
}
.table{
  width:100%!important;
  max-width:none!important;
  border-collapse:separate!important;
  border-spacing:0!important;
  color:var(--nw-table-text)!important;
  background:#fff!important;
}
.table th,
.table td{
  box-sizing:border-box!important;
  border-right:1px solid var(--nw-table-line-soft)!important;
  border-bottom:1px solid var(--nw-table-line-soft)!important;
  padding:10px 10px!important;
  vertical-align:middle!important;
  line-height:1.45!important;
  letter-spacing:-.015em!important;
  word-break:keep-all!important;
  overflow-wrap:anywhere!important;
}
.table th:last-child,
.table td:last-child{
  border-right:0!important;
}
.table thead th{
  position:sticky;
  top:0;
  z-index:2;
  background:var(--nw-table-head)!important;
  color:var(--nw-table-head-text)!important;
  font-size:10.5px!important;
  font-weight:900!important;
  text-align:center!important;
  white-space:normal!important;
}
.table tbody td{
  color:var(--nw-table-text)!important;
  font-size:11px!important;
  background:#fff!important;
}
.table tbody tr:nth-child(even)>td{
  background:var(--nw-table-even)!important;
}
.table tbody tr:hover>td{
  background:#f6f9fd!important;
}
.table tbody tr:last-child>td{
  border-bottom:0!important;
}
.table td:first-child{
  text-align:left;
}
.table td.num,
.table .num{
  text-align:right!important;
  font-variant-numeric:tabular-nums;
}
.table td.center,
.table .center{
  text-align:center!important;
}
.table td b{
  color:#1f3148!important;
  font-weight:850!important;
  line-height:1.35!important;
}
.table td small{
  display:block!important;
  margin:3px 0 0!important;
  color:var(--nw-table-muted)!important;
  font-size:9px!important;
  line-height:1.35!important;
  white-space:normal!important;
}
.table .badge{
  vertical-align:middle!important;
  white-space:nowrap!important;
}
.table .actions{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:5px!important;
  flex-wrap:wrap!important;
}
.table .actions button,
.table button{
  min-height:29px!important;
  padding:5px 8px!important;
  border-radius:8px!important;
  font-size:9px!important;
  line-height:1.2!important;
  white-space:nowrap!important;
}
.external-no-scroll{
  width:100%!important;
  max-width:100%!important;
  overflow:visible!important;
}

/* Neutralize the old mobile max-content + nowrap rule that caused viewport breakage. */
@media(max-width:760px){
  #content{
    padding-left:10px!important;
    padding-right:10px!important;
  }
  .table{
    width:100%!important;
    max-width:none!important;
  }
  .table th,
  .table td{
    white-space:normal!important;
    word-break:keep-all!important;
    overflow-wrap:anywhere!important;
    padding:8px 6px!important;
    line-height:1.35!important;
  }
  .table thead th{
    font-size:9px!important;
  }
  .table tbody td{
    font-size:9.5px!important;
  }
  .table td small{
    display:block!important;
    margin:3px 0 0!important;
    font-size:8px!important;
    white-space:normal!important;
  }
  .table .actions{
    gap:4px!important;
  }
  .table .actions button,
  .table button{
    min-height:27px!important;
    padding:4px 6px!important;
    font-size:8px!important;
  }
  .toolbar{
    max-width:100%!important;
  }
}

/* External workforce visual hierarchy */
.external-kpis{
  gap:10px!important;
  margin:0 0 14px!important;
}
.external-kpis .stat{
  min-width:0!important;
  border:1px solid #dfe7f1!important;
  border-radius:15px!important;
  padding:13px 14px!important;
  box-shadow:0 5px 14px rgba(25,47,76,.045)!important;
}
.external-kpis .stat small{
  color:#6b7a8e!important;
  font-size:9.5px!important;
  font-weight:800!important;
  line-height:1.3!important;
}
.external-kpis .stat b{
  display:block!important;
  margin-top:5px!important;
  color:#1f3148!important;
  font-size:18px!important;
  line-height:1.15!important;
  letter-spacing:-.035em!important;
  white-space:normal!important;
}
.external-kpis .stat:nth-child(1){
  background:linear-gradient(180deg,#f7faff 0%,#fff 100%)!important;
  border-color:#cfe0f7!important;
}
.external-kpis .stat:nth-child(2){
  background:linear-gradient(180deg,#effaf8 0%,#fff 100%)!important;
  border-color:#bde9df!important;
}
.external-kpis .stat:nth-child(2) b{color:#087a68!important}
.external-kpis .stat:nth-child(3){
  background:linear-gradient(180deg,#f6f3ff 0%,#fff 100%)!important;
  border-color:#ddd4ff!important;
}
.external-kpis .stat:nth-child(3) b{color:#644bc2!important}
.external-kpis .stat:nth-child(4){
  background:linear-gradient(180deg,#fff7ed 0%,#fff 100%)!important;
  border-color:#fed7aa!important;
}
.external-kpis .stat:nth-child(4) b{color:#b85a0a!important}

.external-deployed-workers,
.external-site-summary,
.external-company-settlement,
.external-tax-invoices,
.external-direct-payment-detail,
.external-worker-detail-card{
  margin-top:12px!important;
  padding:14px!important;
  border:1px solid #e1e8f0!important;
  border-radius:16px!important;
  background:#fff!important;
  box-shadow:0 6px 18px rgba(31,49,72,.045)!important;
  overflow:hidden!important;
}
.external-deployed-workers{border-top:4px solid #2f78d3!important}
.external-site-summary{border-top:4px solid #0f8f78!important}
.external-company-settlement{border-top:4px solid #7058c8!important}
.external-tax-invoices{border-top:4px solid #169b67!important}
.external-direct-payment-detail{border-top:4px solid #d57b20!important}
.external-worker-detail-card{border-top:4px solid #60748e!important}

.external-deployed-workers .panel-head,
.external-site-summary .panel-head,
.external-company-settlement .panel-head,
.external-tax-invoices .panel-head,
.external-direct-payment-detail .panel-head,
.external-worker-detail-card .panel-head{
  margin:0 0 11px!important;
  padding:0 0 10px!important;
  border-bottom:1px solid #e8edf3!important;
}
.external-deployed-workers .panel-head h3{color:#245ea8!important}
.external-site-summary .panel-head h3{color:#087665!important}
.external-company-settlement .panel-head h3{color:#5c48a8!important}
.external-tax-invoices .panel-head h3{color:#0c7b52!important}
.external-direct-payment-detail .panel-head h3{color:#a95a0d!important}
.external-worker-detail-card .panel-head h3{color:#465d76!important}

.external-deployed-workers .table-wrap,
.external-site-summary .table-wrap,
.external-company-settlement .table-wrap,
.external-tax-invoices .table-wrap,
.external-direct-payment-detail .table-wrap,
.external-worker-detail-card .table-wrap{
  overflow:visible!important;
  border-color:#dfe6ee!important;
  box-shadow:none!important;
}
.external-deployed-workers .table,
.external-site-summary .table,
.external-company-settlement .table,
.external-tax-invoices .table,
.external-direct-payment-detail .table,
.external-worker-detail-card .table{
  width:100%!important;
  min-width:0!important;
  table-layout:fixed!important;
}
.external-deployed-workers .table th,
.external-deployed-workers .table td,
.external-site-summary .table th,
.external-site-summary .table td,
.external-company-settlement .table th,
.external-company-settlement .table td,
.external-tax-invoices .table th,
.external-tax-invoices .table td,
.external-direct-payment-detail .table th,
.external-direct-payment-detail .table td,
.external-worker-detail-card .table th,
.external-worker-detail-card .table td{
  white-space:normal!important;
  word-break:keep-all!important;
  overflow-wrap:anywhere!important;
}
.external-deployed-workers .table thead th,
.external-site-summary .table thead th,
.external-company-settlement .table thead th,
.external-tax-invoices .table thead th,
.external-direct-payment-detail .table thead th,
.external-worker-detail-card .table thead th{
  background:#f1f5f9!important;
  color:#40516a!important;
}
.external-deployed-workers .table tbody td:first-child,
.external-site-summary .table tbody td:first-child,
.external-company-settlement .table tbody td:first-child,
.external-tax-invoices .table tbody td:first-child,
.external-direct-payment-detail .table tbody td:first-child,
.external-worker-detail-card .table tbody td:first-child{
  background-image:linear-gradient(90deg,rgba(37,99,235,.035),rgba(37,99,235,0))!important;
}

/* 7 columns: actual deployed workforce */
.external-deployed-workers .table th:nth-child(1),
.external-deployed-workers .table td:nth-child(1){width:21%!important;text-align:left!important}
.external-deployed-workers .table th:nth-child(2),
.external-deployed-workers .table td:nth-child(2){width:26%!important;text-align:left!important}
.external-deployed-workers .table th:nth-child(3),
.external-deployed-workers .table td:nth-child(3){width:15%!important}
.external-deployed-workers .table th:nth-child(4),
.external-deployed-workers .table td:nth-child(4){width:8%!important;text-align:center!important}
.external-deployed-workers .table th:nth-child(5),
.external-deployed-workers .table td:nth-child(5){width:9%!important;text-align:right!important}
.external-deployed-workers .table th:nth-child(6),
.external-deployed-workers .table td:nth-child(6){width:10%!important;text-align:right!important}
.external-deployed-workers .table th:nth-child(7),
.external-deployed-workers .table td:nth-child(7){width:11%!important;text-align:right!important}

/* 5 columns: site summary */
.external-site-summary .table th:nth-child(1),
.external-site-summary .table td:nth-child(1){width:27%!important;text-align:left!important}
.external-site-summary .table th:nth-child(2),
.external-site-summary .table td:nth-child(2){width:31%!important;text-align:left!important}
.external-site-summary .table th:nth-child(3),
.external-site-summary .table td:nth-child(3){width:12%!important;text-align:center!important}
.external-site-summary .table th:nth-child(4),
.external-site-summary .table td:nth-child(4){width:13%!important;text-align:right!important}
.external-site-summary .table th:nth-child(5),
.external-site-summary .table td:nth-child(5){width:17%!important;text-align:right!important}

/* 7 columns: company settlement */
.external-company-settlement .external-company-compact th:nth-child(1),
.external-company-settlement .external-company-compact td:nth-child(1){width:25%!important;text-align:left!important}
.external-company-settlement .external-company-compact th:nth-child(2),
.external-company-settlement .external-company-compact td:nth-child(2){width:10%!important;text-align:center!important}
.external-company-settlement .external-company-compact th:nth-child(3),
.external-company-settlement .external-company-compact td:nth-child(3){width:13%!important;text-align:right!important}
.external-company-settlement .external-company-compact th:nth-child(4),
.external-company-settlement .external-company-compact td:nth-child(4){width:10%!important;text-align:right!important}
.external-company-settlement .external-company-compact th:nth-child(5),
.external-company-settlement .external-company-compact td:nth-child(5){width:15%!important;text-align:right!important}
.external-company-settlement .external-company-compact th:nth-child(6),
.external-company-settlement .external-company-compact td:nth-child(6){width:15%!important;text-align:right!important}
.external-company-settlement .external-company-compact th:nth-child(7),
.external-company-settlement .external-company-compact td:nth-child(7){width:12%!important;text-align:center!important}

/* 6 columns: invoice calculation */
.external-tax-invoices .external-invoice-expense-table th:nth-child(1),
.external-tax-invoices .external-invoice-expense-table td:nth-child(1){width:25%!important;text-align:left!important}
.external-tax-invoices .external-invoice-expense-table th:nth-child(2),
.external-tax-invoices .external-invoice-expense-table td:nth-child(2){width:23%!important;text-align:left!important}
.external-tax-invoices .external-invoice-expense-table th:nth-child(3),
.external-tax-invoices .external-invoice-expense-table td:nth-child(3){width:13%!important;text-align:right!important}
.external-tax-invoices .external-invoice-expense-table th:nth-child(4),
.external-tax-invoices .external-invoice-expense-table td:nth-child(4){width:11%!important;text-align:right!important}
.external-tax-invoices .external-invoice-expense-table th:nth-child(5),
.external-tax-invoices .external-invoice-expense-table td:nth-child(5){width:14%!important;text-align:right!important}
.external-tax-invoices .external-invoice-expense-table th:nth-child(6),
.external-tax-invoices .external-invoice-expense-table td:nth-child(6){width:14%!important;text-align:right!important}

/* 6 columns: direct payment */
.external-direct-payment-detail .external-direct-compact th:nth-child(1),
.external-direct-payment-detail .external-direct-compact td:nth-child(1){width:16%!important;text-align:left!important}
.external-direct-payment-detail .external-direct-compact th:nth-child(2),
.external-direct-payment-detail .external-direct-compact td:nth-child(2){width:23%!important;text-align:left!important}
.external-direct-payment-detail .external-direct-compact th:nth-child(3),
.external-direct-payment-detail .external-direct-compact td:nth-child(3){width:14%!important;text-align:right!important}
.external-direct-payment-detail .external-direct-compact th:nth-child(4),
.external-direct-payment-detail .external-direct-compact td:nth-child(4){width:20%!important;text-align:right!important}
.external-direct-payment-detail .external-direct-compact th:nth-child(5),
.external-direct-payment-detail .external-direct-compact td:nth-child(5){width:14%!important;text-align:right!important}
.external-direct-payment-detail .external-direct-compact th:nth-child(6),
.external-direct-payment-detail .external-direct-compact td:nth-child(6){width:13%!important;text-align:center!important}

/* 6 columns: master roster */
.external-worker-detail-card .external-worker-compact th:nth-child(1),
.external-worker-detail-card .external-worker-compact td:nth-child(1){width:22%!important;text-align:left!important}
.external-worker-detail-card .external-worker-compact th:nth-child(2),
.external-worker-detail-card .external-worker-compact td:nth-child(2){width:26%!important;text-align:left!important}
.external-worker-detail-card .external-worker-compact th:nth-child(3),
.external-worker-detail-card .external-worker-compact td:nth-child(3){width:16%!important}
.external-worker-detail-card .external-worker-compact th:nth-child(4),
.external-worker-detail-card .external-worker-compact td:nth-child(4){width:14%!important;text-align:right!important}
.external-worker-detail-card .external-worker-compact th:nth-child(5),
.external-worker-detail-card .external-worker-compact td:nth-child(5){width:13%!important;text-align:right!important}
.external-worker-detail-card .external-worker-compact th:nth-child(6),
.external-worker-detail-card .external-worker-compact td:nth-child(6){width:9%!important;text-align:center!important}

.external-status{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:4px!important;
  margin-top:4px!important;
  min-height:22px!important;
  padding:3px 7px!important;
  border-radius:999px!important;
  font-size:8.5px!important;
  font-weight:900!important;
  white-space:nowrap!important;
}
.external-status.due{
  background:#fff7ed!important;
  color:#b85a0a!important;
  border:1px solid #fed7aa!important;
}
.external-status.done{
  background:#ecfdf5!important;
  color:#087a52!important;
  border:1px solid #a7f3d0!important;
}
.external-invoice-kpi{
  display:flex!important;
  align-items:center!important;
  gap:6px!important;
  padding:7px 10px!important;
  border:1px solid #bbf7d0!important;
  border-radius:10px!important;
  background:#f0fdf4!important;
  color:#087a52!important;
}
.external-subsection-title{
  display:flex!important;
  align-items:flex-end!important;
  justify-content:space-between!important;
  gap:10px!important;
  margin:4px 0 8px!important;
}
.external-subsection-title b{
  color:#304258!important;
  font-size:11px!important;
}
.external-subsection-title small{
  color:#7b8799!important;
  font-size:9px!important;
  text-align:right!important;
}

@media(max-width:760px){
  .external-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
  }
  .external-kpis .stat{
    padding:11px 10px!important;
    border-radius:13px!important;
  }
  .external-kpis .stat small{font-size:8px!important}
  .external-kpis .stat b{font-size:15px!important}
  .external-deployed-workers,
  .external-site-summary,
  .external-company-settlement,
  .external-tax-invoices,
  .external-direct-payment-detail,
  .external-worker-detail-card{
    margin-top:10px!important;
    padding:10px 8px!important;
    border-radius:14px!important;
  }
  .external-deployed-workers .panel-head,
  .external-site-summary .panel-head,
  .external-company-settlement .panel-head,
  .external-tax-invoices .panel-head,
  .external-direct-payment-detail .panel-head,
  .external-worker-detail-card .panel-head{
    gap:7px!important;
    padding-bottom:8px!important;
  }
  .external-deployed-workers .panel-head h3,
  .external-site-summary .panel-head h3,
  .external-company-settlement .panel-head h3,
  .external-tax-invoices .panel-head h3,
  .external-direct-payment-detail .panel-head h3,
  .external-worker-detail-card .panel-head h3{
    font-size:12px!important;
  }
  .external-deployed-workers .panel-head small,
  .external-site-summary .panel-head small,
  .external-company-settlement .panel-head small,
  .external-tax-invoices .panel-head small,
  .external-direct-payment-detail .panel-head small,
  .external-worker-detail-card .panel-head small{
    font-size:7.5px!important;
    line-height:1.35!important;
  }
  .external-deployed-workers .table th,
  .external-deployed-workers .table td,
  .external-site-summary .table th,
  .external-site-summary .table td,
  .external-company-settlement .table th,
  .external-company-settlement .table td,
  .external-tax-invoices .table th,
  .external-tax-invoices .table td,
  .external-direct-payment-detail .table th,
  .external-direct-payment-detail .table td,
  .external-worker-detail-card .table th,
  .external-worker-detail-card .table td{
    padding:6px 3px!important;
    font-size:7.8px!important;
    line-height:1.3!important;
    letter-spacing:-.025em!important;
  }
  .external-deployed-workers .table thead th,
  .external-site-summary .table thead th,
  .external-company-settlement .table thead th,
  .external-tax-invoices .table thead th,
  .external-direct-payment-detail .table thead th,
  .external-worker-detail-card .table thead th{
    font-size:7.4px!important;
  }
  .external-deployed-workers .table td small,
  .external-worker-detail-card .table td small,
  .external-company-settlement .table td small,
  .external-direct-payment-detail .table td small{
    font-size:6.8px!important;
    line-height:1.25!important;
  }
  .external-deployed-workers .table button,
  .external-company-settlement .table button,
  .external-direct-payment-detail .table button,
  .external-worker-detail-card .table button{
    min-height:23px!important;
    padding:3px 4px!important;
    border-radius:6px!important;
    font-size:6.8px!important;
  }
  .external-invoice-kpi{
    padding:5px 7px!important;
    font-size:8px!important;
  }
  .external-subsection-title{
    align-items:flex-start!important;
    flex-direction:column!important;
    gap:2px!important;
  }
  .external-subsection-title small{
    text-align:left!important;
    font-size:7.5px!important;
  }
}

@media(max-width:430px){
  .external-deployed-workers .table th,
  .external-deployed-workers .table td,
  .external-site-summary .table th,
  .external-site-summary .table td,
  .external-company-settlement .table th,
  .external-company-settlement .table td,
  .external-tax-invoices .table th,
  .external-tax-invoices .table td,
  .external-direct-payment-detail .table th,
  .external-direct-payment-detail .table td,
  .external-worker-detail-card .table th,
  .external-worker-detail-card .table td{
    padding:5px 2px!important;
    font-size:7px!important;
  }
  .external-deployed-workers .table thead th,
  .external-site-summary .table thead th,
  .external-company-settlement .table thead th,
  .external-tax-invoices .table thead th,
  .external-direct-payment-detail .table thead th,
  .external-worker-detail-card .table thead th{
    font-size:6.7px!important;
  }
  .external-kpis .stat b{font-size:14px!important}
}

/* Print: clean, aligned and without sticky headers or UI chrome */
@media print{
  html,body,#content{
    overflow:visible!important;
    max-width:none!important;
  }
  .table-wrap,
  .external-no-scroll{
    overflow:visible!important;
    border:0!important;
    border-radius:0!important;
  }
  .table{
    width:100%!important;
    min-width:0!important;
    table-layout:fixed!important;
  }
  .table thead th{
    position:static!important;
    background:#eef2f6!important;
    color:#34445a!important;
  }
  .table th,
  .table td{
    padding:4px 3px!important;
    font-size:7.5px!important;
    line-height:1.25!important;
    white-space:normal!important;
    word-break:keep-all!important;
    overflow-wrap:anywhere!important;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
  .table tbody tr:hover>td,
  .table tbody tr:nth-child(even)>td{
    background:#fff!important;
  }
  .external-deployed-workers,
  .external-site-summary,
  .external-company-settlement,
  .external-tax-invoices,
  .external-direct-payment-detail,
  .external-worker-detail-card{
    box-shadow:none!important;
    border-radius:0!important;
    padding:0!important;
    overflow:visible!important;
  }
}
