/* ==================== Reset & Base ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a73e8;
  --primary-light: #e8f0fe;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1f2937;
  --text2: #6b7280;
  --text3: #9ca3af;
  --border: #e5e7eb;
  --radius: 12px;
  --rsm: 8px;
  --personal: #e74c3c;
  --company: #2980b9;
  --total: #8e44ad;
  --after-tax: #27ae60;
  --credit: #16a34a;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* ==================== Header ==================== */
.header { text-align: center; padding: 24px 0 12px; }
.header h1 { font-size: 1.45rem; color: var(--primary); }
.period { font-size: 0.85rem; color: var(--text2); margin-top: 2px; }
.header .note { font-size: 0.82rem; color: var(--text2); margin-top: 6px; background: #fef3cd; padding: 4px 10px; border-radius: 6px; display: inline-block; }

/* ==================== Card ==================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}

/* ==================== Table base ==================== */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

.rate-table, .detail-table, .ref-table, .min-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.rate-table th, .detail-table th, .ref-table th, .min-table th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--text2);
  font-size: 0.8rem;
  border-bottom: 2px solid var(--border);
  padding: 8px 6px;
  text-align: center;
  vertical-align: middle;
}

.rate-table th small { font-weight: 400; color: var(--text3); font-size: 0.7rem; display: block; margin-top: 2px; }

.btn-print-link {
  display: inline-block;
  border: none;
  background: none;
  color: var(--text3);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: color .15s;
  vertical-align: middle;
}
.btn-print-link:hover { color: var(--primary); background: var(--primary-light); }

.rate-table td, .detail-table td, .ref-table td, .min-table td {
  padding: 9px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.rate-table td small, .detail-table td small { display: block; font-size: 0.75rem; color: var(--text3); }

.rate-table tbody tr:nth-child(even),
.detail-table tbody tr:nth-child(even),
.ref-table tbody tr:nth-child(even) { background: #fafbfc; }

.rate-table tbody tr:hover,
.detail-table tbody tr:hover { background: var(--primary-light); }

.rate-table tbody td[title] { cursor: help; }

/* 个人进账行 */
.rate-table tr.personal-credit td { background: #f0fdf4 !important; }
.rate-table tr.personal-credit td:first-child { font-weight: 500; color: var(--credit); }

/* 大病行 */
.rate-table tr.flat-row td { background: #fefce8 !important; }

/* 合计行 */
.rate-table tfoot tr.sum-row td,
.detail-table tfoot tr.sum-row td {
  background: #f3f4f6 !important;
  font-weight: 600;
  border-top: 2px solid var(--primary);
  padding: 10px 6px;
}

/* ==================== Form ==================== */
.form-group { margin-bottom: 14px; }
.form-group > label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.95rem; }
.form-group > label input[type="checkbox"] { margin-right: 6px; }

.input-hint { color: var(--text2); font-size: 0.85rem; margin-bottom: 14px; }

.input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  overflow: hidden;
  background: #fff;
  transition: border-color .2s;
  width: 100%;
  max-width: 480px;
}
.input-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,0.12); }

.form-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 13px 16px;
  font-size: 1.05rem;
  background: transparent;
  min-width: 0;
}

.input-suffix {
  padding: 13px 16px;
  background: #f9fafb;
  color: var(--text2);
  font-size: 0.92rem;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

.form-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.flex-1 { flex: 1; }
.checkbox-row { margin-top: -4px; display: flex; align-items: center; gap: 8px; }
.checkbox-row label { display: flex; align-items: center; gap: 6px; margin: 0; }

.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.check-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.check-item input { margin: 0; cursor: pointer; }
.check-item:has(input:checked) {
  background: rgba(26,115,232,0.08);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 500;
}

/* ==================== 两面布局 ==================== */
.sub-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 18px 0 10px;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
}
.history-table th { background: #f1f5f9; }
.flexible-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 6px 0;
  color: var(--text);
  padding-left: 8px;
  border-left: 3px solid var(--primary);
  line-height: 1.4;
}
.flexible-title small {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text3);
}
.flexible-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: stretch;
}
.flexible-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.flexible-col .sub-title {
  margin-top: 0;
  margin-bottom: 8px;
}
.flexible-col .table-scroll { flex: 1; }
.flexible-col table.ref-table tr { height: 36px; }
.flexible-col table.ref-table th,
.flexible-col table.ref-table td {
  vertical-align: middle;
  line-height: 1.2;
  padding: 6px 10px;
}
@media (max-width: 768px) {
  .flexible-grid { grid-template-columns: 1fr; }
}
.calc-layout {
  display: block;
}
.calc-left {
  min-width: 0;
}
.card-info h3:first-child { margin-top: 0; }
.info-item {
  margin-bottom: 14px;
}

