:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #d8ddd3;
  --paper: #ffffff;
  --page: #edf1ef;
  --teal: #176b5b;
  --coral: #c94f2c;
  --amber: #f2a51a;
  --indigo: #4357ad;
  --soft-teal: #e5f2f1;
  --soft-amber: #fff6d8;
  --soft-coral: #fde9e2;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 107, 91, 0.08), transparent 28%),
    linear-gradient(180deg, #f9fbfa 0, var(--page) 48%, #e5ebe8 100%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(17, 24, 39, 0.16));
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.language-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.industry-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.industry-control span {
  margin: 0;
  white-space: nowrap;
}

.industry-control select {
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  font-weight: 800;
  max-width: 160px;
}

.language-control span {
  margin: 0;
  white-space: nowrap;
}

.language-control select {
  width: 96px;
  min-height: 32px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  font-weight: 800;
}

.export-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1320px;
  margin: 0 auto 16px;
  padding: 10px 12px;
  border: 1px solid #b7d7d5;
  border-radius: 8px;
  background: var(--soft-teal);
  color: #123d3b;
  font-size: 13px;
  font-weight: 800;
}

.export-result[hidden] {
  display: none;
}

.export-result a {
  color: var(--teal);
  text-decoration: none;
  white-space: nowrap;
}

.export-result a:hover {
  text-decoration: underline;
}

.export-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.export-control select {
  width: 78px;
  min-height: 40px;
  padding: 8px 9px;
  font-weight: 800;
}

.tool-button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 8px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.tool-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: #aab5aa;
}

.tool-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  font-weight: 700;
}

.tool-button.compact {
  min-height: 38px;
  padding: 0 11px;
}

.tool-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.tool-button.is-locked {
  background: var(--ink);
  border-color: var(--ink);
}

.tool-button.secondary {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(520px, 1.12fr);
  grid-template-areas:
    "builder preview"
    "builder followup";
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(216, 221, 211, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.builder-panel {
  grid-area: builder;
  padding: 18px;
}

.preview-panel {
  grid-area: preview;
  padding: 18px;
  background: rgba(17, 24, 39, 0.93);
}

.followup-panel {
  grid-area: followup;
  padding: 18px;
}

.panel-heading,
.line-items-head,
.followup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.builder-panel .line-items-head {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #dfe6e2;
}

.heading-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-heading select {
  flex: 0 0 132px;
}

.category-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 8px;
  width: min(100%, 340px);
}

.category-selectors label span {
  margin-bottom: 4px;
  text-align: left;
}

.category-selectors select,
.equipment-category-selectors select {
  width: 100%;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.category-selectors select:disabled {
  color: #778078;
  background: #f2f4f1;
  cursor: not-allowed;
}

.equipment-category-selectors {
  grid-column: 1 / -1;
  width: 100%;
  padding-bottom: 14px;
  border-bottom: 1px solid #d9e4df;
}

.panel-heading.compact {
  color: #fff;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.preview-panel .eyebrow {
  color: var(--amber);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  line-height: 1.12;
}

h1 {
  font-size: 25px;
  margin-bottom: 0;
  white-space: nowrap;
}

h2 {
  font-size: 20px;
  margin-bottom: 0;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid #cfd7ce;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  min-height: 40px;
  padding: 9px 10px;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 124, 123, 0.12);
}

input:disabled {
  color: #7a8379;
  background: #f4f5ef;
  cursor: not-allowed;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 6px;
}

.field-note {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

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

.quote-basics-section {
  margin-top: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #dfe6e2;
}

.quote-basics-section .payment-qr-field {
  margin-bottom: 0;
}

.section-divider {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid #dfe6e2;
}

.section-divider span {
  font-size: 15px;
  font-weight: 850;
}

.section-divider small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.equipment-grid {
  margin-bottom: 24px;
  padding: 14px;
  border: 1px solid #d9e4df;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #f7faf8;
}

.central-air-parameter[hidden] {
  display: none;
}

.product-add-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #d9e4df;
}

.product-add-bar strong,
.product-add-bar small {
  display: block;
}

.product-add-bar strong {
  font-size: 13px;
}

.product-add-bar small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.product-config-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.product-library-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid #d9e4df;
  border-radius: 6px;
  background: #fff;
}

