/* 个人所得税计算 — 风格对齐 shebao.zannuo.com */
:root {
  --navy: #1b4f8a;
  --gold: #ffed4a;
  --section: #375a7f;
  --section-sub: #5b7fa6;
  --input-bg: #fff2cc;
  --input-ink: #0000cc;
  --blue: #2e75b6;
  --blue-sum: #d6eaf8;
  --green: #2e7d6f;
  --green-sum: #d5f5e3;
  --total-bg: #fdecea;
  --total-ink: #c00000;
  --note: #555555;
  --note-bg: #f4f6f8;
  --line: #d7dee8;
  --page: #eef2f6;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #5c6773;
  --header: #f7f9fc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 36, 64, 0.06), 0 8px 24px rgba(16, 36, 64, 0.06);
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--page);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--header);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--navy);
}
.brand span { font-weight: 500; color: var(--muted); margin-left: 8px; }
.badge {
  font-size: 12px;
  color: var(--muted);
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}

.wrap {
  width: min(1120px, calc(100% - 24px));
  margin: 16px auto 32px;
  flex: 1;
}

.sheet {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid #e3e9f0;
}

.title {
  background: var(--navy);
  color: var(--gold);
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 16px 16px 14px;
  margin: 0;
}

.note {
  background: var(--note-bg);
  color: var(--note);
  font-size: 13px;
  padding: 8px 16px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}

.toolbar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  padding: 10px 16px 0;
}
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.btn:hover { background: #f3f7fb; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn.primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn.primary:hover { background: #163f6e; }

.block { padding: 12px 16px 16px; }
.block + .block { padding-top: 0; }

.section-h {
  background: var(--section);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 7px 12px;
  margin: 0;
  border-radius: 6px 6px 0 0;
}
.section-h.blue { background: var(--blue); }
.section-h.green { background: var(--green); }

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.seg button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.seg button[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 14px;
  margin: 10px 0 4px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field label {
  font-size: 12px;
  color: var(--muted);
}
.field input,
.field select {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--input-ink);
  background: var(--input-bg);
  border: 1px solid #e0d4a0;
  border-radius: 6px;
  padding: 7px 8px;
  min-height: 36px;
}
.field input:focus,
.field select:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 4px 0;
  min-height: 36px;
}
.check input { width: 16px; height: 16px; accent-color: var(--navy); }

.hint {
  font-size: 13px;
  color: var(--note);
  margin: 8px 0 0;
}
.compare {
  background: var(--blue-sum);
  color: #163f6e;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 10px 0 0;
}
.compare[hidden],
#varyFields[hidden],
#bonusFields[hidden],
#itemsFields[hidden],
#totalFields[hidden],
#cumTableWrap[hidden],
#monthTableWrap[hidden] { display: none; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}
.metric {
  background: var(--note-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.metric .v {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.01em;
}
.metric.tax .v { color: var(--total-ink); }
.metric .k {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.metric .d {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.chart-card {
  margin: 6px 0 14px;
  padding: 20px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.chart {
  display: flex;
  align-items: stretch;
  gap: 4px;
  height: 240px;
  width: 100%;
}
.bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: default;
  outline: none;
}
.bar-plot {
  position: relative;
  flex: 1;
  width: 100%;
}
.bar {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #8ec4ff;
  transition: background 0.15s ease, height 0.2s ease;
}
.bar.is-zero {
  height: 0 !important;
  background: transparent;
}
.bar-col:hover .bar,
.bar-col:focus-visible .bar,
.bar-col.is-active .bar {
  background: #2f7de1;
}
.bar-val {
  position: absolute;
  left: -20%;
  right: -20%;
  text-align: center;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #9aa3af;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(-100%);
  margin-top: -4px;
  bottom: 0;
}
.bar-col:hover .bar-val,
.bar-col:focus-visible .bar-val,
.bar-col.is-active .bar-val {
  color: #1a1a1a;
  font-weight: 650;
}
.bar-label {
  flex: none;
  margin-top: 8px;
  font-size: 12px;
  color: #9aa3af;
  line-height: 1.2;
}
.bar-col:hover .bar-label,
.bar-col:focus-visible .bar-label,
.bar-col.is-active .bar-label {
  color: #375a7f;
  font-weight: 650;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 760px;
}
.data-table th,
.data-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th {
  background: var(--section-sub);
  color: #fff;
  font-weight: 650;
  text-align: center;
  position: sticky;
  top: 0;
}
.data-table td { text-align: right; }
.data-table td:first-child,
.data-table th:first-child { text-align: left; }
.data-table tbody tr:nth-child(even) { background: #f8fafc; }
.data-table tbody tr:hover { background: #eef6fc; }
.data-table .rate-col { text-align: center; }
.rules-table { min-width: 0; }
.rules-table td:nth-child(2) { text-align: left; }

.rules {
  font-size: 13px;
  color: var(--note);
}
.rules p { margin: 8px 0; }
.rules ol { margin: 6px 0 10px; padding-left: 22px; }
.rules li { margin: 4px 0; }

.foot {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 8px 16px 18px;
}

@media (max-width: 800px) {
  .fields, .metrics { grid-template-columns: 1fr 1fr; }
  .title { font-size: 18px; }
}
@media (max-width: 520px) {
  .fields, .metrics { grid-template-columns: 1fr; }
  .metric .v { font-size: 18px; }
  .chart { height: 200px; gap: 2px; }
  .bar-val { font-size: 9px; }
  .bar-col:not(:hover):not(:focus-visible):not(.is-active) .bar-val { opacity: 0; }
  .bar-label { font-size: 11px; }
}

@media print {
  body { background: #fff; }
  .topbar, .toolbar, .badge { display: none; }
  .sheet { box-shadow: none; border: none; }
  .wrap { width: 100%; margin: 0; }
  .chart-card { break-inside: avoid; }
  .bar-col:not(.is-active) .bar-val { opacity: 1 !important; color: #555; }
}
