/* ============================================================
   家纺毛毯报价系统 · 全局样式
   简约商务蓝白风格 · 适配工厂办公大屏 · 支持打印/PDF
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #1a5276;
  --primary-light: #2471a3;
  --primary-dark: #154360;
  --accent: #2980b9;
  --border: #d5dce3;
  --border-light: #e8edf2;
  --bg: #eef2f6;
  --bg-page: #f7f9fb;
  --card: #ffffff;
  --text: #2c3e50;
  --text-secondary: #566573;
  --muted: #7f8c8d;
  --danger: #c0392b;
  --danger-hover: #e74c3c;
  --success: #1e8449;
  --success-hover: #27ae60;
  --warning: #e67e22;
  --shadow: 0 1px 4px rgba(26, 82, 118, 0.08);
  --shadow-card: 0 2px 8px rgba(26, 82, 118, 0.06);
  --radius: 6px;
  --radius-sm: 4px;
  --input-h: 40px;
  --font-base: 14px;
  --font-lg: 15px;
  --font-xl: 18px;
  --max-width: 1600px;
}

html {
  font-size: var(--font-base);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.file-protocol-tip {
  background: #fff3cd;
  border-bottom: 1px solid #ffc107;
  color: #664d03;
  padding: 10px 32px;
  font-size: 14px;
  line-height: 1.5;
}

.file-protocol-tip a {
  color: #0d6efd;
  font-weight: 600;
}

.file-protocol-tip code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── 页头 ─────────────────────────────────────────────── */

.header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: #fff;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(21, 67, 96, 0.25);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header .role-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
}

.role-bar select,
.role-bar button {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.15s;
}

.role-bar select option {
  color: var(--text);
  background: #fff;
}

.role-bar select:hover,
.role-bar button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.role-name-input {
  width: 120px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.role-name-input:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.sales-custom-box {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sales-custom-box.show {
  display: flex;
}

.sales-custom-box .role-name-input {
  width: 110px;
}

.sales-custom-box .role-name-input:nth-child(3) {
  width: 160px;
}

#saveCostBtn {
  display: none;
}

/* ── 主容器与栅格 ─────────────────────────────────────── */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 32px 48px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

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

/* ── 卡片 ─────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
  overflow: hidden;
}

.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: var(--font-lg);
  color: var(--primary);
  background: linear-gradient(to bottom, #fafcfe, #f4f8fb);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-head-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(21, 67, 96, 0.08);
}

.card-body {
  padding: 20px;
}

/* ── 表单 ─────────────────────────────────────────────── */

.form-row {
  margin-bottom: 14px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-row--full {
  grid-column: 1 / -1;
}

.form-row--action {
  display: flex;
  align-items: flex-end;
}

.form-row label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  height: var(--input-h);
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  color: var(--text);
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-row textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

.form-row input:hover,
.form-row select:hover {
  border-color: #b8c5d0;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(36, 113, 163, 0.12);
}

.form-row input:read-only,
.form-row input[readonly] {
  background: #f0f4f7;
  color: var(--text-secondary);
  cursor: default;
}

.form-row input:disabled,
.form-row select:disabled {
  background: #f0f4f7;
  cursor: not-allowed;
  opacity: 0.75;
}

/* 定制尺寸 */
.custom-size {
  display: none;
  margin-top: 10px;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.custom-size.show {
  display: grid;
}

.sub-panel {
  grid-column: 1 / -1;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 14px;
  background: #fafcfe;
}

.sub-panel:last-child {
  margin-bottom: 0;
}

.sub-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

.custom-field {
  display: none;
}

.custom-field.show {
  display: block;
}

.layer-panel {
  display: none;
}

.layer-panel.show {
  display: block;
}

.auxiliary-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.finishing-fee-multi {
  position: relative;
}

.finishing-fee-trigger-wrap {
  position: relative;
}

.finishing-fee-trigger {
  width: 100%;
  min-height: var(--input-h);
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: var(--font-base);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.finishing-fee-trigger:hover {
  border-color: var(--accent);
}

.finishing-fee-trigger-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finishing-fee-trigger-arrow {
  color: var(--muted);
  font-size: 12px;
  flex-shrink: 0;
}

.finishing-fee-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.finishing-fee-dropdown.open {
  display: block;
}

.finishing-fee-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.finishing-fee-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-base);
  color: var(--text);
}

.finishing-fee-option:hover {
  background: #f0f6fb;
}

.finishing-fee-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

#customFinishingFeeBox {
  margin-top: 10px;
}

.finishing-fee-cost-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
}