.product-library-bar strong,
.product-library-bar small {
  display: block;
}

.product-library-bar strong {
  font-size: 13px;
}

.product-library-bar small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.product-library-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-library-import {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.secondary-action,
.delete-custom-product {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 13px;
  border-radius: 6px;
  font-weight: 800;
  white-space: nowrap;
}

.secondary-action {
  border: 1px solid var(--teal);
  color: var(--teal);
  background: #fff;
}

.secondary-action:hover {
  background: var(--soft-teal);
}

.delete-custom-product {
  border: 1px solid #efc9bd;
  color: var(--coral);
  background: #fff8f5;
}

.delete-custom-product:disabled {
  color: #a5ada8;
  border-color: #dde2de;
  background: #f5f7f5;
  cursor: not-allowed;
}

.primary-action {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--teal);
  border-radius: 6px;
  color: #fff;
  background: var(--teal);
  font-weight: 800;
  white-space: nowrap;
}

.primary-action:hover {
  filter: brightness(0.95);
}

.product-config-actions .secondary-action,
.product-config-actions .delete-custom-product {
  flex: 1 1 112px;
}

.product-config-actions .primary-action {
  flex: 1 0 100%;
}

.selected-products-panel {
  margin: 0 0 28px;
  padding: 14px;
  border: 1px solid #dfe6e2;
  border-radius: 8px;
  background: #fff;
}

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

.selected-products-head h2 {
  font-size: 16px;
}

.selected-products-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selected-products-actions > strong {
  color: var(--teal);
  font-size: 12px;
  white-space: nowrap;
}

.clear-products-button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #efc9bd;
  border-radius: 5px;
  color: var(--coral);
  background: #fff8f5;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.clear-products-button:hover:not(:disabled) {
  border-color: var(--coral);
  background: var(--soft-coral);
}

.clear-products-button:disabled {
  color: #a5ada8;
  border-color: #dde2de;
  background: #f5f7f5;
  cursor: not-allowed;
}

.selected-products {
  display: grid;
  gap: 8px;
}

.selected-products-empty {
  display: grid;
  gap: 3px;
  min-height: 70px;
  place-content: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cfd8d2;
  border-radius: 6px;
  background: #fafcfb;
}

.selected-products-empty strong {
  color: var(--ink);
  font-size: 13px;
}

.selected-products-empty span {
  font-size: 11px;
}

.selected-product-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 74px 102px 28px;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 10px;
  border: 1px solid #e0e6e1;
  border-radius: 6px;
  background: #f8faf9;
}

.selected-product-index {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-size: 11px;
  font-weight: 850;
}

.selected-product-copy,
.selected-product-price {
  min-width: 0;
}

.selected-product-copy strong,
.selected-product-copy span,
.selected-product-price strong,
.selected-product-price span,
.selected-product-qty span {
  display: block;
}

.selected-product-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-product-copy span,
.selected-product-price span,
.selected-product-qty span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.selected-product-qty input {
  min-height: 34px;
  padding: 6px 8px;
}

.selected-product-price {
  text-align: right;
}

.selected-product-price strong {
  color: var(--teal);
  font-size: 12px;
  white-space: nowrap;
}

.icon-remove-product {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 1px solid #dfd7d2;
  border-radius: 4px;
  color: var(--coral);
  background: #fff;
  font-size: 18px;
  line-height: 1;
}

.product-feature-field,
.product-image-field {
  grid-column: 1 / -1;
}

.product-image-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #d9e4df;
  border-radius: 6px;
  background: #fff;
}

.product-image-field span,
.product-image-field small {
  display: block;
}

.product-image-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-image-field small {
  margin-top: 3px;
  color: var(--muted);
}

.product-image-upload {
  padding: 8px 12px;
  border-radius: 4px;
  color: #fff;
  background: var(--teal);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.product-price-field input {
  color: var(--teal);
  font-size: 18px;
  font-weight: 850;
}

.wide-field {
  display: block;
  margin-top: 12px;
}

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

.payment-qr-field {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #e3e7df;
  border-radius: 8px;
  background: #fbfcf9;
}

.qr-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.qr-field-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 0;
}

