:root {
  --bg: #ffffff;
  --bg-1: #fafbfc;
  --bg-2: #f2f4f7;
  --line: #e6e8ec;
  --line-2: #d6dae1;
  --tx: #10151c;
  --tx-1: #4c5563;
  --tx-2: #7b8593;
  --ac: #4a3aff;
  --ac-bg: #f0efff;
  --ac-line: #cfcbff;
  --warn-bg: #fff9ec;
  --warn-line: #f0d9a8;
  --shadow: 0 1px 2px rgb(16 21 28 / .04), 0 8px 24px rgb(16 21 28 / .06);
  --nav-w: 292px;
  --rail-w: 236px;
  --top-h: 56px;
  --radius: 10px;
  color-scheme: light;
}
/* 다크는 **시스템 설정이 기본**이고, 토글하면 그 선택이 이긴다. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --bg-1: #141920;
    --bg-2: #1b212a;
    --line: #262d38;
    --line-2: #333c4a;
    --tx: #e8ebef;
    --tx-1: #a9b2be;
    --tx-2: #7c8695;
    --ac: #9d94ff;
    --ac-bg: #201f3d;
    --ac-line: #3a3670;
    --warn-bg: #2a2415;
    --warn-line: #4d4227;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216;
  --bg-1: #141920;
  --bg-2: #1b212a;
  --line: #262d38;
  --line-2: #333c4a;
  --tx: #e8ebef;
  --tx-1: #a9b2be;
  --tx-2: #7c8695;
  --ac: #9d94ff;
  --ac-bg: #201f3d;
  --ac-line: #3a3670;
  --warn-bg: #2a2415;
  --warn-line: #4d4227;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 24px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--tx);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  font-size: 15.5px;
  line-height: 1.78;
  letter-spacing: -0.003em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ac); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd {
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg);
  color: var(--tx-2);
  font-family: inherit;
  font-size: 11px;
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; padding: 8px 12px; background: var(--bg); border: 1px solid var(--ac); border-radius: 8px; }

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--top-h);
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top__brand { display: flex; align-items: center; gap: 9px; color: var(--tx); }
.top__brand:hover { text-decoration: none; }
.top__mark { width: 26px; height: 26px; border-radius: 6px; object-fit: contain; }
.top__name { font-weight: 700; letter-spacing: -0.01em; }
.top__kind { padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--tx-2); font-size: 11.5px; font-weight: 600; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 260px;
  margin-left: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg-1);
  color: var(--tx-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.search:hover { border-color: var(--ac); color: var(--tx-1); }
.search kbd { margin-left: auto; }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.top__stamp { color: var(--tx-2); font-size: 12px; }
.iconbtn, .top__burger { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--tx-1); cursor: pointer; }
.iconbtn:hover, .top__burger:hover { border-color: var(--line-2); color: var(--tx); }
.top__burger { display: none; }

.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--rail-w); align-items: start; max-width: 1560px; margin: 0 auto; }

.nav { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 22px 14px 60px 20px; border-right: 1px solid var(--line); }
.nav__group + .nav__group { margin-top: 22px; }
.nav__label { margin: 0 0 6px 10px; color: var(--tx-2); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; }
.nav__item { display: flex; gap: 8px; padding: 5px 10px; border-radius: 7px; color: var(--tx-1); font-size: 13.5px; line-height: 1.5; }
.nav__item:hover { background: var(--bg-2); color: var(--tx); text-decoration: none; }
.nav__num { flex: 0 0 auto; min-width: 20px; color: var(--tx-2); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.nav__item.is-active { background: var(--ac-bg); color: var(--ac); font-weight: 600; }
.nav__item.is-active .nav__num { color: var(--ac); }

.main { min-width: 0; padding: 28px 56px 96px; }

/* 우측 목차 — 지금 페이지 안에서만 움직인다. 좌측(문서 전체)과 역할이 겹치지 않는다. */
/*
 * 레일 자체를 화면 높이로 붙인다. 안쪽 요소만 sticky 로 두면 **부모(레일)의 높이가 내용만큼**이라
 * 그 밖으로 스크롤하는 순간 붙을 자리가 없어져 목차가 사라진다(실제로 사라졌다).
 */
.rail { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 28px 20px 60px 0; }
.rail__inner { }
.rail__title { margin-bottom: 8px; color: var(--tx-2); font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; }
.rail__item { display: block; padding: 3px 0 3px 12px; border-left: 2px solid var(--line); color: var(--tx-2); font-size: 12.5px; line-height: 1.55; }
.rail__item--l2 { padding-left: 22px; }
.rail__item:hover { color: var(--tx); text-decoration: none; }
.rail__item.is-active { border-left-color: var(--ac); color: var(--ac); font-weight: 600; }

.crumb { display: flex; align-items: center; gap: 7px; color: var(--tx-2); font-size: 12.5px; }
.crumb b { color: var(--tx-1); font-weight: 600; }

.hero { margin: 10px 0 34px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.hero h1 { margin: 6px 0 0; font-size: 34px; line-height: 1.28; letter-spacing: -0.025em; }
.hero__lead { margin: 12px 0 0; color: var(--tx-1); font-size: 16.5px; line-height: 1.7; }
.hero__eyebrow { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--ac-bg); color: var(--ac); font-size: 12px; font-weight: 700; }
.hero--home { border-bottom: 0; }
.hero--home h1 { font-size: 40px; margin-top: 14px; }

