:root {
  --navy-950: #081628;
  --navy-900: #10233f;
  --navy-800: #173252;
  --teal-700: #087f78;
  --teal-600: #0a958b;
  --teal-100: #d9f4f0;
  --orange-500: #e28b35;
  --orange-100: #fff0dc;
  --red-600: #c24848;
  --red-100: #fde7e7;
  --green-600: #27835e;
  --green-100: #e0f3e9;
  --blue-600: #3475b9;
  --blue-100: #e2eefb;
  --quote-stage-converted: #5a67d8;
  --ink: #17253a;
  --muted: #66758a;
  --line: #dce3eb;
  --surface: #ffffff;
  --background: #f3f6f9;
  --shadow: 0 16px 42px rgba(22, 41, 68, 0.10);
  --radius: 16px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 80% -20%, rgba(10, 149, 139, 0.09), transparent 34%),
    var(--background);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 250px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 50% 5%, rgba(31, 150, 143, 0.28), transparent 28%),
    linear-gradient(170deg, var(--navy-900), var(--navy-950));
  box-shadow: 12px 0 35px rgba(8, 22, 40, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.brand-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  object-fit: contain;
  border-radius: 14px;
  filter: drop-shadow(0 8px 16px rgba(8, 95, 211, 0.3));
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand span {
  margin-top: 3px;
  color: #aebdd0;
  font-size: 11px;
}

.nav-list {
  display: grid;
  gap: 7px;
  margin-top: 26px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #b9c6d6;
  background: transparent;
  text-align: left;
  transition: 160ms ease;
}

.nav-item span {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #cdd8e5;
  background: rgba(255, 255, 255, 0.07);
  font-size: 11px;
  font-weight: 800;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active span {
  color: #fff;
  background: var(--teal-600);
}

.sidebar-note {
  margin-top: auto;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.055);
}

.sidebar-note span,
.sidebar-note strong,
.sidebar-note small {
  display: block;
}

.sidebar-note span {
  color: #6ed4c8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.sidebar-note strong {
  margin: 7px 0 5px;
  color: #f6f8fb;
  font-size: 12px;
}

.sidebar-note small {
  color: #94a4b8;
  font-size: 10px;
  line-height: 1.55;
}

.main {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px 34px 18px;
  border-bottom: 1px solid rgba(220, 227, 235, 0.75);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(12px);
}

.page-heading {
  min-width: 0;
  flex: 1;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--teal-700);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.page-heading h1 {
  margin: 0;
  color: var(--navy-900);
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.page-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions,
.toolbar,
.action-group,
.modal-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.content {
  padding: 28px 34px 50px;
}

.button,
.icon-button,
.table-action {
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  transition: 150ms ease;
}

.button {
  min-height: 38px;
  padding: 9px 14px;
  font-size: 12px;
}

.button:hover,
.table-action:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button.primary {
  color: #fff;
  background: var(--teal-700);
  box-shadow: 0 8px 18px rgba(8, 127, 120, 0.18);
}

.button.primary:hover {
  background: var(--teal-600);
}

.button.secondary {
  color: var(--navy-800);
  border-color: var(--line);
  background: #fff;
}

.language-toggle {
  min-width: 76px;
  text-align: center;
}

.button.ghost {
  color: var(--muted);
  background: transparent;
}

.button.danger {
  color: #fff;
  background: var(--red-600);
}

.button.small {
  min-height: 31px;
  padding: 6px 10px;
  font-size: 11px;
}

.icon-button {
  min-height: 34px;
  padding: 7px 10px;
  color: var(--muted);
  border-color: var(--line);
  background: #fff;
  font-size: 11px;
}

.mobile-menu {
  display: none;
}

.section-stack {
  display: grid;
  gap: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  position: relative;
  min-height: 130px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(220, 227, 235, 0.9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(22, 41, 68, 0.055);
}

.stat-card::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  right: -24px;
  bottom: -28px;
  border: 12px solid var(--card-accent, var(--teal-100));
  border-radius: 50%;
  opacity: 0.8;
}

.stat-card .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 13px;
  color: var(--navy-900);
  font-size: 24px;
  letter-spacing: -0.04em;
}

.stat-card small {
  display: block;
  margin-top: 7px;
  color: #8996a8;
  font-size: 10px;
}

.panel {
  overflow: hidden;
  border: 1px solid rgba(220, 227, 235, 0.92);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(22, 41, 68, 0.055);
}

.panel-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 19px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  min-width: 0;
  flex: 1;
}

.panel-title h2 {
  margin: 0;
  color: var(--navy-900);
  font-size: 15px;
  letter-spacing: -0.02em;
}

.panel-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.panel-body {
  padding: 18px 19px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.stage-list {
  display: grid;
  gap: 16px;
}

.stage-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
}

.stage-row span,
.stage-row strong {
  font-size: 11px;
}

.stage-track {
  height: 8px;
  overflow: hidden;
  border-radius: 10px;
  background: #edf1f5;
}

.stage-fill {
  height: 100%;
  min-width: 5px;
  border-radius: inherit;
  background: var(--fill, var(--teal-600));
}

.toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.list-filter-toolbar {
  align-items: center;
  gap: 12px;
}

.list-filter-toolbar .list-filter-controls {
  flex: 1 1 560px;
  min-width: 0;
  flex-wrap: nowrap;
}

.list-filter-toolbar .search-box {
  flex: 1 1 360px;
  width: auto;
  min-width: 260px;
  max-width: 540px;
}

.list-filter-toolbar .filter-select {
  flex: 0 0 220px;
  min-width: 180px;
  max-width: 280px;
}

.search-box {
  width: min(310px, 100%);
  position: relative;
}

.search-box input {
  width: 100%;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: #fff;
  font-size: 11px;
}

.filter-select {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--navy-800);
  outline: none;
  background: #fff;
  font-size: 11px;
}

.search-box input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.line-table input:focus,
.line-table select:focus,
.line-table textarea:focus {
  border-color: rgba(10, 149, 139, 0.65);
  box-shadow: 0 0 0 3px rgba(10, 149, 139, 0.10);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.data-table th {
  padding: 10px 13px;
  color: #758398;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  text-align: left;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 13px;
  border-bottom: 1px solid #edf1f5;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: #fbfcfd;
}

.cell-primary {
  color: var(--navy-900);
  font-weight: 750;
}

.cell-secondary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.party-seller-company {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.35;
}

.party-customer-primary {
  display: block;
  margin-top: 0;
  color: var(--navy-900);
  font-size: inherit;
  font-weight: 750;
  line-height: 1.35;
}

.internal-contract-table {
  min-width: 920px;
}

.quote-number-stage.pending,
.quote-number-stage.draft {
  color: var(--orange-500);
}

.quote-number-stage.sent {
  color: var(--blue-600);
}

.quote-number-stage.approved,
.quote-number-stage.confirmed {
  color: var(--green-600);
}

.quote-number-stage.void,
.quote-number-stage.rejected,
.quote-number-stage.cancelled {
  color: var(--red-600);
}

.quote-number-stage.converted {
  color: var(--quote-stage-converted);
}

.quote-row-warning {
  color: #b45309;
  font-weight: 700;
}

.product-category {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.product-category.tag {
  color: #94651c;
  background: #fff2d5;
}

.product-category.hardware {
  color: #245f9d;
  background: #e5f0fb;
}

.product-category.software {
  color: #5f4aa3;
  background: #eee9ff;
}

.product-category.service {
  color: #23745c;
  background: #e2f5ed;
}

.product-category.other {
  color: #4b5563;
  background: #eef2f7;
}

.product-category-picker-field {
  gap: 8px;
}

.product-category-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.product-category-chip {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.product-category-chip:hover {
  border-color: rgba(10, 149, 139, 0.45);
  background: #f2faf8;
}

.product-category-chip.active {
  border-color: rgba(10, 149, 139, 0.85);
  background: #dff6f1;
  color: #0f766e;
}

.product-category-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.product-category-custom:not([hidden]) {
  display: block;
}

.product-description-switch {
  padding: 0;
  overflow: hidden;
  border: 1px solid #d7e0ea;
  border-radius: 12px;
  background: #fbfdff;
}

.product-description-switch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f6fafc 100%);
}

.product-description-switch-header strong {
  display: block;
  color: var(--navy-900);
  font-size: 14px;
}

.product-description-switch-header small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.localized-description-tabs {
  display: inline-flex;
  flex-shrink: 0;
  gap: 4px;
  padding: 4px;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  background: #eef4f8;
}

.localized-description-tab {
  min-height: 30px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #58708a;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.localized-description-tab.active {
  background: #fff;
  color: #0f766e;
  box-shadow: 0 4px 14px rgba(15, 35, 55, 0.12);
}

.product-description-fields {
  padding: 14px;
}

.localized-description-field {
  margin: 0;
}

.localized-description-field textarea {
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

.localized-description-field[hidden] {
  display: none !important;
}

.product-non-software-field.is-hidden,
.product-non-software-field[hidden],
.software-product-form .product-non-software-field,
#productForm[data-product-category-kind="software"] .product-non-software-field {
  display: none !important;
}

#productForm:has(.product-category-chip.active[data-category="软件"]) .product-non-software-field,
#productForm:has(.product-category-hidden[value="软件"]) .product-non-software-field,
#productForm:has(.product-category-select option:checked[value="软件"]) .product-non-software-field,
#productForm:has(.product-category-chip.active[data-category="服务"]) .product-non-software-field,
#productForm:has(.product-category-hidden[value="服务"]) .product-non-software-field,
#productForm:has(.product-category-select option:checked[value="服务"]) .product-non-software-field,
#productForm:has(.product-category-chip.active[data-category*="software" i]) .product-non-software-field,
#productForm:has(.product-category-hidden[value*="software" i]) .product-non-software-field,
#productForm:has(.product-category-select option:checked[value*="software" i]) .product-non-software-field,
#productForm:has(.product-category-chip.active[data-category*="service" i]) .product-non-software-field,
#productForm:has(.product-category-hidden[value*="service" i]) .product-non-software-field,
#productForm:has(.product-category-select option:checked[value*="service" i]) .product-non-software-field {
  display: none !important;
}

.spec-preview {
  max-width: 360px;
  line-height: 1.45;
}

.external-spec b {
  color: #23745c;
}

.internal-spec {
  color: #8a5b25;
}

.internal-spec b {
  color: #9a5e16;
}

.internal-parameter-field {
  padding: 12px;
  border: 1px solid #efd7b6;
  border-radius: 10px;
  background: #fffaf2;
}

.section-inline-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0 2px;
  color: var(--navy-900);
}

.section-inline-title span {
  color: var(--muted);
  font-size: 10px;
}

.customer-category {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 20px;
  color: #31546f;
  background: #e8f0f6;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.customer-category.hospital {
  color: #a13b51;
  background: #fbe7ec;
}

.customer-category.hotel {
  color: #91641e;
  background: #fff0d5;
}