.text-button:disabled {
  color: #a3aca2;
  cursor: not-allowed;
}

.qr-upload {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 10px;
  border: 1px dashed #b9c4b8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.qr-upload svg {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 8px;
  color: var(--teal);
  background: var(--soft-teal);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.qr-upload strong {
  font-size: 14px;
}

.qr-upload small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.license-field {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #e3e7df;
  border-radius: 8px;
  background: #fff;
}

.license-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.license-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.license-head strong {
  min-height: 26px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #7a4d00;
  background: var(--soft-amber);
  font-size: 12px;
  font-weight: 850;
}

.license-field.is-pro .license-head strong {
  color: #123d3b;
  background: var(--soft-teal);
}

.license-unlock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.license-unlock[hidden] {
  display: none;
}

.license-field p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  flex: 0 0 auto;
}

.icon-button.danger {
  color: var(--coral);
  background: var(--soft-coral);
  border-color: #f3c8bb;
}

.items-list {
  display: grid;
  gap: 10px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 72px 92px 70px 40px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid #e3e7df;
  border-radius: 8px;
  background: #fbfcf9;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #123d3b;
  background: var(--soft-teal);
  font-size: 12px;
  font-weight: 800;
}

.quote-paper {
  position: relative;
  background: #fffdf8;
  color: var(--ink);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.engineering-document {
  display: grid;
  gap: 22px;
  padding: 0;
  container-type: inline-size;
  background: transparent;
  box-shadow: none;
}

/* Fixed-size, off-screen DOM used only by the paginated PDF renderer. */
.pdf-export-root {
  position: fixed;
  left: -20000px;
  top: 0;
  width: 297mm;
  background: #fff;
  pointer-events: none;
}

.pdf-export-root.engineering-document {
  display: block;
  gap: 0;
  padding: 0;
}

.pdf-export-root .pdf-export-page {
  position: relative;
  box-sizing: border-box;
  width: 297mm;
  height: 210mm;
  min-height: 210mm;
  padding: 9.5mm;
  overflow: hidden;
  color: #111;
  background: #fff;
  border-radius: 0;
  box-shadow: none;
}

.pdf-export-page .main-product-row {
  height: 17mm;
}

.pdf-export-page .product-image-cell img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 12mm;
  object-fit: fill;
}

.pdf-export-root .product-image-cell .product-image-pending {
  box-sizing: border-box;
  width: 100%;
  height: 12mm;
  min-height: 0;
  max-height: 12mm;
  font-size: 7pt;
  line-height: 1;
}

.pdf-export-root .product-image-cell .product-image-gallery {
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  height: 12mm;
  min-height: 0;
  max-height: 12mm;
  overflow: hidden;
}

.pdf-export-root .product-image-cell .product-image-gallery > img,
.pdf-export-root .product-image-cell .product-image-gallery > .product-image-pending {
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: fill;
}

.pdf-export-page .product-detail-grid {
  font-size: 7.5pt;
  line-height: 1.25;
}

.pdf-export-page .pdf-parameter-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3mm;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pdf-export-page .pdf-product-continuation td {
  padding: 2mm;
  color: #203e73;
  font-weight: 800;
  text-align: left;
  background: #eef3fb;
}

.pdf-export-page .pdf-detail-terminal {
  break-inside: avoid;
  page-break-inside: avoid;
}

.pdf-export-page .payment-qr-preview {
  margin: 6px 0 4px;
  padding: 5px;
  gap: 3px;
}

.pdf-export-page .payment-qr-preview img {
  width: 96px;
  height: 96px;
}

.pdf-export-page .payment-qr-preview span {
  font-size: 7px;
}

/* 汇总页放入报价说明后压缩布局，保证一页放得下 */
.pdf-export-page.pdf-export-summary-page .summary-brand {
  margin-bottom: 2px;
}

.pdf-export-page.pdf-export-summary-page > h2 {
  margin-bottom: 6px;
}

.pdf-export-page.pdf-export-summary-page .summary-table {
  margin-top: 6px;
}

