/* ==========================================================================
   广东（珠海/中山）用工成本反推计算器 — 样式表
   浅色主题 · 无外部依赖
   ========================================================================== */

:root {
  --bg:          #f4f7fb;
  --card:        #ffffff;
  --border:      #e3e8ef;
  --border-soft: #eef2f7;

  --text:        #0f172a;
  --text-sub:    #475569;
  --muted:       #8b98ab;

  --primary:     #2563eb;
  --primary-dk:  #1d4ed8;
  --primary-lt:  #eff6ff;

  --seg-net:      #2563eb;  /* 员工到手 */
  --seg-personal: #7dd3fc;  /* 个人社保公积金 */
  --seg-tax:      #fbbf24;  /* 个人所得税 */
  --seg-employer: #8b5cf6;  /* 企业社保公积金 */
  --seg-other:    #94a3b8;  /* 其他 */

  --warn-bg:   #fff8e6;
  --warn-bd:   #f5c451;
  --warn-tx:   #8a5a00;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==================== 页头 ==================== */

.site-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  color: #fff;
  padding: 34px 0 38px;
  margin-bottom: 26px;
}

.site-header .wrap {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.header-main { max-width: 700px; }

.site-header h1 {
  margin: 0 0 10px;
  font-size: 27px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -.3px;
}

.header-sub {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.7;
  color: rgba(255, 255, 255, .85);
}

.header-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .22);
  white-space: nowrap;
}

.badge-line { color: rgba(255, 255, 255, .82); }
.badge-line.muted { color: rgba(255, 255, 255, .62); }
.header-badge strong { color: #fff; }

/* ==================== 栅格 ==================== */

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 372px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-bottom: 22px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 24px;
  margin-bottom: 22px;
}

.layout .card { margin-bottom: 0; height: 100%; }

.card-title {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.block-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: .2px;
}

/* ==================== 表单控件 ==================== */

.mode-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
}

.mode-btn {
  flex: 1;
  padding: 9px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
}

.mode-btn:hover { color: var(--primary); }

.mode-btn.active {
  background: var(--card);
  color: var(--primary-dk);
  box-shadow: var(--shadow-sm);
}

.field { margin-bottom: 20px; }

.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.field-primary label {
  font-size: 14px;
  color: var(--text);
}

.field-hint {
  margin: 7px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.field-indent {
  margin-top: 12px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}

input[type="number"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%238b98ab' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input-money {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.input-money:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input-money .money-prefix {
  padding-left: 13px;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}

.input-money input {
  border: 0;
  box-shadow: none;
  background: transparent;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text);
  padding-left: 6px;
  font-variant-numeric: tabular-nums;
}

.input-money input:focus { box-shadow: none; outline: none; }

.field-indent .input-money,
.field-indent input[type="number"] { max-width: 190px; }

.quick-row {
  display: flex;
  gap: 7px;
  margin-top: 11px;
  flex-wrap: wrap;
}

.quick-btn {
  flex: 1;
  min-width: 62px;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all .15s ease;
}

.quick-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-lt);
}

.switch-label {
  display: flex !important;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-sub);
  margin-bottom: 0 !important;
}

.switch-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

input[type="range"] {
  width: 100%;
  height: 5px;
  margin: 12px 0 2px;
  border-radius: 3px;
  background: #e2e8f0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, .4);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, .4);
  cursor: pointer;
}

.range-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* 高级设置 */

.advanced {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.advanced-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--text-sub);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .16s ease;
}

.advanced-toggle:hover { border-color: var(--primary); color: var(--primary); }

.advanced-toggle .chev {
  transition: transform .2s ease;
  font-size: 12px;
  color: var(--muted);
}

.advanced-toggle.open .chev { transform: rotate(180deg); }

.advanced-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease, margin-top .28s ease;
}

.advanced-panel.open {
  max-height: 700px;
  margin-top: 16px;
}

.advanced-panel .field:last-child { margin-bottom: 0; }

/* ==================== 结果区 ==================== */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.summary-item {
  padding: 15px 17px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-main {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
  border-color: #dbeafe;
  padding: 20px 22px;
}

.summary-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: .2px;
}

.summary-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-dk);
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.summary-value.sm {
  font-size: 23px;
  color: var(--text);
  letter-spacing: -.5px;
}

.summary-foot {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.summary-foot strong { color: var(--text-sub); }

/* 提示条 */

.alert {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.65;
  margin-bottom: 20px;
}

.alert-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-bd);
  border-left: 4px solid var(--warn-bd);
  color: var(--warn-tx);
}

/* 堆叠条 */

.bar-block { margin-bottom: 26px; }

.cost-bar {
  display: flex;
  height: 46px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f1f5f9;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .05);
}

.bar-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width .3s ease;
  position: relative;
  min-width: 0;
}