.customer-category.building {
  color: #315f99;
  background: #e4eef9;
}

.customer-category.distributor {
  color: #5e4a9f;
  background: #eee9ff;
}

.customer-category.partner {
  color: #24735c;
  background: #e2f5ed;
}

.money {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.order-internal-contract-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.badge.internal-contract-status {
  padding: 3px 7px;
  color: var(--blue-600);
  background: var(--blue-100);
}

.internal-contract-override-action {
  padding: 3px 7px;
}

.internal-supply-relation-table {
  min-width: 940px;
}

.badge.pending,
.badge.draft {
  color: #a3681d;
  background: var(--orange-100);
}

.badge.approved,
.badge.confirmed,
.badge.fulfilled {
  color: var(--green-600);
  background: var(--green-100);
}

.badge.rejected,
.badge.cancelled {
  color: var(--red-600);
  background: var(--red-100);
}

.badge.sent {
  color: var(--blue-600);
  background: var(--blue-100);
}

.badge.quote-customer-stage {
  display: block;
  margin-top: 3px;
  padding: 0;
  border-radius: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
  font-weight: 750;
  line-height: inherit;
  white-space: normal;
}

.badge.quote-customer-stage::before {
  display: none;
}

.badge.quote-customer-stage.pending,
.badge.quote-customer-stage.draft {
  color: var(--orange-500);
  background: transparent;
}

.badge.quote-customer-stage.approved,
.badge.quote-customer-stage.confirmed,
.badge.quote-customer-stage.fulfilled {
  color: var(--green-600);
  background: transparent;
}

.badge.quote-customer-stage.rejected,
.badge.quote-customer-stage.cancelled,
.badge.quote-customer-stage.void {
  color: var(--red-600);
  background: transparent;
}

.badge.quote-customer-stage.sent {
  color: var(--blue-600);
  background: transparent;
}

.badge.quote-customer-stage.converted {
  color: var(--quote-stage-converted);
  background: transparent;
}

.table-action {
  min-height: 29px;
  padding: 5px 8px;
  color: var(--navy-800);
  border-color: var(--line);
  background: #fff;
  font-size: 9px;
}

.table-action.danger {
  color: var(--red-600);
}

.avatar,
.product-thumb,
.product-placeholder {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
}

.avatar {
  color: var(--teal-700);
  background: var(--teal-100);
  font-size: 11px;
  font-weight: 850;
}

.product-thumb,
.product-placeholder {
  border: 1px solid var(--line);
  background: #f2f5f8;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-placeholder {
  color: #9aa8b9;
  font-size: 9px;
  font-weight: 800;
}

.identity-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 35px;
  text-align: center;
}

.empty-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 15px;
  color: var(--teal-700);
  background: var(--teal-100);
  font-weight: 850;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--navy-900);
  font-size: 14px;
}