.pdf-export-page.pdf-export-summary-page .summary-table th,
.pdf-export-page.pdf-export-summary-page .summary-table td {
  height: 44px !important;
  padding: 4px 5px;
}

.pdf-export-page.pdf-export-summary-page .summary-table tfoot th {
  height: 44px !important;
}

.pdf-export-page.pdf-export-summary-page .deposit-summary {
  padding: 8px;
}

.pdf-export-page.pdf-export-summary-page .signature-row {
  min-height: 60px;
}

.pdf-export-page.pdf-export-summary-page .document-slogan {
  padding: 5px;
}

.pdf-export-page.pdf-export-summary-page .quote-note {
  margin-top: 6px;
}

.pdf-export-page.pdf-export-summary-page .quote-note h3 {
  margin-bottom: 3px;
}

.pdf-export-page.pdf-export-summary-page .quote-note p {
  margin-bottom: 2px;
}

.pdf-export-page .pdf-page-number {
  position: absolute;
  right: 9.5mm;
  bottom: 4mm;
  color: #596273;
  font-size: 7pt;
}

.document-page {
  position: relative;
  container-type: inline-size;
  min-height: 70.72cqw;
  min-width: 0;
  padding: 5.2%;
  overflow: visible;
  color: #111;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.25);
}

.is-exporting-pdf .document-page {
  border-radius: 0;
  box-shadow: none;
}

.document-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  color: #17213c;
}

.document-brand span {
  font-size: clamp(22px, 5cqw, 36px);
  font-weight: 800;
  line-height: 1.25;
}

.cover-page {
  display: flex;
  flex-direction: column;
}

.cover-rule {
  width: 100%;
  height: 5px;
  margin-top: 12px;
  background: #203e73;
}

.cover-rule.bottom {
  margin-top: auto;
}

.cover-title {
  margin: auto 0;
  text-align: center;
}

.cover-title h2 {
  font-size: clamp(18px, 5cqw, 35px);
  font-weight: 500;
}

.cover-title p {
  margin: 26px 0 0;
  font-size: clamp(16px, 3.7cqw, 27px);
}

.cover-contact {
  margin-left: auto;
  font-size: clamp(11px, 2.7cqw, 20px);
}

.cover-contact p {
  margin-bottom: 5px;
}

.document-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.document-page-header > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.document-page-header > div:last-child {
  align-items: flex-end;
}

.mini-brand strong {
  color: #203e73;
  font-size: clamp(10px, 2.3cqw, 17px);
}

.mini-brand span,
.document-page-header > div:last-child {
  color: #596273;
  font-size: clamp(6px, 1.35cqw, 10px);
}

.detail-page > h2,
.summary-page > h2 {
  margin: 0 0 10px;
  text-align: center;
  color: #090909;
  font-size: clamp(15px, 3.6cqw, 28px);
}

.project-meta-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: clamp(6px, 1.35cqw, 10px);
}

.engineering-document .quote-table,
.summary-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: clamp(6px, 1.4cqw, 10.5px);
}

