/* ============================================================
 * 个税优化测算系统 · 静态前端设计系统
 * 主色 深藏青 #0F3A5C / 点缀金 #B8893B / 辅助青 #0E6E6E
 * 原生 CSS，无框架；移动端友好（热区≥44px、输入≥16px、表格横滚、导航横滑）
 * ============================================================ */

:root {
  --navy: #0F3A5C;
  --navy-deep: #0B2C47;
  --navy-soft: #E8EFF5;
  --gold: #B8893B;
  --gold-soft: #F6EEDF;
  --teal: #0E6E6E;
  --teal-soft: #E2F0F0;
  --bg: #F2F5F8;
  --card: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --line: #E5E9EF;
  --danger: #C0392B;
  --danger-soft: #FBEAE8;
  --success: #1E8449;
  --success-soft: #E7F5EC;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(15, 58, 92, 0.08);
  --shadow-lg: 0 10px 32px rgba(15, 58, 92, 0.16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

body { min-height: 100vh; }

a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.page { max-width: 1080px; margin: 0 auto; padding: 16px 16px 96px; }
.page-narrow { max-width: 560px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flex-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* ---------- 顶部品牌 ---------- */
.brand-header {
  background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 60%, #14507E 100%);
  color: #fff;
  padding: 22px 16px 18px;
}
.brand-header .inner { max-width: 1080px; margin: 0 auto; }
.brand-title { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.brand-sub { font-size: 13px; opacity: .85; margin-top: 4px; }
.brand-badge {
  display: inline-block; margin-top: 10px;
  background: rgba(184, 137, 59, .22);
  border: 1px solid rgba(184, 137, 59, .55);
  color: #F3E2C4; font-size: 12px; border-radius: 999px; padding: 3px 12px;
}

/* ---------- 入口卡片（选择页） ---------- */
.entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.entry-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 18px; cursor: pointer;
  border: 1px solid var(--line); min-height: 132px;
  transition: transform .15s ease, box-shadow .15s ease;
}
.entry-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.entry-icon {
  width: 56px; height: 56px; border-radius: 14px; flex: 0 0 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.entry-personal .entry-icon { background: var(--teal-soft); color: var(--teal); }
.entry-team .entry-icon { background: var(--gold-soft); color: var(--gold); }
.entry-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.entry-desc { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.7; }
.entry-arrow { margin-left: auto; font-size: 26px; color: var(--gold); }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin-top: 22px; line-height: 1.7; }

/* ---------- 按钮（热区≥44px） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 20px;
  border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: inherit; line-height: 1.2; white-space: nowrap;
  transition: opacity .15s ease, background .15s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-deep); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #A3762F; }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--navy-soft); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn-link { background: none; border: none; color: var(--navy); min-height: 44px; cursor: pointer; font-size: 14px; padding: 0 8px; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.form-item.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; color: var(--navy); font-weight: 600; }
.form-label .hint { color: var(--muted); font-weight: 400; font-size: 12px; }
.form-input, .form-select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; font-family: inherit; color: var(--text);
  background: #fff; outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(15,58,92,.10); }
.form-error { color: var(--danger); font-size: 12px; min-height: 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  min-height: 44px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--teal); background: var(--teal-soft); color: var(--teal);
  font-size: 12px; cursor: pointer;
}
.chip:hover { background: var(--teal); color: #fff; }

/* ---------- 统计 / 结果卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 6px; }
.stat-value.gold { color: var(--gold); }
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.hero-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-top: 3px solid var(--gold); }
.hero-label { font-size: 12px; color: var(--muted); }
.hero-num { font-size: 20px; font-weight: 700; color: var(--navy); margin-top: 6px; word-break: break-all; }

/* ---------- 表格（横滚 + 姓名列固定） ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid var(--line); }
table.data-table { border-collapse: collapse; width: 100%; min-width: 640px; background: #fff; }
.data-table th, .data-table td { padding: 10px 14px; font-size: 13px; white-space: nowrap; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { background: var(--navy-soft); color: var(--navy); font-weight: 600; position: sticky; top: 0; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.row-best td { background: var(--gold-soft); font-weight: 600; }
.data-table td.sticky-col, .data-table th.sticky-col { position: sticky; left: 0; background: #fff; z-index: 2; box-shadow: 2px 0 0 var(--line); }
.data-table th.sticky-col { background: var(--navy-soft); z-index: 3; }

/* ---------- 页签导航（横滑） ---------- */
.tabs-bar {
  display: flex; gap: 6px; overflow-x: auto; white-space: nowrap;
  -webkit-overflow-scrolling: touch; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px; margin-bottom: 16px;
}
.tabs-bar::-webkit-scrollbar { display: none; }
.tab-item {
  flex: 0 0 auto; min-height: 44px; display: inline-flex; align-items: center;
  padding: 8px 16px; border-radius: 9px; font-size: 14px; color: var(--muted);
  cursor: pointer; border: none; background: transparent; font-family: inherit;
}
.tab-item.active { background: var(--navy); color: #fff; font-weight: 600; }
.sub-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.sub-tab { flex: 0 0 auto; min-height: 44px; padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy); font-size: 13px; cursor: pointer; }
.sub-tab.active { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.tag-green { background: var(--success-soft); color: var(--success); }
.tag-blue { background: var(--navy-soft); color: var(--navy); }
.tag-gray { background: #EEF1F4; color: var(--muted); }
.tag-gold { background: var(--gold-soft); color: var(--gold); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(11, 44, 71, .45);
  display: none; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal-mask.show { display: flex; }
.modal-box {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0; max-height: 88vh; overflow-y: auto; padding: 20px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); min-width: 44px; min-height: 44px; cursor: pointer; }
.modal-actions { display: flex; gap: 12px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
@media (min-width: 640px) {
  .modal-mask { align-items: center; }
  .modal-box { border-radius: 16px; }
}

/* ---------- Toast ---------- */
#toast-wrap { position: fixed; top: 14%; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: 86vw; }
.toast {
  background: rgba(15, 58, 92, .94); color: #fff; padding: 11px 20px;
  border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); text-align: center;
  max-width: 86vw;
}
.toast.toast-error { background: rgba(192, 57, 43, .95); }
.toast.toast-success { background: rgba(30, 132, 73, .95); }

/* ---------- 图表 ---------- */
.chart-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.chart-box canvas { width: 100%; height: 260px; display: block; }
.chart-caption { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: center; }

/* ---------- 团队版布局 ---------- */
.team-body { display: flex; flex-direction: column; min-height: 100vh; }
.team-main { flex: 1; max-width: 1080px; width: 100%; margin: 0 auto; padding: 16px 16px 24px; }
.team-side { display: flex; gap: 10px; overflow-x: auto; padding: 10px 0; margin-bottom: 14px; }
.team-menu-btn {
  flex: 0 0 auto; min-height: 44px; padding: 8px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--navy); font-size: 14px; cursor: pointer; font-family: inherit;
}
.team-menu-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.team-footer {
  border-top: 1px solid var(--line); background: #fff; padding: 12px 16px;
  text-align: center; font-size: 13px;
}
.team-footer a { display: inline-flex; min-height: 44px; align-items: center; }
.user-chip { font-size: 13px; opacity: .9; }

/* ---------- 导出页卡片 ---------- */
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.export-card { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.export-thumb {
  aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #F7FAFC; margin-bottom: 14px;
}
.export-card .btn { margin-top: auto; }
.thumb-mock { width: 100%; height: 100%; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.thumb-row { height: 14px; border-radius: 4px; background: var(--navy-soft); }
.thumb-row.gold { background: var(--gold-soft); }
.thumb-row.teal { background: var(--teal-soft); }
.thumb-cols { display: flex; gap: 8px; flex: 1; }
.thumb-col { flex: 1; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.thumb-bar { height: 8px; border-radius: 4px; background: var(--navy-soft); }
.thumb-bar.gold { background: var(--gold); opacity: .7; }
.thumb-bar.teal { background: var(--teal); opacity: .7; }
.version-switch { display: inline-flex; border: 1px solid var(--navy); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.version-switch button { min-height: 36px; padding: 6px 14px; border: none; background: #fff; color: var(--navy); font-size: 13px; cursor: pointer; font-family: inherit; }
.version-switch button.active { background: var(--navy); color: #fff; }

/* ---------- 明细弹窗行 ---------- */
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.detail-row:last-child { border-bottom: none; }
.detail-key { color: var(--muted); flex: 0 0 46%; }
.detail-val { font-weight: 600; color: var(--navy); text-align: right; }
.ai-note { background: var(--teal-soft); border-left: 3px solid var(--teal); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-top: 12px; color: var(--text); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-icon { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---------- 政策页 ---------- */
.law-item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.law-no { font-weight: 600; color: var(--navy); font-size: 14px; }
.law-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.law-desc { font-size: 13px; margin-top: 6px; }
.logic-item { margin-bottom: 14px; }
.logic-title { font-weight: 600; color: var(--navy); font-size: 14px; margin-bottom: 4px; }
.logic-body { font-size: 13px; color: var(--text); line-height: 1.75; }
.exempt-list { margin: 0; padding-left: 20px; font-size: 14px; }
.exempt-list li { margin-bottom: 8px; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager-info { font-size: 13px; color: var(--muted); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .entry-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid, .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .export-grid { grid-template-columns: 1fr; }
  .brand-title { font-size: 19px; }
}
