/* ==========================================================================
   알마니 Open API Docs — 디자인 시스템 (단일 CSS)
   - 외부 리소스 0건: 시스템 폰트 스택만 사용
   - 라이트 기본 + prefers-color-scheme 다크 + html[data-theme] 토글 오버라이드
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 토큰
   -------------------------------------------------------------------------- */
:root {
  /* 치수 */
  --header-h: 60px;
  --sidebar-w: 260px;
  --content-max: 720px;
  --codepanel-w: 420px;

  /* 폰트 (시스템 스택) */
  --font-sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Segoe UI", "Malgun Gothic", "Noto Sans KR", Roboto, Helvetica, Arial,
    sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;

  /* 라이트 팔레트 — 잉크 네이비 중립 + 옐로 액센트 */
  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --bg-hover: #eef0f4;
  --border: #e4e7ec;
  --border-strong: #d2d7e0;
  --ink-strong: #16233c;
  --ink: #35435c;
  --ink-soft: #5e6b83;
  --ink-faint: #8b96a9;
  --accent: #b58900;            /* 라이트 배경 위 텍스트/아이콘용(어둡게 보정) */
  --accent-raw: #f5c400;        /* 브랜드 원색 */
  --accent-bg: #fdf6da;         /* 액센트 연배경 */
  --danger: #d64545;
  --danger-bg: #fbecec;
  --success: #1a9e5c;
  --success-bg: #e6f6ee;
  --warn: #c07a12;
  --warn-bg: #fcf2e2;
  --info: #35507d;
  --info-bg: #eef2f8;

  /* 메서드 뱃지 */
  --method-get: #2270c7;    --method-get-bg: #e8f1fb;
  --method-post: #1a9e5c;   --method-post-bg: #e6f6ee;
  --method-put: #7a4fd6;    --method-put-bg: #f1ebfb;
  --method-delete: #d64545; --method-delete-bg: #fbecec;

  /* 코드 패널 — 테마와 무관하게 항상 다크 */
  --code-bg: #10192b;
  --code-bg-2: #172236;
  --code-border: #26334d;
  --code-ink: #dde4ef;
  --code-ink-soft: #8593ab;
  --code-accent: #f5c400;

  --shadow: 0 8px 28px rgba(22, 35, 60, 0.14);
  --radius: 10px;
}