.engineering-document .quote-table th,
.engineering-document .quote-table td,
.summary-table th,
.summary-table td {
  padding: 6px 5px;
  border: 1px solid #111;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.engineering-document .quote-table thead th,
.summary-table thead th {
  color: #fff;
  background: #203e73;
  font-weight: 800;
}

.reference-table th:nth-child(1) { width: 4%; }
.reference-table th:nth-child(2) { width: 13%; }
.reference-table th:nth-child(3) { width: 15%; }
.reference-table th:nth-child(4) { width: 12%; }
.reference-table th:nth-child(5) { width: 7%; }
.reference-table th:nth-child(6) { width: 12%; }
.reference-table th:nth-child(7) { width: 9%; }
.reference-table th:nth-child(8) { width: 6%; }
.reference-table th:nth-child(9) { width: 6%; }
.reference-table th:nth-child(10) { width: 7%; }
.reference-table th:nth-child(11) { width: 9%; }

.main-product-row {
  height: clamp(54px, 12cqw, 92px);
}

.product-detail-row td {
  padding: 6px 8px;
  background: #f8fafc;
  text-align: left;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  color: #27364a;
  font-size: clamp(5px, 1.05cqw, 8px);
  line-height: 1.3;
  text-align: left;
}

.product-detail-grid strong {
  color: #111827;
}

/* 技术参数多列展示（长参数拆列，减少列表高度） */
.detail-text {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.detail-col {
  flex: 1 1 0;
  min-width: 0;
}

/* 长技术参数默认折叠，点击展开 */
.detail-param.is-collapsible .detail-col {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-param.is-collapsible.is-expanded .detail-col {
  -webkit-line-clamp: unset;
  display: block;
}

.detail-toggle {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 10px;
  font: inherit;
  font-weight: 700;
  color: #0e7c7b;
  background: #eef7f6;
  border: 1px solid #cfe5e2;
  border-radius: 999px;
  cursor: pointer;
}

.detail-toggle:hover {
  background: #dff1ee;
}

/* 打印与 PDF 导出时始终显示完整技术参数 */
@media print {
  .detail-param.is-collapsible .detail-col {
    -webkit-line-clamp: unset;
    display: block;
  }

  .detail-toggle {
    display: none;
  }
}

.is-exporting-pdf .detail-param.is-collapsible .detail-col {
  -webkit-line-clamp: unset;
  display: block;
}

.is-exporting-pdf .detail-toggle {
  display: none;
}

.product-image-cell img {
  display: block;
  width: 100%;
  max-height: clamp(54px, 11cqw, 88px);
  object-fit: contain;
}

.product-image-cell .product-image-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  align-items: center;
}

.product-image-cell .product-image-gallery img {
  width: 100%;
  height: auto;
  max-height: clamp(40px, 9cqw, 72px);
  border: 1px solid #d7dde5;
  background: #fff;
  object-fit: contain;
}

.product-image-cell img[hidden] {
  display: none;
}

.product-image-cell span {
  color: #8a8f98;
}

.document-section-title {
  margin: 10px 0 6px;
  text-align: center;
  font-size: clamp(8px, 1.7cqw, 13px);
}

.material-table th:nth-child(1) { width: 7%; }
.material-table th:nth-child(2) { width: 28%; }
.material-table th:nth-child(3) { width: 25%; }
.material-table th:nth-child(4) { width: 8%; }
.material-table th:nth-child(5) { width: 8%; }
.material-table th:nth-child(6) { width: 12%; }
.material-table th:nth-child(7) { width: 12%; }

.detail-total {
  padding: 7px;
  border: 1px solid #111;
  border-top: 0;
  text-align: right;
  font-size: clamp(7px, 1.5cqw, 12px);
}

.engineering-document .quote-note {
  margin-top: 10px;
  padding-top: 0;
  border: 0;
  font-size: clamp(6px, 1.25cqw, 10px);
}

.engineering-document .quote-note h3 {
  margin-bottom: 5px;
  font-size: clamp(6px, 1.35cqw, 10px);
  line-height: normal;
}

.engineering-document .quote-note p {
  margin-bottom: 4px;
  line-height: 1.4;
}

.summary-brand {
  margin-bottom: 4px;
}

.summary-table {
  margin-top: 12px;
  font-size: clamp(10px, 2.1cqw, 16px);
}

.summary-table th,
.summary-table td {
  height: clamp(42px, 10cqw, 80px);
}

.summary-table tfoot th {
  height: clamp(46px, 9cqw, 68px);
  font-size: 1.1em;
}

.summary-table tfoot th:last-child {
  font-size: 1.6em;
  font-weight: 800;
}

.deposit-summary {
  padding: 12px;
  border: 1px solid #111;
  border-top: 0;
  text-align: center;
  font-size: clamp(7px, 1.5cqw, 12px);
}

.signature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: clamp(45px, 10cqw, 80px);
  border: 1px solid #111;
  border-top: 0;
}

.signature-row strong {
  padding: 8px;
  font-size: clamp(8px, 1.7cqw, 13px);
}

.signature-row strong + strong {
  border-left: 1px solid #111;
}

.document-slogan {
  padding: 8px;
  color: #fff;
  background: #203e73;
  text-align: center;
  font-size: clamp(8px, 1.7cqw, 13px);
  font-style: italic;
  font-weight: 800;
}

.quote-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 18px;
}

