/* 계산로그 — light theme, mobile-first, system fonts only */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --text: #1c2430;
  --muted: #5b6575;
  --line: #d9dee6;
  --accent: #1f5fbf;
  --accent-soft: #e8f0fc;
  --ok: #1e6b3a;
  --ok-bg: #e7f5ec;
  --warn: #8a2c0d;
  --warn-bg: #fdece4;
  --radius: 8px;
}
* { 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", "Malgun Gothic", "맑은 고딕", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #f0b400;
  outline-offset: 2px;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; top: 0; background: #fff; padding: 8px 12px; }
.skip:focus { left: 8px; z-index: 10; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-inner { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; padding-bottom: 10px; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.site-nav a { text-decoration: none; font-size: .95rem; }
.site-nav a:hover { text-decoration: underline; }

/* main */
main { padding-top: 20px; padding-bottom: 40px; }
h1 { font-size: 1.6rem; line-height: 1.3; margin: .3em 0 .5em; }
h2 { font-size: 1.25rem; margin: 2em 0 .6em; padding-bottom: .25em; border-bottom: 2px solid var(--accent-soft); }
h3 { font-size: 1.05rem; margin: 1.2em 0 .4em; }
.answer { font-size: 1.05rem; background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: var(--radius); }
.notice { background: var(--bg-soft); border: 1px solid var(--line); padding: 10px 12px; border-radius: var(--radius); font-size: .95rem; }
.muted, .hint { color: var(--muted); font-size: .9rem; }
.hint { margin: .25em 0 0; }

/* forms */
.calc-form { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.field label, .field .label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
input[type="number"], input[type="text"], select {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid #b9c1cc;
  border-radius: 6px;
}
input[readonly] { background: #eef1f5; }
input:disabled, select:disabled { background: #eef1f5; color: #7a8391; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0 0; padding: 10px 12px 12px; background: #fff; }
legend { font-weight: 700; padding: 0 4px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.check input { width: 20px; height: 20px; }
.btn, .btn-remove {
  font: inherit;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}
.btn { background: var(--accent); color: #fff; border: 1px solid var(--accent); margin-top: 10px; }
.btn-remove { background: #fff; color: var(--warn); border: 1px solid #d9b3a6; align-self: end; }
.intake-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.intake-row:last-child { border-bottom: 0; }
.radio-row { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.radio-row label { font-weight: 400; display: inline-flex; align-items: center; gap: 6px; }

/* results */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: #fff; }
caption { text-align: left; font-weight: 600; padding: 6px 0; color: var(--muted); }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
thead th { background: var(--bg-soft); }
td.num, th.num { text-align: right; white-space: nowrap; }
.st { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-over { background: var(--warn-bg); color: var(--warn); }
.result-box { margin-top: 8px; }
.notes { padding-left: 1.2em; font-size: .92rem; color: var(--muted); }
.big { font-size: 1.3rem; font-weight: 800; }
.formula { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; white-space: pre-wrap; }

/* sources, faq, related */
.sources { padding-left: 1.2em; font-size: .92rem; }
.sources li { margin-bottom: .8em; }
.sources a { word-break: break-all; }
.src-title { font-weight: 600; }
.src-date, .src-note { color: var(--muted); }
.faq-item { border-top: 1px solid var(--line); padding: 4px 0; }
.faq-item h3 { margin: .8em 0 .2em; }
.faq-item p { margin: 0 0 .6em; }
.related ul, .tool-list { padding-left: 1.2em; }
.tool-list li { margin-bottom: .8em; }
.tool-list a { font-weight: 700; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); font-size: .88rem; color: var(--muted); padding: 16px 0 24px; }
.site-footer p { margin: .4em 0; }

@media (min-width: 640px) {
  .header-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .grid { grid-template-columns: 1fr 1fr; }
  .intake-row { grid-template-columns: 2fr 1.3fr 1.6fr auto; align-items: end; }
  .intake-row.caf { grid-template-columns: 2.2fr 1fr 1fr auto; }
  h1 { font-size: 1.9rem; }
}
@media print {
  .site-header, .site-footer, .calc-form, .btn { display: none; }
}
