/**
 * 商业发票整页编辑器（5177 `发票样式:6445-6580` +
 * `运费样式:1760-1900`）。
 *
 * 与工厂合同页同一套思路：单独一个文件，`zoom: 1.2` 是 5177 这张发票自身的放大，
 * 不是弹窗反向除算；报价合同的「不许 zoom / !important」护栏继续成立。
 */

.commercial-invoice-panel {
  overflow-x: auto;
  min-width: 0;
  padding-top: 8px;
}

.commercial-invoice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wb-space-2);
  margin-bottom: var(--wb-space-3);
}

.commercial-invoice-table-scroll {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-right: 32px;
  padding-bottom: 6px;
  zoom: 1.2;
}

.commercial-invoice-table-frame {
  display: grid;
  grid-template-columns: max-content;
  align-items: start;
  column-gap: 0;
  width: max-content;
  min-width: 100%;
}

.commercial-invoice-table-wrap { width: max-content; }

.commercial-invoice-table {
  width: max-content;
  min-width: max-content;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--wb-surface);
  color: var(--wb-ci-ink);
  font-size: var(--wb-fs-14);
}

.commercial-invoice-table th,
.commercial-invoice-table td {
  position: relative;
  border: 1px solid var(--wb-ci-line);
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.commercial-invoice-table input,
.commercial-invoice-table textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--wb-ci-field-line);
  border-radius: var(--wb-radius-button);
  background: var(--wb-surface);
  color: inherit;
  font: inherit;
  text-align: inherit;
  box-sizing: border-box;
  padding: 7px 8px;
  resize: none;
  outline: none;
}

.commercial-invoice-table input:focus,
.commercial-invoice-table textarea:focus {
  border-color: var(--wb-ci-focus-border);
  box-shadow: 0 0 0 2px var(--wb-ci-focus-ring);
}

.commercial-invoice-table textarea {
  min-height: 50px;
  overflow: hidden;
}

.commercial-company-row input {
  font-size: 24px;
  font-weight: var(--wb-fw-800);
  text-align: center;
}

.commercial-invoice-address-input {
  min-height: 34px;
  height: 42px;
}

.commercial-seller-address-row textarea {
  min-height: 34px;
  height: 42px;
  text-align: center;
  line-height: 1.25;
  padding-top: 3px;
  padding-bottom: 3px;
}

.commercial-title-row input {
  font-size: 22px;
  font-weight: var(--wb-fw-800);
  letter-spacing: 0;
  text-align: center;
}

.commercial-header-row th {
  height: 41px;
  font-weight: var(--wb-fw-800);
}

.commercial-meta-shell-row > td,
.commercial-meta-shell-cell {
  height: auto;
  padding: 0;
  vertical-align: top;
  line-height: 1;
}

.commercial-meta-grid {
  display: grid;
  grid-template-columns: 48px minmax(260px, 1fr) 118px 178px;
  grid-template-rows: minmax(64px, auto) minmax(64px, auto);
  width: 100%;
  align-items: stretch;
}

.commercial-to-label,
.commercial-to-box,
.commercial-meta-label,
.commercial-meta-value {
  display: flex;
  align-items: center;
  border-right: 1px solid var(--wb-ci-line);
  border-bottom: 1px solid var(--wb-ci-line);
  box-sizing: border-box;
  min-height: 100%;
  padding: 0 7px;
  text-align: left;
  font-weight: var(--wb-fw-800);
}

.commercial-to-label {
  grid-row: 1 / span 2;
  width: max-content;
  min-width: 46px;
  justify-content: flex-start;
}

.commercial-to-box { grid-row: 1 / span 2; }
.commercial-to-box textarea { min-height: 128px; }
.commercial-meta-label,
.commercial-meta-value { min-height: 64px; }

.commercial-invoice-strong-input,
.commercial-invoice-address-box {
  font-weight: var(--wb-fw-700);
  text-align: left;
}

.commercial-shipping-cell { min-width: 220px; }
.commercial-amount-cell,
.commercial-total-row td { font-weight: var(--wb-fw-700); }

.commercial-invoice-line textarea { min-height: 50px; }

.commercial-column-resizer {
  position: absolute;
  top: 0;
  right: -8px;
  bottom: 0;
  z-index: 8;
  width: 16px;
  cursor: col-resize;
  touch-action: none;
}

.commercial-column-resizer::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 7px;
  bottom: 4px;
  width: 2px;
  border-radius: var(--wb-radius-pill);
  background: transparent;
}

.commercial-column-resizer:hover::after { background: var(--wb-ci-resizer); }
