.inventory-header .cx-help{max-width:820px}
.inventory-kpis{margin-bottom:16px}
.inventory-command-tiles{margin-top:14px}
.inventory-command-tile{text-decoration:none;color:inherit;transition:transform .15s ease,border-color .15s ease}
.inventory-command-tile:hover{transform:translateY(-2px);border-color:rgba(15,118,110,.35)}
.inventory-filters{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:12px;align-items:end}
.inventory-table td,.inventory-table th,.inventory-movement-table td,.inventory-movement-table th{white-space:nowrap}
.inventory-low-list{display:grid;gap:10px;margin:0;padding-inline-start:20px}
.inventory-policy-json{direction:ltr;text-align:left;background:rgba(15,23,42,.06);border:1px solid rgba(15,23,42,.12);border-radius:14px;padding:12px;overflow:auto;max-height:260px}
.inventory-modal{max-width:820px;width:min(96vw,820px)}
.inventory-modal .cx-modal-body{display:grid;grid-template-columns:repeat(2,minmax(180px,1fr));gap:12px}
.inventory-modal textarea{min-height:90px}
.inventory-modal .cx-actions-row,.inventory-modal .inventory-full{grid-column:1/-1}
.inventory-table-wrap,.inventory-movement-table{max-height:70vh}
@media(max-width:1100px){.inventory-filters{grid-template-columns:repeat(2,minmax(150px,1fr))}}

