:root {
  --ink: #16232b;
  --muted: #5c6f7b;
  --line: #d5dee3;
  --paper: #ffffff;
  --wash: #f2f6f8;
  --brand: #1f3a5f;
  --accent: #0f6a63;
  --warn: #8a4b00;
  --warn-bg: #fdf4e3;
  --danger: #9b2c2c;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--wash);
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.chrome {
  background: var(--brand);
  color: #fff;
}

.chrome .in {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  align-items: center;
}

.chrome a {
  color: #fff;
  text-decoration: none;
  font-size: 0.92rem;
}

.chrome .brand {
  font-weight: 700;
  font-size: 1rem;
  margin-right: 0.4rem;
}

.chrome a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 3px;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.2rem 1rem 2.5rem;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.3;
  margin: 0.4rem 0 0.6rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.12rem;
  margin: 1.4rem 0 0.6rem;
}

h3 {
  font-size: 1rem;
  margin: 1rem 0 0.4rem;
}

p {
  margin: 0.5rem 0;
}

a {
  color: #16506f;
}

.lede {
  font-size: 1.02rem;
  color: #32414b;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.86rem;
}

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

.panel h2:first-child {
  margin-top: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.6rem;
  margin: 0.8rem 0;
}

.card {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.75rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 0.15rem;
}

.card strong {
  font-size: 0.98rem;
}

.card span {
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 600;
}

.card em {
  font-style: normal;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.card:hover,
.card:focus-visible {
  border-color: var(--brand);
  outline: 2px solid rgba(31, 58, 95, 0.15);
}

.card[aria-pressed="true"] {
  border-color: var(--brand);
  background: #eef3f8;
}

.card-muted span {
  color: var(--warn);
}

fieldset.q {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 0.8rem 0 0.4rem;
}

fieldset.q:first-of-type {
  border-top: 0;
}

fieldset.q legend {
  font-weight: 600;
  padding: 0;
  margin-bottom: 0.35rem;
}

fieldset.q label {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  margin-right: 1rem;
  font-size: 0.95rem;
}

fieldset.q-sub label {
  margin-right: 0.5rem;
}

input[type="number"],
input[type="text"],
input[type="date"],
select {
  font: inherit;
  padding: 0.42rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  max-width: 100%;
}

fieldset.q input[type="number"] {
  width: 9rem;
}

select {
  min-width: 8rem;
}

details#advanced {
  margin: 0.8rem 0 0;
  border-top: 1px dashed var(--line);
  padding-top: 0.6rem;
}

details#advanced summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
}

.form-foot {
  margin-top: 1rem;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.45rem 0.8rem;
}

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
}

button.primary:hover {
  background: #16294a;
}

button.ghost {
  background: #fff;
  color: var(--brand);
  border-color: var(--brand);
}

#result:empty {
  display: none;
}

.verdict {
  margin-top: 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: #fff;
}

.verdict[data-verdict="permit"] {
  border-color: #8a2f2f;
  background: #fdf4f4;
}

.verdict[data-verdict="report"] {
  border-color: #2f5d8a;
  background: #f3f7fc;
}

.verdict[data-verdict="exempt"] {
  border-color: var(--accent);
  background: #f2f8f7;
}

.verdict[data-verdict="need-check"] {
  border-color: var(--warn);
  background: var(--warn-bg);
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #e8eef4;
  color: var(--brand);
}

.verdict-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0.35rem 0 0.2rem;
}

.verdict-reason {
  margin: 0.2rem 0 0.6rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 0.9rem;
  margin: 0.6rem 0;
  font-size: 0.94rem;
}

.facts dt {
  color: var(--muted);
  font-weight: 600;
}

.facts dd {
  margin: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
  padding: 0;
  list-style: none;
}

.tags li {
  font-size: 0.78rem;
  background: #fff3d6;
  color: var(--warn);
  border: 1px solid #ecd39a;
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}

.warn-list {
  margin: 0.5rem 0;
  padding-left: 1.1rem;
  color: var(--danger);
  font-size: 0.92rem;
}

.ref-list {
  margin: 0.4rem 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
}

