* {
  box-sizing: border-box;
  font-family: "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

body {
  margin: 0;
  background: #f5f7fb;
  color: #1f2a37;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: clamp(16px, 4vw, 24px) clamp(16px, 6vw, 32px);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  gap: 16px;
  flex-wrap: wrap;
}


.header-left {
  display: flex;
  gap: 16px;
  flex: 1 1 auto;
  align-items: flex-start;
  flex-wrap: nowrap;
}

.header-column {
  flex: 0 1 auto;
}

.info-column {
  flex: 0 1 auto;
}

.tips-column {
  flex: 0 0 auto;
}

.header-actions {
  flex: 0 0 auto;
  margin-left: auto;
}

.subtitle {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 14px;
}

.hero-hint {
  margin-top: 6px;
  background: #fef2f2;
  border-radius: 8px;
  padding: 6px 10px;
  display: inline-block;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  justify-content: flex-start;
}

.header-tips {
  margin-top: 12px;
}

.mode-toggle {
  display: flex;
  gap: 8px;
}

.mode-btn {
  border: 1px solid #d1d5db;
  background: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  color: #374151;
}

.mode-btn.active {
  background: #0f62fe;
  color: #fff;
  border-color: #0f62fe;
}

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

.view-btn {
  border: 1px dashed #d1d5db;
  background: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #6b7280;
}

.view-btn.active {
  border-color: #0f62fe;
  color: #0f62fe;
  background: #eef2ff;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
  gap: clamp(16px, 4vw, 24px);
  padding: clamp(16px, 4vw, 24px);
}

.panel {
  background: #fff;
  padding: clamp(16px, 4vw, 24px);
  border-radius: 16px;
  box-shadow: 0 6px 18px rgba(31, 42, 55, 0.08);
}

.panel h2 {
  margin-top: 0;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.input-grid label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  color: #4b5563;
}

.notice-field {
  background: #f3f4f6;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  color: #4b5563;
  margin-top: 12px;
}

.input-note {
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
}

input[type="number"],
input[type="text"] {
  margin-top: 6px;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.hint {
  font-size: 13px;
  color: #6b7280;
}

.notice {
  margin-top: 8px;
  padding: 8px 12px;
  background: #eef2ff;
  border-radius: 10px;
  font-size: 13px;
  color: #3730a3;
}

.modules-table,
.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.modules-table th,
.modules-table td,
.summary-table th,
.summary-table td {
  padding: 10px 8px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  text-align: left;
}

.modules-table thead {
  background: #f3f4f6;
}

.modules-table tbody tr:hover {
  background: #f9fafb;
}

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

.totals-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.totals-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.totals-row article {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background: #fafbff;
}

.price {
  font-size: 26px;
  margin: 4px 0;
  color: #111827;
}

.price-cny {
  font-size: 24px;
  color: #111827;
}

.placeholder-card {
  border-style: dashed;
  background: #f9fafb;
}

.scenario-notes {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 16px;
  background: #fdfefe;
  font-size: 14px;
  line-height: 1.5;
  color: #374151;
}

.scenario-notes h3 {
  margin-top: 0;
}

.price.muted {
  color: #6b7280;
  font-size: 18px;
}

.note {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.hidden {
  display: none !important;
}

.label-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.required-marker {
  color: #d93025;
  font-weight: 600;
}

.required-field input {
  border-color: #fda29b;
  background: #fff5f5;
}

.factory-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.factory-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  background: #fdfdfd;
  box-shadow: inset 0 0 0 1px #f1f5f9;
}

.factory-row {
  display: grid;
  grid-template-columns: 2fr repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
  align-items: end;
}

.factory-row label {
  margin: 0;
}

.factory-row input {
  width: 100%;
}

/* Checkbox column - fixed narrow width */
.modules-table th:nth-child(1),
.modules-table td:nth-child(1),
.summary-table th:nth-child(1),
.summary-table td:nth-child(1) {
  width: 60px;
  white-space: nowrap;
  text-align: center;
}

.modules-table th:nth-child(3),
.modules-table td:nth-child(3),
.summary-table th:nth-child(3),
.summary-table td:nth-child(3) {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.modules-table td.price-col {
  font-weight: 600;
  color: #0f62fe;
  white-space: nowrap;
  min-width: 0;
  width: 1%;
}

.modules-table td.remark-cell {
  color: #9ca3af;
}

.price-input {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.price-input input {
  width: 80px;
  padding: 4px 6px;
}

.price-input input.required-price {
  border-color: #fda29b;
  background: #fff5f5;
}

.price-input .unit {
  font-size: 12px;
  color: #6b7280;
}

.price-col .strike {
  text-decoration: line-through;
  color: #9ca3af;
  margin-right: 4px;
  font-size: 13px;
}

.price-col .waived {
  color: #0f62fe;
  font-weight: 600;
}

.cloud-card {
  margin-top: 24px;
  border: 1px solid #dbe1ec;
  border-radius: 16px;
  padding: 16px;
  background: #f5f8ff;
}

/* 工厂报价标题样式 - 增加视觉分隔 */
#multi-modules-wrapper > h2 {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 2px solid #e5e7eb;
  font-size: 20px;
  color: #111827;
}

.sales-tips {
  margin-top: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px 16px;
  background: #fff8f0;
  display: inline-flex;
  flex-direction: column;
  max-width: none;
}

.sales-tips h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 16px;
}

.sales-tips ul {
  margin: 0;
  padding-left: 18px;
  color: #92400e;
  font-size: 14px;
  line-height: 1.5;
}

.module-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.module-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  font-size: 11px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.layout[data-view="inputs"] .outputs,
.layout[data-view="outputs"] .inputs {
  display: none;
}

.layout[data-view="inputs"],
.layout[data-view="outputs"] {
  grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
  .app-header {
    flex-direction: column;
    gap: 12px;
  }
  .header-left {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }
  .header-column,
  .tips-column,
  .info-column,
  .header-actions {
    width: 100%;
    max-width: none;
    margin-left: 0;
  }
  .sales-tips {
    width: 100%;
    display: flex;
    margin-top: 0;
    margin-bottom: 12px;
  }
  .layout {
    grid-template-columns: 1fr;
  }
  .header-actions {
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 640px) {
  .modules-table th,
  .modules-table td {
    padding: 8px 6px;
  }
  .modules-table td.remark-cell {
    font-size: 12px;
  }
  .modules-table th:nth-child(3),
  .modules-table td:nth-child(3) {
    width: 0;
  }
  .modules-table th:nth-child(2),
  .modules-table td:nth-child(2) {
    width: auto;
  }
  .header-actions {
    align-items: stretch;
  }
  .mode-toggle,
  .view-toggle {
    flex-wrap: wrap;
    width: 100%;
  }
  .panel {
    border-radius: 12px;
  }
}
