/* Shared visual contract, loaded after module layouts. */
body.erp-ui {
  --bg: #f3f5f0;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #dce3d7;
  --shade: #edf1e8;
  --control-bg: #ffffff;
  --control-text: #0f172a;
  --control-border: #cbd5e1;
  --control-hover: #899e86;
  --label: #334155;
  --table-head: #e9eee4;
  --table-label: #475569;
  --positive: #047857;
  --address-bg: #fff7e5;
  --address-text: #854d0e;
  --address-border: #e5d2a8;
  font-size: 15px;
  line-height: 1.5;
}
body.erp-ui.dark {
  color-scheme: dark;
  --bg: #101510;
  --surface: #19211b;
  --text: #edf2e9;
  --muted: #a7b4a4;
  --line: #344438;
  --shade: #243026;
  --control-bg: #111a13;
  --control-text: #f1f5f9;
  --control-border: #4a5f4d;
  --control-hover: #899e86;
  --label: #c7d4c2;
  --table-head: #243126;
  --table-label: #c7d4c2;
  --positive: #34d399;
  --address-bg: #253329;
  --address-text: #fbbf24;
  --address-border: #4a5f4d;
}
.erp-ui.workbench-page {
  --wb-label: var(--label);
  --wb-border: var(--control-border);
  --wb-hover-border: var(--control-hover);
  --wb-focus: #10b981;
  --wb-focus-ring: #10b98133;
  --wb-heading: var(--text);
  --wb-soft-text: var(--muted);
  --wb-thead: var(--table-head);
}
.erp-ui .main { background: var(--bg); min-width: 0; }
.erp-ui :is(.panel,.metric,.modal,.os-card,.client-card,.ib-metric) {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 2px 5px #0206170a;
}
.erp-ui.dark .main :is(.panel,.metric,.os-card,.client-card,.ib-metric,.column,.ib-queue button,.ib-abc>div),
.erp-ui.dark .modal { background: var(--surface); border-color: var(--line); box-shadow: 0 2px 8px #00000026; }
.erp-ui :is(.topbar,.toolbar,.wb-tabs,.modal-head,.modal-footer) { background: var(--surface); border-color: var(--line); }
.erp-ui :is(.main,.modal) :is(.input,.wb-table input,.wb-table select,textarea) {
  background: var(--control-bg);
  color: var(--control-text);
  border: 1px solid var(--control-border);
  border-radius: 7px;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 1px 2px #0206170d;
}
.erp-ui :is(.main,.modal) :is(.input,.wb-table input,.wb-table select,textarea):hover { border-color: var(--control-hover); }
.erp-ui :is(.main,.modal) :is(.input,.wb-table input,.wb-table select,textarea):focus {
  background: var(--control-bg);
  border-color: #10b981;
  outline: 2px solid #10b981;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px #10b98122;
}
.erp-ui :is(input,textarea)::placeholder { color: #64748b; opacity: 1; font-size: 14px; font-weight: 400; }
.erp-ui :is(.main,.modal) :is(input,select,textarea):disabled {
  background: var(--shade); color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1; cursor: not-allowed;
}
.erp-ui :is(select option,select optgroup) { background: var(--control-bg); color: var(--control-text); }
.erp-ui :is(.field label,.ib-label,.wb-note-field label,.wb-money-line label) {
  color: var(--label); font-size: 14px; font-weight: 650; line-height: 1.5; margin-bottom: 6px;
}
.erp-ui .wb-meta .field label { text-transform: uppercase; letter-spacing: .65px; }
.erp-ui :is(.btn,.icon-btn,.text-btn,.tabs button,.wb-tabs button,.wb-back,.wb-quick-btn,.wb-row-remove,.search-trigger,.nav button) {
  min-height: 44px;
}
.erp-ui .icon-btn,.erp-ui .wb-row-remove { min-width: 44px; }
.erp-ui .btn { font-size: 14px; font-weight: 650; padding: 10px 16px; border-color: var(--control-border); }
.erp-ui .text-btn { font-size: 14px; font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }
.erp-ui .tabs button { font-size: 14px; font-weight: 600; padding: 9px 14px; }
.erp-ui .nav button { font-size: 14px; }
.erp-ui .nav-label { font-size: 11px; font-weight: 700; }
.erp-ui .breadcrumb { font-size: 13px; }
.erp-ui :is(table th,.wb-table th,.ib-page table th) {
  background: var(--table-head);
  color: var(--table-label);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .8px;
  line-height: 1.5;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.erp-ui :is(table td,.wb-table td,.ib-page table td) {
  color: var(--text); font-size: 16px; padding: 14px 16px; border-bottom-color: var(--line); line-height: 1.5;
}
.erp-ui :is(table td strong,.wb-part-name,.alert-text strong) { font-size: 16px; font-weight: 750; color: var(--text); }
.erp-ui :is(table td small,.wb-part-table small,.alert-text small,.stock-small small,.scan-result small) {
  color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: .25px; line-height: 1.6;
}
.erp-ui table tbody tr:hover small { color: var(--label); }
.erp-ui table tbody tr:hover { background: var(--shade); }
.erp-ui :is(.stock-location,.wb-stock-location) {
  display: inline-block;
  background: var(--address-bg);
  color: var(--address-text);
  border: 1px solid var(--address-border);
  border-radius: 6px;
  font: 700 14px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;
  padding: 5px 10px;
  margin-top: 5px;
  box-shadow: inset 0 1px 3px #0206171a;
  white-space: nowrap;
}
.erp-ui .inventory-price { font-size: 16px; font-weight: 750; font-variant-numeric: tabular-nums; }
.erp-ui .metric-label { color: var(--muted); font-size: 14px; font-weight: 650; text-transform: uppercase; letter-spacing: .6px; line-height: 1.5; }
.erp-ui .metric-value { color: var(--text); font-size: 30px; font-weight: 900; line-height: 1.3; font-variant-numeric: tabular-nums; margin-top: 12px; }
.erp-ui :is(.metric-foot,.table-footer,.table-total,.fin-total-line,.panel-head p,.wb-section-head p,.fin-hint,.ib-footnote,.wb-tip,.wb-categorybar>span) { font-size: 13px; line-height: 1.6; }
.erp-ui :is(.panel-head h2,.wb-section-head h2) { color: var(--text); font-size: 19px; font-weight: 750; }
.erp-ui .pill { font-size: 13px; font-weight: 650; line-height: 1.4; padding: 5px 9px; }
.erp-ui .wb-table .wb-line-total { color: var(--positive); font-size: 18px; font-weight: 750; }
.erp-ui .wb-table .wb-service-description { font-size: 16px; font-weight: 700; }
.erp-ui .wb-table .wb-service-type { color: var(--control-text); font-size: 14px; }
.erp-ui .wb-part-table td:first-child>strong { display: block; letter-spacing: .5px; }
.erp-ui .wb-meta small { font-size: 13px; color: var(--muted); }
.erp-ui .wb-table-footer strong { color: var(--text); }
.erp-ui.dark .btn { color: var(--text); background: var(--surface); border-color: var(--control-border); }
.erp-ui.dark .btn:hover { background: var(--shade); border-color: var(--control-hover); }
.erp-ui.dark :is(.btn.primary,.btn.lime) { background: #a3e635; color: #14200b; border-color: #a3e635; }
.erp-ui.dark :is(.btn.primary,.btn.lime):hover { background: #bef264; }
.erp-ui.dark :is(.tabs,.wb-categorybar .tabs) { background: var(--shade); border-color: var(--line); }
.erp-ui.dark .tabs button { color: var(--muted); background: transparent; }
.erp-ui.dark .tabs button.active { background: #334155; color: #f8fafc; }
.erp-ui.dark :is(.text-btn,.wb-quick-btn,.wb-part-actions .text-btn) { color: #6ee7b7; }
.erp-ui.dark :is(.panel-bottom,.wb-tip,.wb-summary-checks,.detail-meta,.fin-drawer-meta,.fin-bank-info,.fin-toolbar,.fin-integration,.fin-ledger-item,.ib-flow span) { background: var(--shade); color: var(--label); border-color: var(--line); }
.erp-ui.dark .wb-context { background: #302819; color: #fde68a; border-color: #76562c; border-left-color: #f59e0b; }
.erp-ui.dark .wb-context svg { color: #fbbf24; }
.erp-ui.dark .pill.green { background: #10382d; color: #6ee7b7; }
.erp-ui.dark .pill.amber { background: #3b2c15; color: #fcd34d; }
.erp-ui.dark .pill.red { background: #431c2b; color: #fda4af; }
.erp-ui.dark .pill.blue { background: #1c3154; color: #bfdbfe; }
.erp-ui.dark .pill.gray { background: #283548; color: #cbd5e1; }
.erp-ui.dark .ib-page { --ib-text: var(--text); --ib-bg: var(--surface); }
.erp-ui.dark .ib-page :is(p,small,.ib-label) { color: var(--muted); }
.erp-ui.dark :is(.ib-notice,.notice) { background: #302819; color: #fde68a; border-color: #b7791f; }
.erp-ui.dark :is(.ib-cost,.ib-list,.ib-abc>div,.ib-queue button,.fin-dre-row) { border-color: var(--line); }
.erp-ui.dark :is(.ib-class,.ib-steps b) { background: #253a24; color: #bef264; }
.erp-ui.dark .ib-class.B { background: #213353; color: #bfdbfe; }
.erp-ui.dark .ib-class.C { background: #3b3023; color: #fcd34d; }
.erp-ui.dark .fin-drawer .fin-payment-head strong { color: #f8fafc; }
.erp-ui.dark .search-trigger { background: var(--control-bg); border-color: var(--control-border); color: var(--label); }
.erp-ui :is(.toolbar,.fin-toolbar,.panel-head) { flex-wrap: wrap; gap: 16px; }
.erp-ui .toolbar>.input { min-width: 250px; flex: 1 1 290px; }
.erp-ui.inventory-page #inventory-content table { min-width: 1080px; }
.erp-ui.inventory-page .metric { min-width: 0; }
.erp-ui button { min-height: 44px; }
.erp-ui .sub { color: var(--muted); font-size: 15px; line-height: 1.6; }
.erp-ui :is(.fin-metric .label,.fiscal-stat>span,.ib-metric>span) { color: var(--muted); font-size: 14px; font-weight: 650; letter-spacing: .5px; }
.erp-ui :is(.fin-metric small,.fiscal-stat small,.fin-account span small,.fin-bill-meta small,.fin-ledger-item small,.fin-payment-head small,.fiscal-review-meta small,.fiscal-doc-header small,.fin-related) { color: var(--muted); font-size: 13px; font-weight: 600; }
.erp-ui :is(.fin-drawer-meta,.fin-bank-info,.fin-ledger-item,.fin-period,.fin-beta,.fin-integration,.fiscal-env,.fiscal-review-meta,.fiscal-review-confirm,.fiscal-config-panel>p,.fiscal-check p,.fiscal-check strong,.fiscal-note,.fiscal-locked,.fiscal-pending) { font-size: 14px; line-height: 1.6; }
.erp-ui .stockbar { background: var(--line); height: 5px; }

.erp-ui.dark.inventory-page .toolbar>.input { background: var(--control-bg); }
.erp-ui.dark .metric-foot b { color: #bef264; background: #283c21; }
.erp-ui.dark .fin-metric.highlight { background: #152d27; border-color: #315849; }
.erp-ui.dark .fin-metric.highlight .value { color: #6ee7b7; }
.erp-ui.dark :is(.fiscal-env,.fin-methods button.active) { background: #18332b; border-color: #315849; color: #a7f3d0; }
.erp-ui.dark :is(.fiscal-pending,.fiscal-locked) { background: #302819; color: #fde68a; }
.erp-ui.dark :is(.fiscal-review-confirm,.fiscal-source,.fin-dre small,.fin-hint) { color: var(--label); }
/* The document sheet keeps its paper palette in either application theme. */
.erp-ui .fiscal-paper { background: #fff; color: #243026; color-scheme: light; }
.erp-ui .fiscal-paper :is(th,td) { color: #243026; border-color: #d8ddd2; }
.erp-ui .fiscal-paper th { background: #f3f5ee; }
.erp-ui .fiscal-paper td strong { color: #243026; }
.erp-ui .fiscal-paper tbody tr:hover { background: #f3f5ee; }
@media(max-width:767px) {
  .erp-ui :is(.main,.modal) :is(.input,.wb-table input,.wb-table select,textarea),
  .erp-ui :is(table td,.wb-table td,.ib-page table td) { font-size: 14px; }
  .erp-ui :is(table td small,.wb-part-table small,.alert-text small,.stock-small small,.scan-result small) { font-size: 12px; }
  .erp-ui :is(.stock-location,.wb-stock-location) { font-size: 12px; }
  .erp-ui .metric-value { font-size: 26px; }
  .erp-ui .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .erp-ui .toolbar>.input { min-width: 0; width: 100%; }
}

.erp-ui .stock-minimum { color: var(--muted); font-size: 14px; font-weight: 500; }
.erp-ui .modal-body p { font-size: 14px; line-height: 1.6; color: var(--muted); }
.erp-ui .modal-body p strong { color: var(--text); font-size: 16px; }
.erp-ui :is(.fin-tabs button,.fiscal-tabs button,.fin-methods button) { font-size: 14px; font-weight: 600; }
.erp-ui :is(.fin-chart text,.fin-legend,.fin-chart-foot,.fiscal-stage>span) { font-size: 12px; }
.erp-ui .fin-account>span { font-size: 15px; }
/* Keep part identity visible while wide inventory tables scroll. */
.erp-ui.inventory-page #inventory-content :is(th,td):first-child {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  min-width: 260px; max-width: 320px; white-space: normal;
  box-shadow: 1px 0 var(--line);
}
.erp-ui.inventory-page #inventory-content th:first-child { background: var(--table-head); z-index: 2; }
.erp-ui.inventory-page #inventory-content tr:hover td:first-child { background: var(--shade); }
.erp-ui .ib-metric small { color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.6; }
