* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--erp-font-sans);
  font-size: var(--erp-font-size-md);
  line-height: var(--erp-line-height-normal);
  background: var(--erp-bg);
  color: var(--erp-text);
}

a {
  color: var(--erp-primary);
}

a:hover {
  color: var(--erp-primary-hover);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-height: var(--erp-control-height);
  border: var(--erp-border-width) var(--erp-border-style) var(--erp-border);
  border-radius: var(--erp-radius-md);
  background: var(--erp-surface);
  color: var(--erp-text);
  padding: 9px 10px;
  transition: border-color var(--erp-duration-fast) var(--erp-ease-standard), box-shadow var(--erp-duration-fast) var(--erp-ease-standard);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--erp-shadow-focus);
}

textarea {
  resize: vertical;
}

* {
  scrollbar-color: var(--erp-border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: var(--erp-radius-pill);
  background: var(--erp-border-strong);
  background-clip: padding-box;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-brand {
  margin-bottom: 18px;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 26px;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-card .auth-success {
  padding: 10px 12px;
  border: 1px solid var(--success-border, #a7d7c4);
  border-radius: 8px;
  background: var(--success-surface, #eef8f3);
  color: var(--success-text, #226647);
}

.auth-card .auth-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger, #a63a3a);
  font-size: 14px;
}

.employee-credential-status {
  margin: 8px 0 0;
}

.sidebar {
  background: #18272e;
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 800;
}

.brand span {
  display: block;
  color: #b8c8ce;
  font-size: 13px;
  margin-top: 3px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 6px;
  color: #c9d6dc;
  cursor: pointer;
  padding: 10px 12px;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.user-panel {
  display: grid;
  gap: 5px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 12px;
}

.user-panel span {
  color: #b8c8ce;
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.topbar h1,
.topbar p {
  margin: 0;
}

.topbar h1 {
  font-size: 30px;
  letter-spacing: 0;
}

.topbar p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.action-icon-button .action-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-icon-button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.action-icon-button.primary:hover {
  background: var(--brand-dark);
}

.action-icon-button.secondary,
.action-icon-button.back {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.action-icon-button.back {
  background: #eef2f4;
  border-color: #c9d4dd;
  color: #34434b;
}

.action-icon-button.secondary:hover,
.action-icon-button.back:hover {
  background: #e3e9ed;
}

.action-icon-button.danger {
  background: #fff7f7;
  border-color: #e0b8b8;
  color: var(--danger);
}

.action-icon-button.danger:not(:disabled):hover {
  background: #ffecec;
  border-color: #d99a9a;
}

.sidebar nav a .tf-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.shipping-related-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.shipping-related-context div { display: grid; gap: 3px; }
.shipping-related-context span,
.shipping-related-context small { color: var(--muted, #667985); }
.shipping-related-context strong { color: #17313d; }

.topbar-actions .shipping-editor-more,
.topbar-actions .purchase-editor-more,
.customer-order-actions .customer-order-editor-more {
  display: none;
}

.brand-home {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.brand-home:hover,
.brand-home:focus-visible {
  background: transparent;
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 5px;
}

.action-icon-button.tiny-action {
  width: 44px;
  height: 44px;
  border-radius: 8px;
}

.action-icon-button.tiny-action .action-icon {
  width: 21px;
  height: 21px;
}

.action-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.action-icon-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 20;
  transform: translateX(-50%) translateY(-2px);
  min-width: max-content;
  max-width: 220px;
  border-radius: 6px;
  background: #1f2d33;
  color: #fff;
  font-size: 13px;
  line-height: 1.3;
  padding: 6px 8px;
  box-shadow: 0 8px 20px rgba(22, 34, 40, 0.18);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.action-icon-button:hover::after,
.action-icon-button:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.primary,
.secondary,
.back-button,
.danger-button,
.icon-button,
.status-tile,
.company-tile {
  border: 1px solid transparent;
  border-radius: 6px;
}

.primary {
  background: var(--brand);
  color: #fff;
  padding: 10px 14px;
  font-weight: 700;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
  padding: 10px 14px;
}

.secondary:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.back-button {
  background: #eef2f4;
  border-color: #c9d4dd;
  color: #34434b;
  padding: 10px 14px;
}

.back-button:hover {
  background: #e3e9ed;
}

.deactivate-button {
  border-color: #c9d4dd;
}

.danger-button {
  background: #fff7f7;
  border-color: #e0b8b8;
  color: var(--danger);
  padding: 10px 14px;
}

.danger-button:not(:disabled):hover {
  background: #ffecec;
  border-color: #d99a9a;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.company-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 14px;
}

.shipment-status-field {
  display: grid;
  gap: 6px;
}

.shipment-status-field > span {
  color: var(--muted);
}

.shipment-status-summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #d89a28;
  border-radius: 6px;
  background: #fffaf0;
}

.shipment-status-summary strong {
  white-space: nowrap;
}

.shipment-status-summary small {
  color: var(--muted);
}

.shipment-status-summary.shipped {
  border-left-color: #258a68;
  background: #f2fbf7;
}

.shipment-status-summary.void {
  border-left-color: var(--danger);
  background: #fff7f7;
}

.shipment-action-state {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 700;
}

.shipment-action-state.void {
  color: var(--danger);
  border-color: #e0b8b8;
  background: #fff7f7;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.task-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 18px;
  text-align: left;
  box-shadow: var(--shadow);
}

.task-card strong {
  font-size: 20px;
}

.task-card span {
  color: var(--muted);
  line-height: 1.45;
}

.task-card:hover,
.task-card.primary-task {
  border-color: var(--brand);
  background: var(--soft);
}

.company-tile {
  display: inline-grid;
  grid-template-columns: 28px auto;
  gap: 0 8px;
  align-items: center;
  text-align: left;
  background: var(--panel);
  border-color: var(--line);
  padding: 9px 14px;
  box-shadow: none;
  border-radius: 0;
}

.company-grid .company-tile:first-child { border-radius: 8px 0 0 8px; }
.company-grid .company-tile:last-child { border-radius: 0 8px 8px 0; }
.company-grid .company-tile + .company-tile { margin-left: -1px; }

.company-tile span {
  display: grid;
  width: 26px;
  height: 26px;
  grid-row: span 2;
  place-items: center;
  border-radius: 8px;
  background: #e7f4f4;
  color: var(--brand);
  font-weight: 800;
}

.company-tile strong {
  font-size: 14px;
}

.company-tile small {
  color: var(--muted);
  font-size: 11px;
}

.company-tile.active {
  border-color: var(--brand);
  background: var(--soft);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.7fr);
  gap: 14px;
  align-items: start;
}

.document-list-panel {
  margin-bottom: 14px;
}

.customer-order-panel {
  margin-bottom: 14px;
}

.list-actions,
.list-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.list-filters input {
  flex: 1 1 260px;
}

.list-filters select {
  flex: 0 1 160px;
}

.document-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.customer-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.customer-order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.5fr);
  gap: 14px;
  align-items: start;
}

.customer-order-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 6px;
}

.customer-order-item-title h3 {
  margin: 0;
  font-size: 16px;
}

.customer-order-item-title small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.customer-order-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
}

.master-panel {
  margin-bottom: 14px;
}

.master-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.master-tabs .active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand);
  font-weight: 700;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.input-action button {
  align-self: stretch;
  white-space: nowrap;
}

.compact {
  padding: 8px 10px;
}

.customer-order-payment-panel { margin: 18px 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfc; }
.field-with-suffix { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.field-with-suffix > span { color: var(--muted); font-weight: 700; }
.payment-block-toggle { display: flex !important; grid-template-columns: none !important; flex-direction: row !important; align-items: center; gap: 9px !important; }
.payment-block-toggle input { width: 18px; height: 18px; }
.payment-summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.payment-summary-cards > div { padding: 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.payment-summary-cards span, .payment-summary-cards strong { display: block; }
.payment-summary-cards span { color: var(--muted); font-size: 13px; }
.payment-summary-cards strong { margin-top: 5px; font-size: 20px; }
.row-action-stack { display: flex; gap: 5px; justify-content: center; }

.company-scope-block { display: grid; gap: 7px; align-content: end; }
.company-scope-block > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.company-switcher { display: inline-flex; flex-wrap: wrap; }
.company-switcher button { min-height: 42px; padding: 9px 18px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--text); font-weight: 700; }
.company-switcher button:first-child { border-radius: 8px 0 0 8px; }
.company-switcher button:last-child { border-radius: 0 8px 8px 0; }
.company-switcher button + button { margin-left: -1px; }
.company-switcher button.active { position: relative; z-index: 1; border-color: var(--brand); background: var(--soft); color: var(--brand-dark); }

.product-price-history {
  display: grid;
  gap: 14px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
}

.product-price-history h3,
.product-price-history p { margin: 0; }
.product-price-history p { color: var(--muted); font-size: 13px; }
.product-price-heading { display: flex; justify-content: space-between; gap: 18px; align-items: start; }
.product-price-heading > div:first-child { display: grid; gap: 5px; }
.current-product-price { display: grid; gap: 2px; min-width: 180px; text-align: right; }
.current-product-price span,
.current-product-price small { color: var(--muted); font-size: 12px; }
.current-product-price strong { color: var(--brand-dark); font-size: 22px; }
.product-price-entry { display: grid; grid-template-columns: .75fr .7fr 1fr .9fr 1.25fr auto; gap: 10px; align-items: end; }
.product-price-entry label { display: grid; gap: 6px; }
.product-price-entry label span { color: var(--muted); font-size: 13px; font-weight: 700; }
.product-price-entry button { min-height: 42px; }
.product-price-list { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.product-price-list table { width: 100%; border-collapse: collapse; }
.product-price-list th,
.product-price-list td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.product-price-list th:nth-child(2),
.product-price-list td:nth-child(2) { text-align: right; }
.product-price-list th { color: var(--muted); background: #f2f6f7; font-size: 12px; }
.product-price-list tr:last-child td { border-bottom: 0; }
.product-price-empty { padding: 16px; text-align: center; }
.product-price-history.empty { color: var(--muted); }

@media (max-width: 900px) {
  .product-price-entry { grid-template-columns: 1fr 1fr; }
  .product-price-heading { flex-direction: column; }
  .current-product-price { text-align: left; }
}

.customer-order-company-grid {
  display: flex;
}

.company-scope-notice {
  margin: -3px 0 14px;
  padding: 9px 12px;
  border-left: 4px solid #d29338;
  background: #fff8e9;
  color: #72531e;
  font-size: 13px;
}
.customer-order-dashboard-list .customer-order-row { grid-template-columns:minmax(220px,2fr) 90px 140px 120px; padding:14px 16px; }
.customer-order-editor-grid { grid-template-columns:minmax(0,1fr); }

.field-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.note-template-tools {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 8px;
}

.note-template-tools.open {
  display: flex;
}

.note-template-tools select {
  max-width: 260px;
}

.master-grid {
  display: grid;
  grid-template-columns: minmax(320px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.master-list {
  display: grid;
  gap: 8px;
  max-height: 460px;
  overflow: auto;
}

.part-list-tools {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px 12px;
}

.part-tools-head {
  display: grid;
  gap: 2px;
}

.part-tools-head strong {
  font-size: 15px;
}

.part-tools-head span {
  color: var(--muted);
  font-size: 12px;
}

.part-tools-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.part-sort-select {
  display: grid;
  gap: 4px;
}

.part-sort-select span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.part-sort-select select {
  height: 38px;
  padding: 6px 10px;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 10px 6px 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  display: inline-flex;
  align-items: center;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #d8e1e6;
  padding: 2px;
  transition: background 0.16s ease;
}

.switch-track span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(31, 45, 51, 0.18);
  transition: transform 0.16s ease;
}

.switch-control input:checked + .switch-track {
  background: var(--brand);
}

.switch-control input:checked + .switch-track span {
  transform: translateX(16px);
}

.switch-control strong {
  font-size: 13px;
}

.part-sort-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.master-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.master-row[draggable="true"] {
  cursor: grab;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.master-row[draggable="true"] small {
  grid-column: 2;
}

.drag-handle {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 1px;
}

.master-row.dragging {
  opacity: 0.55;
}

.master-row.drag-over {
  border-color: var(--brand);
  background: #e9f7f5;
}

.master-row.active {
  border-color: var(--brand);
  background: #e9f7f5;
}

.master-row.inactive {
  opacity: 0.55;
}

.master-row small {
  color: var(--muted);
}

.module-placeholder {
  display: grid;
  min-height: 260px;
  align-content: center;
  gap: 8px;
}

.module-placeholder h2,
.module-placeholder p {
  margin: 0;
}

.module-placeholder p {
  color: var(--muted);
}

.master-form-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.master-form-head h3 {
  margin: 0;
  font-size: 17px;
}

.master-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.master-check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.master-check input {
  width: auto;
}

.master-danger-backdrop {
  position: fixed;
  z-index: 600;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 31, 36, .5);
}

.master-danger-dialog {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  width: min(470px, 100%);
  padding: 22px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.master-danger-dialog h2,
.master-danger-dialog p { margin: 0; }
.master-danger-dialog h2 { font-size: 19px; }
.master-danger-dialog p { margin-top: 8px; color: var(--muted); line-height: 1.55; }
.master-danger-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: #a33b3b; background: #fff0f0; }
.master-danger-dialog footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }

.bom-copy-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 12px;
}

.bom-copy-box strong {
  display: block;
  margin-bottom: 4px;
}

.bom-copy-box small {
  color: var(--muted);
}

.bom-copy-source {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 9px 11px;
}

.bom-copy-source span,
.bom-copy-source strong {
  display: block;
}

.bom-copy-source span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 3px;
}

.bom-copy-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
}

.edit-mode-note {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
}

.edit-mode-note strong,
.edit-mode-note span {
  display: block;
}

.edit-mode-note strong {
  margin-bottom: 3px;
}

.edit-mode-note span {
  color: var(--muted);
  font-size: 13px;
}

.edit-mode-note.adding {
  background: #f1faf8;
  border-color: #b8ded8;
}

.edit-mode-note.editing {
  background: #fff8ed;
  border-color: #e7c88f;
}

.customer-order-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 58px 88px 90px;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--text);
  text-align: left;
  padding: 10px;
}

.customer-order-row.active {
  border-color: var(--brand);
  background: #e9f7f5;
}

.customer-order-row strong,
.customer-order-row b,
.customer-order-row small {
  display: block;
}

.customer-order-row small {
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.1fr) minmax(110px, 0.65fr) minmax(100px, 0.55fr) minmax(170px, 1fr) minmax(90px, 0.45fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--text);
  text-align: left;
  padding: 10px 12px;
}

.document-row.active {
  border-color: var(--brand);
  background: #e9f7f5;
}

.document-row span {
  min-width: 0;
}

.document-row strong,
.document-row b,
.document-row small {
  display: block;
}

.document-row small {
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-list {
  color: var(--muted);
  border: 1px dashed var(--line);
  padding: 14px;
  text-align: center;
}

.panel {
  min-width: 0;
  border: var(--erp-border-width) var(--erp-border-style) var(--erp-border);
  border-radius: var(--erp-radius-lg);
  background: var(--erp-surface);
  box-shadow: var(--erp-shadow-sm);
  padding: var(--erp-space-4);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  font-size: 18px;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.purchase-status-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.status-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-step {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7fafb;
  color: var(--text);
  padding: 7px 12px;
}

.status-step.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.status-total {
  display: grid;
  gap: 2px;
  min-width: 160px;
  text-align: right;
}

.status-total span {
  color: var(--muted);
  font-size: 13px;
}

.status-total strong {
  font-size: 22px;
}

.purchase-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.purchase-tabs .active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

.wide {
  grid-column: span 3;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.status-tile {
  background: #f7fafb;
  border-color: var(--line);
  color: var(--text);
  padding: 11px 8px;
}

.status-tile.active {
  background: var(--brand);
  color: #fff;
}

.summary-box {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.summary-box div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}

.summary-box span {
  color: var(--muted);
}

.items-panel {
  margin-top: 14px;
}

.candidate-panel {
  margin-top: 14px;
}

.demand-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(180px, 0.7fr);
  gap: 12px;
  margin-bottom: 10px;
}

.source-summary {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px 12px;
}

.source-summary span,
.source-summary strong {
  display: block;
}

.source-summary span {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.candidate-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.candidate-source-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.candidate-source-toggle .active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand);
  font-weight: 700;
}

.candidate-direct-search {
  flex: 1 1 320px;
  max-width: 560px;
}

.candidate-direct-search input {
  width: 100%;
}

.master-actions .master-actions-more,
.bom-action-bar .bom-actions-more {
  display: none;
}

.master-actions .master-permanent-delete { margin-inline-start: 4px; }

.form-hint {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-soft, #f3f7f8);
  color: var(--muted, #64748b);
  font-size: 13px;
}

.product-list-shell { min-width: 0; }
.master-list-standard { min-width: 0; }
.product-picker-mobile-head { display: none; }
.product-picker-toggle,
.product-filter-toggle { display: none; }
.product-list-pane { display: flex; min-width: 0; height: clamp(430px, calc(100vh - 310px), 680px); flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.product-list-controls { position: sticky; top: 0; z-index: 2; display: grid; flex: 0 0 auto; gap: 9px; padding: 11px; border-bottom: 1px solid var(--line); background: #f8fbfa; }
.product-list-search { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 7px; border: 1px solid #b9cac4; border-radius: 8px; background: #fff; padding: 0 9px; }
.product-list-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 119, 124, .11); }
.product-list-search .action-icon { width: 17px; color: var(--muted); }
.product-list-search > .tf-icon { color: var(--muted); }
.product-list-search input { min-width: 0; border: 0; outline: 0; box-shadow: none; padding-inline: 0; }
.product-list-search button { border: 0; background: transparent; color: var(--muted); font-size: 20px; }
.product-list-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.product-list-filters label { display: grid; min-width: 0; gap: 3px; }
.product-list-filters label span { margin: 0; font-size: 11px; }
.product-list-filters select { min-width: 0; height: 34px; padding: 5px 7px; font-size: 12px; }
.product-result-count { color: var(--muted); font-size: 12px; }
.product-list-results { display: grid; min-height: 0; align-content: start; gap: 7px; overflow-y: auto; overscroll-behavior: contain; padding: 9px; }
.product-master-row { gap: 3px; border-radius: 8px; padding: 11px 12px; }
.product-master-row strong { overflow-wrap: anywhere; }
.product-master-row span { color: var(--muted); font-size: 12px; }
.product-master-row small { color: var(--brand); }
.product-master-row mark { border-radius: 3px; background: #fff0a8; color: inherit; padding: 0 1px; }
.product-master-row.keyboard-focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.product-list-empty { display: grid; place-items: center; gap: 5px; min-height: 180px; color: var(--muted); text-align: center; }
.product-list-empty strong { color: var(--text); }
.product-load-more { width: 100%; margin-top: 2px; }
.master-list.product-master-list,
.master-list.master-standard-list { max-height: none; overflow: hidden; }

/* 組成零件：以單一產品、草稿後儲存為核心的操作區 */
.bom-panel { min-width: 0; max-width: 100%; overflow: visible; }
.bom-workspace { display: grid; min-width: 0; gap: 16px; margin-top: 18px; }
.bom-explorer-editor { display: grid; min-width: 0; grid-template-columns: minmax(320px, 360px) minmax(0, 1fr); gap: 16px; margin-top: 18px; align-items: start; }
.bom-product-explorer { display: flex; height: clamp(500px, calc(100vh - 300px), 760px); min-height: 0; flex-direction: column; overflow: hidden; border: 1px solid #dbe5e1; border-radius: 14px; background: #fff; }
.bom-product-explorer .product-list-controls { background: #f8fbfa; }
.bom-product-explorer-results { display: grid; min-height: 0; align-content: start; gap: 4px; overflow-y: auto; overscroll-behavior: contain; padding: 5px 8px 10px; }
.bom-product-explorer .bom-choice { border: 1px solid transparent; }
.bom-product-explorer .bom-choice.active { border-color: #8ebcab; }
.bom-editor { display: grid; min-width: 0; gap: 16px; }
.bom-card { min-width: 0; max-width: 100%; box-sizing: border-box; border: 1px solid #dbe5e1; border-radius: 16px; background: #fff; padding: 20px; box-shadow: 0 5px 18px rgba(31, 70, 57, .06); }
.bom-section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.bom-section-heading > div { display: flex; align-items: flex-start; gap: 12px; }
.bom-section-heading h3, .bom-section-heading p { margin: 0; }
.bom-section-heading p { color: #687b74; font-size: 13px; margin-top: 4px; }
.bom-primary-actions { display: flex; flex: 1 1 280px; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.bom-step { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; background: #e4f2ec; color: #176b4d; font-weight: 800; }
.bom-product-combobox { position: relative; max-width: 760px; }
.bom-search-input { display: flex; align-items: center; gap: 10px; min-height: 46px; border: 1px solid #bccdc6; border-radius: 11px; padding: 0 13px; background: #fff; }
.bom-search-input:focus-within { border-color: var(--erp-primary); box-shadow: var(--erp-shadow-focus); }
.bom-search-input .action-icon { width: 19px; color: #587068; }
.bom-search-input input { width: 100%; border: 0; outline: 0; box-shadow: none; padding: 10px 0; background: transparent; }
.bom-choice-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0; max-height: min(420px, 55vh); overflow: auto; border: 1px solid #cddbd6; border-radius: 12px; padding: 6px; background: #fff; box-shadow: 0 18px 45px rgba(25, 55, 45, .18); }
.bom-choice { display: grid; width: 100%; gap: 2px; padding: 11px 12px; border: 0; border-radius: 9px; background: transparent; color: inherit; text-align: left; }
.bom-choice:hover, .bom-choice.active { background: #edf7f3; }
.bom-choice span, .bom-choice small { color: #64756f; font-weight: 400; }
.bom-choice small { color: #27805f; }
.bom-choice-empty, .bom-dialog-empty { padding: 24px 16px; color: #667872; text-align: center; }
.bom-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.bom-summary > div { display: grid; gap: 5px; padding: 17px 20px; border-right: 1px solid #e3ebe8; }
.bom-summary > div:last-child { border-right: 0; }
.bom-summary span { color: #6c7d77; font-size: 12px; }
.bom-summary strong { overflow-wrap: anywhere; }
.bom-empty-selection { text-align: center; color: #52665f; }
.bom-list-head, .bom-item { display: grid; grid-template-columns: 68px minmax(220px, 2fr) 100px 100px minmax(150px, 1fr) 90px 52px; gap: 10px; align-items: center; }
.bom-list-head { padding: 0 10px 9px; color: #667872; font-size: 12px; font-weight: 700; }
.bom-list-body { display: grid; gap: 8px; }
.bom-item { min-width: 0; border: 1px solid #dce7e3; border-radius: 12px; padding: 10px; background: #fbfdfc; }
.bom-item > * { min-width: 0; }
.bom-item:focus-within { border-color: #8eb9aa; }
.bom-sequence { display: flex; align-items: center; gap: 8px; }
.bom-sequence strong { min-width: 25px; text-align: center; }
.drag-handle { display: inline-flex; color: #80938c; cursor: grab; }
.bom-part-identity { display: grid; min-width: 0; gap: 3px; }
.bom-part-identity strong, .bom-part-identity span, .bom-part-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bom-part-identity span { color: #60736c; font-size: 13px; }
.bom-part-identity small { color: #27805f; }
.bom-item label > span { display: none; }
.bom-item input { width: 100%; min-width: 0; }
.bom-card-list .bom-item { grid-template-columns: 48px minmax(0, 1fr); align-items: start; gap: 12px; padding: 14px; }
.bom-item-fact { display: grid; gap: 4px; }
.bom-item-fact small, .bom-part-identity > small:first-child { color: #71827c; font-size: 11px; }
.bom-card-fields { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(120px, .6fr) minmax(180px, 1.4fr); gap: 12px; }
.bom-card-field { display: grid; min-width: 0; gap: 5px; }
.bom-card-field > span:first-child { display: block; color: #52675f; font-size: 12px; font-weight: 700; }
.bom-card-field input { width: 100%; min-width: 0; }
.bom-card-field > .bom-quantity-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.bom-quantity-control b { min-width: 38px; color: #52675f; font-size: 13px; font-weight: 700; }
.bom-card-actions { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
.bom-inline-editor { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; border-radius: 10px; background: #eef6f2; }
.bom-inline-editor label { display: grid; gap: 5px; }
.bom-inline-editor label > span { display: block; color: #52675f; font-size: 12px; font-weight: 700; }
.bom-inline-editor label > small { color: #667a72; }
.bom-order-actions { display: flex; gap: 4px; }
.bom-order-actions button { min-width: 38px; min-height: 38px; padding-inline: 8px; }
.bom-delete { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #ead1d1; border-radius: 9px; background: #fff7f7; color: #a63c3c; }
.bom-delete .tf-icon { width: 17px; height: 17px; }
.bom-empty-state { display: grid; place-items: center; gap: 7px; padding: 48px 20px; border: 1px dashed #b9cbc4; border-radius: 12px; color: #60736c; }
.bom-empty-state .tf-icon { width: 34px; height: 34px; margin-bottom: 3px; color: #7c9b90; }
.bom-empty-state strong { color: #304b41; }
.bom-action-bar { position: sticky; z-index: 15; bottom: 12px; display: flex; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid #d4e1dc; border-radius: 14px; background: rgba(255, 255, 255, .94); box-shadow: 0 12px 30px rgba(25, 55, 45, .14); backdrop-filter: blur(8px); }
.bom-action-bar > div { display: flex; gap: 9px; }
.modal-backdrop { position: fixed; z-index: var(--erp-z-overlay); inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(19, 35, 30, .48); }
.bom-dialog { display: grid; width: min(820px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: hidden; border-radius: var(--erp-radius-lg); background: var(--erp-surface); box-shadow: var(--erp-shadow-md); }
.bom-dialog > header, .bom-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; }
.bom-dialog > header { border-bottom: 1px solid #e0e8e5; }
.bom-dialog > footer { justify-content: flex-end; border-top: 1px solid #e0e8e5; }
.bom-dialog header h3, .bom-dialog header p { margin: 0; }
.bom-dialog header p { margin-top: 3px; color: #697b75; font-size: 13px; }
.modal-close { border: 0; background: transparent; color: #5c6e68; font-size: 28px; }
.bom-dialog > .bom-search-input, .bom-copy-source-select, .bom-copy-mode { margin: 14px 20px 0; }
.bom-picker-results { min-height: 120px; max-height: 390px; overflow: auto; margin: 14px 20px; border: 1px solid #dde7e3; border-radius: 11px; }
.part-picker-dialog { width: min(980px, 100%); height: min(760px, calc(100vh - 40px)); max-height: min(760px, calc(100vh - 40px)); min-height: 0; grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
.part-picker-controls { display: grid; gap: 10px; padding: 14px 20px 0; }
.part-picker-controls .bom-search-input { margin: 0; }
.part-picker-clear { display: grid; flex: 0 0 32px; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 8px; background: transparent; color: #60736c; font-size: 22px; }
.part-picker-clear:hover { background: #eef5f2; }
.part-picker-filters { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); gap: 9px; }
.part-picker-filters label { display: grid; gap: 4px; }
.part-picker-filters label span, .part-picker-show-added span, .part-picker-quantity span { color: #60736c; font-size: 12px; font-weight: 700; }
.part-picker-show-added { display: flex; align-items: center; gap: 8px; width: max-content; }
.part-picker-show-added input { width: auto; }
.part-picker-count { padding: 10px 20px 0; color: #60736c; font-size: 13px; }
.part-picker-results { display: grid; min-height: 0; max-height: none; align-content: start; gap: 8px; margin-top: 8px; margin-bottom: 14px; padding: 8px 8px 36px; border: 0; background: #f5f8f7; overflow-y: auto; overscroll-behavior: contain; }
.part-picker-card { display: grid; grid-template-columns: minmax(190px, 1.05fr) minmax(330px, 1.8fr) 120px; align-items: center; gap: 14px; padding: 13px 14px; border: 1px solid #d9e5e1; border-radius: 10px; background: #fff; }
.part-picker-card.is-added { background: #f0f3f2; color: #71807b; }
.part-picker-select { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
.part-picker-select input { flex: 0 0 auto; width: auto; margin-top: 3px; }
.part-picker-name { min-width: 0; color: #263f36; font-weight: 800; overflow-wrap: anywhere; }
.part-picker-card dl { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 7px 12px; margin: 0; }
.part-picker-card dl > div { min-width: 0; }
.part-picker-card dt { color: #71817b; font-size: 11px; }
.part-picker-card dd { margin: 2px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.part-picker-quantity { display: grid; gap: 4px; }
.part-picker-quantity input { width: 100%; }
.part-picker-added { color: #397e63; font-size: 12px; font-weight: 800; text-align: right; }
.part-picker-empty { display: grid; place-items: center; gap: 7px; min-height: 190px; padding: 24px; color: #667872; text-align: center; }
.part-picker-empty strong { color: #304b41; font-size: 16px; }
.part-picker-limit { padding: 12px; color: #667872; text-align: center; font-size: 12px; }
.part-picker-dialog > footer { min-height: 72px; justify-content: space-between; }
.part-picker-footer-summary { color: #60736c; font-size: 13px; font-weight: 800; }
.part-picker-footer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.bom-pick-row { display: grid; grid-template-columns: 24px minmax(220px, 1fr) 110px; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid #edf1ef; }
.bom-pick-row:last-child { border-bottom: 0; }
.bom-pick-row.disabled { background: #f4f6f5; color: #7b8984; }
.bom-pick-row em { color: #397e63; font-style: normal; text-align: right; }
.part-master-layout.bom-part-create-mode { grid-template-columns: minmax(0, 1fr); }
.part-master-layout.bom-part-create-mode .part-master-list-panel { display: none; }
.part-duplicate-warning { margin: 0 18px; border: 1px solid #e6c97a; border-radius: 10px; background: #fff9e8; color: #624f19; padding: 12px 14px; }
.part-duplicate-warning[hidden] { display: none; }
.part-duplicate-warning > div:first-child { display: grid; gap: 4px; }
.part-duplicate-warning span { color: #756124; }
.part-duplicate-list { display: grid; gap: 8px; margin-top: 10px; }
.part-duplicate-list article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid #eadcae; border-radius: 8px; background: #fffdf6; }
.part-duplicate-list article > div { display: grid; gap: 3px; min-width: 0; }
.part-duplicate-list article > div:last-child { display: flex; flex: 0 0 auto; flex-direction: row; gap: 7px; }
.part-duplicate-list small { color: #756124; }
.part-duplicate-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.part-delete-dialog dl { display: grid; gap: 5px; margin: 14px 0 0; }
.part-delete-dialog dl > div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px; }
.part-delete-dialog dt { color: var(--muted); }
.part-delete-dialog dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.part-delete-dialog ul { margin: 12px 0 0; padding-left: 20px; color: #8a3d3d; }
.bom-copy-source-select { display: grid; gap: 6px; }
.bom-copy-mode { display: flex; gap: 22px; border: 0; padding: 0; }
.bom-copy-mode legend { margin-bottom: 8px; color: #50645c; font-weight: 700; }
.bom-copy-mode label { display: flex; align-items: center; gap: 7px; }

.part-master-panel { border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 0; }
.part-master-layout { display: grid; min-width: 0; grid-template-columns: minmax(320px, 360px) minmax(0, 1fr); gap: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.part-master-list-panel, .part-master-form { min-width: 0; border: 0; border-radius: 0; background: #fff; }
.part-master-list-panel { display: flex; min-height: 0; flex-direction: column; overflow: hidden; }
.part-master-filters { position: sticky; top: 0; z-index: 2; display: grid; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); background: #fff; }
.part-master-list-panel > p { margin: 10px 14px 4px; color: var(--muted); font-size: 13px; }
.part-master-list { display: grid; min-height: 0; flex: 1 1 auto; align-content: start; gap: 6px; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.part-master-row { display: grid; gap: 4px; width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: inherit; text-align: left; }
.part-master-row:hover, .part-master-row.active { border-color: #a9cabb; background: #eef7f3; }
.part-master-row span, .part-master-row small { color: var(--muted); font-weight: 400; }
.part-master-row em { color: var(--brand); font-size: 11px; font-style: normal; }
.part-master-form { display: grid; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); align-content: stretch; overflow: hidden; border-left: 1px solid var(--line); }
.part-master-form .master-form-head { z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.part-master-form .master-form-head h3, .part-master-form .master-form-head small { margin: 0; }
.part-master-head-label { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 700; }
.part-master-quick-nav { z-index: 2; display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 18px; border-bottom: 1px solid #dce7e3; background: #f8fbfa; }
.part-master-quick-nav button { padding: 7px 11px; }
.part-master-quick-nav button.active { border-color: var(--brand); background: var(--soft); color: var(--brand); font-weight: 700; }
.part-master-editor-content { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px; }
.part-master-section { display: grid; min-width: 0; align-content: start; gap: 16px; padding: 0; border: 0; border-radius: 0; }
.part-master-section[hidden] { display: none; }
.part-master-section h4, .part-master-section p { margin: 0; }
.part-master-section > p { color: var(--muted); font-size: 13px; }
.part-supplier-list { display: grid; gap: 10px; }
.part-supplier-editor { display: grid; grid-template-columns: minmax(180px, 1.3fr) repeat(2, minmax(100px, .7fr)); gap: 9px; padding: 11px; border-radius: 9px; background: #f6f9f8; }
.part-supplier-editor label { display: grid; gap: 4px; }
.part-supplier-editor label span { color: #64776f; font-size: 11px; font-weight: 700; }
#addPartSupplier { justify-self: start; }
.part-usage-section { grid-template-columns: minmax(150px, .5fr) minmax(0, 1.5fr); align-items: start; }
.part-usage-list { display: flex; flex-wrap: wrap; gap: 8px; }
.part-usage-list button { display: grid; gap: 2px; text-align: left; }
.part-usage-list button span { color: var(--muted); font-size: 11px; }
.part-master-form .part-master-mobile-back { display: none; }
.part-bom-batch-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgb(15 23 42 / .42); }
.part-bom-batch-dialog { width: min(1040px, 100%); max-height: min(820px, calc(100vh - 32px)); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 18px 44px rgb(15 23 42 / .16); }
.part-bom-batch-dialog > header, .part-bom-batch-dialog > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: #fff; }
.part-bom-batch-dialog > header { border-bottom: 1px solid var(--line); }
.part-bom-batch-dialog > header h2, .part-bom-batch-dialog > header p { margin: 0; }
.part-bom-batch-dialog > header p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.part-bom-batch-dialog > footer { z-index: 2; border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgb(15 23 42 / .04); }
.part-bom-batch-dialog > footer > div { display: flex; gap: 8px; }
.part-bom-batch-body { min-height: 0; overflow-y: auto; padding: 16px; }
.part-bom-batch-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, auto)) auto; gap: 8px; align-items: end; }
.part-bom-batch-apply { display: grid; grid-template-columns: auto 120px 120px minmax(180px, 1fr) auto; gap: 8px; align-items: center; margin-top: 12px; padding: 12px; border-radius: 10px; background: #f6f9f8; }
.part-bom-batch-list { display: grid; gap: 8px; margin-top: 12px; padding-bottom: 8px; }
.part-bom-batch-row { padding: 12px; border-bottom: 1px solid var(--line); }
.part-bom-batch-row > label { display: flex; gap: 8px; align-items: flex-start; }
.part-bom-batch-row > label > span { min-width: 0; display: grid; gap: 2px; }
.part-bom-batch-row small, .part-bom-batch-row em { color: var(--muted); font-size: 13px; font-style: normal; }
.part-bom-batch-row.is-added { opacity: .68; }
.part-bom-batch-row.is-highlighted, .part-usage-list .is-highlighted { background: var(--soft); outline: 2px solid var(--brand); }
.part-bom-batch-fields { display: grid; grid-template-columns: 110px 110px minmax(180px, 1fr) 120px; gap: 8px; margin: 12px 0 0 28px; }
.part-bom-batch-fields label { display: grid; gap: 4px; }
.part-bom-batch-error { color: var(--danger); }

@media (min-width: 1101px) {
  /* The page, not the part editor, owns vertical scrolling. */
  .part-master-workspace { display: block; height: auto; min-height: 0; overflow: visible; }
  .part-master-workspace .part-master-panel { display: block; min-height: 0; overflow: visible; margin-bottom: 0; }
  .part-master-workspace .part-master-layout { height: auto; min-height: 0; overflow: visible; }
  .part-master-workspace .part-master-form { height: auto; min-height: 0; max-height: none; overflow: visible; }
  .part-master-workspace .part-master-editor-content { overflow-y: visible; overscroll-behavior: auto; }
}

@media (max-width: 900px) {
  .bom-explorer-editor { grid-template-columns: 1fr; }
  .bom-product-explorer { height: auto; max-height: 430px; }
  .bom-summary { grid-template-columns: repeat(2, 1fr); }
  .bom-summary > div { border-bottom: 1px solid #e3ebe8; }
  .bom-list-head { display: none; }
  .bom-item, .bom-card-list .bom-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .bom-sequence, .bom-part-identity { grid-column: 1 / -1; }
  .bom-part-identity strong, .bom-part-identity span, .bom-part-identity small { white-space: normal; }
  .bom-item label { display: grid; gap: 4px; }
  .bom-item label > span { display: block; color: #687b74; font-size: 12px; }
  .bom-order-actions { justify-self: start; }
  .bom-delete { justify-self: end; }
  .bom-card-actions, .bom-inline-editor { grid-column: 1 / -1; }
  .bom-card-actions { justify-content: flex-start; }
  .bom-card-fields { grid-column: 1 / -1; }
  .bom-inline-editor { grid-template-columns: 1fr 1fr; }
  .bom-inline-editor .wide { grid-column: 1 / -1; }
  .part-master-panel { padding: 0; }
  .part-master-layout { display: block; overflow: visible; border: 0; background: transparent; }
  .part-master-list-panel { max-height: 520px; border: 1px solid var(--line); border-radius: 12px; }
  .part-master-form { display: none; min-height: min(680px, calc(100dvh - 120px)); border: 1px solid var(--line); border-radius: 12px; }
  .part-master-layout.mobile-editor-open .part-master-list-panel { display: none; }
  .part-master-layout.mobile-editor-open .part-master-form { display: grid; }
  .part-master-form .part-master-mobile-back { display: inline-flex; }
  .part-supplier-editor { grid-template-columns: 1fr 1fr; }
  .part-usage-section { grid-template-columns: 1fr; }
  .part-bom-batch-toolbar, .part-bom-batch-apply, .part-bom-batch-fields { grid-template-columns: 1fr; }
  .part-bom-batch-fields { margin-left: 28px; }
}

@media (max-width: 600px) {
  .part-bom-batch-backdrop { padding: 0; }
  .part-bom-batch-dialog { width: 100%; min-height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .part-bom-batch-dialog > header, .part-bom-batch-dialog > footer { padding: 12px; }
  .part-bom-batch-dialog > footer { align-items: stretch; }
  .part-bom-batch-dialog > footer > div { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .bom-explorer-editor { gap: 12px; margin-top: 12px; }
  .bom-product-explorer { max-height: 360px; }
  .master-danger-backdrop { align-items: end; padding: 8px; }
  .master-danger-dialog { padding: 18px; border-radius: 15px; }
  .master-danger-dialog footer { display: grid; grid-template-columns: 1fr 1fr; }
  .master-danger-dialog footer button { width: 100%; }
  .bom-card { padding: 15px; }
  .bom-section-heading { align-items: stretch; flex-direction: column; }
  .bom-section-heading > .tf-action-button { width: 100%; }
  .bom-section-heading > .tf-icon-button { align-self: flex-end; }
  .bom-primary-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .bom-primary-actions .tf-action-button { width: 100%; min-height: 44px; }
  .bom-summary { grid-template-columns: 1fr; padding: 0; }
  .bom-summary > div { padding: 13px 15px; border-right: 0; }
  .bom-action-bar { bottom: 6px; align-items: center; flex-direction: row; }
  .bom-action-bar > div { width: auto; }
  .bom-action-bar .bom-action-secondary { display: none; }
  .bom-action-bar .bom-actions-more { display: inline-flex; }
  .modal-backdrop { padding: 8px; }
  .bom-dialog { max-height: calc(100vh - 16px); border-radius: 13px; }
  .part-picker-dialog { height: calc(100vh - 16px); max-height: calc(100vh - 16px); }
  .bom-dialog > header, .bom-dialog > footer { padding: 13px 14px; }
  .bom-dialog > .bom-search-input, .bom-copy-source-select, .bom-copy-mode, .bom-picker-results { margin-left: 14px; margin-right: 14px; }
  .part-picker-dialog { width: 100%; }
  .part-picker-controls { padding: 12px 14px 0; }
  .part-picker-filters { grid-template-columns: 1fr; }
  .part-picker-count { padding: 9px 14px 0; }
  .part-picker-results { margin: 10px 14px 12px; padding: 6px 6px 30px; }
  .part-picker-card { grid-template-columns: 1fr; gap: 10px; padding: 12px; }
  .part-picker-card dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .part-picker-quantity, .part-picker-added { width: 100%; text-align: left; }
  .part-picker-dialog > footer { display: grid; grid-template-columns: 1fr; gap: 9px; }
  .part-picker-footer-actions { display: grid; grid-template-columns: 1fr 1.4fr; width: 100%; }
  .part-picker-dialog > footer button { width: 100%; }
  .bom-pick-row { grid-template-columns: 22px minmax(0, 1fr); }
  .bom-pick-row > input[type="number"], .bom-pick-row > em, .bom-pick-row > span:last-child { grid-column: 2; width: 100%; text-align: left; }
  .part-duplicate-warning { margin: 0 12px; }
  .part-duplicate-list article { align-items: stretch; flex-direction: column; }
  .part-duplicate-list article > div:last-child { display: grid; }
  .part-duplicate-actions > button { width: 100%; justify-content: center; }
  .part-delete-dialog footer { grid-template-columns: 1fr; }
  .bom-card-list .bom-item { grid-template-columns: 1fr; }
  .bom-card-list .bom-item > *, .bom-card-fields, .bom-inline-editor, .bom-inline-editor .wide { grid-column: 1; }
  .bom-card-fields { grid-template-columns: 1fr; }
  .bom-card-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .bom-card-actions > .tf-action-button { width: 100%; }
  .bom-inline-editor { grid-template-columns: 1fr; }
  .part-master-form .master-form-head { align-items: flex-start; flex-direction: column; padding: 12px; }
  .part-master-form .master-actions { width: 100%; justify-content: flex-start; }
  .part-master-quick-nav { flex-wrap: nowrap; overflow-x: auto; padding: 9px 12px; }
  .part-master-editor-content { padding: 16px 12px; }
  .part-supplier-editor { grid-template-columns: 1fr; }
  .master-actions .master-permanent-delete { margin-inline-start: 0; }
}

.candidate-view-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.candidate-view-toggle .active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand);
  font-weight: 700;
}

.candidate-list {
  display: grid;
  gap: 8px;
}

.candidate-row {
  display: grid;
  grid-template-columns: 28px minmax(220px, 1fr) 80px 130px 130px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 10px 12px;
}

.candidate-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.candidate-row strong,
.candidate-row small,
.candidate-row b {
  display: block;
}

.candidate-row small {
  color: var(--muted);
}

.candidate-row .candidate-qty,
.candidate-row .candidate-price {
  margin-top: 3px;
  padding: 6px 7px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

.edit-table {
  min-width: 1180px;
}

.customer-order-table {
  min-width: 1120px;
  table-layout: fixed;
}

.customer-order-table th:nth-child(1),
.customer-order-table td:nth-child(1) {
  width: 46px;
}

.customer-order-table th:nth-child(2),
.customer-order-table td:nth-child(2) {
  width: 130px;
}

.customer-order-table th:nth-child(3),
.customer-order-table td:nth-child(3) {
  width: 260px;
}

.customer-order-table th:nth-child(4),
.customer-order-table td:nth-child(4) {
  width: 210px;
}

.customer-order-table th:nth-child(5),
.customer-order-table td:nth-child(5),
.customer-order-table th:nth-child(6),
.customer-order-table td:nth-child(6),
.customer-order-table th:nth-child(7),
.customer-order-table td:nth-child(7) {
  width: 96px;
}

.customer-order-table th:nth-child(8),
.customer-order-table td:nth-child(8) {
  width: 112px;
}

.customer-order-table th:nth-child(9),
.customer-order-table td:nth-child(9) {
  width: 48px;
}

.customer-order-table input,
.customer-order-table .erp-entity-picker-trigger {
  width: 100%;
  min-width: 0;
  padding: 7px;
}

.customer-order-product-field {
  min-width: 0;
}

.edit-table th:nth-child(1),
.edit-table td:nth-child(1) {
  width: 64px;
}

.edit-table th:nth-child(2),
.edit-table td:nth-child(2) {
  width: 120px;
}

.edit-table th:nth-child(3),
.edit-table td:nth-child(3) {
  width: 280px;
}

.edit-table th:nth-child(4),
.edit-table td:nth-child(4) {
  width: 390px;
}

.edit-table th:nth-child(5),
.edit-table td:nth-child(5),
.edit-table th:nth-child(6),
.edit-table td:nth-child(6),
.edit-table th:nth-child(7),
.edit-table td:nth-child(7) {
  width: 92px;
}

.edit-table th:nth-child(8),
.edit-table td:nth-child(8) {
  width: 120px;
}

.edit-table th:nth-child(9),
.edit-table td:nth-child(9) {
  width: 48px;
  text-align: center;
}

.edit-table input {
  padding: 7px;
}

.edit-table .purchase-discount-row td {
  background: #f7f9f8;
}

.edit-table .purchase-discount-row input[readonly] {
  color: var(--muted);
  background: transparent;
}

.amount,
.num {
  text-align: right;
  white-space: nowrap;
}

.icon-button {
  width: 34px;
  height: 34px;
  background: #fff;
  border-color: var(--line);
}

.icon-button.danger {
  color: var(--danger);
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.55fr) minmax(0, 1.45fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.upload-box {
  display: grid;
  place-items: center;
  border: 1px dashed #9db0ba;
  border-radius: 8px;
  min-height: 84px;
  background: #fbfcfd;
}

.upload-box input {
  display: none;
}

.upload-box span {
  color: var(--brand);
  font-weight: 700;
  margin: 0;
}

.note-images,
.sheet-image-row {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.note-image {
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: #fff;
}

.candidate-row--direct {
  align-items: start;
}

.note-image img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #fff;
}

.empty-note {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
}

.purchase-sheet {
  color: #111;
  border: 1px solid #b8c0c5;
  background: #fff;
  box-sizing: border-box;
  width: 210mm;
  min-width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 10mm;
}

.preview-panel {
  overflow-x: auto;
  padding-bottom: 12px;
}

.shipment-preview-panel {
  display: grid;
  gap: 14px;
}

.print-option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 8px 10px;
}

.print-option-toggle input {
  width: 18px;
  height: 18px;
}

.print-option-toggle span {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.shipment-print-options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.print-size-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  padding: 8px 10px;
}

.print-size-control input {
  width: 74px;
  padding: 5px 7px;
}

.print-size-control span {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.shipment-column-controls {
  margin: -2px 0 14px;
}

.shipment-column-controls summary {
  cursor: pointer;
  color: var(--teal);
  font-weight: 700;
  margin-bottom: 8px;
}

.shipment-column-controls p {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.shipment-preview-note-control {
  display: grid;
  gap: 6px;
  max-width: 760px;
  margin: -2px 0 12px;
  color: var(--muted);
}

.shipment-preview-note-control textarea {
  min-height: 56px;
  resize: vertical;
}

.shipment-sheet {
  --shipment-heavy-line: 2.1pt;
  --shipment-thin-line: 1pt;
  --shipment-font-size: 12pt;
  --shipment-company-title-size: 16pt;
  --shipment-company-info-size: 10pt;
  --shipment-document-title-size: 15pt;
  --shipment-col-item: 42pt;
  --shipment-col-name: 229pt;
  --shipment-col-qty: 58pt;
  --shipment-col-unit: 44pt;
  --shipment-col-price: 58pt;
  --shipment-col-amount: 58pt;
  --shipment-col-note: 92pt;
  width: 609pt;
  min-height: 390pt;
  height: auto;
  border: 0;
  background: #fff;
  color: #000;
  box-sizing: border-box;
  padding: 6pt 14pt 4pt;
  font-family: "Microsoft JhengHei", Arial, sans-serif;
  font-size: var(--shipment-font-size);
  overflow: visible;
  break-after: auto;
  page-break-after: auto;
}

.shipment-sheet * {
  color: #000;
}

.shipment-preview-panel .shipment-sheet:not(:last-of-type) {
  break-after: page;
  page-break-after: always;
}

.shipment-sheet-head {
  display: block;
  text-align: center;
  padding-bottom: 1pt;
}

.shipment-sheet-head h2,
.shipment-sheet-head h3,
.shipment-sheet-head p {
  margin: 0;
}

.shipment-sheet-head h2 {
  font-size: var(--shipment-company-title-size);
  line-height: 1.05;
}

.shipment-sheet-head h3 {
  font-size: var(--shipment-document-title-size);
  line-height: 1.05;
  text-align: center;
  letter-spacing: 0;
  margin-top: 1pt;
}

.shipment-sheet-head p {
  font-size: var(--shipment-company-info-size);
  line-height: 1.1;
  margin-top: 1pt;
}

.shipment-sheet-title-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  position: relative;
  font-size: calc(var(--shipment-font-size) * 1.05);
  line-height: 1.1;
  margin-top: 1pt;
}

.shipment-sheet-title-row p {
  margin: 0;
}

.shipment-sheet-title-row p:nth-child(2) {
  position: absolute;
  left: 50%;
  bottom: 0;
  text-align: center;
  transform: translateX(-50%);
  white-space: nowrap;
}

.shipping-list-layout .erp-list-content {
  max-height: none;
  overflow: visible;
  gap: 14px;
}

.shipping-toolbar-context {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 44px;
}

.shipping-toolbar-context span,
.shipping-cell--status > small,
.shipping-cell--receivable > small {
  color: var(--muted);
  font-size: 12px;
}

.shipping-toolbar-context strong {
  color: var(--brand-dark);
}

.shipping-list-layout .erp-list-cell > b,
.shipping-list-layout .erp-list-cell > small {
  display: block;
}

.shipping-list-layout .erp-list-status {
  margin-top: 4px;
}

.shipping-source-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
}

.shipping-source-action .tf-icon {
  flex: 0 0 auto;
}

.shipping-company-context .company-tile {
  min-height: 44px;
}

.shipment-sheet-title-row p:nth-child(3) {
  grid-column: 2;
  text-align: right;
}

.shipment-sheet-meta {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1pt 10pt;
  border: var(--shipment-heavy-line) solid #111;
  border-bottom: 0;
  padding: 2pt 4pt 3pt;
  min-height: 46pt;
  font-size: calc(var(--shipment-font-size) * 0.84);
  line-height: 1.05;
}

.shipment-sheet-meta p {
  margin: 0;
  min-height: 10pt;
}

.shipment-sheet-meta p:nth-child(1),
.shipment-sheet-meta p:nth-child(5) {
  grid-column: span 4;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.shipment-sheet-meta p:nth-child(2),
.shipment-sheet-meta p:nth-child(6) {
  grid-column: span 2;
}

.shipment-sheet-meta p:nth-child(3),
.shipment-sheet-meta p:nth-child(4),
.shipment-sheet-meta p:nth-child(7),
.shipment-sheet-meta p:nth-child(8) {
  grid-column: span 3;
}

.shipment-sheet-meta p.shipment-sheet-tax,
.shipment-sheet-meta p.shipment-sheet-invoice {
  grid-column: span 3;
}

.shipment-sheet-meta p.shipment-sheet-address {
  grid-column: span 6;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.shipment-sheet-table {
  width: 100%;
  box-sizing: border-box;
  border-collapse: collapse;
  table-layout: fixed;
  border: var(--shipment-heavy-line) solid #111;
}

.shipment-sheet-table th,
.shipment-sheet-table td {
  border-left: var(--shipment-heavy-line) solid #111;
  border-right: var(--shipment-heavy-line) solid #111;
  height: 17pt;
  padding: 1pt 4pt;
  vertical-align: middle;
  overflow: hidden;
}

.shipment-sheet-table th {
  border-top: var(--shipment-heavy-line) solid #111;
  border-bottom: var(--shipment-heavy-line) solid #111;
  font-weight: 700;
  font-size: calc(var(--shipment-font-size) * 0.9);
  text-align: center;
}

.shipment-sheet-table th:nth-child(1),
.shipment-sheet-table td:nth-child(1) {
  width: var(--shipment-col-item);
  text-align: center;
}

.shipment-sheet-table th:nth-child(2),
.shipment-sheet-table td:nth-child(2) {
  width: var(--shipment-col-name);
}

.shipment-sheet-table th:nth-child(5),
.shipment-sheet-table td:nth-child(5),
.shipment-sheet-table th:nth-child(6),
.shipment-sheet-table td:nth-child(6) {
  width: var(--shipment-col-price);
  text-align: center;
}

.shipment-sheet-table th:nth-child(6),
.shipment-sheet-table td:nth-child(6) {
  width: var(--shipment-col-amount);
}

.shipment-sheet-table th:nth-child(3),
.shipment-sheet-table td:nth-child(3) {
  width: var(--shipment-col-qty);
  text-align: center;
}

.shipment-sheet-table th:nth-child(4),
.shipment-sheet-table td:nth-child(4) {
  width: var(--shipment-col-unit);
  text-align: center;
}

.shipment-sheet-table th:nth-child(7),
.shipment-sheet-table td:nth-child(7) {
  width: var(--shipment-col-note);
}

.shipment-sheet-table tbody tr {
  height: 20pt;
  max-height: 20pt;
}

.shipment-sheet-table tbody td {
  border-top: 0;
  border-bottom: 0;
  vertical-align: top;
  padding-top: 2pt;
  font-size: calc(var(--shipment-font-size) * 1.02);
  line-height: 1.08;
}

.shipment-sheet-table tbody td:nth-child(5),
.shipment-sheet-table tbody td:nth-child(6) {
  text-align: center;
  padding-left: 4pt;
}

.shipment-sheet-table tbody td.shipment-sheet-line-note {
  overflow: hidden;
  white-space: normal;
  text-align: left;
  font-size: calc(var(--shipment-font-size) * 0.86);
  line-height: 1.15;
  padding-left: 5pt;
  padding-right: 3pt;
}

.shipment-sheet-table tbody td.shipment-sheet-line-note div {
  display: block;
  max-height: 190pt;
  overflow: hidden;
}

.shipment-sheet-table tfoot td {
  border-top: var(--shipment-heavy-line) solid #111;
  border-bottom: var(--shipment-heavy-line) solid #111;
  height: 14pt;
  font-size: var(--shipment-font-size);
  text-align: left;
  padding-left: 5pt;
}

.shipment-sheet-footer {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12pt;
  margin-top: 2pt;
  font-size: var(--shipment-font-size);
}

.shipment-sheet-footer span {
  border-bottom: 0;
  min-height: 12pt;
}

.shipping-action-modal {
  width: min(640px, calc(100vw - 48px));
}

.purchase-pdf-name-dialog {
  width: min(600px, calc(100vw - 48px));
}

.shipment-void-dialog {
  width: min(640px, calc(100vw - 48px));
}

.shipping-action-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.shipping-action-modal__header h2 {
  margin: 2px 0 0;
  font-size: 22px;
  line-height: 1.25;
}

.shipping-action-modal__eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.shipping-action-modal__body {
  display: grid;
  gap: 18px;
}

.purchase-price-locked {
  cursor: pointer;
  background: var(--erp-surface-subtle, #f7faf9);
  color: var(--muted);
}

.purchase-price-locked:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(12 128 133 / 14%);
}

.purchase-receiving-lock-message {
  margin: 0;
  line-height: 1.65;
}

.purchase-receiving-reference-list {
  display: grid;
  gap: 8px;
}

.purchase-receiving-reference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--erp-radius-md);
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.purchase-receiving-reference:hover,
.purchase-receiving-reference:focus-visible {
  border-color: var(--primary);
  background: var(--erp-surface-subtle, #f7faf9);
}

.purchase-receiving-reference > span {
  display: grid;
  gap: 3px;
}

.purchase-receiving-reference small {
  color: var(--muted);
}

.shipping-confirm-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.shipping-confirm-summary > div {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--erp-radius-md);
  background: var(--erp-surface-subtle, #f7faf9);
}

.shipping-confirm-summary dt {
  color: var(--muted);
  font-size: 12px;
}

.shipping-confirm-summary dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 700;
}

.shipping-confirm-summary__total {
  grid-column: 1 / -1;
}

.shipping-confirm-summary__total dd {
  color: var(--brand-dark);
  font-size: 20px;
}

.shipping-modal-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
  border-radius: var(--erp-radius-md);
  background: color-mix(in srgb, var(--brand) 6%, #fff);
  color: var(--text);
  line-height: 1.5;
}

.shipping-modal-alert .tf-icon {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--brand);
}

.shipment-void-impact {
  border-color: color-mix(in srgb, var(--erp-danger, #b42318) 28%, var(--border));
  background: color-mix(in srgb, var(--erp-danger, #b42318) 6%, #fff);
}

.shipment-void-impact .tf-icon {
  color: var(--erp-danger, #b42318);
}

.shipment-void-impact strong {
  display: block;
  margin-bottom: 4px;
}

.shipment-void-impact ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.shipment-void-form {
  display: grid;
  gap: 14px;
}

.shipment-void-form label {
  display: grid;
  gap: 7px;
}

.shipment-void-form label > span {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 700;
}

.shipment-void-form label > span strong {
  color: var(--erp-danger, #b42318);
}

.shipment-void-form label > span small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.shipment-void-form input,
.shipment-void-form select,
.shipment-void-form textarea {
  width: 100%;
}

.shipment-void-form__help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.shipment-void-form .erp-field-error {
  color: var(--erp-danger, #b42318);
  font-size: 13px;
  line-height: 1.45;
}

.shipping-pdf-name-field {
  display: grid;
  gap: 7px;
}

.shipping-pdf-name-field > span {
  font-weight: 700;
}

.shipping-pdf-name-field input {
  width: 100%;
}

.purchase-pdf-name-intro {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.purchase-pdf-name-field > span {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.purchase-pdf-name-field > span strong {
  color: var(--erp-danger, #b42318);
  font-weight: 700;
}

.purchase-pdf-name-field > small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.purchase-pdf-name-field > small.erp-field-error {
  color: var(--erp-danger, #b42318);
}

.shipping-pdf-name-help {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.shipment-edit-table th:nth-child(2),
.shipment-edit-table td:nth-child(2) {
  min-width: 300px;
}

.shipment-edit-table {
  min-width: 1120px;
}

.shipment-edit-table th:nth-child(1),
.shipment-edit-table td:nth-child(1) {
  width: 50px;
}

.shipment-edit-table th:nth-child(2),
.shipment-edit-table td:nth-child(2) {
  width: 330px;
}

.shipment-edit-table th:nth-child(3),
.shipment-edit-table td:nth-child(3) {
  width: 260px;
}

.shipment-edit-table th:nth-child(4),
.shipment-edit-table td:nth-child(4),
.shipment-edit-table th:nth-child(5),
.shipment-edit-table td:nth-child(5),
.shipment-edit-table th:nth-child(6),
.shipment-edit-table td:nth-child(6) {
  width: 92px;
}

.shipment-edit-table th:nth-child(7),
.shipment-edit-table td:nth-child(7) {
  width: 120px;
}

.shipment-edit-table th:nth-child(8),
.shipment-edit-table td:nth-child(8) {
  width: 110px;
}

.shipment-edit-table th:nth-child(9),
.shipment-edit-table td:nth-child(9) {
  width: 52px;
}

.shipment-display-name-input {
  width: 100%;
}

.shipment-item-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.shipment-item-cell .tf-icon-button { min-width: 36px; min-height: 36px; }

.shipment-unit-price-field {
  display: grid;
  gap: 4px;
}

.shipment-unit-price-field small {
  color: var(--warning-text, #9a5b00);
  font-size: 11px;
  line-height: 1.3;
}

.shipment-inventory-disabled {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.shipment-amount-output[readonly] {
  background: var(--surface-soft, #f3f7f8);
  color: var(--text);
  text-align: right;
  cursor: default;
}

@media (max-width: 560px) {
  .shipment-edit-table { display: block; min-width: 0; }
  .shipment-edit-table thead { display: none; }
  .shipment-edit-table tbody { display: grid; gap: 10px; }
  .shipment-edit-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  .shipment-edit-table tbody td { display: block; width: auto !important; min-width: 0 !important; padding: 0; border: 0; }
  .shipment-edit-table tbody td::before { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
  .shipment-edit-table tbody td:nth-child(1)::before { content: "項次"; }
  .shipment-edit-table tbody td:nth-child(2)::before { content: "品名"; }
  .shipment-edit-table tbody td:nth-child(3)::before { content: "規格／型號"; }
  .shipment-edit-table tbody td:nth-child(4)::before { content: "數量"; }
  .shipment-edit-table tbody td:nth-child(5)::before { content: "單位"; }
  .shipment-edit-table tbody td:nth-child(6)::before { content: "單價"; }
  .shipment-edit-table tbody td:nth-child(7)::before { content: "金額"; }
  .shipment-edit-table tbody td:nth-child(2), .shipment-edit-table tbody td:nth-child(4) { grid-column: 1 / -1; }
  .shipment-edit-table tbody td:last-child { grid-column: 2; justify-self: end; }
  .shipment-edit-table .shipment-display-name-input { min-width: 0; }
}

.item-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.45);
}

.item-picker-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 41;
  width: min(760px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  padding: 18px;
}

.item-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.item-picker-header p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.item-picker-header h2 {
  margin: 0;
  font-size: 22px;
}

.item-picker-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.segmented-button.active {
  border-color: var(--brand);
  background: var(--soft);
  color: var(--brand-dark);
}

.item-picker-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.item-picker-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.item-picker-row {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.item-picker-row:hover {
  border-color: var(--brand);
  background: #f7fcfb;
}

.item-picker-row strong {
  color: var(--ink);
  font-size: 16px;
}

.item-picker-row span {
  color: var(--muted);
  font-size: 13px;
}

.item-picker-row .item-picker-name {
  color: var(--ink);
  font-size: 14px;
}

.item-picker-row .item-picker-company {
  color: var(--muted);
  font-size: 13px;
}

.item-picker-row em {
  color: var(--brand);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
}

.item-picker-custom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.advanced-fields {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px 12px;
}

.advanced-fields summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.advanced-fields .form-grid {
  margin-top: 10px;
}

.print-adjust-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 210mm;
  margin: 0 auto 12px;
  border: 1px solid #c8e3e0;
  border-radius: 8px;
  background: #f2faf8;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.print-adjust-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.print-adjust-field select {
  width: auto;
  min-width: 112px;
  height: 40px;
  border-color: #b9d8d5;
  background: #fff;
  padding: 6px 30px 6px 10px;
}

.print-adjust-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.print-adjust-tools .action-icon-button {
  width: 44px;
  height: 44px;
  border-color: #a9d3cf;
  background: #fff;
  color: #0b6970;
}

.print-adjust-tools .action-icon-button.primary {
  border-color: #0b6970;
  background: #dff4f1;
  color: #07575d;
}

.print-adjust-tools .action-icon-button:hover,
.print-adjust-tools .action-icon-button.primary:hover {
  background: #cdece8;
}

.print-adjust-tools .action-icon {
  width: 20px;
  height: 20px;
}

.print-adjust-hint {
  color: #5c7378;
}

.sheet-head {
  text-align: center;
}

.sheet-head h2,
.sheet-head h3,
.sheet-head p {
  margin: 0;
}

.sheet-head h2 {
  font-size: 24px;
}

.sheet-head p {
  margin-top: 4px;
}

.sheet-head h3 {
  margin-top: 8px;
  font-size: 20px;
  letter-spacing: 0;
}

.sheet-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  column-gap: 22px;
  margin: 16px 0 8px;
  font-size: 14px;
}

.sheet-meta p {
  margin: 0 0 6px;
}

.sheet-order-no {
  margin-bottom: 10px;
}

.expected-date-box {
  border: 2px solid #111;
  min-height: 58px;
  margin-top: 14px;
  align-self: start;
  padding: 8px 12px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.expected-date-box span {
  font-size: 14px;
  font-weight: 700;
}

.expected-date-box strong {
  font-size: 22px;
  font-weight: 800;
}

.preview-table {
  border: 1px solid #9aa4aa;
  font-size: var(--preview-detail-font-size, 16px);
  table-layout: fixed;
  width: 100%;
}

.preview-table th,
.preview-table td {
  border: 1px solid #9aa4aa;
  padding: 8px 7px;
  vertical-align: top;
}

.preview-table td {
  min-width: 0;
  max-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.preview-table th {
  position: relative;
  color: #111;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.preview-table th > span:first-child {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
}

.resizable-col {
  padding-right: 12px;
}

.col-resize-handle {
  position: absolute;
  top: 0;
  right: -8px;
  z-index: 2;
  width: 16px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.col-resize-handle::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 7px;
  border-left: 2px solid rgba(10, 122, 128, 0.45);
  opacity: 0;
  transition: opacity 150ms ease;
}

.resizable-col:hover .col-resize-handle::after,
.col-resize-handle:hover::after {
  opacity: 1;
}

.preview-table th:first-child,
.preview-table td:first-child {
  text-align: center;
}

.preview-table td:first-child,
.preview-table td:nth-last-child(-n + 4) {
  vertical-align: middle;
}

.preview-table td:nth-last-child(4),
.preview-table td:nth-last-child(2),
.preview-table td:last-child {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.preview-table td:nth-last-child(3) {
  text-align: center;
}

.preview-table .preview-cell-part-no,
.preview-table .preview-cell-name,
.preview-table .preview-cell-spec {
  white-space: normal;
}

.preview-table .preview-cell-qty,
.preview-table .preview-cell-unit,
.preview-table .preview-cell-price,
.preview-table .preview-cell-amount {
  white-space: nowrap;
}

.preview-table .preview-cell-qty,
.preview-table .preview-cell-price,
.preview-table .preview-cell-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.preview-table .preview-cell-unit {
  text-align: center;
}

.preview-col-item {
  width: 7%;
}

.preview-col-part-no {
  width: 12%;
}

.preview-col-name {
  width: 31%;
}

.preview-col-spec {
  width: 27%;
}

.preview-col-part-no + .preview-col-name {
  width: 25%;
}

.preview-col-part-no + .preview-col-name + .preview-col-spec {
  width: 20%;
}

.preview-col-qty {
  width: 9%;
}

.preview-col-unit {
  width: 7%;
}

.preview-col-price {
  width: 8%;
}

.preview-col-amount {
  width: 11%;
}

.quote-blank {
  min-width: 64px;
}

.sheet-note {
  position: relative;
  min-height: var(--preview-note-height, 120px);
  border: 1px solid #9aa4aa;
  border-top: 0;
  padding: 8px;
}

.note-resize-handle {
  position: absolute;
  right: 0;
  bottom: -5px;
  left: 0;
  height: 10px;
  cursor: row-resize;
  touch-action: none;
  user-select: none;
}

.note-resize-handle::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 4px;
  left: 12px;
  border-bottom: 2px solid rgba(10, 122, 128, 0.35);
  opacity: 0;
}

.sheet-note:hover .note-resize-handle::after,
.note-resize-handle:hover::after {
  opacity: 1;
}

.print-resizing,
.print-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.sheet-note p {
  margin: 8px 0 0;
}

.note-lines {
  margin-top: 8px;
}

.note-lines p {
  margin: 4px 0;
  line-height: 1.55;
}

.long-spec-notes {
  margin-top: 8px;
}

.long-spec-notes p {
  margin: 4px 0;
}

.sheet-image-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.sheet-image-row .note-image {
  max-width: 360px;
}

.sheet-image-row .note-image img {
  max-height: 260px;
}

.sheet-total {
  display: grid;
  gap: 8px;
  border: 1px solid #9aa4aa;
  border-top: 0;
  padding: 12px 8px;
}

.sheet-total div {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 20px;
}

.sheet-total strong {
  text-align: right;
}

.sheet-footer {
  display: grid;
  grid-template-columns: 190px 190px;
  gap: 120px;
  margin-top: 18px;
  font-size: 16px;
}

.work-queue-workspace {
  align-content: start;
}

.work-queue-company {
  margin-bottom: 8px;
}

.work-queue-context {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.work-queue-context strong {
  color: var(--text);
}

.work-queue-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.work-queue-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  min-width: 0;
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
}

button.work-queue-card {
  cursor: pointer;
}

button.work-queue-card:hover {
  border-color: var(--brand);
  box-shadow: 0 8px 24px rgba(24, 39, 46, 0.09);
  transform: translateY(-1px);
}

button.work-queue-card:focus-visible {
  outline: 3px solid rgba(15, 132, 136, 0.25);
  outline-offset: 2px;
}

.work-queue-card.is-disabled {
  background: #f5f7f7;
  color: var(--muted);
}

.work-queue-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 9px;
  background: #eaf5f4;
  color: var(--brand);
}

.work-queue-card.is-disabled .work-queue-icon {
  background: #e9eeee;
  color: #74858a;
}

.work-queue-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.work-queue-copy strong {
  font-size: 16px;
}

.work-queue-copy b {
  font-size: 30px;
  line-height: 1.1;
}

.work-queue-copy small {
  color: var(--muted);
  line-height: 1.5;
}

.work-queue-next {
  align-self: center;
  color: var(--brand);
}

.work-queue-loading,
.work-queue-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 72px;
  margin-bottom: 14px;
}

.work-queue-loading {
  justify-content: center;
  color: var(--muted);
}

.work-queue-loading .tf-icon,
#refreshWorkQueue.is-loading .tf-icon {
  animation: work-queue-spin 0.8s linear infinite;
}

@keyframes work-queue-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
  .app-shell {
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 12px;
  }

  .brand {
    margin-bottom: 10px;
  }

  nav {
    display: flex;
    overflow-x: auto;
  }

  nav a {
    white-space: nowrap;
  }

  .layout-grid,
  .master-grid,
  .demand-controls,
  .task-grid,
  .purchase-status-strip,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .work-queue-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 760px) {
  .workspace {
    width: 100%;
    min-width: 0;
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .company-grid,
  .task-grid,
  .demand-controls,
  .form-grid,
  .master-grid,
  .bom-copy-controls,
  .status-grid,
  .sheet-image-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: flex;
    justify-content: flex-start;
  }

  .topbar-actions .shipping-secondary-mobile,
  .topbar-actions .purchase-secondary-mobile,
  .customer-order-actions .customer-order-secondary-mobile {
    display: none;
  }

  .topbar-actions .shipping-editor-more,
  .topbar-actions .purchase-editor-more,
  .customer-order-actions .customer-order-editor-more {
    display: inline-flex;
  }

  .product-picker-mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
  .product-picker-mobile-head > span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  .product-picker-toggle { display: inline-flex; }
  .product-list-pane { display: none; height: min(62vh, 560px); margin-top: 8px; }
  .product-list-pane.mobile-open { display: flex; }
  .product-filter-toggle { display: inline-flex; justify-self: end; }
  .product-list-filters { display: none; grid-template-columns: 1fr; }
  .product-list-filters.open { display: grid; }

  .customer-order-actions,
  .master-actions {
    align-items: center;
  }

  .master-actions .master-action-secondary { display: none; }
  .master-actions .master-actions-more { display: inline-flex; }

  .part-tools-row {
    grid-template-columns: 1fr;
  }

  .switch-control {
    justify-content: space-between;
  }

  .purchase-status-strip {
    text-align: left;
  }

  .status-total {
    text-align: left;
  }

  .list-actions,
  .list-filters {
    display: grid;
  }

  .document-row {
    grid-template-columns: 1fr;
  }

  .work-queue-grid {
    grid-template-columns: 1fr;
  }

  .work-queue-card {
    min-height: 132px;
  }

  .shipping-list-layout .erp-list-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .shipping-list-layout .erp-list-cell,
  .shipping-list-layout .erp-list-amount {
    grid-column: 1 / -1;
  }

  .shipping-list-layout .erp-list-cell--primary { order: 1; }
  .shipping-list-layout .shipping-cell--status { order: 2; }
  .shipping-list-layout .shipping-cell--receivable { order: 3; }
  .shipping-list-layout .shipping-date-cell { order: 4; }
  .shipping-list-layout .shipping-quantity-cell { order: 5; }
  .shipping-list-layout .erp-list-cell--company { order: 6; }
  .shipping-list-layout .shipping-source-action { order: 7; width: 100%; min-height: 44px; }
  .shipping-shipment-row .shipping-cell--status { order: 2; }
  .shipping-shipment-row .shipping-date-cell { order: 3; }
  .shipping-shipment-row .shipping-cell--receivable { order: 4; }
  .shipping-shipment-row .shipping-quantity-cell { order: 5; }
  .shipping-shipment-row .erp-list-cell--company { order: 6; }
  .shipping-source-row .shipping-date-cell { order: 2; }
  .shipping-source-row .shipping-cell--status { order: 3; }
  .shipping-source-row .shipping-source-action { order: 4; }
  .shipping-source-row .erp-list-cell--company { order: 5; }

  .candidate-row {
    grid-template-columns: 28px 1fr;
  }

  .customer-order-table-wrap {
    overflow-x: visible;
  }

  .customer-order-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .customer-order-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .customer-order-table tbody {
    display: grid;
    gap: 12px;
  }

  .customer-order-table tr {
    display: grid;
    grid-template-columns: 1fr;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .customer-order-table td,
  .customer-order-table td:nth-child(n) {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    align-items: center;
    width: auto;
    min-width: 0;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
  }

  .customer-order-table td:last-child {
    border-bottom: 0;
  }

  .customer-order-table td::before {
    content: attr(data-label);
    padding-right: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }

  .customer-order-table .customer-order-product-field,
  .customer-order-table input,
  .customer-order-table .erp-entity-picker {
    min-width: 0;
    max-width: 100%;
  }

  .wide {
    grid-column: auto;
  }

  .panel {
    padding: 13px;
  }

  .purchase-sheet {
    width: 210mm;
    min-width: 210mm;
    min-height: 297mm;
    padding: 10mm;
  }

  .sheet-total div {
    grid-template-columns: 1fr 120px;
  }
}

.employee-form-section {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line, #d8e1e5);
  border-radius: 14px;
  background: var(--surface, #fff);
}

.employee-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.employee-section-heading h3,
.employee-section-heading p {
  margin: 0;
}

.employee-section-heading p,
.development-account-preview p,
.employee-login-meta small {
  color: var(--muted, #60727a);
  font-size: 12px;
}

.employee-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.employee-account-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  color: #61727a;
  background: #edf2f4;
  font-size: 12px;
  white-space: nowrap;
}

.employee-account-status.is-ready {
  color: #0b675f;
  background: #dff4ef;
}

.employee-login-meta {
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 68px;
}

.employee-login-meta span {
  color: var(--muted, #60727a);
  font-size: 12px;
}

.development-account-preview {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.development-account-preview p {
  grid-column: 1 / -1;
}

.employee-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.employee-module-grid .master-check {
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line, #d8e1e5);
  border-radius: 10px;
  cursor: pointer;
}

.employee-module-grid .master-check input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  accent-color: var(--teal, #0f8686);
}

.employee-module-grid .master-check:has(input:checked) {
  border-color: #55aaa3;
  background: #eef9f7;
}

@media (max-width: 760px) {
  .employee-section-grid,
  .employee-module-grid,
  .development-account-preview {
    grid-template-columns: 1fr;
  }

  .employee-account-status {
    justify-self: start;
  }
}

@media (max-width: 480px) {
  .shipping-dialog-backdrop {
    align-items: end;
    padding: 12px;
  }

  .shipping-action-modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .shipping-confirm-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .shipping-confirm-summary__total {
    grid-column: 1;
  }

  .shipping-action-modal .shipping-action-modal__footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .shipping-action-modal__footer .tf-action-button {
    width: 100%;
    min-height: 44px;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  @page shipment-note {
    size: 609pt 397pt;
    margin: 0;
  }

  body {
    background: #fff;
  }

  body * {
    visibility: hidden;
  }

  .preview-panel,
  .preview-panel * {
    visibility: visible;
  }

  .sidebar,
  .topbar,
  .company-grid,
  .purchase-status-strip,
  .purchase-tabs,
  .document-list-panel,
  .customer-order-panel,
  .candidate-panel,
  .form-panel,
  .status-panel,
  .items-panel,
  .note-panel,
  .preview-panel > .panel-title {
    display: none !important;
  }

  .print-adjust-tools,
  .print-option-toggle,
  .print-size-control,
  .col-resize-handle,
  .note-resize-handle {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .preview-grid {
    display: block;
    padding: 0;
    margin: 0;
  }

  .preview-panel {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    overflow: visible;
  }

  .panel {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .purchase-sheet {
    border: 0;
    width: auto;
    min-width: 0;
    min-height: auto;
    margin: 0;
    padding: 0 1mm;
  }

  body.printing-purchase-a4,
  body.printing-purchase-a4 #app,
  body.printing-purchase-a4 .app-shell,
  body.printing-purchase-a4 .workspace,
  body.printing-purchase-a4 .purchase-preview-panel {
    width: auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  body.printing-purchase-a4 * {
    visibility: hidden !important;
  }

  body.printing-purchase-a4 .workspace > :not(.purchase-preview-panel),
  body.printing-purchase-a4 .purchase-preview-panel > :not(.purchase-sheet) {
    display: none !important;
  }

  body.printing-purchase-a4 .purchase-preview-panel,
  body.printing-purchase-a4 .purchase-sheet,
  body.printing-purchase-a4 .purchase-sheet * {
    visibility: visible !important;
  }

  body.printing-purchase-a4 .purchase-preview-panel,
  body.printing-purchase-a4 .purchase-sheet {
    display: block !important;
    position: static !important;
  }

  body.printing-purchase-a4 .purchase-preview-panel {
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-purchase-a4 .purchase-sheet {
    overflow: visible !important;
  }

  .shipment-sheet {
    border: 0;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 6pt 14pt 4pt;
    box-sizing: border-box;
  }

  body.printing-shipment,
  body.printing-shipment #app,
  body.printing-shipment .app-shell,
  body.printing-shipment .workspace,
  body.printing-shipment .preview-panel,
  body.printing-shipment .shipment-preview-panel {
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  body.printing-shipment * {
    visibility: hidden !important;
  }

  body.printing-shipment .workspace > :not(.shipment-preview-panel),
  body.printing-shipment .shipment-preview-panel > :not(.shipment-sheet) {
    display: none !important;
  }

  body.printing-shipment .shipment-preview-panel,
  body.printing-shipment .shipment-sheet,
  body.printing-shipment .shipment-sheet * {
    visibility: visible !important;
  }

  body.printing-shipment .shipment-preview-panel {
    display: block !important;
    position: static !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body.printing-shipment .shipment-sheet {
    display: block !important;
    position: static !important;
    overflow: visible !important;
  }

  body.printing-shipment .shipment-sheet-table thead {
    display: table-header-group;
  }

  body.printing-shipment .shipment-sheet-table tr,
  body.printing-shipment .shipment-sheet-table tfoot,
  body.printing-shipment .shipment-sheet-footer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.printing-shipment .shipment-sheet:last-of-type {
    break-after: auto !important;
    page-break-after: auto !important;
  }

  .preview-table,
  .preview-table th,
  .preview-table td,
  .sheet-note,
  .sheet-total {
    border-color: #7f8b91;
    border-width: 0.75pt;
  }

  .preview-table thead {
    display: table-header-group;
  }

  .preview-table tr,
  .sheet-note,
  .sheet-total,
  .sheet-footer {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