.quote-label {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--soft-amber);
  color: #7a4d00;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.quote-header h2 {
  font-size: 27px;
  overflow-wrap: anywhere;
}

.quote-header p {
  color: var(--muted);
  margin-bottom: 0;
}

.quote-meta {
  display: grid;
  gap: 8px;
  justify-items: end;
  align-content: start;
  min-width: 120px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.client-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
  padding: 14px;
  background: #eef7f6;
  border-left: 5px solid var(--teal);
  border-radius: 8px;
}

.equipment-summary {
  margin-bottom: 20px;
  border: 1px solid #d9e4df;
  border-top: 4px solid var(--teal);
  border-radius: 8px;
  background: #f8fbf9;
  overflow: hidden;
}

.equipment-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid #dfe6e2;
}

.equipment-summary-head span,
.spec-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.equipment-summary-head h3 {
  margin: 5px 0 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.equipment-summary-head > strong {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 22px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.spec-grid div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid #e3e9e6;
  border-bottom: 1px solid #e3e9e6;
}

.spec-grid div:nth-child(3n) {
  border-right: 0;
}

.spec-grid div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.spec-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.client-strip span,
.totals span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.client-strip strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quote-table th,
.quote-table td {
  border-bottom: 1px solid #e2e5dd;
  padding: 12px 8px;
  text-align: left;
  vertical-align: top;
}

.quote-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.quote-table th:nth-child(2),
.quote-table th:nth-child(3),
.quote-table th:nth-child(4),
.quote-table td:nth-child(2),
.quote-table td:nth-child(3),
.quote-table td:nth-child(4) {
  text-align: right;
}

.quote-table td:first-child {
  overflow-wrap: anywhere;
}

.totals {
  display: grid;
  gap: 8px;
  width: min(100%, 300px);
  margin: 18px 0 18px auto;
}

.totals > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #e0e6de;
}

.grand-total {
  color: var(--teal);
  font-size: 20px;
}

.quote-note {
  border-top: 1px solid #e0e6de;
  padding-top: 16px;
}

