/* AIOTOR ERP V12.7.17 — zero-waste international register contract.
   Key operational values stay visible; compact labels, wrapping and semantic
   widths replace horizontal rails, tiny fonts and destructive ellipsis. */
:root{
  --erp-table-value-size:12px;
  --erp-table-head-size:10.9px;
  --erp-table-line:1.26;
  --erp-table-pad-y:4px;
  --erp-table-pad-x:5px;
}

/* Shared runtime registers. The workspace owns the width; rows may grow enough
   to show their values instead of forcing the user to horizontally scroll. */
.rt-table-card,.rt-table-wrap{min-width:0!important;max-width:100%!important;width:100%!important}
.rt-table-wrap{overflow-x:hidden!important;overscroll-behavior-inline:contain}
.rt-table{width:100%!important;max-width:100%!important;min-width:0!important;table-layout:fixed!important;border-collapse:collapse!important}
.rt-table th{padding:5px 5px!important;font-size:var(--erp-table-head-size)!important;line-height:1.12!important;letter-spacing:.02em!important;vertical-align:middle!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
.rt-table th .rt-sort-head{display:flex!important;align-items:center!important;width:100%!important;min-width:0!important;height:auto!important;min-height:26px!important;padding:0!important;font-size:inherit!important;line-height:inherit!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;text-align:inherit!important}
.rt-table td{height:auto!important;min-height:36px!important;max-height:none!important;padding:var(--erp-table-pad-y) var(--erp-table-pad-x)!important;font-size:var(--erp-table-value-size)!important;line-height:var(--erp-table-line)!important;vertical-align:middle!important;min-width:0!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
.rt-table td .rt-cell{display:block!important;min-width:0!important;max-width:100%!important;font-size:var(--erp-table-value-size)!important;line-height:var(--erp-table-line)!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;word-break:normal!important;-webkit-line-clamp:unset!important;-webkit-box-orient:initial!important}
.rt-table td .rt-cell.badge{display:inline-flex!important;max-width:100%!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;line-height:1.18!important}
.rt-table td .rt-cell.number,
.rt-table td[data-col-key*="qty"] .rt-cell,
.rt-table td[data-col-key*="amount"] .rt-cell,
.rt-table td[data-col-key*="total"] .rt-cell,
.rt-table td[data-col-key*="rate"] .rt-cell,
.rt-table td[data-col-key*="count"] .rt-cell{white-space:nowrap!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:normal!important}
/* Long prose can grow to three lines in dense registers; the complete value is
   still available through title/smart-cell detail. Operational IDs/statuses do
   not use this clamp. */
.rt-table td[data-col-key*="description"] .rt-cell,
.rt-table td[data-col-key*="narration"] .rt-cell,
.rt-table td[data-col-key="note"] .rt-cell,
.rt-table td[data-col-key*="detail"] .rt-cell{display:-webkit-box!important;-webkit-box-orient:vertical!important;-webkit-line-clamp:3!important;overflow:hidden!important}
.rt-table .rt-actions{display:flex!important;align-items:center!important;align-content:center!important;justify-content:flex-start!important;gap:3px!important;row-gap:3px!important;flex-wrap:wrap!important;min-width:0!important;max-width:100%!important;overflow:visible!important;white-space:normal!important}
.rt-table .rt-mini{height:auto!important;min-height:26px!important;max-width:100%!important;padding:4px 6px!important;font-size:10.8px!important;line-height:1.05!important;white-space:normal!important;overflow-wrap:anywhere!important}
.rt-table .rt-field{min-width:0!important;width:100%!important;font-size:12px!important}
.rt-screen-toolbar,.rt-title-actions,.rt-toolbar{min-width:0!important;flex-wrap:wrap!important}

/* Legacy/smart tables follow the same rule: no clipped business values. */
.erp-smart-cell{min-width:0!important;max-width:none!important;cursor:help}
.erp-smart-cell>.erp-cell-value{min-width:0!important;max-width:100%!important;display:block!important;overflow:visible!important;white-space:normal!important;text-overflow:clip!important;overflow-wrap:anywhere!important;line-height:1.28!important;-webkit-line-clamp:unset!important}
.erp-smart-popover{z-index:100000!important;max-height:min(44vh,320px);overflow:auto;padding:9px 11px!important;border-radius:9px!important;font-size:12px!important;line-height:1.42!important;letter-spacing:0!important;white-space:normal!important;overflow-wrap:anywhere}

/* Factory Control is the stress case: older releases imposed a 1420px rail,
   fixed 38px rows and nowrap. This final layer deliberately supersedes them. */
[data-screen="factory.mrp"]{overflow:visible!important}
[data-screen="factory.mrp"] .rt-main{height:auto!important;min-height:100%!important;overflow:visible!important}
[data-screen="factory.mrp"] .rt-table-card{height:auto!important;min-height:0!important;overflow:visible!important}
[data-screen="factory.mrp"] .rt-table-wrap{width:100%!important;max-width:100%!important;max-height:none!important;min-height:0!important;overflow-x:hidden!important;overflow-y:visible!important;padding-bottom:0!important}
[data-screen="factory.mrp"] .rt-table{display:table!important;width:100%!important;min-width:0!important;max-width:100%!important;table-layout:fixed!important}
[data-screen="factory.mrp"] .rt-table colgroup{display:table-column-group!important}
[data-screen="factory.mrp"] .rt-table thead{display:table-header-group!important;width:auto!important}
[data-screen="factory.mrp"] .rt-table tbody{display:table-row-group!important;width:auto!important}
[data-screen="factory.mrp"] .rt-table thead tr,
[data-screen="factory.mrp"] .rt-table tbody tr[data-row-id]{display:table-row!important;width:auto!important;height:auto!important}
[data-screen="factory.mrp"] .rt-table thead th{display:table-cell!important;height:auto!important;min-height:32px!important;padding:5px!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;vertical-align:middle!important;background:#f4f8ff!important}
[data-screen="factory.mrp"] .rt-table thead th .rt-sort-head{display:flex!important;height:auto!important;min-height:24px!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;font-size:10.9px!important;line-height:1.12!important}
[data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td{display:table-cell!important;width:auto!important;height:auto!important;min-height:38px!important;max-height:none!important;padding:4px 5px!important;vertical-align:middle!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
[data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td::before{content:none!important}
[data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] .rt-cell{display:block!important;max-width:100%!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;-webkit-line-clamp:unset!important}
[data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] .rt-cell.badge{display:inline-flex!important}
[data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] .rt-actions{display:flex!important;flex-wrap:wrap!important;align-items:center!important;align-content:center!important;gap:3px!important;max-width:100%!important;white-space:normal!important;overflow:visible!important}
[data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] .rt-mini{height:auto!important;min-height:25px!important;max-width:100%!important;padding:4px 5px!important;font-size:10.6px!important;line-height:1.05!important;white-space:normal!important;overflow-wrap:anywhere!important}
[data-screen="factory.mrp"] .rt-screen-toolbar{flex-wrap:wrap!important;gap:6px!important}
[data-screen="factory.mrp"] .rt-screen-search-shell{flex:1 1 420px!important;max-width:none!important}
[data-screen="factory.mrp"] .rt-factory-quick-filter{height:31px!important;min-width:158px!important;font-size:10.9px!important}

/* Other wide operating registers inherit the same no-rail/no-overlap behavior. */
[data-screen="factory.dispatch"] .rt-table-wrap,
[data-screen="factory.lifecycle"] .rt-table-wrap,
[data-screen="orders.pending"] .rt-table-wrap,
[data-screen="orders.po_register"] .rt-table-wrap,
[data-screen="inventory.audit"] .rt-table-wrap,
[data-screen="inventory.inward"] .rt-table-wrap,
[data-screen="inventory.outward"] .rt-table-wrap{overflow-x:hidden!important;max-width:100%!important}
[data-screen="factory.dispatch"] .rt-actions,
[data-screen="factory.lifecycle"] .rt-actions{flex-wrap:wrap!important;overflow:visible!important}

/* Ultimate Finance: accounting registers remain dense but values/actions never
   disappear. Two-line party/source fields are allowed to wrap naturally. */
.page-finance-ultimate .fu-table-wrap{width:100%!important;max-width:100%!important;overflow-x:hidden!important}
.page-finance-ultimate .fu-table{width:100%!important;min-width:0!important;max-width:100%!important;table-layout:fixed!important}
.page-finance-ultimate .fu-table th{padding:5px!important;font-size:10.9px!important;line-height:1.14!important;letter-spacing:.02em!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important}
.page-finance-ultimate .fu-table td{height:auto!important;padding:5px!important;font-size:12px!important;line-height:1.24!important;min-width:0!important;vertical-align:middle!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important}
.page-finance-ultimate .fu-table td>*{min-width:0;max-width:100%}
.page-finance-ultimate .fu-table td b,
.page-finance-ultimate .fu-table td small,
.page-finance-ultimate .fu-link{overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;white-space:normal!important}
.page-finance-ultimate .fu-table td b,.page-finance-ultimate .fu-link{display:block!important;-webkit-line-clamp:unset!important}
.page-finance-ultimate .fu-table td small{display:block!important;font-size:10.75px!important;line-height:1.18!important}
.page-finance-ultimate .fu-status{max-width:100%;overflow:visible!important;text-overflow:clip!important;white-space:normal!important;font-size:10.75px!important;padding:4px 6px!important}
.page-finance-ultimate .fu-actions-row,.page-finance-ultimate .fu-actions{gap:3px!important;flex-wrap:wrap!important;min-width:0!important;overflow:visible!important}
.page-finance-ultimate .fu-btn{min-height:28px!important;height:auto!important;padding:5px 7px!important;font-size:10.75px!important;line-height:1.08!important;white-space:normal!important}
.page-finance-ultimate .fu-selector-row{display:flex!important;align-items:end!important;gap:7px!important;flex-wrap:wrap!important}
.page-finance-ultimate .fu-selector-row label{min-width:120px;max-width:190px;flex:0 1 170px}
.page-finance-ultimate .fu-selector-row select{min-height:31px!important;font-size:11.5px!important}
.page-finance-ultimate .fu-flow-health{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
.page-finance-ultimate .fu-flow-health a{display:grid;gap:2px;min-width:0;padding:9px 10px;border:1px solid #dbe5f1;border-radius:10px;background:#fff;color:inherit;text-decoration:none}
.page-finance-ultimate .fu-flow-health b{font-size:16px;line-height:1.05}
.page-finance-ultimate .fu-flow-health span{font-size:10.8px;font-weight:800;line-height:1.15}
.page-finance-ultimate .fu-flow-health small{font-size:10.2px;line-height:1.2;color:#66758f}

/* Customer Returns and other standalone audited tables. */
.customer-return-page .return-table{overflow-x:hidden!important;max-width:100%!important}
.customer-return-page .return-table table{width:100%!important;min-width:0!important;table-layout:fixed!important}
.customer-return-page .return-table th{padding:5px!important;font-size:10.7px!important;line-height:1.15!important;letter-spacing:.02em!important;white-space:normal!important}
.customer-return-page .return-table td{height:auto!important;padding:5px!important;font-size:11.9px!important;line-height:1.26!important;min-width:0!important;white-space:normal!important;overflow-wrap:anywhere!important}
.customer-return-page .return-links a,.customer-return-page .return-submit{font-size:11px!important}

/* Consistent focus affordance for mouse, keyboard and touch users. */
.rt-table a:focus-visible,.rt-table button:focus-visible,.rt-table input:focus-visible,
.fu-table a:focus-visible,.fu-table button:focus-visible,.fu-selector-row select:focus-visible,
.erp-smart-cell:focus-visible{outline:2px solid currentColor!important;outline-offset:2px!important}

@media(max-width:1180px){
  :root{--erp-table-value-size:11.75px;--erp-table-head-size:10.65px;--erp-table-pad-x:4px}
  .page-finance-ultimate .fu-flow-health{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:980px){
  /* Existing runtime mobile-card conversion remains authoritative; make its
     labels readable and values complete. */
  [data-screen="factory.mrp"] .rt-table-wrap{overflow:visible!important}
  [data-screen="factory.mrp"] .rt-table thead,
  [data-screen="factory.mrp"] .rt-table colgroup{display:none!important}
  [data-screen="factory.mrp"] .rt-table,
  [data-screen="factory.mrp"] .rt-table tbody,
  [data-screen="factory.mrp"] .rt-table tr{display:block!important;width:100%!important}
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id]{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;margin:0 0 9px!important;border:1px solid #d8e3f0!important;border-left:4px solid #1d7fd6!important;border-radius:11px!important;background:#fff!important}
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td{display:grid!important;grid-template-columns:92px minmax(0,1fr)!important;gap:6px!important;min-height:39px!important;padding:6px!important}
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td::before{content:attr(data-label)!important;font-size:10px!important;line-height:1.15!important;text-transform:uppercase!important;letter-spacing:.04em!important;font-weight:850!important;color:#64748b!important}
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td:nth-child(4),
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td:nth-child(9),
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td:nth-child(10){grid-column:1/-1!important}
}
@media(max-width:640px){
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id]{grid-template-columns:1fr!important}
  [data-screen="factory.mrp"] .rt-table tbody tr[data-row-id] td{grid-template-columns:86px minmax(0,1fr)!important;grid-column:1/-1!important}
  .page-finance-ultimate .fu-flow-health{grid-template-columns:1fr}
  .page-finance-ultimate .fu-selector-row label{min-width:108px;flex:1 1 130px}
  .page-finance-ultimate .fu-selector-row small{flex-basis:100%}
}

/* V12.7.18 procurement queue filters: compact structured filters without
   consuming another full-width toolbar row. Pending means Needs PO by default;
   moved demand is exposed explicitly through In Procurement / PO Register. */
[data-screen="orders.pending"] .rt-screen-toolbar,
[data-screen="orders.po_register"] .rt-screen-toolbar{align-items:center!important;gap:5px!important}
.rt-procurement-filters{display:flex;align-items:center;gap:5px;min-width:0;flex:1 1 100%;flex-wrap:wrap}
.rt-procurement-view{display:flex;align-items:center;gap:4px;min-width:0;margin:0}
.rt-procurement-view>span{font-size:10.3px;font-weight:800;color:#58677f;white-space:nowrap}
.rt-procurement-view select,
.rt-procurement-filter-form select,
.rt-procurement-filter-form input,
.rt-procurement-filter-form button{height:29px;min-height:29px;border:1px solid #d4deea;border-radius:7px;background:#fff;color:#172033;font:600 10.8px/1.1 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.rt-procurement-view select{width:126px;padding:0 24px 0 7px}
.rt-procurement-filter-form{display:flex;align-items:center;gap:4px;min-width:0;flex:0 1 auto;margin:0}
.rt-procurement-filter-form select{width:118px;padding:0 22px 0 7px}
.rt-procurement-filter-form input{width:150px;min-width:110px;padding:0 8px;font-weight:500}
.rt-procurement-filter-form button{padding:0 8px;cursor:pointer;font-weight:750}
.rt-procurement-filter-form button[type="submit"]{background:#eef5ff;border-color:#bfd5f4;color:#174f8d}
.rt-active-filter-chips{display:flex;align-items:center;gap:4px;min-width:0;flex-wrap:wrap}
.rt-filter-chip{display:inline-flex;align-items:center;gap:4px;max-width:190px;min-height:27px;padding:3px 6px;border:1px solid #cfdbea;border-radius:999px;background:#f7faff;color:#26364d;font-size:10.3px;line-height:1.05;cursor:pointer}
.rt-filter-chip b{font-size:9.8px;color:#5e6d83;text-transform:uppercase;letter-spacing:.02em}
.rt-filter-chip span{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:108px}
.rt-filter-chip i{font-style:normal;font-size:13px;font-weight:850;color:#7a8799}
[data-screen="orders.pending"] .rt-screen-search-shell,
[data-screen="orders.po_register"] .rt-screen-search-shell{flex:1 1 330px!important;min-width:220px!important;max-width:none!important}
@media(max-width:900px){
  .rt-procurement-filters{align-items:stretch}
  .rt-procurement-view,.rt-procurement-filter-form{flex:1 1 100%}
  .rt-procurement-view select{flex:1 1 auto;width:auto}
  .rt-procurement-filter-form select{width:112px}
  .rt-procurement-filter-form input{flex:1 1 auto;width:auto}
}

/* AIOTOR ERP V12.7.19 — purchase-order progress and queue movement. */
.rt-action-busy,.rt-mini.rt-action-busy{position:relative!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;opacity:1!important}
.rt-action-busy.primary,.rt-mini.rt-action-busy.primary{color:#fff!important}
.rt-action-busy::before,.rt-mini.rt-action-busy::before{content:"";display:inline-block;width:12px;height:12px;flex:0 0 12px;border:2px solid rgba(255,255,255,.46);border-top-color:#fff;border-radius:50%;animation:aiotorPOButtonSpin .68s linear infinite}
.rt-action-busy:not(.primary)::before,.rt-mini.rt-action-busy:not(.primary)::before{border-color:rgba(37,99,235,.25);border-top-color:#2563eb}
.rt-po-factory-po.rt-po-creating{display:inline-flex!important;align-items:center!important;gap:7px!important;background:#1769d2!important;border-color:#1769d2!important;color:#fff!important;white-space:nowrap!important}
.rt-po-factory-po.rt-po-creating i{display:inline-block;width:12px;height:12px;border:2px solid rgba(255,255,255,.45);border-top-color:#fff;border-radius:50%;animation:aiotorPOButtonSpin .68s linear infinite}
.rt-po-row-complete{pointer-events:none!important;background:#effcf4!important}
@keyframes aiotorPOButtonSpin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.rt-action-busy::before,.rt-mini.rt-action-busy::before,.rt-po-factory-po.rt-po-creating i{animation-duration:1.4s}}
.rt-po-route-error{margin:0 10px 8px;padding:7px 9px;border:1px solid #fecaca;border-radius:8px;background:#fff7f7;color:#991b1b;font-size:10.8px;line-height:1.3;font-weight:650;overflow-wrap:anywhere}