/* 台账表单横排布局 */
.calc-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: flex-end;
}
.calc-form-group { flex: 0 0 auto; }
.calc-form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.calc-form-checkgroup {
  flex: 1 1 auto;
  min-width: 320px;
}
.calc-form-extra {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 2px;
}
.calc-form-extra .checkbox-row label { font-weight: normal; }
.calc-hint {
  font-size: 0.78rem;
  color: #16a34a;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .calc-form-row {
    flex-direction: column;
    gap: 10px;
  }
  .calc-form-group { width: 100%; }
  .calc-form-checkgroup { min-width: 0; }
  .calc-form-extra {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }
  .calc-hint { font-size: 0.72rem; }
}
.info-item h4 {
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--text);
}
.info-item p {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.6;
}
.qrcode-area {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.qrcode-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: var(--rsm);
  background: #fff;
  min-height: 150px;
}
.qrcode-label {
  font-size: 0.78rem;
  color: var(--text3);
}

@media (max-width: 768px) {
  .calc-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .calc-layout { display: block; }
}

/* ==================== Button ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--rsm);
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  width: 100%;
}
.btn-auto { width: auto; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: #f3f4f6; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e5e7eb; }

/* ==================== Summary ==================== */
.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.summary-item {
  padding: 12px 10px;
  border-radius: var(--rsm);
  text-align: center;
  color: #fff;
}
.summary-item.personal { background: #e74c3c; }
.summary-item.company { background: #2980b9; }
.summary-item.total { background: #8e44ad; }
.summary-item.after-tax { background: #27ae60; }
.summary-label { display: block; font-size: 0.82rem; opacity: .9; margin-bottom: 6px; }
.summary-value { display: block; font-size: 1.4rem; font-weight: 700; }

/* ==================== Source Links ==================== */
.source-links { margin-top: 12px; list-style: none; width: 100%; }
.source-links li { padding: 5px 0; font-size: 0.82rem; }
.source-links li::before { content: '🔗 '; }
.source-links a { color: var(--primary); text-decoration: none; }
.source-links a:hover { text-decoration: underline; }

/* ==================== 社保服务指引卡片 ==================== */
.guide-grid {
  display: flex;
  gap: 16px;
}
.guide-item {
  flex: 1 1 200px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.guide-item-center {
  justify-content: center;
}
.guide-icon {
  font-size: 1.5rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.guide-content strong {
  font-size: 0.88rem;
  color: var(--primary);
  display: block;
  margin-bottom: 4px;
}
.guide-content p {
  font-size: 0.8rem;
  color: var(--text2);
  line-height: 1.5;
  margin: 0;
}
.bank-selector-inline select {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.82rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
}
.bank-search-input {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.82rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}
.bank-search-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.branch-empty {
  padding: 24px 12px;
  text-align: center;
  color: var(--text3);
  font-size: 0.8rem;
}
.bank-branches-inline {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}
.branch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.branch-item {
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
}
.branch-name {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.branch-addr {
  color: var(--text2);
  line-height: 1.4;
}
.branch-tel {
  margin-left: auto;
  white-space: nowrap;
}
.branch-tel a {
  color: var(--primary);
  text-decoration: none;
}
.branch-more {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text3);
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}
.source-links li::before { content: '🔗 '; }
.source-links a { color: var(--primary); text-decoration: none; }
.source-links a:hover { text-decoration: underline; }

/* ==================== 生育待遇表格 ==================== */
.maternity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.maternity-table th {
  background: #fdf2f8;
  font-weight: 600;
  color: #9d174d;
  font-size: 0.78rem;
  border-bottom: 2px solid #fbcfe8;
  padding: 10px 8px;
  text-align: left;
  vertical-align: middle;
}
.maternity-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #fce7f3;
  vertical-align: top;
  line-height: 1.5;
  color: var(--text);
}
.maternity-table tbody tr:nth-child(even) { background: #fef7f7; }
.maternity-table tbody tr:hover { background: #fce7f3; }
.maternity-table .m-item { display: block; }
.maternity-table .m-item + .m-item { margin-top: 6px; padding-top: 6px; border-top: 1px dashed #fbcfe8; }
.maternity-table .m-file {
  display: inline-block;
  font-size: 0.75rem;
  background: #fff1f2;
  color: #9d174d;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  margin-right: 2px;
}
.maternity-table .m-amt {
  display: inline-block;
  font-weight: 600;
  color: #b91c1c;
}
.maternity-table .m-detail {
  font-size: 0.78rem;
  color: var(--text2);
  display: block;
  margin-top: 2px;
}
.maternity-table .clause-cell {
  max-width: 280px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: help;
}

/* ==================== 生育福利卡片 ==================== */
.maternity-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
@media (max-width: 900px) {
  .maternity-cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 500px) {
  .maternity-cards { grid-template-columns: repeat(2, 1fr); }
}
.m-card {
  background: #fff;
  border: 1px solid #fbcfe8;
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
}
.m-card:hover {
  border-color: #f472b6;
  box-shadow: 0 2px 12px rgba(244,114,182,0.15);
  transform: translateY(-2px);
}
.m-card-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}
.m-card-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: #9d174d;
  margin-bottom: 4px;
}
.m-card-summary {
  font-size: 0.78rem;
  color: var(--text2);
  line-height: 1.4;
}
.m-card-summary small {
  font-size: 0.7rem;
  color: var(--text3);
}

/* ==================== 弹窗 ==================== */
.m-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
}
.m-overlay.show { display: block; }
.m-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 720px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.m-modal.show { display: block; }
.m-modal-head,
.m-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #fce7f3;
  background: #fdf2f8;
  border-radius: 12px 12px 0 0;
}
.m-modal-head span,
.m-modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #9d174d;
  margin: 0;
}
.m-modal-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: #9d174d;
  cursor: pointer;
  padding: 8px 12px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-modal-body {
  padding: 20px;
}
.m-modal-body .m-detail-item {
  margin-bottom: 14px;
}
.m-modal-body .m-detail-item:last-child { margin-bottom: 0; }
.m-modal-body .m-detail-label {
  font-size: 0.78rem;
  color: var(--text2);
  font-weight: 600;
  margin-bottom: 4px;
}
.m-modal-body .m-detail-value {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.6;
}
.m-modal-body .m-file {
  display: inline;
  font-size: 0.82rem;
  color: #9d174d;
  margin-right: 4px;
  white-space: nowrap;
}
.m-modal-body .m-amt-block {
  background: #fef2f2;
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid #e11d48;
  font-size: 0.88rem;
  line-height: 1.6;
}
.m-modal-body .m-amt-block strong {
  color: #b91c1c;
}

/* 生育福利打印样式 */
.maternity-print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.maternity-print-table th {
  background: #fdf2f8 !important;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  padding: 8px 6px;
  border-bottom: 2px solid #fbcfe8;
  text-align: left;
  font-size: 10px;
}
.maternity-print-table td {
  padding: 6px;
  border-bottom: 1px solid #fce7f3;
  vertical-align: top;
  line-height: 1.4;
}
.maternity-print-table .m-file {
  display: inline;
  color: #9d174d;
  font-size: 10px;
}
.print-header {
  text-align: center;
  margin-bottom: 16px;
}
.print-header h1 { font-size: 18px; color: #9d174d; margin-bottom: 4px; }
.print-header p { font-size: 12px; color: #666; }



/* ==================== 灵活就业翻页 ==================== */
.flexible-tabs { display: inline-flex; gap: 4px; margin-left: 8px; }
.flexible-tab {
  font-size: 0.68rem;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
}
.flexible-tab:hover { border-color: var(--primary); color: var(--primary); }
.flexible-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ==================== Action ==================== */
.action-bar { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
.btn-xs { padding: 4px 10px; font-size: 0.78rem; border-radius: 4px; margin-left: 8px; vertical-align: middle; }

/* ==================== Footer ==================== */
.footer { text-align: center; padding: 16px 0 28px; font-size: 0.78rem; color: var(--text2); }
.footer p { margin-bottom: 3px; }

/* ==================== Print ==================== */
@media print {
  body { background: #fff; font-size: 11px; }
  .container { max-width: 100%; padding: 0; }
  .summary-row { grid-template-columns: repeat(4, 1fr); }
  .summary-item { padding: 14px; -webkit-print-color-adjust: exact; print-color-adjust: exact; background: #f5f5f5 !important; color: #333 !important; border: 1px solid #ccc; }
  .summary-item.personal .summary-value { color: #c0392b; }
  .summary-item.company .summary-value { color: #2471a3; }
  .summary-item.total .summary-value { color: #7d3c98; }
  .summary-item.after-tax .summary-value { color: #1e8449; }
  .summary-value { font-size: 1.3rem; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
  .card-title { font-size: 0.95rem; }
  .form-group, .form-row, .btn, .input-hint, .source-links,
  .ref-table, .min-table, .footer { display: none; }
  .rate-table { min-width: 0; font-size: 9px; }
  .rate-table th, .rate-table td { padding: 4px 3px; }
  .summary-row { grid-template-columns: repeat(4, 1fr); }
  .summary-item { padding: 6px; }
  .summary-value { font-size: 1rem; }
  .detail-table { min-width: 0; font-size: 9px; }
  .detail-table th, .detail-table td { padding: 3px; }
}

/* 台账专用打印：只打印 #resultCard 区域 */
body.printing-ledger .header,
body.printing-ledger section.card:not(#resultCard),
body.printing-ledger .footer { display: none !important; }
body.printing-ledger { background: #fff; }
body.printing-ledger .container { max-width: 100%; padding: 14px; }
body.printing-ledger #resultCard { box-shadow: none; border: none; padding: 0; display: block !important; }
body.printing-ledger #resultCard .action-bar { display: none; }
body.printing-ledger #resultCard .summary-row { display: grid; grid-template-columns: repeat(4, 1fr); }
body.printing-ledger #resultCard .table-scroll { display: block; overflow: visible; }
body.printing-ledger #resultCard .detail-table { display: table; width: 100%; }
body.printing-ledger #resultCard .detail-table thead { display: table-header-group; }
body.printing-ledger #resultCard .detail-table tbody { display: table-row-group; }
body.printing-ledger #resultCard .detail-table tfoot { display: table-row-group; }
body.printing-ledger #resultCard .detail-table tr { display: table-row; }
body.printing-ledger #resultCard .detail-table td { display: table-cell; }
body.printing-ledger #resultCard .detail-table td::before { content: none; }

/* ==================== Tablet ==================== */
@media (max-width: 1024px) and (min-width: 641px) {
  .container { max-width: 100%; padding: 14px; }
  .rate-table { font-size: 0.85rem; }
  .rate-table th, .rate-table td { padding: 7px 4px; }
  .summary-row { grid-template-columns: repeat(4, 1fr); }
  .summary-value { font-size: 1.1rem; }
  .input-wrapper { max-width: 400px; }
}

/* ==================== Mobile ==================== */
@media (max-width: 640px) {
  .container { padding: 10px; }
  .card { padding: 14px; }
  .header h1 { font-size: 1.2rem; }

  .guide-grid { flex-direction: column; }
  .guide-item { flex: 1 1 auto !important; width: 100%; flex-direction: column; align-items: stretch; }
  .guide-icon { align-self: flex-start; }

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

  .summary-row { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .summary-value { font-size: 1rem; }

  /* 费率表手机端卡片化 */
  .rate-table { min-width: 0; display: block; }
  .rate-table thead { display: none; }
  .rate-table tbody, .rate-table tfoot, .rate-table tr { display: block; }
  .rate-table tr {
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--rsm);
    padding: 6px 10px;
    background: #fff !important;
    position: relative;
  }
  .rate-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px dashed #f0f0f0;
    text-align: right;
  }
  .rate-table td:last-child { border-bottom: none; }
  .rate-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text2);
    font-size: 0.8rem;
    text-align: left;
  }
  .rate-table tfoot tr.sum-row {
    background: #f3f4f6 !important;
    border: 2px solid var(--primary);
  }

  .detail-table { min-width: 0; display: block; }
  .detail-table thead { display: none; }
  .detail-table tbody, .detail-table tfoot, .detail-table tr { display: block; }
  .detail-table tr {
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: var(--rsm);
    padding: 5px 10px;
  }
  .detail-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    border-bottom: 1px dashed #f0f0f0;
    text-align: right;
  }
  .detail-table td:last-child { border-bottom: none; }
  .detail-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text2);
    font-size: 0.8rem;
  }
  /* 手机端只显示月缴列（年缴隐藏） */
  .detail-table td[data-label="单位年缴"],
  .detail-table td[data-label="个人年缴"] { display: none; }
  .detail-table tfoot tr.sum-row {
    background: #f3f4f6 !important;
    border: 2px solid var(--primary);
  }

  .rate-table tr.flat-row td { background: transparent !important; }
  .rate-table tr.personal-credit { background: #f0fdf4 !important; }
  .rate-table tr.flat-row { background: #fefce8 !important; }
}

@media (max-width: 380px) {
  .summary-row { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .summary-value { font-size: 0.85rem; }
  .summary-item { padding: 8px 4px; }
}

.rate-select, .rate-input {
  width: 100%;
  min-width: 70px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
  background: #fff;
  cursor: pointer;
  transition: border-color .2s;
}
.rate-select:focus, .rate-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.12);
}
.rate-input {
  text-align: center;
  max-width: 90px;
}
.rate-select {
  max-width: 85px;
}

@media (max-width: 640px) {
  .rate-select, .rate-input {
    max-width: 100%;
    min-width: 0;
  }
  .rate-input {
    max-width: 80px;
  }
  .rate-select {
    max-width: 75px;
  }
}

/* ========== 更新日志 ========== */
.changelog-card { padding: 0; overflow: hidden; }
.changelog-card .card-title { margin: 0; padding: 0; }

/* ========== 数据查询 ========== */
.search-form { margin-top: 10px; }
.search-row {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 8px;
}
.search-label {
  font-size: 0.85rem; color: var(--text2); white-space: nowrap;
  min-width: 80px;
}
.search-select, .search-input {
  flex: 1; min-width: 160px;
  padding: 8px 10px;
  font-size: 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  background: #fff;
}
.search-select:focus, .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.search-btn {
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}
.search-btn:hover { opacity: 0.88; }
.search-hint {
  font-size: 0.75rem; color: var(--text3);
  margin-top: 2px; margin-bottom: 0;
}
.search-result { margin-top: 12px; }
.search-meta {
  font-size: 0.78rem; color: var(--text2);
  margin-bottom: 8px;
}
.search-table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}
.search-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.search-table th {
  position: sticky; top: 0;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #f3f4f6;
}
.search-table td {
  padding: 4px 10px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;
}
.search-table tr:last-child td { border-bottom: none; }
.search-more, .search-empty, .search-loading {
  text-align: center;
  margin-top: 6px;
}
.search-empty, .search-loading {
  margin-top: 12px;
  padding: 20px;
  font-size: 0.82rem;
  color: var(--text3);
}
.search-more-btn {
  padding: 4px 16px;
  font-size: 0.78rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.search-more-btn:hover { background: #e5e7eb; }
.changelog-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 14px 22px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
}
.changelog-toggle:hover { background: rgba(0,0,0,0.02); }
.changelog-toggle .changelog-hint {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text2);
  margin-left: 4px;
}
.changelog-toggle .changelog-arrow {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text2);
  transition: transform 0.2s;
  display: inline-block;
}
.changelog-toggle[aria-expanded="true"] .changelog-arrow { transform: rotate(90deg); }
.changelog {
  list-style: none;
  padding: 4px 22px 18px;
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.85;
  color: var(--text);
  border-top: 1px dashed #e5e5e5;
}
.changelog > li { padding: 8px 0 6px; border-bottom: 1px dashed #f0f0f0; }
.changelog > li:last-child { border-bottom: none; }
.changelog > li > strong { color: var(--primary); margin-right: 4px; }
.changelog ul { list-style: disc; padding-left: 22px; margin: 4px 0 0; color: var(--text2); font-size: 0.85rem; }
.changelog ul li { padding: 1px 0; }
.changelog code { background: #f0f0f0; color: #555; padding: 1px 5px; border-radius: 2px; font-family: Consolas, monospace; font-size: 0.82rem; }

/* 医保个人进账：小数点后1位 */
.num-1dec::before { content: '¥'; }

/* ==================== 公积金差额补缴弹窗 ==================== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: #fff; border-radius: 12px; width: 440px; max-width: 92vw;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1rem; }
.modal-close {
  background: none; border: none; font-size: 1.2rem; cursor: pointer;
  color: var(--text2); padding: 4px 8px; border-radius: 4px;
}
.modal-close:hover { background: #f0f0f0; }
.modal-body { padding: 20px; }
.form-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.form-row label {
  font-size: 0.85rem; color: var(--text); white-space: nowrap; width: 100px;
}
.form-row input, .form-row select {
  flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.85rem; outline: none;
}
.form-row input:focus, .form-row select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light);
}
.btn-calc {
  width: 100%; padding: 10px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 0.9rem; cursor: pointer;
  margin-top: 4px;
}
.btn-calc:hover { background: #1557b0; }
.calc-result {
  margin-top: 16px; padding: 14px 16px; background: #f8fafc;
  border-radius: 8px; border: 1px solid var(--border);
  font-size: 0.88rem; line-height: 1.8;
}
.calc-result .result-item {
  display: flex; justify-content: space-between; padding: 4px 0;
}
.calc-result .result-item:not(:last-child) {
  border-bottom: 1px dashed #eee;
}
.calc-result .result-label { color: var(--text2); }
.calc-result .result-value { font-weight: 600; color: var(--text); }
.calc-result .result-total {
  margin-top: 8px; padding-top: 8px; border-top: 2px solid var(--primary);
  font-size: 1rem;
}
.calc-result .result-total .result-value { color: var(--primary); font-size: 1.1rem; }
.row-account-credit td { color: var(--blue); }

/* ========== 栏目锚点导航 ========== */
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 66px; }

.anchor-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  margin: 0 0 14px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  scrollbar-width: thin;
}
.anchor-link {
  flex-shrink: 0;
  display: inline-block;
  padding: 5px 14px;
  font-size: 0.82rem;
  color: var(--text2);
  text-decoration: none;
  white-space: nowrap;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 20px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.anchor-link:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary);
}
.anchor-link.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* ========== 导航下拉菜单 ========== */
.dropdown-toggle {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}
.dd-caret {
  display: inline-block;
  margin-left: 2px;
  font-size: 0.7em;
  transition: transform 0.15s;
}
.dropdown-toggle.open {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}
.dropdown-toggle.open .dd-caret {
  transform: rotate(180deg);
}
.dropdown-menu {
  position: fixed;
  display: none;
  z-index: 100;
  min-width: 232px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}
.dropdown-menu.open {
  display: block;
}
.dd-group-title {
  padding: 8px 12px 4px;
  font-size: 0.72rem;
  color: var(--text3);
  letter-spacing: 0.04em;
}
.dd-group-title:not(:first-child) {
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}
.dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}
.dd-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========== 返回置顶悬浮按钮 ========== */
.back-top {
  position: fixed;
  right: 18px;
  bottom: 26px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}
.back-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-top:hover {
  filter: brightness(1.08);
}
@media (max-width: 520px) {
  .back-top {
    right: 12px;
    bottom: 18px;
    width: 40px;
    height: 40px;
    font-size: 1.05rem;
  }
}

/* ==================== 加入我们弹窗 ==================== */
.join-logo {
  text-align: center;
  margin-bottom: 14px;
}
.join-logo img {
  height: 44px;
  width: auto;
  display: inline-block;
}
.join-grid {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: stretch;
  flex-wrap: nowrap;
}
.join-card {
  flex: 1 1 0;
  max-width: 100%;
  min-width: 0;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px 14px;
  background: var(--card);
}
.join-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.join-qr {
  width: 160px;
  height: 160px;
  margin: 0 auto 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafafa;
}
.join-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.join-qr-placeholder {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.8rem;
  color: var(--text3);
}
.join-num {
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.6;
  word-break: break-all;
  margin: 0;
}
.copy-btn {
  margin-left: 8px;
  padding: 2px 12px;
  font-size: 0.75rem;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.15s;
}
.copy-btn:hover {
  background: var(--primary-light);
}
.copy-btn.copied {
  color: #16a34a;
  border-color: #16a34a;
}
/* ==================== 运营社群标签列表 ==================== */
.join-communities {
  border-top: 1px dashed var(--border);
  padding-top: 16px;
  margin-top: 16px;
  text-align: center;
}
.join-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.join-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}
.join-tag {
  display: inline-block;
  padding: 5px 14px;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--primary-light);
  border-radius: 20px;
  white-space: nowrap;
}
.join-hint {
  margin-top: 12px;
  font-size: 0.72rem;
  color: var(--text3);
  line-height: 1.5;
}
.channel-open-btn {
  padding: 8px 26px;
  font-size: 0.85rem;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.15s;
}
.channel-open-btn:hover {
  filter: brightness(1.08);
}
.channel-link {
  display: inline-block;
  padding: 10px 30px;
  font-size: 0.9rem;
  color: #fff;
  background: var(--primary);
  border-radius: 8px;
  text-decoration: none;
  transition: filter 0.15s;
}
.channel-link:hover {
  filter: brightness(1.08);
}
/* 腾讯频道弹窗层级高于加入我们 */
#joinChannelModal {
  z-index: 10050;
}
@media (max-width: 520px) {
  .join-grid {
    flex-wrap: wrap;
  }
  .join-card {
    flex: 1 1 100%;
    min-width: 100%;
  }
}