.empty-state p {
  max-width: 360px;
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.convert-order-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.convert-order-summary > div {
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.convert-order-summary span,
.convert-order-summary strong {
  display: block;
}

.convert-order-summary span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.convert-order-summary strong {
  margin-top: 6px;
  color: var(--navy-900);
  font-size: 12px;
  line-height: 1.35;
}

.convert-order-warning {
  margin: 14px 0;
}

.convert-order-warning p {
  margin: 0 0 6px;
}

.convert-order-warning p:last-child {
  margin-bottom: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 22, 40, 0.66);
  backdrop-filter: blur(5px);
}

.modal {
  width: min(680px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 25px 70px rgba(8, 22, 40, 0.28);
}

.modal.wide {
  width: min(1080px, 100%);
}

.modal.document-modal {
  width: min(1160px, 100%);
  background: #edf1f5;
}

.modal.convert-order-modal {
  width: min(560px, 100%);
}

.modal.tiered-convert-order-modal {
  width: min(900px, 100%);
}

.tiered-conversion-help {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid #b8d7e9;
  border-radius: 10px;
  background: #f0f8fc;
  color: #27536a;
  font-size: 12px;
  line-height: 1.5;
}

.tiered-conversion-table-wrap {
  margin: 14px 0;
}

.tiered-conversion-table input[type="number"] {
  width: 110px;
  text-align: center;
}

.tiered-conversion-table td:nth-child(2),
.tiered-conversion-table td:nth-child(3),
.tiered-conversion-table td:nth-child(4),
.tiered-conversion-table th {
  text-align: center;
  vertical-align: middle;
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

.modal-header > div:first-child {
  min-width: 0;
  flex: 1;
}

.modal-header h2 {
  margin: 0;
  color: var(--navy-900);
  font-size: 17px;
  letter-spacing: -0.025em;
}

.modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.modal-body {
  padding: 21px;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: #58687d;
  font-size: 10px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 39px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  outline: none;
  background: #fff;
  font-size: 11px;
}

.field textarea {
  min-height: 85px;
  resize: vertical;
  line-height: 1.5;
}

.field small,
.help-text {
  color: #8b98a9;
  font-size: 9px;
  line-height: 1.45;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 7px;
}

.checkbox-row {
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.field .checkbox-row input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  padding: 0;
}

.exchange-rate-field small {
  display: grid;
  gap: 3px;
}

.exchange-rate-error {
  display: block;
  color: var(--red-600);
}

.storage-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.storage-detail-grid .detail-box p {
  overflow-wrap: anywhere;
}

.storage-healthy {
  color: var(--green-600) !important;
}

.form-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.form-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
}

.section-heading h3 {
  min-width: 0;
  flex: 1;
  margin: 0;
  color: var(--navy-900);
  font-size: 12px;
}

.line-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.line-table {
  width: 100%;
  min-width: 830px;
  border-collapse: collapse;
}

.line-table th {
  padding: 8px;
  color: #6f7d90;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
  text-align: left;
  font-size: 8px;
  text-transform: uppercase;
}

.line-table td {
  padding: 7px;
  border-bottom: 1px solid #edf1f5;
  vertical-align: top;
}

.line-table tr:last-child td {
  border-bottom: 0;
}

.line-table input,
.line-table select,
.line-table textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #fff;
  font-size: 10px;
}

.line-table textarea {
  min-height: 50px;
  resize: vertical;
}

.line-discount-cell {
  min-width: 110px;
}

.line-discount-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-table .line-discount-enabled {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}

.line-table .line-discount {
  flex: 1 1 0;
  min-width: 0;
  width: 0;
}

.line-table .line-discount:disabled {
  background: #f1f5f9;
  color: #64748b;
}

.document-line-discount {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  line-height: 1.3;
  white-space: normal;
}

.line-product-search {
  margin-bottom: 6px;
}

.product-search-cell {
  position: relative;
  min-width: 230px;
}

.product-search-hint {
  display: block;
  margin-top: 5px;
  color: #6b7280;
  font-size: 10px;
  line-height: 1.35;
}

.product-picker-results {
  position: absolute;
  z-index: 80;
  top: 43px;
  left: 7px;
  right: 7px;
  max-height: 290px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.product-choice-row {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #111827;
  text-align: left;
  cursor: pointer;
}

.product-choice-row:hover,
.product-choice-row.active {
  background: #e9f7f5;
}

.product-choice-main,
.product-choice-sub,
.product-choice-meta {
  display: block;
}

.product-choice-main {
  font-size: 12px;
  font-weight: 800;
}

.product-choice-sub {
  margin-top: 2px;
  color: #374151;
  font-size: 11px;
}

.product-choice-meta {
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
}

.product-picker-empty {
  padding: 9px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

.contact-table {
  min-width: 760px;
}

.user-switch-button {
  gap: 8px;
}

.user-role-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.permission-group {
  border: 1px solid #dde6ee;
  border-radius: 12px;
  padding: 10px;
  background: #f8fbfd;
}

.permission-group strong {
  display: block;
  margin-bottom: 6px;
  color: #10233f;
}

.permission-checkbox {
  margin: 6px 0;
  font-size: 13px;
}

.contact-email-stack {
  display: grid;
  gap: 5px;
}

.contact-email-stack input {
  min-width: 170px;
}

.checkbox-row.compact {
  min-height: 34px;
  align-items: center;
  margin: 0;
}

.line-amount {
  display: block;
  padding-top: 8px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.line-table input.price-invalid {
  color: var(--red-600);
  border-color: var(--red-600);
  background: var(--red-100);
}

.badge.quote-pricing-mode {
  margin-top: 4px;
  padding: 3px 7px;
  font-size: 8px;
}

.badge.quote-pricing-mode.standard {
  color: var(--blue-600);
  background: var(--blue-100);
}

.badge.quote-pricing-mode.tiered {
  color: #8b5a1c;
  background: var(--orange-100);
}

.badge.quote-pricing-mode.exact-tiered {
  color: #5b21b6;
  background: #ede9fe;
}

.quote-mode-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.quote-mode-choice {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
  text-align: left;
  color: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

.quote-mode-choice:hover,
.quote-mode-choice:focus-visible {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: 0;
}

.quote-mode-choice strong {
  font-size: 16px;
}

.quote-mode-choice span,
.quote-mode-controls span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.quote-mode-heading,
.quote-mode-controls,
.tier-editor-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quote-mode-controls {
  margin-left: auto;
}

.tier-editor-cell {
  min-width: 650px;
}

.tier-editor-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.tier-grid,
.tier-row {
  display: grid;
  grid-template-columns: 28px 92px 92px 112px minmax(130px, 1fr) 58px;
  gap: 6px;
  align-items: center;
  min-width: 548px;
}

.tier-grid-header {
  padding: 0 4px 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.tier-row {
  padding: 5px 4px;
  border-top: 1px solid var(--line);
}

.tier-index {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.tier-row .tier-min-quantity,
.tier-row .tier-max-quantity,
.tier-row .tier-unit-price {
  min-width: 0;
  width: 100%;
}

.tier-row .tier-remove-button {
  min-height: 28px;
  padding: 4px 7px;
}

.tier-editor-footer {
  min-width: 548px;
  padding: 7px 4px 1px;
}

.tier-floor-diagnostic,
.tier-invalid-diagnostic {
  font-size: 10px;
}

.tier-floor-diagnostic {
  color: var(--muted);
}

.tier-invalid-diagnostic {
  color: var(--red-600);
  font-weight: 700;
}

.totals-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  margin-top: 16px;
}

.totals-card {
  padding: 13px 15px;
  border-radius: 11px;
  background: #f6f9fb;
}

.total-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 7px 0;
  color: var(--muted);
  font-size: 10px;
}

.total-row.grand {
  margin-top: 4px;
  padding-top: 11px;
  color: var(--navy-900);
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 850;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--navy-800);
  background: #f8fafb;
  font-size: 9px;
}

.file-chip button {
  padding: 0;
  border: 0;
  color: var(--red-600);
  background: transparent;
  font-size: 9px;
  font-weight: 800;
}

.license-file-chip {
  align-items: center;
}

.license-preview-image {
  width: 58px;
  height: 40px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.signature-pad-field {
  min-width: 0;
}

.signature-pad-wrap {
  position: relative;
  overflow: hidden;
  border: 1px dashed #9fb0c2;
  border-radius: 12px;
  background: #fff;
}

.signature-pad-canvas {
  width: 100%;
  height: 300px;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.signature-existing {
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: 70%;
  max-height: 170px;
  pointer-events: none;
}

.signature-pad-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.payment-voucher-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 110px;
}

.payment-voucher-links .table-action {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signature-upload-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 8px;
}

.signature-upload {
  flex: 1;
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
}

.signature-upload span {
  color: var(--ink);
  font-weight: 700;
}

.signature-upload input {
  width: 100%;
}

.signature-upload-preview {
  width: 132px;
  height: 72px;
  margin-top: 0;
  flex: 0 0 132px;
}

.signature-upload-preview img {
  object-fit: contain;
}

.seller-signing-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
  gap: 16px;
  align-items: start;
}

.seller-signing-grid .signature-pad-field {
  min-width: 0;
}

.seller-date-pad .signature-pad-canvas {
  height: 300px;
}

.seller-date-pad .signature-existing {
  max-width: 76%;
  max-height: 120px;
}

.customer-sign-share textarea {
  min-height: 74px;
  font-size: 11px;
  word-break: break-all;
}

.customer-signing-modal .modal-body {
  display: grid;
  gap: 18px;
}

body.customer-signing-portal-page {
  min-height: 100vh;
  background: #eef3f8;
}

body.customer-signing-portal-page .app-shell {
  display: none;
}

body.customer-signing-portal-page #modalRoot {
  display: block;
}

body.customer-signing-portal-page .modal-backdrop {
  position: static;
  min-height: 100vh;
  padding: 22px;
  background:
    radial-gradient(circle at 78% -12%, rgba(10, 149, 139, 0.12), transparent 34%),
    #eef3f8;
}

body.customer-signing-portal-page .modal {
  width: min(1180px, calc(100vw - 32px));
  max-width: 1180px;
  max-height: none;
  margin: 0 auto;
  overflow: visible;
}

body.customer-signing-portal-page .modal-header,
body.customer-signing-portal-page .modal-footer {
  position: static;
}

.customer-signing-complete {
  display: grid;
  gap: 14px;
}

.success-notice {
  border-color: #9ad1b7;
  background: #e8f7ef;
  color: #155f3c;
}

.success-notice strong,
.success-notice span {
  display: block;
}

.success-notice span {
  margin-top: 4px;
  font-weight: 600;
}

.customer-signing-completed-modal [data-signature-drag] {
  cursor: default;
  pointer-events: none;
}

.customer-signing-readonly-section {
  display: grid;
  gap: 12px;
}

.readonly-notice {
  border-color: #d7b56d;
  background: #fff8e6;
  color: #6b4c00;
  font-weight: 700;
}

.customer-signing-document-preview {
  max-height: 68vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef3f8;
}

.customer-signing-document-preview .document-sheet {
  margin: 0 auto;
  box-shadow: 0 8px 22px rgba(16, 35, 63, 0.12);
}

.customer-sign-only-panel {
  padding: 14px;
  border: 2px solid #1f6feb;
  border-radius: 14px;
  background: #f7fbff;
}

.customer-sign-only-panel .section-heading h3 {
  color: #0f4ea8;
}

.image-preview {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-top: 8px;
  border: 1px dashed #bdc8d5;
  border-radius: 11px;
  color: #8c9aad;
  background: #f7f9fb;
  font-size: 9px;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.detail-box {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.detail-box span,
.detail-box strong,
.detail-box p {
  display: block;
}

.detail-box span {
  color: var(--muted);
  font-size: 9px;
}

.detail-box strong {
  margin-top: 5px;
  color: var(--navy-900);
  font-size: 11px;
}

.detail-box p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
}

.notice {
  padding: 13px 14px;
  border: 1px solid #bfe5df;
  border-radius: 10px;
  color: #336b67;
  background: #eef9f7;
  font-size: 10px;
  line-height: 1.6;
}

.danger-zone {
  padding: 14px;
  border: 1px solid #f0caca;
  border-radius: 10px;
  background: #fff8f8;
}

.danger-zone h3 {
  margin: 0 0 5px;
  color: var(--red-600);
  font-size: 11px;
}

.danger-zone p {
  margin: 0 0 12px;
  color: #8e6565;
  font-size: 9px;
  line-height: 1.5;
}

.document-stage {
  padding: 28px;
}

.signature-layout-panel {
  position: sticky;
  top: 70px;
  z-index: 25;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.signature-layout-panel.compact {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.signature-layout-panel.compact strong {
  color: var(--navy-900);
  font-size: 12px;
}

.signature-layout-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.signature-layout-title strong {
  color: var(--navy-900);
  font-size: 13px;
}

.signature-layout-title span {
  color: var(--muted);
  font-size: 10px;
}

.signature-layout-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 10px;
}

.signature-layout-grid section {
  padding: 9px 10px;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  background: #f8fafc;
}

.signature-layout-grid h3 {
  margin: 0 0 7px;
  color: var(--navy-900);
  font-size: 11px;
}

.signature-layout-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.signature-layout-control {
  display: grid;
  grid-template-columns: 42px 1fr 46px;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  color: #44546a;
  font-size: 10px;
}

.signature-layout-control input {
  width: 100%;
}

.signature-layout-control b {
  color: var(--navy-900);
  font-size: 10px;
  text-align: right;
}

.seal-adjustment-panel {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.15fr);
  align-items: center;
  gap: 14px 18px;
}

.seal-adjustment-panel .compact-title {
  display: grid;
  gap: 3px;
}

.seal-adjustment-panel .compact-title strong {
  color: var(--navy-900);
  font-size: 12px;
}

.seal-adjustment-panel .compact-title span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.seal-adjustment-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.seal-adjustment-control {
  display: grid;
  grid-template-columns: 58px minmax(80px, 1fr) 54px 44px;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid #dbe3ea;
  border-radius: 10px;
  background: #f8fafc;
  color: #334155;
  font-size: 10px;
}

.seal-adjustment-control:has([data-seal-setting="sealWidth"]),
.seal-adjustment-control:has([data-seal-setting="sealHeight"]),
.seal-adjustment-control:has([data-seal-setting="marginRightPt"]) {
  display: none;
}

.seal-adjustment-control span {
  white-space: nowrap;
  font-weight: 700;
}

.seal-adjustment-control input[type="range"] {
  width: 100%;
}

.seal-adjustment-control input[type="number"] {
  width: 54px;
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  font-size: 10px;
}

.seal-adjustment-control select {
  width: 100%;
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  font-size: 10px;
}

.seal-adjustment-control b {
  color: var(--navy-900);
  font-size: 10px;
  text-align: right;
}

.seal-adjustment-panel > .button {
  justify-self: end;
  white-space: nowrap;
}

.seller-document-locked-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom-color: #f1d7a8;
  background: #fff8e6;
}

.seller-document-locked-panel strong {
  color: #8a5200;
}

.seller-document-locked-panel .lock-time {
  margin-left: auto;
  color: #8a6d3b;
  font-size: 10px;
  white-space: nowrap;
}

.document-sheet {
  position: relative;
  width: 210mm;
  max-width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 12mm 13mm;
  color: #172335;
  background: #fff;
  box-shadow: 0 15px 38px rgba(19, 35, 56, 0.12);
  font-family: Arial, sans-serif;
  box-sizing: border-box;
}

.order-reference {
  min-height: calc(var(--order-page-count, 1) * 297mm);
}

.internal-contract-reference {
  min-height: calc(var(--internal-contract-page-count, 1) * 297mm);
  font-family: Arial, "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

.exact-tier-grid,
.exact-tier-row {
  grid-template-columns: 28px 130px 120px minmax(150px, 1fr) 58px;
  min-width: 500px;
}

.exact-tier-row .exact-tier-quantity {
  min-width: 0;
  width: 100%;
}

.internal-contract-reference.internal-contract-print-measurement {
  width: 210mm;
  max-width: 210mm;
  min-height: 0;
  padding: 0 8mm;
  box-shadow: none;
}

.reference-table.internal-contract-table {
  min-width: 0;
  table-layout: fixed;
}

.internal-contract-reference .internal-contract-totals {
  margin-top: 0;
  border-top: 0;
}

.internal-contract-heading {
  align-items: center;
  margin-top: 1.5mm;
  padding: 2.8mm 4mm;
  border-color: #172335;
  background: #f2f5f8;
}

.internal-contract-heading h1 {
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  font-size: 18pt;
  font-weight: 800;
  letter-spacing: 0.24em;
}

.internal-contract-heading strong {
  margin-bottom: 1mm;
  color: #526174;
  font-size: 7.5pt;
}

.internal-contract-heading span {
  color: #172335;
  font-size: 8.5pt;
  font-weight: 700;
}

.internal-contract-reference .ref-order-parties .ref-party {
  min-height: 22mm;
  padding: 3mm 4mm;
}

.internal-contract-reference .ref-order-parties .ref-party strong {
  margin-bottom: 1.2mm;
  color: #526174;
  font-size: 8pt;
}

.internal-contract-reference .ref-order-parties .ref-party b {
  margin-bottom: 1mm;
  color: #172335;
  font-size: 9.5pt;
}

.internal-contract-reference .ref-order-parties .ref-party span {
  font-size: 8pt;
  line-height: 1.42;
}

.internal-contract-preamble {
  padding: 2.5mm 4mm;
  border: 1px solid #172335;
  border-top: 1px solid #172335;
  border-bottom: 0;
  font-size: 10pt;
  line-height: 1.6;
  text-align: justify;
}

.internal-contract-preamble p {
  margin: 0;
  text-indent: 2em;
}

.internal-contract-purchase-heading,
.internal-contract-terms {
  border: 1px solid #172335;
  border-top: 0;
  color: #172335;
  font-size: 9.5pt;
  line-height: 1.65;
}

.internal-contract-purchase-heading {
  padding: 2mm 4mm;
}

.internal-contract-purchase-heading h2,
.internal-contract-clause-heading {
  margin: 0;
  font-size: 11pt;
  line-height: 1.45;
}

.internal-contract-purchase-heading p,
.internal-contract-clause-section p {
  margin: 1.2mm 0 0;
  text-align: justify;
}

.internal-contract-bank-line {
  display: block;
}

.internal-contract-clause-section {
  padding: 2.5mm 4mm;
  border-top: 0;
}

.internal-contract-clause-heading {
  break-after: avoid;
  page-break-after: avoid;
}

.internal-contract-clause-heading + p {
  break-before: avoid;
  page-break-before: avoid;
}

.internal-contract-reference .internal-contract-signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 0;
  border: 1px solid #172335;
  border-top: 0;
}

.internal-contract-signature-block {
  position: relative;
  min-height: 48mm;
  padding: 4mm;
  box-sizing: border-box;
}

.internal-contract-signature-block + .internal-contract-signature-block {
  border-left: 1px solid #172335;
}

.internal-contract-signature-company {
  display: block;
  margin-bottom: 1mm;
}

.internal-contract-signature-body {
  position: relative;
  display: grid;
  min-height: 38mm;
  grid-template-rows: 2fr 3fr 3fr;
}

.internal-contract-signature-body > span {
  display: flex;
  align-items: center;
}

.internal-contract-signature-seal {
  position: absolute;
  top: 0;
  left: 24mm;
  width: 38mm;
  height: 38mm;
  object-fit: contain;
}

.internal-contract-reference .quotation-table th,
.internal-contract-reference .quotation-table td {
  text-align: center;
  vertical-align: middle;
}

.internal-contract-reference .quotation-table td.ref-description {
  text-align: left;
  vertical-align: middle;
}

.doc-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 3px solid #123f5f;
}

.doc-brand {
  min-width: 0;
  flex: 1;
}

.doc-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-logo {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #087f78;
  font-size: 13px;
  font-weight: 800;
}

.doc-brand h2 {
  margin: 0;
  color: #123f5f;
  font-size: 16px;
  line-height: 1.3;
}

.doc-brand p {
  max-width: 520px;
  margin: 8px 0 0;
  color: #627083;
  font-size: 8px;
  line-height: 1.55;
}

.doc-title {
  min-width: 190px;
  text-align: right;
}

.doc-title h1 {
  margin: 0;
  color: #123f5f;
  font-size: 25px;
  letter-spacing: 0.04em;
}

.doc-title strong {
  display: block;
  margin-top: 7px;
  color: #087f78;
  font-size: 10px;
}

.doc-title span {
  display: block;
  margin-top: 4px;
  color: #687688;
  font-size: 8px;
}

.doc-party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 24px 0;
}

.doc-party {
  padding: 13px 15px;
  border: 1px solid #dbe3ea;
  border-radius: 7px;
  background: #fbfcfd;
}

.doc-party label {
  display: block;
  margin-bottom: 7px;
  color: #087f78;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.doc-party strong {
  display: block;
  color: #17314b;
  font-size: 10px;
}

.doc-party p {
  margin: 5px 0 0;
  color: #687688;
  font-size: 7.5px;
  line-height: 1.55;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 7.5px;
}

.doc-table th {
  padding: 8px 6px;
  color: #fff;
  background: #123f5f;
  text-align: left;
  font-size: 7px;
  letter-spacing: 0.04em;
}

.doc-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #dfe6ec;
  vertical-align: top;
  line-height: 1.45;
}