/* 시스템 다크 모드 (토글 미설정 시) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1522;
    --bg-subtle: #151d2e;
    --bg-hover: #1c2639;
    --border: #253048;
    --border-strong: #33405c;
    --ink-strong: #f1f4f9;
    --ink: #ccd4e2;
    --ink-soft: #97a3b8;
    --ink-faint: #6d7a91;
    --accent: #f5c400;
    --accent-bg: rgba(245, 196, 0, 0.13);
    --danger: #ef7070;
    --danger-bg: rgba(214, 69, 69, 0.16);
    --success: #4cc98a;
    --success-bg: rgba(26, 158, 92, 0.16);
    --warn: #e2a13f;
    --warn-bg: rgba(192, 122, 18, 0.16);
    --info: #9fb4d8;
    --info-bg: rgba(84, 110, 160, 0.18);
    --method-get: #6aa8f0;    --method-get-bg: rgba(34, 112, 199, 0.2);
    --method-post: #4cc98a;   --method-post-bg: rgba(26, 158, 92, 0.2);
    --method-put: #ab8cec;    --method-put-bg: rgba(122, 79, 214, 0.22);
    --method-delete: #ef7070; --method-delete-bg: rgba(214, 69, 69, 0.2);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  }
}

/* 토글 오버라이드 — 미디어쿼리보다 우선 (특이도 상승) */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --bg-hover: #eef0f4;
  --border: #e4e7ec;
  --border-strong: #d2d7e0;
  --ink-strong: #16233c;
  --ink: #35435c;
  --ink-soft: #5e6b83;
  --ink-faint: #8b96a9;
  --accent: #b58900;
  --accent-bg: #fdf6da;
  --danger: #d64545;
  --danger-bg: #fbecec;
  --success: #1a9e5c;
  --success-bg: #e6f6ee;
  --warn: #c07a12;
  --warn-bg: #fcf2e2;
  --info: #35507d;
  --info-bg: #eef2f8;
  --method-get: #2270c7;    --method-get-bg: #e8f1fb;
  --method-post: #1a9e5c;   --method-post-bg: #e6f6ee;
  --method-put: #7a4fd6;    --method-put-bg: #f1ebfb;
  --method-delete: #d64545; --method-delete-bg: #fbecec;
  --shadow: 0 8px 28px rgba(22, 35, 60, 0.14);
}
:root[data-theme="dark"] {
  --bg: #0f1522;
  --bg-subtle: #151d2e;
  --bg-hover: #1c2639;
  --border: #253048;
  --border-strong: #33405c;
  --ink-strong: #f1f4f9;
  --ink: #ccd4e2;
  --ink-soft: #97a3b8;
  --ink-faint: #6d7a91;
  --accent: #f5c400;
  --accent-bg: rgba(245, 196, 0, 0.13);
  --danger: #ef7070;
  --danger-bg: rgba(214, 69, 69, 0.16);
  --success: #4cc98a;
  --success-bg: rgba(26, 158, 92, 0.16);
  --warn: #e2a13f;
  --warn-bg: rgba(192, 122, 18, 0.16);
  --info: #9fb4d8;
  --info-bg: rgba(84, 110, 160, 0.18);
  --method-get: #6aa8f0;    --method-get-bg: rgba(34, 112, 199, 0.2);
  --method-post: #4cc98a;   --method-post-bg: rgba(26, 158, 92, 0.2);
  --method-put: #ab8cec;    --method-put-bg: rgba(122, 79, 214, 0.22);
  --method-delete: #ef7070; --method-delete-bg: rgba(214, 69, 69, 0.2);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   2. 리셋 / 베이스
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  word-break: keep-all;
}
h1, h2, h3, h4 {
  color: var(--ink-strong);
  line-height: 1.35;
  margin: 0 0 12px;
}
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 700; margin-top: 8px; }
h3 { font-size: 17px; font-weight: 600; margin-top: 32px; }
h4 { font-size: 15px; font-weight: 600; margin-top: 24px; }
p  { margin: 0 0 14px; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0 0 14px; padding-left: 22px; }
img { max-width: 100%; }
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
}
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-hover);
  color: var(--ink-strong);
  border-radius: 5px;
  padding: 2px 6px;
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 20px;
  font-size: 14px;
}
th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--ink-faint);
  font-size: 12.5px;
  font-weight: 600;
  background: var(--bg-subtle);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   3. 상단 헤더 바
   -------------------------------------------------------------------------- */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.docs-logo {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.docs-logo:hover { text-decoration: none; }
.docs-logo b { color: var(--accent); font-weight: 800; }
.header-spacer { flex: 1; }

/* 햄버거 (모바일 전용) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  padding: 8px;
}
.nav-toggle:hover { background: var(--bg-hover); }
.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-strong);
}

/* 테마 토글 */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--ink-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
/* 라이트에서는 달(다크로 전환), 다크에서는 해(라이트로 전환) 아이콘 */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  .theme-toggle .icon-sun { display: block; }
  .theme-toggle .icon-moon { display: none; }
}
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* --------------------------------------------------------------------------
   4. 사이드바
   -------------------------------------------------------------------------- */
#docs-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 40;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 16px 12px 48px;
}
.nav-group-label {
  margin: 22px 12px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-faint);
}
.nav-group-label:first-child { margin-top: 6px; }
.nav-list,
.nav-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-link {
  display: block;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}