/* Searchable inventory item pickers */
.inventory-search-field{position:relative}
.inventory-search-field .cx-input{width:100%}
.inventory-selected-item{margin-top:8px;border:1px solid rgba(15,118,110,.16);background:rgba(15,118,110,.06);border-radius:12px;padding:9px 11px;font-size:13px;color:var(--cx-muted,#64748b);display:grid;gap:4px}
.inventory-selected-item strong{color:var(--cx-text,#0f172a);font-weight:800}
.inventory-selected-item span{display:block;line-height:1.5}
.inventory-modal .cx-field.inventory-full{min-width:0}
.inventory-modal .cx-input[list]{padding-inline-start:12px}

/* Settlement intelligence and transfer follow-up */
.inventory-recommendations{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px;margin-top:12px}
.inventory-recommendation .cx-card-body{display:grid;gap:8px}
.inventory-mini-table td,.inventory-mini-table th{white-space:normal}

/* Inventory reports tabs */

/* Production log global UI */
.inventory-movement-table tr[data-clickable="true"]{cursor:pointer}.inventory-production-readonly-note{padding:10px 12px;border-radius:14px;background:rgba(124,58,237,.10);border:1px solid rgba(124,58,237,.18);color:var(--cx-text,#1f1633)}


/* Production KPI cards aligned with dashboard/global cards */
.production-page-kpis {
  margin-block: var(--cx-space-5);
  grid-auto-rows: 1fr;
}
.production-page-kpis.cx-grid-5 { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.production-page-kpis.cx-grid-4 { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.production-page-kpis .cx-kpi { min-height: 138px; padding: var(--cx-space-5); }
@media (max-width: 1280px) { .production-page-kpis.cx-grid-5,.production-page-kpis.cx-grid-4 { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 900px) { .production-page-kpis.cx-grid-5,.production-page-kpis.cx-grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 640px) { .production-page-kpis.cx-grid-5,.production-page-kpis.cx-grid-4 { grid-template-columns: 1fr; } }

/* Production log columns and details */
.production-ledger-table .cx-table,.production-batch-table .cx-table{min-width:1080px;}
.production-detail-modal .cx-card{margin:0 0 12px;}

/* Production ledger tabs */
.production-ledger-tabs-card .cx-card-body{display:grid;gap:14px;}
.production-tabs-help{margin:0;padding:10px 12px;border:1px solid var(--cx-border,#e6e0f4);border-radius:14px;background:color-mix(in srgb,var(--cx-surface,#fff) 94%,#7c3aed 6%);}
.production-ledger-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
.production-ledger-tab{border:1px solid var(--cx-border,#e6e0f4);border-radius:18px;background:var(--cx-surface,#fff);padding:12px 14px;text-align:start;cursor:pointer;display:grid;gap:4px;color:var(--cx-text,#1f1633);transition:.16s ease;}
.production-ledger-tab strong{font-size:14px}.production-ledger-tab small{color:var(--cx-muted,#6b627a);font-size:11px;}
.production-ledger-tab.is-active{border-color:color-mix(in srgb,#7c3aed 60%,#db2777 40%);background:linear-gradient(135deg,rgba(124,58,237,.12),rgba(219,39,119,.08));box-shadow:0 14px 30px rgba(124,58,237,.14);}
.production-tab-panel{display:grid;gap:12px;}
.production-tab-toolbar{align-items:end;justify-content:flex-start;flex-wrap:wrap;}
.production-tab-table-wrap{padding:0;overflow:auto;}
@media(max-width:720px){.production-ledger-tabs{grid-template-columns:1fr}}

/* Live table search without apply buttons */
.production-tab-toolbar .cx-live-search-field{min-width:260px;max-width:420px;width:100%}
.production-tab-table-wrap{transition:opacity .16s ease}

/* Phase 33 — Inventory operational pages upgrade */
.inventory-page-kpis{margin:16px 0}
.inventory-page-card .cx-card-header{align-items:flex-start}
.inventory-page-card .cx-card-header h2{margin-bottom:4px}
.inventory-smart-table .cx-status-pill{white-space:nowrap}
.inventory-action-stack{display:flex;gap:8px;align-items:center;justify-content:flex-start;flex-wrap:wrap}
.inventory-insight-card{margin-top:16px}
.inventory-insight-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.inventory-insight-grid>div{border:1px solid rgba(99,102,241,.14);border-radius:16px;padding:14px;background:linear-gradient(135deg,rgba(255,255,255,.86),rgba(250,245,255,.74))}
.inventory-insight-grid strong{display:block;margin-top:5px;font-size:1.05rem;color:var(--cx-text,#111827)}
.inventory-insight-grid small{display:block;margin-top:4px;color:var(--cx-muted,#6b7280)}
.inventory-modal-kpis{margin-bottom:14px}
.inventory-detail-modal .cx-table-wrap{max-height:360px;overflow:auto}
.inventory-page-card .cx-filter-bar{border-top:1px solid rgba(99,102,241,.12)}
.inventory-movement-table tr[data-row-semantic="warn"] td:first-child,
.inventory-smart-table tr[data-row-semantic="warn"] td:first-child{box-shadow:inset -3px 0 0 rgba(245,158,11,.75)}
.inventory-movement-table tr[data-row-semantic="ok"] td:first-child,
.inventory-smart-table tr[data-row-semantic="ok"] td:first-child{box-shadow:inset -3px 0 0 rgba(16,185,129,.65)}
@media (max-width: 900px){
  .inventory-insight-grid{grid-template-columns:1fr}
  .inventory-action-stack{justify-content:flex-start}
  .inventory-page-card .cx-filter-bar{grid-template-columns:1fr}
}

/* Phase 34B — Raw Materials Health + Ledger Intelligence UI */
.inventory-intel-kpis .cx-kpi-value{letter-spacing:-.02em}
.inventory-health-card .cx-card-body{display:grid;gap:16px}
.inventory-health-strip{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:4px}
.inventory-health-strip>div{border:1px solid rgba(20,184,166,.16);background:linear-gradient(135deg,rgba(240,253,250,.9),rgba(255,255,255,.82));border-radius:18px;padding:14px}
.inventory-health-strip strong{display:block;margin-top:5px;font-size:1.14rem;color:var(--cx-text,#111827)}
.inventory-health-score{display:inline-flex;align-items:baseline;gap:2px;min-width:54px;justify-content:center;border-radius:999px;padding:7px 10px;background:rgba(16,185,129,.12);color:#047857;border:1px solid rgba(16,185,129,.22)}
.inventory-health-score[data-state="warn"]{background:rgba(245,158,11,.12);color:#92400e;border-color:rgba(245,158,11,.24)}
.inventory-health-score[data-state="danger"]{background:rgba(239,68,68,.12);color:#991b1b;border-color:rgba(239,68,68,.24)}
.inventory-health-score strong{font-size:1.05rem;line-height:1}
.inventory-health-score small{font-size:.72rem;opacity:.8}
.inventory-health-table td:nth-child(2),.inventory-health-table th:nth-child(2){text-align:center}
.inventory-risk-panel article h3,.inventory-ledger-intel article h3{margin:0 0 10px;font-size:1rem}
.inventory-ledger-intel .cx-card-body,.inventory-risk-panel .cx-card-body{gap:16px}
.inventory-ledger-intel article,.inventory-risk-panel article{min-width:0;border:1px solid rgba(99,102,241,.12);border-radius:18px;padding:14px;background:rgba(255,255,255,.68)}
.inventory-mini-table .cx-table{font-size:.92rem}
@media (max-width: 1100px){
  .inventory-health-strip{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width: 720px){
  .inventory-health-strip{grid-template-columns:1fr}
  .inventory-ledger-intel .cx-card-body,.inventory-risk-panel .cx-card-body{grid-template-columns:1fr}
}

/* Phase 34C — Waste/Audit/Transfer/Component intelligence + raw material modal hotfix */
.inventory-waste-intel article,
.inventory-audit-intel article,
.inventory-transfer-intel article{min-width:0;border:1px solid rgba(99,102,241,.12);border-radius:18px;padding:14px;background:rgba(255,255,255,.7)}
.inventory-wide-pane{grid-column:1/-1}
.inventory-alert-list{display:grid;gap:10px}
.inventory-alert{border-radius:14px;padding:12px;border:1px solid rgba(148,163,184,.2);background:rgba(248,250,252,.88)}
.inventory-alert strong{display:block;margin-bottom:4px}
.inventory-alert span{display:block;color:var(--cx-muted,#64748b);font-size:.92rem}
.inventory-alert[data-level="warn"]{border-color:rgba(245,158,11,.28);background:rgba(255,251,235,.88)}
.inventory-alert[data-level="danger"]{border-color:rgba(239,68,68,.28);background:rgba(254,242,242,.88)}
.inventory-alert[data-level="ok"]{border-color:rgba(16,185,129,.24);background:rgba(240,253,244,.86)}
.inventory-item-modal .cx-modal-card,
.inventory-item-modal.cx-modal-card{max-width:min(760px,calc(100vw - 32px));overflow-x:hidden}
.inventory-item-form{overflow-x:hidden;max-width:100%;box-sizing:border-box}
.inventory-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start;max-width:100%;overflow-x:hidden}
.inventory-form-grid .cx-field{min-width:0}
.inventory-form-grid .cx-input,
.inventory-form-grid .cx-select,
.inventory-form-grid select,
.inventory-form-grid input{min-width:0;max-width:100%;width:100%;box-sizing:border-box}
.inventory-modal-actions{justify-content:flex-start;gap:10px;position:sticky;bottom:0;background:linear-gradient(180deg,rgba(255,255,255,.86),#fff);padding-top:10px}
@media (max-width: 780px){
  .inventory-form-grid{grid-template-columns:1fr}
  .inventory-item-modal .cx-modal-card,
  .inventory-item-modal.cx-modal-card{max-width:calc(100vw - 18px)}
  .inventory-wide-pane{grid-column:auto}
}

/* Phase 35A/B — Inventory count Excel import foundation */
.inventory-count-sessions .cx-table-wrap{max-height:420px}
.inventory-count-import-form{overflow-x:hidden}
.inventory-count-import-steps{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.inventory-count-import-steps .cx-card{min-width:0}
.inventory-count-preview{display:grid;gap:14px;margin-top:14px}
.inventory-count-preview .cx-card{min-width:0}
.inventory-count-modal .cx-modal-card,
.inventory-count-modal.cx-modal-card{max-width:min(980px,calc(100vw - 32px));overflow-x:hidden}
.inventory-count-modal [data-count-preview-zone]{min-height:0}
@media (max-width: 820px){
  .inventory-count-import-steps{grid-template-columns:1fr}
}

.inventory-count-drop{
  margin-bottom: 10px;
}


/* Phase 35C — Audit Control Tabs Cleanup */
.inventory-audit-control .cx-card-body{display:grid;gap:16px}
.inventory-audit-tabs{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.inventory-audit-tab{border:1px solid rgba(124,58,237,.14);background:rgba(255,255,255,.78);border-radius:16px;padding:12px;text-align:right;cursor:pointer;display:grid;gap:4px;min-width:0;color:var(--cx-text,#111827)}
.inventory-audit-tab:hover{border-color:rgba(124,58,237,.32);box-shadow:0 8px 20px rgba(88,28,135,.08)}
.inventory-audit-tab.is-active{background:linear-gradient(135deg,rgba(124,58,237,.14),rgba(236,72,153,.12));border-color:rgba(124,58,237,.42);box-shadow:0 10px 26px rgba(88,28,135,.13)}
.inventory-audit-tab strong{font-size:.98rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.inventory-audit-tab small{color:var(--cx-muted,#64748b);font-size:.78rem;line-height:1.35}
.inventory-audit-tab-body{display:grid;gap:16px}
.inventory-audit-tab-stack{display:grid;gap:16px}
.inventory-audit-primary-card,
.inventory-audit-sources-card{border-color:rgba(124,58,237,.14)}
.inventory-audit-primary-card>.cx-card-header,
.inventory-audit-sources-card>.cx-card-header{align-items:flex-start}
.inventory-audit-tab-kpis{margin-bottom:14px}
.inventory-count-session-table .cx-table-wrap{max-height:520px}
.inventory-audit-sources-card .inventory-insight-card{margin-bottom:14px}
@media (max-width: 1180px){
  .inventory-audit-tabs{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width: 760px){
  .inventory-audit-tabs{grid-template-columns:1fr}
  .inventory-audit-tab strong{white-space:normal}
}

/* Phase 35C2 — Count upload modal professional rebuild */
.inventory-count-modal.cx-modal{
  width:min(1120px,calc(100vw - 34px)) !important;
  max-width:min(1120px,calc(100vw - 34px)) !important;
}
.inventory-count-modal.cx-modal>.cx-modal-body{
  display:block !important;
  grid-template-columns:none !important;
  padding:0 !important;
  overflow:auto;
}
.inventory-count-modal .inventory-count-import-form{
  display:grid;
  grid-template-rows:minmax(0,1fr) auto;
  min-height:0;
  overflow:hidden;
}
.inventory-count-modal-layout{
  display:grid;
  gap:16px;
  padding:18px;
  min-width:0;
}
.inventory-count-hero{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:18px;
  border:1px solid rgba(124,58,237,.16);
  border-radius:22px;
  background:linear-gradient(135deg,rgba(124,58,237,.12),rgba(20,184,166,.10));
}
.inventory-count-hero h3{margin:0 0 6px;font-size:1.25rem}
.inventory-count-hero p{margin:0;color:var(--cx-muted,#64748b);line-height:1.6}
.inventory-count-hero-badges{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.inventory-count-hero-badges span{
  border:1px solid rgba(124,58,237,.18);
  background:rgba(255,255,255,.76);
  border-radius:999px;
  padding:7px 10px;
  font-size:.82rem;
  white-space:nowrap;
}
.inventory-count-form-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:14px;
}
.inventory-count-form-grid .cx-field{min-width:0}
.inventory-count-form-grid .cx-input,
.inventory-count-form-grid select,
.inventory-count-form-grid input{
  width:100%;
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}
.inventory-count-workflow{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}
.inventory-count-step-card{min-width:0}
.inventory-count-step-card .cx-card-body{display:grid;gap:12px}
.inventory-count-drop{
  display:grid;
  gap:5px;
  min-height:104px;
  place-items:center;
  border:2px dashed rgba(20,184,166,.45);
  border-radius:18px;
  padding:18px;
  text-align:center;
  background:rgba(240,253,250,.78);
  color:#0f766e;
}
.inventory-count-drop strong{font-size:1rem}
.inventory-count-drop small{font-size:.86rem;opacity:.82}
.inventory-count-drop.is-dragover{background:rgba(204,251,241,.96);border-color:#0f766e}
.inventory-count-preview-zone{min-width:0}
.inventory-count-empty-preview{
  display:grid;
  gap:5px;
  place-items:center;
  min-height:130px;
  border:1px dashed rgba(148,163,184,.35);
  border-radius:18px;
  color:var(--cx-muted,#64748b);
  background:rgba(248,250,252,.72);
  text-align:center;
}
.inventory-count-empty-preview strong{color:var(--cx-text,#111827)}
.inventory-count-modal-actions{
  margin:0;
  padding:14px 18px;
  border-top:1px solid var(--cx-border,rgba(148,163,184,.22));
  background:var(--cx-surface,#fff);
  position:sticky;
  bottom:0;
  z-index:2;
  justify-content:flex-start;
}
.inventory-count-preview .cx-table-wrap{max-height:360px;overflow:auto}
@media (max-width: 980px){
  .inventory-count-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .inventory-count-workflow{grid-template-columns:1fr}
  .inventory-count-hero{display:grid}
}
@media (max-width: 640px){
  .inventory-count-modal.cx-modal{width:calc(100vw - 18px) !important;max-width:calc(100vw - 18px) !important}
  .inventory-count-form-grid{grid-template-columns:1fr}
  .inventory-count-modal-layout{padding:12px}
  .inventory-count-modal-actions{padding:12px;display:grid}
}

/* Phase 35D — Audit Control Comparison Grid */
.inventory-audit-scope-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:0 0 14px;
}
.inventory-audit-scope-tab{
  border:1px solid rgba(124,58,237,.18);
  background:rgba(255,255,255,.78);
  border-radius:999px;
  padding:8px 13px;
  cursor:pointer;
  color:var(--cx-text,#111827);
}
.inventory-audit-scope-tab.is-active{
  background:linear-gradient(135deg,rgba(124,58,237,.18),rgba(236,72,153,.12));
  border-color:rgba(124,58,237,.42);
  font-weight:800;
}
.inventory-audit-comparison-table .cx-table-wrap{
  max-height:62vh;
}
.inventory-audit-comparison-table td,
.inventory-audit-comparison-table th{
  vertical-align:middle;
}
.inventory-audit-number{
  appearance:none;
  border:1px solid rgba(124,58,237,.16);
  background:rgba(248,250,252,.82);
  color:var(--cx-text,#111827);
  border-radius:12px;
  padding:7px 10px;
  min-width:74px;
  cursor:pointer;
  display:inline-grid;
  gap:2px;
  place-items:center;
}
.inventory-audit-number:hover{
  border-color:rgba(124,58,237,.38);
  background:rgba(245,243,255,.92);
}
.inventory-audit-number small{
  font-size:.68rem;
  color:var(--cx-muted,#64748b);
}
.cx-btn-xs{
  padding:5px 9px;
  font-size:.78rem;
  border-radius:10px;
  margin-top:4px;
}
.inventory-count-sessions-compact .cx-table-wrap{
  max-height:320px;
}
.inventory-audit-drill.cx-modal{
  width:min(1080px,calc(100vw - 34px)) !important;
}
.inventory-audit-drill .inventory-detail-modal{
  min-width:0;
}
.inventory-audit-drill .cx-table-wrap{
  max-height:360px;
}
@media(max-width:820px){
  .inventory-audit-number{min-width:56px;padding:6px 8px}
}

/* Phase 35F/G/H — Settlement permission, final cleanup, theoretical vs actual */
.inventory-count-settle-modal.cx-modal{
  width:min(860px,calc(100vw - 34px)) !important;
}
.inventory-count-settle-form textarea.cx-input{
  min-height:110px;
}
.inventory-count-settle-form .cx-table-wrap{
  max-height:260px;
}
.inventory-count-session-table .cx-btn-xs{
  white-space:nowrap;
}
.inventory-audit-primary-card .cx-card-body{
  gap:14px;
}
.inventory-audit-tab-stack>.cx-card{
  min-width:0;
}

/* Phase 35I — Audit operational grid and source-only drilldowns */
.inventory-audit-operational-table .cx-table-wrap{
  max-height:64vh;
  overflow:auto;
}
.inventory-audit-operational-table th,
.inventory-audit-operational-table td{
  vertical-align:middle;
}
.inventory-audit-static{
  display:inline-flex;
  min-width:62px;
  justify-content:center;
  padding:7px 10px;
  border-radius:12px;
  background:rgba(248,250,252,.86);
  border:1px solid rgba(148,163,184,.18);
  color:var(--cx-text,#111827);
  font-weight:700;
}
.inventory-audit-actual-cell{
  display:inline-grid;
  gap:3px;
  justify-items:center;
}
.inventory-audit-actual-cell small{
  font-size:.68rem;
  color:var(--cx-muted,#64748b);
}
.inventory-audit-source-btn{
  appearance:none;
  border:1px solid rgba(124,58,237,.18);
  background:rgba(255,255,255,.88);
  color:var(--cx-text,#111827);
  border-radius:13px;
  padding:7px 11px;
  min-width:76px;
  cursor:pointer;
  display:inline-grid;
  gap:2px;
  place-items:center;
}
.inventory-audit-source-btn[data-state="in"]{
  border-color:rgba(16,185,129,.28);
  background:rgba(240,253,244,.9);
}
.inventory-audit-source-btn[data-state="out"]{
  border-color:rgba(245,158,11,.3);
  background:rgba(255,251,235,.92);
}
.inventory-audit-source-btn[data-state="empty"]{
  opacity:.72;
  cursor:default;
}
.inventory-audit-source-btn strong{
  font-size:.92rem;
}
.inventory-audit-source-btn small{
  font-size:.68rem;
  color:var(--cx-muted,#64748b);
}
.inventory-audit-source-btn:hover{
  box-shadow:0 8px 18px rgba(88,28,135,.09);
  transform:translateY(-1px);
}
.inventory-audit-source-details-table .cx-table-wrap{
  max-height:470px;
  overflow:auto;
}
.inventory-audit-source-drill.cx-modal{
  width:min(1120px,calc(100vw - 34px)) !important;
}
.inventory-audit-source-modal{
  min-width:0;
}
.inventory-audit-comparison-table .inventory-audit-number{
  display:none;
}
@media(max-width:900px){
  .inventory-audit-static,
  .inventory-audit-source-btn{
    min-width:54px;
    padding:6px 8px;
  }
}

/* Phase 35J — clean count template, manual count entry, consumption column, polished source modals */
.inventory-consumption-cell{
  display:grid;
  gap:3px;
  justify-items:center;
  min-width:86px;
}
.inventory-consumption-cell strong{
  color:var(--cx-text,#111827);
}
.inventory-consumption-cell span{
  color:var(--cx-muted,#64748b);
  font-size:.82rem;
}
.inventory-consumption-cell small{
  border-radius:999px;
  padding:3px 8px;
  font-size:.7rem;
  background:rgba(148,163,184,.14);
  color:#475569;
}
.inventory-consumption-cell small[data-state="ok"]{
  background:rgba(16,185,129,.13);
  color:#047857;
}
.inventory-manual-count-card .cx-card-header{
  align-items:flex-start;
}
.inventory-manual-count-table .cx-input{
  min-width:110px;
}
.inventory-manual-actual-input{
  font-weight:800;
  text-align:center;
}
.inventory-manual-count-wrap .cx-table-wrap{
  max-height:420px;
  overflow:auto;
}
.inventory-source-modal-shell{
  display:grid;
  gap:16px;
  min-width:0;
}
.inventory-source-hero{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  padding:18px;
  border-radius:22px;
  border:1px solid rgba(124,58,237,.16);
  background:linear-gradient(135deg,rgba(124,58,237,.12),rgba(20,184,166,.09));
}
.inventory-source-hero h3{
  margin:0 0 5px;
  font-size:1.22rem;
}
.inventory-source-hero p{
  margin:0;
  color:var(--cx-muted,#64748b);
}
.inventory-source-kpis{
  margin:0;
}
.inventory-source-groups{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}
.inventory-source-groups article{
  border:1px solid rgba(148,163,184,.18);
  background:rgba(255,255,255,.78);
  border-radius:16px;
  padding:13px;
  display:grid;
  gap:4px;
}
.inventory-source-groups article span{
  color:var(--cx-muted,#64748b);
  font-size:.82rem;
}
.inventory-source-groups article strong{
  font-size:1.04rem;
  color:var(--cx-text,#111827);
}
.inventory-source-groups article small{
  color:var(--cx-muted,#64748b);
}
.inventory-source-table-card .cx-table-wrap{
  max-height:430px;
  overflow:auto;
}
.inventory-ref-btn{
  white-space:nowrap;
}
@media(max-width:980px){
  .inventory-source-groups{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:640px){
  .inventory-source-hero{display:grid}
  .inventory-source-groups{grid-template-columns:1fr}
}


/* Phase 35J2 verified cumulative marker: audit control final bundle */

/* Phase 35J3 — count entry title/modal clarity */
.inventory-manual-count-card{
  border-color:rgba(16,185,129,.24) !important;
  background:linear-gradient(180deg,rgba(240,253,244,.72),rgba(255,255,255,.86));
}
.inventory-manual-count-card .cx-card-header h3{
  color:#047857;
}
.inventory-count-modal .inventory-count-workflow{
  margin-top:4px;
}


/* Phase 35K — final audit columns and remove duplicated sessions */
.inventory-audit-final-table th:nth-child(3),
.inventory-audit-final-table th:nth-child(7){
  background:rgba(16,185,129,.09);
}
.inventory-audit-final-table .inventory-audit-actual-cell small{
  color:#64748b;
  font-size:.7rem;
}
.inventory-count-sessions-compact{
  display:none !important;
}


/* Phase 35L — professional source modal polish */
.inventory-audit-source-drill-pro.cx-modal{
  width:min(1280px,calc(100vw - 42px)) !important;
  max-width:min(1280px,calc(100vw - 42px)) !important;
}
.inventory-audit-source-drill-pro .cx-modal-body{
  padding:22px !important;
  max-height:min(78vh,760px) !important;
  overflow:auto !important;
  display:block !important;
}
.inventory-audit-source-drill-pro .inventory-source-modal-shell{
  width:100%;
  display:grid;
  gap:18px;
}
.inventory-audit-source-drill-pro .inventory-source-hero{
  min-height:96px;
  align-items:center;
  padding:22px 24px;
  border-radius:24px;
  background:
    radial-gradient(circle at top left,rgba(124,58,237,.20),transparent 34%),
    linear-gradient(135deg,rgba(255,255,255,.96),rgba(245,243,255,.92));
  box-shadow:0 18px 46px rgba(88,28,135,.11);
}
.inventory-audit-source-drill-pro .inventory-source-hero h3{
  font-size:1.35rem;
}
.inventory-audit-source-drill-pro .inventory-source-kpis{
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
}
.inventory-audit-source-drill-pro .inventory-source-group-card,
.inventory-audit-source-drill-pro .inventory-source-table-card{
  border-radius:22px;
  box-shadow:0 14px 38px rgba(15,23,42,.06);
}
.inventory-audit-source-drill-pro .inventory-source-groups{
  grid-template-columns:repeat(4,minmax(0,1fr));
}
.inventory-audit-source-drill-pro .inventory-source-groups article{
  min-height:96px;
  padding:16px;
  border-radius:18px;
}
.inventory-source-empty{
  min-height:120px;
  border:1px dashed rgba(124,58,237,.25);
  background:linear-gradient(135deg,rgba(250,245,255,.75),rgba(255,255,255,.9));
  border-radius:18px;
  display:grid;
  place-items:center;
  text-align:center;
  gap:6px;
  padding:22px;
}
.inventory-source-empty strong{
  color:#4c1d95;
  font-size:1rem;
}
.inventory-source-empty span{
  color:#64748b;
  max-width:520px;
}
.inventory-audit-source-drill-pro .inventory-audit-source-details-table .cx-table-wrap{
  max-height:430px;
  overflow:auto;
  border-radius:16px;
}
.inventory-audit-source-drill-pro .inventory-audit-source-details-table table{
  min-width:900px;
}
@media(max-width:1000px){
  .inventory-audit-source-drill-pro .inventory-source-kpis,
  .inventory-audit-source-drill-pro .inventory-source-groups{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
}
@media(max-width:640px){
  .inventory-audit-source-drill-pro.cx-modal{
    width:calc(100vw - 18px) !important;
  }
  .inventory-audit-source-drill-pro .cx-modal-body{
    padding:14px !important;
  }
  .inventory-audit-source-drill-pro .inventory-source-kpis,
  .inventory-audit-source-drill-pro .inventory-source-groups{
    grid-template-columns:1fr !important;
  }
}

/* Phase 35AJ — inventory audit global filter + saved count results */
.inventory-audit-control{
  margin-top:0;
}
.inventory-saved-count-results .cx-card-header{
  align-items:flex-start;
}
.inventory-saved-count-results-table .cx-table-wrap{
  max-height:540px;
  overflow:auto;
  border-radius:18px;
}
.inventory-saved-count-results-table table{
  min-width:980px;
}
.inventory-count-result-modal.cx-modal{
  width:min(1320px,calc(100vw - 36px)) !important;
  max-width:min(1320px,calc(100vw - 36px)) !important;
}
.inventory-count-result-modal .cx-modal-body{
  max-height:min(80vh,780px) !important;
  overflow:auto !important;
  padding:22px !important;
}
.inventory-count-result-detail{
  display:grid;
  gap:18px;
}
.inventory-count-result-hero{
  min-height:104px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:22px 24px;
  border:1px solid rgba(124,58,237,.18);
  border-radius:24px;
  background:radial-gradient(circle at top left,rgba(124,58,237,.18),transparent 34%),linear-gradient(135deg,rgba(255,255,255,.96),rgba(250,245,255,.92));
  box-shadow:0 18px 46px rgba(88,28,135,.10);
}
.inventory-count-result-hero h3{
  margin:0 0 6px;
  color:#4c1d95;
  font-size:1.25rem;
}
.inventory-count-result-hero p{
  margin:0;
  color:var(--cx-muted,#64748b);
  font-weight:850;
}
.inventory-count-result-lines-card .cx-card-body{
  min-width:0;
}
.inventory-count-result-lines-table .cx-table-wrap{
  max-height:470px;
  overflow:auto;
  border-radius:18px;
}
.inventory-count-result-lines-table table{
  min-width:1120px;
}
@media(max-width:760px){
  .inventory-count-result-modal.cx-modal{
    width:calc(100vw - 18px) !important;
    max-width:calc(100vw - 18px) !important;
  }
  .inventory-count-result-modal .cx-modal-body{
    padding:12px !important;
  }
  .inventory-count-result-hero{
    display:grid;
    padding:16px;
  }
}

/* Phase 35AK — period-aware count result details modal */
.inventory-count-result-modal-pro.cx-modal{
  display: flex !important;
  flex-direction: column !important;
}
.inventory-count-result-modal-pro .cx-modal-header{
  flex:0 0 auto;
  border-bottom:1px solid rgba(124,58,237,.14);
  background:linear-gradient(135deg,rgba(255,255,255,.98),rgba(250,245,255,.96));
}
.inventory-count-result-modal-pro .cx-modal-body{
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
}
.inventory-count-loading{
  min-height:360px;
  display:grid;
  place-content:center;
  gap:10px;
  text-align:center;
  color:var(--cx-muted,#64748b);
}
.inventory-count-result-detail-pro{
  min-width: 0;
}
.inventory-count-result-hero-pro{
  justify-content: space-between;
  border: 1px solid rgba(124,58,237,.18);
  background: radial-gradient(circle at top right,rgba(236,72,153,.18),transparent 34%),linear-gradient(135deg,rgba(255,255,255,.98),rgba(245,243,255,.96));
  box-shadow: 0 20px 56px rgba(88,28,135,.12);
}
.inventory-count-result-hero-pro h3{
  color: #3b0764;
}
.inventory-count-result-hero-pro p{
  margin:0 0 5px;
  font-weight:900;
  color:#475569;
}
.inventory-count-result-hero-side{
  display: grid;
  place-content: center;
  text-align: center;
  border-radius: 22px;
  border: 1px solid rgba(124,58,237,.16);
  background: rgba(255,255,255,.82);
}
.inventory-count-result-hero-side strong{
  display: block;
  color: #581c87;
}
.inventory-count-result-hero-side span{
  color:#64748b;
  font-weight:900;
}

.inventory-count-result-lines-card-pro{
  min-width: 0;
}
.inventory-count-result-lines-card-pro .cx-card-body{
  min-width: 0;
}
.inventory-count-result-lines-table-pro .cx-table-wrap{
  min-height: 320px;
}


@media(max-width:1100px){
  .inventory-count-result-kpis{grid-template-columns:repeat(2,minmax(0,1fr));}
  .inventory-count-result-hero-pro{display:grid;}
  .inventory-count-result-hero-side{min-width:0;}
}
@media(max-width:700px){
  .inventory-count-result-modal-pro.cx-modal{
    width:calc(100vw - 12px) !important;
    height:calc(100vh - 18px) !important;
  }
  .inventory-count-result-modal-pro .cx-modal-body{padding:12px !important;}
  .inventory-count-result-hero-pro{padding:16px;border-radius:20px;}
  .inventory-count-result-kpis{grid-template-columns:1fr;}
}

/* Phase 35AL — inventory count boundary carry-forward + readable result modal */
.inventory-count-result-modal-pro.inventory-modal .cx-modal-body,
.inventory-count-result-modal-pro .cx-modal-body{
  display:block !important;
  grid-template-columns:none !important;
  gap:0 !important;
}
.inventory-count-result-modal-pro.cx-modal{
  width:min(1500px,calc(100vw - 32px)) !important;
  max-width:min(1500px,calc(100vw - 32px)) !important;
  height:min(88vh,900px) !important;
  max-height:min(88vh,900px) !important;
  overflow:hidden !important;
  border-radius:28px !important;
}
.inventory-count-result-modal-pro .cx-modal-header{
  min-height:76px;
  padding:18px 24px !important;
}
.inventory-count-result-modal-pro .cx-modal-header h2{
  margin:0;
  font-size:1.35rem;
  color:#2e1065;
}
.inventory-count-result-modal-pro .cx-modal-body{
  padding:20px !important;
  overflow:hidden !important;
  background:linear-gradient(180deg,#fbf7ff 0%,#fff 100%) !important;
}
.inventory-count-result-detail-pro{
  height:100%;
  min-height:0;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr);
  gap:14px;
}
.inventory-count-result-hero-pro{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) minmax(220px,300px);
  align-items:stretch;
  gap:14px;
  padding:18px 20px !important;
  border-radius:24px !important;
}
.inventory-count-result-hero-pro h3{
  margin:8px 0 6px !important;
  font-size:1.25rem !important;
  line-height:1.35;
  word-break:break-word;
}
.inventory-count-result-hero-side{
  min-width:0 !important;
  padding:14px !important;
}
.inventory-count-result-hero-side strong{
  font-size:1.55rem !important;
}
.inventory-count-result-kpis{
  display:grid !important;
  grid-template-columns:repeat(5,minmax(140px,1fr)) !important;
  gap:12px !important;
  margin:0 !important;
}
.inventory-count-result-lines-card-pro{
  min-height:0;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  overflow:hidden !important;
  border-radius:24px !important;
}
.inventory-count-result-lines-card-pro .cx-card-header{
  padding:18px 20px !important;
  border-bottom:1px solid rgba(124,58,237,.12);
}
.inventory-count-result-lines-card-pro .cx-card-body{
  min-height:0;
  overflow:hidden;
  padding:0 !important;
}
.inventory-count-result-lines-table-pro,
.inventory-count-result-lines-table-pro .cx-table-wrap{
  height:100%;
  min-height:0;
}
.inventory-count-result-lines-table-pro .cx-table-wrap{
  max-height:none !important;
  overflow:auto !important;
  border-radius:0 !important;
}
.inventory-count-result-lines-table-pro table{
  min-width:1420px !important;
}
.inventory-count-result-lines-table-pro thead th{
  position:sticky;
  top:0;
  z-index:3;
  background:#f1eaff !important;
  box-shadow:0 1px 0 rgba(124,58,237,.16);
}
.inventory-count-result-lines-table-pro th,
.inventory-count-result-lines-table-pro td{
  padding:12px 14px !important;
  vertical-align:middle;
  white-space:nowrap;
}
.inventory-count-result-lines-table-pro td:first-child,
.inventory-count-result-lines-table-pro th:first-child{
  min-width:240px;
  white-space:normal;
}
@media(max-width:1100px){
  .inventory-count-result-modal-pro.cx-modal{width:calc(100vw - 18px) !important;height:calc(100vh - 18px) !important;max-height:calc(100vh - 18px) !important;}
  .inventory-count-result-detail-pro{grid-template-rows:auto auto minmax(0,1fr);}
  .inventory-count-result-hero-pro{grid-template-columns:1fr !important;}
  .inventory-count-result-kpis{grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
}
@media(max-width:700px){
  .inventory-count-result-modal-pro .cx-modal-header{padding:12px 14px !important;}
  .inventory-count-result-modal-pro .cx-modal-body{padding:10px !important;}
  .inventory-count-result-hero-pro{padding:14px !important;}
  .inventory-count-result-kpis{grid-template-columns:1fr !important;}
}

/* Phase 35AM — inventory details uses the global detail modal contract */
.inventory-count-result-modal-pro.cx-modal-detail{
  width:min(1440px,calc(100vw - 32px)) !important;
  height:min(90vh,920px) !important;
  max-height:min(90vh,920px) !important;
}
.inventory-count-result-modal-pro.cx-modal-detail .cx-modal-body{
  display:block !important;
  padding:20px !important;
  overflow:hidden !important;
}
.inventory-count-result-modal-pro.cx-modal-detail .inventory-count-result-detail-pro{
  height:100%;
  width:100%;
  max-width:none;
}
.inventory-count-result-modal-pro.cx-modal-detail .inventory-count-result-hero-pro{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) minmax(220px,300px) !important;
}
.inventory-count-result-modal-pro.cx-modal-detail .inventory-count-result-lines-card-pro{
  min-height:0;
}
.inventory-count-result-modal-pro.cx-modal-detail .inventory-count-result-lines-card-pro .cx-card-body{
  min-height:0;
  overflow:hidden;
  padding:0 !important;
}
.inventory-count-result-modal-pro.cx-modal-detail .inventory-count-result-lines-table-pro .cx-table-wrap{
  height:100%;
  max-height:none !important;
  overflow:auto !important;
}
@media(max-width:1100px){
  .inventory-count-result-modal-pro.cx-modal-detail{width:calc(100vw - 18px) !important;height:calc(100vh - 18px) !important;max-height:calc(100vh - 18px) !important;}
  .inventory-count-result-modal-pro.cx-modal-detail .inventory-count-result-hero-pro{grid-template-columns:1fr !important;}
}
@media(max-width:700px){
  .inventory-count-result-modal-pro.cx-modal-detail .cx-modal-body{padding:10px !important;}
}

/* B-Inventory Ledger Summary — item movement opening/period/closing drilldown */
.inventory-summary-ledger-panel{display:grid;gap:12px}
.inventory-period-note{padding:10px 12px;border:1px solid rgba(20,184,166,.16);border-radius:14px;background:rgba(240,253,250,.72)}
.inventory-summary-ledger-table .cx-table{min-width:1280px}
.inventory-summary-ledger-table td,.inventory-summary-ledger-table th{text-align:start;vertical-align:middle}
.inventory-ledger-number{min-width:74px;justify-content:center;font-variant-numeric:tabular-nums}
.inventory-ledger-number[disabled]{opacity:.46;cursor:not-allowed;pointer-events:none}
.inventory-ledger-number.is-negative,.cx-danger{color:#b91c1c!important;font-weight:800}
.inventory-summary-ledger-table tr[data-row-semantic="danger"] td:first-child{box-shadow:inset -3px 0 0 rgba(239,68,68,.78)}
.inventory-summary-ledger-table tr[data-row-semantic="neutral"]{opacity:.9}
.inventory-summary-detail-modal .inventory-movement-table .cx-table{min-width:980px}

/* B-Inventory Ledger Smart Detail Modal — use global modal/table contract */
.inventory-ledger-detail-smart-modal.cx-smart-detail-modal{
  width:min(1280px,calc(100vw - 2rem));
}
.inventory-ledger-detail-smart-table .cx-table{
  min-width:1180px;
}
.inventory-ledger-detail-smart-table td,
.inventory-ledger-detail-smart-table th{
  text-align:start;
  vertical-align:middle;
}
.inventory-ledger-detail-smart-modal .cx-smart-detail-table-area .cx-table-wrap{
  max-height:min(58vh,620px);
}
@media(max-width:720px){
  .inventory-ledger-detail-smart-modal.cx-smart-detail-modal{
    width:100%;
  }
  .inventory-ledger-detail-smart-modal .cx-smart-detail-table-area .cx-table-wrap{
    max-height:50vh;
  }
}

/* Production log compact operational layout */
.production-summary-strip{display:flex;align-items:stretch;gap:0;overflow:auto;border:1px solid var(--cx-border,#e6e0f4);border-radius:14px;background:var(--cx-surface,#fff)}
.production-summary-strip>span{min-width:135px;flex:1;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;border-inline-start:1px solid var(--cx-border,#e6e0f4);white-space:nowrap}
.production-summary-strip>span:first-child{border-inline-start:0}
.production-summary-strip small{color:var(--cx-muted,#6b627a);font-size:12px}
.production-summary-strip strong{font-size:15px;color:var(--cx-text,#1f1633)}
.production-ledger-tabs{display:flex;gap:6px;border-bottom:1px solid var(--cx-border,#e6e0f4);padding:0 2px}
.production-ledger-tab{border:0;border-bottom:2px solid transparent;border-radius:0;background:transparent;padding:9px 14px;display:block;font-weight:800;box-shadow:none}
.production-ledger-tab.is-active{border-bottom-color:var(--cx-primary,#7c3aed);background:transparent;box-shadow:none;color:var(--cx-primary,#7c3aed)}
.production-tab-toolbar{display:grid;grid-template-columns:minmax(240px,2fr) repeat(3,minmax(150px,1fr)) auto;gap:10px;align-items:end}
.production-tab-toolbar .cx-field{min-width:0}
.production-tab-toolbar .cx-live-search-field{min-width:0;max-width:none;width:auto}
@media(max-width:1050px){.production-tab-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}.production-tab-toolbar .cx-btn{width:max-content}}
@media(max-width:640px){.production-summary-strip>span{min-width:125px}.production-tab-toolbar{grid-template-columns:1fr}.production-ledger-tabs{overflow:auto}.production-ledger-tab{white-space:nowrap}}

/* Production modal + shared inventory combobox */
.inventory-production-modal{width:min(94vw,720px);max-width:720px}
.inventory-production-modal .cx-modal-body{display:block;padding:var(--cx-space-5)}
.inventory-production-form{gap:var(--cx-space-4)}
.inventory-production-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--cx-space-4)}
.inventory-production-modal textarea{min-height:96px;resize:vertical}
.inventory-production-modal .cx-modal-footer{justify-content:flex-start;gap:var(--cx-space-3)}
.inventory-combobox{position:relative;display:block;min-width:0}
.inventory-combobox .cx-input{padding-inline-end:2.75rem}
.inventory-combobox-toggle{position:absolute;inset-inline-end:.45rem;inset-block-start:50%;translate:0 -50%;width:2rem;height:2rem;border:0;border-radius:10px;background:transparent;color:var(--cx-muted);font-size:1.25rem;cursor:pointer}
.inventory-combobox-toggle:hover{background:var(--cx-surface-soft);color:var(--cx-text)}
.inventory-suggestion-list{position:absolute;z-index:30;inset-inline:0;inset-block-start:calc(100% + .4rem);display:grid;gap:.25rem;max-height:280px;overflow:auto;padding:.45rem;border:1px solid var(--cx-border);border-radius:var(--cx-radius-lg);background:var(--cx-surface);box-shadow:0 18px 42px rgba(35,20,60,.18)}
.inventory-suggestion-list[hidden]{display:none}
.inventory-suggestion-option{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:.15rem .75rem;width:100%;padding:.7rem .8rem;border:1px solid transparent;border-radius:12px;background:transparent;color:var(--cx-text);text-align:start;cursor:pointer}
.inventory-suggestion-option strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.inventory-suggestion-option span{direction:ltr;color:var(--cx-muted);font-size:.78rem}
.inventory-suggestion-option small{grid-column:1/-1;color:var(--cx-muted);font-weight:700}
.inventory-suggestion-option:hover,.inventory-suggestion-option[data-active="1"]{border-color:color-mix(in srgb,var(--cx-primary) 30%,var(--cx-border));background:color-mix(in srgb,var(--cx-primary) 8%,var(--cx-surface))}
.inventory-suggestion-empty{padding:1rem;color:var(--cx-muted);text-align:center;font-weight:800}
@media(max-width:640px){.inventory-production-fields{grid-template-columns:1fr}.inventory-production-modal .cx-modal-footer .cx-btn{flex:1}}


/* Component yield + production batch modal — global modal contract */
.cx-component-editor-modal.cx-modal-xl,
.cx-production-batch-modal.cx-modal-xl { width:min(1120px, calc(100vw - 32px)); max-height:min(880px, calc(100vh - 32px)); }
.cx-component-editor-modal .cx-modal-body,
.cx-production-batch-modal .cx-modal-body { overflow:auto; min-width:0; }
.cx-component-editor-modal .cx-modal-footer,
.cx-production-batch-modal .cx-modal-footer { position:sticky; bottom:0; z-index:2; background:var(--cx-surface, #fff); display:flex; gap:10px; justify-content:flex-start; }
.cx-component-master-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.cx-yield-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:0; }
.cx-recipe-copy-disclosure { margin-block-end:12px; }
.cx-recipe-copy-disclosure summary { cursor:pointer; font-weight:700; padding:10px; }
.cx-production-entry-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.cx-production-yield-card { display:grid; grid-template-columns:1fr auto auto; gap:12px; align-items:center; padding:12px; border:1px solid var(--cx-border, #ddd); border-radius:12px; background:var(--cx-soft, #faf8ff); }
.cx-production-factor { padding:10px 12px; border-radius:10px; background:var(--cx-soft, #f7f4ff); font-weight:700; }
.cx-input-with-suffix { display:flex; align-items:stretch; }
.cx-input-with-suffix .cx-input { border-start-end-radius:0; border-end-end-radius:0; }
.cx-input-with-suffix span { display:flex; align-items:center; padding-inline:12px; border:1px solid var(--cx-border, #ddd); border-inline-start:0; border-radius:10px 0 0 10px; white-space:nowrap; }
@media (max-width:760px){.cx-component-master-grid,.cx-production-entry-grid,.cx-yield-summary{grid-template-columns:1fr}.cx-production-yield-card{grid-template-columns:1fr}.cx-component-editor-modal.cx-modal-xl,.cx-production-batch-modal.cx-modal-xl{width:calc(100vw - 16px);max-height:calc(100vh - 16px)}}

/* Production batch modal — unified global modal, wide layout, live recipe preview */
.cx-production-batch-modal.cx-modal-detail {
  --cx-modal-width: 1320px;
  --cx-modal-max-height: min(90vh, 920px);
}
.cx-production-batch-modal .cx-modal-body { overflow: auto; }
.cx-production-modal-layout {
  display: grid;
  grid-template-columns: minmax(360px, .85fr) minmax(520px, 1.25fr);
  gap: var(--cx-space-5, 20px);
  align-items: start;
  min-width: 0;
}
.cx-production-modal-main,
.cx-production-modal-side { min-width: 0; }
.cx-production-form-card,
.cx-production-preview,
.cx-production-preview-empty,
.cx-production-preview-loading {
  border: 1px solid var(--cx-border, #e6e0f4);
  border-radius: var(--cx-radius-xl, 18px);
  background: color-mix(in srgb, var(--cx-surface-card, #fff) 94%, #7c3aed 6%);
  box-shadow: 0 14px 38px rgba(88, 28, 135, .08);
  padding: var(--cx-space-4, 16px);
}
.cx-production-form-card { display: grid; gap: var(--cx-space-4, 16px); }
.cx-production-preview-empty,
.cx-production-preview-loading { display: grid; gap: .4rem; color: var(--cx-muted, #6b627a); font-weight: 850; }
.cx-production-preview-empty strong { color: var(--cx-text-main, #1f1633); }
.cx-production-preview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .6rem;
  margin-block-end: var(--cx-space-4, 16px);
}
.cx-production-preview-summary b {
  display: block;
  padding: .75rem .85rem;
  border: 1px solid rgba(171,71,188,.16);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,245,255,.9));
  color: #3b0764;
  min-width: 0;
  overflow-wrap: anywhere;
}
.cx-production-preview-table .cx-table { min-width: 820px; }
.cx-production-batch-modal .inventory-suggestion-list,
.cx-production-batch-modal .cx-picker-results,
.cx-component-editor-modal .cx-picker-results {
  z-index: 1300;
}
@media (max-width: 1180px) {
  .cx-production-modal-layout { grid-template-columns: 1fr; }
  .cx-production-preview-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cx-production-preview-summary { grid-template-columns: 1fr; }
}

/* Production batch modal fit pass — no horizontal scroll, content fits the global modal shell */
.cx-production-batch-modal.cx-modal,
.cx-production-batch-modal.cx-modal-card,
.cx-production-batch-modal.cx-modal-xl,
.cx-production-batch-modal.cx-modal-detail {
  width: min(1240px, calc(100vw - 36px)) !important;
  max-width: calc(100vw - 36px) !important;
  max-height: min(92vh, 920px) !important;
  overflow: hidden !important;
}
.cx-production-batch-modal .cx-modal-body {
  display: block !important;
  padding: 18px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
.cx-production-batch-modal .cx-modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  padding: 12px 18px !important;
  background: color-mix(in srgb, var(--cx-surface, #fff) 94%, #7c3aed 6%);
  border-top: 1px solid var(--cx-border, #e6e0f4);
}
.cx-production-batch-form,
.cx-production-batch-form * {
  box-sizing: border-box;
  min-width: 0;
}
.cx-production-batch-form {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.cx-production-modal-layout {
  display: grid !important;
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.4fr) !important;
  gap: 18px !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
.cx-production-modal-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  padding: 16px;
  border: 1px solid var(--cx-border, #e6e0f4);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(250,245,255,.35));
  box-shadow: 0 14px 36px rgba(88, 28, 135, .07);
  overflow: hidden;
}
.cx-production-panel-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(109, 40, 217, .12);
}
.cx-production-panel-title strong {
  font-weight: 950;
  color: var(--cx-text-main, #1f1633);
}
.cx-production-panel-title small {
  color: var(--cx-muted, #6b627a);
  font-weight: 750;
}
.cx-production-batch-modal .cx-production-yield-card {
  grid-template-columns: 1fr !important;
  gap: 7px !important;
  padding: 12px !important;
  overflow: hidden;
}
.cx-production-batch-modal .cx-production-yield-card span,
.cx-production-batch-modal .cx-production-yield-card strong {
  overflow-wrap: anywhere;
}
.cx-production-batch-modal .cx-production-entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 12px !important;
}
.cx-production-batch-modal .cx-production-factor {
  overflow-wrap: anywhere;
}
.cx-production-preview,
.cx-production-preview-empty,
.cx-production-preview-loading {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.cx-production-preview-empty,
.cx-production-preview-loading,
.cx-production-preview-empty.is-inner {
  padding: 16px !important;
  border: 1px dashed rgba(109,40,217,.24) !important;
  border-radius: 16px;
  background: rgba(250,245,255,.55) !important;
}
.cx-production-preview-summary {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin: 0 !important;
}
.cx-production-preview-summary span {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(109,40,217,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  min-width: 0;
}
.cx-production-preview-summary small {
  color: var(--cx-muted, #6b627a);
  font-weight: 800;
}
.cx-production-preview-summary b {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--cx-primary, #5b21b6);
  overflow-wrap: anywhere;
}
.cx-production-preview-lines {
  display: grid;
  gap: 9px;
  max-height: min(46vh, 430px);
  overflow: auto;
  padding-inline-end: 2px;
}
.cx-production-preview-line {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(95px, 1fr));
  gap: 9px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(109,40,217,.12);
  border-radius: 14px;
  background: rgba(255,255,255,.86);
}
.cx-production-preview-line.has-shortage {
  border-color: rgba(245, 158, 11, .34);
  background: rgba(255, 251, 235, .78);
}
.cx-production-preview-line-name {
  display: grid;
  gap: 2px;
}
.cx-production-preview-line-name strong,
.cx-production-preview-line b {
  overflow-wrap: anywhere;
  color: var(--cx-text-main, #1f1633);
}
.cx-production-preview-line small,
.cx-production-preview-line span {
  color: var(--cx-muted, #6b627a);
  font-size: .78rem;
  font-weight: 800;
}
.cx-production-batch-modal .inventory-suggestion-list,
.cx-production-batch-modal .cx-picker-results {
  max-width: 100%;
  z-index: 1400;
}
@media (max-width: 1180px) {
  .cx-production-batch-modal.cx-modal,
  .cx-production-batch-modal.cx-modal-card,
  .cx-production-batch-modal.cx-modal-xl,
  .cx-production-batch-modal.cx-modal-detail {
    width: calc(100vw - 22px) !important;
    max-width: calc(100vw - 22px) !important;
  }
  .cx-production-modal-layout {
    grid-template-columns: 1fr !important;
  }
  .cx-production-preview-lines {
    max-height: 340px;
  }
}
@media (max-width: 760px) {
  .cx-production-batch-modal .cx-modal-body {
    padding: 12px !important;
  }
  .cx-production-batch-modal .cx-production-entry-grid,
  .cx-production-preview-summary {
    grid-template-columns: 1fr !important;
  }
  .cx-production-preview-line {
    grid-template-columns: 1fr 1fr;
  }
  .cx-production-preview-line-name {
    grid-column: 1 / -1;
  }
}

/* Production modal branch/unit fit — final: no empty preview block, full-width form when preview is unavailable */
.cx-production-batch-modal .cx-production-modal-layout.is-single {
  grid-template-columns: minmax(0, 1fr) !important;
}
.cx-production-batch-modal .cx-production-modal-side[hidden] {
  display: none !important;
}
.cx-production-batch-modal .cx-production-modal-layout.is-single .cx-production-modal-main {
  width: 100%;
  max-width: min(920px, 100%);
  margin-inline: auto;
}
.cx-production-batch-modal .cx-production-modal-layout.is-single .cx-production-entry-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
.cx-production-batch-modal .cx-input-with-suffix span[data-production-unit] {
  white-space: nowrap;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 760px) {
  .cx-production-batch-modal .cx-production-modal-layout.is-single .cx-production-entry-grid {
    grid-template-columns: 1fr !important;
  }
  .cx-production-batch-modal .cx-production-modal-layout.is-single .cx-production-modal-main {
    max-width: 100%;
  }
}


/* Production branch/default quantity pass */
.cx-production-branch-card {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(16, 185, 129, .22);
  border-radius: 14px;
  background: rgba(236, 253, 245, .72);
}
.cx-production-branch-card small,
.cx-production-branch-card span {
  color: var(--cx-muted, #6b627a);
  font-weight: 800;
}
.cx-production-branch-card strong {
  color: var(--cx-text-main, #1f1633);
  font-weight: 950;
  overflow-wrap: anywhere;
}
.cx-production-branch-card.is-warning {
  border-color: rgba(245, 158, 11, .38);
  background: rgba(255, 251, 235, .78);
}
.cx-production-batch-modal .cx-production-modal-layout.is-single .cx-production-modal-main {
  max-width: min(920px, 100%) !important;
}
.cx-production-batch-modal .cx-production-modal-layout.is-single .cx-production-yield-card {
  grid-template-columns: 1fr 1fr !important;
}
@media (max-width: 760px) {
  .cx-production-batch-modal .cx-production-modal-layout.is-single .cx-production-yield-card {
    grid-template-columns: 1fr !important;
  }
}