.disclaimer {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.verdict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.ad-slot {
  margin: 1rem 0;
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin: 1rem 0;
  display: block;
  overflow-x: auto;
}

.table caption {
  text-align: left;
  padding: 0.5rem 0.7rem;
  font-weight: 700;
  background: #eef3f8;
  border-bottom: 1px solid var(--line);
}

.table th,
.table td {
  text-align: left;
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table tbody tr:last-child td,
.table tbody tr:last-child th {
  border-bottom: 0;
}

.table thead th {
  background: #f7fafc;
  color: var(--muted);
  font-size: 0.82rem;
}

.ticks {
  padding-left: 1.1rem;
}

.steps {
  padding-left: 1.3rem;
}

.steps li {
  margin: 0.5rem 0;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0;
  display: grid;
  gap: 0.55rem;
}

.checklist li label {
  display: block;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.glossary {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.glossary dt {
  font-weight: 700;
}

.glossary dd {
  margin: 0;
  color: #32414b;
}

.faq {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin: 0.45rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
}

.faq p {
  margin: 0.4rem 0 0;
  color: #32414b;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.7rem;
}

.grid2 label {
  display: grid;
  gap: 0.25rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.grid2 label.inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
}

.file {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  font-size: 0.9rem;
}

.file input[type="file"] {
  font-size: 0.85rem;
  max-width: 15rem;
}

.ledger {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0;
  display: grid;
  gap: 0.5rem;
}

.ledger li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  background: #fbfdfe;
}

.ledger .entry-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  align-items: baseline;
}

.ledger .entry-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.ledger .entry-actions {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.stale-banner {
  background: var(--warn-bg);
  border-bottom: 1px solid #ecd39a;
  color: var(--warn);
  font-size: 0.88rem;
  padding: 0.45rem 1rem;
  text-align: center;
}

footer.chrome {
  margin-top: 2rem;
  background: #16293f;
}

footer.chrome .in {
  display: block;
  padding: 1.2rem 1rem 2rem;
}

footer.chrome section {
  margin-top: 1rem;
}

footer.chrome h2 {
  font-size: 0.85rem;
  color: #c9d8e6;
  margin: 0 0 0.35rem;
  text-transform: none;
}

footer.chrome ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

footer.chrome a {
  color: #e8f0f7;
  font-size: 0.88rem;
}

.disc {
  color: #c9d8e6;
  font-size: 0.82rem;
  margin: 0.2rem 0;
}

.sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.1rem 1.2rem;
  margin: 1rem 0;
}

.sheet-head h1 {
  font-size: 1.25rem;
  margin: 0 0 0.3rem;
}

.sheet-notice {
  font-size: 0.86rem;
  color: var(--warn);
  margin: 0;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.9rem;
}

.sheet-table th,
.sheet-table td {
  border: 1px solid #c8d3da;
  padding: 0.4rem 0.55rem;
  text-align: left;
}

.sheet-table th {
  width: 34%;
  background: #f5f8fa;
  font-weight: 600;
}

.sheet-block h2 {
  font-size: 1rem;
  margin: 0.8rem 0 0.35rem;
}

.sheet-block ul,
.sheet-block ol {
  margin: 0.3rem 0;
  padding-left: 1.2rem;
  font-size: 0.9rem;
}

.sheet-foot {
  margin-top: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid #c8d3da;
  font-size: 0.78rem;
  color: var(--muted);
}

#form-preview .sheet {
  margin: 0;
}

.checklist-sheet .checklist {
  gap: 0.3rem;
}

.checklist-sheet .checklist li {
  display: grid;
  grid-template-columns: 1.2rem 1fr;
  gap: 0.35rem;
  font-size: 0.9rem;
  border-bottom: 1px dashed #d9e2e8;
  padding-bottom: 0.3rem;
}

.checklist-sheet .box {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 1.5px solid #6b7c88;
  border-radius: 3px;
  margin-top: 0.2rem;
}

@media (max-width: 520px) {
  h1 {
    font-size: 1.32rem;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .facts dt {
    margin-top: 0.4rem;
  }

  .cards {
    grid-template-columns: 1fr 1fr;
  }

  .glossary {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }

  .glossary dd {
    margin: 0 0 0.5rem;
  }
}

@media print {
  @page {
    size: A4;
    margin: 14mm;
  }

  body {
    background: #fff;
    font-size: 10.5pt;
  }

  .chrome,
  footer.chrome,
  .ad-slot,
  .verdict-actions,
  button,
  nav[aria-label="사이트 메뉴"],
  nav[aria-label="위치"],
  #advanced {
    display: none !important;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .sheet {
    border: 0;
    padding: 0;
    margin: 0;
    page-break-after: avoid;
  }

  .checklist-sheet {
    page-break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