.doc-table .right {
  text-align: right;
  white-space: nowrap;
}

.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.doc-item img,
.doc-item-placeholder {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  object-fit: cover;
  border: 1px solid #dbe3ea;
  border-radius: 4px;
}

.doc-item-placeholder {
  display: grid;
  place-items: center;
  color: #94a1b0;
  background: #f4f7f9;
  font-size: 5px;
}

.doc-item strong {
  display: block;
  color: #17314b;
  font-size: 8px;
}

.doc-item span {
  display: block;
  margin-top: 3px;
  color: #6e7b8c;
  font-size: 6.5px;
}

.doc-totals-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 24px;
  margin-top: 18px;
}

.doc-amount-words {
  color: #667589;
  font-size: 7px;
  line-height: 1.6;
}

.doc-amount-words strong {
  display: block;
  margin-bottom: 4px;
  color: #17314b;
  font-size: 7.5px;
}

.doc-totals {
  padding: 10px 12px;
  border-radius: 6px;
  background: #f5f8fa;
}

.doc-total-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 4px 0;
  color: #687688;
  font-size: 7.5px;
}

.doc-total-row.grand {
  margin-top: 5px;
  padding-top: 8px;
  color: #123f5f;
  border-top: 1px solid #cbd6df;
  font-size: 9px;
  font-weight: 800;
}

.doc-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  margin-top: 21px;
}

.doc-info {
  padding: 10px 11px;
  border-left: 3px solid #0a958b;
  background: #f7fafb;
}

.doc-info h4 {
  margin: 0 0 5px;
  color: #17314b;
  font-size: 7.5px;
}

.doc-info p {
  margin: 0;
  color: #667589;
  font-size: 6.7px;
  line-height: 1.55;
  white-space: pre-line;
}

.doc-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #dce4ea;
}

.doc-note h4 {
  margin: 0 0 5px;
  color: #17314b;
  font-size: 7.5px;
}

.doc-note p {
  margin: 0;
  color: #687688;
  font-size: 6.7px;
  line-height: 1.55;
  white-space: pre-line;
}

.doc-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  margin-top: 45px;
}

.signature-line {
  padding-top: 7px;
  color: #687688;
  border-top: 1px solid #97a5b4;
  font-size: 7px;
}

.doc-signature-box {
  position: relative;
  min-height: 82px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.signature-assets {
  position: absolute;
  inset: -32px 8px 10px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

.signature-image {
  width: 35mm;
  max-height: 20mm;
  object-fit: contain;
}

.seal-image {
  width: 38mm;
  height: 38mm;
  object-fit: contain;
  opacity: 0.9;
}

.doc-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 34px;
  padding-top: 10px;
  color: #8a97a7;
  border-top: 1px solid #dfe6ec;
  font-size: 6.5px;
}

.reference-document {
  --document-preview-padding: 10mm;
  max-width: 210mm;
  padding: 10mm;
  color: #111;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 8px;
  line-height: 1.35;
}

.reference-document strong,
.reference-document b {
  font-weight: 700;
}

.document-letterhead {
  position: relative;
  display: grid;
  grid-template-columns: var(--document-logo-column, 39mm) minmax(0, 1fr);
  align-items: center;
  gap: var(--document-header-gap, 6.5mm);
  min-height: 24mm;
  margin-bottom: 4.2mm;
  padding-bottom: 3mm;
  border-bottom: 0.45mm solid #111;
}

.document-letterhead::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1.4mm;
  left: 0;
  border-bottom: 0.2mm solid #111;
}

.document-letterhead-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: var(--document-logo-height, 20mm);
}

.document-letterhead-logo img {
  max-width: var(--document-logo-width, 35mm);
  max-height: var(--document-logo-height, 20mm);
  object-fit: contain;
}

.document-logo-fallback {
  display: grid;
  width: min(var(--document-logo-width, 35mm), 28mm);
  height: min(var(--document-logo-height, 20mm), 18mm);
  place-items: center;
  color: #fff;
  background: #111;
  border-radius: 1.5mm;
  font-size: 12pt;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.document-letterhead-copy {
  display: grid;
  justify-items: stretch;
  align-content: center;
  justify-self: stretch;
  min-width: 0;
  padding-right: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  text-align: right;
  color: #000;
  font-family: "Times New Roman", "SimSun", serif;
  font-weight: 700;
  line-height: 1.15;
}

.document-letterhead-copy h2 {
  justify-self: end;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 0 1.4mm;
  color: #000;
  font-size: var(--document-title-size, 13.2pt);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: 0;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
  overflow-wrap: normal;
}

.document-letterhead-copy span {
  justify-self: end;
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 6.5pt;
  line-height: 1.14;
  text-align: right;
  overflow-wrap: break-word;
  white-space: normal;
}

.document-letterhead-copy .document-letterhead-address {
  margin-bottom: 0.6mm;
}

.ref-top-grid.quotation-info-grid {
  grid-template-columns: 71fr 29fr;
  border-bottom: 1px solid #111;
}

.quotation-info-grid > :last-child {
  border-right: 0;
}

.quotation-party-stack {
  min-width: 0;
  border-right: 1px solid #111;
}

.quotation-party-stack .ref-party {
  border-right: 0;
}

.quotation-party-stack .ref-party:first-child {
  border-bottom: 1px solid #111;
}

.ref-party-logo {
  max-width: 72px;
  max-height: 36px;
  object-fit: contain;
  margin-bottom: 4px;
}

.ref-main-title {
  margin: 8px 0 10px;
  color: #111;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-decoration: underline;
}

.ref-top-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.05fr 0.9fr;
  border: 1px solid #111;
  border-bottom: 0;
}

.ref-party,
.ref-meta {
  min-width: 0;
  padding: 7px;
  border-right: 1px solid #111;
}

.ref-top-grid > :last-child,
.ref-order-parties > :last-child {
  border-right: 0;
}

.ref-party strong {
  display: block;
  margin-bottom: 4px;
  font-size: 8px;
  text-decoration: underline;
}

.ref-party b,
.ref-party span {
  display: block;
}

.ref-party b {
  margin-bottom: 3px;
  font-size: 8.5px;
}

.ref-party span {
  font-size: 6.8px;
  line-height: 1.45;
}

.ref-meta {
  display: grid;
  gap: 6px;
}

.ref-meta div {
  border-bottom: 1px dotted #999;
}

.ref-meta div:last-child {
  border-bottom: 0;
}

.ref-meta strong,
.ref-meta span {
  display: block;
}

.ref-meta strong {
  font-size: 6.8px;
}

.ref-meta span {
  margin-top: 2px;
  font-size: 7.2px;
}

.reference-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  color: #111;
  font-size: 6.5px;
}

.reference-table th,
.reference-table td {
  padding: 5px 4px;
  border: 1px solid #111;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.reference-table th {
  background: #edf1f4;
  font-size: 6.4px;
  font-weight: 700;
  text-align: center;
}

.reference-table tbody tr {
  min-height: 44px;
}

.reference-table .ref-product-type-row {
  min-height: 0;
}

.reference-table .ref-product-type-row td {
  padding: 2px 4px;
  color: #000;
  background: #bfbfbf;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
  vertical-align: middle;
}

.reference-table .ref-name {
  font-weight: 700;
  line-height: 1.35;
  vertical-align: top;
}

.reference-table .document-product-name {
  display: block;
  font-size: 7.8px;
  font-weight: 800;
  line-height: 1.25;
}

.reference-table .document-product-code {
  display: block;
  margin-top: 3px;
  font-size: 6.2px;
  font-weight: 400;
  line-height: 1.2;
}

.quotation-table td {
  vertical-align: middle;
}

.quotation-table .ref-name,
.quotation-table .ref-number,
.quotation-table .ref-money,
.quotation-table .ref-center {
  text-align: center;
  vertical-align: middle;
}

