/* ===== 집계산기 공통 스타일 ===== */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-card: #ffffff;
  --text: #1a1d21;
  --text-soft: #5b6470;
  --line: #e3e6ea;
  --accent: #1558d6;
  --accent-soft: #eaf1fe;
  --ok: #0a7d47;
  --ok-soft: #e7f6ee;
  --warn: #b3261e;
  --warn-soft: #fdecea;
  --radius: 10px;
  --wrap: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --bg-soft: #1b1f23;
    --bg-card: #1b1f23;
    --text: #e8eaed;
    --text-soft: #a2abb5;
    --line: #2c3238;
    --accent: #7aa7ff;
    --accent-soft: #1d2942;
    --ok: #5fd39b;
    --ok-soft: #17301f;
    --warn: #ff8a80;
    --warn-soft: #34201e;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }

/* ---- 헤더 ---- */
.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 14px;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }

/* ---- 본문 ---- */
main { padding: 28px 0 56px; }

h1 {
  font-size: 27px;
  line-height: 1.35;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
}
h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin: 40px 0 12px;
  padding-top: 4px;
}
h3 { font-size: 17px; margin: 26px 0 8px; }

p { margin: 0 0 14px; }
a { color: var(--accent); }

.lead { color: var(--text-soft); font-size: 16px; margin-bottom: 22px; }
.muted { color: var(--text-soft); font-size: 14px; }

ul, ol { padding-left: 20px; margin: 0 0 16px; }
li { margin-bottom: 6px; }

hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

/* ---- 계산기 ---- */
.calc {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 22px 0;
}
.calc h2 { margin-top: 0; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 5px;
}
.field .hint {
  display: block;
  font-size: 12.5px;
  color: var(--text-soft);
  font-weight: 400;
  margin-top: 2px;
}
.field input[type="number"],
.field select {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  appearance: none;
}
.field input[type="number"]:focus,
.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
    linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

.check { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.check input { width: 18px; height: 18px; margin-top: 3px; flex: none; }
.check label { font-size: 14px; font-weight: 600; }
.check label .hint { display: block; margin-top: 2px; }

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  font-weight: 500;
  font-size: 14px;
  padding: 10px;
  margin-top: 8px;
}

/* ---- 결과 ---- */
.result { margin-top: 20px; }
.result[hidden] { display: none; }

.verdict {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.verdict .big { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.verdict .sub { font-size: 14.5px; margin-top: 4px; }
.verdict.is-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.verdict.is-no { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.verdict.is-info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.verdict .sub { color: var(--text); opacity: .85; }

table.rows {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  margin-bottom: 16px;
}
table.rows th, table.rows td {
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.rows th { font-weight: 500; color: var(--text-soft); }
table.rows td {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  width: 1%;
  padding-left: 10px;
}
table.rows tr.total th, table.rows tr.total td {
  border-top: 2px solid var(--line);
  border-bottom: 0;
  font-size: 16px;
  padding-top: 12px;
}
table.rows tr.total th { color: var(--text); font-weight: 700; }
table.rows .note { display: block; font-size: 12.5px; color: var(--text-soft); font-weight: 400; }

.tablewrap { overflow-x: auto; }

/* 글 본문 안의 표 (열이 여러 개일 수 있음) */
table.data {
  width: 100%;
  min-width: 300px;
  border-collapse: collapse;
  font-size: 14.5px;
  margin-bottom: 18px;
}
table.data th, table.data td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  width: auto;
}
/* 값 칸은 줄바꿈 금지 — 금액이 중간에서 잘리지 않게. 넘치면 표가 가로 스크롤됩니다 */
table.data td { white-space: nowrap; }
/* 첫 칸(항목명)은 길 수 있으므로 줄바꿈 허용 */
table.data tr:not(:first-child) th { white-space: normal; }
table.data tr:first-child th {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-soft);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
table.data th:first-child, table.data td:first-child {
  text-align: left;
  padding-left: 0;
}
table.data td:last-child, table.data th:last-child { padding-right: 0; }
table.data tr:last-child th, table.data tr:last-child td { border-bottom: 0; }

/* ---- 박스 ---- */
.box {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 14.5px;
}
.box strong { display: block; margin-bottom: 4px; }
/* 글 본문에서 만들어진 인용 상자는 굵은 글씨를 문장 안에 그대로 둡니다 */
.box.quote strong { display: inline; margin-bottom: 0; }
.box.warn { border-left-color: var(--warn); }

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  margin-bottom: 8px;
  background: var(--bg-card);
}
details[open] { padding-bottom: 6px; }
summary {
  cursor: pointer;
  padding: 13px 0;
  font-weight: 600;
  font-size: 15px;
  list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: " +"; color: var(--text-soft); float: right; }
details[open] summary::after { content: " −"; }
details p:last-child { margin-bottom: 10px; }

/* ---- 카드 링크 ---- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr; } }
.card {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-card);
}
.card:hover { border-color: var(--accent); }
.card b { display: block; font-size: 16px; margin-bottom: 4px; }
.card span { font-size: 13.5px; color: var(--text-soft); }

/* ---- 폼 (문의) ---- */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.form-field input[type="text"],
.form-field input[type="email"],
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.form-field textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
.hp { position: absolute; left: -9999px; }

/* ---- 푸터 ---- */
.site-foot {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 26px 0 40px;
  font-size: 13.5px;
  color: var(--text-soft);
}
.site-foot nav { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.site-foot a { color: var(--text-soft); }
.site-foot p { margin: 0 0 6px; }

/* ---- 광고 자리 ---- */
.adslot {
  margin: 26px 0;
  min-height: 1px;
  text-align: center;
  overflow: hidden;
}

/* ---- 기타 ---- */
.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff; padding: 10px 16px; z-index: 50;
}
.skip:focus { left: 8px; top: 8px; }

.updated { font-size: 13px; color: var(--text-soft); margin-bottom: 20px; }