.doc { max-width: 780px; }
.doc h2.hd { margin: 52px 0 14px; padding-top: 8px; font-size: 21px; letter-spacing: -0.02em; scroll-margin-top: calc(var(--top-h) + 20px); }
.doc h3.hd { margin: 32px 0 10px; font-size: 16.5px; scroll-margin-top: calc(var(--top-h) + 20px); }
.hd__link { margin-left: 8px; color: var(--tx-2); font-weight: 400; opacity: 0; }
.hd:hover .hd__link { opacity: 1; }
.doc p { margin: 12px 0; }
.doc ul, .doc ol { margin: 12px 0; padding-left: 21px; }
.doc li { margin: 5px 0; }
.doc li > ul, .doc li > ol { margin: 4px 0; }
.doc hr { margin: 40px 0; border: 0; border-top: 1px solid var(--line); }
.doc p.subsec { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--top-h) + 20px); }
/* 굵은 글씨 한 줄짜리 소제목은 구분선 없이 여백만 준다 — 선이 잦으면 문서가 표처럼 갈라져 보인다. */
.doc p.subsec--tight { margin-top: 30px; padding-top: 0; border-top: 0; }
.doc p.subsec--tight > strong { font-size: 15.5px; }
.doc p.subsec > strong:first-child { font-size: 16.5px; }
.doclink { border-bottom: 1px dashed var(--line-2); color: var(--tx-1); cursor: help; }

.doc blockquote { margin: 18px 0; padding: 14px 18px; border: 1px solid var(--warn-line); border-left-width: 3px; border-radius: var(--radius); background: var(--warn-bg); }
.doc blockquote p { margin: 6px 0; }

.doc code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg-1); font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 0.86em; }
.doc pre { margin: 18px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); overflow-x: auto; line-height: 1.6; }
.doc pre code { padding: 0; border: 0; background: none; font-size: 13px; }

/* ── 흐름도 ── */
.flow { list-style: none; margin: 24px 0; padding: 0; }
.flow__step { position: relative; display: flex; gap: 14px; padding: 0 0 20px 0; }
/* 단계를 잇는 선 — 마지막 단계 뒤에는 그리지 않는다(끊긴 선처럼 보인다). */
.flow__step::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--line); }
.flow__step:last-child { padding-bottom: 0; }
.flow__step:last-child::before { display: none; }
.flow__n {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 1px solid var(--ac-line);
  border-radius: 50%;
  background: var(--ac-bg);
  color: var(--ac);
  font-size: 12.5px;
  font-weight: 700;
}
.flow__body { padding-top: 2px; }
.flow__body b { display: block; font-size: 15px; }
.flow__body span { display: block; color: var(--tx-1); font-size: 13.5px; line-height: 1.65; }
.flow__more { color: var(--tx-2) !important; }

.flowline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 22px 0; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); }
.flowline__step { padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg); font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.flowline__arrow { color: var(--tx-2); font-style: normal; }

.tablebox { margin: 20px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc thead th { background: var(--bg-1); text-align: left; font-weight: 700; white-space: nowrap; }
.doc th, .doc td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc tbody tr:hover { background: var(--bg-1); }

.pager { display: flex; gap: 12px; max-width: 780px; margin-top: 56px; }
.pager__item { flex: 1; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--tx); }
.pager__item:hover { border-color: var(--ac); background: var(--bg-1); text-decoration: none; }
.pager__item span { display: block; color: var(--tx-2); font-size: 12px; }
.pager__item b { font-size: 14px; font-weight: 600; }
.pager__item--next { text-align: right; }

.doc--home { max-width: 780px; color: var(--tx-1); }
.grp { max-width: 1100px; margin-top: 46px; }
.grp__head h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.grp__head p { margin: 4px 0 16px; color: var(--tx-2); font-size: 13.5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 12px; }
.card { display: flex; flex-direction: column; gap: 3px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--tx); transition: border-color .12s, box-shadow .12s, transform .12s; }
.card:hover { border-color: var(--ac-line); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.card__num { color: var(--ac); font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; }
.card__title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card__lead { margin-top: 2px; color: var(--tx-2); font-size: 12.5px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: start center; padding-top: 12vh; background: rgb(10 13 18 / .45); }
.modal[hidden] { display: none; }
.modal__box { width: min(620px, 92vw); border: 1px solid var(--line); border-radius: 14px; background: var(--bg); box-shadow: var(--shadow); overflow: hidden; }
.modal__input { width: 100%; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--tx); font: inherit; font-size: 15px; }
.modal__input:focus { outline: none; }
.modal__list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.modal__item { display: block; padding: 9px 12px; border-radius: 8px; color: var(--tx); }
.modal__item:hover, .modal__item.is-on { background: var(--bg-2); text-decoration: none; }
.modal__item b { display: block; font-size: 14px; font-weight: 600; }
.modal__item span { color: var(--tx-2); font-size: 12px; }
.modal__none { padding: 22px; color: var(--tx-2); font-size: 13.5px; text-align: center; }
.modal__foot { padding: 9px 14px; border-top: 1px solid var(--line); color: var(--tx-2); font-size: 11.5px; }

@media (max-width: 1240px) {
  .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .rail { display: none; }
  .main { padding: 28px 40px 96px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .top__burger { display: grid; }
  .search { width: auto; }
  .search span { display: none; }
  .nav { position: fixed; top: var(--top-h); left: 0; width: 300px; z-index: 25; background: var(--bg); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .nav.is-open { transform: none; }
  .main { padding: 20px 20px 80px; }
  .hero h1 { font-size: 27px; }
  .hero--home h1 { font-size: 30px; }
  .top__stamp { display: none; }
}
@media print {
  .top, .nav, .rail, .pager, .modal, .hd__link { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
}