@media (max-width: 900px) {
  .finishing-fee-cost-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .finishing-fee-cost-grid {
    grid-template-columns: 1fr;
  }
}

.price-unit-row {
  display: grid;
  grid-template-columns: 1fr 110px;
  gap: 8px;
}

.fabric-width-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.form-row input[readonly].computed-field {
  background: #eef6fb;
  color: var(--primary);
  font-weight: 600;
}

@media (max-width: 600px) {
  .auxiliary-row {
    grid-template-columns: 1fr;
  }
}

.product-images-panel {
  width: 100%;
}

.product-images-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.image-upload-tip {
  font-size: 12px;
  color: var(--muted);
}

.product-image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.image-empty-tip {
  width: 100%;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafcfe;
}

.product-image-item {
  position: relative;
  width: 110px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.product-image-item img {
  width: 100%;
  height: 88px;
  object-fit: cover;
  display: block;
}

.product-image-name {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.product-image-remove:hover {
  background: rgba(192, 57, 43, 0.9);
}

.quote-images-section {
  border: 1px solid #333;
  margin-bottom: 12px;
  padding: 10px;
  background: #fff;
}

.quote-images-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a5276;
  margin-bottom: 8px;
  text-align: center;
}

.quote-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.quote-image-item {
  width: calc(25% - 8px);
  min-width: 120px;
  max-width: 180px;
  text-align: center;
}

.quote-image-item img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  border: 1px solid #ccc;
  background: #fafafa;
  display: block;
}

.quote-image-caption {
  font-size: 10px;
  color: #666;
  margin-top: 4px;
  word-break: break-all;
  line-height: 1.3;
}

/* ── 核算结果 ─────────────────────────────────────────── */

