:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #687482;
  --line: #dfe5eb;
  --surface: #ffffff;
  --background: #f3f6f8;
  --accent: #245b48;
  --accent-soft: #e7f2ed;
  --danger: #a61b1b;
  --warning: #8a5b00;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--background); color: var(--ink); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding: 18px 14px 22px; background: var(--surface); border-right: 1px solid var(--line); z-index: 30; }
.sidebar .brand { display: block; padding: 8px 12px 18px; margin-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 20px; }
.app-main { min-width: 0; }
.topbar { min-height: 68px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; position: sticky; top: 0; z-index: 20; }
.guest-topbar { justify-content: space-between; }
.brand { font-weight: 750; letter-spacing: .02em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.main-nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; width: 100%; }
.main-nav a { display: block; width: 100%; color: var(--ink); text-decoration: none; padding: 11px 12px; border-radius: 9px; border-left: 3px solid transparent; white-space: normal; overflow-wrap: anywhere; line-height: 1.35; font-weight: 650; }
.main-nav a:hover, .main-nav a:focus-visible { background: var(--accent-soft); color: var(--accent); border-left-color: var(--accent); outline: none; }
.global-search-form { flex: 1 1 360px; max-width: 640px; min-width: 220px; }
.global-search-form input { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #fff; }
.top-actions, .language-form { display: flex; align-items: center; gap: 8px; }
.top-actions form { margin: 0; }
.language-form .language-choice[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.user-name { color: var(--muted); white-space: nowrap; }
button, .button-link { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 8px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button-link:hover { border-color: var(--accent); }
button.primary, .button-link:not(.secondary) { background: var(--accent); color: white; border-color: var(--accent); }
.button-link.secondary { background: var(--surface); color: var(--ink); }
.page { width: min(1400px, calc(100% - 36px)); margin: 32px auto 60px; }
.hero { margin-bottom: 26px; }
.compact-hero { margin-bottom: 20px; }
.hero h1, .page-heading h1 { margin: 6px 0 8px; font-size: clamp(27px, 3vw, 40px); }
.hero p, .page-heading p { color: var(--muted); margin: 6px 0; }
.eyebrow { color: var(--accent); font-weight: 750; letter-spacing: .12em; font-size: 12px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.grid, .module-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.module-grid { margin: 20px 0; }
.card, .auth-card, .module-card, .metric { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 8px 28px rgba(23, 35, 46, .045); }
.module-card { text-decoration: none; color: var(--ink); transition: transform .12s ease, border-color .12s ease; }
.module-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.module-card h2 { margin: 0 0 8px; font-size: 20px; }
.module-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.admin-card { border-style: dashed; }
.auth-card { width: min(440px, 100%); margin: 72px auto; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 18px 0; }
.webshop-vat-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.webshop-vat-metrics .metric { min-width: 0; }
.webshop-vat-metrics .metric strong { font-size: clamp(20px, 2vw, 30px); overflow-wrap: anywhere; }
@media (max-width: 1100px) { .webshop-vat-metrics { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); } }
.metric { padding: 18px; display: grid; gap: 4px; }
.metric span, .metric small { color: var(--muted); }
.metric strong { font-size: 30px; }
.access-card { margin-top: 20px; }
.stack-form, .form-card { display: grid; gap: 14px; }
.form-card { max-width: 900px; }
.wide-form { max-width: none; }
.form-grid p { margin: 0 0 13px; display: grid; gap: 6px; }
.form-grid label { font-weight: 650; }
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea, .line-table input, .line-table select, .search-bar input, .detail-grid input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: white; }
.form-grid select[multiple] { min-height: 130px; }
.form-grid ul { list-style: none; padding: 0; margin: 0; }
.form-grid ul label { font-weight: 400; }
.form-grid .helptext { color: var(--muted); font-size: 13px; }
.form-grid .errorlist, .line-table .errorlist { color: var(--danger); margin: 0; padding-left: 18px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.search-bar { display: flex; gap: 8px; margin: 16px 0; max-width: 760px; }
.search-bar input { flex: 1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 13px; color: var(--muted); background: #fafbfc; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfc; }
.line-table { min-width: 980px; }
.line-table td:nth-child(1), .line-table td:nth-child(2) { min-width: 230px; }
.line-table td:nth-child(3), .line-table td:nth-child(4) { width: 110px; }
.muted { color: var(--muted); }
.alert, .message { padding: 11px 13px; margin: 10px 0; border-radius: 8px; background: #eef4f1; border: 1px solid #c8ddd4; }
.message.error { background: #fff1f0; border-color: #ffc9c5; color: var(--danger); }
.message.warning { background: #fff8e8; border-color: #ecd49e; color: var(--warning); }
.badge, .tag, .status { display: inline-block; border-radius: 999px; background: var(--accent-soft); color: var(--accent); padding: 5px 9px; font-size: 12px; }
.tag { margin: 2px 3px 2px 0; }
.status-draft { background: #edf0f3; color: #4d5a66; }
.status-dispatched { background: #fff4d6; color: #765100; }
.status-posted, .status-received { background: #e7f2ed; color: var(--accent); }
.status-cancelled { background: #f8e5e5; color: var(--danger); }
.compact-list { padding-left: 20px; }
.compact-list li { margin: 7px 0; }
.detail-list { display: grid; grid-template-columns: minmax(130px, 180px) 1fr; gap: 10px 14px; margin: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; }
.danger-text { color: var(--danger); font-weight: 650; }
@media (min-width: 900px) { .two-column { columns: 2; column-gap: 28px; } .two-column p { break-inside: avoid; } }
@media (max-width: 980px) { .app-shell { display: block; } .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); } .sidebar .brand { margin-bottom: 10px; } .topbar { position: static; flex-wrap: wrap; } .global-search-form { flex-basis: 100%; max-width: none; } }
@media (max-width: 640px) { .page { width: min(100% - 20px, 1400px); margin-top: 20px; } .topbar { align-items: flex-start; padding: 12px 14px; } .top-actions, .language-form { flex-wrap: wrap; } .company-context-form { width: 100%; } .page-heading { flex-direction: column; } .search-bar { flex-direction: column; } }

/* v0.7 structured filters and versioned product forms */
.filter-bar { display: flex; flex-wrap: wrap; gap: .65rem; align-items: end; margin: 1rem 0; padding: .85rem; background: var(--card, #fff); border: 1px solid var(--border, #ddd); border-radius: 10px; }
.filter-bar input, .filter-bar select { min-width: 150px; max-width: 260px; }
.filter-bar label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; }
.notice { margin: .8rem 0 1rem; padding: .8rem 1rem; border: 1px solid #c8d3e0; border-radius: 8px; background: #f6f9fc; }
.notice.warning, .validation-panel { border-color: #e4b65c; background: #fff8e8; }
.validation-panel { padding: .8rem 1rem; border: 1px solid #e4b65c; border-radius: 8px; }
.validation-panel ul { margin: .5rem 0 0 1.2rem; }
.button-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.dimension-group { display: flex; gap: .25rem; min-width: 260px; }
.dimension-group input { width: 75px; }
.line-table input[type="number"] { width: 95px; }
.line-table select { min-width: 150px; }

/* v0.8 product categories, packaging and compliance */
.product-master-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.product-master-grid .full-span { grid-column: 1 / -1; }
.checkbox-panel { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 13px; }
.checkbox-grid { display: grid !important; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 14px; margin-top: 8px !important; }
.checkbox-grid li { margin: 0; }
.category-indent { display: inline-block; }
.category-indent.depth-1 { padding-left: 24px; }
.category-indent.depth-2 { padding-left: 48px; }
.button-link.small { padding: 6px 9px; font-size: 12px; }
.advanced-section { margin-top: 24px; border: 1px solid var(--line); border-radius: 12px; padding: 0 18px 18px; background: #fbfcfd; }
.advanced-section summary { cursor: pointer; font-weight: 700; padding: 16px 0; }
.packaging-table { min-width: 1500px; }
.cbm-output { display: inline-block; min-width: 78px; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .product-master-grid { grid-template-columns: 1fr; } .product-master-grid .full-span { grid-column: auto; } }

/* v0.8.1 controlled packaging dictionary and visible validation */
.error-summary { margin: 0 0 18px; padding: 16px 18px; border: 2px solid #c83434; border-radius: 10px; background: #fff2f2; color: #721c1c; }
.error-summary h2 { margin: 0 0 6px; font-size: 20px; }
.error-summary p { margin: 4px 0; }
.error-summary ul { margin: 10px 0 0 20px; }
.error-summary a { color: inherit; }
.required-mark { color: var(--danger); font-weight: 800; }
.required-note { color: var(--muted); font-size: 13px; margin: 0; }
.required-field > label::after, .required-field > strong::after { content: " *"; color: var(--danger); font-weight: 800; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], .errorlist + input, .errorlist + select { border-color: var(--danger) !important; box-shadow: 0 0 0 2px rgba(166, 27, 27, .08); }
.containment-example { display: block; min-width: 190px; margin-top: 5px; color: var(--muted); line-height: 1.35; }
input[readonly] { background: #f0f3f5 !important; color: #46525d; }
.danger-button { background: #a61b1b !important; border-color: #a61b1b !important; color: #fff !important; }
.material-table { min-width: 1050px; }

/* v0.9 unified PI/CI/PL workspace and A4 PDF configuration */
.document-line-table { min-width: 1900px; }
.document-line-table td { min-width: 92px; }
.document-line-table td:nth-child(2), .document-line-table td:nth-child(3) { min-width: 210px; }
.document-line-table td:nth-child(4) { min-width: 260px; }
.document-total { text-align: right; font-size: 18px; margin: 18px 4px 4px; }
.issue-panel { border-color: #c5d9cf; background: #f8fcfa; }
.issue-panel form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.issue-panel label { display: grid; gap: 5px; flex: 1; min-width: 280px; }
.issue-panel input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; }
.status-issued { background: #e7f2ed; color: var(--accent); }
.status-superseded { background: #fff4d6; color: #765100; }

/* v0.10 business centers, workflow navigation and global search */
.global-search-form { flex: 0 1 320px; }
.global-search-form input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin: -8px 0 18px; color: var(--muted); font-size: 13px; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.center-grid .module-card { min-height: 145px; }
.search-results { display: grid; gap: 10px; }
.search-result { display: grid; grid-template-columns: max-content minmax(180px, 1fr) minmax(160px, 2fr); gap: 12px; align-items: center; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.search-result:hover { border-color: var(--accent); }
.search-result small { color: var(--muted); }
.stack-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.allocation-row td { background: #fafbfc; font-size: 12px; }
.status-confirmed { background: #e8eef8; color: #2c4c79; }
.status-ready { background: #fff4d6; color: #765100; }
.status-docs_issued { background: #e7f2ed; color: var(--accent); }
@media (max-width: 1100px) { .global-search-form { order: 4; flex-basis: 100%; } }
@media (max-width: 720px) { .search-result { grid-template-columns: 1fr; } }

/* v0.10.2: compact PI multi-select and commercial-line packing controls */
.pi-selector-tools { display:flex; gap:1rem; align-items:end; justify-content:space-between; margin-bottom:1rem; }
.pi-selector-tools label { flex:1; max-width:36rem; }
.pi-selector-tools input { width:100%; }
.pi-choice-list { display:grid; gap:.65rem; max-height:34rem; overflow:auto; padding:.15rem; }
.pi-choice { display:flex; gap:.8rem; align-items:flex-start; border:1px solid #d8dde5; border-radius:.55rem; padding:.8rem; cursor:pointer; background:#fff; }
.pi-choice:hover { border-color:#8894a6; }
.pi-choice:has(input:checked) { border-color:#39465a; box-shadow:0 0 0 1px #39465a inset; }
.pi-choice.is-incompatible { opacity:.56; cursor:not-allowed; background:#f5f6f8; }
.pi-choice input { margin-top:.25rem; }
.pi-choice-main { display:grid; gap:.18rem; min-width:0; }
.pi-choice-main small { color:#667085; }
.pi-incompatibility { color:#a12622 !important; }
.carton-cell { min-width:11rem; max-width:15rem; }
.compact-label { display:block; margin-top:.45rem; font-size:.78rem; color:#475467; }
.compact-label input { display:block; width:100%; margin-top:.18rem; }
.carton-warning { color:#9a5a00; font-weight:600; }
.packing-adjustment { margin-top:.35rem; }
.packing-adjustment > summary { cursor:pointer; color:var(--accent); font-weight:650; font-size:11.5px; white-space:nowrap; }
.packing-adjustment-fields { margin-top:.35rem; padding-top:.2rem; border-top:1px dashed var(--line); }
.sales-lines-table textarea { min-width:16rem; }

/* v0.10.3 dense desktop workspace */
body { font-size: 13px; }
.page { width: min(100% - 28px, 1560px); margin-top: 18px; }
h1 { font-size: 24px; } h2 { font-size: 17px; } h3 { font-size: 14px; }
.card { padding: 14px 16px; margin-bottom: 14px; }
.form-grid p { margin-bottom: 8px; gap: 4px; }
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea, .line-table input, .line-table select, .search-bar input, .detail-grid input { padding: 7px 8px; border-radius: 6px; font-size: 13px; }
button, .button-link { padding: 7px 10px; font-size: 13px; }
th, td { padding: 7px 9px; font-size: 12px; line-height: 1.35; }
th { font-size: 11.5px; }
.compact-table { min-width: 680px; }
.compact-table th, .compact-table td { padding: 6px 8px; }
.packaging-table { min-width: 1320px; }
.document-line-table { min-width: 1500px; }
.sales-lines-table textarea { min-width: 230px; min-height: 56px; font-size: 12px; }
.locked-options, .checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 8px 14px; }
.locked-options label, .checkbox-grid label { font-weight: 500; }
.pi-choice-table { max-height: 420px; overflow-y: auto; }
.pi-choice.is-incompatible { opacity: .55; }
.pi-incompatibility { display:block; color:#a12622; margin-top:2px; }
.level-display { white-space: nowrap; font-weight: 700; }

/* v0.10.3.1 Sales Confirmation usability hotfix */
.stacked-fields { display: grid; gap: 8px; }
.stacked-fields p { margin: 0; }
.danger-link { border: 0; background: transparent; color: #a61b1b; padding: 4px 6px; cursor: pointer; font: inherit; text-decoration: underline; }
.danger-link:hover { color: #760f0f; }
.sales-line[hidden] { display: none !important; }

.delete-control { display: none; }


/* v0.10.3.2 PI detail width and readability */
.pi-detail-lines { width: 100%; min-width: 1280px; table-layout: fixed; }
.pi-detail-lines .col-no { width: 42px; }
.pi-detail-lines .col-sku { width: 118px; }
.pi-detail-lines .col-model { width: 125px; }
.pi-detail-lines .col-name { width: 220px; }
.pi-detail-lines .col-description { width: 320px; }
.pi-detail-lines .col-quantity { width: 110px; }
.pi-detail-lines .col-cartons { width: 105px; }
.pi-detail-lines .col-unit-price { width: 125px; }
.pi-detail-lines .col-amount { width: 135px; }
.pi-detail-lines .col-remaining { width: 110px; }
.pi-detail-lines td { vertical-align: top; overflow-wrap: anywhere; }
.pi-detail-lines .description-cell { max-width: 320px; white-space: normal; }

/* v0.10.3.3 PI automatic packing metrics */
.sales-lines-table { min-width: 1420px; }
.sales-lines-table th:nth-child(1), .sales-lines-table td:nth-child(1) { min-width:42px; width:42px; }
.sales-lines-table th:nth-child(2), .sales-lines-table td:nth-child(2) { min-width:180px; }
.sales-lines-table th:nth-child(3), .sales-lines-table td:nth-child(3) { min-width:170px; width:auto; }
.sales-lines-table th:nth-child(4), .sales-lines-table td:nth-child(4) { min-width:230px; width:auto; }
.sales-lines-table th:nth-child(5), .sales-lines-table td:nth-child(5) { min-width:86px; width:86px; }
.sales-lines-table th:nth-child(6), .sales-lines-table td:nth-child(6) { min-width:92px; width:92px; }
.sales-lines-table th:nth-child(7), .sales-lines-table td:nth-child(7),
.sales-lines-table th:nth-child(8), .sales-lines-table td:nth-child(8) { min-width:96px; width:96px; }
.sales-lines-table th:nth-child(9), .sales-lines-table td:nth-child(9) { min-width:150px; width:150px; }
.sales-lines-table th:nth-child(10), .sales-lines-table td:nth-child(10),
.sales-lines-table th:nth-child(11), .sales-lines-table td:nth-child(11),
.sales-lines-table th:nth-child(12), .sales-lines-table td:nth-child(12) { min-width:88px; width:88px; }
.sales-lines-table input[name$="-package_count"],
.sales-lines-table input[name$="-net_weight_kg"],
.sales-lines-table input[name$="-gross_weight_kg"],
.sales-lines-table input[name$="-volume_cbm"] { min-width: 78px; width: 100%; }
.sales-lines-table .sales-action-cell { position:sticky; right:0; min-width:88px; width:88px; background:#fff; z-index:2; box-shadow:-5px 0 8px -8px rgba(16,24,40,.55); }
.sales-lines-table th.sales-action-cell { background:#fafbfc; z-index:3; }
.sales-lines-table tbody tr:hover .sales-action-cell { background:#fbfcfc; }
.compact-button { margin-top: 6px; padding: 5px 7px; font-size: 11.5px; }

.selection-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  margin: .65rem 0;
  padding: .55rem .7rem;
  border: 1px solid #d8dde5;
  border-radius: 8px;
  background: #f8fafc;
  font-size: .86rem;
}
.selection-toolbar button { min-height: 30px; padding: .28rem .55rem; }
.selection-page-toggle { display: inline-flex; align-items: center; gap: .3rem; }
.select-column { width: 34px; min-width: 34px; text-align: center; }
.select-column input { width: auto; min-height: 0; }

/* v0.11.1: deleted packaging rows remain visible for undo but never participate in saved hierarchy. */
.packaging-row.row-marked-for-deletion { opacity: 0.48; }
.packaging-row.row-marked-for-deletion .level-display { text-decoration: line-through; }
.packaging-table input[readonly] { background: #f3f5f7; cursor: not-allowed; }

.document-meta-grid { display: grid; grid-template-columns: minmax(220px, 360px); gap: 1rem; margin-bottom: 1rem; }
.document-meta-grid p { margin: 0; }
.document-meta-grid label { display: block; font-weight: 600; margin-bottom: .35rem; }

/* v0.14.0.1: finance summary cards remain readable with many counters. */
.finance-metrics { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 9px; margin: 12px 0 18px; }
.finance-metrics .metric { padding: 11px 13px; border-radius: 11px; gap: 2px; }
.finance-metrics .metric span { font-size: 12px; line-height: 1.25; }
.finance-metrics .metric strong { font-size: 22px; line-height: 1.1; }
.field-hidden, .section-hidden { display: none !important; }

.workbench-tabs { display:flex; flex-wrap:wrap; gap:8px; margin:18px 0; border-bottom:1px solid var(--line); }
.workbench-tabs a { display:inline-block; padding:10px 14px; border:1px solid var(--line); border-bottom:0; border-radius:9px 9px 0 0; background:var(--surface); color:var(--text); text-decoration:none; }
.workbench-tabs a.active { font-weight:700; background:white; position:relative; top:1px; }
.purchase-order-lines { min-width:1280px; }
.purchase-order-lines .po-main-unit { background:#f3f5f7; cursor:not-allowed; min-width:120px; }
.source-search-row { display: flex; gap: 10px; align-items: center; }
.source-search-row input { flex: 1; min-width: 260px; }
.source-search-status { margin: 8px 0; min-height: 1.4em; }
.source-search-results { display: grid; gap: 8px; margin: 8px 0 18px; }
.source-search-result { display: flex; justify-content: space-between; gap: 16px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-soft, #fafafa); }
.source-search-result strong, .source-pi-card strong { display: block; }
.source-search-result small, .source-pi-card small, .po-line-progress, .batch-progress { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.inventory-entry-table select, .inventory-entry-table input { min-width: 110px; }
.inventory-entry-table .sku-display, .inventory-entry-table .main-unit-display { white-space: nowrap; font-weight: 600; }
.inventory-entry-table .product-name-display { min-width: 150px; }

.unsaved-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}
.unsaved-dialog::backdrop { background: rgba(15, 23, 42, 0.48); }
.unsaved-dialog-body { padding: 24px; }
.unsaved-dialog-body h2 { margin: 0 0 10px; }
.unsaved-dialog-body p { margin: 0; color: var(--muted, #52606d); }
.unsaved-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.company-context-form { display:flex; align-items:center; gap:.35rem; margin:0; }
.company-context-form label { font-size:.78rem; opacity:.8; }
.company-context-form select { max-width:15rem; padding:.35rem .5rem; }
.role-capability-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:1rem; }
.role-capability-grid .module-card { display:block; }
.role-capability-grid ul { margin:.75rem 0 0; padding-left:1.2rem; }
.role-capability-grid li { margin:.5rem 0; }

/* v0.16.0.15: shared business-list pagination. */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin: 1rem 0 .25rem;
  font-size: .88rem;
}
.pagination a,
.pagination strong.active,
.pagination .ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: .25rem .5rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-decoration: none;
  background: var(--surface);
}
.pagination a:hover { background: var(--surface-soft, #f6f8fa); }
.pagination strong.active,
.pagination .page-size a.active { font-weight: 700; border-color: currentColor; }
.pagination .page-size,
.pagination .page-numbers { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.pagination .page-summary { color: var(--muted); margin: 0 .15rem; }
.pagination .ellipsis { border-color: transparent; background: transparent; }
.shipment-quantity-error, .shipment-carton-rule { display: block; margin-top: 4px; }
.shipment-carton-rule { color: var(--muted); }


/* v0.16.0.76: searchable selectors and clear empty states for purchase payments. */
.form-field { margin: 0; }
.form-field > label { display: block; font-weight: 600; margin-bottom: .35rem; }
.searchable-select-control { display: grid; gap: .4rem; }
.searchable-select-input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; font-size: 13px; background: white; }
.searchable-select-input:disabled { background: #f3f5f7; cursor: not-allowed; }
.searchable-select-status { min-height: 0; font-size: .78rem; color: var(--muted); }
.field-empty-state { display: grid; gap: .3rem; margin-top: .55rem; padding: .65rem .75rem; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface-soft, #f8fafc); }
.field-empty-state strong { font-size: .88rem; }
.field-empty-state span, .field-empty-state a { font-size: .82rem; line-height: 1.35; }

/* v0.16.0.99: keep one real bank movement and its document allocations visibly reconciled. */
.funds-allocation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: .75rem;
  margin: .75rem 0 1rem;
}
.funds-allocation-summary > div {
  display: grid;
  gap: .25rem;
  padding: .7rem .8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft, #f8fafc);
}
.funds-allocation-summary span { color: var(--muted); font-size: .82rem; }
.funds-allocation-summary strong { font-size: 1.05rem; }
.funds-allocation-summary .negative-balance { color: #b42318; }
@media (max-width: 720px) {
  .funds-allocation-summary { grid-template-columns: 1fr; }
}

/* v0.16.0.131: compact, server-searched Shipment selectors. */
.remote-field { min-width: 0; }
.remote-field > p { margin-bottom: .45rem; }
.remote-field .source-search-results { margin-bottom: .5rem; }
.selected-source-list { display: grid; gap: .5rem; }
.source-pi-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; background: var(--surface-soft, #fafafa); }
.compact-heading { margin-top: 1rem; margin-bottom: .5rem; }
.compact-details summary { cursor: pointer; display: flex; gap: .6rem; align-items: baseline; }
.compact-details .details-body { margin-top: 1rem; }
@media (max-width: 760px) {
  .source-search-row { align-items: stretch; flex-direction: column; }
  .source-search-row input { min-width: 0; }
  .source-pi-card { align-items: flex-start; flex-direction: column; }
}

/* v0.17.0.48: business-first purchase-to-platform replenishment guide. */
.purchase-flow { overflow: hidden; }
.purchase-flow-steps { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 10px; }
.purchase-flow-step { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.purchase-flow-step p { margin: 5px 0 0; color: var(--muted); }
.flow-number { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-weight: 800; }
.flow-step-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flow-state { flex: 0 0 auto; border-radius: 999px; padding: 4px 9px; background: var(--line); color: var(--muted); font-size: 11px; font-weight: 700; }
.flow-complete { border-color: #a9d9bf; }
.flow-complete .flow-number, .flow-complete .flow-state { background: #e2f5ea; color: #166534; }
.flow-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.flow-current .flow-number, .flow-current .flow-state { background: var(--accent-soft); color: var(--accent); }
.flow-partial { border-color: #e9c46a; }
.flow-partial .flow-number, .flow-partial .flow-state { background: #fff4d6; color: #8a5a00; }
.flow-stopped { border-color: #e5a3a3; }
.flow-stopped .flow-number, .flow-stopped .flow-state { background: #fde8e8; color: #9b1c1c; }
.purchase-flow-step .button-link { margin-top: 10px; }
.flow-linked-records { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.flow-linked-records a { border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; text-decoration: none; font-size: 12px; }
.api-boundary-note { margin-top: 14px; }
@media (max-width: 620px) {
  .purchase-flow-step { grid-template-columns: 32px minmax(0, 1fr); padding: 12px; }
  .flow-number { width: 30px; height: 30px; }
  .flow-step-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* v0.16.0.179: concise, visual business navigation */
.compact-page-heading { margin-bottom: 12px; align-items: center; }
.compact-metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0 18px; }
.compact-metrics .metric { padding: 13px 15px; border-radius: 12px; min-height: 74px; text-decoration: none; color: var(--ink); }
.compact-metrics .metric span { font-size: 12px; line-height: 1.25; }
.compact-metrics .metric strong { font-size: 25px; line-height: 1.05; }
.compact-module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.compact-module-card { min-height: 92px !important; padding: 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.compact-module-card h2 { margin: 0; font-size: 18px; line-height: 1.25; }
.module-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.module-arrow { color: var(--accent); font-size: 22px; }
.workspace-section { margin: 20px 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.section-title h2 { margin: 0; font-size: 17px; }
.section-title a { color: var(--accent); text-decoration: none; font-size: 13px; }
.channel-grid, .quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.channel-card, .quick-link { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; padding: 15px 16px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; transition: border-color .12s ease, transform .12s ease; }
.channel-card:hover, .quick-link:hover { border-color: var(--accent); transform: translateY(-1px); }
.channel-card strong, .quick-link strong { font-size: 14px; line-height: 1.3; }
.channel-code { min-width: 54px; padding: 5px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; text-align: center; }
.compact-settings { padding-top: 4px; border-top: 1px solid var(--line); }
.compact-table-card { margin-top: 18px; padding-top: 15px; }
.related-flow { margin: 18px 0; padding-top: 14px; border-top: 1px solid var(--line); }
.related-flow-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.related-flow-stage { min-width: 0; }
.related-flow-stage h3 { margin: 0 0 7px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.related-flow-stage ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.related-flow-stage li { margin: 0; }
.related-flow-stage a { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; color: var(--ink); text-decoration: none; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 8px; align-items: center; }
.related-flow-stage a:hover { border-color: var(--accent); }
.related-flow-stage strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.related-flow-stage small { grid-column: 2; color: var(--muted); font-size: 11px; }
.related-kind { padding: 3px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10px; line-height: 1; }
.compact-search-results .search-result { min-height: 74px; }
@media (max-width: 620px) {
  .compact-module-grid, .channel-grid, .quick-links, .related-flow-grid { grid-template-columns: 1fr; }
  .compact-module-card { min-height: 76px !important; }
}

/* v0.16.0.199: business-first document detail pages with progressive disclosure. */
.business-summary { margin: 12px 0 18px; }
.business-summary .metric { min-height: 82px; }
.business-summary .metric strong { overflow-wrap: anywhere; }
.business-summary .metric small { line-height: 1.3; }
.business-section { margin-top: 18px; }
.business-section > .section-title { margin-bottom: 10px; }
.business-actions { margin: 10px 0 18px; }
.traceability-details { margin: 18px 0; padding: 0; overflow: hidden; }
.traceability-details > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  font-weight: 700;
}
.traceability-details > summary::-webkit-details-marker { display: none; }
.traceability-details > summary::after { content: "+"; color: var(--accent); font-size: 22px; line-height: 1; }
.traceability-details[open] > summary::after { content: "−"; }
.traceability-details[open] > summary { border-bottom: 1px solid var(--line); }
.traceability-details .traceability-summary-copy { display: grid; gap: 2px; }
.traceability-details .traceability-summary-copy small { color: var(--muted); font-weight: 400; }
.traceability-details .details-body { padding: 18px 20px 20px; }
.traceability-details .related-flow { margin: 0; padding-top: 0; border-top: 0; }
.traceability-details .card { box-shadow: none; }
.operational-table th, .operational-table td { vertical-align: top; }
.secondary-facts { color: var(--muted); font-size: 12px; line-height: 1.35; }
.inline-status { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 700px) {
  .traceability-details > summary { align-items: flex-start; padding: 15px 16px; }
  .traceability-details .details-body { padding: 15px 16px 18px; }
}

/* v0.16.0.200: business-first operational lists with row-level progressive disclosure. */
.operational-list { min-width: 760px; }
.operational-list th, .operational-list td { vertical-align: top; }
.operational-list td { padding-top: 10px; padding-bottom: 10px; }
.record-primary { min-width: 180px; }
.record-primary > a, .record-primary > strong { display: block; font-weight: 700; }
.record-primary small, .operational-list td > small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.3; }
.row-actions { min-width: 86px; white-space: nowrap; }
.row-actions > a { display: inline-block; margin-right: 8px; }
.list-row-details { display: inline-block; position: relative; vertical-align: middle; }
.list-row-details > summary { cursor: pointer; list-style: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); font-size: 17px; line-height: 1; }
.list-row-details > summary::-webkit-details-marker { display: none; }
.list-row-details[open] > summary { background: var(--accent-soft); border-color: var(--accent); }
.list-row-details > div { position: absolute; right: 0; z-index: 20; width: min(360px, 70vw); margin-top: 6px; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(31, 42, 55, .14); white-space: normal; }
.list-row-details .detail-list { margin: 0; }
.compact-guidance { padding: 0; }
.compact-guidance > summary { cursor: pointer; padding: 13px 16px; font-weight: 700; }
.compact-guidance > p, .compact-guidance > .table-wrap { margin-left: 16px; margin-right: 16px; }
.compact-guidance > :last-child { margin-bottom: 14px; }
@media (max-width: 760px) {
  .operational-list { min-width: 680px; }
  .list-row-details > div { position: fixed; left: 14px; right: 14px; bottom: 14px; width: auto; max-height: 70vh; overflow: auto; }
}

/* v0.17.0.56: CRM prospect-first entry, inline contacts and websites. */
.crm-customer-form { display: grid; gap: 16px; }
.crm-customer-form .crm-section { max-width: none; }
.crm-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.crm-field-grid > p { min-width: 0; }
.crm-field-grid .full-span { grid-column: 1 / -1; }
.crm-inline-list { display: grid; gap: 10px; }
.crm-inline-card { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
details.crm-inline-card > summary { cursor: pointer; padding: 11px 13px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.crm-inline-body { padding: 12px 13px; }
.crm-inline-card > summary + .crm-inline-body { border-top: 1px solid var(--line); }
.crm-inline-card .checkbox-line { display: flex; align-items: center; gap: 8px; align-content: start; }
.crm-inline-card .checkbox-line label { margin: 0; }
.crm-inline-card .checkbox-line input { width: auto; }
.crm-advanced-body { display: grid; gap: 14px; padding-top: 14px; }
.crm-section > details > summary { cursor: pointer; font-size: 16px; }
.status-pill { display: inline-flex; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--muted); font-size: 11px; font-weight: 650; }
@media (max-width: 760px) {
  .crm-field-grid { grid-template-columns: 1fr; }
  .crm-field-grid .full-span { grid-column: auto; }
  .crm-section .page-heading { align-items: flex-start; }
}

/* v0.17.0.71: multi-point one-person workflow optimizations. */
.inventory-action-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: .75rem;
  margin: .75rem 0 1rem;
}
.inventory-action-strip > div {
  display: grid;
  gap: .25rem;
  padding: .75rem .85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft, #f8fafc);
}
.inventory-action-strip span,
.inventory-action-strip small { color: var(--muted); font-size: .82rem; }
.inventory-action-strip strong { font-size: 1.02rem; }
.compact-action-note { margin: .4rem 0 1rem; }
.shipment-shortcut-flow-card { border-color: var(--accent-soft, var(--line)); }
.shipment-quick-steps { list-style: none; padding: 0; margin: .85rem 0 0; display: grid; gap: .55rem; }
.shipment-quick-steps li { display: grid; gap: .2rem; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.shipment-quick-steps span { color: var(--muted); font-size: .86rem; }
@media (max-width: 760px) {
  .inventory-action-strip { grid-template-columns: 1fr; }
}


/* v0.17.0.72: shipment follow-up and traceability guidance. */
.shipment-status-cell { min-width: 170px; }
.shipment-status-focus,
.shipment-status-hint { display: block; margin-top: 3px; color: var(--muted); line-height: 1.3; }
.shipment-status-focus { font-weight: 700; color: var(--ink); }
.shipment-next-step-card { border-left: 4px solid var(--accent); }
.shipment-next-step-attention { border-left-color: var(--warning); }
.shipment-next-step-complete { border-left-color: var(--accent); }
.shipment-next-step-muted { border-left-color: var(--line); }
.shipment-draft-checks { margin-top: .6rem; }
.shipment-draft-checks li { color: var(--warning); }
.shipment-source-summary-card small { display: block; margin-top: 3px; color: var(--muted); }

/* v0.17.0.73: daily shipment worklist and cancelled archive reduction. */
.worklist-archive-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(120px, auto) auto;
  gap: .75rem;
  align-items: center;
  margin: .75rem 0 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft, #f8fafc);
}
.worklist-archive-strip div { display: grid; gap: .2rem; }
.worklist-archive-strip small,
.worklist-archive-strip span { color: var(--muted); font-size: .84rem; }
.shipment-worklist .archived-row { opacity: .78; }
.archive-label { color: var(--muted); font-weight: 700; }
.shipment-archive-card { border-left: 4px solid var(--line); }
.muted-metric { opacity: .82; }
@media (max-width: 760px) {
  .worklist-archive-strip { grid-template-columns: 1fr; align-items: stretch; }
}

/* v0.17.0.75: compact daily work and authorization split views. */
.daily-work-card { margin-bottom: 18px; }
.daily-work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.daily-work-item { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; background: var(--surface); color: var(--ink); text-decoration: none; display: grid; gap: 5px; }
.daily-work-item span { font-size: 12px; color: var(--muted); }
.daily-work-item strong { font-size: 24px; line-height: 1.05; }
.daily-work-item small { color: var(--muted); }
.authorization-split-card { margin-top: 18px; }

/* v0.17.0.76: daily workflow and read-only relationship checks. */
.compact-workflow-card { margin-bottom: 18px; }
.daily-work-card,
.relationship-check-card,
.status-tab {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}
.daily-work-card,
.relationship-check-card {
  padding: 13px 15px;
  display: grid;
  gap: 5px;
}
.daily-work-card span,
.relationship-check-card span,
.status-tab { color: var(--muted); }
.daily-work-card strong,
.relationship-check-card strong { font-size: 24px; line-height: 1.05; }
.daily-work-card small { color: var(--muted); }
.relationship-check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.status-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.status-tab { padding: 8px 12px; font-weight: 700; }
.status-tab.active { background: var(--surface-soft, #f8fafc); color: var(--ink); }


/* v0.17.0.77: access-control history reduction and readable system-field disclosure. */
.access-history-card { padding: 0; overflow: hidden; }
.access-history-card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; font-weight: 700; }
.access-history-card > summary::-webkit-details-marker { display: none; }
.access-history-card > summary::after { content: "+"; color: var(--accent); font-size: 21px; line-height: 1; }
.access-history-card[open] > summary::after { content: "−"; }
.access-history-card[open] > summary { border-bottom: 1px solid var(--line); }
.access-history-card > summary .status { margin-left: auto; }
.access-history-body { padding: 14px 18px 18px; }
.access-history-body .archived-row { opacity: .78; }
.system-field-details { display: inline-block; margin-left: 6px; vertical-align: middle; }
.system-field-details > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; width: auto; min-width: max-content; min-height: 26px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent); font-size: 11px; line-height: 1.2; white-space: nowrap; }
.system-field-details > summary::-webkit-details-marker { display: none; }
.system-field-details[open] > summary { background: var(--accent-soft); border-color: var(--accent); }
.system-field-details > code { display: block; width: max-content; max-width: min(360px, 70vw); margin: 5px 0 0; padding: 5px 8px; border-radius: 7px; background: var(--surface-soft, #f8fafc); color: var(--muted); font-size: 11px; overflow-wrap: anywhere; white-space: normal; }
@media (max-width: 760px) {
  .access-history-card > summary { align-items: flex-start; }
  .access-history-body { padding: 12px 14px 16px; }
}

/* v0.17.0.78: employee onboarding and desktop-responsive operational tables. */
.hero h1,
.page-heading h1 { font-size: clamp(22px, 1.7vw, 28px); }
.page { width: min(calc(100% - 28px), 1920px); }
.table-wrap { max-width: 100%; overscroll-behavior-x: contain; }
.wide-table-wrap { overflow-x: auto; overflow-y: hidden; }
.responsive-wide-table { width: max-content; min-width: 100%; }
.cell-nowrap { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
.procurement-execution-table { min-width: 1880px; table-layout: auto; }
.procurement-execution-table th,
.procurement-execution-table td { word-break: normal; }
.procurement-execution-table .company-cell { min-width: 120px; }
.procurement-execution-table .sku-cell { min-width: 120px; }
.procurement-execution-table .product-name-cell { min-width: 220px; max-width: 320px; white-space: normal; overflow-wrap: break-word; }
.procurement-execution-table .number-cell { min-width: 118px; text-align: right; }
.procurement-execution-table .document-links-cell { min-width: 220px; white-space: nowrap; }
.employee-table { min-width: 820px; }
.employee-table td:first-child,
.employee-table td:nth-child(3),
.employee-table td:nth-child(5),
.employee-table td:nth-child(6) { white-space: nowrap; }
.employee-onboarding-form { display: grid; gap: 14px; }
.onboarding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.onboarding-grid p { margin: 0; display: grid; gap: 5px; }
.onboarding-grid label,
.onboarding-role-panel > label { font-weight: 650; }
.onboarding-grid input:not([type="checkbox"]),
.onboarding-grid select,
.onboarding-grid textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 8px 9px; background: #fff; }
.onboarding-grid .full-span,
.onboarding-role-panel { grid-column: 1 / -1; }
.onboarding-grid .helptext,
.onboarding-role-panel .helptext { color: var(--muted); font-size: 12px; }
.onboarding-grid .errorlist,
.employee-onboarding-form .errorlist { color: var(--danger); margin: 0; padding-left: 18px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; margin: 0; }
.checkbox-line label { font-weight: 700; }
.erp-account-fields[hidden] { display: none !important; }
.onboarding-role-panel ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 7px 12px; }
.onboarding-role-panel li label { display: flex; align-items: flex-start; gap: 7px; font-weight: 500; }

@media (max-width: 1360px) and (min-width: 981px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .main-nav a { padding: 9px 9px; font-size: 12.5px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .page { width: calc(100% - 20px); margin-top: 14px; }
  .card { padding: 12px 13px; }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
  .metric { padding: 13px; }
  .metric strong { font-size: 24px; }
  .page-heading { gap: 12px; margin-bottom: 14px; }
  .filter-bar { padding: .7rem; }
}

@media (max-width: 760px) {
  .onboarding-grid { grid-template-columns: 1fr; }
  .onboarding-grid .full-span,
  .onboarding-role-panel { grid-column: auto; }
}

/* v0.17.0.79: operational table alignment and wider cross-module responsive contract. */
.numeric-cell {
  text-align: right !important;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  font-variant-numeric: tabular-nums;
}
.identifier-cell {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.description-cell {
  min-width: 200px;
  max-width: 360px;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.operational-wide-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
.operational-wide-table th,
.operational-wide-table td {
  word-break: normal;
}
.operational-wide-table .identifier-cell { min-width: 110px; }
.operational-wide-table .numeric-cell { min-width: 108px; }
.procurement-execution-table th.number-cell,
.procurement-execution-table td.number-cell {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 1180px) {
  .operational-wide-table .description-cell { min-width: 180px; }
  .operational-wide-table .numeric-cell { min-width: 100px; }
}

/* v0.17.0.80 company-context clarity */
.company-context-form.company-context-locked {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.company-context-readonly {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: .25rem .65rem;
  border: 1px solid var(--line, #d8dde5);
  border-radius: .45rem;
  background: var(--surface-soft, #f6f7f9);
  white-space: nowrap;
}
select[data-company-context-locked="1"] {
  pointer-events: none;
  appearance: none;
  background-image: none;
  cursor: default;
}

/* v0.17.0.86 TikTok LOT allocation controls: CSP-safe layout utilities */
.tiktok-inventory-spaced { margin-top: .45rem; }
.tiktok-inventory-inline { display: inline; }
.tiktok-allocation-quantity { width: 6rem; }

/* v0.17.0.106: finance center quick links show only titles, no small explanatory text. */
.finance-center-page .workspace-section { margin: 20px 0; }
.finance-center-page .quick-links { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.finance-center-page .quick-link { grid-template-columns: 1fr auto; min-height: 48px; padding: 14px 16px; }
.finance-center-page .quick-link strong { font-size: 15px; line-height: 1.25; }
.finance-center-page .quick-link small { display: none !important; }
.finance-center-heading { margin-bottom: 10px; }

/* v0.17.0.107: finance center cards use title-only layout without arrow icons. */
.finance-center-page .quick-link { grid-template-columns: 1fr; }
.finance-center-page .quick-link > span[aria-hidden="true"] { display: none !important; }
.finance-center-page .metric span { font-size: 13px; line-height: 1.2; }

/* v0.17.0.111: Finance Center cards use a uniform workbench grid. */
.finance-center-page .quick-links {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: stretch;
  gap: 10px;
}
.finance-center-page .quick-link {
  height: 62px;
  min-height: 62px;
  padding: 12px 16px;
  align-items: center;
  overflow: hidden;
}
.finance-center-page .quick-link strong {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}
@media (min-width: 1400px) {
  .finance-center-page .quick-links { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
}
