/* 组件 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: var(--pad);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.idx {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.card-title {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.card-hint {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--faint);
}

/* 车型 */
.chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.chip:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  padding: 8px 4px;
  text-align: center;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.chip b {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip small {
  display: block;
  font-size: 8.5px;
  color: var(--faint);
  margin-top: 2px;
}

.chip.is-active {
  border-color: var(--brand);
  background: var(--brand-weak);
  box-shadow: 0 0 0 1px var(--brand);
}

.chip.is-active b {
  color: var(--brand-ink);
}

/* 方案 */
.schemes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scheme {
  position: relative;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.scheme-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scheme-name {
  font-size: 12.5px;
  font-weight: 500;
}

.scheme-badge {
  font-size: 8px;
  font-weight: 500;
  color: #fff;
  background: var(--brand);
  border-radius: 3px;
  padding: 2px 5px;
}

.scheme-rate {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.scheme-desc {
  font-size: 9.5px;
  color: var(--muted);
  margin-top: 4px;
}

.scheme.is-active {
  border-color: var(--brand);
  background: var(--brand-weak);
  box-shadow: 0 0 0 1px var(--brand);
}

.scheme.is-disabled {
  opacity: 0.5;
}

/* 首付 */
.slider-wrap {
  margin: 8px 4px 0;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  margin: 0;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--brand) var(--pct, 0%), #e8eaee var(--pct, 0%));
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

input[type='range']::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: #e8eaee;
}

input[type='range']::-moz-range-progress {
  height: 3px;
  border-radius: 2px;
  background: var(--brand);
}

input[type='range']::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
}

.scale {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  color: var(--faint);
  margin-top: 8px;
  padding: 0 2px;
}

.fields {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.field {
  display: block;
  border: 1px solid var(--line);
  background: #fafbfc;
  border-radius: var(--r-sm);
  padding: 7px 10px;
  min-width: 0;
  transition: border-color 0.15s var(--ease);
}

.field:focus-within {
  border-color: var(--brand);
  background: #fff;
}

.field-label {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.04em;
}

.field-line {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 1px;
}

.field-line i {
  font-style: normal;
  font-size: 10px;
  color: var(--faint);
}

.field input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 16px;
  font-weight: 500;
  text-align: right;
  padding: 0;
  font-variant-numeric: tabular-nums;
}

.field.is-error {
  border-color: #e5484d;
  background: #fff7f7;
}

.field-error {
  display: block;
  font-size: 9px;
  color: #e5484d;
  margin-top: 5px;
  min-height: 0;
}

/* 按钮 */
.btn {
  height: 44px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  padding: 0 18px;
  border: 1px solid transparent;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  font-weight: 500;
}

.btn-primary:hover {
  background: #f26200;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover {
  background: #fafbfc;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.actions .btn-primary {
  flex: 1;
}

.actions .btn-ghost {
  width: 96px;
}

/* 结果 */
.result {
  padding: 18px 17px 14px;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.res-label {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--faint);
}

.res-chip {
  margin-left: auto;
  font-size: 8.5px;
  color: var(--brand-ink);
  background: var(--brand-weak);
  border-radius: 3px;
  padding: 2px 7px;
}

.hero-num {
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.14;
  margin-top: 8px;
  padding-bottom: 2px;
  font-variant-numeric: tabular-nums;
}

.hero-num span {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 5px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.summary-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10px;
}

.summary-item span {
  color: var(--muted);
  white-space: nowrap;
}

.summary-item b {
  font-weight: 500;
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 720px) {
  .summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 20px;
  }
}

.summary-item b.is-long {
  font-size: 9.5px;
  font-weight: 400;
  color: var(--ink);
}

.detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 0 2px;
  font-size: 11px;
  font-weight: 500;
}

.detail-head span {
  font-size: 9px;
  color: var(--faint);
  font-weight: 400;
}

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