.nav-link:hover {
  background: var(--bg-hover);
  text-decoration: none;
}
.nav-link.is-active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}
.nav-sublist { margin: 2px 0 6px; }
.nav-sublink {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 12px 5px 24px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.nav-sublink:hover { background: var(--bg-hover); text-decoration: none; }
.nav-sublink.is-active { color: var(--accent); font-weight: 600; }
.nav-method {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  width: 30px;
}
.nav-method.m-get { color: var(--method-get); }
.nav-method.m-post { color: var(--method-post); }
.nav-method.m-put { color: var(--method-put); }
.nav-method.m-delete { color: var(--method-delete); }

/* 사이드바 섹션 전환 탭 (가이드 ↔ API 레퍼런스, JS가 renderSidebar에서 삽입) */
.sidebar-section-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
  margin: -16px -12px 12px;
  padding: 12px 12px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.sidebar-section-tabs .section-tab {
  flex: 1 1 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--ink-soft);
}
.sidebar-section-tabs .section-tab:hover {
  color: var(--ink-strong);
  background: var(--bg-hover);
  text-decoration: none;
}
.sidebar-section-tabs .section-tab.is-active {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent);
  font-weight: 700;
}

/* 모바일 오버레이 배경 (JS가 .sidebar-backdrop 삽입) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(10, 15, 26, 0.45);
}
body.sidebar-open .sidebar-backdrop { display: block; }

/* --------------------------------------------------------------------------
   5. 본문 레이아웃
   -------------------------------------------------------------------------- */
.docs-main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--header-h) + 40px) 40px 96px;
  max-width: calc(var(--content-max) + var(--codepanel-w) + 128px);
}
.doc-prose {
  max-width: var(--content-max);
  margin-bottom: 40px;
}

/* 엔드포인트 섹션: 본문 + 우측 sticky 코드 패널 2컬럼 */
.endpoint {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, var(--codepanel-w));
  gap: 48px;
  align-items: start;
  padding: 48px 0 56px;
  border-top: 1px solid var(--border);
}
.endpoint-doc {
  max-width: var(--content-max);
  min-width: 0;
}
.endpoint .code-panel-col {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 엔드포인트 헤더 (메서드 + 경로) */
.endpoint-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}
.endpoint-path {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-strong);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
}

/* --------------------------------------------------------------------------
   6. 메서드 뱃지 / 상태 pill / 필수 뱃지
   -------------------------------------------------------------------------- */
.method-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 6px;
}
.method-get    { color: var(--method-get);    background: var(--method-get-bg); }
.method-post   { color: var(--method-post);   background: var(--method-post-bg); }
.method-put    { color: var(--method-put);    background: var(--method-put-bg); }
.method-delete { color: var(--method-delete); background: var(--method-delete-bg); }

/* 템플릿 상태 pill: REG 등록 / REQ 심사요청 / APR 승인 / REJ 반려 / UPT 수정 */
.status-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--ink-soft);
}
.status-pill[data-status="REG"] { background: var(--bg-hover);    color: var(--ink-soft); }
.status-pill[data-status="REQ"] { background: var(--method-get-bg); color: var(--method-get); }
.status-pill[data-status="APR"] { background: var(--success-bg);  color: var(--success); }
.status-pill[data-status="REJ"] { background: var(--danger-bg);   color: var(--danger); }
.status-pill[data-status="UPT"] { background: var(--warn-bg);     color: var(--warn); }

.badge-required {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--danger);
}
.badge-optional {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-faint);
}

/* --------------------------------------------------------------------------
   7. 파라미터 표 (행형 정의 리스트 + 중첩 들여쓰기)
   -------------------------------------------------------------------------- */
