:root {
  --ink: #14202b;
  --muted: #5b6b7c;
  --line: #d5dde5;
  --bg: #f7f9fb;
  --card: #ffffff;
  --brand: #12314f;
  --accent: #f2c94c;
  --diff: #b42318;
  --check: #b54708;
  --info: #475467;
  --ok: #046c4e;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

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

a { color: #0b4f8a; }
a:hover { color: #08385f; }

.chrome { background: var(--brand); color: #fff; }
.chrome .in {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  align-items: center;
}
.chrome a { color: #eaf1f7; text-decoration: none; font-size: 0.92rem; }
.chrome a:hover, .chrome a[aria-current="page"] { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.brand { font-weight: 700; font-size: 1rem !important; letter-spacing: 0.02em; }

main { max-width: 900px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }

h1 { font-size: 1.6rem; line-height: 1.3; margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.15rem; margin: 1.8rem 0 0.6rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }

p { margin: 0.5rem 0; }
.lead { font-size: 1.02rem; color: #26333f; }
.updated { font-size: 0.82rem; color: var(--muted); margin-top: 0; }
.freshness { font-size: 0.82rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 0.6rem; margin: 0.4rem 0 1rem; }
.freshness[data-stale="1"], .warn { color: var(--check); border-color: var(--check); }
.ok { color: var(--ok); }
.muted { color: var(--muted); }
.small { font-size: 0.84rem; }
.note { font-size: 0.85rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 0.7rem; margin-top: 1.4rem; }

.cards { display: grid; gap: 0.8rem; margin: 1rem 0; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cards.three { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.95rem;
  text-decoration: none;
  color: inherit;
}
.card:hover { border-color: #93a7ba; }
.card h2 { margin: 0 0 0.35rem; font-size: 1rem; }
.card p { margin: 0 0 0.5rem; font-size: 0.9rem; color: #33424f; }
.card .go { font-size: 0.85rem; color: #0b4f8a; font-weight: 600; }

.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}

label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.25rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #b9c6d2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid #7db2e0;
  outline-offset: 1px;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

.grid { display: grid; gap: 0.8rem; margin: 0.6rem 0 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0.6rem 0; }
legend { font-size: 0.88rem; font-weight: 600; padding: 0 0.3rem; }
.chk { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 400; margin-right: 0.9rem; }
.chk input { width: auto; }
.chk-group { display: flex; flex-direction: column; justify-content: flex-end; gap: 0.3rem; padding-bottom: 0.2rem; }

button {
  cursor: pointer;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.95rem;
  font-size: 0.92rem;
}
button:hover { background: #0b2338; }
button.ghost { background: #fff; color: var(--brand); }
button.ghost:hover { background: #eef3f8; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary { padding: 0.6rem 1.2rem; font-weight: 600; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }

.tw { overflow-x: auto; margin: 0.8rem 0; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; background: #fff; }
caption { caption-side: top; text-align: left; font-size: 0.82rem; color: var(--muted); padding-bottom: 0.35rem; }
th, td { border: 1px solid var(--line); padding: 0.45rem 0.55rem; vertical-align: top; text-align: left; }
thead th { background: #eef3f8; font-size: 0.85rem; }
tbody th { font-weight: 600; background: #fbfcfd; }
.row-diff td { background: #fdf3f2; color: var(--diff); }

.amount-table input { min-width: 8.5rem; }
.amount-table td:nth-child(3) { max-width: 22rem; }

.badge { display: inline-block; font-size: 0.76rem; font-weight: 700; padding: 0.1rem 0.45rem; border-radius: 999px; color: #fff; }
.badge-diff { background: var(--diff); }
.badge-check { background: var(--check); }
.badge-info { background: var(--info); }

.finding { border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; padding: 0.8rem 0.9rem; margin: 0.7rem 0; background: #fff; }
.finding.sev-diff { border-left-color: var(--diff); }
.finding.sev-check { border-left-color: var(--check); }
.finding.sev-info { border-left-color: var(--info); }
.finding header { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.finding h3 { margin: 0; font-size: 0.98rem; }
.finding .rule { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; color: var(--muted); }
.finding .amount { font-size: 1.15rem; font-weight: 700; margin: 0.3rem 0 0.1rem; }
.finding.sev-diff .amount { color: var(--diff); }
.finding .actions { margin-top: 0.4rem; }

.verdict { font-size: 1.2rem; font-weight: 700; padding: 0.8rem 0.9rem; border-radius: 10px; background: #eef3f8; margin: 0.4rem 0 0.9rem; }
.verdict.v-diff { background: #fdecea; color: var(--diff); }
.verdict.v-check { background: #fdf0e3; color: var(--check); }
.verdict.v-match { background: #e8f6ef; color: var(--ok); }

dl.totals, dl.rates { display: grid; grid-template-columns: max-content 1fr; gap: 0.2rem 0.9rem; font-size: 0.92rem; margin: 0.6rem 0; }
dl.totals dt, dl.rates dt { color: var(--muted); }
dl.rates { grid-template-columns: 1fr; gap: 0.6rem; }
.rate-card { background: #fbfcfd; border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; }
.rate-card dt { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.rate-card dd { margin: 0.1rem 0 0; }
.rate-card dd:first-of-type { font-size: 1.05rem; }

.errors { background: #fdf3f2; border: 1px solid #f3c9c4; border-radius: 8px; padding: 0.5rem 0.6rem 0.5rem 1.6rem; font-size: 0.88rem; }
.skipped { margin: 0.8rem 0; font-size: 0.88rem; }
.skipped summary { cursor: pointer; color: var(--muted); }

.callout { border: 1px solid var(--line); border-left: 4px solid #7db2e0; background: #f4f8fc; border-radius: 10px; padding: 0.8rem 0.95rem; margin: 1.2rem 0; }
.callout-warn { border-left-color: var(--check); background: #fdf7f0; }
.callout-rule { border-left-color: var(--info); background: #f6f7f9; }
.callout h2 { margin-top: 0; font-size: 1rem; }

.steps { padding-left: 1.3rem; }
.steps li { margin-bottom: 0.5rem; }
.steps p { margin: 0.1rem 0 0; font-size: 0.92rem; color: #33424f; }

.related { margin: 2rem 0 0.6rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.related h2 { font-size: 0.95rem; margin-top: 0; }
.related ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.sources { margin: 1rem 0; font-size: 0.86rem; }
.src-list { padding-left: 1.1rem; }

footer.chrome { margin-top: 2rem; }
footer.chrome .in { display: block; padding: 1.2rem 1rem 2.4rem; }
footer.chrome h2 { font-size: 0.86rem; margin: 1rem 0 0.3rem; color: #cddbe8; }
footer.chrome ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
footer.chrome a { font-size: 0.85rem; }
.disc { font-size: 0.8rem; color: #c9d6e2; margin: 0.3rem 0; }

.faq dt { font-weight: 700; margin-top: 1rem; }
.faq dd { margin: 0.25rem 0 0; }

.sheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem; }
.sheet-head { border-bottom: 2px solid var(--brand); margin-bottom: 0.8rem; }
.checklist { padding-left: 1.2rem; font-size: 0.9rem; }
.checklist li { margin-bottom: 0.35rem; }
.checklist label { font-weight: 400; display: inline; }
.checklist input { width: auto; margin-right: 0.3rem; }
.form-table td, .form-table th { height: 2rem; }
.form-table th { width: 22%; }
.form-lines { border-bottom: 1px solid #b9c6d2; min-height: 2rem; }
.sheet-foot { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 0.5rem; }

.letter h2 { margin-top: 0; }
.letter-table { margin-bottom: 1rem; }
#dispute-body { white-space: pre-wrap; font-family: inherit; font-size: 0.92rem; background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px; padding: 0.8rem; }
.notfound { columns: 2; }

@media (max-width: 560px) {
  body { font-size: 15px; }
  h1 { font-size: 1.35rem; }
  main { padding: 1rem 0.75rem 2.5rem; }
  .amount-table thead { display: none; }
  .amount-table, .amount-table tbody, .amount-table tr, .amount-table th, .amount-table td { display: block; width: 100%; }
  .amount-table tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 0.6rem; background: #fff; padding: 0.4rem 0.5rem; }
  .amount-table th, .amount-table td { border: 0; padding: 0.2rem 0; }
  .amount-table td:nth-child(3) { max-width: none; }
  .amount-table input { min-width: 0; }
  .cards.two, .cards.three { grid-template-columns: 1fr; }
  .notfound { columns: 1; }
}

@media print {
  @page { size: A4; margin: 18mm; }
  body { background: #fff; font-size: 11pt; }
  .chrome, .related, .sources, .no-print, .form-actions, .freshness, .next { display: none !important; }
  main { max-width: none; padding: 0; }
  h1 { font-size: 16pt; }
  .sheet { border: 0; padding: 0; }
  table { font-size: 9.5pt; }
  .tw { overflow: visible; }
  a { color: #000; text-decoration: none; }
  .print-target .no-print { display: none !important; }
  .finding { break-inside: avoid; }
}