.tr {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr 0.85fr 1.1fr;
  align-items: center;
  gap: 4px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 10px;
}

.tr.th {
  font-size: 9px;
  font-weight: 500;
  color: var(--faint);
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.04em;
}

.tr .n {
  text-align: right;
  font-weight: 500;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.tr .d {
  text-align: right;
  font-size: 9px;
  color: var(--faint);
}

.tr.is-total {
  border-bottom: 0;
  border-top: 1px solid var(--ink);
  padding-top: 11px;
  font-weight: 500;
}

.tr.is-total .n {
  font-size: 11.5px;
}

.tr.is-total .n.is-empty {
  text-align: center;
  color: var(--faint);
}

.tr.is-selected {
  background: var(--brand-weak);
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: 3px;
}

.tr--clickable {
  cursor: pointer;
}

.savings {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 11px 0 2px;
  border-top: 1px dashed var(--line);
  background: none;
  font-size: 10px;
  color: var(--muted);
}

.savings b {
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-ink);
  background: var(--brand-weak);
  border-radius: 3px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}

.fine {
  font-size: 9.5px;
  line-height: 1.75;
  color: var(--faint);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.capture-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.capture-brand .mark {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--brand);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.capture-brand b {
  display: block;
  font-size: 11px;
  font-weight: 500;
}

.capture-brand span {
  display: block;
  font-size: 8.5px;
  color: var(--faint);
}

/* 期数 */
.terms {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.term {
  height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  font-size: 11.5px;
  color: var(--muted);
  transition: all 0.15s var(--ease);
}

.term.is-active {
  border-color: var(--brand);
  background: var(--brand-weak);
  color: var(--brand-ink);
  box-shadow: 0 0 0 1px var(--brand);
}

.term[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.term-note {
  font-size: 9px;
  color: var(--faint);
  margin-top: 8px;
}

/* 历史 */
.history-section .card {
  padding: 0;
  overflow: hidden;
}

.history-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 17px;
  cursor: pointer;
  user-select: none;
}

.history-title {
  font-size: 12px;
  font-weight: 500;
}

.history-count {
  font-size: 9.5px;
  color: var(--faint);
}

.history-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-clear {
  font-size: 9.5px;
  color: var(--faint);
  padding: 4px;
}

.history-clear:hover {
  color: #e5484d;
}

.history-toggle {
  font-size: 10px;
  color: var(--faint);
  transition: transform 0.2s var(--ease);
}

.history-section.is-collapsed .history-toggle {
  transform: rotate(-90deg);
}

.history-section.is-collapsed .history-body {
  display: none;
}

.history-body {
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  min-width: 560px;
}

.history-table th {
  text-align: left;
  font-weight: 400;
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

.history-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

.history-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.history-table tr:last-child td {
  border-bottom: 0;
}

.history-btn {
  font-size: 9.5px;
  color: var(--muted);
  padding: 3px 6px;
  border-radius: 3px;
}

.history-btn:hover {
  background: var(--bg);
  color: var(--ink);
}

.history-btn.is-danger:hover {
  color: #e5484d;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 10px;
  color: var(--faint);
}

/* 弹窗 / toast */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 12, 16, 0.45);
}

.modal-box {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--r);
  padding: 20px;
  box-shadow: 0 24px 60px -24px rgba(10, 12, 16, 0.45);
}

.modal-title {
  font-size: 14px;
  font-weight: 500;
}