.param-table {
  border-top: 1px solid var(--border);
  margin: 8px 0 28px;
}
.param-row {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.param-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.param-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-strong);
}
.param-type {
  font-size: 12.5px;
  color: var(--ink-faint);
}
.param-desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}
.param-desc code { font-size: 0.86em; }
/* 중첩 들여쓰기 + 좌측 가이드라인 */
.param-row.nested-1 {
  margin-left: 14px;
  padding-left: 18px;
  border-left: 2px solid var(--border-strong);
}
.param-row.nested-2 {
  margin-left: 46px;
  padding-left: 18px;
  border-left: 2px solid var(--border-strong);
}

/* --------------------------------------------------------------------------
   8. 코드 패널 (항상 다크) + 언어 탭 + 응답 탭 + 복사 버튼
   -------------------------------------------------------------------------- */
.code-panel {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  background: var(--code-bg-2);
  border-bottom: 1px solid var(--code-border);
}
.code-panel-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--code-ink-soft);
  letter-spacing: 0.02em;
}
.lang-tabs,
.response-tabs {
  display: flex;
  gap: 4px;
}
.lang-tab,
.response-tab {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--code-ink-soft);
  padding: 5px 10px;
  border-radius: 6px;
  line-height: 1.3;
}
.lang-tab:hover,
.response-tab:hover { color: var(--code-ink); }
.lang-tab.is-active,
.response-tab.is-active {
  color: var(--code-bg);
  background: var(--code-accent);
}
.response-tab[data-response="error"].is-active {
  color: #fff;
  background: #c14f4f;
}

.code-block { position: relative; }
.code-block pre {
  margin: 0;
  padding: 16px 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--code-ink);
  tab-size: 2;
}
.code-block[hidden] { display: none; }

/* 언어 전환: html[data-code-lang] 기준으로 페이지 전체 동기화 */
.code-block[data-lang] { display: none; }
html[data-code-lang="curl"] .code-block[data-lang="curl"] { display: block; }
html[data-code-lang="java"] .code-block[data-lang="java"] { display: block; }
/* JS 미동작(no-js) 시 cURL만 노출 */
html:not([data-code-lang]) .code-block[data-lang="curl"] { display: block; }

/* 복사 버튼 (JS가 각 .code-block에 삽입) */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--code-ink-soft);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 4px 9px;
  opacity: 0;
  transition: opacity 0.15s;
}
.code-block:hover .copy-btn,
.copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--code-ink); background: rgba(255, 255, 255, 0.14); }
.copy-btn.is-copied { color: var(--code-accent); border-color: var(--code-accent); }

/* --------------------------------------------------------------------------
   9. 콜아웃
   -------------------------------------------------------------------------- */
.callout {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 14px;
  color: var(--ink);
}
.callout > :last-child { margin-bottom: 0; }
.callout-info   { background: var(--info-bg); }
.callout-tip    { background: var(--accent-bg); }
.callout-warn   { background: var(--warn-bg); }
.callout-danger { background: var(--danger-bg); }
.callout-title {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 4px;
  color: var(--ink-strong);
}
.callout-info   .callout-title { color: var(--info); }
.callout-tip    .callout-title { color: var(--accent); }
.callout-warn   .callout-title { color: var(--warn); }
.callout-danger .callout-title { color: var(--danger); }

/* --------------------------------------------------------------------------
   10. 앵커 링크 복사 버튼 (JS가 h2/h3에 삽입)
   -------------------------------------------------------------------------- */
.anchor-btn {
  margin-left: 8px;
  font-size: 0.8em;
  font-weight: 400;
  color: var(--ink-faint);
  opacity: 0;
  transition: opacity 0.15s;
  vertical-align: middle;
}
h2:hover .anchor-btn,
h3:hover .anchor-btn,
.anchor-btn:focus-visible { opacity: 1; }
.anchor-btn:hover { color: var(--accent); }
.anchor-btn.is-copied { color: var(--accent); opacity: 1; }

/* --------------------------------------------------------------------------
   11. 반응형
   -------------------------------------------------------------------------- */