.bar-seg-label {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .22);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.seg-net      { background: var(--seg-net); }
.seg-personal { background: var(--seg-personal); }
.seg-personal .bar-seg-label { color: #0c4a6e; text-shadow: none; }
.seg-tax      { background: var(--seg-tax); }
.seg-tax .bar-seg-label { color: #713f12; text-shadow: none; }
.seg-employer { background: var(--seg-employer); }
.seg-other    { background: var(--seg-other); }

.cost-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px 20px;
}

.cost-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 5px 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.dot.seg-net      { background: var(--seg-net); }
.dot.seg-personal { background: var(--seg-personal); }
.dot.seg-tax      { background: var(--seg-tax); }
.dot.seg-employer { background: var(--seg-employer); }
.dot.seg-other    { background: var(--seg-other); }

.legend-name { color: var(--text-sub); }

.legend-val {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.legend-pct {
  width: 52px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}

/* 明细表 */

.table-block { margin-bottom: 26px; }
.table-block:last-of-type { margin-bottom: 18px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.detail-table,
.compliance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.detail-table thead th,
.compliance-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-sub);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.detail-table thead th:first-child { border-radius: 7px 0 0 0; }
.detail-table thead th:last-child  { border-radius: 0 7px 0 0; }

.detail-table td,
.compliance-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.detail-table tbody tr:hover { background: #fafcff; }

.col-item { color: var(--text); font-weight: 500; }

.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

.row-note {
  display: block;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
}

.row-subtotal td {
  background: #f8fafc;
  font-weight: 700;
  color: var(--text-sub);
}

.row-total td {
  background: var(--primary-lt);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--primary-dk);
  border-bottom: 0;
}

.detail-table tbody tr.row-total:hover { background: #e6efff; }

.muted { color: var(--muted); font-weight: 400; }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 26px 12px !important;
  font-size: 13.5px;
}

.empty-legend {
  color: var(--muted);
  font-size: 13px;
  justify-content: center;
}

/* 结果说明 */

.notes {
  padding: 15px 18px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.notes p {
  margin: 0 0 9px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-sub);
}

.notes p:last-child { margin-bottom: 0; }
.notes b { color: var(--text); }

/* ==================== 合规清单 ==================== */

.card-lead {
  margin: 0 0 20px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--text-sub);
}

.card-lead strong { color: var(--text); }

.compliance-table { margin-bottom: 24px; min-width: 760px; }

.compliance-table tbody tr:hover { background: #fafcff; }

.compliance-table td:first-child { font-size: 13.5px; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.tag-must {
  background: #fee2e2;
  color: #b91c1c;
}

.tag-law {
  background: #fef3c7;
  color: #92400e;
}

.text-emphasis { color: var(--primary-dk); font-weight: 600; }

.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.risk-box {
  padding: 17px 19px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcfe;
}

.risk-box-wide { background: #fbfcfe; }

.risk-box h3 {
  margin: 0 0 11px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.risk-box ul {
  margin: 0;
  padding-left: 19px;
}

.risk-box li {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.risk-box li:last-child { margin-bottom: 0; }

.risk-box strong { color: var(--text); }

.risk-p {
  margin: 0 0 9px;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-sub);
}

.risk-p:last-child { margin-bottom: 0; }
.risk-p.muted { font-size: 12.5px; }

/* ==================== 说明卡 ==================== */

.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px 40px;
}

.two-col h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.two-col h3:not(:first-child) { margin-top: 22px; }

.plain-list,
.source-list {
  margin: 0;
  padding-left: 19px;
}

.plain-list li,
.source-list li {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-sub);
  margin-bottom: 9px;
}

.source-list li { font-size: 13px; }
.source-list strong { color: var(--text); }
.source-list li br + * { color: var(--muted); }

code {
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  color: #be185d;
}

.disclaimer {
  margin: 20px 0 0;
  padding: 13px 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

/* ==================== 城市对比表 ==================== */

.compare-table { margin-bottom: 0; }

.compare-table th:nth-child(1),
.compare-table td:nth-child(1) { width: 25%; }

.compare-table th:nth-child(2),
.compare-table td:nth-child(2),
.compare-table th:nth-child(3),
.compare-table td:nth-child(3) { width: 21%; }

.col-num-l {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  line-height: 1.55;
}

.note-cell {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-sub);
  font-weight: 400;
}

.note-cell b { color: var(--primary-dk); font-weight: 600; }

.row-diff td { background: #fffcf0; }
.row-diff:hover td { background: #fff8e3 !important; }
.row-diff td:first-child { box-shadow: inset 3px 0 0 var(--seg-tax); }

.compare-note {
  margin-top: 18px;
  margin-bottom: 0;
  background: var(--primary-lt);
  border-color: #dbeafe;
}

.compare-note h3 { margin-bottom: 8px; }

#compare-impact {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-sub);
}

#compare-impact b {
  color: var(--primary-dk);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ==================== 页脚 ==================== */

.site-footer {
  padding: 26px 0 40px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ==================== 响应式 ==================== */

@media (max-width: 940px) {
  .layout { grid-template-columns: 1fr; }
  .layout .card { height: auto; }
  .site-header h1 { font-size: 23px; }
  .header-badge { align-items: flex-start; text-align: left; }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .wrap { padding: 0 14px; }
  .card { padding: 18px 16px 20px; border-radius: 12px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-value { font-size: 28px; }
  .summary-value.sm { font-size: 20px; }
  .cost-legend { grid-template-columns: 1fr; }
  .site-header { padding: 24px 0 26px; }
  .mode-btn { font-size: 12px; padding: 8px 4px; }
  .two-col { gap: 20px; }
}

/* 打印 */

@media print {
  body { background: #fff; }
  .input-card, .advanced, .quick-row, .site-footer { display: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .site-header { background: #fff; color: #000; }
  .header-sub, .badge-line { color: #444; }
  .header-badge { background: #fff; border-color: #ccc; }
}