.result-box {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.result-item {
  background: linear-gradient(to bottom, #f8fafc, #f2f6fa);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}

.result-item .label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.result-item .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.result-item.highlight {
  background: linear-gradient(to bottom, #eafaf1, #d5f5e3);
  border-color: #a9dfbf;
}

.result-item.highlight .value {
  color: var(--success);
  font-size: 22px;
}

.result-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 400;
}

/* ── 按钮 ─────────────────────────────────────────────── */

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  min-height: 40px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 2px 6px rgba(26, 82, 118, 0.3);
}

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

.btn-secondary:hover {
  background: #f0f4f7;
  border-color: #b8c5d0;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: var(--success-hover);
  box-shadow: 0 2px 6px rgba(30, 132, 73, 0.3);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 5px 10px;
  min-height: 30px;
  font-size: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── 核算流程明细 ─────────────────────────────────────── */

.calc-process-box {
  background: #fff;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 200px;
  max-height: 520px;
  overflow: auto;
}

.calc-process-sheet {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.calc-process-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
  text-align: center;
}

.calc-process-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #fef9f3;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

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

.calc-process-table th,
.calc-process-table td {
  border: 1px solid var(--border-light);
  padding: 8px 10px;
  vertical-align: top;
  word-break: break-word;
}

.calc-process-table th {
  background: #f4f8fb;
  font-size: 12px;
  text-align: center;
}

.calc-process-table .calc-name {
  width: 18%;
  font-weight: 600;
}

.calc-process-table .calc-desc {
  width: 57%;
  font-size: 12px;
  color: var(--text-secondary);
}

.calc-process-table .calc-amt {
  width: 25%;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.calc-process-table tfoot td {
  background: #fafcfe;
}

.calc-process-table .calc-subtotal td,
.calc-process-table .calc-highlight td {
  font-weight: 600;
}

.calc-process-table .calc-highlight td {
  background: #eef6fb;
  color: var(--primary);
}

.calc-process-table .calc-total td {
  background: #eaf0f5;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 14px;
}

.calc-process-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── 报价预览 ─────────────────────────────────────────── */

.preview-box {
  background: #fff;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 240px;
  max-height: 620px;
  overflow: auto;
  color: var(--text);
  display: flex;
  justify-content: center;
}

.preview-box .quote-sheet {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
}

.preview-placeholder {
  color: var(--muted);
  font-size: 14px;
  padding: 48px 16px;
  text-align: center;
}

.quote-text-fallback {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.85;
  margin: 0;
  font-family: inherit;
}

/* ── 正式报价单表格 ─────────────────────────────────── */

.quote-sheet {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #222;
  font-size: 13px;
  line-height: 1.6;
  background: #fff;
}

.quote-sheet-header {
  text-align: center;
  border-bottom: 2px solid #1a5276;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.quote-company-name {
  font-size: 20px;
  font-weight: 700;
  color: #1a5276;
  margin-bottom: 6px;
}

.quote-company-line {
  font-size: 12px;
  color: #444;
  margin-top: 4px;
}

.quote-sales-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #c5d9e8;
}

.quote-sales-line {
  font-size: 12px;
  color: #333;
  margin-top: 4px;
  line-height: 1.45;
  word-break: break-all;
}

.quote-sheet-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 6px;
  margin: 12px 0 14px;
  color: #1a5276;
}

.quote-meta-table,
.quote-table,
.quote-footer-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  table-layout: fixed;
}

.quote-table .col-name { width: 20%; }
.quote-table .col-size { width: 13%; }
.quote-table .col-weight { width: 16%; }
.quote-table .col-qty { width: 8%; }
.quote-table .col-price { width: 14%; }
.quote-table .col-total { width: 15%; }

.quote-meta-table td,
.quote-table th,
.quote-table td,
.quote-footer-table td {
  border: 1px solid #333;
  padding: 8px 10px;
  vertical-align: middle;
  word-break: break-word;
}

.quote-meta-table td {
  width: 50%;
  font-size: 12px;
}

.quote-meta-label {
  display: inline-block;
  min-width: 68px;
  color: #555;
  font-weight: 600;
  margin-right: 8px;
}

.quote-table th {
  background: #eaf0f5;
  font-weight: 700;
  text-align: center;
  font-size: 12px;
}

.quote-table td {
  text-align: center;
  font-size: 12px;
}

.quote-table td.text-left {
  text-align: left;
}

.quote-table th,
.quote-table td {
  max-width: 0;
  overflow: hidden;
  word-break: break-word;
}

.quote-table td.num,
.quote-footer-value.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  word-break: break-all;
}

.quote-spec-note {
  border: 1px solid #333;
  margin-top: 0;
  margin-bottom: 12px;
  padding: 8px 10px;
  font-size: 11px;
  color: #444;
  background: #fafcfe;
}

.quote-footer-table td {
  font-size: 12px;
}

.quote-footer-label {
  width: 100px;
  background: #f4f8fb;
  font-weight: 700;
  text-align: center;
}

.quote-footer-value {
  text-align: left;
}

.quote-sign-row {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  font-size: 12px;
  padding: 0 8px;
  gap: 16px;
}

.preview-box:empty::before {
  content: none;
}

/* ── 搜索栏 ───────────────────────────────────────────── */

.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.search-bar input {
  flex: 1;
  height: var(--input-h);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  font-family: inherit;
  background: #fff;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(36, 113, 163, 0.12);
}

/* ── 表格（报价记录自适应） ───────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

th {
  background: linear-gradient(to bottom, #f4f8fb, #eaf0f5);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.3px;
}

td {
  color: var(--text);
  word-break: break-word;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #f4f8fb;
}

tbody tr:nth-child(even) td {
  background: #fafcfe;
}

tbody tr:nth-child(even):hover td {
  background: #f0f5fa;
}

td:last-child {
  white-space: nowrap;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.empty-tip {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px !important;
  font-size: 14px;
}

/* ── 标签与提示 ───────────────────────────────────────── */

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  background: #dceaf5;
  color: var(--primary);
  border: 1px solid #b8d4ea;
}

.lock-tip {
  font-size: 12px;
  color: var(--warning);
  margin-top: 12px;
  padding: 8px 12px;
  background: #fef9f3;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warning);
}