/* 1280px 미만: 코드 패널이 본문 아래로 */
@media (max-width: 1279.98px) {
  .endpoint { grid-template-columns: minmax(0, var(--content-max)); }
  .endpoint .code-panel-col {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* 768px 미만: 사이드바 오버레이 + 햄버거 */
@media (max-width: 767.98px) {
  .docs-main { margin-left: 0; padding: calc(var(--header-h) + 28px) 20px 72px; }
  .nav-toggle { display: flex; }
  #docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
    width: min(300px, 84vw);
  }
  #docs-sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }
  h1 { font-size: 25px; }
  h2 { font-size: 20px; }
  .endpoint { padding: 36px 0 44px; }
}

/* ==========================================================================
   v1.1 — 상단 검색 · 헤더 내비(가이드/API/블로그) · 우측 페이지 목차
   ========================================================================== */

/* 헤더 내비 */
.header-nav { display: flex; align-items: center; gap: 4px; margin-right: 8px; }
.header-nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; white-space: nowrap;
}
.header-nav a:hover { color: var(--ink-strong); background: var(--bg-hover); }
.header-nav a.active { color: var(--accent); }
@media (max-width: 900px) { .header-nav { display: none; } }

/* 상단 검색 */
.header-search { position: relative; margin: 0 16px; flex: 0 1 360px; }
.header-search input {
  width: 100%; box-sizing: border-box; height: 36px; padding: 0 12px 0 34px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-subtle); color: var(--ink);
  font-size: 14px; font-family: var(--font-sans);
}
.header-search input:focus { border-color: var(--accent); background: var(--bg); }
.header-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.header-search .search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-faint); pointer-events: none;
}
.header-search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--ink-faint); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; background: var(--bg); font-family: var(--font-mono);
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18); overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.search-results[hidden] { display: none; }
.search-results a {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  text-decoration: none; color: var(--ink); font-size: 13.5px;
}
.search-results a .grp { color: var(--ink-faint); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.search-results a:hover, .search-results a.selected { background: var(--bg-hover); }
.search-results .no-result { padding: 12px 14px; color: var(--ink-faint); font-size: 13px; }
@media (max-width: 640px) { .header-search { flex: 1 1 auto; margin: 0 8px; } .header-search kbd { display: none; } }

/* 우측 페이지 목차 (≥1400px 고정 레일) */
.page-toc {
  display: none; position: fixed; z-index: 30;
  top: calc(var(--header-h) + 32px); right: 20px; width: 190px;
  max-height: calc(100vh - var(--header-h) - 64px); overflow-y: auto;
  font-size: 12.5px; line-height: 1.5;
}
.page-toc .toc-title {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); margin: 0 0 8px; padding-left: 12px;
}
.page-toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.page-toc li a {
  display: block; padding: 4px 0 4px 12px; color: var(--ink-soft); text-decoration: none;
  border-left: 2px solid transparent; margin-left: -2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page-toc li.lv3 a { padding-left: 24px; font-size: 12px; }
.page-toc li a:hover { color: var(--ink-strong); }
.page-toc li a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 700; }
@media (min-width: 1400px) {
  .page-toc { display: block; }
  /* 페이지 목차가 실제로 생성된 페이지에서만 우측 여백 확보 */
  body.has-page-toc .docs-main { padding-right: 240px; }
}

/* 좁은 화면용 인라인 목차 */
.page-toc-inline {
  margin: 0 0 28px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-subtle); font-size: 13.5px;
}
.page-toc-inline summary {
  cursor: pointer; padding: 10px 16px; font-weight: 700; color: var(--ink-strong);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.page-toc-inline summary::before { content: "≡"; color: var(--accent); font-weight: 800; }
.page-toc-inline ul { margin: 0; padding: 0 16px 12px 20px; }
.page-toc-inline li { margin: 3px 0; }
.page-toc-inline a { color: var(--ink-soft); text-decoration: none; }
.page-toc-inline a:hover { color: var(--accent); }
@media (min-width: 1400px) { .page-toc-inline { display: none; } }
