/* Stage 18.12.46 — Legibility & responsive safeguards.
   Preserve dark hero/scanner areas, print layouts and data semantics.
   This stylesheet is loaded last; visual acceptance on authenticated pages still required. */
:root { --b46-ink:#202b38;--b46-muted:#475569;--b46-line:#cbd5e1;--b46-focus:#176c9a; }
body.erp-body { text-rendering:optimizeLegibility; }
body.erp-body :is(.main-shell,.page-content,.shell-context-bar,.topbar-start,.topbar-actions) {min-width:0;}
body.erp-body .page-content { max-width:100%; }
/* Common light operational surfaces: no forced light theme on dark hero widgets. */
body.erp-body .page-content :is(.content-card:not(.scan-command-hero):not(.hero-card):not([class*="dark"]),.form-card,.table-card,.table-wrap,.data-table-wrap,.inventory-entry-row,.quality-form-card,.hr-form-card,.analytics-filter) {min-width:0;}
body.erp-body .page-content :is(.content-card:not(.scan-command-hero):not(.hero-card):not([class*="dark"]),.form-card,.table-card,.table-wrap,.inventory-entry-row) :is(.muted,.eyebrow,.field-help,.form-help,.helptext,.help-text,.hint,.helper-text) {
 color:var(--b46-muted);font-size:max(.9rem,14px);line-height:1.8;
}
body.erp-body .page-content :is(.form-field,.field-wrap,.field-row,.scan-field,.cut-ws-fields) :is(label,small) {font-size:max(.9rem,14px);line-height:1.65;}
body.erp-body .page-content :is(.form-field,.field-wrap,.field-row) > label {font-weight:650;color:var(--b46-ink);}
body.erp-body .page-content :is(.content-card:not(.scan-command-hero):not(.hero-card):not([class*="dark"]),.form-card,.table-card,.table-wrap,.data-table-wrap) :is(.data-table,.detail-dl,.data-list,.info-grid) {color:var(--b46-ink);}
body.erp-body .page-content :is(.content-card,.table-card,.table-wrap,.data-table-wrap,.inventory-entry-row) :is(.data-table td,.data-table th,.table td,.table th) {font-size:max(.875rem,14px);line-height:1.7;vertical-align:middle;}
body.erp-body .page-content :is(.content-card,.table-card,.table-wrap,.data-table-wrap) :is(.data-table small,.data-table .muted,.data-list small,.detail-dl dt,.info-grid small,.info-grid span) {font-size:max(.87rem,13px);line-height:1.7;}
body.erp-body .page-content :is(.data-table th,.table th) {font-weight:700;}
body.erp-body .page-content :is(.data-table-wrap,.table-wrap,.table-scroll,.table-responsive,.stage1840-sales-progress) {max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;scrollbar-width:thin;}
body.erp-body .page-content :is(.content-card,.form-card,.table-card,.data-table-wrap) :is(h2,h3,h4) {line-height:1.5;overflow-wrap:anywhere;}
body.erp-body .page-content :is(.form-grid,.quality-form-grid,.inventory-entry-fields,.filter-bar,.filter-grid,.card-grid,.dashboard-grid)>* {min-width:0;}
body.erp-body .page-content :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea) {max-width:100%;min-width:0;}
body.erp-body .page-content :is(input,select,textarea)::placeholder {color:#596779;opacity:1;}
body.erp-body .page-content :is(.form-field,.field-wrap) :is(.field-error,.errorlist) {color:#9a2533;font-size:max(.9rem,14px);line-height:1.7;}
body.erp-body .page-content :is(.form-field,.field-wrap,.field-row) :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea):not(:disabled) {min-height:42px;}
body.erp-body .page-content :is(a,button,input,select,textarea,summary):focus-visible,
body.login-body :is(a,button,input,select,textarea):focus-visible {outline:3px solid var(--b46-focus);outline-offset:2px;}
/* Important: disabled fields remain visually distinguishable from editable fields. */
body.erp-body .page-content :is(input,select,textarea):disabled {cursor:not-allowed;}
/* Extra-small operational text is especially harmful on scanner/cutting/traceability pages. */
body.erp-body .page-content :is(.cut-ws,.scan-command-hero,.scan-form18-6,.trace-live-metrics,.scanner-readiness,.quality-detail-layout) :is(small,label,.eyebrow,.cut-ws-hint,.scan-field>span,.scan-field>small,.scanner-readiness span,.scanner-readiness b) {font-size:max(.9rem,14px);line-height:1.7;}
body.erp-body .page-content :is(.cut-ws,.scan-form18-6,.quality-form-card) :is(input,select,textarea) {font-size:max(.933rem,14px);}
body.erp-body .page-content .cut-ws-steps span {font-size:max(.9rem,14px);min-width:0;}
body.erp-body .page-content :is(.filter-bar,.page-toolbar,.form-actions,.inventory-create-actions) {min-width:0;max-width:100%;flex-wrap:wrap;row-gap:10px;}
body.erp-body .page-content :is(.filter-bar,.page-toolbar) :is(.search-field,input,select) {max-width:100%;}
/* Compact topbar keeps live purchasing count in document flow. */
body.erp-body .topbar {background:#fff;backdrop-filter:none;-webkit-backdrop-filter:none;}
body.erp-body .topbar-start {flex:1 1 auto;min-width:0;}
body.erp-body .topbar-actions {flex:0 1 auto;min-width:0;}
body.erp-body .topbar .stage1840-purchase-chip {position:static;z-index:auto;max-width:170px;}
body.erp-body .topbar-heading {min-width:0;}
body.erp-body .topbar-title {text-overflow:ellipsis;overflow:hidden;white-space:nowrap;}
/* Sign-in is a separate template and needs its own readable labels. */
body.login-body .login-form :is(p,label,small) {line-height:1.8;}
body.login-body .login-form label {font-size:max(.95rem,14px);}
body.login-body .login-form :is(input,button) {min-height:44px;max-width:100%;}
body.login-body .login-form input::placeholder {color:#596779;opacity:1;}
@media(max-width:1100px) {
  body.erp-body .topbar {gap:10px;padding-inline:14px;}
  body.erp-body .topbar .stage1840-purchase-chip-text {display:none;}
  body.erp-body .topbar-actions {gap:7px;}
  body.erp-body .user-copy {max-width:115px;overflow:hidden;}
}
@media(max-width:760px) {
  body.erp-body .page-content :is(.filter-bar,.page-toolbar,.form-actions) {gap:10px;}
  body.erp-body .page-content :is(.filter-bar,.form-grid,.quality-form-grid,.inventory-entry-fields) {max-width:100%;}
  body.erp-body .page-content :is(.content-card,.table-card,.form-card,.inventory-entry-row) {max-width:100%;}
  body.erp-body .page-content :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea) {font-size:16px;}
  body.erp-body .topbar {overflow:visible;}
  body.erp-body .topbar-heading {max-width:100%;}
}
@media(max-width:480px) {
  body.erp-body .page-content :is(.form-grid,.quality-form-grid,.filter-grid,.cut-ws-fields) {grid-template-columns:minmax(0,1fr);}
  body.erp-body .page-content :is(.page-toolbar,.filter-bar,.form-actions) :is(.button,button[type="submit"]) {min-height:42px;}
  body.erp-body .topbar-actions {gap:5px;}
  body.erp-body .topbar .stage1840-purchase-chip {padding:5px;min-width:32px;}
  body.erp-body .topbar-title {font-size:clamp(13px,3.7vw,17px);}
  body.erp-body .page-content :is(.data-table-wrap,.table-wrap,.table-scroll) {margin-inline:0;}
}
@media print {
  body.erp-body .page-content :is(.data-table-wrap,.table-wrap,.table-scroll) {overflow:visible;}
  body.erp-body .topbar {position:static;}
}
