/* ==========================================================================
   문패 munpae
   원칙: 무채색 베이스 + 상태색만 유채색.
   페이지에서 색이 보이는 순간 = 정보가 있는 순간.
   ========================================================================== */

:root {
  /* 베이스 — 색을 쓰지 않는다 */
  --paper:   #ffffff;
  --paper-2: #fafaf9;
  --paper-3: #f5f5f4;
  --ink:     #1c1917;
  --ink-2:   #57534e;
  --ink-3:   #78716c;
  --rule:    #e7e5e4;
  --rule-2:  #d6d3d1;

  /* 브랜드 — CTA와 로고에만. 면적 최소 */
  --brand:      #16324e;
  --brand-deep: #0f2439;

  /* 상태색 — 제품 안에서도 그대로 쓴다 */
  --st-closed:  #dc2626;   /* 폐업 */
  --st-rest:    #d97706;   /* 휴업 */
  --st-simple:  #2563eb;   /* 간이 */
  --st-exempt:  #059669;   /* 면세 */
  --st-invalid: #78716c;   /* 오류 */

  /* 어두운 배경용 상태색 */
  --dk-closed:  #f87171;
  --dk-rest:    #fbbf24;
  --dk-simple:  #60a5fa;
  --dk-exempt:  #34d399;
  --dk-invalid: #a8a29e;

  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          system-ui, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --gutter: clamp(1.25rem, 5vw, 4rem);
  --measure: 74rem;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  letter-spacing: -0.011em;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}

.shell {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 20; }
.skip:focus { left: 0; }

/* --- 공통 활자 ----------------------------------------------------------- */

.eyebrow {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.section-title {
  margin: 0 0 .85rem;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 700;
  line-height: 1.42;
  letter-spacing: -0.028em;
}

.lede { margin: 0; max-width: 46ch; color: var(--ink-2); }

/* --- 헤더 ---------------------------------------------------------------- */

.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; }

.wordmark { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.wordmark .mark { width: 1.6rem; height: 1.6rem; flex: none; display: block; }
.wordmark .mark rect { fill: var(--brand); }
.wordmark .mark path { stroke: var(--paper); }
.wordmark b { font-size: 1.08rem; font-weight: 700; letter-spacing: -0.01em; }
.wordmark span { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; color: var(--ink-3); }

.masthead-link { font-size: .9rem; font-weight: 500; color: var(--ink-2); text-decoration: none; }
.masthead-link:hover { color: var(--brand); }

/* --- 버튼 ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.5rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand);
  color: #fff;
  font-family: inherit; font-size: 1rem; font-weight: 600; letter-spacing: -0.015em;
  text-decoration: none; cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease;
}
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

.btn-ghost { background: transparent; color: var(--brand); border-color: var(--rule-2); }
.btn-ghost:hover { background: var(--paper-3); border-color: var(--rule-2); color: var(--brand-deep); }

/* --- 히어로 -------------------------------------------------------------- */

.hero { padding-block: clamp(2.75rem, 6vw, 4.5rem) clamp(3rem, 6vw, 4.5rem); }

/* 제목은 왼쪽, 설명·CTA·사실은 오른쪽 아래에 붙인다 */
.hero-head { display: grid; gap: 1.75rem; }
@media (min-width: 62rem) {
  .hero-head {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(2.5rem, 5vw, 4.5rem);
    align-items: start;
  }
}

.hero-title {
  margin: 0;
  font-size: clamp(2.05rem, 4.4vw, 3.05rem);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.035em;
  max-width: 15ch;
}

.hero-lede { margin: 0 0 1.6rem; max-width: 48ch; font-size: 1.02rem; color: var(--ink-2); }

.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; }

/* 사실 3개 — 강조해야 하는 문구 */
.facts {
  display: flex; flex-wrap: wrap;
  margin: 1.1rem 0 0; padding: 0;
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  width: fit-content;
  max-width: 100%;
}
.facts li {
  padding: .7rem 1.15rem;
  font-size: .92rem;
  color: var(--ink-2);
  border-left: 1px solid var(--rule);
}
.facts li:first-child { border-left: 0; }