.modal-body {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.8;
  margin-top: 10px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.modal-actions .btn {
  flex: 1;
  height: 40px;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 120;
  background: #0a0c10;
  color: #fff;
  font-size: 11px;
  padding: 9px 14px;
  border-radius: 4px;
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s var(--ease);
}

.toast.is-error {
  background: #b42318;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
}

/* 对比 */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

.compare-table th,
.compare-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.compare-table th:first-child,
.compare-table td:first-child {
  text-align: left;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.compare-table thead th {
  font-size: 8.5px;
  color: var(--faint);
  font-weight: 400;
}

.compare-table .is-best {
  color: var(--brand-ink);
  font-weight: 500;
}

.compare-table .diff {
  font-size: 9px;
  color: var(--muted);
}

/* 骨架屏 */
.skeleton {
  color: transparent;
  background: linear-gradient(90deg, #f1f2f4 25%, #f8f9fa 37%, #f1f2f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 3px;
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: 0 0;
  }
}

/* 加载遮罩 */
.loading {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(244, 245, 247, 0.72);
  backdrop-filter: blur(3px);
}

.loading-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 20px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 导出预览（微信/iOS 兜底） */
.export-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.export-preview img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}

.export-preview p {
  font-size: 11px;
  color: var(--muted);
}

.tr .range{font-style:normal;font-size:8px;color:var(--faint);margin-left:4px}

/* 对比入口 */
.res-compare {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
}

.res-compare:hover {
  border-color: var(--brand);
  color: var(--brand-ink);
}

.res-compare[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.compare-fab {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: #0a0c10;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.55);
}

.compare-fab b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}

@media (max-width: 1023px) {
  .compare-fab {
    bottom: 84px;
    right: 14px;
  }
}

.compare-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.compare-summary span {
  font-size: 10px;
  color: var(--brand-ink);
  background: var(--brand-weak);
  border-radius: 3px;
  padding: 3px 8px;
}

.compare-table .is-win {
  color: var(--brand-ink);
  font-weight: 500;
}

/* 对比弹窗：方案卡片 + 差额 + 可展开明细 */
.cmp-hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fafbfc;
}

.cmp-side {
  min-width: 0;
}

.cmp-side:last-child {
  text-align: right;
}

.cmp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cmp-side:last-child .cmp-head {
  justify-content: flex-end;
}

.cmp-name {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cmp-remove {
  flex: none;
  font-size: 9px;
  color: var(--faint);
  text-decoration: underline;
  padding: 2px;
}

.cmp-remove:hover {
  color: #b42318;
}

.cmp-num {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.cmp-num span {
  font-size: 9.5px;
  font-weight: 400;
  color: var(--muted);
  margin-left: 3px;
  letter-spacing: 0;
}

.cmp-sub {
  font-size: 9.5px;
  color: var(--faint);
  margin-top: 3px;
}

.cmp-tags {
  display: flex;
  gap: 4px;
  margin-top: 7px;
}

.cmp-side:last-child .cmp-tags {
  justify-content: flex-end;
}

.cmp-tag {
  font-size: 8.5px;
  font-weight: 500;
  color: var(--brand-ink);
  background: var(--brand-weak);
  border-radius: 3px;
  padding: 2px 6px;
}

.cmp-vs {
  font-size: 9px;
  color: var(--faint);
  letter-spacing: 0.12em;
}

.cmp-diff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.cmp-diff > div {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 11px;
  font-size: 9.5px;
  color: var(--muted);
}

.cmp-diff b {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  margin-top: 3px;
}

.cmp-diff b.is-win {
  color: var(--brand-ink);
}

.cmp-details {
  margin-top: 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}

.cmp-details summary {
  cursor: pointer;
  font-size: 10px;
  color: var(--muted);
  padding: 7px 0;
  list-style: none;
}

.cmp-details summary::-webkit-details-marker {
  display: none;
}

.cmp-details summary::before {
  content: '＋';
  margin-right: 6px;
  color: var(--faint);
}

.cmp-details[open] summary::before {
  content: '－';
}

.cmp-details .compare-table {
  margin-top: 2px;
}

.cmp-note {
  font-size: 9px;
  color: var(--faint);
  line-height: 1.7;
  margin-top: 10px;
}

.boot-error {
  position: fixed;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 300;
  padding: 10px 14px;
  border-radius: 4px;
  background: #b42318;
  color: #fff;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}

#modalRoot .modal {
  z-index: 110;
}
