/* ============================================================
 * 社保补缴测算器 · 样式
 * 设计取向：移动优先、政务可信感、数字突出
 * ============================================================ */

:root {
  /* 公伟可标准色系 v1.0 · 墨绿 */
  --brand: #1F3A31;
  --brand-2: #2E6B4F;
  --brand-soft: #E6EFE7;
  --gold: #B33A2C;
  --gold-soft: #F5EFE3;
  --ink: #2E261E;
  --ink-2: #6B6152;
  --ink-3: #8A8073;
  --line: #DFD5C1;
  --line-2: #EFE8D9;
  --bg: #EDE4D0;
  --white: #FAF7F0;
  --ok: #2E6B4F;
  --ok-soft: #E6EFE7;
  --warn: #A8542F;
  --warn-soft: #F5E9DC;
  --danger: #B33A2C;
  --danger-soft: #F7E7E4;
  --r: 14px;
  --shadow: 0 1px 2px rgba(46, 38, 30, .05), 0 8px 24px rgba(46, 38, 30, .07);
  --shadow-lg: 0 12px 40px rgba(46, 38, 30, .16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  padding-bottom: 40px;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 14px; }

/* ---------------- 顶部 ---------------- */
.hdr {
  background: linear-gradient(135deg, #162B24 0%, #1F3A31 45%, #2A4A3F 100%);
  color: #F6F1E7;
  padding: 26px 0 30px;
  position: relative;
  overflow: hidden;
}
.hdr::after {
  content: "";
  position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(184, 134, 47, .28), transparent 68%);
}
.hdr .wrap { position: relative; z-index: 1; }
.hdr__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hdr__brand { flex: 1; min-width: 0; }
/* 右上角律师头像：建立信任 */
.hdr__me { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.hdr__meta { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.hdr__meta b { font-size: 13.5px; font-weight: 700; color: #FAF7F0; }
.hdr__meta span { font-size: 11px; color: rgba(246, 241, 231, .62); }
.hdr__avatar {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(246, 241, 231, .92);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .28);
  background: #1F3A31; flex: 0 0 auto;
}
@media (max-width: 360px) { .hdr__meta { display: none; } }
.hdr__title { font-size: 21px; font-weight: 700; letter-spacing: .5px; margin: 0 0 6px; }
.hdr__sub { font-size: 12.5px; color: rgba(246, 241, 231, .72); margin: 0; }
.hdr__badge {
  display: inline-block; margin-top: 12px; padding: 3px 10px; border-radius: 20px;
  background: rgba(246, 241, 231, .12); border: 1px solid rgba(246, 241, 231, .2);
  font-size: 11.5px; color: rgba(246, 241, 231, .85);
}
.hdr__link {
  flex: 0 0 auto; color: rgba(246, 241, 231, .78); font-size: 12px; text-decoration: none;
  border: 1px solid rgba(246, 241, 231, .26); padding: 5px 11px; border-radius: 20px;
  white-space: nowrap;
}
.hdr__link:hover { color: #FAF7F0; border-color: rgba(246, 241, 231, .5); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--white);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 16px 18px;
  margin-top: 14px;
  border: 1px solid rgba(226, 232, 240, .8);
}
.card__hd { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.card__no {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold-soft); color: var(--gold);
  font-size: 12px; font-weight: 700; display: grid; place-items: center;
  border: 1px solid rgba(184, 134, 47, .25);
}
.card__title { font-size: 15.5px; font-weight: 650; margin: 0; color: var(--ink); }
.card__tip { font-size: 12.5px; color: var(--ink-3); margin-left: auto; }

/* ---------------- 表单 ---------------- */
.grid { display: grid; gap: 12px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--3 { grid-template-columns: 1fr 1fr 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }

input[type="text"], input[type="number"], input[type="month"], input[type="date"], select {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #FAF7F0; color: var(--ink); font-size: 15px;
  font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%238a99ab' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 32px;
}
input:focus, select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(30, 90, 168, .12); }
input:disabled { background: #F5EFE3; color: var(--ink-3); }
input[type="month"] { padding-right: 8px; }

.hint { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* 分段选择 */
.seg {
  display: flex; background: var(--line-2); border-radius: 12px; padding: 4px; gap: 4px;
}
.seg button {
  flex: 1; border: 0; background: transparent; padding: 12px 6px; border-radius: 9px;
  font-size: 14.5px; color: var(--ink-3); font-family: inherit; cursor: pointer;
  transition: all .18s; white-space: nowrap; font-weight: 600; letter-spacing: .5px;
}
.seg button[aria-pressed="true"] {
  background: var(--brand); color: #F6F1E7; font-weight: 700;
  box-shadow: 0 3px 10px rgba(31, 58, 49, .30);
}

/* 复选组 */
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; cursor: pointer;
  background: #FAF7F0; user-select: none; color: var(--ink-2);
}
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand-2); }
.check:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); color: var(--brand); font-weight: 500; }
/* 不支持 :has 的旧内核，由 JS 加 .is-on 兜底 */
.check.is-on { border-color: var(--brand-2); background: var(--brand-soft); color: var(--brand); font-weight: 500; }

