/* AIOTOR ERP V12.7.20 — no scroll locks + row-level procurement state.
   Final cascade layer. Normal ERP pages grow with content; only deliberate
   editors/modals own internal scroll areas. Operational text stays readable. */
:root{
  --v12720-row-font:12px;
  --v12720-head-font:10.7px;
  --v12720-control-h:28px;
}

html{height:auto!important;min-height:100%!important;max-width:100%!important;overflow-x:hidden!important;overflow-y:auto!important}
body{max-width:100%!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active){height:auto!important;min-height:100dvh!important;max-height:none!important;overflow-x:hidden!important;overflow-y:auto!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-app,
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-platinum-shell,
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-dashboard,
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-content,
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-main{height:auto!important;max-height:none!important;overflow:visible!important;min-width:0!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-app,
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-dashboard{min-height:100dvh!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-main{min-height:0!important;display:block!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-main>*{min-width:0!important;max-width:100%!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-table-card{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;margin-bottom:8px!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-table-wrap{height:auto!important;min-height:0!important;max-height:none!important;overflow-x:auto!important;overflow-y:visible!important;padding-bottom:0!important;scrollbar-gutter:auto!important}
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-pager,
body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-standard-footer{position:static!important;inset:auto!important;max-height:none!important;overflow:visible!important}

/* Legacy/server-template pages: remove viewport prisons while preserving the
   Print Studio's intentional canvas/inspector scrolling. */
body.admin-tw:not(.page-settings.page-cat-printstudio){height:auto!important;min-height:100dvh!important;overflow-x:hidden!important;overflow-y:auto!important}
body.admin-tw:not(.page-settings.page-cat-printstudio) .app-shell,
body.admin-tw:not(.page-settings.page-cat-printstudio) .main.main-full.shared-shell-main,
body.admin-tw:not(.page-settings.page-cat-printstudio) .shared-shell-content,
body.admin-tw:not(.page-settings.page-cat-printstudio) .shared-shell-body,
body.admin-tw:not(.page-settings.page-cat-printstudio) .tabs.active,
body.admin-tw:not(.page-settings.page-cat-printstudio) .panel,
body.admin-tw:not(.page-settings.page-cat-printstudio) .compact-panel,
body.admin-tw:not(.page-settings.page-cat-printstudio) .ops-panel,
body.admin-tw:not(.page-settings.page-cat-printstudio) .erp-module-panel,
body.admin-tw:not(.page-settings.page-cat-printstudio) .fu-shell{height:auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;min-width:0!important;max-width:100%!important}
body.admin-tw:not(.page-settings.page-cat-printstudio) .app-shell,
body.admin-tw:not(.page-settings.page-cat-printstudio) .shared-shell-content{min-height:100dvh!important}
body.admin-tw:not(.page-settings.page-cat-printstudio) .table-card,
body.admin-tw:not(.page-settings.page-cat-printstudio) .ops-table-wrap,
body.admin-tw:not(.page-settings.page-cat-printstudio) .inventory-table-wrap{height:auto!important;max-height:none!important;overflow-x:auto!important;overflow-y:visible!important;min-width:0!important;max-width:100%!important}
body.admin-tw:not(.page-settings.page-cat-printstudio) .table-card table,
body.admin-tw:not(.page-settings.page-cat-printstudio) .ops-table,
body.admin-tw:not(.page-settings.page-cat-printstudio) .inventory-table{width:100%!important;max-width:100%!important;min-width:0!important;table-layout:fixed!important}
body.admin-tw:not(.page-settings.page-cat-printstudio) .table-card th,
body.admin-tw:not(.page-settings.page-cat-printstudio) .table-card td,
body.admin-tw:not(.page-settings.page-cat-printstudio) .ops-table th,
body.admin-tw:not(.page-settings.page-cat-printstudio) .ops-table td{height:auto!important;max-height:none!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important;word-break:normal!important}

/* Less title/toolbar waste. Full wording remains in title/ARIA. */
.rt-titlebar{padding:5px 8px!important;gap:6px!important;margin:0 0 6px!important;min-height:0!important}
.rt-titlebar h1{font-size:18px!important;line-height:1.05!important;margin:0!important}
.rt-titlebar .rt-eyebrow{font-size:8.5px!important;line-height:1!important;margin:0 0 2px!important}
.rt-titlebar p[data-rt-subtitle]{font-size:10.8px!important;line-height:1.2!important;margin:3px 0 0!important;max-width:1100px!important}
.rt-title-actions{gap:4px!important;flex-wrap:wrap!important}
.rt-screen-toolbar{min-height:0!important;height:auto!important;padding:5px 6px!important;gap:4px!important;flex-wrap:wrap!important}
.rt-action,.rt-mini,.fu-btn,.ops-btn{min-height:var(--v12720-control-h)!important;height:auto!important;padding:4px 7px!important;font-size:10.7px!important;line-height:1.05!important;white-space:normal!important}

/* Procurement row truth: the spinner lives on the exact row currently being
   persisted. Successful rows become Ordered before leaving Needs PO. */
[data-screen="orders.pending"] tr.rt-po-row-processing{background:#f1f7ff!important;box-shadow:inset 3px 0 #1769d2!important}
[data-screen="orders.pending"] tr.rt-po-row-failed{background:#fff7f7!important;box-shadow:inset 3px 0 #c73535!important}
[data-screen="orders.pending"] tr.rt-po-row-complete{background:#effbf3!important;box-shadow:inset 3px 0 #1e9b55!important}
[data-screen="orders.pending"] button[data-action-id="orders.create_po_row"]{min-width:76px!important;justify-content:center!important}
[data-screen="orders.pending"] button[data-action-id="orders.create_po_row"].rt-action-busy{background:#1769d2!important;border-color:#1769d2!important;color:#fff!important}
[data-screen="orders.pending"] button[data-action-id="orders.create_po_row"].rt-action-busy::before{width:11px!important;height:11px!important;flex-basis:11px!important;border:2px solid rgba(255,255,255,.45)!important;border-top-color:#fff!important}
[data-screen="orders.pending"] button[data-action-id="orders.create_po_row"].success{background:#e8f8ef!important;border-color:#a8ddbd!important;color:#176a3d!important;font-weight:850!important}
[data-screen="orders.pending"] tr[data-po-state="queued"] button[data-action-id="orders.create_po_row"]{background:#f5f7fb!important;color:#64748b!important;border-color:#d8e0ea!important}
[data-screen="orders.pending"] tr[data-po-state="failed"] button[data-action-id="orders.create_po_row"]{background:#fff!important;color:#a61f2d!important;border-color:#eab9bf!important}

/* Do not resurrect destructive ellipsis on operational values. */
.rt-table td .rt-cell,.rt-table th,.rt-table th .rt-sort-head,
.fu-table td,.fu-table th,
body.admin-tw:not(.page-settings.page-cat-printstudio) table td,
body.admin-tw:not(.page-settings.page-cat-printstudio) table th{font-size:var(--v12720-row-font)!important;line-height:1.22!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere!important}
.rt-table th,.rt-table th .rt-sort-head,.fu-table th,
body.admin-tw:not(.page-settings.page-cat-printstudio) table th{font-size:var(--v12720-head-font)!important;line-height:1.12!important}

/* IDs, quantities and short workflow states are compact and readable rather
   than character-wrapped. */
.rt-table td[data-col-key="status"] .rt-cell,
.rt-table td[data-col-key="po"] .rt-cell,
.rt-table td[data-col-key="qty"] .rt-cell,
.rt-table td[data-col-key="shortage"] .rt-cell,
.rt-table td[data-col-key*="amount"] .rt-cell,
.rt-table td[data-col-key*="rate"] .rt-cell{overflow-wrap:normal!important;word-break:normal!important}

/* Navigation may scroll horizontally on genuinely narrow devices, but content
   registers themselves must not create a hidden horizontal rail. */
.rt-header-menu,.shell-workbench-nav,.shell-workbench-subnav{overscroll-behavior-inline:contain!important}

@media(max-width:900px){
  :root{--v12720-row-font:11.7px;--v12720-head-font:10.4px}
  .rt-titlebar{display:block!important}
  .rt-title-actions{margin-top:5px!important;justify-content:flex-start!important}
  body.aiotor-runtime-shell:not(.rt-order-entry-active) .rt-table-wrap{overflow-x:auto!important;overflow-y:visible!important}
}

/* V12.7.21: dynamically-created PO batch progress host. Row buttons remain the
   primary truth; this panel is only the compact global summary. */
[data-rt-po-batch-progress]{margin:5px 6px 7px;padding:7px 8px;border:1px solid #d8e3ef;border-radius:8px;background:#fff;box-shadow:0 2px 8px rgba(15,23,42,.05)}
[data-rt-po-batch-progress][hidden]{display:none!important}
.rt-po-batch-head,.rt-po-batch-message,.rt-po-factory-head,.rt-po-batch-actions{display:flex;align-items:center;justify-content:space-between;gap:7px;flex-wrap:wrap}
.rt-po-batch-title{display:flex;align-items:baseline;gap:7px;flex-wrap:wrap}.rt-po-batch-title>b{font-size:12px}.rt-po-batch-title>span,.rt-po-batch-message{font-size:10.5px;color:#526174}
.rt-po-batch-summary,.rt-po-batch-actions{display:flex;gap:5px;flex-wrap:wrap}.rt-po-batch-chip{font-size:9.8px;padding:2px 6px;border-radius:999px;background:#eef3f8;color:#405168}.rt-po-batch-chip.good{background:#e8f7ee;color:#176a3d}.rt-po-batch-chip.warn{background:#fff4d8;color:#8a5b00}
.rt-po-batch-track{height:4px;margin:6px 0;background:#e8eef5;border-radius:999px;overflow:hidden}.rt-po-batch-track>i{display:block;height:100%;background:#1769d2;border-radius:inherit;transition:width .25s ease}
.rt-po-factory-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:5px;margin-top:6px}.rt-po-factory-card{border:1px solid #e0e7ef;border-radius:7px;padding:6px;background:#fbfcfe;min-width:0}.rt-po-factory-card.complete{border-color:#b9dfc8;background:#f4fbf6}.rt-po-factory-card.failed{border-color:#efc1c5;background:#fff8f8}
.rt-po-factory-copy{display:flex;min-width:0;flex-direction:column}.rt-po-factory-copy>b{font-size:10.7px;overflow-wrap:anywhere}.rt-po-factory-copy>span,.rt-po-so-row{font-size:9.7px;color:#607086}.rt-po-so-list{display:grid;gap:3px;margin-top:4px}.rt-po-so-row{display:grid;grid-template-columns:minmax(55px,.8fr) minmax(70px,1.3fr) auto auto;gap:5px;align-items:center}.rt-po-so-row>*{min-width:0;overflow-wrap:anywhere}.rt-po-so-status,.rt-po-factory-po{font-size:9.4px;font-style:normal;font-weight:700;border-radius:999px;padding:2px 5px;white-space:nowrap}.rt-po-so-status.failed{background:#fde8e8;color:#a61f2d}.rt-po-so-status.created,.rt-po-so-status.existing{background:#e8f7ee;color:#176a3d}.rt-po-route-error{margin-top:4px;font-size:9.8px;color:#a61f2d;overflow-wrap:anywhere}
.rt-po-batch-actions a,.rt-po-batch-actions button{min-height:25px;padding:3px 7px;font-size:10px}
