/* 관리비 고지서가 모티프다. 연한 녹색 바탕에 흰 명세서, 진녹색 글자와 항목선. */
:root {
  --ground: #e9f1ec;
  --surface: #ffffff;
  --raised: #f4f8f5;
  --tint: #d9ebe1;
  --border: #cfdcd4;
  --rule: #e4ece7;
  --control: #b7c7bd;
  --text: #16211c;
  --muted: #4c5a53;
  --accent: #0d6248;
  --accent-ink: #083f2f;
  --accent-hover: #0a4f3a;
  --minus: #0d6248;
  --warn-bg: #fdf3dc;
  --warn-ink: #6d4a07;
  --radius-card: 12px;
  --radius-control: 8px;
  --gap: 24px;
  --fs-title: 30px;
  --fs-section: 21px;
  --fs-total: 40px;
  --fs-body: 16px;
  --fs-small: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/1.65 "Pretendard Variable", Pretendard, system-ui, -apple-system, "Malgun Gothic", sans-serif;
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
.wrap { width: min(1160px, 100% - 48px); margin-inline: auto; }

/* 머리글 */
.site-head { background: var(--accent-ink); color: #fff; }
.bar { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; white-space: nowrap; }
.logo:hover { color: #fff; }
.logo svg { width: 26px; height: 30px; flex: none; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.nav a { padding: 8px 10px; color: #dcebe3; font-size: 15px; text-decoration: none; border-radius: 6px; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.nav a[aria-current="page"] { color: var(--accent-ink); background: #fff; font-weight: 600; }
.menu-btn { display: none; margin-left: auto; min-height: 40px; padding: 0 14px; color: #fff; background: transparent; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: var(--radius-control); font: inherit; font-size: 15px; cursor: pointer; }

/* 계산 화면 */
.bench { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: var(--gap); padding-block: 32px var(--gap); align-items: start; }
.head { grid-column: 1 / -1; max-width: 760px; }
.head h1 { font-size: var(--fs-title); line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.head p { margin-top: 8px; font-size: 17px; }
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span:first-child { font-size: 15px; font-weight: 600; }
.field small { color: var(--muted); font-size: var(--fs-small); line-height: 1.45; }
.field small[data-ko] { color: var(--accent); font-weight: 600; }
.field small[data-ko]:empty { display: none; }
.input { display: flex; align-items: center; min-height: 46px; background: var(--surface); border: 1px solid var(--control); border-radius: var(--radius-control); }
.input:focus-within { border-color: var(--accent); outline: 1px solid var(--accent); }
.input input { flex: 1; width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--text); font: inherit; font-size: 17px; font-variant-numeric: tabular-nums; outline: none; }
.input input[type="date"] { font-size: 16px; }
.input i { padding-right: 12px; color: var(--muted); font-style: normal; font-size: 15px; }
.input i:empty { display: none; }
.field select { width: 100%; min-height: 46px; padding: 0 10px; background: var(--surface); color: var(--text); border: 1px solid var(--control); border-radius: var(--radius-control); font: inherit; font-size: 15px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tabs button { min-height: 42px; padding: 0 2px; margin-bottom: -1px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font: inherit; font-size: 16px; cursor: pointer; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-pressed="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 700; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.copy { min-height: 42px; padding: 0 16px; background: var(--surface); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: var(--radius-control); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.copy:hover { background: var(--tint); }
.share p { font-size: var(--fs-small); color: var(--muted); }

/* 명세서 */
.bill { position: sticky; top: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
.bill-name { padding: 14px 24px; background: var(--tint); color: var(--accent-ink); font-weight: 700; }
.bill-total { padding: 20px 24px 0; color: var(--accent-ink); font-size: var(--fs-total); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.bill-total span { margin-left: 4px; font-size: 20px; font-weight: 600; letter-spacing: 0; }
.bill-sub { padding: 6px 24px 0; color: var(--muted); }
.bill-empty { padding: 24px; color: var(--muted); }
.lines { margin: 18px 24px 0; padding: 12px 0 6px; border-top: 1px dashed var(--control); }
.line { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.line:last-child { border-bottom: 0; }
.line dt { font-size: 15px; }
.line dd { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.line.minus dd { color: var(--minus); }
.line.sum { margin-top: 2px; border-top: 2px solid var(--accent-ink); }
.line.sum dt, .line.sum dd { font-weight: 700; }
.bill-note { margin: 4px 24px 0; padding-bottom: 4px; color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }
.bill > :last-child { margin-bottom: 20px; }
.notice { padding: 12px 24px; background: var(--warn-bg); color: var(--warn-ink); font-size: var(--fs-small); }

/* 결과 아래 추가 영역 */
.extra:empty { display: none; }
.extra { padding-bottom: var(--gap); }
.extra-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; }
.extra-block h2, .quick h2 { font-size: var(--fs-section); line-height: 1.3; font-weight: 700; margin-bottom: 14px; }
.plan-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 32px; align-items: start; }
.plan-wrap .tbl { margin: 0; }
.plan svg { display: block; width: 100%; height: auto; }
.plan .own { fill: var(--accent); }
.plan .shared { fill: var(--tint); }
.plan figcaption { margin-top: 12px; font-size: 15px; }
.key { display: inline-block; width: 14px; height: 14px; margin: 0 4px 0 2px; border-radius: 2px; vertical-align: -2px; }
.key.own { background: var(--accent); }
.key.shared { background: var(--tint); }
.msg { display: block; width: 100%; padding: 12px; background: var(--raised); color: var(--text); border: 1px solid var(--control); border-radius: var(--radius-control); font: inherit; line-height: 1.6; resize: vertical; }
.quick { margin-bottom: var(--gap); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; }
.quick-row { display: grid; grid-template-columns: 220px 220px 1fr; gap: 16px; align-items: end; }
.quick-row p { padding-bottom: 12px; }

/* 표 */
.tbl { overflow-x: auto; margin: 16px 0; }
.tbl table { width: 100%; min-width: 420px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl caption { padding-bottom: 8px; text-align: left; font-weight: 600; font-size: 15px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; font-size: 15px; font-weight: 400; }
.tbl thead th { color: var(--muted); border-bottom: 2px solid var(--accent-ink); font-weight: 600; }
.tbl tbody th { font-weight: 500; }
.tbl .n { text-align: right; }

/* 글 */
.article { padding-block: 8px 48px; }
.prose { max-width: 760px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 32px; }
.prose > * + * { margin-top: 14px; }
.prose h2 { margin-top: 34px; font-size: var(--fs-section); line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose .formula { padding: 12px 14px; background: var(--raised); border-left: 3px solid var(--accent); font-weight: 600; }
.prose dt { margin-top: 18px; font-weight: 700; }
.prose dd { margin-top: 4px; }
.plain-head { padding-top: 32px; padding-bottom: 16px; }
.plain-head h1 { font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.02em; }

/* 다른 계산기 */
.others { background: var(--surface); padding-block: 36px; }
.others h2 { font-size: var(--fs-section); font-weight: 700; margin-bottom: 14px; }
.others ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; padding: 0; list-style: none; }
.others a { display: block; padding: 12px 0; border-bottom: 1px solid var(--rule); color: var(--text); text-decoration: none; }
.others a:hover strong { color: var(--accent); text-decoration: underline; }
.others strong { display: block; font-weight: 600; }
.others span { color: var(--muted); font-size: var(--fs-small); }

/* 바닥글 */
footer { background: var(--accent-ink); color: #dcebe3; padding-block: 28px; font-size: var(--fs-small); }
footer nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 10px; }
footer a { color: #fff; }
footer a:hover { color: #fff; }

.mini { display: none; }

@media (max-width: 960px) {
  .bench { grid-template-columns: minmax(0, 1fr); }
  .bill { position: static; scroll-margin-top: 12px; }
  .plan-wrap { grid-template-columns: minmax(0, 1fr); }
  body:has(.mini:not([hidden])) footer { padding-bottom: 84px; }
  .mini:not([hidden]) { position: fixed; inset: auto 0 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; background: var(--accent-ink); color: #fff; font-size: 15px; text-decoration: none; }
  .mini:hover { color: #fff; }
  .mini strong { font-size: 19px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .prose { max-width: none; }
}
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav { display: none; width: 100%; margin: 0 0 12px; }
  .nav.open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav a { padding: 12px; }
}
@media (max-width: 560px) {
  :root { --fs-title: 25px; --fs-total: 34px; }
  .wrap { width: calc(100% - 32px); }
  .bench { padding-top: 22px; }
  .head p { font-size: 16px; }
  .tool, .extra-block, .quick { padding: 18px; }
  .prose { padding: 20px 18px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .quick-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .quick-row p { grid-column: 1 / -1; padding: 0; }
  .bill-name, .bill-total, .bill-sub, .notice { padding-inline: 18px; }
  .bill-empty { padding: 18px; }
  .lines, .bill-note { margin-inline: 18px; }
  .line { flex-direction: row; }
  .line dd { white-space: normal; }
  .others ul { grid-template-columns: minmax(0, 1fr); }
  .tbl table { min-width: 0; }
  .tbl th, .tbl td { padding: 9px 6px; font-size: 14px; }
}
@media print {
  .site-head, .others, footer, .share, .article { display: none; }
}
