:root {
  --red: #ef3135;
  --ink: #333333;
  --muted: #8b9190;
  --line: #ececec;
  --bg: #f6f7fb;
  --white: #fff;
  --blue: #3b82f6;
  --warn: #8a5a12;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --header: 124px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-weight: 700; line-height: 1.35; margin: 0; }
p { margin: 0; }
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.site { position: sticky; top: 0; z-index: 30; background: #fff; }
.brand-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 78px;
  border-bottom: 1px solid #f2f2f2;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; color: inherit; }
.logo { height: 46px; width: auto; max-width: none; flex: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name strong { font-size: 20px; letter-spacing: 0.12em; font-weight: 700; }
.brand small { color: #888; font-size: 12px; letter-spacing: 0.18em; }
.slogan {
  margin: 0;
  padding-left: 18px;
  border-left: 1px solid #e6e6e6;
  color: #9aa0a0;
  font-size: 16px;
}
.nav-btn, .nav-toggle { display: none; }
.nav-inner { display: flex; align-items: center; min-height: 52px; gap: 4px; }
.nav-inner a, .nav-book {
  text-decoration: none;
  color: var(--ink);
  padding: 0 14px;
  line-height: 52px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 15px;
}
.nav-inner a[aria-current="page"],
.nav-inner a:hover,
.nav-book:hover { color: var(--red); }
.nav-phone { margin-left: auto; color: var(--red) !important; font-weight: 700; white-space: nowrap; }
.nav-book {
  margin-left: 8px;
  line-height: 34px;
  padding: 0 16px;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 4px;
}

.banner {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(100deg, #2f6fe6 0%, #4b93ff 58%, #6aa8ff 100%);
  padding: 78px 0 72px;
}
.banner::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -120px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}
.banner-inner { position: relative; z-index: 1; max-width: 760px; }
.banner h1 { font-size: clamp(32px, 4vw, 46px); max-width: 12em; }
.banner p { margin-top: 14px; font-size: 18px; color: rgba(255, 255, 255, 0.9); }
.banner-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn, .btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 22px;
  border-radius: 4px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 700;
}
.btn:hover { background: #d8272b; border-color: #d8272b; color: #fff; }
.btn.secondary, .btn-line { background: #fff; color: var(--red); }
.btn.secondary:hover, .btn-line:hover { background: var(--red); color: #fff; }
.banner .btn { background: #fff; color: var(--red); border-color: #fff; }
.banner .btn:hover { background: #fff5f5; }
.banner .btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.85); }
.banner .btn.ghost:hover { background: #fff; color: var(--red); }

.section { padding: 64px 0; }
.sec-title { text-align: center; margin-bottom: 32px; }
.sec-title h2 { font-size: 30px; }
.sec-title p { margin-top: 8px; color: var(--muted); }
.cards { display: grid; gap: 18px; }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.svc, .tool-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(31, 45, 61, 0.06);
  padding: 32px 22px 24px;
}
.tool-card { text-decoration: none; color: inherit; }
.tool-card:hover { transform: translateY(-3px); }
.ico {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f2f4f6;
  color: #9aa3ab;
}
.ico svg { width: 30px; height: 30px; }
.svc h3, .tool-card strong { margin: 16px 0 6px; font-size: 18px; }
.sub, .tool-card p { color: #a0a6a6; font-size: 13px; }
.dash { display: block; width: 28px; height: 3px; margin: 14px auto; background: var(--red); border-radius: 2px; }
.ticks { list-style: none; margin: 0 0 18px; padding: 0; align-self: stretch; text-align: left; }
.ticks li { position: relative; margin: 8px 0; padding-left: 22px; color: #555; font-size: 14px; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--red); font-weight: 700; }
.svc .btn-line, .tool-card .more { margin-top: auto; }
.tool-card .more { color: var(--red); font-weight: 700; }

.band { background: #fff; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; list-style: none; margin: 0; padding: 0; }
.steps li { text-align: center; min-width: 0; }
.steps span {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 2px solid var(--red);
  color: var(--red);
  font-weight: 700;
  background: #fff;
}
.steps strong { display: block; margin-bottom: 6px; }
.steps p { color: var(--muted); font-size: 14px; }

.contact { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: center; max-width: 760px; margin: 0 auto; }
.contact .phone { display: inline-block; margin: 8px 0; font-size: clamp(28px, 4vw, 40px); font-weight: 700; text-decoration: none; color: var(--red); line-height: 1.2; }
.qr { width: 180px; height: auto; object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 8px; }
.hint { color: var(--muted); font-size: 14px; }

.site-footer { background: #fff; color: #777; border-top: 1px solid var(--line); padding: 28px 0 32px; font-size: 14px; }
.foot { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.foot strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.foot a { color: var(--red); text-decoration: none; font-weight: 700; }
.foot-note { margin-top: 14px; color: #999; }
.beian { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; font-size: 13px; }
.beian a { color: #777; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.beian a:hover { color: var(--red); }
.beian img { width: 20px; height: 20px; }

.dock { display: none; }

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px 12px; }
.modal[hidden] { display: none !important; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  padding: 16px 16px 12px;
}
.modal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.modal-bar h2 { font-size: 20px; }
.modal-close {
  border: 0;
  background: transparent;
  color: #666;
  cursor: pointer;
  min-height: 36px;
  padding: 0 8px;
}
.lead-mount iframe { width: 100% !important; max-width: 100%; border: 0; display: block; }
body.modal-open { overflow: hidden; }

.page-head { background: transparent; color: var(--ink); padding: 28px 0 4px; }
.page-head h1 { font-size: clamp(26px, 4vw, 32px); color: var(--ink); }
.page-head h1::after { content: ""; display: block; width: 36px; height: 3px; margin-top: 10px; background: var(--red); }
.page-head p { max-width: 46em; margin-top: 10px; color: var(--muted); }
main.wrap { padding: 8px 0 64px; }
.tool-nav { display: flex; gap: 8px; overflow-x: auto; padding: 16px 0 8px; }
.tool-nav a {
  flex: none;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.tool-nav a[aria-current="page"] { background: var(--red); border-color: var(--red); color: #fff; }

.calculator { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.cats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: calc(var(--header) + 12px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.cats button, .switch button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 4px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--muted);
  min-height: 40px;
}
.cats button[aria-pressed="true"] { background: var(--red); color: #fff; }
.switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.switch button { border: 1px solid var(--line); background: #fff; }
.switch button[aria-pressed="true"] { background: var(--red); color: #fff; border-color: var(--red); }
.panel { display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.panel.active { display: block; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fields > * { min-width: 0; }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #e1e4e8;
  border-radius: 4px;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid #f3b4b6; border-color: var(--red); }
.check { display: flex; align-items: flex-start; gap: 8px; min-height: 44px; }
.check input { width: auto; min-height: 0; margin-top: 3px; }
.check span { min-width: 0; }
fieldset { margin: 16px 0 0; padding: 12px 14px 16px; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1 1 140px; }
.dir-forward .only-reverse,
.dir-reverse .only-forward,
.person-resident .only-nonresident,
.person-nonresident .only-resident,
[hidden] { display: none !important; }
.resident-toggle { display: flex; }
.message { margin-top: 14px; color: var(--red); }
.panel > .hint { margin-bottom: 14px; }
.result {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: 8px;
  padding: 16px 18px 8px;
  overflow-x: auto;
  max-width: 100%;
}
.result h2, .result h3 { font-size: 20px; margin-bottom: 12px; }
.result dl, .pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 18px; margin: 0 0 12px; }
.result dt { color: var(--muted); }
.result dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.result dd strong { font-size: 18px; }
.notes { margin: 0 0 12px; padding-left: 18px; color: var(--warn); }
.notes.plain { color: var(--muted); }
table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; }
#wage-varied { overflow-x: auto; }
.month-table { min-width: 640px; }
.month-table input { min-height: 36px; text-align: right; }
.solutions { margin-bottom: 12px; }
.solutions button {
  margin: 0 8px 8px 0;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.stack { display: grid; gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 20px; min-width: 0; }
.card h2 { font-size: 24px; margin-bottom: 8px; }
.card > .hint { margin: 8px 0 14px; }

@media (max-width: 1024px) {
  .cards.four, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .slogan { display: none; }
  .logo { height: 40px; }
  .brand-name strong { font-size: 18px; }
  .nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
  }
  .nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; }
  .main-nav { display: none; border-top: 1px solid var(--line); }
  .nav-toggle:checked ~ .main-nav { display: block; }
  .nav-inner { flex-direction: column; align-items: stretch; padding: 8px 0 12px; min-height: 0; }
  .nav-inner a, .nav-book { line-height: 44px; text-align: left; }
  .nav-phone, .nav-book { margin-left: 0; }
  .calculator { grid-template-columns: minmax(0, 1fr); }
  .cats { position: static; flex-direction: row; overflow-x: auto; }
  .cats button { white-space: nowrap; }
  :root { --header: 78px; }
}

@media (max-width: 720px) {
  .wrap { width: min(1180px, calc(100% - 28px)); }
  .banner { padding: 42px 0 36px; }
  .banner h1 { font-size: 28px; }
  .banner p { font-size: 16px; }
  .section { padding: 40px 0; }
  .sec-title h2 { font-size: 24px; }
  .cards.four, .cards.three, .steps, .fields, .contact { grid-template-columns: minmax(0, 1fr); }
  .wide { grid-column: auto; }
  .foot { flex-direction: column; }
  body.home { padding-bottom: calc(52px + env(safe-area-inset-bottom)); }
  .dock {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: #fff;
    box-shadow: 0 -1px 0 var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dock a, .dock button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border: 0;
    background: #fff;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
  }
  .dock a { background: var(--red); color: #fff; }
}