.admin-only {
  display: none;
}

body.is-admin .admin-only {
  display: inline;
}

/* ── PDF 打印内容区 ───────────────────────────────────── */

#pdfContent {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  z-index: -9999;
  margin: 0 auto;
}

.pdf-export-shell {
  width: 1020px;
  max-width: 1020px;
  margin: 0 auto;
  background: #fff;
}

.pdf-document {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  padding: 0;
  color: #222;
  font-size: 10px;
  line-height: 1.4;
  background: #fff;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}

.pdf-document .quote-sheet {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.pdf-document .quote-table th,
.pdf-document .quote-table td,
.pdf-document .quote-meta-table td,
.pdf-document .quote-footer-table td,
.pdf-document .quote-spec-note {
  border-color: #000 !important;
}

/* ── 打印 / 导出 PDF 专用 ─────────────────────────────── */

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

  html, body {
    background: #fff !important;
    font-size: 12pt;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* 隐藏所有操作界面 */
  .no-print,
  .header,
  .btn-group,
  .search-bar,
  .table-wrap,
  .lock-tip,
  .card:not(.print-area),
  .container > .grid-2 > div:not(.print-area) {
    display: none !important;
  }

  .container {
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .grid-2 {
    display: block;
  }

  /* 仅保留报价内容 */
  #pdfContent {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  #pdfContent,
  #pdfContent * {
    visibility: visible !important;
  }

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

  .preview-box.print-area {
    display: block !important;
    border: none;
    border-left: none;
    max-height: none;
    overflow: visible;
    padding: 0;
    background: #fff;
    page-break-inside: avoid;
  }
}

/* ── 大屏适配（工厂办公显示器 1440+ / 1920+） ─────────── */

@media (min-width: 1440px) {
  :root {
    --font-base: 15px;
    --font-lg: 16px;
    --input-h: 42px;
    --max-width: 1680px;
  }

  .header h1 {
    font-size: 24px;
  }

  .container {
    padding: 28px 40px 56px;
  }

  .grid-2 {
    gap: 24px;
  }

  .card-body {
    padding: 24px;
  }

  .result-item .value {
    font-size: 22px;
  }

  .result-item.highlight .value {
    font-size: 24px;
  }

  .preview-box {
    font-size: 14px;
    min-height: 280px;
    max-height: 560px;
  }

  th, td {
    padding: 13px 16px;
    font-size: 14px;
  }
}

@media (min-width: 1920px) {
  :root {
    --max-width: 1840px;
  }

  .header {
    padding: 20px 48px;
  }

  .header h1 {
    font-size: 26px;
  }

  .container {
    padding: 32px 48px 64px;
  }

  .grid-3 {
    gap: 18px;
  }

  .result-box {
    gap: 18px;
  }
}

/* ── 中小屏降级 ───────────────────────────────────────── */

@media (max-width: 1200px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .result-box {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
  }

  .container {
    padding: 16px;
  }

  .result-box {
    grid-template-columns: 1fr 1fr;
  }

  .search-bar {
    flex-wrap: wrap;
  }

  .search-bar input {
    width: 100%;
    flex: none;
  }
}

@media (max-width: 600px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .result-box {
    grid-template-columns: 1fr;
  }

  .btn-group {
    flex-direction: column;
  }

  .btn-group .btn {
    width: 100%;
  }

  th, td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .table-actions {
    flex-direction: column;
  }
}

/* ── 登录页 ─────────────────────────────────────────────── */

body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(41, 128, 185, 0.12), transparent 45%),
    radial-gradient(circle at bottom left, rgba(26, 82, 118, 0.1), transparent 40%),
    var(--bg-page);
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(26, 82, 118, 0.12);
  padding: 36px 32px 28px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(26, 82, 118, 0.2);
}

.login-brand h1 {
  font-size: 20px;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.login-brand p {
  font-size: 13px;
  color: var(--muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

.login-error {
  font-size: 13px;
  color: var(--danger);
  min-height: 18px;
}

.login-submit {
  width: 100%;
  height: 44px;
  margin-top: 6px;
  font-size: 15px;
  letter-spacing: 2px;
}

.login-footnote {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.header .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.header .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
}