/* 不带边框的开关样式 */
.check-plain {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.check-plain input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand-2); }

/* 开关行 */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 1px dashed var(--line);
}
.switch-row:first-of-type { border-top: 0; }
.switch-row__label { font-size: 13.5px; color: var(--ink-2); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: #FAF7F0; color: var(--ink); font-size: 14.5px; font-family: inherit;
  font-weight: 500; cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.btn:hover { border-color: var(--ink-3); }
.btn--primary {
  background: linear-gradient(135deg, #1F3A31, #2E6B4F); color: #FAF7F0; border-color: transparent;
  box-shadow: 0 4px 14px rgba(30, 90, 168, .25);
}
.btn--primary:hover { filter: brightness(1.06); }
.btn--gold { background: linear-gradient(135deg, #9C3327, #9C3327); color: #FAF7F0; border-color: transparent; }
.btn--block { width: 100%; }
.btn--sm { height: 36px; padding: 0 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.actions .btn { flex: 1; min-width: 130px; }

/* ---------------- 结果 ---------------- */
#result { display: none; }
#result.on { display: block; animation: rise .28s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.summary {
  background: linear-gradient(135deg, #162B24, #162B24);
  color: #FAF7F0; border-radius: var(--r); padding: 18px; margin-top: 14px;
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.summary::after {
  content: ""; position: absolute; right: -40px; bottom: -70px; width: 180px; height: 180px;
  border-radius: 50%; background: radial-gradient(circle, rgba(246, 241, 231, .08), transparent 70%);
}
.summary__label { font-size: 12.5px; color: rgba(246, 241, 231, .68); }
.summary__big {
  font-size: 34px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}
.summary__big small { font-size: 15px; font-weight: 500; opacity: .7; margin-left: 4px; }
.summary__meta { font-size: 12.5px; color: rgba(246, 241, 231, .62); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.kpi {
  background: #FAF7F0; border-radius: 12px; padding: 13px 14px;
  border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
}
.kpi__label { font-size: 12px; color: var(--ink-3); }
.kpi__value {
  font-size: 20px; font-weight: 700; margin-top: 3px; letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
}
.kpi__sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kpi--ee { border-left-color: #B33A2C; }
.kpi--ee .kpi__value { color: #B33A2C; }
.kpi--er { border-left-color: #2E6B4F; }
.kpi--er .kpi__value { color: #2E6B4F; }
.kpi--late { border-left-color: var(--gold); }
.kpi--late .kpi__value { color: var(--gold); }
.kpi--total { border-left-color: var(--ok); }
.kpi--total .kpi__value { color: var(--ok); }

/* 提示条 */
.notice {
  display: flex; gap: 8px; padding: 11px 13px; border-radius: 10px; font-size: 12.8px;
  line-height: 1.6; margin-top: 10px;
}
.notice__icon { flex: 0 0 auto; font-weight: 700; }
.notice--warn { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(163, 90, 6, .16); }
.notice--info { background: var(--brand-soft); color: var(--brand); border: 1px solid rgba(30, 90, 168, .14); }
.notice--danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(179, 38, 30, .16); }

/* 表格 */
.tbl-wrap { overflow-x: auto; margin-top: 4px; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 420px; }
table.tbl th, table.tbl td { padding: 8px 8px; text-align: right; border-bottom: 1px solid var(--line-2); }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
table.tbl thead th {
  font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  background: #F5EFE3; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td { font-variant-numeric: tabular-nums; color: var(--ink-2); }
table.tbl td.strong { color: var(--ink); font-weight: 600; }
table.tbl tfoot td {
  font-weight: 700; color: var(--ink); background: #F5EFE3; border-top: 1px solid var(--line);
}
.num-ee { color: #B33A2C; }
.num-er { color: #2E6B4F; }

details.more { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
details.more summary {
  cursor: pointer; font-size: 13px; color: var(--brand); font-weight: 500;
  list-style: none; display: flex; align-items: center; gap: 5px;
}
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "▸"; font-size: 10px; transition: transform .15s; }
details.more[open] summary::before { transform: rotate(90deg); }

/* ---------- 付费墙 ---------- */
.locked { font-size: 15px; font-weight: 600; color: var(--ink-3); letter-spacing: 1px; }
.kpi--lock { background: #F7F2E8; cursor: pointer; transition: all .15s; }
.kpi--lock:hover { border-color: var(--gold); box-shadow: 0 4px 14px rgba(184, 134, 47, .12); }
.kpi--lock:active { transform: scale(.985); }
.kpi--lock .kpi__value { color: var(--ink-3); }
.payhint {
  text-align: center; font-size: 12.5px; color: var(--gold);
  margin: 10px 0 0; line-height: 1.7;
}
/* 单位版头条：数字锁住，但整块可点 */
.summary__big.paygate { cursor: pointer; }
.summary__big.paygate .locked { font-size: 20px; letter-spacing: 0; }
.summary__big.paygate:active { opacity: .72; }
.lockbox {
  margin-top: 12px; background: #FAF7F0; border: 1.5px solid var(--gold);
  border-radius: 14px; padding: 16px;
  box-shadow: 0 6px 22px rgba(184, 134, 47, .13);
}
.lockbox__t { font-weight: 700; font-size: 15.5px; color: var(--gold); margin-bottom: 8px; }
.lockbox__list {
  margin: 0 0 14px; padding-left: 18px; font-size: 13.5px;
  color: var(--ink-2); line-height: 1.95;
}
.lockbox__list li { margin-bottom: 2px; }

/* ---------------- AI 问答 ---------------- */
.ai-log { display: flex; flex-direction: column; gap: 9px; max-height: 320px; overflow-y: auto; }
.ai-log:not(:empty) { margin-bottom: 12px; }
.ai-msg { max-width: 88%; padding: 9px 12px; border-radius: 11px; font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.ai-msg--me { align-self: flex-end; background: var(--brand); color: #FAF7F0; border-bottom-right-radius: 3px; }
.ai-msg--ai { align-self: flex-start; background: #EDE4D0; border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.ai-msg--sys { align-self: center; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; max-width: 100%; }

/* 额度用尽后的交人卡片 */
.ai-handoff {
  align-self: stretch; background: #FAF7F0; border: 1.5px solid var(--gold);
  border-radius: 12px; padding: 16px; text-align: center;
  box-shadow: 0 6px 20px rgba(184, 134, 47, .13);
}
.ai-handoff__t { font-weight: 700; font-size: 15px; color: var(--gold); }
.handoff-avatar {
  display: block; width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  margin: 0 auto 9px; border: 2px solid #FAF7F0; box-shadow: 0 3px 12px rgba(15, 30, 50, .18);
}
.ai-handoff__s { font-size: 12.5px; color: var(--ink-3); margin: 4px 0 10px; }
.ai-handoff__phone {
  display: inline-block; font-size: 25px; font-weight: 700; color: var(--brand-2);
  text-decoration: none; letter-spacing: .5px;
}
.ai-handoff__qr { margin-top: 12px; }
.ai-handoff__qr img {
  width: 140px; height: 140px; object-fit: contain; background: #FAF7F0;
  border: 1px solid var(--line); border-radius: 10px; display: block;
  margin: 0 auto 6px; -webkit-touch-callout: default;
}
textarea#aiQ {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: 15px/1.6 inherit; color: var(--ink); outline: none; resize: vertical; min-height: 60px;
}
textarea#aiQ:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(30, 90, 168, .12); }

/* 联系卡里的微信二维码 */
/* 联系卡上的律师头像 */
.contact-me { display: flex; align-items: center; gap: 13px; }
.contact-avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid #FAF7F0; box-shadow: 0 3px 12px rgba(15, 30, 50, .16);
  background: var(--brand-2); flex: 0 0 auto;
}
.contact-me__body { min-width: 0; }

.contact-qr {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line);
  text-align: center;
}
.contact-qr img {
  width: 150px; height: 150px; object-fit: contain; background: #FAF7F0;
  border: 1px solid var(--line); border-radius: 10px; display: block; margin: 0 auto 6px;
  -webkit-touch-callout: default;
  pointer-events: auto;
}

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(10, 20, 35, .55);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 18px;
  backdrop-filter: blur(2px);
}
.modal-mask.on { display: flex; }
.modal {
  background: #FAF7F0; border-radius: 16px; padding: 22px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-2); line-height: 1.65; }
.modal .actions { margin-top: 4px; }

/* 收款码 */
.pay-row { display: flex; gap: 14px; align-items: flex-start; }
.pay-qr { flex: 0 0 auto; width: 160px; text-align: center; }
.pay-qr a { display: block; }
.pay-qr img {
  width: 160px; height: 160px; object-fit: contain; background: #FAF7F0;
  border: 1px solid var(--line); border-radius: 10px; display: block;
  margin: 0 auto;
  -webkit-touch-callout: default;   /* 允许长按弹出识别二维码菜单 */
  -webkit-user-select: auto;
  user-select: auto;
  pointer-events: auto;
}
.pay-info { flex: 1; min-width: 0; }
.pay-price { font-size: 26px; font-weight: 700; color: var(--gold); line-height: 1.2; }
.pay-no {
  font-family: ui-monospace, Consolas, monospace; font-size: 16px; font-weight: 700;
  letter-spacing: .5px; color: var(--brand); margin: 3px 0 10px; word-break: break-all;
}
@media (max-width: 380px) {
  .pay-row { flex-direction: column; align-items: center; }
  .pay-info { width: 100%; text-align: center; }
}

/* 提示气泡 */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: rgba(46, 38, 30, .92); color: #FAF7F0; padding: 10px 18px; border-radius: 22px;
  font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200;
  max-width: 86vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 页脚 ---------------- */
.foot {
  margin-top: 22px; padding: 16px; font-size: 11.5px; color: var(--ink-3); line-height: 1.7;
  text-align: center;
}
.foot strong { color: var(--ink-2); }

/* ---------------- 报告（打印态） ---------------- */
#report { display: none; }

@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #FAF7F0; padding: 0; font-size: 10.5pt; color: #2E261E; }
  .hdr, .no-print, .actions, .modal-mask, .toast, #result, .foot { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  #report { display: block !important; }
  .report h1 { font-size: 17pt; text-align: center; margin: 0 0 2mm; letter-spacing: 2px; }
  .report .rp-sub { text-align: center; font-size: 9pt; color: #6B6152; margin-bottom: 6mm; }
  .report h2 {
    font-size: 11.5pt; margin: 6mm 0 2mm; padding-left: 6px; border-left: 3px solid #1F3A31;
  }
  .report table { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-bottom: 2mm; }
  .report th, .report td { border: 1px solid #8A8073; padding: 3px 6px; }
  .report th { background: #EFE8D9; font-weight: 600; text-align: center; }
  .report td { text-align: right; }
  .report td:first-child { text-align: left; }
  .report .rp-note { font-size: 8.8pt; color: #2E261E; line-height: 1.7; }
  .report .rp-sign { margin-top: 10mm; display: flex; justify-content: space-between; font-size: 9.5pt; }
  .report .rp-foot { margin-top: 6mm; padding-top: 3mm; border-top: 1px solid #C9B99B; font-size: 8.5pt; color: #6B6152; }
}

/* ---------------- 小屏适配 ---------------- */
@media (max-width: 420px) {
  .grid--3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .summary__big { font-size: 29px; }
  .hdr__title { font-size: 19px; }
}

@media (max-width: 360px) {
  .kpis { grid-template-columns: 1fr; }
  .grid--2 { grid-template-columns: 1fr; }
}


/* 身份切换：选中态再强化 */
.seg button[aria-pressed="true"]:active { transform: scale(.985); }
.seg button:not([aria-pressed="true"]):hover { background: rgba(31, 58, 49, .07); color: var(--ink); }