.quote-note p {
  color: #3f4752;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.quote-watermark {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  color: #8a9387;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

.quote-watermark::before {
  content: "";
  flex: 1;
  max-width: 220px;
  margin: 8px 10px 0 0;
  border-top: 1px solid #e0e6de;
}

.quote-watermark[hidden] {
  display: none;
}

.payment-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin: 4px 0 14px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.payment-link-button[hidden] {
  display: none;
}

.payment-qr-preview {
  display: inline-grid;
  gap: 8px;
  justify-items: center;
  margin: 8px 0 14px;
  padding: 10px;
  border: 1px solid #e0e6de;
  border-radius: 8px;
  background: #fff;
}

.payment-qr-preview[hidden] {
  display: none;
}

.payment-qr-preview img {
  width: 132px;
  height: 132px;
  object-fit: contain;
}

.payment-qr-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.followup-panel {
  background: rgba(255, 255, 255, 0.92);
}

.followup-head {
  color: var(--ink);
}

.followup-head h2 {
  font-size: 20px;
}

.followup-panel textarea {
  min-height: 210px;
  resize: vertical;
  background: #fffdf8;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .topbar,
  .export-result,
  .builder-panel,
  .followup-panel,
  .panel-heading {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .preview-panel {
    display: block;
    margin: 0;
    padding: 0;
    max-width: none;
    background: #fff;
    box-shadow: none;
    border: 0;
  }

  .quote-paper {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  .engineering-document {
    display: block;
  }

  .document-page {
    width: 297mm;
    min-height: 210mm;
    padding: 15mm;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }

  .quote-table tr,
  .summary-table tr,
  .quote-note {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .document-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
}

/* 显示屏智报价 新增字段样式 */
.equipment-category-selectors {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 10px;
}
@media (min-width: 720px) {
  .equipment-category-selectors {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.product-search-field,
.product-select-field,
.product-notes-field {
  grid-column: 1 / -1;
}
.product-search-field input {
  width: 100%;
}
.product-price-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
}
.product-qty-field input {
  text-align: right;
}
.product-source-info {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 10px 12px;
  border: 1px dashed #cfd6cf;
  border-radius: 6px;
  background: #fafbf8;
}
.product-source-info summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.product-source-info .source-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin-top: 8px;
  color: #3f4752;
  font-size: 12px;
}
.product-source-info .source-grid span {
  color: var(--muted);
}
.product-image-cell .product-image-pending {
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(42px, 9cqw, 70px);
  font-size: clamp(9px, 1.8cqw, 13px);
  color: #a2a8b2;
  border: 1px dashed #d7dde5;
  border-radius: 4px;
  background: #fafbfc;
}
.equipment-input-area,
.equipment-quote-table {
  width: 100%;
}

/* 窄屏适配：导航换行、两栏堆叠、输入区自适应 */
@media (max-width: 1023px) {
  .topbar {
    flex-wrap: wrap;
  }
  .top-actions {
    flex: 1 1 100%;
  }
  .product-price-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .equipment-category-selectors {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "builder"
      "preview"
      "followup";
  }
}

/* 服务项目选择弹窗 */
#servicePickerDialog {
  width: min(560px, 92vw);
  max-height: 76vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

#servicePickerDialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}

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

.service-picker-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.service-picker-list {
  display: grid;
  gap: 8px;
  max-height: 56vh;
  overflow-y: auto;
  padding-right: 4px;
}

.service-picker-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.service-picker-item:hover {
  border-color: var(--accent);
  background: #f2faf8;
}

.service-picker-name {
  font-weight: 650;
}

.service-picker-price {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

.service-picker-empty {
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.service-picker-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.filter-with-action {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-with-action select {
  flex: 1;
  min-width: 0;
}
.filter-with-action .text-button {
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.category-manager-add {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}
.category-manager-add input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.category-manager-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}
.category-manager-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.category-manager-row .cm-index {
  flex: 0 0 28px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.category-manager-row .cm-name {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 0;
  border-bottom: 1px dashed transparent;
  font-weight: 700;
  background: transparent;
}
.category-manager-row .cm-name:focus {
  border-bottom-color: var(--accent);
  outline: none;
}
.category-manager-row .cm-count {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}
.category-manager-row .cm-delete {
  flex: 0 0 auto;
  padding: 2px 8px;
  border: 0;
  background: transparent;
  color: #b42318;
  cursor: pointer;
  font-size: 12px;
}
.category-manager-row .cm-delete:hover {
  text-decoration: underline;
}
.category-manager-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 16px 0;
  text-align: center;
}
.category-manager-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ================= SaaS 账号栏 / 登录 / 订阅 ================= */
.account-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.account-info {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.25;
  text-align: right;
}
.account-email {
  font-size: 12px;
  color: var(--ink);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-plan {
  font-size: 11px;
  color: var(--muted);
}
.account-plan.is-pro {
  color: #0e7c7b;
  font-weight: 800;
}

#authDialog,
#subscribeDialog,
#resetDialog,
#categoryManagerDialog {
  width: min(520px, 92vw);
  max-height: 80vh;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}
#authDialog::backdrop,
#subscribeDialog::backdrop,
#resetDialog::backdrop,
#categoryManagerDialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0 16px;
}
.auth-tabs button {
  flex: 1;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
}
.auth-tabs button.is-active {
  border-color: #0e7c7b;
  color: #0e7c7b;
  background: #eef7f6;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 700;
}
.auth-form input {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
}
.auth-submit {
  width: 100%;
  margin-top: 4px;
}
.auth-error {
  color: #b42318;
  font-size: 13px;
  margin: 8px 0;
}
.auth-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 14px;
}

.auth-forgot {
  text-align: right;
  margin-top: 4px;
}

.redeem-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.redeem-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.subscribe-plans {
  display: flex;
  gap: 12px;
  margin: 16px 0;
}
.plan-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 20px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.plan-card:hover {
  border-color: #0e7c7b;
}
.plan-card.is-recommended {
  border-color: #0e7c7b;
  background: #f2faf9;
}
.plan-card strong {
  font-size: 15px;
}
.plan-price {
  font-size: 21px;
  font-weight: 800;
  color: #0e7c7b;
}
.plan-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
