/* ============================================================
   components.css — 卡片、表单、表格、结果面板、政策卡片
   ============================================================ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 16px 0 8px;
  color: var(--c-text-2);
}

/* ---------- 表单 ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field--full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-2);
}

.result-meta {
  margin-top: 12px;
  color: #e34d59;
  font-weight: 600;
  font-size: 13px;
}
.result-meta__static {
  color: var(--c-text);
  font-weight: 400;
}

.field input,
.field select {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--c-text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-light);
}

.field__hint {
  font-size: 12px;
  color: var(--c-text-3);
}

.btn {
  height: 42px;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius);
  background: var(--c-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--c-primary-dark);
}

.form-actions {
  margin-top: 16px;
}

/* ---------- 结果面板 ---------- */
.result-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.result-summary__item {
  background: var(--c-bg);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.result-summary__item .label {
  font-size: 12px;
  color: var(--c-text-3);
}

.result-summary__item .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
  margin-top: 2px;
}

.result-summary__item--total .value {
  color: var(--c-primary);
}

/* ---------- 表格 ---------- */
.table-wrap {
  overflow-x: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  padding: 10px 12px;
  text-align: right;
  white-space: normal;
  word-break: break-word;
  border-bottom: 1px solid var(--c-border);
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  background: var(--c-bg);
  font-weight: 600;
  color: var(--c-text-2);
  position: sticky;
  top: 0;
}

tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--c-border);
  border-bottom: none;
}

/* 网格线格式（计算器结果表 + 费率表共用）：外框+横线+竖线，斑马纹提升可读性 */
.calc-table,
.rates-table {
  border: 1.5px solid var(--c-border);
}

.calc-table th,
.calc-table td,
.rates-table th,
.rates-table td {
  border: 1px solid var(--c-border);
  padding: 9px 10px;
}

.calc-table thead th,
.rates-table thead th {
  background: var(--c-primary-light);
  color: var(--c-primary-dark);
  text-align: center;
}

.calc-table thead th:first-child,
.rates-table thead th:first-child {
  text-align: left;
}

.calc-table tbody td:first-child,
.rates-table tbody td:first-child {
  font-weight: 600;
}

.calc-table tbody tr:nth-child(even),
.rates-table tbody tr:nth-child(even) {
  background: var(--c-bg);
}

.calc-table tfoot td {
  background: var(--c-primary-light);
  border-top: 2px solid var(--c-primary);
}

.num {
  font-variant-numeric: tabular-nums;
}

.text-muted {
  color: var(--c-text-3);
  font-size: 12px;
}

/* 费率表：备注/基数口径列左对齐并自动换行；其余列不换行、按内容宽度显示 */
.rates-table th:not(:last-child),
.rates-table td:not(:last-child) {
  white-space: nowrap;
}

.rates-table th:last-child,
.rates-table td:last-child {
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

/* 移动端：固定布局 + 列宽分配 + 允许换行，兼顾手机与电脑端 */
@media (max-width: 768px) {
  .rates-table {
    table-layout: fixed;
    font-size: 12px;
  }
  .rates-table th,
  .rates-table td {
    white-space: normal;
    word-break: break-word;
    padding: 8px 6px;
  }
  .rates-table th:not(:last-child),
  .rates-table td:not(:last-child) {
    white-space: normal;
  }
  .rates-table th:nth-child(1),
  .rates-table td:nth-child(1) { width: 14%; }
  .rates-table th:nth-child(2),
  .rates-table td:nth-child(2) { width: 18%; }
  .rates-table th:nth-child(3),
  .rates-table td:nth-child(3) { width: 22%; }
  .rates-table th:nth-child(4),
  .rates-table td:nth-child(4) { width: 13%; }
  .rates-table th:nth-child(5),
  .rates-table td:nth-child(5) { width: 13%; }
  .rates-table th:nth-child(6),
  .rates-table td:nth-child(6) { width: 20%; }
}

/* ---------- 政策卡片 ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  border: 1px solid var(--c-border);
  background: #fff;
  color: var(--c-text-2);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.filter-chip[aria-pressed="true"] {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

.policy-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.policy-card__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.policy-card__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.policy-card__meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.policy-card__summary {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--c-text-2);
}

.policy-card__tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 12px;
  color: var(--c-primary);
  background: var(--c-primary-light);
  padding: 2px 10px;
  border-radius: 999px;
}

.badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-accent-dark);
  background: #e6f7f0;
  padding: 2px 10px;
  border-radius: 999px;
}

.policy-card__toggle {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--c-primary);
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
}

.policy-card__toggle:hover {
  text-decoration: underline;
}

.policy-card__toggle-icon {
  transition: transform 0.15s ease;
}

.policy-card__content {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--c-border);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--c-text-2);
  white-space: pre-wrap;
}

.policy-card__content[hidden] {
  display: none;
}
.policy-card__read-title {
  font-weight: 600;
  color: var(--c-text);
  font-size: 13.5px;
  margin-bottom: 6px;
}
.policy-card__read-body {
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--c-text-2);
}

/* ---------- 提示 ---------- */
.note-box {
  background: #fff8e6;
  border: 1px solid #f3e2b0;
  color: #8a6d1a;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.empty {
  color: var(--c-text-3);
  text-align: center;
  padding: 32px 0;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .result-summary {
    grid-template-columns: 1fr;
  }
  .card {
    padding: 16px;
  }

  /* 计算器结果表：固定布局压缩 6 列适配手机，竖线保留、金额不换行 */
  .calc-table {
    table-layout: fixed;
    font-size: 11px;
  }
  .calc-table th,
  .calc-table td {
    padding: 7px 4px;
  }
  .calc-table th:nth-child(1),
  .calc-table td:nth-child(1) { width: 17%; }
  .calc-table th:nth-child(2),
  .calc-table td:nth-child(2) { width: 18%; }
  .calc-table th:nth-child(3),
  .calc-table td:nth-child(3) { width: 14%; }
  .calc-table th:nth-child(4),
  .calc-table td:nth-child(4) { width: 19%; }
  .calc-table th:nth-child(5),
  .calc-table td:nth-child(5) { width: 14%; }
  .calc-table th:nth-child(6),
  .calc-table td:nth-child(6) { width: 18%; }
}