.quotation-table .quote-external-description {
  line-height: 1.45;
  white-space: pre-line;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.quotation-table .quotation-picture-cell {
  text-align: center;
  vertical-align: middle;
}

.quotation-table .quotation-picture-cell img,
.quotation-table .quotation-picture-cell span {
  margin-left: auto;
  margin-right: auto;
}

.quotation-table.tiered-quotation-table th:nth-child(1) { width: 4%; }
.quotation-table.tiered-quotation-table th:nth-child(2) { width: 14%; }
.quotation-table.tiered-quotation-table th:nth-child(3) { width: 8%; }
.quotation-table.tiered-quotation-table th:nth-child(4) { width: 30%; }
.quotation-table.tiered-quotation-table th:nth-child(5) { width: 6%; }
.quotation-table.tiered-quotation-table th:nth-child(6) { width: 8%; }
.quotation-table.tiered-quotation-table th:nth-child(7) { width: 8%; }
.quotation-table.tiered-quotation-table th:nth-child(8) { width: 5%; }
.quotation-table.tiered-quotation-table th:nth-child(9) { width: 9%; }
.quotation-table.tiered-quotation-table th:nth-child(10) { width: 8%; }

.quotation-table.exact-tiered-quotation-table th:nth-child(1) { width: 4%; }
.quotation-table.exact-tiered-quotation-table th:nth-child(2) { width: 15%; }
.quotation-table.exact-tiered-quotation-table th:nth-child(3) { width: 9%; }
.quotation-table.exact-tiered-quotation-table th:nth-child(4) { width: 35%; }
.quotation-table.exact-tiered-quotation-table th:nth-child(5) { width: 8%; }
.quotation-table.exact-tiered-quotation-table th:nth-child(6) { width: 10%; }
.quotation-table.exact-tiered-quotation-table th:nth-child(7) { width: 11%; }
.quotation-table.exact-tiered-quotation-table th:nth-child(8) { width: 8%; }

.exact-tiered-quotation-table .exact-tier-remark {
  text-align: left;
  vertical-align: middle;
  white-space: pre-line;
}

.tiered-quotation-table .tiered-first-tier-row td,
.tiered-quotation-table .tiered-subsequent-tier-row td {
  text-align: center;
  vertical-align: middle;
}

.tiered-quotation-table .tiered-description {
  text-align: left;
  vertical-align: middle;
  white-space: pre-line;
  line-height: 1.36;
}

.tiered-quotation-table .tiered-product-identity-cell {
  vertical-align: middle;
}

.tiered-quotation-declaration {
  padding: 5px 7px;
  border: 1px solid #111;
  border-top: 0;
  font-size: 7px;
  line-height: 1.4;
}

.tiered-quotation-declaration p {
  margin: 0;
}

.quotation-reference .document-letterhead {
  margin-bottom: 4.5mm;
  padding-bottom: 3mm;
}

.quotation-reference .ref-main-title {
  margin: 5px 0 8px;
  font-size: 21px;
  letter-spacing: 0.1em;
}

.quotation-reference .ref-party,
.quotation-reference .ref-meta {
  padding: 5px 6px;
}

.quotation-reference .ref-party strong {
  margin-bottom: 3px;
}

.quotation-reference .ref-party b {
  margin-bottom: 2px;
}

.quotation-reference .ref-party span {
  line-height: 1.32;
}

.quotation-reference .ref-meta {
  gap: 4px;
}

.quotation-reference .ref-meta div {
  padding-bottom: 2px;
}

.quotation-reference .quotation-table th {
  padding: 5px 3px;
  background: #f0f3f6;
  font-size: 6.7px;
}

.quotation-reference .quotation-table td {
  padding: 4px 4px;
}

.quotation-reference .quotation-table .quote-external-description {
  line-height: 1.36;
}

.reference-table .ref-picture {
  padding: 2px;
  text-align: center;
}

.reference-table .ref-picture img {
  width: 46px;
  height: 42px;
  object-fit: contain;
}

.reference-table .ref-picture span {
  display: inline-grid;
  width: 42px;
  height: 38px;
  place-items: center;
  color: #999;
  border: 1px solid #ccc;
  font-size: 5px;
}

.ref-center {
  text-align: center;
}

.ref-number,
.ref-money {
  text-align: right;
  white-space: nowrap;
}

.quotation-table th:nth-child(1) { width: 4%; }
.quotation-table th:nth-child(2) { width: 14%; }
.quotation-table th:nth-child(3) { width: 8%; }
.quotation-table th:nth-child(4) { width: 32%; }
.quotation-table th:nth-child(5) { width: 7%; }
.quotation-table th:nth-child(6) { width: 6%; }
.quotation-table th:nth-child(7) { width: 10%; }
.quotation-table th:nth-child(8) { width: 10%; }
.quotation-table th:nth-child(9) { width: 9%; }

.quotation-table th:nth-child(2),
.quotation-table th:nth-child(3),
.quotation-table th:nth-child(5),
.quotation-table th:nth-child(6),
.quotation-table th:nth-child(7),
.quotation-table th:nth-child(8),
.quotation-table th:nth-child(9),
.quotation-table td:nth-child(2),
.quotation-table td:nth-child(3),
.quotation-table td:nth-child(5),
.quotation-table td:nth-child(6),
.quotation-table td:nth-child(7),
.quotation-table td:nth-child(8),
.quotation-table td:nth-child(9),
.quotation-table .ref-name,
.quotation-table .quotation-picture-cell,
.quotation-table .ref-number,
.quotation-table .ref-money {
  text-align: center;
  vertical-align: middle;
}

.quotation-table .ref-name .document-product-name,
.quotation-table .ref-name .document-product-code {
  text-align: center;
}

.quotation-table .quotation-picture-cell img,
.quotation-table .quotation-picture-cell span {
  margin-left: auto;
  margin-right: auto;
}

.reference-document.quotation-reference .quotation-table th,
.reference-document.quotation-reference .quotation-table td,
.reference-document.order-reference .quotation-table th,
.reference-document.order-reference .quotation-table td {
  text-align: center !important;
  vertical-align: middle !important;
}

.reference-document.quotation-reference .quotation-table th.quote-description-heading,
.reference-document.quotation-reference .quotation-table th.quote-remarks-heading,
.reference-document.order-reference .quotation-table th.quote-description-heading,
.reference-document.order-reference .quotation-table th.quote-remarks-heading {
  text-align: center !important;
  vertical-align: middle !important;
}

.reference-document.quotation-reference .quotation-table td.quote-description-cell,
.reference-document.quotation-reference .quotation-table td.quote-remarks-cell,
.reference-document.order-reference .quotation-table td.quote-description-cell,
.reference-document.order-reference .quotation-table td.quote-remarks-cell {
  text-align: left !important;
  vertical-align: middle !important;
  white-space: pre-line;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: none;
}

.reference-document.quotation-reference .quotation-table .ref-product-type-row td,
.reference-document.order-reference .quotation-table .ref-product-type-row td {
  text-align: left !important;
  vertical-align: middle !important;
}

.commercial-invoice-table {
  table-layout: fixed;
}

.commercial-invoice-table th,
.commercial-invoice-table td {
  text-align: center;
  vertical-align: middle;
}

.commercial-invoice-table .ref-number,
.commercial-invoice-table .ref-money {
  text-align: center;
}

.commercial-invoice-table .invoice-product-cell,
.commercial-invoice-table .invoice-description-cell {
  line-height: 1.35;
  white-space: pre-line;
}

.commercial-invoice-table .invoice-product-cell {
  text-align: center;
  vertical-align: middle;
}

.commercial-invoice-table .invoice-description-cell {
  text-align: left;
  vertical-align: middle;
}

.commercial-invoice-table .ref-total-label {
  text-align: right;
}

.commercial-invoice-table .invoice-col-no { width: 5%; }
.commercial-invoice-table .invoice-col-product { width: 16%; }
.commercial-invoice-table .invoice-col-description { width: 23%; }
.commercial-invoice-table .invoice-col-hs { width: 9%; }
.commercial-invoice-table .invoice-col-origin { width: 12%; }
.commercial-invoice-table .invoice-col-qty { width: 6.428571%; }
.commercial-invoice-table .invoice-col-unit { width: 6.571429%; }
.commercial-invoice-table .invoice-col-unit-price { width: 10%; }
.commercial-invoice-table .invoice-col-amount { width: 12%; }

.invoice-software-table .invoice-col-no { width: 5.5%; }
.invoice-software-table .invoice-col-product { width: 16%; }
.invoice-software-table .invoice-col-description { width: 41.5%; }
.invoice-software-table .invoice-col-qty { width: 8.428571%; }
.invoice-software-table .invoice-col-unit { width: 6.571429%; }
.invoice-software-table .invoice-col-unit-price { width: 10%; }
.invoice-software-table .invoice-col-amount { width: 12%; }

.ref-total-label {
  font-size: 7.5px;
  font-weight: 800;
  text-align: right;
}

.ref-grand-total {
  font-size: 8px;
  font-weight: 800;
}

.ref-amount-words {
  display: grid;
  grid-template-columns: 105px 1fr;
  padding: 7px;
  border: 1px solid #111;
  border-top: 0;
}

.ref-amount-words span {
  font-weight: 800;
}

.ref-terms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 8px;
  border: 1px solid #111;
  border-bottom: 0;
}

.ref-terms-grid section {
  min-height: 58px;
  padding: 7px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
}

.ref-terms-grid section:nth-child(2n) {
  border-right: 0;
}

.quotation-reference .ref-terms-grid {
  margin-top: 0;
  border-top: 0;
}

.quotation-terms-grid .ref-term-wide {
  grid-column: 1 / -1;
  border-right: 0;
}

.ref-bank-payment-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #111;
  border-top: 0;
}

.ref-bank-payment-row section {
  min-height: 58px;
  padding: 7px;
  border-right: 1px solid #111;
}

.ref-bank-payment-row section:last-child {
  border-right: 0;
}

.ref-quotation-terms {
  padding: 7px;
  border: 1px solid #111;
  border-top: 0;
  background: #fbfcfd;
}

.reference-document h2,
.reference-document h3 {
  color: #111;
}

.ref-terms-grid h3,
.ref-bank-payment-row h3,
.ref-quotation-terms h3,
.ref-declaration h3 {
  margin: 0 0 4px;
  font-size: 7.5px;
  text-decoration: underline;
}

.ref-terms-grid p,
.ref-bank-payment-row p,
.ref-quotation-terms p,
.ref-declaration p,
.ref-payment-info p,
.ref-breach p {
  margin: 0;
  font-size: 6.6px;
  line-height: 1.5;
  white-space: pre-line;
}

.ref-quotation-terms p {
  font-size: 6.4px;
}

.ref-declaration {
  min-height: 72px;
  padding: 7px;
  border: 1px solid #111;
  border-top: 0;
}

.ref-quotation-sign {
  min-height: 49mm;
  border: 1px solid #111;
  border-top: 0;
  background: #fff;
}

.ref-page-footer {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid #111;
  font-size: 6px;
  text-align: center;
}

.ref-document-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8mm;
  color: #222;
  font-size: 6.2px;
  line-height: 1.35;
  text-align: left;
}

.ref-document-footer .ref-footer-note {
  flex: 1;
}

