/* ===== 个税·五险一金计算器样式（独立一份；色板与科研导航站、其他子应用完全一致） =====
   本页主角是「两页签 + 输入表单 + 结果卡片网格 + 收入分配条形 + 税率/明细表」：
   ① 顶部两页签（个税计算 / 五险一金），当前页签高亮；
   ② 输入用标签在上、输入在下的垂直栅格，缴费比例做成可编辑小表格；
   ③ 结果用卡片网格铺各项汇总；个税页带到手/五险一金/个税三段收入条；
   ④ 年度税率表与五险一金明细表数字对齐、表头吸顶。 */
:root {
  --bg: #f5f6f8;
  --bg-card: #ffffff;
  --bg-hover: #f0f2f5;
  --text: #2c3e50;
  --text-sub: #7f8c9b;
  --border: #e8ebef;
  --accent: #0e9f8a;
  --accent-soft: rgba(14, 159, 138, .1);
  --accent-text: #fff;
  --danger: #e2544d;
  --ok: #2f9e5f;
  --shadow: 0 2px 8px rgba(30, 40, 60, .06);
  --bar-bg: #f7f8fa;
  --code-bg: #f4f6f9;
  --tag-bg: #eef2f7;
  --group-line: #dfe5ec;
}

html[data-theme="dark"] {
  --bg: #060a17;
  --bg-card: #0d1424;
  --bg-hover: #1a2336;
  --text: #dce3ec;
  --text-sub: #8794a8;
  --border: #1e2a44;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, .14);
  --danger: #ff6b64;
  --ok: #4ade80;
  --shadow: 0 2px 10px rgba(0, 0, 0, .5);
  --bar-bg: #0a1120;
  --code-bg: #101a30;
  --tag-bg: #16213a;
  --group-line: #24334f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  transition: background .25s, color .25s;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; background: var(--bar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .back { color: var(--accent); text-decoration: none; font-size: 14px; white-space: nowrap; }
.topbar .back:hover { text-decoration: underline; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex: none; }
.brand-mark img { width: 26px; height: 26px; }
.brand-text h1 { font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { font-size: 12px; color: var(--text-sub); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.icon-btn {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: var(--bg-hover); }
.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lang-btn {
  border: none; background: var(--bg-card); color: var(--text-sub);
  padding: 6px 10px; font-size: 13px; cursor: pointer; text-decoration: none;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--border); }
.lang-btn.active { background: var(--accent); color: var(--accent-text); }

/* ===== 主体 / 页签条 ===== */
.tc { max-width: 900px; margin: 0 auto; padding: 14px 16px 4px; }
.calc-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.calc-tabs {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 4px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  margin-right: auto;
}
.calc-tab {
  border: none; background: transparent; color: var(--text-sub);
  padding: 8px 18px; border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.calc-tab:hover { background: var(--bg-hover); color: var(--text); }
.calc-tab.active { background: var(--accent); color: var(--accent-text); }

/* ===== 面板 ===== */
.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.sec-head h2 { font-size: 16px; margin-right: auto; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  border-radius: 8px; padding: 6px 13px; cursor: pointer; font-size: 13.5px;
}
.btn:hover { background: var(--bg-hover); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }

/* ===== 输入表单 ===== */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 18px; margin-bottom: 4px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.fld-label { font-size: 13px; font-weight: 600; color: var(--text); }
.field input[type="number"], .field select {
  width: 100%; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 14px;
}
.field select { cursor: pointer; }
.field input[type="number"]:focus, .field select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field-hint { font-size: 12px; color: var(--text-sub); margin-top: 6px; }

/* ===== 快速示例 / 预设 ===== */
.quick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.quick-label { font-size: 12.5px; color: var(--text-sub); }
.chip {
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 12.5px;
}
.chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ===== 结果卡片网格 ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat {
  display: flex; flex-direction: column; gap: 4px; padding: 11px 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
}
.stat-l { font-size: 12.5px; color: var(--text-sub); }
.stat-v { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; word-break: break-all; }
.stat-v b { color: var(--accent); }
.stat-v .ok { color: var(--ok); }
.stat-v .danger { color: var(--danger); }
.result-note { font-size: 12px; color: var(--text-sub); }
.bracket-hint { font-size: 12.5px; color: var(--accent); font-weight: 600; margin: 2px 0 8px; }

/* ===== 收入分配条形 ===== */
.income-wrap { margin-bottom: 10px; }
.income-bar { display: flex; height: 20px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--bg-hover); }
.ib { display: block; height: 100%; transition: width .3s; min-width: 0; }
.ib-net { background: var(--ok); }
.ib-si { background: #6aa9e0; }
.ib-tax { background: #ff9c6e; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 12.5px; color: var(--text-sub); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.d-net { background: var(--ok); } .d-si { background: #6aa9e0; } .d-tax { background: #ff9c6e; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 6px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.data th {
  background: var(--bar-bg); color: var(--text-sub); font-weight: 600; font-size: 12px;
  position: sticky; top: 0; z-index: 1;
}
table.data th.center, table.data td.center { text-align: center; }
table.data th.left, table.data td.left { text-align: left; }
table.data td.num { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--bg-hover); }
table.data tbody tr.sum td { font-weight: 700; background: var(--accent-soft); border-top: 1px solid var(--accent); }
.ex-note { color: var(--text-sub); font-size: 12px; }
.same-rate { text-align: center; }
.same-rate input[type="number"] { width: 68px; text-align: center; }
.same-note { color: var(--text-sub); font-size: 12px; margin-left: 6px; }
/* 缴费比例小表格里的输入框 */
table.rates td input[type="number"] {
  width: 74px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
  border-radius: 7px; padding: 4px 6px; font-size: 13px; text-align: center;
}
table.rates td input[type="number"]:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
table.rates tbody tr:hover { background: transparent; }

/* ===== 说明区（SEO 主体） ===== */
.doc { max-width: 900px; margin: 10px auto 40px; padding: 18px 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.doc h2 { font-size: 16px; margin: 18px 0 6px; }
.doc h2:first-child { margin-top: 0; }
.doc h3 { font-size: 14.5px; margin: 12px 0 4px; color: var(--text); }
.doc p { font-size: 14px; margin-bottom: 8px; }
.doc ul, .doc ol { margin: 0 0 8px 20px; font-size: 14px; }
.doc li { margin-bottom: 5px; }
.doc dl.faq dt { font-weight: 600; font-size: 14px; margin-top: 10px; }
.doc dl.faq dd { font-size: 14px; color: var(--text-sub); margin-left: 0; }
.doc .rel-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.doc .rel-links a {
  display: inline-block; padding: 4px 12px; background: var(--tag-bg);
  border-radius: 999px; color: var(--accent); text-decoration: none; font-size: 13px;
}
.doc .rel-links a:hover { background: var(--accent-soft); text-decoration: none; }
.doc .ver { font-size: 12px; color: var(--text-sub); border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg-card); padding: 8px 18px; border-radius: 999px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .topbar .back { font-size: 13px; }
  .brand { flex: 1 1 auto; }
  .brand-text p { display: none; }
  .spacer { display: none; }
  .tc { padding: 10px 10px 0; }
  .panel { padding: 12px; }
  .sec-head h2 { font-size: 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .calc-tab { padding: 7px 14px; font-size: 13px; }
  .stat-v { font-size: 17px; }
}