@media (max-width: 36rem) {
  .facts { flex-direction: column; flex-wrap: nowrap; width: 100%; }
  .facts li { border-left: 0; border-top: 1px solid var(--rule); }
  .facts li:first-child { border-top: 0; }
}
.facts b { color: var(--ink); font-weight: 600; }
.facts .num { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }

/* --- 결과 시트 목업 (히어로 주인공) ---------------------------------------- */

.result {
  margin: clamp(2.25rem, 5vw, 3.25rem) 0 0;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(28, 25, 23, .05), 0 8px 24px -12px rgba(28, 25, 23, .18);
  overflow: hidden;
}

.result-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .4rem 1rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.result-file { font-size: .88rem; font-weight: 600; }
.result-stamp { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.result-scroll { overflow-x: auto; }

.sheet {
  width: 100%;
  min-width: 46rem;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .875rem;
}

.sheet caption { caption-side: bottom; padding: .8rem 1rem; text-align: left; font-size: .8rem; color: var(--ink-3); border-top: 1px solid var(--rule); }

.sheet th, .sheet td { padding: .62rem .9rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }

.sheet .group th {
  padding-block: .5rem;
  font-family: var(--mono);
  font-size: .68rem; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
}
.sheet .group .group-added { color: var(--brand); background: #f6f8fb; }

.sheet thead .cols th { font-size: .78rem; font-weight: 600; color: var(--ink-2); background: var(--paper); }

/* 문패가 붙인 열: 왼쪽에 경계선을 세우고 바탕을 아주 살짝 눕힌다 */
.sheet .added { background: #fbfcfd; }
.sheet .col-first-added { border-left: 2px solid var(--brand); }

.sheet td.name { font-weight: 500; }
.sheet td.bizno { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.sheet td.note { color: var(--ink-2); font-size: .82rem; }
.sheet td.plain { color: var(--ink-3); }

.sheet tbody tr:last-child td { border-bottom: 0; }
.sheet tbody tr[data-alert] { background: #fef2f2; }
.sheet tbody tr[data-alert] .added { background: #fef2f2; }
.sheet tbody tr[data-alert] td:first-child { box-shadow: inset 3px 0 0 var(--st-closed); }

/* --- 상태 칩 ------------------------------------------------------------- */

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .12rem .5rem .16rem;
  border: 1px solid var(--chip-line, var(--rule));
  border-radius: 999px;
  background: var(--chip-bg, var(--paper-3));
  color: var(--chip-ink, var(--ink-2));
  font-size: .78rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.chip::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--chip-dot, var(--ink-3)); }

.chip.closed  { --chip-bg:#fef2f2; --chip-line:#fecaca; --chip-ink:#b91c1c; --chip-dot:var(--st-closed); }
.chip.rest    { --chip-bg:#fffbeb; --chip-line:#fde68a; --chip-ink:#b45309; --chip-dot:var(--st-rest); }
.chip.simple  { --chip-bg:#eff6ff; --chip-line:#bfdbfe; --chip-ink:#1d4ed8; --chip-dot:var(--st-simple); }
.chip.exempt  { --chip-bg:#ecfdf5; --chip-line:#a7f3d0; --chip-ink:#047857; --chip-dot:var(--st-exempt); }
.chip.invalid { --chip-bg:#f5f5f4; --chip-line:#e7e5e4; --chip-ink:#57534e; --chip-dot:var(--st-invalid); }
/* 계속·일반은 정보가 아니다. 색을 주지 않는다. */
.chip.quiet   { border-color: transparent; background: transparent; color: var(--ink-3); font-weight: 500; }
.chip.quiet::before { display: none; }
.chip.quiet { padding-inline: 0; }

/* --- 섹션 ---------------------------------------------------------------- */

.band { border-top: 1px solid var(--rule); padding-block: clamp(3.25rem, 6.5vw, 5rem); }
.band-tint { background: var(--paper-2); }
.band-dark { background: var(--ink); color: #e7e5e4; border-top-color: var(--ink); }
.band-dark .section-title { color: #fafaf9; }
.band-dark .eyebrow { color: #a8a29e; }
.band-dark .lede { color: #a8a29e; }

.band-head { margin-bottom: clamp(2rem, 4vw, 3rem); }

/* --- 손실 지점 ----------------------------------------------------------- */

.risk-list { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
@media (min-width: 52rem) { .risk-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.risk { display: flex; flex-direction: column; gap: .65rem; padding: clamp(1.4rem, 2.4vw, 1.85rem); background: var(--paper); }
.risk h3 { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.5; letter-spacing: -0.02em; }
.risk p { margin: 0; font-size: .94rem; color: var(--ink-2); }
/* 상태색은 상태에만 쓴다. 여기는 라벨이므로 무채색이다. */
.risk .penalty {
  margin-top: auto; padding-top: .85rem; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: .74rem; letter-spacing: .01em;
  font-weight: 500; color: var(--ink);
}

/* --- 순서 ---------------------------------------------------------------- */

.steps { display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); counter-reset: step; }
@media (min-width: 52rem) { .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.step { position: relative; padding-top: 1.45rem; border-top: 1px solid var(--rule-2); }
.step::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  position: absolute; top: -1.55rem; left: 0;
  font-family: var(--mono); font-size: .7rem; letter-spacing: .14em; color: var(--ink-3);
}
.step h3 { margin: 0 0 .5rem; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; }
.step p { margin: 0; font-size: .94rem; color: var(--ink-2); }

/* --- 상태 해석 (어두운 띠) -------------------------------------------------- */

.reads { border-top: 1px solid #44403c; }
.read {
  display: grid; gap: .45rem 1.75rem; align-items: baseline;
  padding-block: 1.15rem; border-bottom: 1px solid #44403c;
}
@media (min-width: 44rem) { .read { grid-template-columns: 9rem minmax(0, 1fr); } }

.read-state {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .88rem; font-weight: 600; color: var(--tone, #e7e5e4);
}
.read-state::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--tone, #a8a29e); flex: none; }
.read.closed  { --tone: var(--dk-closed); }
.read.rest    { --tone: var(--dk-rest); }
.read.simple  { --tone: var(--dk-simple); }
.read.exempt  { --tone: var(--dk-exempt); }
.read.invalid { --tone: var(--dk-invalid); }

.read-text { margin: 0; font-size: .96rem; color: #d6d3d1; }
.read-text em { font-style: normal; font-weight: 600; color: #fafaf9; }

.reads-note { margin: 1.6rem 0 0; max-width: 54ch; font-size: .85rem; color: #a8a29e; }

/* --- 파일 취급 ----------------------------------------------------------- */

.pledge { display: grid; gap: clamp(1.4rem, 4vw, 3.5rem); align-items: start; }
@media (min-width: 52rem) { .pledge { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pledge-body { margin: 0; color: var(--ink-2); }
.pledge-list { margin: 0; padding: 0; list-style: none; display: grid; gap: .8rem; }
.pledge-list li { position: relative; padding-left: 1.4rem; font-size: .95rem; color: var(--ink-2); }
.pledge-list li::before { content: ""; position: absolute; left: 0; top: .72em; width: .65rem; height: 1px; background: var(--rule-2); }

/* --- 마무리 -------------------------------------------------------------- */

.closer { text-align: center; }
.closer .hero-title, .closer .section-title { max-width: 24ch; margin-inline: auto; }
.closer .lede { margin-inline: auto; margin-bottom: 1.9rem; }
.closer .cta-row { justify-content: center; }
.closer .facts { margin-inline: auto; }

/* --- 푸터 ---------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding-block: 2.5rem 3.25rem;
  font-size: .83rem;
  color: var(--ink-3);
}

.footer-top {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  gap: 1.25rem 2rem; align-items: flex-start;
  padding-bottom: 1.5rem; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.footer-brand { display: grid; gap: .55rem; }
.footer-brand p { margin: 0; font-size: .85rem; color: var(--ink-2); }

.footer-nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.footer-nav a { font-size: .86rem; color: var(--ink-2); text-decoration: none; }
.footer-nav a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

/* 사업자 정보. 존재하되 시선을 뺏지 않는다. */
.footer-biz {
  margin: 0 0 1.1rem;
  font-style: normal;
  font-size: .8rem;
  line-height: 1.85;
  color: var(--ink-3);
}
.footer-biz .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.footer-biz a { color: inherit; text-underline-offset: 3px; }

.footer-disclaimer { margin: 0; max-width: 72ch; font-size: .78rem; line-height: 1.8; color: var(--ink-3); }
.footer a { text-decoration-color: var(--rule-2); text-underline-offset: 3px; }

/* --- /check 자리표시 ------------------------------------------------------ */

.stub { padding-block: clamp(3.5rem, 10vw, 7rem); }
.stub .section-title { max-width: 22ch; }
.stub .lede { margin-bottom: 1.9rem; }

/* --- 연출 ---------------------------------------------------------------- */

/* 히어로 연출은 CSS만으로 한다. 스크립트가 죽어도 결과 표는 반드시 보인다. */
@media (prefers-reduced-motion: no-preference) {
  .sheet tbody tr { animation: row-in 300ms ease both; animation-delay: calc(var(--r) * 70ms); }
  .sheet .chip:not(.quiet) {
    animation: chip-in 260ms cubic-bezier(.2, 1.5, .4, 1) both;
    animation-delay: calc(660ms + var(--r) * 45ms);
  }
}
@keyframes row-in  { from { opacity: 0 } to { opacity: 1 } }
@keyframes chip-in { from { opacity: 0; transform: scale(.88) } to { opacity: 1; transform: none } }

.js .lift { opacity: 0; transform: translateY(12px); transition: opacity 560ms ease, transform 560ms cubic-bezier(.2,.7,.3,1); transition-delay: calc(var(--d, 0) * 1ms); }
.js .lift.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
  .sheet tbody tr, .sheet .chip, .js .lift { opacity: 1; transform: none; }
}

/* --- 좁은 화면: 상태 열이 스크롤 뒤로 숨지 않게 한다 --------------------------- */

.result-hint { display: none; padding: 0 1rem .85rem; font-size: .78rem; color: var(--ink-3); }

@media (max-width: 47.99rem) {
  .sheet { min-width: 27rem; font-size: .8rem; }
  .sheet th, .sheet td { padding: .5rem .55rem; }
  .sheet .c-tax { display: none; }     /* 과세유형은 접는다 */
  .sheet caption { padding-inline: .85rem; }

  .result { position: relative; }
  .result::after {
    content: "";
    position: absolute; top: 2.5rem; right: 0; bottom: 4.5rem; width: 2rem;
    pointer-events: none;
    background: linear-gradient(to right, rgba(255, 255, 255, 0), var(--paper));
  }
  .result-hint { display: block; }
}

/* --- 단건 조회 화면 (/check) ------------------------------------------------ */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.lookup { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 7vw, 5rem); }
.lookup .lede { margin-bottom: 2rem; }

.lookup-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: stretch; }

.lookup-input {
  flex: 1 1 15rem;
  min-width: 0;
  padding: .85rem 1rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
.lookup-input::placeholder { color: #b6b2ae; letter-spacing: .02em; }
.lookup-input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }

.lookup-form .btn { flex: 0 0 auto; }

.lookup-help { margin: .8rem 0 0; font-size: .85rem; color: var(--ink-3); }

.lookup-foot {
  margin: 2.5rem 0 0; padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: .88rem; color: var(--ink-3);
}

/* 호출 실패 안내 */
.notice {
  margin-top: 1.75rem; padding: .9rem 1.1rem;
  border: 1px solid var(--rule-2); border-left: 3px solid var(--ink-3);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.notice p { margin: 0; font-size: .94rem; color: var(--ink-2); }

/* 결과 카드 */
.outcome {
  margin-top: 1.75rem;
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--accent, var(--rule-2));
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}
.outcome.is-alert   { --accent: var(--st-closed); }
.outcome.is-caution { --accent: var(--st-rest); }
.outcome.is-info    { --accent: var(--st-simple); }
.outcome.is-clear   { --accent: var(--st-exempt); }

.outcome-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .3rem 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.outcome-no {
  margin: 0;
  font-family: var(--mono); font-size: 1.2rem; font-weight: 500;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}
.outcome-stamp { margin: 0; font-family: var(--mono); font-size: .74rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.outcome-facts { display: grid; gap: 1px; margin: 0; padding: 0; background: var(--rule); }
@media (min-width: 34rem) { .outcome-facts { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); } }
.outcome-facts > div { display: flex; flex-direction: column; gap: .4rem; padding: .95rem 1.25rem; background: var(--paper); }
.outcome-facts dt { font-size: .76rem; font-weight: 500; color: var(--ink-3); }
.outcome-facts dd { margin: 0; font-size: .95rem; }
.outcome-facts .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.outcome-findings { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.outcome-findings li {
  display: grid; gap: .5rem .9rem; align-items: baseline;
  padding: .95rem 1.25rem;
  border-bottom: 1px solid var(--rule);
}
@media (min-width: 34rem) { .outcome-findings li { grid-template-columns: 6.5rem minmax(0, 1fr); } }
.outcome-findings li:last-child { border-bottom: 0; }
.outcome-findings p { margin: 0; font-size: .95rem; color: var(--ink-2); }
.outcome-findings .chip { justify-self: start; }

.outcome-clear { margin: 0; padding: .95rem 1.25rem; border-top: 1px solid var(--rule); font-size: .95rem; color: var(--ink-2); }

/* --- 약관·방침 (/terms, /privacy) ------------------------------------------ */

.legal { padding-block: clamp(2.5rem, 6vw, 4rem) clamp(3rem, 7vw, 5rem); }

.legal-title {
  margin: 0 0 .5rem;
  font-size: clamp(1.6rem, 3.2vw, 2.15rem);
  font-weight: 700; line-height: 1.4; letter-spacing: -0.028em;
}
.legal-updated { margin: 0 0 2.5rem; font-family: var(--mono); font-size: .78rem; color: var(--ink-3); }

.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 {
  margin-top: 2.75rem; margin-bottom: .85rem;
  padding-top: 1.4rem; border-top: 1px solid var(--rule);
  font-size: 1.12rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.5;
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin-top: 1.75rem; margin-bottom: .5rem; font-size: .98rem; font-weight: 600; }
.prose p, .prose li { color: var(--ink-2); font-size: .95rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li + li { margin-top: .45rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--brand); text-underline-offset: 3px; }

.prose table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden; font-size: .9rem;
}
.prose th, .prose td { padding: .6rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.prose thead th { background: var(--paper-2); font-weight: 600; font-size: .8rem; color: var(--ink-2); }
.prose tbody th { width: 30%; font-weight: 500; color: var(--ink); background: var(--paper-2); }
.prose td { color: var(--ink-2); }
.prose tbody tr:last-child th, .prose tbody tr:last-child td { border-bottom: 0; }

.prose dl { display: grid; gap: .5rem 1.25rem; }
@media (min-width: 34rem) { .prose dl { grid-template-columns: 10rem minmax(0, 1fr); } }
.prose dt { font-weight: 600; font-size: .92rem; }
.prose dd { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* --- 오류 화면 -------------------------------------------------------------- */

.oops { padding-block: clamp(3.5rem, 10vw, 7rem); }
.oops-code { font-size: 1rem; letter-spacing: .16em; color: var(--ink-3); }
.oops .section-title { max-width: 22ch; }
.oops .lede { margin-bottom: 2rem; }
.oops .btn + .btn { margin-left: .7rem; }

/* --- 헤더 내비 -------------------------------------------------------------- */

.masthead-nav { display: flex; align-items: center; gap: .35rem 1.1rem; flex-wrap: wrap; }
.masthead-link.is-primary {
  padding: .42rem .9rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  color: var(--brand);
  font-weight: 600;
}
.masthead-link.is-primary:hover { background: var(--paper-3); border-color: var(--brand); }

/* --- 업로드 (/check) -------------------------------------------------------- */

.drop { margin-top: 1.75rem; }

.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .5rem;
  min-height: 11rem;
  padding: 2rem 1.25rem;
  border: 2px dashed var(--rule-2);
  border-radius: var(--radius);
  background: var(--paper-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.drop-zone:hover { border-color: var(--brand); background: var(--paper-3); }
.drop-zone.is-over { border-color: var(--brand); background: #f2f5f9; border-style: solid; }
.drop-zone.has-file { border-style: solid; border-color: var(--rule-2); background: var(--paper); }
.drop-zone.is-loading { opacity: .6; cursor: progress; }
.sr-only:focus-visible + .drop-zone { outline: 2px solid var(--brand); outline-offset: 2px; }

.drop-title { font-size: 1rem; font-weight: 600; }
.drop-hint { font-size: .85rem; color: var(--ink-3); }
.drop-hint b { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; }
.drop-file {
  margin-top: .35rem; padding: .3rem .75rem;
  border-radius: 999px; background: var(--paper-3);
  font-family: var(--mono); font-size: .82rem; color: var(--ink-2);
}

/* 조회 전 확인 */
.preview {
  margin-top: 1.75rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.preview-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.preview-title { margin: 0 0 .2rem; font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.preview-note { margin: 0; font-size: .84rem; color: var(--ink-3); }

.preview-tally { display: grid; gap: 1px; margin: 0; padding: 0; background: var(--rule); }
@media (min-width: 34rem) { .preview-tally { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); } }
.preview-tally > div { display: flex; flex-direction: column; gap: .3rem; padding: .9rem 1.25rem; background: var(--paper); }
.preview-tally dt { font-size: .82rem; color: var(--ink-3); }
.preview-tally dd { margin: 0; font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.preview-tally .is-key dd { font-weight: 500; }
.preview-tally .is-invalid dd { color: var(--st-closed); }

.preview-sheet { padding: .9rem 1.25rem; border-top: 1px solid var(--rule); }
.preview-sheet-name { margin: 0 0 .2rem; font-size: .88rem; font-weight: 600; }
.preview-sheet-col { margin: 0; font-size: .88rem; color: var(--ink-2); }
.preview-sheet-alt { margin: .45rem 0 0; font-size: .84rem; color: var(--ink-3); }

.linkish {
  margin-left: .4rem; padding: 0;
  border: 0; background: none; cursor: pointer;
  color: var(--brand); font: inherit; font-size: .84rem;
  text-decoration: underline; text-underline-offset: 3px;
}

/* 한도 초과 — 여기서 멈춘다 */
.preview-block.is-over {
  padding: .95rem 1.25rem;
  border-top: 1px solid var(--rule);
  border-left: 3px solid var(--st-closed);
  background: #fef2f2;
}
.preview-block.is-over p { margin: 0; font-size: .92rem; color: #b91c1c; font-weight: 600; }
.preview-over-hint { margin-top: .3rem !important; font-weight: 400 !important; color: var(--ink-2) !important; }

.preview-actions {
  display: flex; flex-wrap: wrap; gap: .7rem;
  padding: 1.1rem 1.25rem .6rem;
  border-top: 1px solid var(--rule);
}
.preview-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
.preview-calls { margin: 0; padding: 0 1.25rem 1.1rem; font-size: .82rem; color: var(--ink-3); }

/* --- 진행 상태 -------------------------------------------------------------- */

.progress {
  margin-top: 1.75rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: var(--paper);
}

.progress-title { margin: 0 0 .3rem; font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.progress-sub { margin: 0; font-size: .92rem; color: var(--ink-2); }
.progress-sub .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* 진행률 자체보다 건수 표기가 신뢰를 준다. 막대는 거들 뿐이다. */
.progress-bar {
  height: 4px; margin-top: 1rem;
  border-radius: 999px; background: var(--paper-3);
  overflow: hidden;
}
.progress-bar span {
  display: block; height: 100%; width: 0;
  background: var(--brand);
  transition: width 320ms ease;
}

.progress-cache { margin: .9rem 0 0; font-size: .82rem; color: var(--ink-3); }

.progress-summary {
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
  margin: 1.1rem 0 0; padding: 1rem 0 0;
  border-top: 1px solid var(--rule);
}
.progress-summary > div { display: flex; align-items: baseline; gap: .45rem; }
.progress-summary dt { font-size: .92rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: .4rem; }
.progress-summary dt::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--tone, var(--rule-2)); }
/* 라벨과 같은 크기로 두고 굵기로만 구분한다. 숫자만 커 보이면 균형이 깨진다. */
.progress-summary dd {
  margin: 0;
  font-size: .92rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.progress-summary .is-ok { --tone: var(--st-exempt); }
.progress-summary .is-closed { --tone: var(--st-closed); }
.progress-summary .is-rest { --tone: var(--st-rest); }
.progress-summary .is-problem { --tone: var(--st-invalid); }

.progress-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.2rem; }

.progress.is-failed { border-left: 3px solid var(--st-closed); }
.progress.is-failed .progress-title { color: #b91c1c; }

/* --- 결과 미리보기 표 ------------------------------------------------------- */

.progress-attention {
  display: flex; align-items: flex-start; gap: .5rem;
  margin: 1rem 0 0; padding: .7rem .9rem;
  border: 1px solid #fecaca; border-left: 3px solid var(--st-closed);
  border-radius: var(--radius);
  background: #fef2f2;
  font-size: .92rem; font-weight: 600; color: #b91c1c;
}

.result-preview {
  margin: 1.1rem 0 0;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  overflow: hidden;
}

/* 표는 가로로만 스크롤한다. 세로는 잘라서 "더 있다"를 보이게 둔다. */
.result-preview-scroll { position: relative; overflow-x: auto; }
.result-preview .sheet { min-width: 44rem; }
.result-preview .sheet .cols th { background: var(--paper-2); }
.result-preview .sheet tbody tr:last-child td { border-bottom: 1px solid var(--rule); }

/* 아래쪽을 흐리게 덮어 잘렸음을 알린다 */
.result-preview-fade {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 5.5rem;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--paper) 82%);
}

.result-preview-more {
  padding: .8rem 1rem;
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  font-size: .85rem; color: var(--ink-3);
}
.result-preview-more b { color: var(--ink); font-weight: 600; }

/* 정상 상태. 원래는 색을 주지 않았으나, 결과 화면에서는 초록으로 안심을 준다. */
.chip.ok { --chip-bg: #ecfdf5; --chip-line: #a7f3d0; --chip-ink: #047857; --chip-dot: var(--st-exempt); }

@media (max-width: 47.99rem) {
  .result-preview .sheet { min-width: 30rem; font-size: .8rem; }
  .result-preview .sheet th, .result-preview .sheet td { padding: .5rem .55rem; }
  .result-preview .c-tax { display: none; }
}

/* --- 버튼 위계 -------------------------------------------------------------- */

/*
 * 조회하기와 내려받기가 같은 무게면 무엇을 눌러야 할지 알 수 없다.
 * 조회는 확인 화면으로 가는 중간 단계이고, 내려받기가 이 화면의 목적이다.
 */
.btn-secondary {
  background: var(--paper);
  border-color: var(--rule-2);
  color: var(--brand);
}
.btn-secondary:hover { background: var(--paper-3); border-color: var(--brand); color: var(--brand-deep); }

/* 내려받기 — 이 화면에서 유일하게 채워진 버튼 */
.btn-download {
  background: var(--st-exempt);
  border-color: var(--st-exempt);
  box-shadow: 0 1px 2px rgba(5, 150, 105, .25);
}
.btn-download:hover { background: #047857; border-color: #047857; }
.btn-download::before {
  content: "";
  width: .85rem; height: .85rem;
  flex: none;
  background: currentColor;
  /* 아래로 향한 화살표 */
  clip-path: polygon(42% 0, 58% 0, 58% 52%, 82% 52%, 50% 92%, 18% 52%, 42% 52%);
}

/* 현재 보고 있는 화면. 누를 수는 있지만 눈에 띌 필요는 없다. */
.masthead-link.is-current { color: var(--ink); font-weight: 600; cursor: default; }
.masthead-link.is-current:hover { color: var(--ink); }