.ref-document-footer .ref-footer-page {
  flex: 0 0 30mm;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.ref-order-heading {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: end;
  margin-top: 2mm;
  padding: 6px 9px;
  border: 1px solid #111;
  background: linear-gradient(180deg, #f7f9fb 0%, #eef2f6 100%);
}

.ref-order-heading h1 {
  margin: 0;
  color: #111;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.ref-order-heading > div:last-child {
  text-align: right;
}

.ref-order-heading strong,
.ref-order-heading span {
  display: block;
  font-size: 7.5px;
}

.order-source-meta {
  display: block;
  margin-top: 0;
  padding: 0;
  border: 1px solid #111;
  border-top: 0;
  border-right: 1px solid #111;
}

.order-source-meta div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  padding: 4px 8px;
  border-bottom: 0;
}

.order-source-meta strong,
.order-source-meta span {
  display: inline;
  margin: 0;
}

.order-source-meta strong {
  font-size: 7px;
  letter-spacing: 0.02em;
}

.order-source-meta span {
  font-size: 7.4px;
  font-weight: 700;
}

.ref-order-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 0;
  border: 1px solid #111;
  border-top: 0;
  border-bottom: 0;
}

.ref-order-parties .ref-party {
  min-height: 54px;
  padding: 6px 8px;
  background: #fff;
}

.ref-order-parties .ref-party strong {
  margin-bottom: 3px;
  font-size: 7.3px;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

.ref-order-parties .ref-party b {
  margin-bottom: 3px;
  font-size: 8.2px;
}

.ref-order-parties .ref-party span {
  font-size: 7px;
  line-height: 1.35;
}

.order-table th:nth-child(1) { width: 4%; }
.order-table th:nth-child(2) { width: 14%; }
.order-table th:nth-child(3) { width: 8%; }
.order-table th:nth-child(4) { width: 32%; }
.order-table th:nth-child(5) { width: 7%; }
.order-table th:nth-child(6) { width: 6%; }
.order-table th:nth-child(7) { width: 10%; }
.order-table th:nth-child(8) { width: 10%; }
.order-table th:nth-child(9) { width: 9%; }

.order-reference .quotation-table th {
  background: #eef2f6;
  font-size: 7.2px;
}

.order-reference .quotation-table td {
  padding-top: 5px;
  padding-bottom: 5px;
  vertical-align: middle;
}

.order-reference .ref-product-type-row td {
  background: #d9dee4;
  letter-spacing: 0.02em;
}

.ref-order-totals {
  margin-top: 6px;
  border: 1px solid #111;
  background: #fff;
}

.order-reference .ref-order-totals {
  margin-top: 0;
  border-top: 0;
}

.quotation-reference .ref-quote-totals {
  margin-top: 0;
  border-top: 0;
}

.ref-order-totals > div {
  display: grid;
  grid-template-columns: 81% 19%;
  border-bottom: 1px solid #111;
}

.ref-order-totals > div strong,
.ref-order-totals > div span {
  padding: 4px 7px;
}

.ref-order-totals > div span {
  border-left: 1px solid #111;
  font-weight: 700;
  text-align: right;
}

.ref-order-totals .grand {
  font-size: 8px;
  background: #f6f7f9;
}

.ref-order-totals p {
  margin: 0;
  padding: 6px 7px;
  font-size: 6.8px;
}

.ref-order-totals .ref-order-amount-words {
  font-weight: 800;
  background: #fbfcfd;
}

.quotation-reference .ref-quote-totals,
.quotation-reference .ref-terms-grid,
.quotation-reference .ref-bank-payment-row,
.quotation-reference .ref-quotation-terms,
.quotation-reference .ref-quotation-sign {
  margin-top: -1px;
  border-top: 1px solid #111;
}

.ref-order-conditions,
.ref-payment-info,
.ref-discount-info,
.ref-signature-log,
.ref-breach,
.ref-buyer-signed-files {
  margin-top: 6px;
  border: 1px solid #111;
}

.order-reference .ref-order-conditions,
.order-reference .ref-bank-payment-row,
.order-reference .ref-breach,
.order-reference .ref-buyer-signed-files {
  margin-top: 0;
}

.order-reference .ref-order-conditions,
.order-reference .ref-bank-payment-row {
  border-top: 0;
}

.ref-order-conditions h2,
.ref-payment-info h2,
.ref-discount-info h2,
.ref-signature-log h2,
.ref-breach h2,
.ref-buyer-signed-files h2 {
  margin: 0;
  padding: 5px 7px;
  border-bottom: 1px solid #111;
  background: #edf1f4;
  font-size: 8px;
  text-align: center;
}

.ref-condition-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.ref-condition-grid > div {
  display: grid;
  grid-template-columns: 90px 1fr;
  min-height: 30px;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
}

.ref-condition-grid > div:nth-child(2n) {
  border-right: 0;
}

.ref-condition-grid > div:nth-last-child(-n+2) {
  border-bottom: 0;
}

.order-condition-grid > div:nth-last-child(-n+2) {
  border-bottom: 1px solid #111;
}

.order-condition-grid::after {
  content: "";
  display: block;
  min-height: 30px;
  border-bottom: 1px solid #111;
}

.ref-condition-grid strong,
.ref-condition-grid span {
  padding: 5px 6px;
  white-space: pre-line;
}

.ref-condition-grid strong {
  border-right: 1px solid #111;
}

.ref-payment-info p,
.ref-discount-info p,
.ref-breach p,
.ref-buyer-signed-files p {
  min-height: 42px;
  padding: 6px 7px;
  line-height: 1.42;
}

.order-reference .ref-buyer-signed-files {
  border-top: 0;
  font-size: 7px;
}

.order-reference .ref-buyer-signed-files p {
  min-height: 0;
  margin: 0;
}

.ref-signature-log .reference-table {
  margin: 0;
  border: 0;
}

.package-product-photo {
  width: 58px;
  height: 42px;
  object-fit: contain;
  border: 1px solid #d8dee9;
  background: #fff;
}

.package-product-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.ref-signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 8px;
  border: 1px solid #111;
}

.order-reference {
  position: relative;
}

.order-reference .ref-breach {
  border-top: 0;
}

.order-reference .ref-signature-grid {
  margin-top: 0;
  border-top: 0;
}

.ref-signature {
  position: relative;
  min-height: 100px;
  padding: 7px 8px 8px;
  border-right: 1px solid #111;
  font-size: 6.8px;
  overflow: visible;
}

.ref-signature > strong {
  display: block;
  margin: -7px -8px 0;
  padding: 5px 8px;
  border-bottom: 1px solid #111;
  background: #f4f6f8;
  font-size: 7.6px;
  letter-spacing: 0.02em;
}

.order-signature-grid {
  grid-template-columns: 1fr 1fr;
}

.order-signature-grid .ref-signature {
  min-height: 63mm;
}

.ref-signature:last-child {
  border-right: 0;
}

.ref-signature-assets {
  display: flex;
  align-items: center;
  gap: 8px;
}

.signature-overlay-assets {
  position: absolute;
  inset: 0;
  z-index: 2;
  min-height: 0;
  height: auto;
  display: block;
  pointer-events: none;
}

.adjustable-signature-assets {
  pointer-events: auto;
}

.adjustable-signature-assets:empty::after {
  content: "";
}

.adjustable-signature-assets .signature-image {
  position: absolute;
  height: auto;
  max-height: 20mm;
  object-fit: contain;
}

.adjustable-signature-assets .seal-image {
  position: absolute;
  width: 38mm !important;
  height: 38mm !important;
  max-width: 38mm;
  max-height: 38mm;
  object-fit: contain;
  opacity: var(--seller-seal-opacity, 1);
  transform: rotate(var(--seller-seal-rotation, 0deg));
  transform-origin: center center;
}

.adjustable-signature-assets .date-image {
  position: absolute;
  max-height: 11mm;
  object-fit: contain;
  pointer-events: auto;
}

.buyer-signature-assets {
  pointer-events: none;
}

.buyer-signature-assets.adjustable-signature-assets {
  pointer-events: auto;
}

.buyer-signature-assets .signature-image {
  position: absolute;
  left: 8%;
  top: 12%;
  max-width: 42mm;
  max-height: 20mm;
}

.buyer-signature-assets .date-image {
  position: absolute;
  max-height: 11mm;
  object-fit: contain;
}

.buyer-signature-assets .seal-image {
  position: absolute;
  right: 7%;
  top: 22%;
  width: 38mm;
  height: 38mm;
  object-fit: contain;
}

.buyer-signature-assets.adjustable-signature-assets .seal-image {
  right: auto;
}

.adjustable-signature-assets [data-signature-drag] {
  cursor: move;
  touch-action: none;
  user-select: none;
}

.dragging-signature-asset {
  opacity: 0.82;
  outline: 1px dashed #b41f2a;
  outline-offset: 2px;
}

.signature-fields {
  position: relative;
  z-index: 1;
  height: 51mm;
  margin-top: 4mm;
  padding-top: 0;
}

.signature-field-row {
  position: absolute;
  left: 0;
  display: grid;
  grid-template-columns: max-content 42mm;
  align-items: end;
  min-height: 6mm;
  justify-content: start;
  gap: 0.6mm;
  font-size: 7.2px;
  font-weight: 700;
  line-height: 1;
}

.signature-authorized-row {
  top: 0;
}

.signature-stamp-row {
  top: 22.5mm;
  transform: translateY(-50%);
}

.signature-date-row {
  top: 45mm;
}

.signature-field-row span {
  white-space: nowrap;
}

.signature-field-row i {
  display: block;
  height: 0;
  border-bottom: 0.35mm solid #111;
}

.signature-stamp-row i {
  display: none;
}

.ref-quotation-sign .quotation-signature-block {
  min-height: 49mm;
  padding: 4mm 9mm 5mm;
}

.quotation-auto-signature-grid {
  min-height: 40mm;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 1.2mm;
}

.quotation-signature-detail-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: repeat(3, 1fr);
  align-items: stretch;
  gap: 0;
  height: 39mm;
  overflow: visible;
}

.quotation-auto-field,
.quotation-stamp-field {
  position: relative;
  z-index: 2;
  min-width: 0;
  display: grid;
  grid-template-columns: 38mm minmax(0, 1fr);
  align-items: center;
  column-gap: 4mm;
  min-height: 0;
  text-align: left;
}

.quotation-auto-field span,
.quotation-stamp-field span {
  display: block;
  color: #111827;
  font-size: 7.4px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.quotation-auto-field strong {
  display: block;
  min-height: 0;
  margin-top: 0;
  padding: 0;
  color: #1f2937;
  font-size: 8px;
  line-height: 1.25;
}

.quotation-company-field {
  padding: 0;
  border-left: 0;
  background: none;
  text-align: left;
}

.quotation-company-field strong {
  display: block;
  color: #1f2937;
  font-size: 8.4px;
  font-weight: 800;
  line-height: 1.25;
}

.quotation-stamp-field {
  grid-template-columns: 38mm minmax(0, 1fr);
  align-self: stretch;
  align-items: center;
  z-index: 4;
  text-align: left;
}

.quotation-stamp-box {
  position: absolute;
  left: 22mm;
  top: -12.7mm;
  z-index: 4;
  width: 38mm;
  height: 38mm;
  margin-top: 0;
  display: grid;
  place-items: center;
  overflow: visible;
}

.quotation-stamp-box img {
  width: 38mm;
  height: 38mm;
  max-width: 38mm;
  max-height: 38mm;
  opacity: 0.6;
  object-fit: contain;
  transform: rotate(-2deg);
  transform-origin: center center;
}

.quotation-stamp-box em {
  color: #6b7280;
  font-size: 6.5px;
  font-style: normal;
  line-height: 1.35;
}

.document-actions {
  max-width: 390px;
  flex-wrap: wrap;
}

.final-seal-block {
  width: 48mm;
  min-height: 48mm;
  margin: 12px 0 0 auto;
  display: grid;
  place-items: center;
  padding: 5mm;
  border: 1px dashed #aab4bf;
  text-align: center;
  font-size: 7px;
}

.final-seal-block strong,
.final-seal-block span {
  display: block;
}

.final-seal-block img {
  width: 38mm;
  height: 38mm;
  max-width: 38mm;
  max-height: 38mm;
  object-fit: contain;
}

.page-seam-stamps {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.page-seam-stamps.is-hidden {
  display: none;
}

.page-seam-stamp {
  position: absolute;
  top: var(--seam-page-top, 44%);
  right: var(--seam-screen-right, 0);
  width: var(--seam-slice-width, 6mm);
  height: var(--seam-seal-height, 38mm);
  display: block;
  overflow: hidden;
  border: 1px dashed rgba(180, 31, 42, 0.42);
  background: rgba(180, 31, 42, 0.025);
  cursor: move;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}

.page-seam-stamp.is-hidden {
  display: none;
}

.page-seam-stamp::before {
  content: "";
  position: absolute;
  top: -3mm;
  bottom: -3mm;
  right: 0;
  border-left: 1px dashed rgba(180, 31, 42, 0.65);
  pointer-events: none;
}

.page-seam-stamp::after {
  content: attr(data-slice-label);
  position: absolute;
  top: 50%;
  right: calc(100% + 5px);
  width: 34px;
  transform: translateY(-50%);
  color: #b41f2a;
  font-size: 7px;
  font-weight: 700;
  line-height: 1.15;
  text-align: right;
}

.page-seam-stamps.is-locked .page-seam-stamp {
  border: 0;
  background: transparent;
  cursor: default;
  pointer-events: none;
}

.page-seam-stamps.is-locked .page-seam-stamp::before,
.page-seam-stamps.is-locked .page-seam-stamp::after {
  display: none;
}

.page-seam-stamp-slice {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 2;
}

.page-seam-stamp-slice img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.page-seam-stamp-slice span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 1mm;
  border: 1px dashed rgba(180, 31, 42, 0.4);
  color: #b41f2a;
  font-size: 5px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  box-sizing: border-box;
  opacity: var(--seller-seal-opacity, 1);
  writing-mode: vertical-rl;
}

.internal-contract-seam-seals {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.internal-contract-seam-seals.is-hidden {
  display: none;
}

.internal-contract-seam-group {
  position: absolute;
  inset: 0;
}

.internal-contract-seam-stamp {
  position: absolute;
  top: var(--seam-screen-top);
  width: var(--seam-slice-width);
  height: var(--seam-seal-height);
  overflow: hidden;
}

.internal-contract-seam-group.is-right .internal-contract-seam-stamp {
  right: var(--seam-screen-right, 0);
}

.internal-contract-seam-group.is-left .internal-contract-seam-stamp {
  left: var(--seam-screen-left, 0);
}

.internal-contract-seam-slice,
.internal-contract-seam-slice img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.internal-contract-seam-slice span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #b41f2a;
  font-size: 5px;
  font-weight: 800;
  writing-mode: vertical-rl;
}

.auxiliary-document {
  margin-bottom: 24px;
}

.commercial-invoice {
  position: relative;
  min-height: calc(var(--invoice-page-count, 1) * 297mm);
}

.commercial-invoice.commercial-invoice-print-measurement {
  width: 210mm;
  max-width: 210mm;
  padding: 8mm 8mm 12mm;
}

.commercial-invoice-seam-stamps {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.commercial-invoice-seam-stamps.is-hidden {
  display: none;
}

.commercial-invoice-seam-stamp {
  position: absolute;
  top: var(--invoice-seam-screen-top);
  right: 0;
  width: var(--invoice-seam-slice-width);
  height: var(--invoice-seam-height, 38mm);
  overflow: hidden;
}

.commercial-invoice-seam-slice,
.commercial-invoice-seam-slice img {
  display: block;
  width: 100%;
  height: 100%;
}

.commercial-invoice-seam-slice img {
  object-fit: fill;
}

.commercial-invoice-seam-slice span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #b41f2a;
  font-size: 5px;
  font-weight: 800;
  writing-mode: vertical-rl;
}

.ref-top-grid.compact {
  grid-template-columns: 1fr 1fr 0.8fr;
}

.compact-table th,
.compact-table td {
  padding: 5px 6px;
}

.invoice-schedule {
  margin-top: 10px;
}

.invoice-schedule h3 {
  margin: 0 0 5px;
  font-size: 8px;
}

.receipt-sign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

.receipt-sign-grid > div {
  min-height: 120px;
  padding: 12px;
  border: 1px solid #111;
}

.receipt-sign-grid strong,
.receipt-sign-grid span {
  display: block;
  margin-bottom: 12px;
  font-size: 8px;
}

.shipping-mark-box {
  width: min(520px, 100%);
  min-height: 330px;
  display: grid;
  place-content: center;
  gap: 18px;
  margin: 52px auto 0;
  padding: 32px;
  border: 4px solid #111;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.shipping-mark-box strong,
.shipping-mark-box span {
  display: block;
}

.package-cover {
  min-height: 520px;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
}

.package-cover h1 {
  margin: 0;
  color: #123f5f;
  font-size: 28px;
}

.package-cover p {
  margin: 0;
  font-size: 12px;
}

.toast-stack {
  position: fixed;
  z-index: 200;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 240px;
  padding: 11px 13px;
  border: 1px solid #bfe5df;
  border-radius: 9px;
  color: #285e59;
  background: #eef9f7;
  box-shadow: var(--shadow);
  font-size: 10px;
  font-weight: 700;
}

.toast.error {
  color: #8e4040;
  border-color: #efc2c2;
  background: #fff1f1;
}

/* Application UI refinement. Keep document/PDF styles isolated below. */
body {
  color: #18263a;
}

::selection {
  color: #fff;
  background: rgba(8, 127, 120, 0.86);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  box-shadow: 0 10px 28px rgba(22, 41, 68, 0.055);
}

.content {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
}

.panel,
.stat-card,
.modal {
  box-shadow: 0 14px 34px rgba(22, 41, 68, 0.075);
}

.panel,
.stat-card {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.panel:hover,
.stat-card:hover {
  border-color: rgba(10, 149, 139, 0.22);
  box-shadow: 0 18px 44px rgba(22, 41, 68, 0.10);
}

.panel-header {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.panel-title h2,
.page-heading h1 {
  text-wrap: balance;
}

.toolbar {
  gap: 12px;
}

.toolbar .action-group,
.inline-actions,
.document-actions {
  flex-wrap: wrap;
}

.toolbar .list-filter-controls {
  flex-wrap: nowrap;
}

.button,
.icon-button,
.table-action {
  letter-spacing: 0.01em;
}

.button:active,
.icon-button:active,
.table-action:active {
  transform: translateY(0);
}

.button:focus-visible,
.icon-button:focus-visible,
.table-action:focus-visible,
.nav-item:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.search-box input:focus-visible,
.filter-select:focus-visible {
  outline: 2px solid rgba(10, 149, 139, 0.38);
  outline-offset: 2px;
}

.button.primary {
  background: linear-gradient(135deg, var(--teal-700), var(--teal-600));
}

.button.secondary:hover,
.icon-button:hover,
.table-action:hover {
  border-color: rgba(10, 149, 139, 0.28);
  background: #f7fbfb;
}

.table-action:disabled,
.table-action:disabled:hover,
.table-action:disabled:active {
  color: #8fa0b4;
  border-color: #dbe4ee;
  background: #f3f6f9;
  cursor: not-allowed;
  transform: none;
}

.search-box input,
.filter-select,
.field input,
.field select,
.field textarea,
.line-table input,
.line-table select,
.line-table textarea,
.checkbox-row {
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-box input:hover,
.filter-select:hover,
.line-table input:hover,
.line-table select:hover,
.line-table textarea:hover,
.checkbox-row:hover {
  border-color: #cbd6e2;
  background: #fcfdff;
}

.table-wrap {
  border-radius: 12px;
  background: #fff;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f9fc;
}

.data-table tbody tr {
  transition: background 140ms ease, box-shadow 140ms ease;
}

.data-table tbody tr:hover {
  background: #f6fbfa;
}

.data-table td:first-child,
.data-table th:first-child {
  padding-left: 16px;
}

.data-table td:last-child,
.data-table th:last-child {
  padding-right: 16px;
}

.table-action {
  box-shadow: 0 1px 2px rgba(22, 41, 68, 0.04);
}

.badge,
.customer-category,
.product-category {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.modal {
  scrollbar-gutter: stable;
}

.modal-header,
.modal-footer {
  box-shadow: 0 1px 0 rgba(220, 227, 235, 0.55);
}

.form-section {
  scroll-margin-top: 90px;
}

.file-chip {
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.file-chip:hover {
  border-color: rgba(10, 149, 139, 0.28);
  background: #f2faf8;
  transform: translateY(-1px);
}

.toast {
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(22, 41, 68, 0.16);
}

@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signature-layout-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .quote-mode-choice-grid {
    grid-template-columns: 1fr;
  }

  .quote-mode-heading {
    align-items: flex-start;
  }

  .quote-mode-controls {
    width: 100%;
    margin-left: 0;
  }

  .tier-editor-cell {
    min-width: 560px;
  }
  .app-shell {
    display: block;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    grid-column: 1;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .topbar {
    padding: 18px;
  }

  .topbar-actions .secondary {
    display: none;
  }

  .content {
    padding: 20px 16px 40px;
  }

  .list-filter-toolbar .list-filter-controls {
    flex-basis: 100%;
    flex-wrap: wrap;
  }

  .list-filter-toolbar .search-box,
  .list-filter-toolbar .filter-select {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }

  .form-grid,
  .form-grid.three,
  .convert-order-summary,
  .detail-grid,
  .doc-party-grid,
  .doc-info-grid,
  .doc-signatures,
  .totals-layout {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-height: calc(100vh - 20px);
    border-radius: 13px;
  }

  .document-stage {
    padding: 12px;
  }

  .signature-layout-panel {
    top: 64px;
  }

  .signature-layout-title {
    display: block;
  }

  .document-sheet {
    width: 100%;
    min-height: 0;
    padding: 24px 20px;
  }
}

@media (max-width: 540px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions .button {
    padding-inline: 10px;
  }

  .page-heading p,
  .eyebrow {
    display: none;
  }

  .doc-header,
  .doc-totals-wrap {
    display: block;
  }

  .doc-title {
    margin-top: 18px;
    text-align: left;
  }

  .doc-totals {
    margin-top: 15px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 8mm 8mm 12mm;

    @bottom-right {
      content: "Page " counter(page) " / Total " counter(pages);
      color: #333;
      font-family: Arial, sans-serif;
      font-size: 6pt;
      font-weight: 700;
    }
  }

  @page quotation-page {
    size: A4;
    margin: 8mm 8mm 12mm;

    @bottom-left {
      content: "If you have any questions, please feel free to contact us.   We wish you continued success in your business.";
      color: #333;
      font-family: Arial, sans-serif;
      font-size: 5.5pt;
      text-align: left;
    }

    @bottom-right {
      content: "Page " counter(page) " / Total " counter(pages);
      color: #333;
      font-family: Arial, sans-serif;
      font-size: 6pt;
      font-weight: 700;
      text-align: right;
      box-sizing: border-box;
      width: 42mm;
      padding-right: 8mm;
    }
  }

  @page order-page {
    size: A4;
    margin: 8mm 0 12mm 8mm;

    @bottom-left {
      content: "This sales order shall become effective upon confirmation by both parties. Any order changes shall be confirmed in writing by both parties.";
      color: #333;
      font-family: Arial, sans-serif;
      font-size: 5.2pt;
      text-align: left;
    }

    @bottom-right {
      content: "Page " counter(page) " / Total " counter(pages);
      color: #333;
      font-family: Arial, sans-serif;
      font-size: 6pt;
      font-weight: 700;
      text-align: right;
      box-sizing: border-box;
      width: 42mm;
      padding-right: 8mm;
    }
  }

  @page internal-contract-page {
    size: A4;
    margin: 8mm 0 12mm;

    @bottom-right {
      content: "Page " counter(page) " / Total " counter(pages);
      color: #333;
      font-family: Arial, sans-serif;
      font-size: 6pt;
      font-weight: 700;
      text-align: right;
      box-sizing: border-box;
      width: 42mm;
      padding-right: 8mm;
    }
  }

  @page commercial-invoice-page {
    size: A4;
    margin: 8mm 0 12mm 8mm;

    @bottom-right {
      content: "Page " counter(page) " / Total " counter(pages);
      color: #333;
      font-family: Arial, sans-serif;
      font-size: 6pt;
      font-weight: 700;
      text-align: right;
      box-sizing: border-box;
      width: 42mm;
      padding-right: 8mm;
    }
  }

  body {
    background: #fff !important;
  }

  body > .app-shell,
  body > .toast-stack {
    display: none !important;
  }

  #modalRoot {
    display: block !important;
  }

  #document-preview {
    position: static;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .document-sheet {
    width: 100%;
    max-width: none;
    min-height: auto;
    margin: 0;
    padding: 0;
    zoom: 1;
    box-shadow: none;
  }

  .reference-document {
    padding: 0;
  }

  .quotation-reference {
    page: quotation-page;
  }

  .order-reference {
    page: order-page;
  }

  .internal-contract-reference {
    page: internal-contract-page;
    width: 210mm;
    max-width: 210mm;
  }

  .commercial-invoice {
    page: commercial-invoice-page;
    position: relative;
    min-height: calc(var(--invoice-page-count, 1) * 277mm);
  }

  .commercial-invoice > :not(.commercial-invoice-seam-stamps):not(.final-seal-block) {
    box-sizing: border-box;
    width: calc(100% - 8mm);
    max-width: calc(100% - 8mm);
  }

  .commercial-invoice > .final-seal-block {
    width: 48mm;
    max-width: 48mm;
    margin-right: 8mm;
  }

  .commercial-invoice:not(:last-child) {
    break-after: page;
    page-break-after: always;
  }

  .commercial-invoice-seam-stamp {
    top: var(--invoice-seam-print-top);
    right: 0;
    border: 0;
    background: transparent;
  }

  .quotation-reference .quotation-table,
  .order-reference .quotation-table,
  .internal-contract-reference .quotation-table {
    border: 1px solid #111;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }

  .quotation-reference .quotation-table-print-frame {
    display: block;
    overflow: visible;
    break-inside: auto;
    page-break-inside: auto;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    box-shadow: inset 0 -1px 0 #111;
  }

  .quotation-reference .tiered-quotation-table-print-frame {
    box-shadow: inset 0 -1px 0 #111;
  }

  .ref-document-footer {
    display: none;
  }

  .internal-contract-document-footer {
    display: flex;
  }

  .internal-contract-document-footer .ref-footer-page {
    font-size: 0;
  }

  .internal-contract-document-footer .internal-contract-footer-number {
    font-size: 7px;
  }

  .internal-contract-document-footer .ref-footer-page::after {
    content: none;
  }

  .modal-backdrop,
  .modal,
  .document-stage {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    overflow: visible;
    padding: 0;
    border: 0;
    background: #fff;
    box-shadow: none;
  }

  .modal-header,
  .modal-footer,
  .no-print {
    display: none !important;
  }

  .page-seam-stamps {
    position: absolute;
    inset: 0;
  }

  body.customer-signing-portal-page .order-reference .page-seam-stamps {
    top: 0;
    bottom: 0;
    left: 0;
    right: -8mm;
  }

  body.customer-signing-portal-page,
  body.customer-signing-portal-page .modal-backdrop,
  body.customer-signing-portal-page .modal,
  body.customer-signing-portal-page .modal-body,
  body.customer-signing-portal-page .customer-signing-complete,
  body.customer-signing-portal-page .customer-signing-document-preview {
    display: block;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    overflow: visible;
  }

  body.customer-signing-portal-page .customer-signing-document-preview .document-sheet {
    margin: 0;
    box-shadow: none;
  }

  .order-reference {
    min-height: calc(var(--order-page-count, 1) * 277mm);
  }

  .order-reference > :not(.page-seam-stamps) {
    box-sizing: border-box;
    width: calc(100% - 8mm);
    max-width: calc(100% - 8mm);
  }

  .page-seam-stamp {
    position: absolute;
    top: var(--seam-print-top, var(--seam-page-top, 44%));
    right: var(--seam-print-right, 0);
    width: var(--seam-print-slice-width, var(--seam-slice-width, 6mm));
    height: var(--seam-print-seal-height, var(--seam-seal-height, 38mm));
    border: 0;
    background: transparent;
  }

  .page-seam-stamp::after {
    display: none;
  }

  .page-seam-stamp::before {
    display: none;
  }

  .internal-contract-seam-stamp {
    top: var(--seam-print-top);
  }

  .internal-contract-seam-group.is-right .internal-contract-seam-stamp {
    right: var(--seam-print-right, 0);
  }

  .internal-contract-seam-group.is-left .internal-contract-seam-stamp {
    left: var(--seam-print-left, 0);
  }

  .internal-contract-reference > :not(.internal-contract-seam-seals) {
    box-sizing: border-box;
    width: calc(100% - 16mm);
    max-width: calc(100% - 16mm);
    margin-left: 8mm;
    margin-right: 8mm;
  }

  .doc-table tr,
  .doc-info,
  .doc-note,
  .reference-table tr,
  .ref-terms-grid section,
  .ref-declaration,
  .ref-bank-payment-row,
  .ref-quotation-terms,
  .ref-order-totals,
  .ref-order-conditions,
  .ref-payment-info,
  .ref-breach,
  .ref-signature-grid {
    break-inside: avoid;
  }

  .quotation-reference .quotation-table,
  .order-reference .quotation-table,
  .internal-contract-reference .quotation-table,
  .quotation-reference .quotation-table tbody,
  .order-reference .quotation-table tbody,
  .internal-contract-reference .quotation-table tbody,
  .quotation-reference .quotation-table tr.quote-product-row,
  .order-reference .quotation-table tr.quote-product-row,
  .internal-contract-reference .quotation-table tr {
    break-inside: auto;
    page-break-inside: auto;
  }

  .quotation-reference .quotation-table thead,
  .order-reference .quotation-table thead,
  .internal-contract-reference .quotation-table thead {
    display: table-header-group;
  }

  .quotation-reference .tiered-quotation-table thead {
    display: table-header-group;
  }

  .quotation-reference .tiered-quotation-table .tiered-first-tier-row,
  .quotation-reference .tiered-quotation-table .tiered-tier-row,
  .quotation-reference .tiered-quotation-table .tiered-subsequent-tier-row {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .quotation-reference .tiered-quotation-table .ref-product-type-row + .tiered-first-tier-row {
    break-before: avoid;
    page-break-before: avoid;
  }

  .reference-document.quotation-reference .quotation-table th,
  .reference-document.quotation-reference .quotation-table td,
  .reference-document.order-reference .quotation-table th,
  .reference-document.order-reference .quotation-table td {
    text-align: center !important;
    vertical-align: middle !important;
  }

  .reference-document.quotation-reference .quotation-table th.quote-description-heading,
  .reference-document.quotation-reference .quotation-table th.quote-remarks-heading,
  .reference-document.order-reference .quotation-table th.quote-description-heading,
  .reference-document.order-reference .quotation-table th.quote-remarks-heading {
    text-align: center !important;
    vertical-align: middle !important;
  }

  .reference-document.quotation-reference .quotation-table td.quote-description-cell,
  .reference-document.quotation-reference .quotation-table td.quote-remarks-cell,
  .reference-document.order-reference .quotation-table td.quote-description-cell,
  .reference-document.order-reference .quotation-table td.quote-remarks-cell {
    text-align: left !important;
    vertical-align: middle !important;
    white-space: pre-line;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: none;
  }

  .reference-document.quotation-reference .quotation-table .ref-product-type-row td,
  .reference-document.order-reference .quotation-table .ref-product-type-row td {
    text-align: left !important;
    vertical-align: middle !important;
  }

  .quotation-reference .quotation-table .ref-product-type-row,
  .order-reference .quotation-table .ref-product-type-row {
    break-inside: avoid;
    break-after: avoid;
    page-break-inside: avoid;
    page-break-after: avoid;
  }

  .quotation-reference .quotation-table .ref-product-type-row + tr,
  .order-reference .quotation-table .ref-product-type-row + tr {
    break-before: avoid;
    page-break-before: avoid;
  }

  .document-package > .document-sheet:not(:last-child) {
    break-after: page;
  }
}

/* Locked document rule: Description of Goods content stays left/middle. */
.reference-document.quotation-reference .quotation-table th.quote-description-heading,
.reference-document.order-reference .quotation-table th.quote-description-heading {
  text-align: center !important;
  vertical-align: middle !important;
}

.reference-document.quotation-reference .quotation-table td.document-description-cell,
.reference-document.order-reference .quotation-table td.document-description-cell {
  text-align: left !important;
  vertical-align: middle !important;
  white-space: pre-line !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
  hyphens: none !important;
}
/* End locked Description of Goods rule. */
