/* KeepGong frontend baseline CSS — D51b
 * 실측 RemNote 토큰 (Specs/KeepGong/DesignSystem/KeepGongTokenSpec.lean)
 * Atlassian 8px grid spacing
 *
 * D52 cycle/d52-refine-ui: Stitch v8 + RemNote features 반영.
 *   멀티휴 accent(blue/cyan/purple) + Refine 분할 워크스페이스(.kg-topnav/.kg-refine-split/.kg-problem-card)
 *   ← Specs/KeepGong/DesignSystem/RefineWorkspaceSpec.lean (@sync). 색은 ComponentStatus 파생.
 */

/* Noto Sans KR (디자이너 기준, 2026-06-04) — 한글/라틴 공통. 수식/코드만 JetBrains Mono. */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;800;900&display=swap');

:root {
  /* Foundation / Color — synced from Figma `colors` collection (node 33:3, 2026-06-12). */
  --base-grey-50: #f9fafb;
  --base-grey-100: #f2f4f6;
  --base-grey-200: #e5e8eb;
  --base-grey-300: #d1d6db;
  --base-grey-400: #b0b8c1;
  --base-grey-500: #8b95a1;
  --base-grey-600: #6b7684;
  --base-grey-700: #4e5968;
  --base-grey-800: #333d4b;
  --base-grey-900: #191f28;
  --base-grey-950: #0b0c0e;
  --base-blue-50: #edf4fd;
  --base-blue-100: #c5ddf9;
  --base-blue-200: #9cc6f6;
  --base-blue-300: #73aff3;
  --base-blue-400: #4997f2;
  --base-blue-500: #1e80f1;
  --base-blue-600: #0f68ce;
  --base-blue-700: #0d519f;
  --base-blue-800: #0b3a71;
  --base-blue-900: #072343;
  --base-blue-950: #030c17;
  --base-red-50: #ffeeee;
  --base-red-100: #ffd4d6;
  --base-red-200: #feafb4;
  --base-red-300: #fb8890;
  --base-red-400: #f66570;
  --base-red-500: #f04452;
  --base-red-600: #e42939;
  --base-red-700: #d22030;
  --base-red-800: #bc1b2a;
  --base-red-900: #a51926;
  --base-red-950: #48070e;
  --base-orange-50: #fff3e0;
  --base-orange-100: #ffe0b0;
  --base-orange-200: #ffcd80;
  --base-orange-300: #ffbd51;
  --base-orange-400: #ffa927;
  --base-orange-500: #fe9800;
  --base-orange-600: #fb8800;
  --base-orange-700: #f57800;
  --base-orange-800: #ed6700;
  --base-orange-900: #e45600;
  --base-orange-950: #752d00;
  --base-yellow-50: #fff9e7;
  --base-yellow-100: #ffefbf;
  --base-yellow-200: #ffe69b;
  --base-yellow-300: #ffdd78;
  --base-yellow-400: #ffd158;
  --base-yellow-500: #ffc342;
  --base-yellow-600: #ffb331;
  --base-yellow-700: #faa131;
  --base-yellow-800: #ee8f11;
  --base-yellow-900: #dd7d02;
  --base-yellow-950: #a25e07;
  --base-green-50: #f0faf6;
  --base-green-100: #aeefd5;
  --base-green-200: #76e4b8;
  --base-green-300: #3fd599;
  --base-green-400: #15c47e;
  --base-green-500: #03b26c;
  --base-green-600: #02a262;
  --base-green-700: #068d57;
  --base-green-800: #0b754b;
  --base-green-900: #0f563a;
  --base-green-950: #18513a;
  --base-teal-50: #edf8f8;
  --base-teal-100: #bce9e9;
  --base-teal-200: #89d8d8;
  --base-teal-300: #58c7c7;
  --base-teal-400: #30b6b6;
  --base-teal-500: #18a5a5;
  --base-teal-600: #109595;
  --base-teal-700: #0c8585;
  --base-teal-800: #097575;
  --base-teal-900: #076565;
  --base-teal-950: #074a4a;
  --base-purple-50: #f9f0fc;
  --base-purple-100: #edccf8;
  --base-purple-200: #da9bef;
  --base-purple-300: #c770e4;
  --base-purple-400: #b44bd7;
  --base-purple-500: #a234c7;
  --base-purple-600: #9128b4;
  --base-purple-700: #8222a2;
  --base-purple-800: #73228e;
  --base-purple-900: #65237b;
  --base-purple-950: #3c0e3c;

  --semantic-background-default: #ffffff;
  --semantic-background-subtle: var(--base-grey-50);
  --semantic-background-dimmed: #0000008f;
  --semantic-background-inverse: var(--base-grey-900);
  --semantic-background-strong: var(--base-grey-100);
  --semantic-fill-brand: var(--base-blue-400);
  --semantic-fill-secondary: var(--base-teal-300);
  --semantic-fill-default: #ffffff;
  --semantic-fill-danger: var(--base-red-500);
  --semantic-fill-info: var(--base-teal-500);
  --semantic-fill-inverse: var(--base-grey-900);
  --semantic-fill-muted: var(--base-grey-100);
  --semantic-fill-strong: var(--base-grey-200);
  --semantic-fill-subtle: var(--base-grey-50);
  --semantic-fill-success: var(--base-green-500);
  --semantic-fill-warning: var(--base-yellow-500);
  --semantic-text-primary: var(--base-grey-900);
  --semantic-text-secondary: var(--base-grey-700);
  --semantic-text-secondary-brand: var(--base-teal-700);
  --semantic-text-brand: var(--base-blue-600);
  --semantic-text-danger: var(--base-red-600);
  --semantic-text-disabled: var(--base-grey-400);
  --semantic-text-inverse: #ffffff;
  --semantic-text-success: var(--base-green-600);
  --semantic-text-tertiary: var(--base-grey-500);
  --semantic-text-muted: var(--semantic-text-tertiary);
  --semantic-text-warning: var(--base-orange-600);
  --semantic-icon-brand: var(--base-blue-500);
  --semantic-icon-danger: var(--base-red-500);
  --semantic-icon-disabled: var(--base-grey-400);
  --semantic-icon-inverse: #ffffff;
  --semantic-icon-primary: var(--base-grey-900);
  --semantic-icon-secondary: var(--base-grey-700);
  --semantic-icon-success: var(--base-green-500);
  --semantic-icon-tertiary: var(--base-grey-500);
  --semantic-icon-muted: var(--semantic-icon-tertiary);
  --semantic-border-danger: var(--base-red-500);
  --semantic-border-default: var(--base-grey-200);
  --semantic-border-focus: var(--base-blue-500);
  --semantic-border-strong: var(--base-grey-300);
  --semantic-border-subtle: var(--base-grey-100);
  --semantic-state-brand-hover: var(--base-blue-600);
  --semantic-state-danger-hover: var(--base-red-600);
  --semantic-state-disabled-content: var(--base-grey-400);
  --semantic-state-disabled-fill: var(--base-grey-100);
  --semantic-state-inverse-hover: var(--base-grey-800);
  --semantic-state-success-hover: var(--base-green-600);
  --semantic-status-brand-content-strong: var(--base-blue-700);
  --semantic-status-brand-soft-fill: var(--base-blue-50);
  --semantic-status-brand-subtle: var(--base-blue-100);
  --semantic-status-danger-border: var(--base-red-200);
  --semantic-status-danger-soft-fill: var(--base-red-50);
  --semantic-status-info-border: var(--base-purple-500);
  --semantic-status-info-soft-fill: var(--base-purple-50);
  --semantic-status-info-solid-fill: var(--base-purple-600);
  --semantic-status-neutral-soft-fill: var(--base-grey-100);
  --semantic-status-neutral-solid-fill: var(--base-grey-800);
  --semantic-status-secondary-border: var(--base-teal-200);
  --semantic-status-secondary-content: var(--base-teal-600);
  --semantic-status-secondary-soft-fill: var(--base-teal-50);
  --semantic-status-secondary-subtle: var(--base-teal-100);
  --semantic-status-success-border: var(--base-green-200);
  --semantic-status-success-soft-fill: var(--base-green-50);
  --semantic-status-warning-border: var(--base-orange-200);
  --semantic-status-warning-soft-fill: var(--base-orange-50);

  /* Legacy aliases kept stable while code migrates to foundation tokens. */
  --color-bg:           var(--semantic-background-default);
  --color-surface:      var(--semantic-background-subtle);
  --color-sunken:       var(--semantic-background-strong);
  --color-text:         var(--semantic-text-primary);
  --color-text-2:       var(--semantic-text-secondary);
  --color-text-muted:   var(--semantic-text-tertiary);
  --color-text-subtle:  var(--semantic-text-tertiary);
  --color-border:       var(--semantic-border-default);
  --color-divider:      var(--semantic-border-subtle);
  --color-accent:        var(--semantic-fill-brand);
  --color-accent-cyan:   var(--semantic-fill-secondary);
  --color-accent-purple: var(--base-purple-500);
  --color-accent-soft:   var(--base-blue-100);
  --color-accent-2:      var(--base-blue-300);
  --color-accent-bg:     var(--semantic-status-brand-soft-fill);
  --color-accent-border: var(--semantic-status-brand-subtle);
  --color-success:      var(--semantic-fill-success);
  --color-warning:      var(--semantic-fill-warning);
  --color-danger:       var(--semantic-fill-danger);
  --color-info:         var(--semantic-fill-info);
  /* Historical numbered aliases are still referenced by pre-token components.
     Keep every reference valid while those call sites migrate to semantic names. */
  --color-text-1:       var(--semantic-text-primary);
  --color-text-3:       var(--semantic-text-tertiary);
  --color-surface-1:    var(--semantic-background-subtle);
  --color-surface-2:    var(--semantic-background-strong);
  --color-danger-text:  var(--semantic-text-danger);
  /* Refine 검수 상태 (RefineWorkspaceSpec.RefineStatusColor — ComponentStatus 파생) */
  --color-status-verified-surface: #E6FAEC;  /* 구조 확인됨 (ok/approved) */
  --color-status-verified-text:    #006E2A;
  --color-status-review-surface:   #FFF4E5;  /* ★ 검토 필요 (needsFix = 안되는 부분) */
  --color-status-review-text:      #E65100;

  --semantic-button-pressed-scale: 0.9;

  /* ── Semantic roles (역할 기반 — 컴포넌트는 위 primitive 대신 이 역할 변수를 사용) ──
   * @sync Specs/KeepGong/DesignSystem/KeepGongTokenSpec.lean § 9
   * 디자인시스템.md: "원재료는 직접 쓰지 않고 역할 토큰으로 참조" */
  /* background */
  --bg-page:    var(--color-bg);
  --bg-raised:  var(--color-surface);
  --bg-sunken:  var(--color-sunken);
  /* fill (면 색) */
  --fill-primary:       var(--semantic-fill-brand);
  --fill-primary-hover: var(--semantic-state-brand-hover);
  --fill-soft:          var(--color-accent-bg);   /* 선택/활성 연한 강조 면 */
  --fill-neutral:       var(--semantic-fill-muted);
  --fill-inverse:       var(--semantic-fill-inverse);        /* 어두운(잉크) 면 */
  /* text */
  --text-primary:   var(--semantic-text-primary);
  --text-secondary: var(--semantic-text-secondary);
  --text-muted:     var(--semantic-text-muted);
  --text-subtle:    var(--color-text-subtle);
  --text-inverse:   var(--semantic-text-inverse);
  --text-accent:    var(--color-accent);
  /* icon */
  --icon-default: var(--text-secondary);
  --icon-muted:   var(--text-muted);
  --icon-accent:  var(--color-accent);
  /* border */
  --border-default: var(--semantic-border-default);
  --border-strong:  var(--semantic-border-strong);
  --border-divider: var(--semantic-border-default);
  --border-focus:   var(--semantic-border-focus);
  /* state (disabled 는 색이 아니라 opacity) */
  --state-hover:    var(--semantic-fill-subtle);
  --state-pressed:  var(--semantic-fill-strong);
  --state-selected: var(--color-accent-bg);
  --state-disabled-opacity: 0.3;                 /* 디자인시스템.md: disabled = opacity 30% */
  /* status */
  --status-success: var(--color-success);
  --status-warning: var(--color-warning);
  --status-danger:  var(--semantic-fill-danger);
  --status-info:    var(--color-info);

  /* Spacing — Atlassian 8px grid */
  --space-0:    0;
  --space-025:  2px;
  --space-050:  4px;
  --space-075:  6px;
  --space-100:  8px;
  --space-150:  12px;
  --space-200:  16px;
  --space-250:  20px;
  --space-300:  24px;
  --space-400:  32px;
  --space-500:  40px;
  --space-600:  48px;
  --space-800:  64px;
  --space-1000: 80px;

  /* Spacing roles (의미별 — 디자인시스템.md Gap/Padding/Margin) → space 그리드
   * @sync Specs/KeepGong/DesignSystem/KeepGongTokenSpec.lean § 10 */
  --gap-none: var(--space-0);
  --gap-2xs:  var(--space-025);   /* 2  label-description stack */
  --gap-xs:   var(--space-050);   /* 4 */
  --gap-sm:   var(--space-075);   /* 6 */
  --gap-md:   var(--space-100);   /* 8 */
  --gap-lg:   var(--space-150);   /* 12 */
  --gap-xl:   var(--space-250);   /* 20 */
  --gap-2xl:  var(--space-400);   /* 32 */
  --pad-none: var(--space-0);
  --pad-2xs:  var(--space-025);   /* 2  tight capsule track inset */
  --pad-sm:   var(--space-100);   /* 8 */
  --pad-md:   var(--space-150);   /* 12 */
  --pad-lg:   var(--space-200);   /* 16 */
  --pad-xl:   var(--space-250);   /* 20 */
  --pad-2xl:  var(--space-300);   /* 24 (28→24 스냅) */
  --pad-3xl:  var(--space-400);   /* 32 */
  --pad-4xl:  var(--space-500);   /* 40 */
  --pad-5xl:  var(--space-800);   /* 64 */
  --margin-none:        var(--space-0);
  --margin-sm:          var(--space-200);   /* 16 작은 블록 */
  --margin-md:          var(--space-400);   /* 32 기본 블록 */
  --margin-section:     var(--space-500);   /* 40 섹션 간격 최대 */
  --margin-page-x:      var(--space-500);   /* 40 페이지 좌우 */
  --margin-page-top:    var(--space-500);   /* 40 페이지 상단 */
  --margin-page-bottom: var(--space-1000);  /* 80 페이지 하단 */

  /* Radius — 디자이너 스케일 (디자인시스템.md, 2026-06-04). md=8 이 Input/Button/Tab 기본 */
  --radius-none: 0;
  --radius-2xs:  2px;
  --radius-xs:   4px;
  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --border-width-default: 1px;
  --decision-trace-drawer-width: 640px;
  --decision-trace-layer-backdrop: 949;
  --decision-trace-layer-drawer: 950;
  --decision-trace-backdrop-scrim: rgba(15, 23, 42, 0.18);
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 999px;

  /* Size — 컴포넌트 height (디자인시스템.md). @sync KeepGongTokenSpec.lean § 12.
     width 는 Hug/Fill, 정사각 컨트롤은 height=width. */
  --size-xs: 32px;   /* 작은 보조 */
  --size-sm: 36px;   /* 작은 보조 */
  --size-md: 48px;   /* 기본 폼/버튼 */
  --size-lg: 52px;   /* 기본 폼/버튼 (Input 기본) */
  --size-xl: 56px;   /* 큰 입력/주요 액션 */

  /* Layout */
  --sidebar-width:      240px;
  --sidebar-collapsed-width: 80px;
  --right-panel-width:  320px;
  --workbench-list-min-width: 300px;
  --header-height:      56px;
  --max-content:        1280px;
  --max-reading:        720px;
  /* Refine 분할 워크스페이스 (RefineWorkspaceSpec.WorkspacePane — source 50 | structure 50) */
  --color-surface-app:  #FAF8FF;   /* 분할 배경 (faint blue) */
  --pane-source:        50;        /* 좌 원본 비율 % (사용자 확정 5:5, 2026-06-10) */
  --pane-structure:     50;        /* 우 구조 비율 % */
  --pane-gap:           8px;

  /* Typography — Noto Sans KR (디자이너 기준). 수식/코드만 mono */
  --font-body:    "Noto Sans KR", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-display: "Noto Sans KR", -apple-system, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", "Fira Code", Menlo, monospace;
  --text-style-display-large-font-size: 56px;
  --text-style-display-medium-font-size: 48px;
  --text-style-display-small-font-size: 40px;
  --text-style-title-large-font-size: 32px;
  --text-style-title-medium-font-size: 28px;
  --text-style-title-small-font-size: 24px;
  --text-style-heading-large-font-size: 22px;
  --text-style-heading-medium-font-size: 20px;
  --text-style-heading-small-font-size: 18px;
  --text-style-body-large-font-size: 18px;
  --text-style-body-medium-font-size: 16px;
  --text-style-body-small-font-size: 14px;
  --text-style-label-large-font-size: 16px;
  --text-style-label-medium-font-size: 14px;
  --text-style-label-small-font-size: 12px;
  --text-style-caption-medium-font-size: 12px;
  --text-style-caption-small-font-size: 11px;
  --text-style-display-line-height: 1.25;
  --text-style-title-line-height: 1.3;
  --text-style-heading-line-height: 1.4;
  --text-style-body-line-height: 1.6;
  --text-style-label-line-height: 1.4;
  --text-style-caption-line-height: 1.4;
  --text-style-weight-regular: 400;
  --text-style-weight-medium: 500;
  --text-style-weight-bold: 700;

  /* LatexRenderContractSpec §D144 — 해설 산문·수식 공통 세로 리듬. */
  --solution-flow-line-height: var(--text-style-body-line-height);
  --solution-flow-line-gap: var(--space-025);

  /* Motion */
  --motion-fast:   100ms;
  --motion-base:   150ms;
  --motion-medium: 250ms;
  --motion-slow:   400ms;
  --motion-easing: cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadow — soft (organic). primitive(크기) + Figma role tokens */
  --shadow-xs: 0 1px 2px rgba(41,41,54,0.04);
  --shadow-sm: 0 2px 4px rgba(41,41,54,0.06);
  --shadow-md: 0 4px 12px rgba(41,41,54,0.08);
  --shadow-lg: 0 8px 24px rgba(41,41,54,0.10);
  /* Foundation / Shadow — synced from Figma `Shadow/*` effect styles (nodes 477:1648, 1136:3). */
  --shadow-dropdown: 0 8px 20px -4px rgba(0, 0, 0, 0.12);
  --shadow-modal:    0 12px 32px -8px rgba(20, 24, 31, 0.16);
  --shadow-card:     0 4px 12px -2px rgba(78, 89, 104, 0.10);
  --shadow-section:  0 8px 24px -8px rgba(78, 89, 104, 0.12);
  --shadow-snackbar: 0 12px 32px -8px rgba(78, 89, 104, 0.16);
  --effect-snackbar-bg-blur: 10px;
}

.kg-solution-flow {
  margin-top: var(--space-075);
  font-size: var(--text-style-body-small-font-size);
  line-height: var(--solution-flow-line-height);
}

.kg-solution-flow .kg-math {
  font-size: inherit;
  line-height: inherit;
  white-space: pre-line;
}

/* KaTeX 기본 1em 위·아래 여백은 빈 문단과 중첩돼 풀이 한 단계를 2~3줄로 만들었다. */
.kg-solution-flow .katex-display {
  margin-block: var(--solution-flow-line-gap);
}

/* Solution video scene book — @sync SolutionVideoEditorComponentsSpec §1-b.
 * Stitch screen 79d005d68a564e3696b01840918881b2를 기존 semantic token으로 정규화. */
.kg-video-book {
  margin-top: var(--margin-sm);
  padding: var(--pad-lg);
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-lg);
  background: var(--semantic-background-subtle);
  box-shadow: var(--shadow-section);
}
.kg-video-book__toolbar,
.kg-video-job__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-lg);
  margin-bottom: var(--space-150);
}
.kg-video-book__spread {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap-2xs);
  padding: var(--pad-md);
  border-radius: var(--radius-lg);
  background: var(--semantic-background-strong);
}
.kg-video-book__page {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--semantic-background-default);
  box-shadow: var(--shadow-card);
}
.kg-video-book__page:first-child { border-radius: var(--radius-md) var(--radius-2xs) var(--radius-2xs) var(--radius-md); }
.kg-video-book__page:nth-child(2) { border-radius: var(--radius-2xs) var(--radius-md) var(--radius-md) var(--radius-2xs); }
.kg-video-book__page--empty { box-shadow: none; opacity: .52; }
.kg-video-book__image { width: 100%; height: 100%; object-fit: contain; }
.kg-video-book__loading {
  padding: var(--pad-xl);
  color: var(--semantic-text-tertiary);
  font-size: var(--text-style-body-small-font-size);
  text-align: center;
}
.kg-video-book__filmstrip {
  display: flex;
  gap: var(--gap-md);
  margin-top: var(--space-150);
  padding-bottom: var(--pad-2xs);
  overflow-x: auto;
}
.kg-video-book__thumb {
  flex: 0 0 70px;
  min-height: var(--size-md);
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-md);
  background: var(--semantic-background-default);
  color: var(--semantic-text-secondary);
  font-weight: 700;
  cursor: pointer;
}
.kg-video-book__thumb.is-active {
  border-color: var(--semantic-border-focus);
  color: var(--semantic-text-brand);
  box-shadow: 0 0 0 var(--space-025) var(--semantic-status-brand-subtle);
}
.kg-video-job {
  margin-top: var(--margin-sm);
  padding: var(--pad-xl);
  border-radius: var(--radius-lg);
  background: var(--semantic-background-inverse);
  color: var(--semantic-text-inverse);
  box-shadow: var(--shadow-modal);
}
.kg-video-job__stages {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--gap-sm);
}
.kg-video-job__stage {
  padding: var(--pad-sm);
  border: 1px solid var(--base-grey-700);
  border-radius: var(--radius-sm);
  color: var(--base-grey-400);
  font-size: var(--text-style-caption-small-font-size);
  font-weight: 700;
  text-align: center;
}
.kg-video-job__stage.is-active {
  border-color: var(--base-blue-300);
  color: var(--base-blue-100);
  background: var(--base-blue-900);
}
.kg-video-job__stage.is-verified {
  border-color: var(--base-green-300);
  color: var(--base-green-100);
  background: var(--base-green-950);
}
@media (max-width: 860px) {
  .kg-video-book__spread { grid-template-columns: 1fr; }
  .kg-video-book__page:nth-child(n) { border-radius: var(--radius-md); }
  .kg-video-job__stages { grid-template-columns: 1fr; }
}

* { box-sizing: border-box; }

.kg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* disabled = 별도 회색 variant 금지, opacity 30% (디자인시스템.md state 역할) */
:disabled,
[aria-disabled="true"],
.is-disabled {
  opacity: var(--state-disabled-opacity);
  pointer-events: none;
  cursor: not-allowed;
}

/* ════════════════════════════════════════════════
 * Button component — 6 variant (디자인시스템.md Components/Button)
 * @sync Specs/KeepGong/DesignSystem/ButtonSpec.lean. 역할 변수만 사용.
 * ════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);                 /* leading/trailing icon ↔ label */
  height: 40px;                       /* Medium 기본 (W/H 토큰 바인딩 안 함, Figma 고정) */
  min-width: 56px;                    /* size별 최소폭, 라벨 중앙정렬 */
  padding: 0 var(--pad-lg);           /* 좌우 16 (상하 0) */
  border: none;
  border-radius: var(--radius-md);    /* 8 */
  font-family: var(--font-body);
  font-size: var(--text-style-label-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--motion-fast) var(--motion-easing),
              border-color var(--motion-fast) var(--motion-easing),
              color var(--motion-fast) var(--motion-easing),
              transform var(--motion-fast) var(--motion-easing);
  transform-origin: center;
}
/* size — 높이 고정 32/40/48, 좌우 padding 12/16/20 */
.btn--sm { height: var(--size-xs); padding: 0 var(--pad-md); font-size: var(--text-style-label-small-font-size); min-width: var(--size-md); }
.btn--lg { height: var(--size-md); padding: 0 var(--pad-xl); font-size: var(--text-style-label-large-font-size); min-width: var(--space-800); }
/* icon-only = 정사각 (height=width) */
.btn--icon { width: 40px; min-width: 0; padding: 0; }
.btn--icon.btn--sm { width: var(--size-xs); }
.btn--icon.btn--lg { width: var(--size-md); }

/* variants — 면(fill)/글자(text)/테두리(border) 역할 바인딩 */
.btn--cta            { background: var(--semantic-fill-brand); color: var(--semantic-text-inverse); }
.btn--cta:hover,
.btn--cta:active     { background: var(--semantic-state-brand-hover); }
.btn--default        { background: var(--semantic-fill-inverse); color: var(--semantic-text-inverse); }
.btn--default:hover,
.btn--default:active { background: var(--semantic-state-inverse-hover); }
.btn--secondary      { background: var(--semantic-fill-muted); color: var(--semantic-text-primary); }
.btn--secondary:hover,
.btn--secondary:active { background: var(--semantic-fill-strong); }
.btn--tertiary       { background: transparent; color: var(--semantic-text-secondary); }
.btn--tertiary:hover,
.btn--tertiary:active { background: var(--semantic-fill-subtle); }
.btn--danger         { background: var(--semantic-fill-danger); color: var(--semantic-text-inverse); }
.btn--danger:hover,
.btn--danger:active  { background: var(--semantic-state-danger-hover); }
.btn--inverse        { background: var(--semantic-fill-default); color: var(--semantic-text-primary); border: 1px solid var(--semantic-border-default); }
.btn--inverse:hover,
.btn--inverse:active { background: var(--semantic-fill-muted); }
/* pressed = hover 컬러 유지 + 중심 기준 90% visual surface (Figma Button node 52:195) */
.btn:active:not(:disabled):not([aria-disabled="true"]):not(.is-disabled) {
  transform: scale(var(--semantic-button-pressed-scale));
}
/* disabled = opacity 30% → 위 전역 :disabled 규칙이 처리 */

/* ════════════════════════════════════════════════
 * Input / Dropdown component (디자인시스템.md Components/Input·Dropdown)
 * @sync Specs/KeepGong/DesignSystem/InputSpec.lean. 역할 변수만 사용.
 * ════════════════════════════════════════════════ */
.field {
  --field-control-height: var(--space-500); /* Medium 40 */
  --field-symbol-height: 93px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);                  /* 라벨↔필드 6 */
  width: 100%;
}
.field--lg { --field-control-height: var(--space-600); --field-symbol-height: 101px; }
.field--md { --field-control-height: var(--space-500); --field-symbol-height: 93px; }
.field--sm { --field-control-height: var(--space-400); --field-symbol-height: 85px; }
.field--symbol { min-height: var(--field-symbol-height); }
.field-label {                          /* Label(14/Medium), 라벨 + 우측 액션 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--gap-md);
  font-size: var(--text-style-label-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  color: var(--text-secondary);
}
.field-action {                         /* 라벨 오른쪽 액션 = text/accent */
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin: 0;
  padding: 0 var(--pad-sm);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  font-size: var(--text-style-caption-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-caption-line-height);
  color: var(--text-accent);
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}
.field-action:hover { background: var(--state-hover); color: var(--text-accent); }
.field-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 18%, transparent);
}
:root {
  --select-chevron-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNy42OTkyIDEwLjAwMDgpIj48cGF0aCBkPSJNMy43NzUgNC40NzVMMC4xNSAwLjg1QzAuMSAwLjggMC4wNjI1IDAuNzQ1ODMzIDAuMDM3NSAwLjY4NzVDMC4wMTI1IDAuNjI5MTY3IDAgMC41NjY2NjcgMCAwLjVDMCAwLjM2NjY2NyAwLjA0NTgzMzMgMC4yNSAwLjEzNzUgMC4xNUMwLjIyOTE2NyAwLjA1IDAuMzUgMCAwLjUgMEg4LjFDOC4yNSAwIDguMzcwODMgMC4wNSA4LjQ2MjUgMC4xNUM4LjU1NDE3IDAuMjUgOC42IDAuMzY2NjY3IDguNiAwLjVDOC42IDAuNTMzMzMzIDguNTUgMC42NSA4LjQ1IDAuODVMNC44MjUgNC40NzVDNC43NDE2NyA0LjU1ODMzIDQuNjU4MzMgNC42MTY2NyA0LjU3NSA0LjY1QzQuNDkxNjcgNC42ODMzMyA0LjQgNC43IDQuMyA0LjdDNC4yIDQuNyA0LjEwODMzIDQuNjgzMzMgNC4wMjUgNC42NUMzLjk0MTY3IDQuNjE2NjcgMy44NTgzMyA0LjU1ODMzIDMuNzc1IDQuNDc1WiIgZmlsbD0iYmxhY2siLz48L2c+PC9zdmc+");
}

.input--lg,
.select-menu--lg,
.select-option--lg {
  --field-control-height: var(--space-600); /* 48 */
  --select-option-height: var(--size-lg);   /* 52 */
}
.input--md,
.select-menu--md,
.select-option--md {
  --field-control-height: var(--space-500); /* 40 */
  --select-option-height: var(--space-600); /* 48 */
}
.input--sm,
.select-menu--sm,
.select-option--sm {
  --field-control-height: var(--space-400); /* 32 */
  --select-option-height: var(--space-500); /* 40 */
}
.input-control {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-xs);
  width: 100%;
  height: var(--field-control-height);
  padding: 0 var(--pad-lg);
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}
.input {
  display: block;
  width: 100%;
  min-width: 0;
  height: var(--field-control-height);
  padding: 0 var(--pad-lg);            /* 16 */
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);     /* 8 */
  font-family: var(--font-body);
  font-size: var(--text-style-body-medium-font-size);
  line-height: var(--text-style-body-line-height);
  color: var(--text-primary);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.input-control .input {
  flex: 1 1 auto;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.input--sm.input,
.input-control.input--sm .input {
  font-size: var(--text-style-body-small-font-size);
}
.input::placeholder { color: var(--text-subtle); }   /* text/subtle */
.input:focus,
.input.input--focused,
.input-control:focus-within,
.input-control.input--focused,
.field--focused .input,
.field--focused .input-control,
.select-trigger.input--focused,
.select-trigger.input--open {
  outline: none;
  border-color: var(--border-focus);   /* accent */
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 15%, transparent);
}
.input-control .input:focus {
  box-shadow: none;
}
.input__affordance {
  flex: 0 0 var(--space-250);
  width: var(--space-250);
  height: var(--space-250);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--icon-muted);
  font-size: var(--text-style-label-medium-font-size);
  line-height: 1;
  opacity: 1;
  transform: translateX(0);
  transition:
    flex-basis var(--motion-medium) var(--motion-easing),
    width var(--motion-medium) var(--motion-easing),
    margin var(--motion-medium) var(--motion-easing),
    opacity var(--motion-fast) var(--motion-easing),
    transform var(--motion-medium) var(--motion-easing);
}
.input__affordance--leading { margin-left: calc(var(--pad-lg) * -0.5); }
.input__affordance--trailing { margin-right: calc(var(--pad-lg) * -0.5); }
.input-control.input--search.input--has-value .input__affordance--search {
  flex-basis: 0;
  width: 0;
  margin-left: 0;
  opacity: 0;
  transform: translateX(-3px);
  pointer-events: none;
}
.input__affordance-icon,
.input__clear-icon {
  width: var(--space-200);
  height: var(--space-200);
  display: block;
}
.input__clear {
  appearance: none;
  flex: 0 0 auto;
  width: var(--space-250);
  height: var(--space-250);
  margin-right: calc(var(--pad-lg) * -0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-full);
  color: var(--icon-muted);
  cursor: pointer;
  opacity: 1;
  transform: translateX(0);
  transition:
    background var(--motion-fast) var(--motion-easing),
    color var(--motion-fast) var(--motion-easing),
    box-shadow var(--motion-fast) var(--motion-easing),
    opacity var(--motion-fast) var(--motion-easing),
    transform var(--motion-medium) var(--motion-easing);
}
.input__clear:hover { background: var(--state-hover); color: var(--text-secondary); }
.input__clear:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 18%, transparent);
}
.input__clear[hidden] { display: none; }
.input-control.input--search .input::placeholder { color: var(--text-muted); }
.input.input--disabled,
.input-control.input--disabled,
.select-trigger.input--disabled {
  background: var(--bg-sunken);
  cursor: not-allowed;
}
.input-control.input--disabled {
  opacity: var(--state-disabled-opacity);
  pointer-events: none;
}
.input-control.input--disabled .input:disabled {
  opacity: 1;
}
.field-helper {                         /* Caption */
  font-size: var(--text-style-caption-medium-font-size);
  line-height: var(--text-style-caption-line-height);
  color: var(--text-muted);
}
/* error = border + helper + status color 동시 (색 하나에 의존 금지) */
.field--error .input,
.field--error .input-control,
.input.input--error,
.input-control.input--error,
.select-trigger.input--error { border-color: var(--status-danger); }
.field--error .input:focus,
.field--error .input-control:focus-within,
.input.input--error:focus,
.input-control.input--error:focus-within,
.select-trigger.input--error:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-danger) 15%, transparent); }
.field--error .field-helper { color: var(--status-danger); }

/* Dropdown — 닫힌 field 는 .input 재사용, 열린 목록 = .select-menu */
.select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.input__value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.input__value.is-placeholder { color: var(--text-subtle); }
.select-trigger__chevron {
  flex: 0 0 auto;
  width: var(--space-200);
  height: var(--space-200);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--icon-muted);
  background: currentColor;
  -webkit-mask: var(--select-chevron-mask) center / contain no-repeat;
  mask: var(--select-chevron-mask) center / contain no-repeat;
  mask-mode: alpha;
  transition: transform var(--motion-fast) var(--motion-easing);
}
.select-trigger.input--open .select-trigger__chevron {
  transform: rotate(180deg);
}
.select-menu {
  --select-option-height: var(--space-600);
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-dropdown);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: calc(var(--select-option-height) * 4);
  overflow-y: auto;
}
.select-option {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  width: 100%;
  height: var(--select-option-height);
  padding: 0 var(--pad-md);              /* 12 */
  border: 0;
  border-radius: var(--radius-sm);        /* 6 */
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--text-style-label-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.select-option:hover,
.select-option--hover { background: var(--semantic-fill-muted); }
.select-option[aria-selected="true"],
.select-option.is-selected {
  background: var(--state-selected);      /* accent bg */
  color: var(--text-accent);
}
.select-option__check {
  flex: 0 0 var(--space-200);
  width: var(--space-200);
  color: currentColor;
  visibility: hidden;
  line-height: 1;
}
.select-option[aria-selected="true"] .select-option__check,
.select-option.is-selected .select-option__check {
  visibility: visible;
}
/* option disabled = opacity 30% → 전역 :disabled / .is-disabled 규칙 */

/* ════════════════════════════════════════════════
 * Tab component (디자인시스템.md Components/Tab)
 * @sync Specs/KeepGong/DesignSystem/TabSpec.lean. 역할 변수만 사용.
 * ════════════════════════════════════════════════ */
:root {
  --tab-capsule-page-info-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj4KPHN2ZyB4PSIyLjUwMDgiIHk9IjMuNzQ4OCIgd2lkdGg9IjE5IiBoZWlnaHQ9IjE2LjUiIHZpZXdCb3g9IjAgMCAxOSAxNi41IiBvdmVyZmxvdz0idmlzaWJsZSIgZmlsbD0ibm9uZSI+PHBhdGggaWQ9InBhZ2VfaW5mbyIgZD0iTTEyLjU4NzUgMTUuNDEyNUMxMS44NjI1IDE0LjY4NzUgMTEuNSAxMy44IDExLjUgMTIuNzVDMTEuNSAxMS43IDExLjg2MjUgMTAuODEyNSAxMi41ODc1IDEwLjA4NzVDMTMuMzEyNSA5LjM2MjUgMTQuMiA5IDE1LjI1IDlDMTYuMyA5IDE3LjE4NzUgOS4zNjI1IDE3LjkxMjUgMTAuMDg3NUMxOC42Mzc1IDEwLjgxMjUgMTkgMTEuNyAxOSAxMi43NUMxOSAxMy44IDE4LjYzNzUgMTQuNjg3NSAxNy45MTI1IDE1LjQxMjVDMTcuMTg3NSAxNi4xMzc1IDE2LjMgMTYuNSAxNS4yNSAxNi41QzE0LjIgMTYuNSAxMy4zMTI1IDE2LjEzNzUgMTIuNTg3NSAxNS40MTI1Wk0xNi40ODc1IDEzLjk4NzVDMTYuODI5MiAxMy42NDU4IDE3IDEzLjIzMzMgMTcgMTIuNzVDMTcgMTIuMjY2NyAxNi44MjkyIDExLjg1NDIgMTYuNDg3NSAxMS41MTI1QzE2LjE0NTggMTEuMTcwOCAxNS43MzMzIDExIDE1LjI1IDExQzE0Ljc2NjcgMTEgMTQuMzU0MiAxMS4xNzA4IDE0LjAxMjUgMTEuNTEyNUMxMy42NzA4IDExLjg1NDIgMTMuNSAxMi4yNjY3IDEzLjUgMTIuNzVDMTMuNSAxMy4yMzMzIDEzLjY3MDggMTMuNjQ1OCAxNC4wMTI1IDEzLjk4NzVDMTQuMzU0MiAxNC4zMjkyIDE0Ljc2NjcgMTQuNSAxNS4yNSAxNC41QzE1LjczMzMgMTQuNSAxNi4xNDU4IDE0LjMyOTIgMTYuNDg3NSAxMy45ODc1Wk04LjUgMTMuNzVIMi41QzIuMjE2NjcgMTMuNzUgMS45NzkxNyAxMy42NTQyIDEuNzg3NSAxMy40NjI1QzEuNTk1ODMgMTMuMjcwOCAxLjUgMTMuMDMzMyAxLjUgMTIuNzVDMS41IDEyLjQ2NjcgMS41OTU4MyAxMi4yMjkyIDEuNzg3NSAxMi4wMzc1QzEuOTc5MTcgMTEuODQ1OCAyLjIxNjY3IDExLjc1IDIuNSAxMS43NUg4LjVDOC43ODMzMyAxMS43NSA5LjAyMDgzIDExLjg0NTggOS4yMTI1IDEyLjAzNzVDOS40MDQxNyAxMi4yMjkyIDkuNSAxMi40NjY3IDkuNSAxMi43NUM5LjUgMTMuMDMzMyA5LjQwNDE3IDEzLjI3MDggOS4yMTI1IDEzLjQ2MjVDOS4wMjA4MyAxMy42NTQyIDguNzgzMzMgMTMuNzUgOC41IDEzLjc1Wk0xLjA4NzUgNi40MTI1QzAuMzYyNSA1LjY4NzUgMCA0LjggMCAzLjc1QzAgMi43IDAuMzYyNSAxLjgxMjUgMS4wODc1IDEuMDg3NUMxLjgxMjUgMC4zNjI1IDIuNyAwIDMuNzUgMEM0LjggMCA1LjY4NzUgMC4zNjI1IDYuNDEyNSAxLjA4NzVDNy4xMzc1IDEuODEyNSA3LjUgMi43IDcuNSAzLjc1QzcuNSA0LjggNy4xMzc1IDUuNjg3NSA2LjQxMjUgNi40MTI1QzUuNjg3NSA3LjEzNzUgNC44IDcuNSAzLjc1IDcuNUMyLjcgNy41IDEuODEyNSA3LjEzNzUgMS4wODc1IDYuNDEyNVpNNC45ODc1IDQuOTg3NUM1LjMyOTE3IDQuNjQ1ODMgNS41IDQuMjMzMzMgNS41IDMuNzVDNS41IDMuMjY2NjcgNS4zMjkxNyAyLjg1NDE3IDQuOTg3NSAyLjUxMjVDNC42NDU4MyAyLjE3MDgzIDQuMjMzMzMgMiAzLjc1IDJDMy4yNjY2NyAyIDIuODU0MTcgMi4xNzA4MyAyLjUxMjUgMi41MTI1QzIuMTcwODMgMi44NTQxNyAyIDMuMjY2NjcgMiAzLjc1QzIgNC4yMzMzMyAyLjE3MDgzIDQuNjQ1ODMgMi41MTI1IDQuOTg3NUMyLjg1NDE3IDUuMzI5MTcgMy4yNjY2NyA1LjUgMy43NSA1LjVDNC4yMzMzMyA1LjUgNC42NDU4MyA1LjMyOTE3IDQuOTg3NSA0Ljk4NzVaTTE2LjUgNC43NUgxMC41QzEwLjIxNjcgNC43NSA5Ljk3OTE3IDQuNjU0MTcgOS43ODc1IDQuNDYyNUM5LjU5NTgzIDQuMjcwODMgOS41IDQuMDMzMzMgOS41IDMuNzVDOS41IDMuNDY2NjcgOS41OTU4MyAzLjIyOTE3IDkuNzg3NSAzLjAzNzVDOS45NzkxNyAyLjg0NTgzIDEwLjIxNjcgMi43NSAxMC41IDIuNzVIMTYuNUMxNi43ODMzIDIuNzUgMTcuMDIwOCAyLjg0NTgzIDE3LjIxMjUgMy4wMzc1QzE3LjQwNDIgMy4yMjkxNyAxNy41IDMuNDY2NjcgMTcuNSAzLjc1QzE3LjUgNC4wMzMzMyAxNy40MDQyIDQuMjcwODMgMTcuMjEyNSA0LjQ2MjVDMTcuMDIwOCA0LjY1NDE3IDE2Ljc4MzMgNC43NSAxNi41IDQuNzVaIiBmaWxsPSJibGFjayIvPjwvc3ZnPgo8L3N2Zz4=");
}

/* 1depth line tab — Label/Large + hug padding + primary underline */
.tabs--line {
  position: relative;
  display: inline-flex;
  gap: var(--gap-none);
  border-bottom: 1px solid var(--border-divider);
}
.tabs--line__indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: var(--tab-line-indicator-width, 0px);
  height: 2px;
  background: var(--text-primary);
  opacity: var(--tab-line-indicator-opacity, 0);
  transform: translateX(var(--tab-line-indicator-x, 0px));
  transition: transform var(--motion-medium) var(--motion-easing),
              width var(--motion-medium) var(--motion-easing),
              opacity var(--motion-fast) var(--motion-easing);
  pointer-events: none;
}
.tab--line {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-width: 0;
  padding: var(--pad-sm) var(--pad-md) calc(var(--pad-sm) + 2px);
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: var(--text-style-label-large-font-size);
  font-weight: var(--text-style-weight-regular);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--motion-fast) var(--motion-easing),
              font-weight var(--motion-fast) var(--motion-easing);
}
.tab--line:hover,
.tab--line.tab--hover {
  color: var(--text-secondary);
  font-weight: var(--text-style-weight-bold);
}
.tab--line.is-selected {
  color: var(--text-primary);
  font-weight: var(--text-style-weight-bold);
}
.tab--line.is-selected::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--text-primary);
}
.tabs--line.has-moving-indicator .tab--line.is-selected::after {
  display: none;
}
.tab--line:disabled,
.tab--line.tab--disabled {
  color: var(--semantic-text-disabled);
  font-weight: var(--text-style-weight-regular);
  pointer-events: none;
  cursor: not-allowed;
}
/* 2depth capsule tab — Label/Medium-Medium 14px + 채워진 pill */
.tabs--capsule {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--gap-none);
  min-height: var(--size-md);            /* track/example height 48 */
  padding: var(--space-050);
  background: var(--semantic-fill-muted);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.tabs--capsule--sm {
  min-height: var(--size-xs);      /* track height 32 */
  padding: var(--pad-2xs);         /* 2px inset -> 28px metric */
}
.tabs--capsule__indicator {
  position: absolute;
  top: var(--space-050);
  left: 0;
  width: var(--tab-capsule-indicator-width, 0px);
  height: calc(100% - (var(--space-050) * 2));
  border-radius: var(--radius-lg);
  background: var(--semantic-fill-default);
  opacity: var(--tab-capsule-indicator-opacity, 0);
  transform: translateX(var(--tab-capsule-indicator-x, var(--space-050)));
  transition: transform var(--motion-medium) var(--motion-easing),
              width var(--motion-medium) var(--motion-easing),
              opacity var(--motion-fast) var(--motion-easing);
  pointer-events: none;
}
.tabs--capsule--sm .tabs--capsule__indicator {
  top: var(--pad-2xs);
  height: calc(100% - (var(--pad-2xs) * 2));
  transform: translateX(var(--tab-capsule-indicator-x, var(--pad-2xs)));
}
.tab--capsule {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  height: var(--space-500);              /* 40 */
  padding: 0 var(--pad-lg);
  border: none;
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  font-size: var(--text-style-label-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: background var(--motion-fast) var(--motion-easing),
              color var(--motion-fast) var(--motion-easing);
}
.tab--capsule:hover,
.tab--capsule.tab--hover { background: var(--state-hover); color: var(--text-secondary); }
.tab--capsule.is-selected { background: var(--semantic-fill-default); color: var(--text-primary); }
.tabs--capsule.has-moving-indicator .tab--capsule.is-selected,
.tabs--capsule.has-moving-indicator .tab--capsule.is-selected:hover {
  background: transparent;
}
@media (prefers-reduced-motion: reduce) {
  .tabs--line__indicator,
  .tabs--capsule__indicator {
    transition: none;
  }
}
.tab--capsule--text-only {
  min-width: 58px;
  overflow: hidden;
}
.tab--capsule--text-icon {
  min-width: 80px;
  overflow: hidden;
}
.tab--capsule--icon-only {
  width: var(--space-500);
  min-width: var(--space-500);
  padding: 0;
}
.tabs--capsule--sm .tab--capsule {
  height: 28px;
}
.tabs--capsule--sm .tab--capsule--icon-only {
  width: 28px;
  min-width: 28px;
}
.tab--capsule__icon {
  flex: 0 0 auto;
  display: block;
  width: var(--space-200);
  height: var(--space-200);
  color: currentColor;
}
.tab--capsule__icon--page-info {
  background: currentColor;
  -webkit-mask: var(--tab-capsule-page-info-mask) center / contain no-repeat;
  mask: var(--tab-capsule-page-info-mask) center / contain no-repeat;
  mask-mode: alpha;
}
.tab--capsule__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab--capsule:disabled,
.tab--capsule.tab--disabled {
  opacity: var(--state-disabled-opacity);
  pointer-events: none;
  cursor: not-allowed;
}

/* ════════════════════════════════════════════════
 * Checkbox / Radio (디자인시스템.md Components/Checkbox·Radio)
 * @sync Specs/KeepGong/DesignSystem/CheckboxRadioSpec.lean
 * ════════════════════════════════════════════════ */
.check, .radio {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  width: min(100%, 360px);
  height: 44px;
  min-height: 44px;
  gap: var(--gap-md);
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  transition: opacity var(--motion-fast) var(--motion-easing);
}
.check__box, .radio__box {
  flex: 0 0 24px; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
  color: var(--text-inverse);                 /* 체크/점 아이콘 색 */
  font-size: 13px;
  transition: background var(--motion-fast), border-color var(--motion-fast),
              box-shadow var(--motion-fast) var(--motion-easing);
}
.check__box { border-radius: var(--radius-xs); }   /* 작은 사각 */
.radio__box {
  position: relative;
  border-radius: var(--radius-full);
  color: transparent;
  font-size: 0;
}
/* 선택 = fill/primary 면 + accent 테두리 (+ 안의 아이콘) 함께 */
.check.is-checked .check__box,
.check.is-indeterminate .check__box {
  background: var(--fill-primary);
  border-color: var(--fill-primary);
}
.radio.is-checked .radio__box {
  background: var(--bg-page);
  border: 2px solid var(--fill-primary);
}
.radio.is-checked .radio__box::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--fill-primary);
}
.check.is-focused .check__box,
.radio.is-focused .radio__box,
.check:focus-within .check__box,
.radio:focus-within .radio__box {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 18%, transparent);
}
.check__copy,
.radio__copy {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  line-height: 1.4;
}
.check__label,
.radio__label {
  color: var(--text-primary);
  font-size: var(--text-style-label-large-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.check__description,
.radio__description {
  color: var(--text-secondary);
  font-size: var(--text-style-caption-medium-font-size);
  font-weight: var(--text-style-weight-regular);
  line-height: var(--text-style-caption-line-height);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ════════════════════════════════════════════════
 * Number Stepper (디자인시스템.md Components/Number Stepper)
 * @sync Specs/KeepGong/DesignSystem/NumberStepperSpec.lean
 * ════════════════════════════════════════════════ */
.stepper {
  --stepper-width: 144px;
  --stepper-height: var(--size-md);
  --stepper-action-size: var(--space-400);
  --stepper-icon-remove-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj4KPHN2ZyB4PSI0Ljk5OTIiIHk9IjEwLjk5OTIiIHdpZHRoPSIxNCIgaGVpZ2h0PSIyIiB2aWV3Qm94PSIwIDAgMTQgMiIgb3ZlcmZsb3c9InZpc2libGUiIGZpbGw9Im5vbmUiPjxwYXRoIGlkPSJyZW1vdmUiIGQ9Ik0xIDJDMC43MTY2NjcgMiAwLjQ3OTE2NyAxLjkwNDE3IDAuMjg3NSAxLjcxMjVDMC4wOTU4MzMzIDEuNTIwODMgMCAxLjI4MzMzIDAgMUMwIDAuNzE2NjY3IDAuMDk1ODMzMyAwLjQ3OTE2NyAwLjI4NzUgMC4yODc1QzAuNDc5MTY3IDAuMDk1ODMzMyAwLjcxNjY2NyAwIDEgMEgxM0MxMy4yODMzIDAgMTMuNTIwOCAwLjA5NTgzMzMgMTMuNzEyNSAwLjI4NzVDMTMuOTA0MiAwLjQ3OTE2NyAxNCAwLjcxNjY2NyAxNCAxQzE0IDEuMjgzMzMgMTMuOTA0MiAxLjUyMDgzIDEzLjcxMjUgMS43MTI1QzEzLjUyMDggMS45MDQxNyAxMy4yODMzIDIgMTMgMkgxWiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+Cjwvc3ZnPgo=");
  --stepper-icon-add-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj4KPHN2ZyB4PSI0Ljk5OTIiIHk9IjQuOTk5MiIgd2lkdGg9IjE0IiBoZWlnaHQ9IjE0IiB2aWV3Qm94PSIwIDAgMTQgMTQiIG92ZXJmbG93PSJ2aXNpYmxlIiBmaWxsPSJub25lIj48cGF0aCBpZD0iYWRkIiBkPSJNNiA4SDFDMC43MTY2NjcgOCAwLjQ3OTE2NyA3LjkwNDE3IDAuMjg3NSA3LjcxMjVDMC4wOTU4MzMzIDcuNTIwODMgMCA3LjI4MzMzIDAgN0MwIDYuNzE2NjcgMC4wOTU4MzMzIDYuNDc5MTcgMC4yODc1IDYuMjg3NUMwLjQ3OTE2NyA2LjA5NTgzIDAuNzE2NjY3IDYgMSA2SDZWMUM2IDAuNzE2NjY3IDYuMDk1ODMgMC40NzkxNjcgNi4yODc1IDAuMjg3NUM2LjQ3OTE3IDAuMDk1ODMzMyA2LjcxNjY3IDAgNyAwQzcuMjgzMzMgMCA3LjUyMDgzIDAuMDk1ODMzMyA3LjcxMjUgMC4yODc1QzcuOTA0MTcgMC40NzkxNjcgOCAwLjcxNjY2NyA4IDFWNkgxM0MxMy4yODMzIDYgMTMuNTIwOCA2LjA5NTgzIDEzLjcxMjUgNi4yODc1QzEzLjkwNDIgNi40NzkxNyAxNCA2LjcxNjY3IDE0IDdDMTQgNy4yODMzMyAxMy45MDQyIDcuNTIwODMgMTMuNzEyNSA3LjcxMjVDMTMuNTIwOCA3LjkwNDE3IDEzLjI4MzMgOCAxMyA4SDhWMTNDOCAxMy4yODMzIDcuOTA0MTcgMTMuNTIwOCA3LjcxMjUgMTMuNzEyNUM3LjUyMDgzIDEzLjkwNDIgNy4yODMzMyAxNCA3IDE0QzYuNzE2NjcgMTQgNi40NzkxNyAxMy45MDQyIDYuMjg3NSAxMy43MTI1QzYuMDk1ODMgMTMuNTIwOCA2IDEzLjI4MzMgNiAxM1Y4WiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+Cjwvc3ZnPgo=");
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  width: var(--stepper-width);
  height: var(--stepper-height);
  padding: var(--pad-sm);
  background: var(--bg-page);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-full);
  transition: border-color var(--motion-fast) var(--motion-easing),
              background var(--motion-fast) var(--motion-easing);
}
.stepper--md {
  --stepper-width: 144px;
  --stepper-height: var(--size-md);
  --stepper-action-size: var(--space-400);
}
.stepper--sm {
  --stepper-width: 128px;
  --stepper-height: var(--space-500);
  --stepper-action-size: var(--space-300);
}
.stepper--focused {
  background: var(--semantic-fill-subtle);
  border-color: var(--border-focus);
  border-width: 2px;
}
.stepper:focus-within {
  background: var(--semantic-fill-subtle);
  border-color: var(--border-focus);
  border-width: 2px;
}
.stepper:has(.stepper__btn:hover:not(:disabled)),
.stepper:has(.stepper__btn.stepper__btn--hover:not(:disabled)),
.stepper:has(.stepper__btn.is-hover:not(:disabled)) {
  border-color: var(--border-strong);
}
.stepper__btn {                           /* minus / plus — 개별 hover */
  flex: 0 0 var(--stepper-action-size);
  width: var(--stepper-action-size);
  height: var(--stepper-action-size);
  align-self: center;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0; cursor: pointer;
}
.stepper__btn:hover:not(:disabled),
.stepper__btn.stepper__btn--hover:not(:disabled),
.stepper__btn.is-hover:not(:disabled) { background: var(--semantic-fill-muted); }
.stepper__btn::before {
  content: "";
  width: var(--space-300);
  height: var(--space-300);
  background: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: var(--space-300) var(--space-300);
  mask-size: var(--space-300) var(--space-300);
  -webkit-mask-mode: alpha;
  mask-mode: alpha;
}
.stepper__btn[aria-label="감소"]::before {
  -webkit-mask-image: var(--stepper-icon-remove-mask);
  mask-image: var(--stepper-icon-remove-mask);
}
.stepper__btn[aria-label="증가"]::before {
  -webkit-mask-image: var(--stepper-icon-add-mask);
  mask-image: var(--stepper-icon-add-mask);
}
/* 최소값 minus 비활성 = action opacity 25% (전역 disabled row 는 .is-disabled opacity 30%) */
.stepper__btn:disabled { opacity: 0.25; cursor: not-allowed; }
.stepper__value {                         /* 중앙 정렬, Label/Large-Medium */
  flex: 0 0 56px;
  width: 56px;
  height: 100%;
  min-width: 0;
  display: inline-flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: var(--text-style-label-large-font-size); font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  color: var(--text-primary);
  font-family: inherit;
  appearance: textfield;
}
.stepper__value::-webkit-outer-spin-button,
.stepper__value::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}
.stepper--sm .stepper__value {
  font-size: var(--text-style-label-medium-font-size);
}

/* ════════════════════════════════════════════════
 * Badge / Tag Chip (디자인시스템.md Components/Badge·Label·Tag Chip)
 * @sync Specs/KeepGong/DesignSystem/BadgeChipSpec.lean. Label = .type-label.
 * ════════════════════════════════════════════════ */
.badge {                                  /* Caption/Small-Medium 11px + small-only 24px pill */
  --badge-soft-bg: var(--semantic-status-neutral-soft-fill);
  --badge-soft-text: var(--text-secondary);
  --badge-solid-bg: var(--semantic-status-neutral-solid-fill);
  --badge-solid-text: var(--semantic-text-inverse);
  --badge-outline-border: var(--semantic-border-strong);
  --badge-outline-text: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--space-300);
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  gap: var(--gap-xs);
  font-size: var(--text-style-caption-small-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-caption-line-height);
  white-space: nowrap;
}
.badge--neutral {
  --badge-soft-bg: var(--semantic-status-neutral-soft-fill);
  --badge-soft-text: var(--text-secondary);
  --badge-solid-bg: var(--semantic-status-neutral-solid-fill);
  --badge-solid-text: var(--semantic-text-inverse);
  --badge-outline-border: var(--semantic-border-strong);
  --badge-outline-text: var(--text-secondary);
}
.badge--brand {
  --badge-soft-bg: var(--semantic-status-brand-soft-fill);
  --badge-soft-text: var(--semantic-status-brand-content-strong);
  --badge-solid-bg: var(--semantic-fill-brand);
  --badge-solid-text: var(--semantic-text-inverse);
  --badge-outline-border: var(--semantic-status-brand-subtle);
  --badge-outline-text: var(--semantic-status-brand-content-strong);
}
.badge--secondary {
  --badge-soft-bg: var(--semantic-status-secondary-soft-fill);
  --badge-soft-text: var(--semantic-status-secondary-content);
  --badge-solid-bg: var(--semantic-status-secondary-content);
  --badge-solid-text: var(--semantic-text-inverse);
  --badge-outline-border: var(--semantic-status-secondary-border);
  --badge-outline-text: var(--semantic-status-secondary-content);
}
.badge--success {
  --badge-soft-bg: var(--semantic-status-success-soft-fill);
  --badge-soft-text: var(--semantic-text-success);
  --badge-solid-bg: var(--semantic-fill-success);
  --badge-solid-text: var(--semantic-text-inverse);
  --badge-outline-border: var(--semantic-status-success-border);
  --badge-outline-text: var(--semantic-text-success);
}
.badge--warning {
  --badge-soft-bg: var(--semantic-status-warning-soft-fill);
  --badge-soft-text: var(--semantic-text-warning);
  --badge-solid-bg: var(--semantic-fill-warning);
  --badge-solid-text: var(--semantic-text-primary);
  --badge-outline-border: var(--semantic-status-warning-border);
  --badge-outline-text: var(--semantic-text-warning);
}
.badge--danger {
  --badge-soft-bg: var(--semantic-status-danger-soft-fill);
  --badge-soft-text: var(--semantic-text-danger);
  --badge-solid-bg: var(--semantic-fill-danger);
  --badge-solid-text: var(--semantic-text-inverse);
  --badge-outline-border: var(--semantic-status-danger-border);
  --badge-outline-text: var(--semantic-text-danger);
}
.badge--info {
  --badge-soft-bg: var(--semantic-status-info-soft-fill);
  --badge-soft-text: var(--semantic-status-info-solid-fill);
  --badge-solid-bg: var(--semantic-status-info-solid-fill);
  --badge-solid-text: var(--semantic-text-inverse);
  --badge-outline-border: var(--semantic-status-info-border);
  --badge-outline-text: var(--semantic-status-info-solid-fill);
}
.badge--soft {
  background: var(--badge-soft-bg);
  color: var(--badge-soft-text);
  border-color: transparent;
}
.badge--solid {
  background: var(--badge-solid-bg);
  color: var(--badge-solid-text);
  border-color: transparent;
}
.badge--outline {
  background: transparent;
  color: var(--badge-outline-text);
  border-color: var(--badge-outline-border);
}
/* Tag Chip Neutral / Medium — Figma 162:54, 162:78, 162:102, 162:126. */
.chip {
  --chip-height: var(--space-500);
  --chip-border-width: 1.5px;
  --chip-letter-spacing: -0.01em;
  --chip-disabled-opacity: 0.65;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: var(--gap-sm);
  height: var(--chip-height);
  padding: 0 var(--pad-lg);
  border: var(--chip-border-width) solid var(--semantic-border-default);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-style-body-small-font-size);
  font-weight: var(--text-style-weight-bold);
  line-height: var(--text-style-body-line-height);
  letter-spacing: var(--chip-letter-spacing);
  white-space: nowrap;
  cursor: pointer;
}
.chip--neutral { background: var(--semantic-fill-default); color: var(--semantic-text-primary); }
.chip--neutral:hover:not(:disabled):not(.is-selected) { background: var(--semantic-fill-subtle); border-color: var(--semantic-border-strong); }
.chip--neutral.is-selected { background: var(--semantic-fill-inverse); border-color: var(--semantic-fill-inverse); color: var(--semantic-text-inverse); }
.chip--neutral:disabled { background: var(--semantic-fill-subtle); border-color: var(--semantic-border-default); color: var(--semantic-text-disabled); opacity: var(--chip-disabled-opacity); cursor: not-allowed; }
.chip:has(> .chip__dismiss-icon) { padding-inline-end: calc(var(--pad-lg) * 0.75); }
.chip__dismiss-icon { flex: none; width: var(--space-300); height: var(--space-300); background: currentColor; mask: url("/assets/icons/close_small.svg") center / contain no-repeat; }
.chip__remove { color: var(--text-muted); font-size: var(--text-style-caption-medium-font-size); cursor: pointer; }

/* ════════════════════════════════════════════════
 * Bullet (디자인시스템.md Components/Bullet)
 * @sync Specs/KeepGong/DesignSystem/BulletSpec.lean
 * ════════════════════════════════════════════════ */
:root {
  --bullet-line-caption-small: 15px;
  --bullet-line-caption-medium: 17px;
  --bullet-line-label-medium: 20px;
  --bullet-line-body-small: 22px;
  --bullet-line-body-medium: 26px;
  --bullet-line-heading-medium: 28px;
  --bullet-line-body-large: 29px;
  --bullet-dot-size: 34%;
  --bullet-ring-size: 58%;
  --bullet-shape-size: 48%;
  --bullet-dash-width: 56%;
  --bullet-dash-height: 2px;
  --bullet-symbol-size: 82%;
  --bullet-number-size: 58%;
  --bullet-arrow-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNC4wMDA4IDYuNDM2OCkiPjxwYXRoIGQ9Ik0xMi4xNSA2LjU2M0gxQzAuNzE2NjY3IDYuNTYzIDAuNDc5MTY3IDYuNDY3MTcgMC4yODc1IDYuMjc1NUMwLjA5NTgzMzMgNi4wODM4MyAwIDUuODQ2MzMgMCA1LjU2M0MwIDUuMjc5NjcgMC4wOTU4MzMzIDUuMDQyMTcgMC4yODc1IDQuODUwNUMwLjQ3OTE2NyA0LjY1ODgzIDAuNzE2NjY3IDQuNTYzIDEgNC41NjNIMTIuMTVMOS4zIDEuNzEzQzkuMSAxLjUxMyA5LjAwNDE3IDEuMjc5NjcgOS4wMTI1IDEuMDEzQzkuMDIwODMgMC43NDYzMzMgOS4xMTY2NyAwLjUxMyA5LjMgMC4zMTNDOS41IDAuMTEzIDkuNzM3NSAwLjAwODgzMzMzIDEwLjAxMjUgMC4wMDA1QzEwLjI4NzUgLTAuMDA3ODMzMzMgMTAuNTI1IDAuMDg4IDEwLjcyNSAwLjI4OEwxNS4zIDQuODYzQzE1LjQgNC45NjMgMTUuNDcwOCA1LjA3MTMzIDE1LjUxMjUgNS4xODhDMTUuNTU0MiA1LjMwNDY3IDE1LjU3NSA1LjQyOTY3IDE1LjU3NSA1LjU2M0MxNS41NzUgNS42OTYzMyAxNS41NTQyIDUuODIxMzMgMTUuNTEyNSA1LjkzOEMxNS40NzA4IDYuMDU0NjcgMTUuNCA2LjE2MyAxNS4zIDYuMjYzTDEwLjcyNSAxMC44MzhDMTAuNTI1IDExLjAzOCAxMC4yODc1IDExLjEzMzggMTAuMDEyNSAxMS4xMjU1QzkuNzM3NSAxMS4xMTcyIDkuNSAxMS4wMTMgOS4zIDEwLjgxM0M5LjExNjY3IDEwLjYxMyA5LjAyMDgzIDEwLjM3OTcgOS4wMTI1IDEwLjExM0M5LjAwNDE3IDkuODQ2MzMgOS4xIDkuNjEzIDkuMyA5LjQxM0wxMi4xNSA2LjU2M1oiIGZpbGw9ImJsYWNrIi8+PC9nPjwvc3ZnPg==");
  --bullet-check-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNi40MjQ4IDcuNDI1NikiPjxwYXRoIGQ9Ik0zLjU3NSA2LjE3NUw5LjQ3NSAwLjI3NUM5LjY1ODMzIDAuMDkxNjY2NyA5Ljg5MTY3IDAgMTAuMTc1IDBDMTAuNDU4MyAwIDEwLjY5MTcgMC4wOTE2NjY3IDEwLjg3NSAwLjI3NUMxMS4wNTgzIDAuNDU4MzMzIDExLjE1IDAuNjkxNjY3IDExLjE1IDAuOTc1QzExLjE1IDEuMjU4MzMgMTEuMDU4MyAxLjQ5MTY3IDEwLjg3NSAxLjY3NUw0LjI3NSA4LjI3NUM0LjA3NSA4LjQ3NSAzLjg0MTY3IDguNTc1IDMuNTc1IDguNTc1QzMuMzA4MzMgOC41NzUgMy4wNzUgOC40NzUgMi44NzUgOC4yNzVMMC4yNzUgNS42NzVDMC4wOTE2NjY3IDUuNDkxNjcgMCA1LjI1ODMzIDAgNC45NzVDMCA0LjY5MTY3IDAuMDkxNjY2NyA0LjQ1ODMzIDAuMjc1IDQuMjc1QzAuNDU4MzMzIDQuMDkxNjcgMC42OTE2NjcgNCAwLjk3NSA0QzEuMjU4MzMgNCAxLjQ5MTY3IDQuMDkxNjcgMS42NzUgNC4yNzVMMy41NzUgNi4xNzVaIiBmaWxsPSJibGFjayIvPjwvZz48L3N2Zz4=");
}
.bullet {
  --bullet-frame-size: var(--bullet-line-body-medium);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--bullet-frame-size);
  height: var(--bullet-frame-size);
  color: var(--text-secondary);
  font-size: var(--bullet-frame-size);
  line-height: 1;
}
.bullet--line-caption-small { --bullet-frame-size: var(--bullet-line-caption-small); }
.bullet--line-caption-medium { --bullet-frame-size: var(--bullet-line-caption-medium); }
.bullet--line-label-medium { --bullet-frame-size: var(--bullet-line-label-medium); }
.bullet--line-body-small { --bullet-frame-size: var(--bullet-line-body-small); }
.bullet--line-body-medium { --bullet-frame-size: var(--bullet-line-body-medium); }
.bullet--line-heading-medium { --bullet-frame-size: var(--bullet-line-heading-medium); }
.bullet--line-body-large { --bullet-frame-size: var(--bullet-line-body-large); }
.bullet__dot,
.bullet__ring,
.bullet__square,
.bullet__diamond,
.bullet__dash,
.bullet__arrow,
.bullet__check,
.bullet__asterisk,
.bullet__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  font-family: var(--font-body);
  line-height: 1;
}
.bullet__dot {
  width: var(--bullet-dot-size);
  height: var(--bullet-dot-size);
  border-radius: var(--radius-full);
  background: currentColor;
}
.bullet__ring {
  width: var(--bullet-ring-size);
  height: var(--bullet-ring-size);
  border: 2px solid currentColor;
  border-radius: var(--radius-full);
}
.bullet__square {
  width: var(--bullet-shape-size);
  height: var(--bullet-shape-size);
  background: currentColor;
}
.bullet__diamond {
  width: var(--bullet-shape-size);
  height: var(--bullet-shape-size);
  background: currentColor;
  transform: rotate(45deg);
}
.bullet__dash {
  width: var(--bullet-dash-width);
  height: var(--bullet-dash-height);
  border-radius: var(--radius-full);
  background: currentColor;
}
.bullet__arrow {
  width: var(--bullet-symbol-size);
  height: var(--bullet-symbol-size);
  background-color: var(--text-secondary);
  -webkit-mask: var(--bullet-arrow-mask) center / contain no-repeat;
  mask: var(--bullet-arrow-mask) center / contain no-repeat;
  mask-mode: alpha;
}
.bullet__check {
  width: var(--bullet-symbol-size);
  height: var(--bullet-symbol-size);
  background-color: var(--text-secondary);
  -webkit-mask: var(--bullet-check-mask) center / contain no-repeat;
  mask: var(--bullet-check-mask) center / contain no-repeat;
  mask-mode: alpha;
}
.bullet__asterisk::before {
  content: "*";
  font-size: var(--bullet-symbol-size);
  font-weight: var(--text-style-weight-bold);
  line-height: 1;
}
.bullet__num {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  font-size: var(--bullet-number-size);
  font-weight: var(--text-style-weight-bold);
  font-variant-numeric: tabular-nums;
}
.bullet__num--color { background: var(--fill-primary); color: var(--text-inverse); }
.bullet__num--neutral {
  background: var(--bg-page);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

/* ════════════════════════════════════════════════
 * Folder Tree (디자인시스템.md Components/Folder Tree)
 * @sync Specs/KeepGong/DesignSystem/FolderTreeSpec.lean
 * depth 는 row 의 --depth 커스텀 프로퍼티로 (left = 16 + 24 * depth).
 * ════════════════════════════════════════════════ */
:root {
  --tree-arrow-right-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj4KPHN2ZyB4PSIxMC4wMDA4IiB5PSI3LjAwMDgiIHdpZHRoPSI1IiBoZWlnaHQ9IjEwIiB2aWV3Qm94PSIwIDAgNSAxMCIgb3ZlcmZsb3c9InZpc2libGUiIGZpbGw9Im5vbmUiPjxwYXRoIGlkPSJhcnJvd19yaWdodCIgZD0iTTAgMTBWMEw1IDVMMCAxMFoiIGZpbGw9ImJsYWNrIi8+PC9zdmc+Cjwvc3ZnPg==");
  --tree-arrow-drop-down-mask: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj4KPHN2ZyB4PSI3LjY5OTIiIHk9IjEwLjAwMDgiIHdpZHRoPSI4LjYiIGhlaWdodD0iNC43IiB2aWV3Qm94PSIwIDAgOC42IDQuNyIgb3ZlcmZsb3c9InZpc2libGUiIGZpbGw9Im5vbmUiPjxwYXRoIGlkPSJhcnJvd19kcm9wX2Rvd24iIGQ9Ik0zLjc3NSA0LjQ3NUwwLjE1IDAuODVDMC4xIDAuOCAwLjA2MjUgMC43NDU4MzMgMC4wMzc1IDAuNjg3NUMwLjAxMjUgMC42MjkxNjcgMCAwLjU2NjY2NyAwIDAuNUMwIDAuMzY2NjY3IDAuMDQ1ODMzMyAwLjI1IDAuMTM3NSAwLjE1QzAuMjI5MTY3IDAuMDUgMC4zNSAwIDAuNSAwSDguMUM4LjI1IDAgOC4zNzA4MyAwLjA1IDguNDYyNSAwLjE1QzguNTU0MTcgMC4yNSA4LjYgMC4zNjY2NjcgOC42IDAuNUM4LjYgMC41MzMzMzMgOC41NSAwLjY1IDguNDUgMC44NUw0LjgyNSA0LjQ3NUM0Ljc0MTY3IDQuNTU4MzMgNC42NTgzMyA0LjYxNjY3IDQuNTc1IDQuNjVDNC40OTE2NyA0LjY4MzMzIDQuNCA0LjcgNC4zIDQuN0M0LjIgNC43IDQuMTA4MzMgNC42ODMzMyA0LjAyNSA0LjY1QzMuOTQxNjcgNC42MTY2NyAzLjg1ODMzIDQuNTU4MzMgMy43NzUgNC40NzVaIiBmaWxsPSJibGFjayIvPjwvc3ZnPgo8L3N2Zz4=");
}
.tree { display: flex; flex-direction: column; }
.tree-row {
  box-sizing: border-box;
  display: flex; align-items: center; gap: var(--gap-xs);
  min-height: 44px;
  padding: var(--pad-md) var(--pad-lg);
  padding-left: calc(var(--pad-lg) + var(--space-300) * var(--depth, 0));
  border-radius: var(--radius-lg);
  font-size: var(--text-style-label-medium-font-size);
  color: var(--text-secondary);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
}
.tree-row:hover,
.tree-row.tree-row--hover {
  background: var(--state-hover);
}
.tree-row[hidden] {
  display: none;
}
.tree-row:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 18%, transparent);
}
.tree-row.is-selected {
  background: var(--semantic-fill-muted);
  color: var(--text-primary);
}
.tree-row.tree-row--disabled,
.tree-row[aria-disabled="true"] {
  opacity: var(--state-disabled-opacity);
  cursor: not-allowed;
}
.tree-row.tree-row--disabled:hover,
.tree-row[aria-disabled="true"]:hover {
  background: transparent;
}
.tree-row__toggle,
.tree-row__icon {
  flex: 0 0 var(--text-style-heading-small-font-size);
  width: var(--text-style-heading-small-font-size);
  height: var(--text-style-heading-small-font-size);
  color: var(--icon-muted);
  font-size: var(--text-style-heading-small-font-size);
  display: block;
}
.tree-row__toggle-button,
.tree-row__destination,
.tree-row__create-button {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tree-row__toggle-button {
  flex: 0 0 var(--text-style-heading-small-font-size);
  width: var(--text-style-heading-small-font-size);
  height: var(--text-style-heading-small-font-size);
  display: grid;
  place-items: center;
}
.tree-row__destination {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  text-align: left;
}
.tree-row__create-button {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--icon-muted);
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  transition: opacity var(--motion-fast) var(--motion-easing), background var(--motion-fast) var(--motion-easing);
}
.tree-row:hover .tree-row__create-button,
.tree-row:focus-within .tree-row__create-button,
.tree-row.is-selected .tree-row__create-button { opacity: 1; }
.tree-row__create-button:hover { background: var(--state-hover); color: var(--text-primary); }
.tree-row__toggle-button:focus-visible,
.tree-row__destination:focus-visible,
.tree-row__create-button:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.tree-row__toggle-button:disabled,
.tree-row__destination:disabled {
  cursor: not-allowed;
}
.tree-row__toggle {
  background: currentColor;
  -webkit-mask: var(--tree-arrow-right-mask) center / contain no-repeat;
  mask: var(--tree-arrow-right-mask) center / contain no-repeat;
  mask-mode: alpha;
  transition: background var(--motion-fast) var(--motion-easing);
}
.tree-row[aria-expanded="true"] .tree-row__toggle {
  -webkit-mask: var(--tree-arrow-drop-down-mask) center / contain no-repeat;
  mask: var(--tree-arrow-drop-down-mask) center / contain no-repeat;
  mask-mode: alpha;
}
.tree-row__toggle--empty {
  background: none;
  -webkit-mask: none;
  mask: none;
}
.tree-row__icon {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}
.tree-row__icon--folder {
  background-image: url("/assets/illustrations/folder.svg");
}
.tree-row__icon--folder-open {
  background-image: url("/assets/illustrations/folder-open.svg");
}
.tree-row__icon--file-pdf {
  background-image: url("/assets/illustrations/file-pdf.svg");
}
.tree-row__label { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════════════════
 * Modal / Toast / Snack Bar (디자인시스템.md Components/Modal·Toast·Snack Bar)
 * @sync Specs/KeepGong/DesignSystem/OverlaySpec.lean
 * ════════════════════════════════════════════════ */
/* Modal — 흐름 차단 backdrop + surface + Shadow/modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: var(--semantic-background-dimmed);
  display: flex; align-items: center; justify-content: center;
  padding: var(--pad-lg);
  z-index: 80;
}
.modal {
  position: relative; /* modal__close 절대 배치 기준 */
  width: 100%; max-width: 400px;
  background: var(--bg-page);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  padding: var(--pad-3xl);
}
/* 닫기 버튼 — snackbar__close 관례의 라이트 표면 판 (배경 클릭과 같은 on_dismiss). */
.modal__close {
  position: absolute;
  top: var(--pad-lg);
  right: var(--pad-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.modal__close-icon {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: 0.7;
}
.modal__close:hover {
  background: var(--bg-surface-hover, rgba(0, 0, 0, 0.06));
}
.modal__close:hover .modal__close-icon {
  opacity: 1;
}
.modal--medium { max-width: 400px; }
.modal--large { max-width: 640px; }
.modal--danger {
  border: 1px solid var(--semantic-status-danger-border);
}
.modal--danger .modal__title {
  color: var(--semantic-text-danger);
}
.modal__header {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  margin-bottom: var(--gap-xl);
}
.modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-style-heading-small-font-size);
  font-weight: var(--text-style-weight-bold);
  line-height: var(--text-style-heading-line-height);
  letter-spacing: 0;
  color: var(--text-primary);
}
.modal__description {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-style-body-medium-font-size);
  font-weight: var(--text-style-weight-regular);
  line-height: var(--text-style-body-line-height);
  letter-spacing: 0;
  color: var(--text-secondary);
}
.modal__body {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-sm);
  margin-top: var(--gap-xl);
}
/* Toast — content-area bottom-center, 아주 짧은 결과 피드백 */
.toast-stack {
  position: fixed;
  bottom: var(--space-500);
  left: calc(var(--sidebar-width) + ((100vw - var(--sidebar-width)) / 2));
  z-index: 40;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: var(--gap-md);
  pointer-events: none;
  transform: translateX(-50%);
}
.kg-master-detail:has(.kg-sidebar.is-collapsed) .toast-stack {
  left: calc(var(--sidebar-collapsed-width) + ((100vw - var(--sidebar-collapsed-width)) / 2));
}
.toast {
  position: fixed;
  bottom: var(--space-500);
  left: calc(var(--sidebar-width) + ((100vw - var(--sidebar-width)) / 2));
  transform: translate(-50%, 0);
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  justify-content: center;
  width: fit-content;
  max-width: min(314px, calc(100vw - var(--space-400)));
  min-height: var(--space-500);
  padding: var(--pad-sm) var(--pad-xl) var(--pad-sm) var(--pad-md);
  background: var(--semantic-background-dimmed);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-snackbar);
  backdrop-filter: blur(var(--effect-snackbar-bg-blur));
  -webkit-backdrop-filter: blur(var(--effect-snackbar-bg-blur));
  font-size: var(--text-style-body-small-font-size);
  font-weight: 500;
  line-height: var(--text-style-body-line-height);
  z-index: 40;
  will-change: opacity, transform;
  animation: kg-toast-in var(--motion-medium) var(--motion-easing) both;
}
.toast__status-icon {
  display: inline-flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--semantic-icon-success);
  background: var(--semantic-background-inverse);
  border-radius: var(--radius-full);
}
.toast__status-glyph {
  display: block;
  width: 20px;
  height: 20px;
  color: currentColor;
  fill: currentColor;
}
.toast__message {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Queue owns the viewport offset; stacked items must not inherit it again. */
.toast-stack .toast,
.kg-master-detail:has(.kg-sidebar.is-collapsed) .toast-stack .toast {
  position: relative;
  inset: auto;
  transform: translateY(0);
  pointer-events: auto;
  animation-name: kg-toast-stack-in;
}
.toast.is-exiting {
  pointer-events: none;
  animation: kg-toast-out var(--motion-medium) var(--motion-easing) both;
}
.toast-stack .toast.is-exiting {
  animation-name: kg-toast-stack-out;
}
.kg-master-detail:has(.kg-sidebar.is-collapsed) .toast {
  left: calc(var(--sidebar-collapsed-width) + ((100vw - var(--sidebar-collapsed-width)) / 2));
}
@keyframes kg-toast-in {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes kg-toast-out {
  0% { opacity: 1; transform: translate(-50%, 0); }
  70% { opacity: 0.25; transform: translate(-50%, 4px); }
  100% { opacity: 0; transform: translate(-50%, 8px); }
}
@keyframes kg-toast-stack-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes kg-toast-stack-out {
  0% { opacity: 1; transform: translateY(0); }
  70% { opacity: 0.25; transform: translateY(4px); }
  100% { opacity: 0; transform: translateY(8px); }
}

/* Snack Bar — floating, 흐름 안 막음, Shadow/snackbar */
.snackbar {
  position: fixed;
  bottom: var(--space-300);
  left: 50%;
  transform: translate(-50%, 0);
  display: inline-flex;
  align-items: flex-start;
  gap: var(--gap-lg);
  width: min(640px, calc(100vw - var(--space-400)));
  padding: var(--pad-xl);
  background: var(--semantic-background-dimmed);
  color: var(--text-inverse);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-snackbar);
  backdrop-filter: blur(var(--effect-snackbar-bg-blur));
  -webkit-backdrop-filter: blur(var(--effect-snackbar-bg-blur));
  font-size: var(--text-style-body-medium-font-size);
  z-index: 40;
}
.snackbar__icon {
  display: inline-flex;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--semantic-background-inverse);
  border-radius: var(--radius-md);
}
.snackbar__icon-graphic {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}
.snackbar__content {
  display: flex;
  flex: 1 0 0;
  flex-direction: column;
  gap: var(--gap-sm);
  min-width: 0;
  width: 100%;
}
.snackbar__title {
  color: var(--text-inverse);
  font-size: var(--text-style-heading-large-font-size);
  font-weight: 700;
  line-height: var(--text-style-heading-line-height);
}
.snackbar__description {
  color: var(--text-inverse);
  font-size: var(--text-style-body-medium-font-size);
  font-weight: 400;
  line-height: var(--text-style-body-line-height);
}
.snackbar__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--gap-sm);
  width: 100%;
}
.snackbar__close {
  position: absolute;
  top: var(--pad-xl);
  right: var(--pad-xl);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}
.snackbar__close-icon {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.78;
}
.snackbar__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-inverse);
}
.snackbar__close:hover .snackbar__close-icon {
  opacity: 1;
}

/* ════════════════════════════════════════════════
 * Breadcrumb / Path Chip (디자인시스템.md Components/Breadcrumb)
 * @sync Specs/KeepGong/DesignSystem/BreadcrumbSpec.lean
 * ════════════════════════════════════════════════ */
.breadcrumb { display: inline-flex; align-items: center; }
.crumb {                                  /* 12px, 보조 정보 */
  display: inline-flex; align-items: center; gap: var(--gap-sm);
  height: var(--size-sm);                 /* 36 */
  padding: var(--pad-sm) var(--pad-sm) var(--pad-sm) 0;  /* 상하 8 · 우 8(sep) · 좌 0 */
  background: none; border: none; cursor: pointer;
  font-size: 12px; font-weight: 400;      /* 기본 Regular */
  color: var(--text-muted);
}
.crumb:hover { font-weight: 500; }                                  /* hover Medium */
.crumb.is-current { font-weight: 700; color: var(--text-primary); cursor: default; }  /* 현재 Bold */
.crumb--last { padding-right: var(--pad-md); }   /* separator 없는 마지막 칩 = 우 12 */
.crumb__sep { color: var(--text-subtle); }

/* ════════════════════════════════════════════════
 * Empty State (디자인시스템.md Components/Empty State) — 단일 조합형
 * @sync Specs/KeepGong/DesignSystem/EmptyStateSpec.lean
 * ════════════════════════════════════════════════ */
.empty-state {
  width: 100%; box-sizing: border-box; background: var(--semantic-background-default);
  border: 1px solid var(--semantic-border-subtle); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--gap-2xl);                                   /* Message ↔ Action 32 */
  padding: var(--pad-4xl) var(--pad-3xl) var(--pad-5xl); /* top40 좌우32 bottom64 */
}
.empty-state__message { display: flex; flex-direction: column; align-items: center; gap: var(--gap-xl); width: 100%; } /* illust↔copy 20 */
.empty-state__illustration { width: 90px; height: 80px; flex: none; }
.empty-state__copy { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: var(--gap-lg); }      /* title↔subtitle 12 */
.empty-state__title { font-family: var(--font-display); font-size: var(--text-style-heading-large-font-size); font-weight: 700; line-height: 1.4; letter-spacing: -.02em; color: var(--text-primary); margin: 0; }
.empty-state__subtitle { font-size: var(--text-style-body-medium-font-size); line-height: 1.6; color: var(--text-secondary); margin: 0; }
.empty-state__actions { display: flex; flex-direction: column; align-items: center; gap: var(--gap-xl); }  /* chips↔buttons 20 */
.empty-state__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap-md); }        /* chip 8 */
.empty-state__buttons { display: flex; gap: var(--gap-lg); }                                                /* button row 12 */

/* ════════════════════════════════════════════════
 * Standalone Notice (디자인시스템.md Components/Standalone Notice)
 * @sync Specs/KeepGong/DesignSystem/StandaloneNoticeSpec.lean
 * page-level surface: 640 fixed / Hug, 외곽 = page margin.
 * ════════════════════════════════════════════════ */
.notice {
  width: 640px;                       /* fixed — W/H 토큰 바인딩 안 함 */
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--gap-2xl);                /* message ↔ action 32 */
  /* 외곽 여백 = page margin (Figma 는 auto layout padding 필드에 바인딩) */
  padding: var(--margin-page-top) var(--margin-page-x) var(--margin-page-bottom);
}
.notice__buttons { display: flex; gap: var(--gap-lg); }   /* button row 12 */

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-primary);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  /* ★ 트랙패드 오버스크롤(rubber-band) 시 100vh 셸 아래 흰 배경 노출 방지
     ("페이지 하단이 들려서 하얀 화면"). pane-body 스크롤이 문서로 체이닝되지 않게. */
  overscroll-behavior: none;
}

/* Full-height workspaces own the viewport.  Lock the document itself as well as
   its inner grid: a wheel gesture over non-scrollable sidebar chrome must not
   reuse a previous route's scroll position or expose blank body below the app. */
html:has(.kg-app-shell),
body:has(.kg-app-shell) {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 var(--margin-sm) 0;
}
h1 { font-size: 36px; line-height: 45px; }
h2 { font-size: 32px; line-height: 40px; }
h3 { font-size: 24px; line-height: 32px; font-weight: 700; }   /* 600→700: 3-weight 체계 */

p { margin: 0 0 var(--margin-sm) 0; color: var(--text-muted); }

/* Typography text styles — Figma Text Style name과 1:1 매핑.
 * 예: Label/Large-Medium → TextStyle::LabelLargeMedium / .type-label-large-medium /
 *     data-text-style="Label/Large-Medium".
 * @sync Specs/KeepGong/DesignSystem/KeepGongTokenSpec.lean § 3b. */
.type-display-large-regular,
.type-display-large-medium,
.type-display-large-bold,
[data-text-style="Display/Large-Regular"],
[data-text-style="Display/Large-Medium"],
[data-text-style="Display/Large-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-display-large-font-size);
  line-height: var(--text-style-display-line-height);
  letter-spacing: 0;
}
.type-display-medium-regular,
.type-display-medium-medium,
.type-display-medium-bold,
[data-text-style="Display/Medium-Regular"],
[data-text-style="Display/Medium-Medium"],
[data-text-style="Display/Medium-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-display-medium-font-size);
  line-height: var(--text-style-display-line-height);
  letter-spacing: 0;
}
.type-display-small-regular,
.type-display-small-medium,
.type-display-small-bold,
[data-text-style="Display/Small-Regular"],
[data-text-style="Display/Small-Medium"],
[data-text-style="Display/Small-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-display-small-font-size);
  line-height: var(--text-style-display-line-height);
  letter-spacing: 0;
}
.type-title-large-regular,
.type-title-large-medium,
.type-title-large-bold,
[data-text-style="Title/Large-Regular"],
[data-text-style="Title/Large-Medium"],
[data-text-style="Title/Large-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-title-large-font-size);
  line-height: var(--text-style-title-line-height);
  letter-spacing: 0;
}
.type-title-medium-regular,
.type-title-medium-medium,
.type-title-medium-bold,
[data-text-style="Title/Medium-Regular"],
[data-text-style="Title/Medium-Medium"],
[data-text-style="Title/Medium-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-title-medium-font-size);
  line-height: var(--text-style-title-line-height);
  letter-spacing: 0;
}
.type-title-small-regular,
.type-title-small-medium,
.type-title-small-bold,
[data-text-style="Title/Small-Regular"],
[data-text-style="Title/Small-Medium"],
[data-text-style="Title/Small-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-title-small-font-size);
  line-height: var(--text-style-title-line-height);
  letter-spacing: 0;
}
.type-heading-large-regular,
.type-heading-large-medium,
.type-heading-large-bold,
[data-text-style="Heading/Large-Regular"],
[data-text-style="Heading/Large-Medium"],
[data-text-style="Heading/Large-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-heading-large-font-size);
  line-height: var(--text-style-heading-line-height);
  letter-spacing: 0;
}
.type-heading-medium-regular,
.type-heading-medium-medium,
.type-heading-medium-bold,
[data-text-style="Heading/Medium-Regular"],
[data-text-style="Heading/Medium-Medium"],
[data-text-style="Heading/Medium-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-heading-medium-font-size);
  line-height: var(--text-style-heading-line-height);
  letter-spacing: 0;
}
.type-heading-small-regular,
.type-heading-small-medium,
.type-heading-small-bold,
[data-text-style="Heading/Small-Regular"],
[data-text-style="Heading/Small-Medium"],
[data-text-style="Heading/Small-Bold"] {
  font-family: var(--font-display);
  font-size: var(--text-style-heading-small-font-size);
  line-height: var(--text-style-heading-line-height);
  letter-spacing: 0;
}
.type-body-large-regular,
.type-body-large-medium,
.type-body-large-bold,
[data-text-style="Body/Large-Regular"],
[data-text-style="Body/Large-Medium"],
[data-text-style="Body/Large-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-body-large-font-size);
  line-height: var(--text-style-body-line-height);
  letter-spacing: 0;
}
.type-body-medium-regular,
.type-body-medium-medium,
.type-body-medium-bold,
[data-text-style="Body/Medium-Regular"],
[data-text-style="Body/Medium-Medium"],
[data-text-style="Body/Medium-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-body-medium-font-size);
  line-height: var(--text-style-body-line-height);
  letter-spacing: 0;
}
.type-body-small-regular,
.type-body-small-medium,
.type-body-small-bold,
[data-text-style="Body/Small-Regular"],
[data-text-style="Body/Small-Medium"],
[data-text-style="Body/Small-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-body-small-font-size);
  line-height: var(--text-style-body-line-height);
  letter-spacing: 0;
}
.type-label-large-regular,
.type-label-large-medium,
.type-label-large-bold,
[data-text-style="Label/Large-Regular"],
[data-text-style="Label/Large-Medium"],
[data-text-style="Label/Large-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-label-large-font-size);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
}
.type-label-medium-regular,
.type-label-medium-medium,
.type-label-medium-bold,
[data-text-style="Label/Medium-Regular"],
[data-text-style="Label/Medium-Medium"],
[data-text-style="Label/Medium-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-label-medium-font-size);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
}
.type-label-small-regular,
.type-label-small-medium,
.type-label-small-bold,
[data-text-style="Label/Small-Regular"],
[data-text-style="Label/Small-Medium"],
[data-text-style="Label/Small-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-label-small-font-size);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
}
.type-caption-medium-regular,
.type-caption-medium-medium,
.type-caption-medium-bold,
[data-text-style="Caption/Medium-Regular"],
[data-text-style="Caption/Medium-Medium"],
[data-text-style="Caption/Medium-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-caption-medium-font-size);
  line-height: var(--text-style-caption-line-height);
  letter-spacing: 0;
}
.type-caption-small-regular,
.type-caption-small-medium,
.type-caption-small-bold,
[data-text-style="Caption/Small-Regular"],
[data-text-style="Caption/Small-Medium"],
[data-text-style="Caption/Small-Bold"] {
  font-family: var(--font-body);
  font-size: var(--text-style-caption-small-font-size);
  line-height: var(--text-style-caption-line-height);
  letter-spacing: 0;
}
.type-display-large-regular,
.type-display-medium-regular,
.type-display-small-regular,
.type-title-large-regular,
.type-title-medium-regular,
.type-title-small-regular,
.type-heading-large-regular,
.type-heading-medium-regular,
.type-heading-small-regular,
.type-body-large-regular,
.type-body-medium-regular,
.type-body-small-regular,
.type-label-large-regular,
.type-label-medium-regular,
.type-label-small-regular,
.type-caption-medium-regular,
.type-caption-small-regular,
[data-text-style$="-Regular"] {
  font-weight: var(--text-style-weight-regular);
}
.type-display-large-medium,
.type-display-medium-medium,
.type-display-small-medium,
.type-title-large-medium,
.type-title-medium-medium,
.type-title-small-medium,
.type-heading-large-medium,
.type-heading-medium-medium,
.type-heading-small-medium,
.type-body-large-medium,
.type-body-medium-medium,
.type-body-small-medium,
.type-label-large-medium,
.type-label-medium-medium,
.type-label-small-medium,
.type-caption-medium-medium,
.type-caption-small-medium,
[data-text-style$="-Medium"] {
  font-weight: var(--text-style-weight-medium);
}
.type-display-large-bold,
.type-display-medium-bold,
.type-display-small-bold,
.type-title-large-bold,
.type-title-medium-bold,
.type-title-small-bold,
.type-heading-large-bold,
.type-heading-medium-bold,
.type-heading-small-bold,
.type-body-large-bold,
.type-body-medium-bold,
.type-body-small-bold,
.type-label-large-bold,
.type-label-medium-bold,
.type-label-small-bold,
.type-caption-medium-bold,
.type-caption-small-bold,
[data-text-style$="-Bold"] {
  font-weight: var(--text-style-weight-bold);
}

/* Legacy role aliases — 새 Figma Text Style 토큰으로 연결. */
.type-display {
  font-family: var(--font-display);
  font-size: var(--text-style-display-small-font-size);
  font-weight: var(--text-style-weight-bold);
  line-height: var(--text-style-display-line-height);
  letter-spacing: 0;
}
.type-title {
  font-family: var(--font-display);
  font-size: var(--text-style-title-large-font-size);
  font-weight: var(--text-style-weight-bold);
  line-height: var(--text-style-title-line-height);
  letter-spacing: 0;
}
.type-heading {
  font-family: var(--font-display);
  font-size: var(--text-style-heading-small-font-size);
  font-weight: var(--text-style-weight-bold);
  line-height: var(--text-style-heading-line-height);
  letter-spacing: 0;
}
.type-body {
  font-family: var(--font-body);
  font-size: var(--text-style-body-medium-font-size);
  font-weight: var(--text-style-weight-regular);
  line-height: var(--text-style-body-line-height);
  letter-spacing: 0;
}
.type-label {
  font-family: var(--font-body);
  font-size: var(--text-style-label-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  line-height: var(--text-style-label-line-height);
  letter-spacing: 0;
}
.type-caption,
.type-caption-sm {
  font-family: var(--font-body);
  font-size: var(--text-style-caption-medium-font-size);
  font-weight: var(--text-style-weight-regular);
  line-height: var(--text-style-caption-line-height);
  letter-spacing: 0;
}
.type-caption-xs {
  font-family: var(--font-body);
  font-size: var(--text-style-caption-small-font-size);
  font-weight: var(--text-style-weight-regular);
  line-height: var(--text-style-caption-line-height);
  letter-spacing: 0;
}
/* weight 보조 (Regular/Medium/Bold 만) */
.fw-regular { font-weight: 400; }
.fw-medium  { font-weight: 500; }
.fw-bold    { font-weight: 700; }

.page {
  max-width: var(--max-reading);
  margin: 0 auto;
  /* 페이지 바깥 여백: 상단 40 / 좌우 40 / 하단 80 (디자인규칙.md Page Margin) */
  padding: var(--margin-page-top) var(--margin-page-x) var(--margin-page-bottom);
}

/* ════════════════════════════════════════════════
 * D51c Step 8 컴포넌트 클래스 — Stitch v3 시안 미러
 * ════════════════════════════════════════════════ */

/* Master-detail layout (Sidebar + Main) */
.kg-master-detail {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--semantic-fill-subtle);
}
.kg-master-detail:has(.kg-sidebar.is-collapsed) {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}
/* ★풀하이트 앱 셸 페이지(kg-app-shell)에서는 최상위 grid 를 뷰포트에 **상한 고정** 한다.
   기본 .kg-master-detail 은 min-height:100vh(하한만) → 자식(우 패널 콘텐츠)의 min-height:auto
   intrinsic 높이가 grid 행으로 합산 전파돼 페이지가 100vh 를 초과(사용자 "오른쪽 내용 펼치면 그만큼
   내려감"). height:100vh + overflow:hidden + 단일 행 minmax(0,1fr) 로 grid 를 정확히 뷰포트로
   잠그면, 내부 패널만 스크롤하고 페이지는 안 늘어난다. (WorkbenchViewportContainmentSpec) */
.kg-master-detail:has(.kg-app-shell) {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  grid-template-rows: minmax(0, 1fr);
}
.kg-main-detail {
  min-width: 0;
  padding: var(--pad-3xl);
  background: var(--semantic-fill-subtle);
  overflow-y: auto;
}
/* ★풀하이트 앱 셸(kg-app-shell: height:100vh + 내부 자체 스크롤)은 main-detail 의 패딩(상·하)이
   100vh 위에 더해져 콘텐츠가 100vh 를 초과 → 페이지가 세로로 들뜨고 하단에 빈 공간이 생긴다
   (사용자 지적 "밑에 들리는거"). upload-page 와 동일하게 패딩 0 + height:100vh + overflow:hidden
   으로 셸이 뷰포트에 정확히 맞고 내부 패널만 스크롤하게 한다. (bundles/refine/variant/downloads 공통) */
.kg-main-detail:has(.kg-app-shell) {
  height: 100vh;
  padding: 0;
  overflow: hidden;
}

/* Sidebar */
.kg-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  box-sizing: border-box;
  background: var(--semantic-fill-default);
  border-right: 1px solid var(--semantic-border-default);
  padding: var(--pad-lg) var(--pad-md);
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
  overflow: visible;
  overscroll-behavior: none;
  z-index: 10;
  transition: width var(--motion-medium), padding var(--motion-medium);
}
.kg-sidebar-fixed-top,
.kg-sidebar-fixed-bottom {
  width: 100%;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}
.kg-sidebar-scroll {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: none;
}
.kg-sidebar-scroll > .kg-nav-group:first-child > .kg-sidebar-divider {
  display: none;
}
.kg-nav-group--main > .kg-sidebar-divider {
  display: none;
}
.kg-sidebar-brand {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 var(--pad-sm);
}
.kg-sidebar-logo {
  display: inline-flex;
  width: 88px;
  height: 20px;
  color: inherit;
  text-decoration: none;
}
.kg-sidebar-logo .kg-login-logo-full {
  width: 88px;
  height: 20px;
}
.kg-sidebar-collapse {
  position: absolute;
  top: 20px;
  right: -17px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-full);
  background: var(--semantic-fill-default);
  color: var(--semantic-text-muted);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  z-index: 20;
  transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.kg-sidebar-collapse:hover,
.kg-sidebar-collapse:active {
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-secondary);
}
.kg-sidebar-collapse:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-workspace-switcher {
  width: 100%;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: var(--gap-lg);
  padding: 0 var(--pad-md);
  border-radius: var(--radius-lg);
  color: inherit;
  text-decoration: none;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-workspace-switcher:hover,
.kg-workspace-switcher:active {
  background: var(--semantic-fill-subtle);
}
.kg-workspace-switcher:active {
  transform: scale(0.98);
}
.kg-workspace-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--semantic-text-inverse);
  border-radius: var(--radius-md);
  background: #EDF4FD;
  color: var(--semantic-fill-brand);
}
.kg-workspace-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.kg-workspace-eyebrow {
  color: var(--semantic-text-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.066px;
}
.kg-workspace-name {
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-workspace-chevron {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--semantic-text-secondary);
}
.kg-sidebar-top {
  width: 100%;
}
.kg-sidebar-divider {
  width: 100%;
  height: 1px;
  flex: 0 0 auto;
  background: var(--semantic-border-default);
}
.kg-sidebar-spacer {
  flex: 1 1 auto;
  min-height: var(--space-300);
}
.kg-sidebar-bottom,
.kg-sidebar-fixed-bottom {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.kg-sidebar-bottom {
  gap: var(--gap-md);
}
.kg-sidebar-fixed-bottom {
  gap: var(--gap-xs);
}
.kg-sidebar-fixed-bottom .kg-nav-group {
  gap: var(--gap-xs);
}
.kg-sidebar-fixed-bottom .kg-sidebar-divider {
  margin-bottom: var(--gap-xs);
}
.kg-sidebar-fixed-bottom .kg-nav-group-label {
  height: 24px;
}
.kg-user-row {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  min-height: 68px;
  padding: 0 var(--pad-sm);
  border-radius: var(--radius-lg);
  color: var(--semantic-text-secondary);
}
.kg-avatar-tiny {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--radius-full);
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 700;
  letter-spacing: -0.192px;
}
.kg-user-row > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kg-user-name {
  flex: 0 1 auto;
  min-width: 0;
  display: block;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-user-meta {
  display: block;
  color: var(--semantic-text-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.066px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-settings { color: var(--text-muted); cursor: pointer; }

.kg-sidebar.is-collapsed {
  align-items: center;
  padding: var(--pad-lg) var(--pad-md);
}
.kg-sidebar.is-collapsed .kg-sidebar-fixed-top,
.kg-sidebar.is-collapsed .kg-sidebar-scroll,
.kg-sidebar.is-collapsed .kg-sidebar-fixed-bottom {
  align-items: center;
}
.kg-sidebar.is-collapsed .kg-sidebar-scroll {
  scrollbar-width: none;
}
.kg-sidebar.is-collapsed .kg-sidebar-scroll::-webkit-scrollbar {
  display: none;
}
.kg-sidebar.is-collapsed .kg-sidebar-brand {
  height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 var(--pad-sm);
  overflow: visible;
}
.kg-sidebar.is-collapsed .kg-sidebar-collapse {
  right: -20px;
}
.kg-sidebar.is-collapsed .kg-sidebar-logo {
  width: 18px;
  height: 20px;
  overflow: hidden;
}
.kg-sidebar.is-collapsed .kg-sidebar-logo .kg-login-logo-full {
  width: 88px;
  height: 20px;
  max-width: none;
}
.kg-sidebar.is-collapsed .kg-workspace-switcher {
  width: 56px;
  min-height: 52px;
  justify-content: center;
  gap: 0;
  padding: 0;
}
.kg-sidebar.is-collapsed .kg-workspace-text,
.kg-sidebar.is-collapsed .kg-workspace-chevron,
.kg-sidebar.is-collapsed .kg-nav-label {
  display: none;
}
.kg-sidebar.is-collapsed .kg-sidebar-top {
  display: flex;
  justify-content: center;
}
.kg-sidebar.is-collapsed .kg-cta-primary {
  width: 40px;
  min-height: 40px;
  height: 40px;
  padding: 0;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}
.kg-sidebar.is-collapsed .kg-cta-primary > span:not(.kg-sidebar-icon) {
  display: none;
}
.kg-sidebar.is-collapsed .kg-nav-group {
  align-items: center;
}
.kg-sidebar.is-collapsed .kg-nav-group-label {
  width: 56px;
  height: 24px;
  justify-content: center;
  padding: 0;
  font-size: 11px;
  line-height: 1.4;
}
.kg-sidebar.is-collapsed .kg-nav-list {
  width: 52px;
  align-items: center;
}
.kg-sidebar.is-collapsed .kg-nav-link,
.kg-sidebar.is-collapsed .kg-nav-action {
  width: 52px;
  justify-content: center;
  gap: 0;
  padding: 0;
}
.kg-sidebar.is-collapsed .kg-nav-link--primary {
  width: 52px;
  min-height: 40px;
}
.kg-sidebar.is-collapsed .kg-nav-link--secondary,
.kg-sidebar.is-collapsed .kg-nav-action {
  min-height: 40px;
}
.kg-sidebar.is-collapsed .kg-nav-badge {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 8px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  color: transparent;
}
.kg-sidebar.is-collapsed .kg-user-row {
  width: 56px;
  min-height: 64px;
  justify-content: center;
  gap: 0;
  padding: 0;
}
.kg-sidebar.is-collapsed .kg-user-row > span:last-child {
  display: none;
}
.kg-sidebar.is-collapsed .kg-avatar-tiny {
  width: 40px;
  height: 40px;
}

.kg-nav-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}
.kg-nav-group-label {
  height: 30px;
  display: flex;
  align-items: center;
  padding: 0 var(--pad-sm);
  color: var(--semantic-text-muted);
  font-size: 11px;
  line-height: 1.4;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.066px;
}
.kg-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}
.kg-nav-row {
  margin: 0;
  padding: 0;
}
.kg-drag-handle {
  color: var(--text-subtle);
  opacity: 0;
  font-size: 12px;
  width: 12px;
  transition: opacity var(--motion-fast);
  cursor: grab;
}
.kg-task-row:hover .kg-drag-handle {
  opacity: 1;
}
.kg-nav-bullet {
  display: none;
}
.kg-nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  border-radius: var(--radius-lg);
  color: var(--semantic-text-secondary);
  text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-nav-link--primary {
  min-height: 40px;
  padding: 0 var(--pad-md) 0 var(--pad-lg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-nav-link--secondary,
.kg-nav-action {
  min-height: 40px;
  padding: 0 var(--pad-md) 0 var(--pad-lg);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-nav-link:hover,
.kg-nav-link:active,
.kg-nav-action:hover,
.kg-nav-action:active {
  background: var(--semantic-fill-subtle);
}
.kg-nav-link[aria-current="page"],
.kg-nav-link.is-active {
  background: #EDF4FD;
  color: var(--semantic-state-brand-hover);
  font-weight: 700;
}
.kg-nav-link:active,
.kg-nav-action:active {
  transform: scale(0.98);
}
.kg-nav-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--semantic-text-secondary);
  font-family: var(--font-body);
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.kg-nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kg-nav-link--secondary .kg-nav-icon,
.kg-nav-action .kg-nav-icon {
  width: 20px;
  height: 20px;
}
.kg-nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-nav-badge {
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: var(--radius-full);
  background: var(--semantic-fill-danger);
  color: var(--semantic-text-inverse);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.066px;
}

/* Buttons */
.kg-cta-primary {
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse) !important;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 var(--pad-xl);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
  cursor: pointer;
}
.kg-cta-primary:hover,
.kg-cta-primary:active { background: var(--semantic-state-brand-hover); }
.kg-cta-primary:active { transform: scale(var(--semantic-button-pressed-scale)); }
.kg-cta-primary:disabled,
.kg-cta-primary:disabled:hover,
.kg-cta-primary:disabled:active {
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-disabled) !important;
  transform: none;
  cursor: not-allowed;
}

.kg-workspace-mark .kg-sidebar-icon,
.kg-cta-primary .kg-sidebar-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}
.kg-nav-action .kg-sidebar-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
.kg-sidebar-collapse .kg-sidebar-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.kg-sidebar-icon {
  width: 100%;
  height: 100%;
  display: block;
  background: currentColor;
  -webkit-mask-image: var(--kg-sidebar-icon-image);
  mask-image: var(--kg-sidebar-icon-image);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.kg-sidebar-icon--add { --kg-sidebar-icon-image: url("/assets/icons/add.svg"); }
.kg-sidebar-icon--home { --kg-sidebar-icon-image: url("/assets/icons/home.svg"); }
.kg-sidebar-icon--upload { --kg-sidebar-icon-image: url("/assets/icons/library_add.svg"); }
.kg-sidebar-icon--refine { --kg-sidebar-icon-image: url("/assets/icons/contract_edit.svg"); }
.kg-sidebar-icon--solution { --kg-sidebar-icon-image: url("/assets/icons/done_all.svg"); }
.kg-sidebar-icon--variant { --kg-sidebar-icon-image: url("/assets/icons/featured_play_list.svg"); }
.kg-sidebar-icon--download { --kg-sidebar-icon-image: url("/assets/icons/box.svg"); }
.kg-sidebar-icon--library { --kg-sidebar-icon-image: url("/assets/icons/database.svg"); }
.kg-sidebar-icon--workspace-bookmark { --kg-sidebar-icon-image: url("/assets/icons/workspace-bookmark.svg"); }
.kg-sidebar-icon--test-paper { --kg-sidebar-icon-image: url("/assets/icons/article.svg"); }
.kg-sidebar-icon--workspace { --kg-sidebar-icon-image: url("/assets/icons/enterprise.svg"); }
.kg-sidebar-icon--account { --kg-sidebar-icon-image: url("/assets/icons/person.svg"); }
.kg-sidebar-icon--admin { --kg-sidebar-icon-image: url("/assets/icons/home_storage.svg"); }
.kg-sidebar-icon--concept { --kg-sidebar-icon-image: url("/assets/icons/filter.svg"); }
.kg-sidebar-icon--rag { --kg-sidebar-icon-image: url("/assets/icons/alarm_smart_wake.svg"); }
.kg-sidebar-icon--edge { --kg-sidebar-icon-image: url("/assets/icons/arrow_right_alt.svg"); }
.kg-sidebar-icon--logout { --kg-sidebar-icon-image: url("/assets/icons/logout.svg"); }
.kg-sidebar-icon--chevron-down { --kg-sidebar-icon-image: url("/assets/icons/arrow_drop_down.svg"); }
.kg-sidebar-icon--menu-close { --kg-sidebar-icon-image: url("/assets/icons/arrow_menu_close.svg"); }
.kg-sidebar-icon--menu-open { --kg-sidebar-icon-image: url("/assets/icons/arrow_menu_open.svg"); }

/* Account settings */
.kg-account-page {
  position: relative;
  min-height: 100vh;
  margin: calc(-1 * var(--pad-3xl));
  padding: var(--pad-4xl);
  display: flex;
  justify-content: center;
  background: var(--semantic-fill-default);
}
.kg-account-content {
  width: min(480px, 100%);
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
}
.kg-account-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
}
.kg-account-header {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kg-account-header h1 {
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.24px;
}
.kg-account-header .btn {
  width: 112px;
}
.kg-account-profile {
  position: relative;
  height: 120px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kg-account-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kg-account-avatar span {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.384px;
}
.kg-account-avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--radius-full);
  object-fit: cover;
}
.kg-account-avatar-edit {
  position: absolute;
  left: calc(50% + 10px);
  top: 68px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-full);
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  box-shadow: none;
  cursor: pointer;
}
.kg-account-avatar-edit::before {
  content: "";
  width: 18px;
  height: 18px;
  display: block;
  background: currentColor;
  -webkit-mask: url("/assets/icons/profile-edit.svg") center / 18px 18px no-repeat;
  mask: url("/assets/icons/profile-edit.svg") center / 18px 18px no-repeat;
}
.kg-account-avatar-edit:hover,
.kg-account-avatar-edit:active {
  color: var(--semantic-state-brand-hover);
  background: var(--semantic-fill-subtle);
}
.kg-account-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.kg-account-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kg-account-label {
  height: 20px;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-account-input {
  width: 100%;
  height: 52px;
  box-sizing: border-box;
  background: var(--semantic-fill-default);
}
.kg-account-helper {
  color: var(--semantic-text-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.066px;
}
.kg-account-wide-button,
.kg-account-google-button {
  width: 100%;
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  cursor: pointer;
  box-sizing: border-box;
  transition: background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}
.kg-account-wide-button {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-account-google-button {
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-account-wide-button:hover,
.kg-account-wide-button:active,
.kg-account-google-button:hover,
.kg-account-google-button:active {
  background: var(--semantic-fill-subtle);
}
.kg-account-wide-button:active,
.kg-account-google-button:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-account-google-mark {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4285F4;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.kg-account-actions {
  margin-top: auto;
  padding-top: var(--pad-4xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kg-account-text-action {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--semantic-text-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
  cursor: pointer;
}
.kg-account-text-action:hover,
.kg-account-text-action:active {
  color: var(--semantic-text-primary);
}
.kg-account-text-action--danger {
  color: var(--semantic-text-danger);
}
.kg-account-text-action--danger:hover,
.kg-account-text-action--danger:active {
  color: var(--semantic-state-danger-hover);
}
.kg-account-toast {
  position: fixed;
  left: calc(var(--sidebar-width) + ((100vw - var(--sidebar-width)) / 2));
  bottom: var(--pad-4xl);
  transform: translateX(-50%);
  min-width: 218px;
  height: 40px;
  padding: 0 var(--pad-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  border-radius: var(--radius-full);
  background: var(--semantic-fill-inverse);
  color: var(--semantic-text-inverse);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
  z-index: 1000;
  animation: kg-auth-toast-in var(--motion-medium) var(--motion-easing) both;
}
.kg-master-detail:has(.kg-sidebar.is-collapsed) .kg-account-toast {
  left: calc(var(--sidebar-collapsed-width) + ((100vw - var(--sidebar-collapsed-width)) / 2));
}
.kg-account-toast-icon {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--semantic-text-inverse);
  color: var(--semantic-fill-inverse);
  position: relative;
}
.kg-account-toast-icon::before {
  content: "";
  position: absolute;
  inset: 3px 2px;
  background: currentColor;
  -webkit-mask: url("/assets/icons/check_small.svg") center / contain no-repeat;
  mask: url("/assets/icons/check_small.svg") center / contain no-repeat;
}
.kg-account-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: var(--pad-lg);
  background: rgba(25, 31, 40, 0.56);
  animation: kg-account-modal-dim-in var(--motion-medium) var(--motion-easing) both;
}
.kg-profile-photo-modal {
  width: 400px;
  height: 555px;
  box-sizing: border-box;
  padding: 25px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-2xl);
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  box-shadow: var(--shadow-modal);
  animation: kg-account-modal-in var(--motion-medium) var(--motion-easing) both;
}
.kg-profile-photo-modal-body {
  width: 350px;
  height: 445px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kg-profile-photo-modal-header {
  width: 350px;
  height: 97px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kg-profile-photo-modal-header h2,
.kg-profile-photo-modal-header p {
  margin: 0;
}
.kg-profile-photo-modal-header h2 {
  color: var(--semantic-text-primary);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}
.kg-profile-photo-modal-header p {
  color: var(--semantic-text-secondary);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0;
}
.kg-profile-photo-modal-summary {
  width: 350px;
  height: 120px;
  padding: 20px 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kg-profile-photo-dropzone {
  width: 350px;
  height: 204px;
  box-sizing: border-box;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  border: 1px dashed #89D8D8;
  border-radius: var(--radius-md);
  background: var(--semantic-fill-default);
}
.kg-profile-photo-upload-copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  flex: 0 0 auto;
}
.kg-profile-photo-upload-icon {
  width: 40px;
  height: 40px;
  display: block;
  margin-bottom: 8px;
  background: url("/assets/icons/profile-cloud-upload.svg") center / 40px 40px no-repeat;
}
.kg-profile-photo-upload-title {
  width: 100%;
  color: var(--semantic-text-secondary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-profile-photo-upload-description {
  width: 100%;
  color: var(--semantic-text-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.14px;
}
.kg-profile-photo-upload-button {
  position: relative;
  width: 100%;
  height: 32px;
  min-height: 32px;
  flex: 0 0 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.096px;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.kg-profile-photo-upload-button:hover,
.kg-profile-photo-upload-button:active {
  background: var(--semantic-fill-strong);
}
.kg-profile-photo-upload-button:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-profile-photo-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.kg-profile-photo-file-item {
  width: 350px;
  height: 68px;
  flex: 0 0 68px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--pad-md);
  border-radius: var(--radius-md);
  background: var(--semantic-fill-subtle);
}
.kg-profile-photo-file-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: block;
  color: #42CFC6;
  background: currentColor;
  -webkit-mask: url("/assets/icons/image.svg") center / 24px 24px no-repeat;
  mask: url("/assets/icons/image.svg") center / 24px 24px no-repeat;
}
.kg-profile-photo-file-name {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--semantic-text-secondary);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.192px;
}
.kg-profile-photo-delete-button {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--semantic-fill-danger);
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast), color var(--motion-fast);
}
.kg-profile-photo-delete-button:hover,
.kg-profile-photo-delete-button:active {
  background: rgba(240, 68, 82, 0.08);
  color: var(--semantic-state-danger-hover);
}
.kg-profile-photo-delete-button:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-profile-photo-delete-button span {
  width: 20px;
  height: 20px;
  display: block;
  background: currentColor;
  -webkit-mask: url("/assets/icons/profile-delete.svg") center / 20px 20px no-repeat;
  mask: url("/assets/icons/profile-delete.svg") center / 20px 20px no-repeat;
}
.kg-profile-photo-modal-footer {
  width: 350px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.kg-profile-photo-button {
  width: 88px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.kg-profile-photo-button:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-profile-photo-button--secondary {
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-primary);
}
.kg-profile-photo-button--secondary:hover,
.kg-profile-photo-button--secondary:active {
  background: var(--semantic-fill-strong);
}
.kg-profile-photo-button--primary {
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
}
.kg-profile-photo-button--primary:hover,
.kg-profile-photo-button--primary:active {
  background: var(--semantic-state-brand-hover);
}
.kg-account-reset-page {
  min-height: 100vh;
  margin: calc(-1 * var(--pad-3xl));
  padding: 40px 24px 80px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  background: var(--semantic-fill-default);
}
.kg-account-reset-content {
  width: 480px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.kg-account-reset-breadcrumb {
  width: 480px;
  max-width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
}
.kg-account-reset-path,
.kg-account-reset-current {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--semantic-text-secondary);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: -0.096px;
  white-space: nowrap;
}
.kg-account-reset-path {
  gap: 6px;
  padding: 8px 8px 8px 0;
  font-weight: 400;
}
.kg-account-reset-current {
  padding: 8px 12px 8px 0;
  color: var(--semantic-text-primary);
  font-weight: 700;
}
.kg-account-reset-breadcrumb-arrow {
  width: 16px;
  height: 16px;
  display: block;
  background: currentColor;
  -webkit-mask: url("/assets/icons/arrow_forward_ios.svg") center / 16px 16px no-repeat;
  mask: url("/assets/icons/arrow_forward_ios.svg") center / 16px 16px no-repeat;
}
.kg-account-reset-section {
  width: 480px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.kg-account-reset-intro {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kg-account-reset-intro h1,
.kg-account-reset-intro p {
  margin: 0;
}
.kg-account-reset-intro h1 {
  color: var(--semantic-text-primary);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.6px;
}
.kg-account-reset-intro p {
  color: var(--semantic-text-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.14px;
}
.kg-account-reset-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.kg-account-reset-field {
  width: 100%;
  display: block;
}
.kg-account-reset-input {
  width: 100%;
  height: 52px;
  box-sizing: border-box;
  padding: 0 16px;
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-md);
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.192px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.kg-account-reset-input::placeholder {
  color: var(--semantic-text-muted);
}
.kg-account-reset-input:focus {
  outline: none;
  border-color: var(--semantic-fill-brand);
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.16);
}
.kg-account-reset-submit {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.192px;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.kg-account-reset-submit:hover,
.kg-account-reset-submit:active {
  background: var(--semantic-state-brand-hover);
}
.kg-account-reset-submit:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
@keyframes kg-account-modal-dim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes kg-account-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 432px) {
  .kg-account-reset-page {
    margin: calc(-1 * var(--pad-lg));
    padding: 32px 16px 64px;
  }
  .kg-profile-photo-modal {
    width: calc(100vw - 32px);
  }
  .kg-profile-photo-modal,
  .kg-profile-photo-modal-body,
  .kg-profile-photo-modal-header,
  .kg-profile-photo-modal-summary,
  .kg-profile-photo-dropzone,
  .kg-profile-photo-file-item,
  .kg-profile-photo-modal-footer {
    max-width: 100%;
  }
}

.kg-btn-primary {
  width: 100%;
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  border: none;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;   /* 버튼 라벨 = Label (15→14) */
  font-weight: 500;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-btn-primary:hover,
.kg-btn-primary:active { background: var(--semantic-state-brand-hover); }
.kg-btn-primary:active:not(:disabled) { transform: scale(var(--semantic-button-pressed-scale)); }

.kg-btn-ghost {
  background: transparent;
  border: none;
  color: var(--semantic-text-secondary);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-btn-ghost:hover,
.kg-btn-ghost:active { background: var(--semantic-fill-subtle); }
.kg-btn-ghost:active { transform: scale(var(--semantic-button-pressed-scale)); }

.kg-btn-ghost-purple {
  background: var(--semantic-fill-default);
  border: 1px solid var(--color-accent-purple);
  color: var(--color-accent-purple);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.kg-btn-google {
  width: 100%;
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  border: 1px solid var(--semantic-border-default);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;   /* 버튼 라벨 = Label (15→14) */
  font-weight: 500;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-btn-google:hover,
.kg-btn-google:active { background: var(--semantic-fill-muted); }
.kg-btn-google:active { transform: scale(var(--semantic-button-pressed-scale)); }

/* Inputs */
.kg-input {
  width: 100%;
  height: var(--size-lg);    /* Input 기본 (size/lg 52) */
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 16px;   /* 입력 텍스트 = Body */
  font-family: inherit;
  color: var(--text-primary);
  background: #FFFFFF;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
  box-sizing: border-box;
}
.kg-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.15);
}
.kg-field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Heading w/ accent */
.kg-h1-accent {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 45px;
  font-weight: 700;   /* 800→700: 디자이너 3-weight 체계(Regular/Medium/Bold) */
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
}
.kg-h2-accent {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  margin: 0 0 16px 0;
}
.kg-login-h2 {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

/* Backlink chip */
.kg-backlink-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--color-accent-bg);
  color: var(--text-accent);
  font-size: 11px;
  font-weight: 700;   /* 600→700: 디자이너 3-weight 체계 (강조=Bold) */
  border-radius: var(--radius-full);
  margin-left: 4px;
}
.kg-breadcrumb-chip {
  padding: 4px 12px;
  background: var(--color-accent-bg);
  color: var(--text-accent);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-full);
}

/* Dotted purple dropzone (organic affordance) */
.kg-dropzone {
  border: 2px dashed #7C3AED;
  background: rgba(124, 58, 237, 0.04);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Task list */
.kg-task-list {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.kg-task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-divider);
  cursor: pointer;
  transition: background var(--motion-fast);
}
.kg-task-row:last-child { border-bottom: none; }
.kg-task-row:hover { background: var(--color-surface); }

/* Login screen full-page form */
.kg-auth-screen {
  display: grid;
  grid-template-columns: minmax(420px, 600px) minmax(420px, 1fr);
  align-items: center;
  gap: var(--gap-2xl);
  min-height: 100vh;
  padding: clamp(32px, 4.45vw, 64px);
  background: var(--bg-page);
}
.kg-login-screen {
  min-height: 100vh;
  --kg-login-hero-w: 600px;
  --kg-login-page-h: min(900px, calc(100vh - 124px));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 62px 64px;
  background: #FFFFFF;
  overflow: auto;
}
.kg-login-hero {
  flex: 0 0 var(--kg-login-hero-w);
  height: var(--kg-login-page-h);
}
.kg-login-hero-image {
  width: 100%;
  height: 100%;
  border-radius: 40px;
  background: #F4F7FB url("/assets/keepgong-auth-visual.png") center / cover no-repeat;
  overflow: hidden;
}
.kg-auth-visual {
  min-height: min(900px, calc(100vh - 128px));
  width: 100%;
  border-radius: var(--radius-2xl);
  background:
    var(--fill-soft)
    url("/assets/keepgong-auth-visual.png")
    center / cover
    no-repeat;
  box-shadow: var(--shadow-xs);
}
.kg-auth-panel {
  min-height: min(900px, calc(100vh - 128px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--pad-2xl);
}
.kg-auth-logo {
  display: inline-flex;
  margin-bottom: var(--margin-section);   /* 48→40: generic lg 폐기, 섹션 간격(≤40) */
  color: inherit;
  text-decoration: none;
}
.kg-auth-form {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-2xl);
}
.kg-auth-form--signup {
  gap: var(--gap-xl);
}
.kg-auth-heading {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
}
.kg-auth-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-primary);
}
.kg-auth-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}
.kg-auth-fields {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
}
.kg-auth-check {
  display: flex;
  align-items: flex-start;
  gap: var(--gap-md);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
  cursor: pointer;
}
.kg-auth-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--semantic-fill-brand);
}
.kg-auth-submit {
  height: var(--size-md);
  padding: 0 var(--pad-lg);
  font-size: 16px;
}
.kg-auth-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--pad-lg);
  border-radius: var(--radius-md);
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-primary);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-auth-secondary-action:hover,
.kg-auth-secondary-action:active { background: var(--semantic-fill-strong); }
.kg-auth-secondary-action:active { transform: scale(var(--semantic-button-pressed-scale)); }
.kg-login-surface {
  position: relative;
  flex: 0 0 712px;
  height: var(--kg-login-page-h);
  max-width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 64px;
  background: #FFFFFF;
}
.kg-auth-toast {
  position: absolute;
  left: 50%;
  bottom: -24px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  max-width: min(340px, calc(100vw - 40px));
  padding: var(--pad-sm) var(--pad-md);
  border-radius: var(--radius-full);
  background: rgba(25, 31, 40, 0.72);
  color: var(--semantic-text-inverse);
  box-shadow: var(--shadow-snackbar);
  backdrop-filter: blur(var(--effect-snackbar-bg-blur));
  -webkit-backdrop-filter: blur(var(--effect-snackbar-bg-blur));
  transform: translateX(-50%);
  z-index: 10;
  animation: kg-auth-toast-in var(--motion-medium) var(--motion-easing) both;
}
.kg-auth-toast.is-exiting {
  animation: kg-auth-toast-out 260ms var(--motion-easing) both;
  pointer-events: none;
}
.kg-auth-toast > span:last-child {
  width: 260px;
  max-width: calc(100vw - 104px);
  color: var(--semantic-text-inverse);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: -0.14px;
  white-space: nowrap;
}
.kg-auth-toast-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--semantic-fill-inverse);
  color: var(--semantic-text-inverse);
}
.kg-auth-toast-icon-glyph {
  width: 20px;
  height: 20px;
  display: block;
}
@keyframes kg-auth-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes kg-auth-toast-out {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, 8px); }
}
.kg-login-form {
  width: 340px;
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}
.kg-login-logo {
  position: relative;
  display: block;
  width: 176px;
  height: 40px;
  flex: 0 0 auto;
  color: inherit;
  text-decoration: none;
}
.kg-login-logo-full {
  display: block;
  width: 176px;
  height: 40px;
  overflow: visible;
}
.kg-login-logo-symbol {
  position: absolute;
  left: 0;
  top: 0;
  width: 34.727px;
  height: 38.173px;
}
.kg-login-logo-symbol img {
  position: absolute;
  display: block;
  max-width: none;
}
.kg-login-logo-union {
  left: 0;
  top: 6.36px;
  width: 28.878px;
  height: 31.811px;
}
.kg-login-logo-tail {
  left: 14.58px;
  top: 16.97px;
  width: 20.147px;
  height: 16.171px;
}
.kg-login-logo-star {
  left: 24.65px;
  top: 0;
  width: 8.748px;
  height: 8.748px;
}
.kg-login-logo-type {
  position: absolute;
  left: 41.09px;
  top: 10.07px;
  width: 134.253px;
  height: 29.845px;
}
.kg-login-content {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 32px;
}
.kg-login-fields {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.kg-login-google {
  width: 100%;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 16px;
  border: 1px solid var(--semantic-border-default);
  border-radius: 10px;
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  letter-spacing: -0.24px;
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-login-google:hover,
.kg-login-google:active {
  background: var(--semantic-fill-muted);
  border-color: var(--semantic-border-default);
}
.kg-login-google:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-login-google:focus-visible,
.kg-login-input:focus-visible,
.kg-login-submit:focus-visible,
.kg-login-signup a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.22);
}
.kg-login-google img {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}
.kg-login-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.kg-login-divider span {
  flex: 1 1 0;
  height: 1px;
  background: var(--semantic-border-default);
}
.kg-login-divider small {
  flex: 0 0 auto;
  color: var(--semantic-text-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.066px;
}
.kg-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.kg-login-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-login-label-row > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}
.kg-login-label-row a {
  flex: 0 1 auto;
  min-width: 0;
  color: var(--semantic-state-brand-hover);
  text-decoration: none;
  text-align: right;
}
.kg-login-label-row a:hover {
  text-decoration: underline;
}
.kg-login-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--semantic-border-default);
  border-radius: 8px;
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.192px;
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.kg-login-input::placeholder {
  color: var(--semantic-text-muted);
  opacity: 1;
}
.kg-login-input:focus {
  outline: none;
  border-color: var(--semantic-fill-brand);
}
.kg-login-password-field {
  position: relative;
  display: block;
  width: 100%;
}
.kg-login-password-field .kg-login-input {
  padding-right: 48px;
}
.kg-login-visibility {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--semantic-text-muted);
  transform: translateY(-50%);
  transition: background var(--motion-fast), transform var(--motion-fast);
  cursor: pointer;
}
.kg-login-visibility:hover {
  background: var(--semantic-fill-muted);
}
.kg-login-visibility:active {
  transform: translateY(-50%) scale(var(--semantic-button-pressed-scale));
}
.kg-login-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: middle;
}
.kg-login-error {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.08);
  color: #B91C1C;
  font-size: 13px;
  line-height: 1.5;
}
.kg-login-submit {
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: none;
  border-radius: 8px;
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.192px;
  text-align: center;
  cursor: pointer;
  transition: background var(--motion-fast), box-shadow var(--motion-fast), opacity var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-login-submit:hover,
.kg-login-submit:active { background: var(--semantic-state-brand-hover); }
.kg-login-submit:active:not(:disabled) { transform: scale(var(--semantic-button-pressed-scale)); }
.kg-login-submit:disabled {
  opacity: var(--state-disabled-opacity);
  cursor: not-allowed;
}
.kg-login-signup {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
}
.kg-login-signup p {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-login-signup a {
  flex: 0 0 auto;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--semantic-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-login-signup a:hover,
.kg-login-signup a:active { background: var(--semantic-fill-muted); }
.kg-login-signup a:active { transform: scale(var(--semantic-button-pressed-scale)); }

/* Sign-up screen — Keep Gong Design ver.1.0 */
.kg-signup-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--semantic-fill-default);
  overflow: auto;
}
.kg-signup-logo-header {
  width: 640px;
  max-width: 100%;
  height: 120px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kg-signup-surface {
  width: 640px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 24px 80px;
  background: var(--semantic-fill-default);
}
.kg-signup-breadcrumb {
  width: 340px;
  max-width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
}
.kg-signup-path-chip {
  min-width: 0;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 8px 8px 0;
  border-radius: 8px;
  color: var(--semantic-text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.096px;
  white-space: nowrap;
}
.kg-signup-path-chip--active {
  padding-right: 12px;
  color: var(--semantic-text-primary);
  font-weight: 700;
}
.kg-signup-path-chip[href]:hover {
  color: var(--semantic-text-primary);
}
.kg-signup-content {
  width: 340px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 32px;
}
.kg-signup-intro {
  width: 100%;
}
.kg-signup-title {
  width: 100%;
  margin: 0;
  color: var(--semantic-text-primary);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.6px;
}
.kg-signup-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}
.kg-signup-field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kg-signup-label {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 20px;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-signup-input-wrap {
  position: relative;
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  border: 1px solid var(--semantic-border-default);
  border-radius: 8px;
  background: var(--semantic-fill-default);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.kg-signup-input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0 16px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--semantic-text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.192px;
}
.kg-signup-input::placeholder {
  color: var(--semantic-text-muted);
  opacity: 1;
}
.kg-signup-input-wrap:focus-within {
  border-color: var(--semantic-fill-brand);
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.18);
}
.kg-signup-field.is-error .kg-signup-input-wrap {
  border-width: 2px;
  border-color: var(--semantic-border-danger);
  box-shadow: none;
}
.kg-signup-input-wrap--with-icon .kg-signup-input {
  padding-right: 48px;
}
.kg-signup-helper {
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.096px;
}
.kg-signup-helper--danger {
  color: var(--semantic-text-danger);
}
.kg-signup-password-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kg-signup-password-rules {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--semantic-border-default);
  border-radius: 8px;
  background: var(--semantic-fill-muted);
}
.kg-signup-password-rules p {
  width: 100%;
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-signup-rule {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
  color: var(--semantic-text-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-signup-rule.is-unmet {
  color: var(--semantic-text-danger);
}
.kg-signup-rule.is-unmet .kg-signup-rule-dot {
  background: var(--semantic-icon-danger);
}
.kg-signup-rule.is-met {
  color: var(--semantic-text-success);
}
.kg-signup-rule-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kg-signup-rule-dot {
  width: 6px;
  height: 6px;
  display: block;
  border-radius: 999px;
  background: var(--semantic-icon-muted);
}
.kg-signup-rule .kg-signup-icon--check-small {
  display: none;
  color: var(--semantic-icon-success);
}
.kg-signup-rule.is-met .kg-signup-rule-dot {
  display: none;
}
.kg-signup-rule.is-met .kg-signup-icon--check-small {
  display: inline-block;
}
.kg-signup-visibility {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--semantic-text-muted);
  transform: translateY(-50%);
  transition: background var(--motion-fast), transform var(--motion-fast);
  cursor: pointer;
}
.kg-signup-visibility:hover {
  background: var(--semantic-fill-muted);
}
.kg-signup-visibility:active {
  transform: translateY(-50%) scale(var(--semantic-button-pressed-scale));
}
.kg-signup-checkbox {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--semantic-text-primary);
  cursor: pointer;
}
.kg-signup-checkbox input {
  position: absolute;
  left: 4px;
  top: 10px;
  width: 24px;
  height: 24px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.kg-signup-checkbox-control {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--semantic-border-default);
  border-radius: 6px;
  background: var(--semantic-fill-default);
  color: var(--semantic-text-inverse);
  transition: background var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast);
}
.kg-signup-checkbox-control .kg-signup-icon {
  opacity: 0;
}
.kg-signup-checkbox input:checked + .kg-signup-checkbox-control {
  border-width: 2px;
  border-color: var(--semantic-fill-brand);
  background: var(--semantic-fill-brand);
}
.kg-signup-checkbox input:checked + .kg-signup-checkbox-control .kg-signup-icon {
  opacity: 1;
}
.kg-signup-checkbox:active .kg-signup-checkbox-control {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-signup-checkbox input:focus-visible + .kg-signup-checkbox-control {
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.22);
}
.kg-signup-checkbox-label {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--semantic-text-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.192px;
}
.kg-signup-policy-link {
  color: var(--semantic-state-brand-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
}
.kg-signup-policy-link:hover {
  color: var(--semantic-fill-brand);
}
.kg-signup-submit {
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: none;
  border-radius: 8px;
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.192px;
  cursor: pointer;
  transition: background var(--motion-fast), box-shadow var(--motion-fast), opacity var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-signup-submit:hover,
.kg-signup-submit:active {
  background: var(--semantic-state-brand-hover);
}
.kg-signup-submit:active:not(:disabled) {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-signup-submit:focus-visible,
.kg-signup-signin a:focus-visible,
.kg-signup-path-chip[href]:focus-visible,
.kg-signup-input-wrap:focus-within,
.kg-signup-visibility:focus-visible {
  outline: none;
}
.kg-signup-submit:focus-visible,
.kg-signup-signin a:focus-visible,
.kg-signup-path-chip[href]:focus-visible,
.kg-signup-visibility:focus-visible {
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.22);
}
.kg-signup-message {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.kg-signup-message--danger {
  border: 1px solid rgba(240, 68, 82, 0.28);
  background: rgba(240, 68, 82, 0.08);
  color: var(--semantic-text-danger);
}
.kg-signup-message--success {
  border: 1px solid rgba(2, 162, 98, 0.24);
  background: rgba(2, 162, 98, 0.08);
  color: var(--semantic-text-success);
}
.kg-signup-signin {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.kg-signup-signin p {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-signup-signin a {
  height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--semantic-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-signup-signin a:hover,
.kg-signup-signin a:active {
  background: var(--semantic-fill-muted);
}
.kg-signup-signin a:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-password-reset-content {
  width: 340px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 32px;
}
.kg-password-reset-intro {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kg-password-reset-description {
  width: 100%;
  margin: 0;
  color: var(--semantic-text-secondary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.14px;
  word-break: keep-all;
}
.kg-password-reset-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}
.kg-password-reset-breadcrumb--hidden {
  opacity: 0;
  pointer-events: none;
}
.kg-password-reset-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.kg-password-reset-link-row {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.kg-password-reset-link-row p {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.14px;
}
.kg-password-reset-link-row a {
  height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--semantic-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.14px;
  transition: background var(--motion-fast), transform var(--motion-fast);
  transform-origin: center;
}
.kg-password-reset-link-row a:hover,
.kg-password-reset-link-row a:active {
  background: var(--semantic-fill-muted);
}
.kg-password-reset-link-row a:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-password-reset-link-row a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.22);
}
.kg-password-expiration-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--semantic-fill-default);
}
.kg-password-expiration-surface {
  width: 640px;
  max-width: 100%;
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 40px 40px 80px;
}
.kg-password-expiration-message {
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  text-align: center;
}
.kg-password-expiration-illustration {
  position: relative;
  width: 80px;
  height: 80px;
  display: block;
  overflow: hidden;
}
.kg-password-expiration-asset {
  position: absolute;
  display: block;
  pointer-events: none;
}
.kg-password-expiration-asset--cloud {
  left: 2.8px;
  top: 6.2px;
  width: 75px;
  height: 45.4px;
}
.kg-password-expiration-asset--lightning {
  left: 30.7px;
  top: 33.7px;
  width: 19.1px;
  height: 39.4px;
}
.kg-password-expiration-copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.kg-password-expiration-title {
  width: 100%;
  margin: 0;
  color: var(--semantic-text-primary);
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.7px;
  word-break: keep-all;
}
.kg-password-expiration-description {
  width: 100%;
  margin: 0;
  color: var(--semantic-text-secondary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.192px;
  word-break: keep-all;
}
.kg-password-expiration-button {
  width: min(480px, 100%);
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-primary);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.192px;
  transition: background var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
  transform-origin: center;
}
.kg-password-expiration-button:hover,
.kg-password-expiration-button:active {
  background: var(--semantic-fill-strong);
}
.kg-password-expiration-button:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-password-expiration-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.22);
}
.kg-signup-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  display: inline-block;
  vertical-align: middle;
}
.kg-login-visibility > .kg-login-icon,
.kg-signup-visibility > .kg-signup-icon {
  color: var(--semantic-icon-muted);
}
.kg-login-signup a > .kg-login-icon,
.kg-signup-signin a > .kg-signup-icon,
.kg-password-reset-link-row a > .kg-signup-icon {
  color: var(--semantic-text-secondary);
}
.kg-signup-path-chip > .kg-signup-icon {
  width: 16px;
  height: 16px;
  color: var(--semantic-icon-disabled);
}
.kg-signup-rule .kg-signup-icon--check-small {
  color: var(--semantic-icon-success);
}
.kg-signup-checkbox-control .kg-signup-icon {
  color: var(--semantic-text-inverse);
}
.kg-signup-complete-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--semantic-fill-default);
}
.kg-signup-complete-surface {
  width: 640px;
  max-width: 100%;
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 40px 24px 80px;
}
.kg-signup-complete-message {
  width: min(480px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.kg-signup-complete-illustration {
  position: relative;
  width: 80px;
  height: 80px;
  display: block;
  overflow: hidden;
}
.kg-signup-complete-lottie,
.kg-signup-complete-static {
  position: absolute;
  inset: 0;
  display: block;
  width: 80px;
  height: 80px;
}
.kg-signup-complete-lottie {
  left: 50%;
  top: 50%;
  z-index: 1;
  opacity: 0;
  transform: translate(-50%, -50%) scale(2);
  transform-origin: center;
  transition: opacity var(--motion-fast);
}
.kg-signup-complete-lottie svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.kg-signup-complete-static {
  z-index: 0;
  opacity: 1;
  transition: opacity var(--motion-fast);
}
.kg-signup-complete-illustration.is-lottie-ready .kg-signup-complete-lottie {
  opacity: 1;
}
.kg-signup-complete-illustration.is-lottie-ready .kg-signup-complete-static {
  opacity: 0;
}
.kg-signup-complete-asset {
  position: absolute;
  display: block;
  pointer-events: none;
}
.kg-signup-complete-asset--left {
  left: 5px;
  top: 10.4px;
  width: 58.6px;
  height: 59.2px;
}
.kg-signup-complete-asset--right {
  left: 12.9px;
  top: 10.6px;
  width: 58.1px;
  height: 59px;
}
.kg-signup-complete-asset--confetti {
  left: 4.8px;
  top: 2.3px;
  width: 73.4px;
  height: 70.2px;
}
.kg-signup-complete-copy {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.kg-signup-complete-title {
  width: 100%;
  margin: 0;
  color: var(--semantic-text-primary);
  font-family: var(--font-body);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.7px;
  word-break: keep-all;
}
.kg-signup-complete-description {
  width: 100%;
  margin: 0;
  color: var(--semantic-text-secondary);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: -0.216px;
  word-break: keep-all;
}
.kg-signup-complete-button {
  min-width: 164px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.192px;
  transition: background var(--motion-fast), transform var(--motion-fast), box-shadow var(--motion-fast);
  transform-origin: center;
}
.kg-signup-complete-button:hover,
.kg-signup-complete-button:active {
  background: var(--semantic-state-brand-hover);
}
.kg-signup-complete-button:active {
  transform: scale(var(--semantic-button-pressed-scale));
}
.kg-signup-complete-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.22);
}
@media (max-width: 720px) {
  .kg-signup-screen {
    min-height: 100dvh;
    align-items: stretch;
  }
  .kg-signup-logo-header {
    width: 100%;
    height: 96px;
  }
  .kg-signup-surface {
    width: 100%;
    padding: 24px 20px 56px;
  }
  .kg-signup-breadcrumb,
  .kg-signup-content,
  .kg-password-reset-content {
    width: min(100%, 340px);
  }
  .kg-signup-complete-surface,
  .kg-password-expiration-surface {
    width: 100%;
    min-height: calc(100dvh - 96px);
    padding: 24px 20px 56px;
  }
}
@media (max-width: 420px) {
  .kg-signup-signin {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .kg-signup-signin a {
    width: 100%;
  }
  .kg-signup-checkbox-label,
  .kg-signup-input,
  .kg-signup-submit {
    font-size: 15px;
  }
  .kg-signup-complete-title,
  .kg-password-expiration-title {
    font-size: 24px;
  }
  .kg-signup-complete-description,
  .kg-password-expiration-description {
    font-size: 16px;
  }
}
@media (max-width: 960px) {
  .kg-auth-screen {
    grid-template-columns: 1fr;
    gap: var(--gap-xl);
    padding: var(--pad-lg);
  }
  .kg-auth-visual {
    min-height: 220px;
    max-height: 280px;
    border-radius: var(--radius-xl);
  }
  .kg-auth-panel {
    min-height: auto;
    padding: var(--pad-xl) var(--pad-sm) var(--pad-3xl);
  }
  .kg-auth-logo {
    margin-bottom: var(--margin-md);
  }
  .kg-auth-form {
    max-width: 420px;
  }
}

@media (max-width: 720px) {
  .kg-auth-screen {
    min-height: 100dvh;
  }
  .kg-auth-visual {
    min-height: 160px;
  }
  .kg-auth-title {
    font-size: 24px;
  }
}

@media (max-width: 1300px) {
  .kg-login-screen {
    --kg-login-page-h: min(900px, calc(100vh - 80px));
    padding: 40px;
  }
  .kg-login-hero {
    flex: 1 1 48%;
    max-width: 600px;
  }
  .kg-login-surface {
    flex: 1 1 52%;
    max-width: 712px;
  }
}

@media (max-width: 860px) {
  .kg-login-screen {
    min-height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    gap: 32px;
    padding: 24px 20px 48px;
  }
  .kg-login-hero {
    flex: 0 0 auto;
    width: min(100%, 480px);
    height: 280px;
  }
  .kg-login-hero-image {
    border-radius: 24px;
  }
  .kg-login-surface {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
    padding: 0;
  }
  .kg-login-form {
    width: min(100%, 340px);
  }
}

@media (max-width: 420px) {
  .kg-login-screen {
    align-items: stretch;
  }
  .kg-login-hero {
    height: 220px;
  }
  .kg-login-form {
    width: 100%;
  }
  .kg-login-label-row a {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .kg-login-google,
  .kg-login-input,
  .kg-login-submit {
    font-size: 15px;
  }
  .kg-login-signup {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .kg-login-signup a {
    width: 100%;
  }
}

/* Wide form page (workspace_create) */
.kg-page-wide {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--pad-5xl) var(--pad-3xl);
}
.kg-form-card {
  background: #FFFFFF;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--pad-3xl);
  box-shadow: var(--shadow-card);
}

/* ════════════════════════════════════════════════════════════════
 * D52 cycle/d52-refine-ui — ④ 리파인 분할 워크스페이스
 * Stitch v8 + RemNote features (learn-any-pdf 분할 뷰).
 * @sync Specs/KeepGong/DesignSystem/RefineWorkspaceSpec.lean
 *   TopNavStage 5 / WorkspacePane(source 46|structure 54) / RefineStatusColor(verified/review/editing)
 * ════════════════════════════════════════════════════════════════ */

/* ── App shell: 전역 상단 네비 + 본문 ── */
.kg-app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--color-surface-app);
}

/* ── 전역 상단 네비 (단일 행, 줄바꿈 금지) ── */
.kg-topnav {
  height: var(--header-height);
  flex: 0 0 var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--gap-xl);   /* 24→20 그리드 스냅 (Gap 스케일 인접 단계) */
  padding: 0 var(--pad-2xl);
  background: var(--color-bg);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.kg-topnav-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  font-family: var(--font-display);
  font-weight: 700;   /* 800→700: 디자이너 3-weight 체계(Regular/Medium/Bold) */
  font-size: 16px;
  letter-spacing: -0.01em;
  /* RemNote blue→cyan 그라데이션 워드마크 */
  background: linear-gradient(92deg, var(--color-accent) 0%, var(--color-accent-cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.kg-topnav-breadcrumb {
  color: var(--text-subtle);
  font-size: 13px;
  flex: 0 0 auto;
}
.kg-topnav-breadcrumb .sep { margin: 0 var(--space-075); opacity: .6; }
.kg-topnav-stages {
  display: flex;
  align-items: center;
  gap: var(--gap-xs);
  flex: 1 1 auto;
  overflow: hidden;
}
.kg-topnav-stage {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;   /* 600→700: 디자이너 3-weight 체계 (강조=Bold) */
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;        /* ★ 라벨 줄바꿈 방지 (사용자 '두칸으로 밀림' 수정) */
  transition: background var(--motion-fast), color var(--motion-fast);
}
.kg-topnav-stage:hover { background: var(--color-sunken); }
.kg-topnav-stage.is-active {       /* 활성 스테이지 = cyan (RemNote 보조 accent) */
  background: rgba(56, 189, 248, 0.14);
  color: var(--color-accent-cyan);
}
.kg-topnav-right {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-lg);
  flex: 0 0 auto;
}
.kg-topnav-search {
  height: var(--size-xs);
  width: 132px;   /* 그룹 드롭다운 3개가 우측에 합류 — 폭 양보 */
  padding: 0 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--text-primary);
}
.kg-topnav-search:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(73, 151, 242, 0.12);
}

/* ── 사이드바→TopNav 마이그 그룹 드롭다운 (TopNavMenuMigrationSpec §2) ──
   native <details> — ai-crawl 이 Leptos 클릭을 발화시키지 못해 브라우저 토글 채택.
   메뉴 항목은 닫혀 있어도 DOM 에 존재 (QA: 13 href 상존 검증 가능). */
.kg-topnav-group { position: relative; }
.kg-topnav-group-summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  list-style: none;             /* 기본 ▶ 마커 제거 */
  transition: background var(--motion-fast), color var(--motion-fast);
}
.kg-topnav-group-summary::-webkit-details-marker { display: none; }
.kg-topnav-group-summary::after { content: "▾"; font-size: 10px; opacity: .7; }
.kg-topnav-group-summary:hover { background: var(--color-sunken); }
.kg-topnav-group[open] .kg-topnav-group-summary {
  background: rgba(80, 108, 247, 0.10);
  color: var(--color-accent);
}
.kg-topnav-group-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;   /* RIGHT 영역 소속 — 좌측으로 펼치면 viewport 이탈 방지 */
  min-width: 168px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
}
.kg-topnav-group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
}
.kg-topnav-group-item:hover { background: var(--color-sunken); }

/* ── 좁은 폭 대응 (TopNavMenuMigrationSpec — Codex F3) ──
   stages 는 overflow:hidden 이라 좁은 폭에서 stage 링크가 잘린다.
   우선순위: stage 링크 + 그룹 드롭다운 > 검색 > breadcrumb. */
@media (max-width: 1100px) {
  .kg-topnav-search { display: none; }
}
@media (max-width: 900px) {
  .kg-topnav-breadcrumb { display: none; }
}

/* ── 분할 본문: 좌 원본(46) | 우 구조(54) ── */
.kg-refine-split {
  /* ★ flex-basis:0 (auto 아님) — auto 면 base size=콘텐츠 높이라, 우 패널 콘텐츠가 길면 grid 행이
     콘텐츠만큼 부풀어(순환 의존: 행 높이←콘텐츠) 셸이 100vh 초과 → 페이지 들뜸/하단 빈 공간
     (사용자 "오른쪽 내용 펼치면 그만큼 내려감"). basis 0 = 가용 공간만 채움 → grid 행 minmax(0,1fr)
     이 확정되고 패널이 내부 스크롤한다. (grid-template-rows 만으론 부족 — flex-basis 가 진짜 원인.) */
  flex: 1 1 0;
  display: grid;
  /* ★ calc()는 fr 미지원 → % 사용 (좌|우 유지). gap 은 minmax(0,..)로 오버플로 흡수 */
  /* D130 8/2: 가운데 12px = 드래그 손잡이 칼럼 (RefinePaneResizeHandle). 우측은
     1fr — 손잡이 폭을 %에서 빼는 계산을 없앤다 (좌 % 가 유일한 자유도). */
  grid-template-columns:
    minmax(0, calc(var(--pane-source) * 1%))
    12px
    minmax(0, 1fr);
  /* ★ 행도 1fr 로 묶어 패널이 컨테이너(100vh-flex) 높이를 받게 한다. 없으면 행이
     content-height(auto)로 늘어 페이지가 100vh 초과 → 무한 스크롤 (D106 fix). */
  grid-template-rows: minmax(0, 1fr);
  gap: var(--pane-gap);
  /* 좌우 반응형 패딩 — 와이드 화면에서 가장자리까지 퍼지지 않게 */
  padding: var(--pad-lg) clamp(16px, 4vw, 96px);
  min-height: 0;             /* grid 자식 스크롤 허용 */
  /* ★ splitBorderBox (WorkbenchViewportContainmentSpec): 세로 패딩(--pad-lg)이 flex 로 받은
     높이에 합산(content-box)되면 남은 공간을 초과 → 문서 스크롤. border-box 로 패딩을 높이 안에 흡수. */
  box-sizing: border-box;
}

/* ── 콘텐츠 생성 워크벤치: 선택 제목은 세로로 공개, 폭은 사용자에게 맡긴다 ──
 * ContentWorkbenchSpec §5b / token-map layout.workbenchListMinWidth.
 * 기존 리파인 split은 2열 고정으로 보존하고, 이 변형만 가운데 8px 손잡이를 가진다. */
.kg-workbench-split {
  grid-template-columns:
    minmax(var(--workbench-list-min-width), calc(var(--pane-source) * 1%))
    var(--pane-gap)
    minmax(var(--right-panel-width), 1fr);
  gap: var(--gap-none);
}

/* 패키지 전환 화면: 패키지 | 번들·바둑판 | 문제. 세 칼럼 중 최대 둘만 펼쳐지고
 * 접힌 칼럼은 기본 컨트롤 높이와 같은 48px 주소를 남긴다. 시간순 레거시는 그대로다. */
.kg-workbench-split.is-package-workspace {
  display: flex;
  gap: var(--kg-package-column-gap);
  padding-inline: clamp(12px, 2vw, 32px);
}

.kg-workbench-split.is-package-workspace .kg-workbench-column {
  flex-grow: 0;
  flex-shrink: 0;
  flex-basis: var(--kg-package-rail-width);
  will-change: flex-basis, flex-grow;
}

.kg-workbench-split.is-package-workspace .kg-package-column.is-open {
  flex-grow: var(--kg-package-user-grow, var(--kg-package-column-grow));
  flex-shrink: 1;
  flex-basis: var(--kg-package-column-min);
}

.kg-workbench-split.is-package-workspace .kg-bundle-column.is-open {
  flex-grow: var(--kg-package-user-grow, var(--kg-bundle-column-grow));
  flex-shrink: 1;
  flex-basis: var(--kg-bundle-column-min);
}

.kg-workbench-split.is-package-workspace .kg-problem-column.is-open {
  flex-grow: var(--kg-package-user-grow, var(--kg-problem-column-grow));
  flex-shrink: 1;
  flex-basis: var(--kg-problem-column-min);
}

.kg-package-column-resize-handle {
  position: relative;
  flex: 0 0 12px;
  min-width: 12px;
  min-height: 0;
  margin-inline: -4px;
  border: 0;
  outline: none;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
}

.kg-package-column-resize-handle::before {
  position: absolute;
  top: 44px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-border) 80%, transparent);
  content: "";
  transform: translateX(-50%);
  transition: width var(--kg-package-hover-duration) var(--kg-package-easing),
    background var(--kg-package-hover-duration) var(--kg-package-easing),
    box-shadow var(--kg-package-hover-duration) var(--kg-package-easing);
}

.kg-package-column-resize-handle:hover::before,
.kg-package-column-resize-handle:focus-visible::before {
  width: 3px;
  background: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-bg);
}

.kg-workbench-column {
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--kg-package-column-radius);
  background: var(--color-surface);
  box-shadow: var(--kg-package-column-shadow);
  transition: flex-basis var(--kg-package-layout-duration) var(--kg-package-easing),
    flex-grow var(--kg-package-layout-duration) var(--kg-package-easing),
    border-color var(--kg-package-content-duration) var(--kg-package-easing),
    background var(--kg-package-content-duration) var(--kg-package-easing),
    box-shadow var(--kg-package-content-duration) var(--kg-package-easing);
}

.kg-workbench-column.is-open { flex-direction: column; }

/* ★D130: 드래그 리사이즈 중에는 flex transition 을 끈다 — 패널이 마우스를 easing 으로
   뒤쫓아 뻑뻑하게 느껴지던 원인. 접기/펼치기 애니메이션은 드래그 밖에서만 산다. */
.kg-workbench-split.is-resizing,
.kg-workbench-split.is-resizing > * {
  transition: none !important;
}

.kg-workbench-column.is-collapsed {
  align-items: stretch;
  justify-content: stretch;
  background: color-mix(in srgb, var(--color-bg) 75%, var(--color-surface));
}

.kg-workbench-column.is-collapsed .kg-workbench-column-content {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(-1 * var(--kg-package-content-shift)));
  transition-delay: 0ms, 0ms, var(--kg-package-content-duration);
}

.kg-workbench-column-toggle {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-100);
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 52%, var(--color-surface));
  color: var(--color-text-2);
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
  transition: background var(--kg-package-hover-duration) var(--kg-package-easing),
    color var(--kg-package-hover-duration) var(--kg-package-easing);
}

.kg-workbench-column-toggle:hover {
  background: var(--color-accent-bg);
  color: var(--color-accent);
}

.kg-workbench-column.is-collapsed .kg-workbench-column-toggle {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 12px 8px;
  border-bottom: 0;
  writing-mode: vertical-rl;
}

.kg-workbench-column-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
  transition: opacity var(--kg-package-content-duration) var(--kg-package-easing),
    transform var(--kg-package-content-duration) var(--kg-package-easing),
    visibility 0ms;
}

.kg-workbench-column-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-100);
  /* ★D130: 좌우 여백 확대 — "수업 단위 패키지 · 번들을 카드에 놓으세요" 가
     패널 경계에 붙어 보이던 문제 (사용자 지적). */
  padding: var(--space-250) var(--space-300) var(--space-125);
}

.kg-workbench-column-header span { display: grid; gap: 2px; }
.kg-workbench-column-header small {
  color: var(--color-accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
}
.kg-workbench-column-header strong { color: var(--color-text-1); font-size: 16px; }
.kg-workbench-column-header em {
  color: var(--color-text-3);
  font-size: 10px;
  font-style: normal;
  text-align: right;
}

.kg-workbench-column-scroll,
.kg-bundle-column-content {
  min-height: 0;
  overflow-y: auto;
}

.kg-workbench-column-scroll { padding: 0 var(--space-200) var(--space-200); }
.kg-bundle-column-content { padding: var(--space-200); }
.kg-problem-column-content { position: relative; }

.kg-workbench-split-handle {
  position: relative;
  min-height: var(--space-800);
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  outline: none;
}

.kg-workbench-split-handle::before {
  position: absolute;
  top: var(--space-150);
  bottom: var(--space-150);
  left: 50%;
  width: var(--space-025);
  border-radius: var(--radius-full);
  background: var(--border-default);
  content: "";
  transform: translateX(-50%);
  transition: background var(--motion-fast) var(--motion-easing),
    box-shadow var(--motion-fast) var(--motion-easing);
}

.kg-workbench-split-handle::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--space-025);
  height: var(--space-250);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  box-shadow: 0 0 0 var(--space-025) var(--border-default);
  content: "";
  transform: translate(-50%, -50%);
}

.kg-workbench-split-handle:hover::before,
.kg-workbench-split-handle:focus-visible::before {
  background: var(--color-accent);
  box-shadow: 0 0 0 var(--space-025) var(--color-accent-bg);
}

.kg-bundle-card-title {
  overflow: hidden;
  color: var(--color-text-1);
  font-size: var(--text-style-label-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-bundle-card-title.is-selected {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  line-height: var(--text-style-label-line-height);
}

/* ── 수업 패키지 보드 ───────────────────────────────────────────────────
 * 좁은 좌측 pane에서는 폼 컨트롤을 한 행에 늘어놓지 않는다. 패키지는 선반,
 * 번들은 두 줄짜리 카드, 이동 select는 명시적 보조 동작으로만 보이게 한다. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.kg-bundle-catalog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-200);
  margin-bottom: var(--space-200);
}

.kg-bundle-catalog-header h2 {
  margin: 0;
  color: var(--color-text-1);
  font-size: var(--text-style-heading-small-font-size);
  line-height: 1.25;
}

.kg-bundle-catalog-header small {
  display: block;
  max-width: 250px;
  margin-top: var(--space-050);
  color: var(--color-text-3);
  font-size: 11px;
  line-height: 1.45;
}

.kg-bundle-catalog-tabs {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.kg-package-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-100);
  margin-bottom: var(--space-250);
  padding: var(--space-150);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: 0 1px 0 rgb(15 23 42 / 3%);
}

.kg-package-create input {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--color-bg);
  color: var(--color-text-1);
  font: inherit;
  font-size: 12px;
  transition: border-color var(--motion-fast) var(--motion-easing),
    box-shadow var(--motion-fast) var(--motion-easing);
}

.kg-package-create input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

.kg-package-board {
  display: flex;
  flex-direction: column;
  gap: var(--space-200);
  padding-bottom: var(--space-300);
}

.kg-package-section {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--kg-package-card-radius);
  background: var(--color-surface);
  box-shadow: var(--kg-package-card-shadow);
  transition: border-color var(--kg-package-hover-duration) var(--kg-package-easing),
    box-shadow var(--kg-package-hover-duration) var(--kg-package-easing),
    transform var(--kg-package-hover-duration) var(--kg-package-easing);
}

.kg-package-section:hover:not(.is-selected) {
  transform: translateY(-1px);
  box-shadow: var(--kg-package-column-shadow);
}

.kg-package-section.is-selected {
  border-color: var(--color-accent);
  box-shadow: var(--kg-package-card-selected-shadow);
}

.kg-package-section.is-ungrouped {
  border-top-color: var(--color-text-3);
  background: color-mix(in srgb, var(--color-bg) 82%, var(--color-surface));
  box-shadow: none;
}

.kg-package-section:has(.kg-package-bundle-handle:active) {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

.kg-package-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-100);
  min-height: var(--kg-package-card-min-height);
  padding: var(--kg-package-card-padding-block) var(--kg-package-card-padding-inline);
  border-bottom: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  background: linear-gradient(100deg, var(--color-surface), color-mix(in srgb, var(--color-accent-bg) 28%, var(--color-surface)));
}

.kg-package-section-heading {
  flex: 1 1 auto;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.kg-package-section-heading,
.kg-package-section-tools,
.kg-package-section-actions {
  display: flex;
  align-items: center;
}

.kg-package-card-arrow {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--color-text-3);
  font-size: 18px;
}

.kg-package-section.is-selected .kg-package-card-arrow { color: var(--color-accent); }

.kg-package-section-heading {
  min-width: 0;
  gap: var(--space-075);
}

.kg-package-section-identity {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.kg-package-section-eyebrow {
  color: var(--color-accent);
  font-size: var(--kg-package-card-eyebrow-size);
  font-weight: 800;
  letter-spacing: .09em;
  line-height: 1;
}

.kg-package-section.is-ungrouped .kg-package-section-eyebrow {
  color: var(--color-text-3);
}

.kg-package-section-title {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-1);
  font-size: var(--kg-package-card-title-size);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-package-section-count {
  flex: 0 0 auto;
  color: var(--color-text-3);
  font-size: var(--kg-package-card-meta-size);
  font-variant-numeric: tabular-nums;
}

.kg-package-section-status {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent-bg);
  color: var(--color-accent);
  font-size: var(--kg-package-card-meta-size);
  font-weight: 700;
}

.kg-package-section-tools,
.kg-package-section-actions {
  flex: 0 0 auto;
  gap: var(--space-050);
}

.kg-package-icon-button,
.kg-package-collapse-button {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-3);
  cursor: pointer;
}

.kg-package-icon-button {
  display: inline-grid;
  width: var(--kg-package-control-size);
  height: var(--kg-package-control-size);
  padding: 0;
  place-items: center;
  font-size: 13px;
  text-decoration: none;
}

.kg-package-collapse-button {
  padding: 4px 6px;
  font-size: 10px;
}

.kg-package-icon-button:hover:not(:disabled),
.kg-package-collapse-button:hover:not(:disabled) {
  background: var(--color-accent-bg);
  color: var(--color-accent);
}

.kg-package-icon-button.is-danger:hover:not(:disabled) {
  background: rgb(220 38 38 / 9%);
  color: #dc2626;
}

.kg-package-icon-button:disabled,
.kg-package-collapse-button:disabled {
  opacity: .28;
  cursor: default;
}

.kg-package-section-body {
  flex-direction: column;
  gap: var(--space-100);
  padding: var(--space-125) var(--space-150) var(--space-150);
  background: color-mix(in srgb, var(--color-bg) 58%, var(--color-surface));
}

.kg-package-bundle-card {
  display: grid;
  /* BundleRowCell 열거와 1:1 — checkbox · handle · main · move · delete */
  grid-template-columns: 15px 20px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: var(--space-075);
  min-width: 0;
  min-height: var(--kg-bundle-card-min-height);
  padding: var(--space-150);
  border: 1px solid var(--color-border);
  border-radius: var(--kg-bundle-card-radius);
  background: var(--color-bg);
  transition: border-color var(--kg-package-hover-duration) var(--kg-package-easing),
    box-shadow var(--kg-package-hover-duration) var(--kg-package-easing),
    transform var(--kg-package-hover-duration) var(--kg-package-easing);
}

.kg-package-bundle-card:hover {
  border-color: color-mix(in srgb, var(--color-accent) 42%, var(--color-border));
  box-shadow: 0 4px 12px rgb(15 23 42 / 6%);
  transform: translateY(-1px);
}

.kg-package-bundle-card.is-selected {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

.kg-package-inline-grid {
  margin: 2px 0 var(--space-100);
  padding: var(--space-100) 0 var(--space-150);
  border-bottom: 1px solid var(--color-border);
}

.kg-package-bundle-context {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px var(--space-100);
  margin-bottom: var(--space-150);
  padding: var(--space-125) var(--space-150);
  border-radius: var(--radius-md);
  background: var(--color-accent-bg);
}

.kg-package-bundle-context span {
  grid-column: 1 / -1;
  color: var(--color-accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .07em;
}

.kg-package-bundle-context strong {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-1);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-package-bundle-context small { color: var(--color-text-3); font-size: 10px; }

.kg-download-package-filter {
  display: flex;
  gap: var(--space-075);
  margin-bottom: var(--space-150);
  padding-bottom: var(--space-100);
  overflow-x: auto;
  scrollbar-width: thin;
}

.kg-download-package-filter .btn { flex: 0 0 auto; }

/* 내려받기 조립 작업대 — 패키지는 전폭 맥락, 조립과 읽기는 서로 다른 5:5 밴드다. */
.kg-download-workbench {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--space-150);
  margin-top: var(--space-250);
}

.kg-download-package-context,
.kg-download-focus { grid-column: 1 / -1; }

.kg-download-workbench-panel,
.kg-download-focus,
.kg-download-focus-column { min-width: 0; }

.kg-download-focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--space-150);
}

.kg-download-focus-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-150);
}

@media (max-width: 980px) {
  .kg-download-workbench,
  .kg-download-focus-grid { grid-template-columns: minmax(0, 1fr); }
  .kg-download-package-context,
  .kg-download-focus { grid-column: 1; }
}

.kg-package-bundle-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-100);
  min-height: 120px;
}

.kg-package-bundle-list.is-busy { cursor: progress; }
.kg-package-bundle-list.is-dragging .kg-package-drop-target { display: block; }

/* ★D130 다중 선택 이동 */
.kg-package-bundle-check {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.kg-package-bulk-bar {
  display: flex;
  align-items: center;
  gap: var(--space-100);
  margin: var(--space-100) 0;
  padding: var(--space-100) var(--space-150);
  border: 1px solid var(--color-accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-accent) 8%, var(--color-surface));
  font-size: 12px;
}

.kg-package-bulk-bar strong { flex: 0 0 auto; color: var(--color-accent); }
.kg-package-bulk-bar label { flex: 1 1 auto; min-width: 0; }
.kg-package-bulk-bar select {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  font-size: 12px;
}

.kg-package-bundle-handle {
  display: grid;
  width: 20px;
  height: 28px;
  place-items: center;
  color: var(--color-text-3);
  cursor: grab;
  font-size: 15px;
  line-height: 1;
  user-select: none;
}

.kg-package-bundle-handle:active { cursor: grabbing; }

.kg-package-bundle-main {
  display: block;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.kg-package-bundle-main:focus-visible {
  border-radius: var(--radius-xs);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

.kg-package-bundle-title {
  display: block;
  width: 100%;
  overflow: hidden;
  color: var(--color-text-1);
  font-size: var(--kg-bundle-card-title-size);
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 선택된 패키지 번들 카드는 제목을 전체 표시로 펼친다 — 시간순 보기
   .kg-bundle-card-title.is-selected 와 동일 계약 (카드는 세로로 자연 증가). */
.kg-package-bundle-title.is-selected {
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.kg-package-bundle-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  margin-top: 3px;
  color: var(--color-text-3);
  font-size: 10px;
  line-height: 1;
}

.kg-package-bundle-status {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
}

.kg-package-bundle-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-3);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.kg-package-bundle-delete:hover:not(:disabled) {
  border-color: var(--color-border);
  color: var(--color-danger-text);
}

.kg-package-bundle-delete:disabled { opacity: 0.5; cursor: default; }

.kg-package-bundle-move {
  position: relative;
  display: block;
  width: 76px;
  min-width: 0;
}

.kg-package-bundle-move select {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 20px 0 7px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  background-color: transparent;
  color: var(--color-text-3);
  cursor: pointer;
  font-size: 10px;
  text-overflow: ellipsis;
  transition: border-color var(--motion-fast) var(--motion-easing),
    background var(--motion-fast) var(--motion-easing);
}

.kg-package-bundle-card:hover .kg-package-bundle-move select,
.kg-package-bundle-move select:focus-visible {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-2);
}

.kg-package-empty-drop {
  padding: var(--space-200) var(--space-150);
  border: 1px dashed color-mix(in srgb, var(--color-accent) 35%, var(--color-border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-accent-bg) 24%, transparent);
  color: var(--color-text-3);
  font-size: 11px;
  text-align: center;
}

.kg-package-drop-target {
  display: none;
  padding: 9px var(--space-100);
  border: 1px dashed var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-accent-bg);
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .01em;
  text-align: center;
}

.kg-package-board.is-dragging .kg-package-drop-target {
  display: block;
  animation: kg-package-drop-reveal 140ms var(--motion-easing) both;
}

.kg-package-board.is-dragging .kg-package-section {
  border-color: color-mix(in srgb, var(--color-accent) 38%, var(--color-border));
}

.kg-package-board.is-busy .kg-package-section {
  cursor: progress;
}

@keyframes kg-package-drop-reveal {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .kg-bundle-catalog-header { align-items: center; }
  .kg-bundle-catalog-header small { display: none; }
  .kg-package-bundle-move { width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  .kg-workbench-split.is-package-workspace,
  .kg-workbench-column,
  .kg-workbench-column-content,
  .kg-workbench-column-toggle,
  .kg-package-section,
  .kg-package-bundle-card {
    transition-duration: 0ms !important;
  }
}

/* ── 패널 카드 (좌/우 공통) ── */
.kg-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* ★ 패널 자체 패딩/보더가 grid 행 높이에 합산되지 않게 (WorkbenchViewportContainmentSpec
     paneOverflowHidden 보강) — content-box 면 인라인 padding 이 높이를 초과시켜 문서 스크롤 유발. */
  box-sizing: border-box;
  background: var(--color-bg);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-section);
  overflow: hidden;
}
.kg-pane-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--gap-lg);
  padding: var(--pad-md) var(--pad-lg);
  border-bottom: 1px solid var(--border-divider);
}
.kg-pane-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}
.kg-pane-tabs { display: inline-flex; gap: 2px; }
.kg-pane-tab {
  padding: 4px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  background: transparent;
  border: none;
}
.kg-pane-tab.is-active {           /* 활성 탭 = primary */
  background: var(--fill-primary);
  color: #fff;
}
.kg-pane-spacer { flex: 1 1 auto; }
.kg-pane-pagenav {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  font-size: 12px;
  color: var(--text-muted);
}
.kg-pane-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--pad-2xl);
  min-height: 0;
  /* ★ 스크롤을 pane 안에 가둠 — 끝에서 트랙패드 바운스가 문서로 새어 흰 화면 노출되는 것 차단 */
  overscroll-behavior: contain;
}

/* ── 좌: 원본 시험지 렌더 ── */
.kg-source-page {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}
.kg-source-problem { margin-bottom: var(--margin-md); }
.kg-source-problem .num { font-weight: 700; margin-right: 6px; }
.kg-source-choices {
  display: flex;
  gap: var(--gap-xl);   /* 16→20 그리드 스냅 (Gap 스케일 인접 단계) */
  margin-top: var(--space-150);
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.kg-figure-box {
  margin: var(--margin-sm) 0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  font-size: 13px;
}

/* ── 우: 구조 (문항 타입 카드 스택) ── */
.kg-structure-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
}
.kg-ghost-btn {
  padding: 5px 12px;
  border: 1px solid var(--border-default);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}
.kg-ghost-btn:hover { background: var(--color-sunken); }

/* 문항 카드 (RefineStatusColor: 헤더 틴트로 상태 표현) */
.kg-problem-card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);   /* 디자이너 스케일 정렬: 14px → lg 12px */
  background: var(--color-bg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--motion-base), transform var(--motion-base);
  /* ★D130 8/2 (사용자 "칼럼 조절이 마우스에 늦게 따라옴"): 칼럼 폭 드래그는 프레임마다
     레일 전체를 reflow 시키는데, 화면 밖 카드(KaTeX 본문)가 그 비용의 대부분이다.
     content-visibility:auto = 뷰포트 밖 카드는 layout/paint 스킵 — 드래그 프레임 비용이
     보이는 카드 수에 비례하게 된다. intrinsic-size 는 스크롤바 추정치(높이만 의미). */
  content-visibility: auto;
  contain-intrinsic-size: auto 220px;
}
/* ★ 편집 중 = 입체감을 shadow + lift 로 (보더 아님, 사용자 지정) */
.kg-problem-card.is-editing {
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
.kg-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--pad-md) var(--pad-lg);
  font-weight: 700;
  font-size: 13px;
}
.kg-card-header.is-verified { background: var(--color-status-verified-surface); }
.kg-card-header.is-review   { background: var(--color-status-review-surface); }
.kg-card-header.is-editing  { background: var(--color-accent-bg); }
.kg-card-header.is-neutral  { background: var(--color-surface); }
.kg-card-num { color: var(--text-primary); }
.kg-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;   /* 600→700: 디자이너 3-weight 체계 (강조=Bold) */
  background: var(--color-bg);
}
.kg-status-chip.is-verified { color: var(--color-status-verified-text); }
.kg-status-chip.is-review   { color: var(--color-status-review-text); }
.kg-status-chip.is-editing  { color: var(--text-accent); }
.kg-card-body {
  padding: var(--pad-lg);
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}
.kg-field { display: flex; gap: var(--gap-lg); font-size: 14px; line-height: 1.6; }
.kg-field-label {
  flex: 0 0 56px;
  font-weight: 700;
  color: var(--text-secondary);
}
.kg-field-value { flex: 1 1 auto; color: var(--text-primary); }
.kg-ref {                          /* [[참조]] = purple (RemNote tertiary) */
  color: var(--color-accent-purple);
  text-decoration: none;
  border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}
.kg-answer { color: var(--text-accent); font-weight: 700; }
.kg-latex-edit {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  padding: var(--pad-md);
  border-radius: var(--radius-md);
  background: var(--color-accent-bg);
  border: none;
  color: var(--text-primary);
  resize: vertical;
  /* ★ LaTeX 탭 전용 편집 영역 — pane 세로 공간을 채움(뷰포트 적응, resize 가능) */
  min-height: 52vh;
  box-sizing: border-box;
}
.kg-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--gap-lg);
  margin-top: var(--space-100);
}
.kg-btn-save {
  padding: 6px 16px;
  background: var(--fill-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.kg-btn-cancel {
  padding: 6px 14px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 13px;
  cursor: pointer;
}

/* ── Refine crop-first workspace: left problem rail | right selected detail ── */
.kg-problem-rail,
.kg-selected-detail {
  border-radius: 8px;
}

.kg-rail-header {
  gap: 10px;
  min-height: 58px;
}

.kg-icon-btn {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.kg-icon-btn:hover { background: var(--color-sunken); }

.kg-rail-heading {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kg-rail-heading strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.kg-rail-heading span,
.kg-detail-eyebrow,
.kg-detail-section-title span {
  color: var(--text-muted);
  font-size: 11px;
}

.kg-rail-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
}

.kg-rail-empty {
  padding: 32px 18px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.kg-rail-doc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ★D140 8/24 감추기 — 카드가 <button> 이라 그 안에 버튼을 못 넣는다.
   행으로 감싸고 감추기를 형제로 둔다 (카드 클릭 판정은 그대로). */
.kg-rail-doc-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.kg-rail-doc-row > .kg-rail-doc { flex: 1 1 auto; }

.kg-rail-doc-hide {
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
/* 평소엔 숨어 있다가 그 행에 손이 갔을 때 나온다 — 목록이 지저분해지지 않게. */
.kg-rail-doc-row:hover > .kg-rail-doc-hide,
.kg-rail-doc-hide:focus-visible { opacity: 1; }
.kg-rail-doc-hide:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}

/* 보관함 — 되살릴 곳이 없으면 감추기 자체가 정당하지 않다 (명세 §5). */
.kg-rail-archive {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-divider);
}
.kg-rail-archive-toggle {
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.kg-rail-archive-toggle:hover { color: var(--text-primary); text-decoration: underline; }
.kg-rail-archive-list {
  margin: 6px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kg-rail-archive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-divider);
  border-radius: 7px;
  background: var(--color-surface);
}
.kg-rail-archive-row > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kg-rail-archive-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.kg-rail-archive-row span { color: var(--text-muted); font-size: 11px; }

.kg-rail-doc {
  width: 100%;
  min-width: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--color-bg);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}

.kg-rail-doc:hover { border-color: var(--fill-primary); background: var(--color-surface); }
.kg-rail-doc strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.kg-rail-doc span { color: var(--text-muted); font-size: 10px; }

.kg-rail-card {
  flex: 0 0 auto;
  min-width: 0;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--color-bg);
  overflow: hidden;
  transition: border-color var(--motion-base), box-shadow var(--motion-base);
}

.kg-rail-card:hover { border-color: var(--color-border-strong); }
.kg-rail-card.is-active {
  border-color: var(--fill-primary);
  box-shadow: inset 3px 0 0 var(--fill-primary);
}

.kg-rail-card-top {
  height: 38px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border-divider);
  background: var(--color-surface);
}

.kg-rail-check {
  width: 34px;
  height: 100%;
  display: grid;
  place-items: center;
}

.kg-rail-card-button,
.kg-rail-preview {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.kg-rail-card-button {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kg-rail-number { font-size: 12px; font-weight: 700; }
.kg-rail-crop-state {
  color: var(--text-muted);
  font-size: 10px;
}
.kg-rail-crop-state.is-ready { color: var(--color-status-verified-text); }

.kg-rail-preview {
  width: 100%;
  height: 126px;
  padding: 9px 12px 12px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #eef1f4;
}

.kg-rail-preview-paper {
  display: block;
  width: 100%;
  height: 104px;
  box-sizing: border-box;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
  color: var(--text-primary);
  font-size: 10px;
  line-height: 1.48;
  pointer-events: none;
}

.kg-rail-footer {
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border-divider);
  color: var(--text-muted);
  font-size: 11px;
}

/* ④ D128 rail 전체 선택 — 액션 1열 안의 컴팩트 체크 (전용 footer 행 제거) */
.kg-rail-select-all {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

/* ④ D128 rail 문항 점프 스트립 (RefineRailUxSpec §2) */
.kg-rail-jump {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-divider);
  background: var(--color-bg);
}

.kg-rail-jump-btn {
  min-width: 26px;
  height: 22px;
  padding: 0 4px;
  border: 1px solid var(--border-default);
  border-radius: 5px;
  background: var(--color-surface);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.kg-rail-jump-btn.is-active {
  border-color: var(--color-primary, #4f7cff);
  color: var(--text-primary);
  font-weight: 600;
}

/* §4 다중 선택 바둑판 — 선택 셀은 채움, 드래그 페인트 중 텍스트 선택 방지 */
.kg-rail-jump { user-select: none; -webkit-user-select: none; }

.kg-rail-jump-btn.is-selected {
  background: var(--color-primary, #4f7cff);
  border-color: var(--color-primary, #4f7cff);
  color: #fff;
  font-weight: 600;
}

.kg-rail-jump-btn.is-selected.is-active {
  outline: 2px solid var(--text-primary);
  outline-offset: -2px;
}

/* §6 액션 1열 — 일괄 수리 + 콘텐츠 생성 */
.kg-rail-actions {
  display: flex;
  gap: 8px;
}

.kg-rail-actions .kg-ghost-btn {
  flex: 1 1 0;
  min-width: 0;
}

/* ④ D128 rail 문서 목록 pager (RefineRailUxSpec §1) */
.kg-rail-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-divider);
  color: var(--text-muted);
  font-size: 11px;
}

/* ④ D128 PDF 문서 전용 rail 전체 컨트롤 (pdf_controls.rs) */
.kg-rail-pdf-controls {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-divider);
  background: var(--color-bg);
}

.kg-rail-pdf-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
}

.kg-rail-pdf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kg-rail-pdf-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid var(--border-default);
  border-radius: 5px;
  background: var(--color-surface);
  color: var(--text-primary);
  font-size: 11px;
}

.kg-rail-pdf-hint {
  color: var(--text-muted);
  font-size: 11px;
}

.kg-rail-pdf-note {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.kg-rail-pdf-note.is-error { color: var(--color-danger-text); }

.kg-detail-header {
  min-height: 58px;
  gap: 12px;
}

.kg-detail-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kg-detail-header strong { font-size: 14px; }
.kg-detail-nav { display: inline-flex; gap: 4px; }

.kg-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: grid;

  /* ★행이 2개인데 자식이 3개였다 (D140 8/23).
     shadow 패널이 나중에 끼어들면서 «수리 대화용» 2행(min 320px)을 차지했고,
     그래서 접어도 320px 를 붙들고 있었다. 접기가 아니라 여기가 원인이다.
     패널 행은 auto — 접히면 내용 높이가 0 이 되고 자리도 사라진다.

     ★D140 8/23 (사용자 "렌더링 되는지 보는 게 목적인데 창이 작아서"):
     비율이 여기 박혀 있었고 미리보기가 대화보다 **작았다**(0.8 : 1.2).
     이제 두 몫은 사용자가 정하는 CSS 변수다 — 기본은 그 비율을 뒤집은 60 : 40.
     하한을 px 로 두면 사용자가 줄이려 해도 안 줄어들므로 min 은 0 이고,
     대신 «칸이 사라지지 않게» 하는 잠금은 detail_split.rs 가 % 로 건다
     (RefinePreviewViewportSpec §3 — 저장된 0 이 화면을 못 죽인다). */
  grid-template-rows:
    minmax(0, var(--kg-detail-latex, 60fr))
    auto
    auto
    minmax(0, var(--kg-detail-chat, 40fr));
  gap: 12px;
  background: var(--color-surface);
  overscroll-behavior: contain;
}

/* 자식 수가 3개(패널 Idle)든 4개든 행이 밀리지 않게 «자리를 못박는다». */
.kg-detail-body > .kg-detail-crop-section { grid-row: 1; }
.kg-detail-body > .kg-semantic-shadow-disclosure { grid-row: 2; }
.kg-detail-body > .kg-detail-split-handle { grid-row: 3; }
.kg-detail-body > .kg-detail-repair-section { grid-row: 4; }

/* 세로 분할 손잡이 — 가로 손잡이와 같은 시각 문법, 축만 다르다. */
.kg-detail-split-handle {
  height: 10px;
  margin: -6px 0;
  border-radius: 5px;
  cursor: row-resize;
  touch-action: none;
  background: transparent;
  transition: background 0.12s ease;
}
.kg-detail-split-handle::before {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin: 3.5px auto;
  border-radius: 2px;
  background: var(--border-default);
}
.kg-detail-split-handle:hover::before,
.kg-detail-split-handle:focus-visible::before { background: var(--fill-primary); }
.kg-detail-split-handle:focus-visible { outline: 2px solid var(--fill-primary); outline-offset: 2px; }

/* ★크게 보기 — 미리보기가 상세 칸 세로를 전부 쓴다. 대화는 «감춰질» 뿐이라
   되돌리면 사용자가 정해 둔 비율이 그대로 돌아온다 (파괴가 아니라 상태). */
.kg-detail-body.is-latex-maximized {
  grid-template-rows: minmax(0, 1fr);
}
.kg-detail-body.is-latex-maximized > .kg-semantic-shadow-disclosure,
.kg-detail-body.is-latex-maximized > .kg-detail-split-handle,
.kg-detail-body.is-latex-maximized > .kg-detail-repair-section { display: none; }

.kg-detail-maximize { flex: 0 0 auto; font-size: 15px; line-height: 1; }
.kg-detail-maximize[aria-pressed="true"] {
  border-color: var(--fill-primary);
  color: var(--fill-primary);
}

/* 접힌 상태에서는 테두리·여백까지 최소로 — 머리말 한 줄만 남는다. */
.kg-semantic-shadow-disclosure:not([open]) {
  margin: 0;
  align-self: start;
}

.kg-detail-crop-section,
.kg-detail-repair-section {
  min-width: 0;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--color-bg);
  overflow: hidden;
}

.kg-visual-safety-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-200);
  padding: var(--space-150) var(--space-200);
  border-bottom: 1px solid var(--semantic-status-warning-border);
  background: var(--semantic-status-warning-soft-fill);
  color: var(--semantic-text-secondary);
  font-size: var(--text-style-label-medium-font-size);
  line-height: 1.5;
}

.kg-visual-safety-alert strong {
  display: block;
  color: var(--semantic-text-warning);
  font-weight: var(--text-style-weight-medium);
}

.kg-visual-safety-alert p { margin: var(--space-050) 0 0; }
.kg-visual-safety-action { flex: 0 0 auto; }

@media (max-width: 720px) {
  .kg-visual-safety-alert { align-items: flex-start; flex-direction: column; }
}

.kg-detail-crop-section,
.kg-detail-repair-section {
  display: flex;
  flex-direction: column;
}

.kg-detail-repair-section { min-height: 0; }

.kg-detail-section-title {
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-divider);
}

summary.kg-detail-section-title {
  cursor: pointer;
  list-style-position: inside;
}

.kg-detail-section-title strong { font-size: 12px; }
.kg-detail-section-title span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-detail-view-tabs {
  flex: 0 0 auto;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 2px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--color-surface);
}

.kg-detail-view-tabs button {
  min-width: 54px;
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
}

.kg-detail-view-tabs button.is-active {
  background: var(--color-bg);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.kg-detail-crop-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #eef1f4;
}

.kg-detail-crop-stage.is-hidden,
.kg-detail-latex-stage.is-hidden { display: none; }

.kg-detail-latex-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #eef1f4;
}

.kg-detail-latex-paper {
  /* ★D140 8/23: 상한 760px 은 A4 96dpi(794px)에 못 미쳐 «출력과 같은 폭» 으로
     볼 수가 없었다 (RefinePreviewViewportSpec §6). 칸이 좁으면 100% 로 줄어드는
     동작은 그대로다 — 넓힐 때 천장만 올린다. */
  width: min(100%, 794px);
  min-height: 100%;
  box-sizing: border-box;
  padding: clamp(22px, 4vw, 44px);
  overflow-wrap: anywhere;
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14);
  font-size: 14px;
  line-height: 1.85;
}

.kg-detail-crop-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.14);
}

.kg-detail-loading,
.kg-visual-companion-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.kg-detail-loading.is-error,
.kg-visual-status.is-error,
.kg-repair-preview.is-error { color: var(--color-danger-text); }

.kg-visual-companion-empty {
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.kg-visual-companion-empty strong { color: var(--text-primary); font-size: 14px; }
.kg-visual-companion-empty p { margin: 0; line-height: 1.55; }
.kg-visual-status { font-size: 11px; }
.kg-visual-status.is-ready { color: var(--color-status-verified-text); }
.kg-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.kg-repair-thread {
  flex: 1 1 auto;
  min-height: 72px;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-bg);
  overscroll-behavior: contain;
}

.kg-repair-thread-empty { display: none; }

.kg-repair-message {
  width: fit-content;
  max-width: min(82%, 620px);
  padding: 9px 11px;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.65;
}

.kg-repair-message.is-user {
  align-self: flex-end;
  border-color: var(--border-focus);
  background: var(--color-accent-bg);
}

.kg-repair-message.is-assistant { align-self: flex-start; }
.kg-repair-message.is-pending { color: var(--text-muted); }
.kg-repair-message.is-error { color: var(--color-danger-text); }
.kg-repair-message p { margin: 3px 0 0; white-space: pre-wrap; }
.kg-repair-message .kg-math { margin-top: 5px; }

.kg-repair-message-role {
  display: block;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

.kg-repair-message-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.kg-repair-composer {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-divider);
  background: var(--color-surface);
}

.kg-detail-editor-grid {
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--border-divider);
}

.kg-detail-latex-input,
.kg-detail-latex-preview {
  min-width: 0;
  min-height: 220px;
  box-sizing: border-box;
  padding: 12px;
  font-size: 12px;
  line-height: 1.7;
}

.kg-detail-latex-input {
  border: 0;
  border-right: 1px solid var(--border-divider);
  resize: vertical;
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: var(--color-bg);
}

.kg-detail-latex-preview { overflow: auto; background: var(--color-surface); }

.kg-detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
}

.kg-detail-chat-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  max-height: 104px;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--color-bg);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.kg-detail-chat-input:focus {
  border-color: var(--fill-primary);
  outline: 2px solid var(--color-accent-bg);
  outline-offset: 0;
}

.kg-repair-send {
  min-width: 78px;
  height: 38px;
  padding-inline: 12px;
}

.kg-repair-send:disabled { opacity: 0.45; cursor: not-allowed; }

.kg-detail-editor-section {
  flex: 0 0 auto;
  min-width: 0;
  max-height: min(48vh, 440px);
  overflow: auto;
  border: 0;
  border-top: 1px solid var(--border-divider);
  border-radius: 0;
  background: var(--color-bg);
}

.kg-detail-advanced-summary {
  min-height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

.kg-detail-advanced-summary strong { font-size: 11px; }
.kg-detail-advanced-summary span { color: var(--text-muted); }
.kg-detail-editor-section[open] .kg-detail-advanced-summary {
  border-bottom: 1px solid var(--border-divider);
}

.kg-repair-preview,
.kg-detail-solution {
  margin: 0 12px 12px;
  padding: 12px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--color-surface);
  font-size: 12px;
}

.kg-detail-solution summary { cursor: pointer; font-weight: 700; }
.kg-detail-solution .kg-math { margin-top: 10px; line-height: 1.75; }

.kg-latex-projection-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--color-success) 28%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-success) 7%, transparent);
  color: var(--color-text-3);
  font-size: 11px;
  line-height: 1.4;
}

.kg-latex-projection-note span {
  color: var(--color-success);
  font-weight: 800;
}

@media (max-width: 980px) {
  .kg-refine-split {
    /* D130: 데스크톱과 같은 3칼럼 (가운데 12px = 손잡이) — 2칼럼이면 손잡이가
       우 패널 칼럼을 훔쳐 상세가 암시 행으로 밀린다. */
    grid-template-columns:
      minmax(250px, calc(var(--pane-source) * 1%))
      12px
      minmax(0, 1fr);
    padding-inline: 12px;
  }
  .kg-detail-editor-grid { grid-template-columns: 1fr; }
  .kg-detail-latex-input { border-right: 0; border-bottom: 1px solid var(--border-divider); }
  .kg-refine-split.kg-workbench-split {
    grid-template-columns:
      minmax(270px, calc(var(--pane-source) * 1%))
      var(--pane-gap)
      minmax(0, 1fr);
  }
  .kg-refine-split.kg-workbench-split.is-package-workspace {
    overflow: hidden;
  }
}

@media (max-width: 720px) {
  .kg-master-detail:has(.kg-refine-split) {
    grid-template-columns: minmax(0, 1fr);
  }
  .kg-master-detail:has(.kg-refine-split) > .kg-sidebar {
    display: none;
  }
  .kg-refine-split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 34vh) minmax(0, 1fr);
    overflow-y: auto;
  }
  .kg-refine-split.kg-workbench-split {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(220px, 34vh) minmax(0, 1fr);
    gap: var(--pane-gap);
  }
  .kg-workbench-split-handle { display: none; }
  /* 기본 레이아웃과 같은 행 계약을 유지한다. 행을 줄이면 shadow가
     수리 대화의 최소 높이를 다시 차지해 접힌 상태에서도 빈 공간이 생긴다.
     ★D140 8/23: 자식이 4개가 됐으므로 행도 4개다 (#1034 와 같은 병 재발 방지 —
     «행이 자식보다 적으면 마지막 자식이 남의 행을 뺏는다»). 좁은 화면에서는
     세로 손잡이를 감추므로 3행은 비고, 비율은 세로 스크롤이 대신한다. */
  .kg-detail-split-handle { display: none; }
  .kg-detail-body {
    grid-template-rows: minmax(240px, 38vh) auto auto minmax(320px, 52vh);
  }
  .kg-detail-header .kg-ghost-btn { display: none; }
  .kg-repair-message { max-width: 92%; }
}

/* New problem upload workspace — Keep Gong Design ver.1.0 node 203:696 */
.kg-main-detail:has(.kg-upload-page) {
  height: 100vh;
  padding: 0;
  overflow: hidden;
}

.kg-upload-page {
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--semantic-fill-subtle);
  color: var(--semantic-text-primary);
}

.kg-upload-process-header {
  flex: 0 0 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-xl) var(--pad-4xl);
}

.kg-upload-stepper {
  width: min(1000px, 100%);
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--gap-md);
  list-style: none;
  margin: 0;
  padding: 0;
}

.kg-upload-step {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-md);
  min-height: 40px;
  color: var(--semantic-text-secondary);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
}

.kg-upload-step.is-active {
  color: var(--semantic-text-brand);
  font-weight: 700;
}

.kg-upload-step-marker {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.kg-upload-step.is-active .kg-upload-step-marker {
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
}

.kg-upload-step-connector {
  width: 40px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--semantic-border-default);
}

.kg-upload-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding: var(--margin-sm) var(--pad-4xl) var(--margin-section);
}

.kg-upload-workspace {
  width: min(1000px, 100%);
  min-height: 0;
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.kg-upload-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
  padding: var(--pad-xl);
  border-radius: var(--radius-xl);
  background: var(--semantic-fill-default);
  overflow: hidden;
}

.kg-upload-panel-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  min-height: 22px;
}

.kg-upload-panel-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}

.kg-upload-count {
  flex: 0 0 auto;
  color: var(--semantic-text-tertiary);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
}

.kg-upload-dropzone {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-lg);
  width: 100%;
  padding: var(--pad-lg);
  border: 1px dashed var(--semantic-status-secondary-border);
  border-radius: var(--radius-md);
  background: var(--semantic-background-default);
}

.kg-upload-dropzone-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-lg);
  width: 100%;
  text-align: center;
}

.kg-upload-dropzone-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.kg-upload-dropzone-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-xs);
  color: var(--semantic-text-tertiary);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
}

.kg-upload-dropzone-text strong {
  color: var(--semantic-text-secondary);
  font-weight: 700;
  line-height: 1.4;
}

.kg-upload-file-button {
  width: 100%;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  padding: 0 var(--pad-md);
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}

.kg-upload-file-button:hover {
  background: var(--semantic-fill-strong);
}

.kg-upload-file-button:active {
  transform: scale(var(--semantic-button-pressed-scale));
}

.kg-upload-file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.kg-upload-status {
  margin: -4px 0 0;
  width: 100%;
  min-height: 18px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  letter-spacing: 0;
}

.kg-upload-status--muted { color: var(--semantic-text-tertiary); }
.kg-upload-status--brand { color: var(--semantic-text-brand); }
.kg-upload-status--success { color: var(--semantic-text-success); }
.kg-upload-status--danger { color: var(--semantic-text-danger); }

.kg-upload-list-error {
  margin: -8px 0 0;
  color: var(--semantic-text-danger);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.kg-upload-file-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.kg-upload-file-item {
  width: 100%;
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--pad-md);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--semantic-background-default);
  color: var(--semantic-text-secondary);
  text-align: left;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}

.kg-upload-file-item:hover {
  background: var(--semantic-fill-subtle);
}

.kg-upload-file-item:active {
  transform: scale(0.99);
}

.kg-upload-file-item.is-selected {
  background: var(--semantic-status-brand-soft-fill);
}

.kg-upload-file-item-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  object-fit: contain;
}

.kg-upload-file-item-name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--semantic-text-secondary);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  word-break: break-word;
}

.kg-upload-empty-list {
  padding: var(--pad-lg) var(--pad-sm);
  color: var(--semantic-text-tertiary);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.kg-upload-preview-panel {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.kg-upload-delete-action {
  display: inline-flex;
  align-items: center;
  gap: var(--gap-sm);
  border: 0;
  background: transparent;
  color: var(--semantic-text-danger);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
  cursor: pointer;
}

.kg-upload-delete-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("/assets/icons/delete.svg") center / 20px 20px no-repeat;
  mask: url("/assets/icons/delete.svg") center / 20px 20px no-repeat;
}

.kg-upload-preview-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
  min-height: 0;
}

.kg-upload-preview-thumbnail {
  width: 100%;
  display: flex;
  justify-content: center;
}

.kg-upload-preview-thumbnail img {
  width: 320px;
  height: 320px;
  object-fit: contain;
}

.kg-upload-summary {
  display: flex;
  flex-direction: column;
  gap: var(--gap-xs);
}

.kg-upload-summary h3 {
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  word-break: break-word;
}

.kg-upload-summary p {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  margin: 0;
  color: var(--semantic-text-tertiary);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0;
}

.kg-upload-meta-divider {
  width: 1px;
  height: 14px;
  background: var(--semantic-border-default);
}

.kg-upload-primary-action {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-xs);
  padding: 0 var(--pad-xl);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--semantic-fill-brand);
  color: var(--semantic-text-inverse);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-fast), transform var(--motion-fast);
}

.kg-upload-primary-action:hover {
  background: var(--semantic-state-brand-hover);
}

.kg-upload-primary-action:active {
  transform: scale(var(--semantic-button-pressed-scale));
}

.kg-upload-primary-action:disabled {
  background: var(--semantic-state-disabled-fill);
  color: var(--semantic-state-disabled-content);
  cursor: not-allowed;
}

.kg-upload-primary-action img {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1);
}

.kg-upload-info-section,
.kg-upload-tag-section {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}

.kg-upload-info-section h3,
.kg-upload-tag-section h3 {
  margin: 0;
  color: var(--semantic-text-secondary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}

.kg-upload-info-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-md);
  margin: 0;
}

.kg-upload-info-row {
  display: flex;
  align-items: flex-start;
  gap: var(--gap-lg);
  color: var(--semantic-text-secondary);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
}

.kg-upload-info-row dt {
  flex: 0 0 100px;
  color: var(--semantic-text-secondary);
  font-weight: 500;
}

.kg-upload-info-row dd {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--gap-xs);
  margin: 0;
  color: var(--semantic-text-secondary);
  font-weight: 400;
}

.kg-upload-info-success { color: var(--semantic-text-success); }
.kg-upload-info-danger { color: var(--semantic-text-danger); }

.kg-upload-tag-chip {
  min-height: 32px;
  width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  padding: 0 var(--pad-md);
  border: 1.5px solid var(--semantic-border-default);
  border-radius: var(--radius-full);
  background: var(--semantic-fill-default);
  color: var(--semantic-text-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  cursor: pointer;
}

.kg-upload-tag-chip img {
  width: 16px;
  height: 16px;
}

.kg-upload-preview-empty {
  flex: 1 1 auto;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-md);
  color: var(--semantic-text-tertiary);
  text-align: center;
}

.kg-upload-preview-empty img {
  width: 120px;
  height: 120px;
}

.kg-upload-preview-empty strong {
  color: var(--semantic-text-secondary);
  font-size: 16px;
  line-height: 1.4;
}

.kg-upload-preview-empty span {
  font-size: 14px;
  line-height: 1.6;
}

.kg-upload-delete-name {
  margin: 0;
  color: var(--semantic-text-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .kg-upload-workspace {
    grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .kg-main-detail:has(.kg-upload-page) {
    overflow: auto;
  }

  .kg-upload-page {
    height: auto;
    min-height: 100vh;
  }

  .kg-upload-process-header {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .kg-upload-stepper {
    min-width: 720px;
  }

  .kg-upload-main {
    padding: var(--pad-lg);
  }

  .kg-upload-workspace {
    grid-template-columns: 1fr;
  }

  .kg-upload-preview-thumbnail img {
    width: 220px;
    height: 220px;
  }
}

/* ── 박스 콜아웃 (UnifiedBoxRenderSpec webPreview=calloutDiv · 기준=HWPX 개체속성 실측) ──
   조건/보기/라포 박스를 LaTeX·HWPX·웹에 일관 렌더. 기하 = hwpxRefGeom:
   보더 0.35mm(≈1px) · 패딩 좌우 4mm(≈15px)/상하 2mm(≈8px) · 모서리 거의 직각(radius 3px). */
.kg-box {
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 8px 15px;
  margin: 10px 0;
  background: var(--color-surface);
  box-sizing: border-box;
}
.kg-box .kg-box-label {
  font-weight: 700;
  font-size: 0.92em;
  color: var(--color-text-2);
  margin-bottom: 5px;
}
.kg-box .kg-box-body {
  white-space: pre-wrap;   /* 보기 ㄱ/ㄴ/ㄷ · 조건 (가)(나)(다) 줄바꿈 보존 */
  line-height: 1.9;
}
/* 보기 박스 — labelBreak: [보기] 라벨이 상단 테두리 중앙을 끊고 올라앉음
   (BoxDesignSystemSpec choice=labelBreak · 기준=HWPX floating 라벨박스). 헤더 줄 아님. */
.kg-bogibox {
  position: relative;
  margin-top: 18px;     /* 테두리 위로 올라온 라벨 공간 */
}
.kg-bogibox .kg-box-label {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);  /* 상단 테두리 중앙에 걸침 */
  margin: 0;
  padding: 0 10px;
  background: var(--color-surface);   /* 흰 배경이 테두리를 끊음 */
  text-align: center;
  font-weight: 800;                    /* 나눔고딕OTF ExtraBold 대응 */
  white-space: nowrap;
}
/* 라포박스 — 개념 포인트 강조 accent */
.kg-rivalbox {
  border-color: var(--color-accent-border);
  background: var(--color-accent-bg);
}
.kg-rivalbox .kg-box-label {
  color: var(--color-accent);
}

/* ★D128 /admin/models 모델 라우팅 컨트롤 (AdminModelRoutingControlSpec)
   설정 카드 + 세그먼트 선택 (cls::SETTING_CARD* / SEG_*). source 뱃지 = 기존 .badge 재사용 */
.kg-setting-card {
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}
.kg-setting-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.kg-setting-card-title {
  font-size: 14px;
  font-weight: 600;
}
.kg-setting-card-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-text-3);
}
.kg-seg-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.kg-seg-btn {
  padding: 5px 14px;
  background: transparent;
  color: var(--color-text-2);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.kg-seg-btn--active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  font-weight: 600;
  cursor: default;
}
.kg-seg-btn--disabled {
  color: var(--color-text-3);
  border-style: dashed;
  cursor: not-allowed;
}
/* ★§9b initiator+finisher 조합 프리뷰 (AdminModelRoutingControlSpec comboPreviewText)
   — 현재 조합("gpt-6.1-sol + gpt-6-luna")을 한 줄 강조 표시. */
.kg-combo-preview {
  margin-top: var(--space-075);
  font-size: var(--text-style-label-medium-font-size);
  font-weight: var(--text-style-weight-medium);
  color: var(--color-text-2);
  font-variant-numeric: tabular-nums;
}

/* /admin/models — dependent master-detail routing console.
   Desktop uses two panes; compact keeps the same module→model reading order. */
.kg-routing-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-150);
  margin-bottom: var(--space-150);
}
.kg-routing-page-head h1 {
  margin: 2px 0 4px;
  letter-spacing: -0.035em;
}
.kg-routing-eyebrow {
  margin: 0;
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.kg-routing-saving {
  flex: none;
  color: var(--text-muted);
  font-size: 12px;
}
.kg-routing-console {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.42fr);
  min-height: min(720px, calc(100vh - 250px));
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.kg-routing-index {
  min-width: 0;
  border-right: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-surface) 92%, var(--color-accent-bg));
}
.kg-routing-index-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-100);
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--color-border);
}
.kg-routing-index-head > div {
  display: grid;
  gap: 2px;
}
.kg-routing-index-head strong { font-size: 14px; }
.kg-routing-index-head span { color: var(--text-muted); font-size: 12px; }
.kg-routing-index-list {
  display: grid;
  gap: 6px;
  max-height: min(670px, calc(100vh - 310px));
  overflow: auto;
  padding: 10px;
}
.kg-routing-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-100);
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.kg-routing-slot:hover { background: var(--color-surface); }
.kg-routing-slot--selected {
  border-color: var(--color-accent-border);
  background: var(--color-accent-bg);
  box-shadow: inset 3px 0 0 var(--color-accent);
}
.kg-routing-slot-copy { display: grid; min-width: 0; gap: 3px; }
.kg-routing-slot-copy strong { font-size: 13px; }
.kg-routing-slot-copy small {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-routing-slot-model {
  max-width: 132px;
  overflow: hidden;
  color: var(--color-text-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-routing-detail {
  min-width: 0;
  padding: 26px 28px;
  overflow: auto;
}
.kg-routing-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-150);
  margin-bottom: var(--space-150);
}
.kg-routing-detail-head h2 { margin: 4px 0; font-size: 23px; letter-spacing: -0.025em; }
.kg-routing-detail-head p:last-child { margin: 0; color: var(--text-muted); font-size: 13px; }
.kg-routing-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.kg-routing-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: var(--space-100);
}
.kg-routing-meta > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--bg-page);
}
.kg-routing-meta span { color: var(--text-muted); font-size: 10px; }
.kg-routing-meta strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.kg-routing-notice {
  margin: 0 0 var(--space-100);
  padding: 9px 11px;
  border-radius: 7px;
  background: var(--semantic-status-warning-soft-fill);
  color: var(--semantic-text-warning);
  font-size: 12px;
}
.kg-routing-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 9px;
}
.kg-routing-section-head > div { display: grid; gap: 2px; }
.kg-routing-section-head strong { font-size: 14px; }
.kg-routing-section-head span { color: var(--text-muted); font-size: 11px; }
.kg-model-list { display: grid; gap: 8px; }
.kg-model-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-150);
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}
.kg-model-option:hover:not(:disabled) {
  border-color: var(--color-accent-border);
  background: var(--color-accent-bg);
  transform: translateY(-1px);
}
.kg-model-option--current {
  border-color: var(--color-accent);
  background: var(--color-accent-bg);
  cursor: default;
}
.kg-model-option--current:disabled { opacity: 1; }
.kg-model-option--disabled { opacity: 0.56; cursor: not-allowed; }
.kg-model-option-copy { display: grid; gap: 3px; min-width: 0; }
.kg-model-option-copy small { color: var(--text-muted); font-size: 10px; }
.kg-model-option-copy strong { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.kg-model-option-state {
  flex: none;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-page);
  color: var(--color-text-2);
  font-size: 10px;
  font-weight: 600;
}
.kg-model-option--current .kg-model-option-state {
  background: var(--color-accent);
  color: var(--text-inverse);
}
.kg-routing-context {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}
.kg-routing-context strong { font-size: 12px; }
.kg-routing-context p { margin: 0; color: var(--text-muted); font-size: 11px; }
.kg-routing-footnote { margin: 12px 2px 0; color: var(--text-muted); font-size: 11px; }

@media (max-width: 899px) {
  .kg-routing-console { grid-template-columns: minmax(0, 1fr); }
  .kg-routing-index { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .kg-routing-index-list { max-height: 38vh; }
  .kg-routing-detail { padding: 20px 18px; }
  .kg-routing-meta { grid-template-columns: minmax(0, 1fr); }
}

/* ★D128 과제3 라벨 에디터 모달 뷰포트 (WorkbenchViewportContainmentSpec §8)
   긴 그림에서도 모달은 뷰포트 안(내부 스크롤), 컨트롤은 sticky, 그림은 높이 캡(비율 유지). */
.kg-label-editor-modal {
  width: min(96vw, 1440px);
  max-width: min(96vw, 1440px);
  height: 96vh;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 18px;
  border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent);
  background: color-mix(in srgb, var(--bg-page) 96%, #eff6ff);
}
.kg-label-editor-modal .modal__header {
  margin-bottom: 10px;
}
.kg-label-editor-modal .modal__body {
  min-height: 0; /* 스크롤 소유자(kg-label-editor-body)까지 높이 예산 전달 */
  display: flex;
  flex-direction: column;
}
.kg-label-editor-body {
  overflow-y: auto;
  min-height: 0; /* flex 자식이 내용 높이로 부모를 밀지 않게 (§2 primitives) */
  padding: 0 4px 8px;
  scrollbar-gutter: stable;
}
.kg-label-editor-controls {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg-page) 96%, transparent);
  padding: 4px 0 8px;
  backdrop-filter: blur(8px);
}
.kg-label-editor-fig {
  max-height: 74vh; /* §8 figureHeightCapped — 드래그 px 변환은 표시폭 역산이라 무영향 */
  width: auto;
}

/* D130 콘텐츠 생성 그림 작업공간 — 한 그림이 한 URL/작업 단위다. */
.kg-figure-workspace-entry {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 10px auto;
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}
.kg-figure-workspace-entry:hover,
.kg-figure-workspace-entry:focus-visible {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 16%, transparent);
  transform: translateY(-1px);
  outline: none;
}
.kg-figure-workspace-entry img { margin: 0 !important; }
.kg-figure-workspace-entry-label {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 42%, transparent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--bg-page) 92%, transparent);
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -.01em;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 140ms ease, transform 140ms ease;
  backdrop-filter: blur(8px);
}
.kg-figure-workspace-entry:hover .kg-figure-workspace-entry-label,
.kg-figure-workspace-entry:focus-visible .kg-figure-workspace-entry-label {
  opacity: 1;
  transform: translateY(0);
}
.kg-figure-workspace-page {
  min-height: calc(100vh - 48px);
  padding: 18px 22px 24px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--color-border) 42%, transparent) 1px, transparent 1px) 0 0 / 24px 24px,
    color-mix(in srgb, var(--bg-page) 97%, #eaf2f8);
}
.kg-figure-workspace-topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto 12px;
  padding: 0 4px;
}
.kg-figure-workspace-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-text-2);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.kg-figure-workspace-back:hover { color: var(--color-accent); }
.kg-figure-workspace-identity {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-variant-numeric: tabular-nums;
}
.kg-figure-workspace-kicker {
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.kg-figure-workspace-identity strong { font-size: 14px; }
.kg-figure-workspace-status {
  justify-self: end;
  color: var(--color-text-3);
  font-size: 11px;
  font-weight: 600;
}
.kg-figure-workspace-main {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, .72fr);
  gap: 14px;
  max-width: 1480px;
  margin: 0 auto;
  align-items: stretch;
}
.kg-figure-workspace-editor {
  min-width: 0;
}
.kg-figure-workspace-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  /* ★D143 8/27: 채팅이 100vh를 독점해 「그림 삭제」 패널이 폴드 밖으로 밀렸다
     (타입·API 발효 후에도 UI 존재 신호 0). 컬럼을 editor 모달과 같은 기준선으로
     결박하고 채팅은 flex로 남는 공간만 차지한다 — 삭제 진입은 항상 화면 안. */
  height: calc(100vh - 108px);
}
.kg-figure-remove {
  border: 1px solid var(--color-border-2);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--color-surface);
}
.kg-figure-remove summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--semantic-text-danger);
}
.kg-figure-remove p {
  margin: 8px 0 6px;
  font-size: 12px;
  color: var(--color-text-3, #5b6570);
}
.kg-figure-remove select {
  width: 100%;
  margin-bottom: 8px;
}
.kg-figure-remove button.danger {
  width: 100%;
  border: 1px solid var(--semantic-border-danger);
  border-radius: 8px;
  background: var(--semantic-status-danger-soft-fill);
  color: var(--semantic-text-danger);
  padding: 7px 10px;
  font-weight: 700;
  cursor: pointer;
}
.kg-figure-remove button.danger:disabled {
  opacity: .55;
  cursor: default;
}
.kg-figure-remove-note {
  font-size: 12px;
  color: var(--color-text-3, #5b6570);
}
.kg-figure-workspace-editor .kg-label-editor-modal {
  width: 100%;
  max-width: none;
  height: calc(100vh - 108px);
  max-height: none;
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(28, 42, 56, .10);
}
.kg-figure-missing-entry {
  display: inline-flex;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 45%, var(--color-border));
  border-radius: 5px;
  color: var(--color-accent);
  background: var(--bg-page);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}
.kg-figure-missing-canvas {
  height: calc(100vh - 108px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed color-mix(in srgb, var(--color-text-3) 55%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-page) 92%, #eef4f7);
  color: var(--color-text-2);
}
.kg-figure-missing-canvas > span { font-size: 34px; color: var(--color-accent); }
.kg-figure-missing-canvas p { max-width: 420px; margin: 0; text-align: center; font-size: 13px; }
.kg-figure-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-page) 98%, #f3eee5);
  box-shadow: 0 18px 45px rgba(28, 42, 56, .08);
}
.kg-figure-chat-header { padding: 16px 17px 12px; border-bottom: 1px solid var(--color-border); }
.kg-figure-chat-header span { display: block; font-size: 15px; font-weight: 800; }
.kg-figure-chat-header small { display: block; margin-top: 3px; color: var(--color-text-3); }
.kg-figure-intent { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 10px 12px 0; padding: 3px; border-radius: 7px; background: color-mix(in srgb, var(--color-border) 58%, transparent); }
.kg-figure-intent button { padding: 7px; border: 0; border-radius: 5px; background: transparent; color: var(--color-text-3); cursor: pointer; }
.kg-figure-intent button.active { background: var(--bg-page); color: var(--color-text-1); font-weight: 750; box-shadow: 0 1px 3px rgba(28,42,56,.12); }
.kg-figure-missing-mode { display: grid; gap: 6px; margin: 12px 14px 0; color: var(--color-accent); font-size: 12px; font-weight: 800; }
.kg-figure-missing-mode select { width: 100%; padding: 7px 9px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--bg-page); color: var(--color-text-2); font: inherit; }
.kg-figure-intent-hint {
  margin: 0;
  padding: 8px 17px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-3);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--bg-page) 96%, #f5e9d8);
}
.kg-figure-chat-log { flex: 1; min-height: 90px; overflow-y: auto; padding: 14px; }
.kg-figure-chat-empty { margin: 14px 4px; color: var(--color-text-3); font-size: 13px; line-height: 1.6; }
.kg-figure-chat-message { width: fit-content; max-width: 88%; margin: 0 0 8px; padding: 9px 11px; border-radius: 8px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.kg-figure-chat-message.is-user { margin-left: auto; background: var(--color-accent); color: #fff; }
.kg-figure-chat-message.is-assistant { border: 1px solid var(--color-border); background: var(--bg-page); color: var(--color-text-2); }
.kg-figure-candidate { margin: 0 12px 10px; padding: 11px; border: 1px solid color-mix(in srgb, var(--color-accent) 38%, var(--color-border)); border-radius: 8px; background: var(--bg-page); }
.kg-figure-candidate-title, .kg-figure-candidate-actions, .kg-figure-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kg-figure-candidate-title span { color: #15803d; font-size: 11px; font-weight: 750; }
.kg-figure-candidate img { display: block; max-width: 100%; max-height: 230px; margin: 9px auto; object-fit: contain; }
.kg-figure-candidate-placement { margin: 0 0 9px; padding: 6px 8px; border-radius: 5px; background: color-mix(in srgb, var(--color-accent) 8%, var(--bg-page)); color: var(--color-text-2); font-size: 11px; font-weight: 700; }
.kg-figure-guards { display: flex; gap: 6px; margin-bottom: 9px; }
.kg-figure-guards span { padding: 2px 6px; border-radius: 4px; background: #f1f5f9; color: var(--color-text-3); font-size: 10px; }
.kg-figure-guards span.ok { background: #ecfdf5; color: #166534; }
.kg-figure-candidate-actions button, .kg-figure-composer-actions button { padding: 7px 11px; border-radius: 6px; cursor: pointer; font-weight: 700; }
.kg-figure-candidate-actions .primary, .kg-figure-composer-actions .primary { border: 1px solid var(--color-accent); background: var(--color-accent); color: #fff; }
.kg-figure-candidate-actions .secondary { border: 1px solid var(--color-border); background: transparent; color: var(--color-text-2); }
.kg-figure-chat-note { margin: 0 14px 8px; color: var(--color-text-3); font-size: 11px; }
.kg-figure-chat-note.is-error { color: #b91c1c; }
.kg-figure-reference-list { display: flex; gap: 5px; flex-wrap: wrap; padding: 0 12px 7px; }
.kg-figure-reference-list > span { padding: 3px 6px; border: 1px solid var(--color-border); border-radius: 5px; font-size: 10px; }
.kg-figure-reference-list button { margin-left: 5px; border: 0; background: transparent; cursor: pointer; color: #b91c1c; }
.kg-figure-composer { padding: 11px 12px 12px; border-top: 1px solid var(--color-border); }
.kg-figure-composer textarea { box-sizing: border-box; width: 100%; min-height: 78px; resize: vertical; padding: 9px; border: 1px solid var(--color-border); border-radius: 7px; background: var(--bg-page); color: var(--color-text-1); font: inherit; font-size: 13px; }
.kg-figure-composer-actions { margin-top: 7px; }
.kg-figure-attach { color: var(--color-text-2); font-size: 12px; font-weight: 700; cursor: pointer; }
.kg-figure-attach input { display: none; }
.kg-figure-workspace-error {
  max-width: 680px;
  margin: 12vh auto 0;
  padding: 24px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff;
  color: #991b1b;
}
.kg-figure-workspace-error p { color: var(--color-text-2); }
.kg-figure-workspace-error a { color: var(--color-accent); font-weight: 700; }
@media (max-width: 760px) {
  .kg-label-editor-modal {
    width: 98vw;
    max-width: 98vw;
    height: 98vh;
    max-height: 98vh;
    padding: 14px 12px;
  }
  .kg-label-editor-fig { max-height: 68vh; }
  .kg-figure-workspace-page { padding: 10px; }
  .kg-figure-workspace-topbar { grid-template-columns: 1fr auto; }
  .kg-figure-workspace-status { display: none; }
  .kg-figure-workspace-main { grid-template-columns: 1fr; }
  .kg-figure-workspace-editor .kg-label-editor-modal {
    width: 100%;
    max-width: none;
    height: calc(100vh - 82px);
  }
  .kg-figure-chat, .kg-figure-missing-canvas { height: auto; min-height: 520px; }
}

/* ④ D128 PDF 재분할 진행 대기 — 스피너 + 진행/결과 카드 (cls::SPINNER / RESPLIT_CARD / RESPLIT_STAGES) */
@keyframes kg-spin { to { transform: rotate(360deg); } }
.kg-spinner {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-block;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: kg-spin 0.7s linear infinite;
}
.kg-resplit-card {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.kg-resplit-stages {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--color-text-3);
}
.kg-resplit-stages > span {
  padding: 2px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
}

/* L5 N→1 — compact purple grid + query-backed detail surface. */
.l5-grid-panel {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid #ddd6fe;
  border-radius: 12px;
  background:
    linear-gradient(145deg, color-mix(in srgb, #7c3aed 6%, var(--color-surface)) 0%, var(--color-surface) 62%);
  box-shadow: inset 3px 0 0 #7c3aed;
}
.l5-grid-panel--loading,
.l5-grid-panel--error {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--color-text-3);
  font-size: 12px;
}
.l5-grid-panel--error {
  border-color: #fecaca;
  box-shadow: inset 3px 0 0 #dc2626;
}
.l5-grid-panel--error div { display: grid; gap: 3px; }
.l5-grid-panel--error strong { color: #b91c1c; }
.l5-grid-panel--error span { font-size: 11px; }
.l5-grid-panel--empty p,
.l5-grid-help {
  margin: 8px 0 0;
  color: var(--color-text-3);
  font-size: 11px;
}
.l5-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.l5-grid-header > div { display: flex; align-items: center; gap: 8px; }
.l5-grid-header strong { color: var(--color-text-1); font-size: 13px; }
.l5-grid-header > span { color: #7c3aed; font-size: 10px; font-weight: 650; }
.l5-grid-mark {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  border-radius: 7px;
  background: #7c3aed;
  color: #fff;
  font: 750 11px/1 var(--font-mono);
  letter-spacing: -.02em;
}
.l5-grid-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0 8px;
}
.l5-grid-summary span {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-3);
  font-size: 9px;
  font-weight: 650;
}
.l5-grid-summary .is-published { color: #15803d; border-color: #bbf7d0; }
.l5-grid-summary .is-actionable { color: #6d28d9; border-color: #ddd6fe; }
.l5-grid-summary .is-running { color: #1d4ed8; border-color: #bfdbfe; }
.l5-grid-summary .is-failed { color: #b91c1c; border-color: #fecaca; }
.l5-grid-cells {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(57px, 1fr));
  gap: 7px;
  max-height: 220px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.l5-grid-cell {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  aspect-ratio: 1;
  padding: 5px;
  border: 1px solid #c4b5fd;
  border-radius: 10px;
  background: color-mix(in srgb, #7c3aed 8%, var(--color-surface));
  color: #5b21b6;
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.l5-grid-cell:hover,
.l5-grid-cell:focus-visible {
  z-index: 1;
  transform: translateY(-2px);
  border-color: #7c3aed;
  box-shadow: 0 7px 18px rgba(91, 33, 182, .16);
  outline: none;
}
.l5-grid-cell strong { font: 760 11px/1.1 var(--font-mono); }
.l5-grid-cell-flow { font: 650 9px/1 var(--font-mono); opacity: .74; }
.l5-grid-cell-state {
  position: absolute;
  top: 4px;
  right: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--color-text-3);
  font-size: 7px;
  font-weight: 700;
}
.l5-grid-cell-state i { width: 5px; height: 5px; border-radius: 50%; background: #7c3aed; }
.l5-grid-cell.is-published { background: color-mix(in srgb, #22c55e 8%, var(--color-surface)); }
.l5-grid-cell.is-published .l5-grid-cell-state i { background: #16a34a; }
.l5-grid-cell.is-running .l5-grid-cell-state i { background: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.l5-grid-cell.is-failed { background: color-mix(in srgb, #ef4444 6%, var(--color-surface)); border-color: #fecaca; }
.l5-grid-cell.is-failed .l5-grid-cell-state i { background: #dc2626; }

.l5-detail-page {
  min-height: calc(100vh - 56px);
  padding: 26px clamp(20px, 4vw, 64px) 64px;
  background:
    radial-gradient(circle at 82% 8%, rgba(124, 58, 237, .09), transparent 25rem),
    linear-gradient(180deg, color-mix(in srgb, #7c3aed 2%, var(--bg-page)) 0%, var(--bg-page) 34%);
}
.l5-detail-header { max-width: 1320px; margin: 0 auto 22px; }
.l5-back-button,
.l5-icon-button {
  border: 0;
  background: transparent;
  color: var(--color-text-2);
  cursor: pointer;
  font: 650 12px/1 var(--font-sans);
}
.l5-back-button { display: inline-flex; align-items: center; gap: 7px; padding: 6px 0; }
.l5-back-button span { color: #7c3aed; font-size: 17px; }
.l5-detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-top: 20px;
}
.l5-kicker { color: #7c3aed; font: 760 10px/1 var(--font-mono); letter-spacing: .14em; }
.l5-detail-title-row h1 { margin: 7px 0 5px; color: var(--color-text-1); font-size: clamp(24px, 3vw, 36px); letter-spacing: -.035em; }
.l5-detail-title-row p { margin: 0; color: var(--color-text-3); font-size: 13px; }
.l5-icon-button { padding: 9px 12px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); }
.l5-notice { max-width: 1320px; margin: -8px auto 18px; padding: 10px 13px; border-radius: 8px; font-size: 12px; }
.l5-notice--ok { color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; }
.l5-notice--error { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; }
.l5-detail-loading,
.l5-detail-error-card { max-width: 1320px; margin: 34px auto; }
.l5-detail-loading { display: flex; align-items: center; gap: 12px; color: var(--color-text-3); }
.l5-loading-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #c4b5fd; border-radius: 12px; color: #7c3aed; font: 800 12px var(--font-mono); }
.l5-detail-error-card { padding: 24px; border: 1px solid #fecaca; border-radius: 12px; background: var(--color-surface); color: #991b1b; }
.l5-detail-error-card p { color: var(--color-text-3); font-size: 12px; }
.l5-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 22px; max-width: 1320px; margin: 0 auto; align-items: start; }
.l5-detail-main { display: grid; gap: 16px; }
.l5-overview-card,
.l5-section,
.l5-detail-aside section,
.l5-technical-details {
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-surface) 97%, #7c3aed);
  box-shadow: 0 12px 34px rgba(30, 25, 55, .045);
}
.l5-overview-card { padding: 18px 20px; border-top: 3px solid #7c3aed; }
.l5-overview-topline { display: flex; justify-content: space-between; gap: 16px; color: #7c3aed; font-size: 11px; }
.l5-status-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--l5-status); font-weight: 750; }
.l5-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--l5-status); }
.l5-flow-count { display: flex; align-items: baseline; gap: 6px; margin: 18px 0 12px; }
.l5-flow-count strong { color: var(--color-text-1); font-size: 26px; letter-spacing: -.04em; }
.l5-flow-count span { color: var(--color-text-3); font-size: 12px; }
.l5-flow-count i { margin: 0 7px; color: #7c3aed; font-style: normal; }
.l5-source-list { display: flex; flex-wrap: wrap; gap: 6px; }
.l5-source-token { padding: 5px 8px; border-radius: 7px; background: color-mix(in srgb, #7c3aed 7%, var(--color-surface)); color: #6d28d9; font: 650 10px var(--font-mono); }
.l5-human-error { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 16px 18px; border: 1px solid #fecaca; border-radius: 12px; background: #fffafa; }
.l5-human-error-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #fee2e2; color: #b91c1c; font-weight: 800; }
.l5-human-error h2 { margin: 0 0 4px; color: #991b1b; font-size: 14px; }
.l5-human-error p { margin: 0; color: #7f1d1d; font-size: 12px; }
.l5-section { padding: 20px; }
.l5-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 14px; }
.l5-section-heading > div { display: flex; align-items: center; gap: 8px; }
.l5-section-heading span { color: #7c3aed; font: 750 10px var(--font-mono); }
.l5-section-heading h2 { margin: 0; color: var(--color-text-1); font-size: 16px; }
.l5-section-heading p { margin: 0; color: var(--color-text-3); font-size: 11px; text-align: right; }
.l5-target-list { display: grid; gap: 10px; }
.l5-target-card { padding: 15px; border: 1px solid #e9d5ff; border-radius: 10px; background: color-mix(in srgb, #7c3aed 3%, var(--color-surface)); }
.l5-target-heading { display: flex; align-items: center; gap: 7px; color: #7c3aed; font-size: 10px; font-weight: 750; }
.l5-mini-badge { padding: 2px 6px; border-radius: 999px; background: #ede9fe; }
.l5-target-card h3 { margin: 7px 0 5px; color: var(--color-text-1); font-size: 14px; }
.l5-target-card p { margin: 0; color: var(--color-text-2); font-size: 12px; line-height: 1.55; }
.l5-target-concepts { margin-top: 6px; color: var(--color-text-3); font-size: 10px; }
.l5-primary-action { margin-top: 12px; padding: 9px 13px; border: 0; border-radius: 8px; background: #7c3aed; color: #fff; cursor: pointer; font-weight: 700; font-size: 12px; }
.l5-primary-action:disabled { opacity: .5; cursor: wait; }
.l5-draft-paper { padding: 18px; border: 1px solid var(--color-border); border-radius: 10px; background: #fff; }
.l5-solution-details { margin-top: 10px; border-top: 1px solid var(--color-border); }
.l5-solution-details summary { padding: 11px 0; color: #6d28d9; cursor: pointer; font-size: 12px; font-weight: 650; }
.l5-solution-details > div { padding: 4px 12px 12px; }
.l5-published-card { display: grid; grid-template-columns: 42px 1fr; gap: 14px; padding: 18px; border: 1px solid #bbf7d0; border-radius: 12px; background: #f0fdf4; }
.l5-published-check { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #16a34a; color: #fff; font-size: 18px; }
.l5-published-card h2 { margin: 0 0 4px; color: #166534; font-size: 15px; }
.l5-published-card p { margin: 0 0 8px; color: #166534; font-size: 12px; }
.l5-published-card a { color: #15803d; font-size: 11px; font-weight: 700; }
.l5-retry-panel { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 16px 18px; border: 1px dashed #c4b5fd; border-radius: 12px; background: color-mix(in srgb, #7c3aed 3%, var(--color-surface)); }
.l5-retry-panel strong { color: var(--color-text-1); font-size: 13px; }
.l5-retry-panel p { margin: 3px 0 0; color: var(--color-text-3); font-size: 11px; }
.l5-retry-panel button { flex: none; padding: 8px 11px; border: 1px solid #7c3aed; border-radius: 8px; background: transparent; color: #6d28d9; cursor: pointer; font-size: 11px; font-weight: 700; }
.l5-detail-aside { position: sticky; top: 18px; display: grid; gap: 12px; }
.l5-detail-aside section,
.l5-technical-details { padding: 15px; }
.l5-detail-aside h2 { margin: 0 0 10px; color: var(--color-text-1); font-size: 13px; }
.l5-detail-aside dl { display: grid; gap: 9px; margin: 0; }
.l5-detail-aside dl div { display: grid; gap: 2px; }
.l5-detail-aside dt { color: var(--color-text-3); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.l5-detail-aside dd { margin: 0; color: var(--color-text-2); font-size: 11px; overflow-wrap: anywhere; }
.l5-evidence-list { display: grid; gap: 7px; }
.l5-evidence-list span { position: relative; padding-left: 15px; color: var(--color-text-3); font-size: 11px; }
.l5-evidence-list span::before { content: ''; position: absolute; left: 0; top: .35em; width: 7px; height: 7px; border-radius: 50%; background: #d1d5db; }
.l5-evidence-list span.is-ready { color: #166534; }
.l5-evidence-list span.is-ready::before { background: #16a34a; }
.l5-technical-details summary { color: var(--color-text-2); cursor: pointer; font-size: 11px; font-weight: 700; }
.l5-technical-details dl { margin-top: 12px; }

@media (max-width: 980px) {
  .l5-detail-grid { grid-template-columns: 1fr; }
  .l5-detail-aside { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .l5-detail-page { padding: 18px 12px 40px; }
  .l5-detail-title-row,
  .l5-section-heading,
  .l5-retry-panel { align-items: flex-start; flex-direction: column; }
  .l5-section-heading p { text-align: left; }
  .l5-detail-aside { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════
 * ★7/22 AdminDataPageSpec — admin 데이터 페이지 공통 (비용(시험지)·모델 라우팅)
 * @sync Specs/KeepGong/DesignSystem/AdminDataPageSpec.lean (cssClasses 14)
 * @sync frontend-rs/src/tokens.rs (css_class PAGE_DATA/DATA_*/HEAT_CELL/SKELETON_*)
 * ════════════════════════════════════════════════ */

/* 데이터 페이지 컨테이너 — 본문 .page(--max-reading=720)와 역할 구분 (폭 정합 근본). */
.kg-page-data {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: var(--margin-page-top) var(--margin-page-x) var(--margin-page-bottom);
}
.kg-data-note { color: var(--color-text-3); font-size: 13px; line-height: 1.6; }
.kg-data-error { color: #dc2626; font-size: 13px; }

/* 데이터 테이블 — 숫자 우정렬 + tabular-nums, 이름 좌정렬 + ellipsis. */
.kg-data-table {
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
  width: 100%;
}
.kg-data-table thead tr { border-bottom: 2px solid var(--color-border); }
.kg-data-table th { padding: 6px 10px; text-align: left; }
.kg-data-table td { padding: 5px 10px; }
.kg-data-row { border-bottom: 1px solid var(--color-border); cursor: pointer; }
.kg-data-row.is-selected { background: var(--color-surface-2); }
.kg-data-cell-name {
  max-width: 640px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-data-num { text-align: right; font-variant-numeric: tabular-nums; }
.kg-data-measured { color: #16a34a; }
.kg-data-estimated { color: var(--color-text-3); }
.kg-data-total { font-weight: 600; }
p.kg-data-total { margin-top: 8px; }

/* ════════════════════════════════════════════════
 * Library planning preview — 선생님 중심 폴더형 자료 관리
 * /preview/library 전용. 기존 /library 검색 화면은 유지한다.
 * ════════════════════════════════════════════════ */
.kg-library-page {
  min-width: 0;
  background: var(--semantic-background-subtle);
}
.kg-library-header {
  max-width: var(--max-content);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--gap-2xl);
}
.kg-library-title-group { min-width: 0; }
.kg-library-title-group h1 { margin: var(--space-050) 0 var(--space-100); font-size: 32px; }
.kg-library-title-group p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.kg-library-eyebrow {
  color: var(--semantic-text-brand);
  font-size: 11px;
  font-weight: var(--text-style-weight-bold);
  letter-spacing: .12em;
}
.kg-library-header-actions { display: flex; align-items: center; gap: var(--gap-sm); }
.kg-library-tabs {
  margin: 0;
  display: flex;
  gap: var(--gap-xl);
  border-bottom: 1px solid var(--border-default);
}
.kg-library-tab {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  padding: var(--space-300) var(--space-050);
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: var(--text-style-weight-medium);
  cursor: pointer;
}
.kg-library-tab:hover { color: var(--text-primary); }
.kg-library-tab.is-active { color: var(--semantic-text-brand); border-bottom-color: var(--border-focus); font-weight: var(--text-style-weight-bold); }
.kg-library-workspace {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  overflow: hidden;
  background: var(--semantic-background-default);
}
.kg-library-toast-stack {
  left: calc(var(--sidebar-width) + 240px + ((100vw - var(--sidebar-width) - 240px) / 2));
}
.kg-master-detail:has(.kg-sidebar.is-collapsed) .kg-library-toast-stack {
  left: calc(var(--sidebar-collapsed-width) + 240px + ((100vw - var(--sidebar-collapsed-width) - 240px) / 2));
}
.kg-library-toast-stack .toast,
.kg-master-detail:has(.kg-sidebar.is-collapsed) .kg-library-toast-stack .toast {
  left: auto;
}
.kg-library-rail {
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--border-default);
  background: var(--semantic-background-default);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.kg-library-rail-head { display: grid; gap: 12px; }
.kg-library-rail-title {
  height: 38px;
  display: flex;
  align-items: center;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: var(--text-style-weight-bold);
}
.kg-library-rail-upload {
  width: 100%;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: var(--semantic-fill-brand);
  color: var(--text-inverse);
  font: inherit;
  font-size: 14px;
  font-weight: var(--text-style-weight-medium);
  cursor: pointer;
}
.kg-library-rail-upload span { font-size: 22px; font-weight: var(--text-style-weight-regular); line-height: 1; }
.kg-library-rail-upload:hover { background: var(--base-blue-500); }
.kg-library-rail-upload:disabled,
.kg-library-rail-upload:disabled:hover {
  background: var(--semantic-fill-muted);
  color: var(--semantic-text-disabled);
  cursor: not-allowed;
}
.kg-library-rail-search-wrap {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--semantic-background-default);
}
.kg-library-rail-search-wrap > span {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background: var(--icon-muted);
  -webkit-mask: url("/assets/icons/search.svg") center / contain no-repeat;
  mask: url("/assets/icons/search.svg") center / contain no-repeat;
}
.kg-library-rail-search,
.kg-library-search {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--semantic-background-default);
  color: var(--text-primary);
  outline: none;
}
.kg-library-rail-search {
  min-width: 0;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: 14px;
}
.kg-library-search { width: min(300px, 32vw); height: 40px; padding: 0 var(--space-350); font-size: 13px; }
.kg-library-rail-search:focus { box-shadow: none; }
.kg-library-rail-search-wrap:focus-within,
.kg-library-search:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 14%, transparent); }
.kg-library-smart-links { display: grid; gap: 4px; margin-top: 12px; padding: 0 0 12px; border-bottom: 1px solid var(--border-default); }
.kg-library-smart-group { display: grid; gap: 4px; }
.kg-library-smart-group + .kg-library-smart-group { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border-default); }
.kg-library-smart-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px 0 16px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.kg-library-smart-link:hover { background: var(--state-hover); }
.kg-library-smart-link.is-active { color: var(--text-secondary); font-weight: var(--text-style-weight-medium); }
.kg-library-smart-label { min-width: 0; display: inline-flex; align-items: center; gap: 8px; }
.kg-library-smart-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  background: var(--icon-default);
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  mask-repeat: no-repeat;
}
.kg-library-smart-icon--done {
  -webkit-mask-image: url("/assets/icons/list_alt_check.svg");
  mask-image: url("/assets/icons/list_alt_check.svg");
}
.kg-library-smart-icon--progress {
  -webkit-mask-image: url("/assets/icons/pace.svg");
  mask-image: url("/assets/icons/pace.svg");
}
.kg-library-smart-icon--review {
  -webkit-mask-image: url("/assets/icons/warning.svg");
  mask-image: url("/assets/icons/warning.svg");
}
.kg-library-smart-count { min-width: 24px; color: var(--text-subtle); font-size: 12px; text-align: right; }
.kg-library-smart-link.is-active .kg-library-smart-count { color: var(--semantic-text-brand); }
.kg-library-rail-section {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.kg-library-rail-section strong {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: var(--text-style-weight-bold);
}
.kg-library-rail-section button {
  padding: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: var(--semantic-fill-muted);
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.kg-library-tree-wrap { overflow: visible; }
.kg-library-rail-title { color: inherit; text-decoration: none; }
.kg-library-tree-wrap .tree { gap: 4px; }
.kg-library-tree-wrap .tree-row {
  min-height: 40px;
  padding-top: 8px;
  padding-bottom: 8px;
  padding-right: 12px;
  padding-left: calc(16px + 24px * var(--depth, 0));
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: -.01em;
}
.kg-library-tree-wrap .tree-row.is-selected {
  background: var(--semantic-status-brand-soft-fill);
  font-weight: var(--text-style-weight-bold);
}
.kg-library-tree-wrap .tree-row__toggle,
.kg-library-tree-wrap .tree-row__icon { flex-basis: 18px; width: 18px; height: 18px; }
.kg-library-main {
  min-width: 0;
  overflow-y: auto;
  padding: var(--space-300);
  background: var(--semantic-background-subtle);
}
.kg-library-main > * { width: 100%; margin-left: 0; margin-right: 0; }
.kg-library-toolbar { display: flex; align-items: stretch; flex-direction: column; gap: var(--gap-md); }
.kg-library-toolbar h1 { margin: var(--space-100) 0 0; font-size: 24px; }
.kg-library-breadcrumb { color: var(--text-subtle); font-size: 12px; }
.kg-library-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; width: 100%; gap: var(--gap-sm); }
.kg-library-search-control { flex: 1 1 auto; width: auto; }
.kg-library-sort-field {
  position: relative;
  flex: 0 0 174px;
  width: 174px;
  gap: 0;
}
.kg-library-sort-field > .field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.kg-library-sort-field > .select-menu {
  position: absolute;
  z-index: 20;
  top: 44px;
  right: 0;
  height: auto;
}
.kg-library-status-tabs { margin-top: var(--space-200); }
.kg-library-summary {
  margin-top: var(--space-400);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-xl);
  padding: var(--space-350) var(--space-400);
  border: 1px solid color-mix(in srgb, var(--semantic-fill-info) 35%, var(--semantic-border-default));
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--semantic-fill-info) 8%, var(--semantic-background-default));
}
.kg-library-summary-copy { display: grid; gap: var(--gap-xs); min-width: 0; }
.kg-library-summary-copy strong { color: var(--text-primary); font-size: 14px; }
.kg-library-summary-copy span { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.kg-library-summary-stat { display: flex; align-items: center; gap: var(--gap-md); white-space: nowrap; color: var(--text-secondary); font-size: 12px; }
.kg-library-summary-stat strong { color: var(--semantic-text-warning); }
.kg-library-section { margin-top: var(--space-300); }
.kg-library-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); margin-bottom: var(--space-150); }
.kg-library-section-title-group { display: flex; align-items: center; gap: var(--gap-xs); min-width: 0; }
.kg-library-section-count { color: var(--text-subtle); font-size: 12px; white-space: nowrap; }
.kg-library-section-title { margin: 0; color: var(--text-primary); font-size: 16px; }
.kg-library-grid,
.kg-library-document-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 400px), 1fr));
  align-items: stretch;
  justify-content: start;
  gap: var(--gap-md);
}
.kg-library-folder-card {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  min-width: 0;
  width: 100%;
  max-width: 700px;
  min-height: 88px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-300);
  background: var(--semantic-background-default);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.kg-library-folder-card:hover { border-color: var(--border-focus); background: var(--semantic-background-subtle); }
.kg-library-folder-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  background: url("/assets/illustrations/folder.svg") center / contain no-repeat;
}
.kg-library-card-copy { display: grid; gap: var(--gap-xs); min-width: 0; flex: 1; }
.kg-library-card-title { overflow: hidden; color: var(--text-primary); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.kg-library-card-meta { color: var(--text-subtle); font-size: 12px; }
.kg-library-doc-card {
  position: relative;
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  gap: var(--gap-xl);
  min-height: 135px;
  padding: var(--pad-lg);
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--semantic-background-default);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.kg-library-doc-card:hover { border-color: var(--border-focus); box-shadow: var(--shadow-card); }
.kg-library-doc-card:has(.kg-library-doc-link) { cursor: pointer; }
.kg-library-doc-link { position: absolute; z-index: 1; inset: 0; padding: 0; border: 0; border-radius: inherit; background: transparent; cursor: pointer; }
.kg-library-doc-link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.kg-library-doc-top {
  display: flex;
  align-items: flex-start;
  gap: var(--gap-lg);
  width: 100%;
  min-width: 0;
}
.kg-library-doc-thumb {
  flex: 0 0 52px;
  width: 52px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--semantic-status-brand-subtle);
  border-radius: var(--radius-xs);
  background: var(--semantic-status-brand-subtle);
}
.kg-library-doc-icon { display: block; width: 24px; height: 24px; }
.kg-library-doc-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--gap-xs); overflow: hidden; }
.kg-library-doc-category { margin: 0; color: var(--text-secondary); font-size: 12px; font-weight: var(--text-style-weight-medium); line-height: 1.4; }
.kg-library-doc-badge { margin-right: 8px; vertical-align: middle; }
.kg-library-doc-title { width: 100%; margin: 0; overflow: hidden; color: var(--text-primary); font-size: 16px; font-weight: var(--text-style-weight-bold); line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.kg-library-doc-meta { margin: 0; overflow: hidden; color: var(--text-secondary); font-size: 11px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.kg-library-doc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); min-width: 0; }
.kg-library-doc-tags { overflow: hidden; color: var(--text-subtle); font-size: 11px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.kg-library-status { display: inline-flex; align-items: center; gap: var(--gap-xs); font-size: 11px; font-weight: var(--text-style-weight-regular); line-height: 1.4; white-space: nowrap; }
.kg-library-status::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.kg-library-status--review { color: var(--semantic-text-warning); }
.kg-library-status--done { color: var(--semantic-text-success); }
.kg-library-status--progress { color: var(--semantic-fill-info); }
.kg-library-progress { width: 100%; height: 4px; margin-top: var(--space-050); overflow: hidden; border-radius: var(--radius-full); background: var(--semantic-fill-muted); }
.kg-library-progress-bar { display: block; width: var(--progress); height: 100%; border-radius: inherit; background: var(--semantic-fill-brand); }
.kg-library-lineage-list { display: grid; gap: var(--space-150); }
.kg-library-lineage-group { overflow: hidden; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--semantic-background-default); }
.kg-library-lineage-original { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: var(--space-150); padding: var(--space-200); border-bottom: 1px solid var(--border-default); }
.kg-library-lineage-original > span { align-self: start; display: inline-flex; justify-content: center; padding: var(--space-050) var(--space-075); border-radius: var(--radius-full); background: var(--semantic-background-muted); color: var(--text-secondary); font-size: 11px; font-weight: var(--text-style-weight-bold); }
.kg-library-lineage-original-copy { min-width: 0; display: grid; gap: var(--space-075); }
.kg-library-lineage-original-copy strong { color: var(--text-primary); font-size: 15px; }
.kg-library-lineage-original-copy p { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.kg-library-lineage-original-copy small { color: var(--text-subtle); font-size: 11px; }
.kg-library-lineage-variants { display: grid; padding: 0 var(--space-200); }
.kg-library-lineage-variant { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: var(--space-125); padding: var(--space-175) 0; }
.kg-library-lineage-variant + .kg-library-lineage-variant { border-top: 1px solid var(--border-default); }
.kg-library-lineage-variant > i { width: 8px; height: 8px; margin-left: 5px; border-radius: 50%; background: var(--fill-primary); box-shadow: 0 0 0 4px var(--semantic-status-brand-subtle); }
.kg-library-lineage-variant-copy { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--space-050) var(--space-100); }
.kg-library-lineage-variant-copy strong { color: var(--text-primary); font-size: 13px; }
.kg-library-lineage-variant-copy span { color: var(--text-subtle); font-size: 11px; }
.kg-library-lineage-variant-copy p { grid-column: 1 / -1; margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.kg-library-lineage-status { padding: var(--space-050) var(--space-100); border-radius: var(--radius-full); background: var(--semantic-background-muted); color: var(--text-secondary); font-size: 10px; font-style: normal; font-weight: var(--text-style-weight-bold); text-decoration: none; white-space: nowrap; }
.kg-library-lineage-status.is-completed { background: color-mix(in srgb, var(--semantic-fill-success) 11%, var(--semantic-background-default)); color: var(--semantic-text-success); }
.kg-library-lineage-status.is-running { background: var(--semantic-status-brand-subtle); color: var(--semantic-text-brand); }
.kg-library-lineage-status.is-failed { background: color-mix(in srgb, var(--semantic-fill-danger) 9%, var(--semantic-background-default)); color: var(--semantic-text-danger); }

/* 문항 탭: 카드 탐색 + 원본/변형 관계 상세 */
.kg-library-problem-filters { display: flex; align-items: center; gap: var(--space-075); margin-bottom: var(--space-150); }
.kg-library-problem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); align-items: stretch; justify-content: start; gap: var(--space-150); }
.kg-library-problem-card { width: 100%; max-width: 500px; min-width: 0; display: grid; align-content: start; gap: var(--space-100); padding: var(--space-150) var(--space-150) var(--space-300); border: 1px solid var(--border-default); border-radius: var(--radius-xl); background: var(--semantic-background-default); box-shadow: var(--shadow-xs); }
.kg-library-problem-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-100); }
.kg-library-problem-card-head label { display: inline-flex; align-items: center; gap: var(--space-075); color: var(--text-primary); font-size: 13px; cursor: pointer; }
.kg-library-problem-card-head input { width: 18px; height: 18px; margin: 0; accent-color: var(--fill-primary); }
.kg-library-problem-kind { padding: var(--space-025) var(--space-075); border-radius: var(--radius-full); font-size: 10px; font-weight: var(--text-style-weight-bold); }
.kg-library-problem-kind.is-original { background: var(--semantic-background-muted); color: var(--text-secondary); }
.kg-library-problem-kind.is-variant { background: var(--semantic-status-brand-subtle); color: var(--semantic-text-brand); }
.kg-library-problem-preview { width: 100%; height: 172px; overflow: hidden; display: block; padding: var(--space-200) var(--space-250); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); text-align: left; cursor: pointer; }
.kg-library-problem-preview:hover { border-color: var(--border-focus); box-shadow: 0 0 0 2px var(--semantic-status-brand-subtle); }
.kg-library-problem-preview > span { display: block; font-size: 13px; line-height: 1.75; }
.kg-library-problem-badges { display: flex; flex-wrap: wrap; gap: var(--space-050); }
.kg-library-problem-meta { display: grid; gap: var(--space-075); margin: 0; }
.kg-library-problem-meta > div { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: var(--space-075); align-items: start; }
.kg-library-problem-meta dt { color: var(--text-secondary); font-size: 11px; font-weight: var(--text-style-weight-bold); }
.kg-library-problem-meta dd { min-width: 0; display: flex; flex-wrap: wrap; gap: var(--space-050); margin: 0; color: var(--text-secondary); font-size: 11px; }
.kg-library-problem-meta dd > span { padding: var(--space-025) var(--space-075); border-radius: var(--radius-full); background: var(--semantic-background-muted); color: var(--text-secondary); font-size: 10px; }
/* @sync OverlaySpec: drawer backdrop 59 < drawer 60 < modal 80. */
.kg-library-problem-drawer-backdrop { position: fixed; z-index: 59; inset: 0; background: rgba(15, 23, 42, .12); }
.kg-library-problem-drawer { position: fixed; z-index: 60; top: 0; right: 0; bottom: 0; width: min(780px, calc(100vw - 320px)); display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--semantic-background-default); box-shadow: -12px 0 32px rgba(15, 23, 42, .12); }
.kg-library-problem-drawer-head { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-150); padding: var(--space-150) var(--space-250); border-bottom: 1px solid var(--border-default); }
.kg-library-problem-drawer-head > div { display: grid; gap: var(--space-025); }
.kg-library-problem-drawer-head > div > span { color: var(--text-subtle); font-size: 10px; }
.kg-library-problem-drawer-head h2 { margin: 0; color: var(--text-primary); font-size: 18px; }
.badge.kg-library-variant-level { min-height: var(--space-400); padding: var(--space-050) var(--space-150); font-size: var(--text-style-label-medium-font-size); font-weight: var(--text-style-weight-bold); }
.kg-library-problem-drawer-head > button { width: 34px; height: 34px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); font-size: 20px; cursor: pointer; }
.kg-library-problem-drawer-body { min-height: 0; overflow-y: auto; padding: var(--space-250); }
.kg-library-problem-detail-section { display: grid; gap: var(--space-150); padding: var(--space-300) 0; border-bottom: 1px solid var(--border-default); }
.kg-library-problem-detail-section:first-child { padding-top: 0; }
.kg-library-problem-detail-section:last-child { border-bottom: 0; }
.kg-library-problem-detail-section h3 { margin: 0; color: var(--text-primary); font-size: 14px; }
.kg-library-problem-detail-paper, .kg-library-problem-solution { padding: var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--semantic-background-subtle); }
.kg-library-problem-solution { display: grid; gap: var(--space-200); }
.kg-library-problem-solution p { white-space: pre-line; }
.kg-library-problem-detail-paper p, .kg-library-problem-solution p { margin: 0; color: var(--text-primary); font-size: 14px; line-height: 1.75; }
.kg-library-problem-answer-info { display: grid; gap: var(--space-150); padding: var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--semantic-background-subtle); }
.kg-library-problem-answer-info h3 { margin: 0; color: var(--semantic-text-brand); font-size: 14px; }
.kg-library-problem-answer-info dl { display: grid; gap: var(--space-100); margin: 0; }
.kg-library-problem-answer-info dl > div { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; gap: var(--space-150); }
.kg-library-problem-answer-info dt { color: var(--text-secondary); font-size: 12px; }
.kg-library-problem-answer-info dd { min-width: 0; margin: 0; color: var(--text-primary); font-size: 13px; font-weight: var(--text-style-weight-medium); }
.kg-library-problem-answer-info .kg-library-problem-answer-value dd { padding: var(--space-150); border-radius: var(--radius-md); background: var(--semantic-background-default); }
.kg-library-problem-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.kg-library-problem-compare article { min-width: 0; min-height: 200px; padding: var(--space-200); background: var(--semantic-background-default); }
.kg-library-problem-compare article + article { border-left: 1px solid var(--border-default); background: var(--semantic-background-subtle); }
.kg-library-problem-compare article > span { display: inline-flex; margin-bottom: var(--space-150); padding: var(--space-025) var(--space-075); border-radius: var(--radius-full); background: var(--semantic-background-muted); color: var(--text-secondary); font-size: 10px; font-weight: var(--text-style-weight-bold); }
.kg-library-problem-compare article + article > span { background: var(--semantic-status-brand-subtle); color: var(--semantic-text-brand); }
.kg-library-problem-compare p { margin: 0; color: var(--text-primary); font-size: 14px; line-height: 1.75; }
.kg-library-problem-connections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-100); }
.kg-library-variant-request-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kg-library-problem-connections article { display: grid; gap: var(--space-100); padding: var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-subtle); }
.kg-library-problem-connections span { color: var(--text-subtle); font-size: 10px; }
.kg-library-problem-connections strong { color: var(--text-primary); font-size: 12px; }
.kg-library-problem-usage-list { border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; }
.kg-library-problem-usage-list article { display: flex; align-items: center; gap: var(--space-150); padding: var(--space-200); }
.kg-library-problem-usage-list article + article { border-top: 1px solid var(--border-default); }
.kg-library-problem-usage-list article > span { flex-shrink: 0; padding: var(--space-050) var(--space-100); border-radius: var(--radius-md); background: var(--semantic-background-subtle); color: var(--text-secondary); font-size: 12px; }
.kg-library-problem-usage-list strong { color: var(--text-primary); font-size: 14px; }
.kg-library-problem-usage-list p { margin: var(--space-050) 0 0; color: var(--text-subtle); font-size: 12px; }

@media (max-width: 820px) {
  .kg-library-problem-drawer { width: 100vw; }
  .kg-library-problem-compare, .kg-library-problem-connections { grid-template-columns: 1fr; }
  .kg-library-problem-compare article + article { border-top: 1px solid var(--border-default); border-left: 0; }
}
.kg-library-modal-form { display: grid; gap: var(--gap-md); color: var(--text-secondary); font-size: 13px; }
.kg-library-upload-target { display: grid; gap: var(--space-150); padding: var(--space-250); border-radius: var(--radius-lg); background: var(--semantic-background-subtle); }
.kg-library-upload-target > span,
.kg-library-upload-target label > span { color: var(--text-secondary); font-size: 11px; font-weight: var(--text-style-weight-medium); }
.kg-library-upload-path-preview { color: var(--text-primary); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.kg-library-upload-cascade { display: grid; gap: var(--space-100); }
.kg-library-upload-cascade > label { display: grid; gap: var(--space-050); }
.kg-library-upload-target-select {
  width: 100%;
  height: 40px;
  padding: 0 36px 0 var(--space-300);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--semantic-background-default);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.kg-library-upload-target-select:focus {
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 14%, transparent);
}
.kg-library-upload-custom-folder { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-100); padding: 0 var(--space-150); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); }
.kg-library-upload-custom-folder span { color: var(--text-subtle); font-size: 11px; }
.kg-library-upload-custom-folder strong { color: var(--text-primary); font-size: 13px; }
.kg-library-upload-new-folder-actions { display: grid; gap: var(--space-075); }
.kg-library-upload-new-folder-button { justify-self: start; min-height: 34px; padding: 0 var(--space-125); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--semantic-text-brand); font: inherit; font-size: 12px; font-weight: var(--text-style-weight-medium); cursor: pointer; }
.kg-library-upload-new-folder-button:hover { border-color: var(--border-focus); background: var(--state-hover); }
.kg-library-upload-new-folder-editor { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-075); }
.kg-library-upload-new-folder-editor input { min-width: 0; height: 38px; box-sizing: border-box; padding: 0 var(--space-125); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); font: inherit; font-size: 13px; }
.kg-library-upload-new-folder-editor input:focus { border-color: var(--border-focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 14%, transparent); }
.kg-library-upload-new-folder-editor button { min-width: 58px; border: 0; border-radius: var(--radius-md); background: var(--semantic-fill-brand); color: var(--text-inverse); font: inherit; font-size: 12px; font-weight: var(--text-style-weight-medium); cursor: pointer; }
.kg-library-upload-new-folder-editor button:disabled { background: var(--semantic-fill-muted); color: var(--semantic-text-disabled); cursor: not-allowed; }
.kg-library-upload-drop {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  border: 1px dashed var(--border-focus);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--semantic-fill-info) 8%, var(--semantic-background-default));
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
}
.kg-library-upload-drop:hover { background: var(--semantic-fill-muted); }
.kg-library-upload-drop strong { color: var(--text-primary); }
.kg-library-upload-drop span { font-size: 12px; }
.kg-library-upload-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-full); background: var(--semantic-fill-brand); color: var(--text-inverse); font-size: 22px !important; }

@media (max-width: 1120px) {
  .kg-library-workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .kg-library-rail { padding: 16px 12px; }
  .kg-library-main { padding: var(--space-300); }
  .kg-library-sort-field { flex: 0 0 160px; width: 160px; }
  .kg-library-summary { align-items: flex-start; flex-direction: column; }
  .kg-library-toast-stack {
    left: calc(var(--sidebar-width) + 220px + ((100vw - var(--sidebar-width) - 220px) / 2));
  }
  .kg-master-detail:has(.kg-sidebar.is-collapsed) .kg-library-toast-stack {
    left: calc(var(--sidebar-collapsed-width) + 220px + ((100vw - var(--sidebar-collapsed-width) - 220px) / 2));
  }
}
@media (max-width: 860px) {
  .kg-library-workspace { grid-template-columns: 1fr; }
  .kg-library-rail { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--border-default); }
  .kg-library-tree-wrap { max-height: 190px; overflow-y: auto; }
  .kg-library-toast-stack {
    left: calc(var(--sidebar-width) + ((100vw - var(--sidebar-width)) / 2));
  }
  .kg-master-detail:has(.kg-sidebar.is-collapsed) .kg-library-toast-stack {
    left: calc(var(--sidebar-collapsed-width) + ((100vw - var(--sidebar-collapsed-width)) / 2));
  }
}

/* 히트 셀 — 구조는 토큰, 배경만 데이터 파생(밴드) 인라인 허용 (spec heat_cell_split). */
.kg-heat-cell {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
  min-width: 74px;
  text-align: center;
  color: #111;
}

/* 로딩 스켈레톤 — 자리 유지 shimmer (spec skeleton_canon: 종료 = 로드 완료 신호). */
.kg-skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface-2) 25%,
    var(--color-surface-1) 37%,
    var(--color-surface-2) 63%
  );
  background-size: 400% 100%;
  animation: kg-shimmer 1.4s ease infinite;
  border-radius: 6px;
}
.kg-skeleton-line { height: 14px; margin-top: 6px; }
.kg-skeleton-row { height: 30px; margin-top: 6px; }
@keyframes kg-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ── 전역 비동기 작업 센터 (D138 v2 — 3개 영속 원장 통합 projection) ──
   새 원재료 0: 전부 기존 semantic var 결박 (uses_existing_primitives_only). */
.kg-work-pill {
  position: fixed;
  /* ★D138 8/11 (ShellPlacement.bottomRightSummary): 상단 우측은 페이지 툴바
     (상태·실행 버튼)의 자리 — 셸 오버레이가 덮으면 페이지 기능을 가린다.
     하단 우측 = 전 화면 공통으로 비어 있는 셸 소유 좌표. */
  bottom: var(--space-200);
  right: var(--space-200);
  z-index: 900;
  height: 32px; /* summaryPillHeight = ButtonSize.sm (compact_summary_is_32px) */
  display: inline-flex;
  align-items: center;
  gap: var(--space-075);
  padding: 0 var(--space-150);
  border-radius: var(--radius-full);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.kg-work-pill:hover { color: var(--text-primary); border-color: var(--border-strong); }
.kg-work-pill--loud { color: var(--text-primary); }

.kg-work-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--right-panel-width); /* drawer_reuses_right_panel_width = 320 */
  z-index: 950;
  background: var(--bg-page);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg, var(--shadow-sm));
  padding: var(--space-200);
  display: flex;
  flex-direction: column;
  gap: var(--space-150);
  /* 비차단 drawer 가 자기 스크롤을 소유한다 (drawerOwnsItsScroll). */
  overscroll-behavior: contain;
  animation: kg-work-drawer-in var(--motion-medium) var(--motion-easing);
}
@keyframes kg-work-drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.kg-work-drawer__head {
  height: var(--header-height);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-divider);
}
.kg-work-drawer__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.kg-work-drawer__head > div { display: grid; gap: 2px; }
.kg-work-drawer__head small { color: var(--text-muted); font-size: 11px; }
.kg-work-list { display: grid; gap: var(--space-100); }
.kg-work-item {
  display: grid;
  gap: var(--space-075);
  padding: var(--space-150);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
}
.kg-work-item__top, .kg-work-item__phase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-100);
}
.kg-work-kind, .kg-work-item__detail, .kg-work-item__phase {
  color: var(--text-muted);
  font-size: 12px;
}
.kg-work-item__title { overflow-wrap: anywhere; }
.kg-work-progress { width: 100%; height: 6px; accent-color: var(--color-accent); }
.kg-work-item__message, .kg-work-error {
  margin: 0;
  color: var(--color-danger, #dc2626);
  font-size: 12px;
  line-height: 1.5;
}
.kg-work-empty { color: var(--text-muted); font-size: 13px; }

/* ════════════════════════════════════════════════
 * ★8/15 대시보드 모양 정리 (D139)
 * @sync Specs/KeepGong/DesignSystem/DashboardSpec.lean §12 (dashboardCssClasses 8)
 * @sync frontend-rs/src/tokens/dashboard.rs
 * 근본: 대시보드 = 데이터 페이지 (kg-page-data 1280) — .page(720) 위 표 넘침 봉인.
 * ════════════════════════════════════════════════ */
.kg-dash-section { margin-top: var(--space-300); }
.kg-journey-cards { display: flex; flex-wrap: wrap; gap: var(--gap-lg); }
.kg-journey-card {
  flex: 1;
  min-width: 150px;
  display: block;
  padding: var(--space-150) var(--space-200);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
}
a.kg-journey-card:hover { border-color: var(--color-accent); }
.kg-journey-count {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.kg-journey-card .type-label { margin-top: var(--space-025); }
.kg-journey-caption { color: var(--color-text-3); margin-top: var(--space-025); }
.kg-quick-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-lg);
  margin: 0;
  padding: 0;
}
.kg-quick-link {
  display: block;
  padding: var(--space-100) var(--space-200);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
}
.kg-quick-link:hover { border-color: var(--color-accent); }
.kg-quick-link .kg-data-note { margin: 0; }
/* 넓은 표 가드 — 컨테이너 폭 정합 + 좁은 창 scroll + 키보드 진입. */
.kg-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}
.kg-table-scroll:focus-visible {
  outline: 2px solid var(--semantic-border-focus);
  outline-offset: var(--space-025);
}
/* ── /formats 양식 라이브러리·선택 원장 (D140 8/19 — TemplateAwareDownloadSpec §7) ── */
.kg-format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}
.kg-format-card {
  padding: var(--space-150) var(--space-200);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.kg-format-card:hover { border-color: var(--color-accent); }
.kg-format-card--selected { border-color: var(--color-accent); outline: 1px solid var(--color-accent); }
.kg-format-badge {
  display: inline-block;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-right: var(--space-050);
}
.kg-format-state {
  display: inline-block;
  font-size: var(--font-size-xs);
  padding: 0 var(--space-075);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}
.kg-format-state--published { border-color: var(--color-accent); color: var(--color-accent); }
.kg-format-detail {
  margin-top: var(--gap-lg);
  padding: var(--space-150) var(--space-200);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}
.kg-format-apply-row {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  flex-wrap: wrap;
  padding: var(--space-100) 0;
  border-bottom: 1px solid var(--color-border);
}
.kg-preflight-list { list-style: none; margin: 0; padding: 0; }
.kg-preflight-item {
  display: flex;
  gap: var(--gap-md);
  padding: var(--space-050) 0;
  font-size: var(--font-size-sm);
}
.kg-preflight-item--failed { color: var(--color-text-muted); }
/* S9 semantic shadow — 기존 생성 결과를 건드리지 않는 read-only audit ledger. */
.kg-semantic-shadow-list { display: grid; gap: 14px; }
.kg-semantic-shadow {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--color-text-1) 13%, transparent);
  border-radius: 14px;
  background:
    linear-gradient(135deg, color-mix(in srgb, #0f766e 5%, transparent), transparent 48%),
    var(--color-surface);
  box-shadow: inset 3px 0 0 #0f766e, 0 12px 30px rgb(15 23 42 / 5%);
}

/* ★관찰 전용 shadow 패널 = 기본 접힘 (D140 8/23).
   영향 0 인 화면이 LaTeX 상세의 세로 공간을 상시 먹지 않게 한다. */
.kg-semantic-shadow-disclosure {
  margin: 10px 0;
  border: 1px solid color-mix(in srgb, #0f766e 22%, transparent);
  border-radius: 10px;
  background: var(--color-surface);
}

.kg-semantic-shadow__summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}

.kg-semantic-shadow__summary::-webkit-details-marker { display: none; }

.kg-semantic-shadow__summary::before {
  content: "▸";
  color: #0f766e;
  font-size: 10px;
}

.kg-semantic-shadow-disclosure[open] .kg-semantic-shadow__summary::before { content: "▾"; }

.kg-semantic-shadow__summary-status {
  margin-right: auto;
  color: var(--color-text-2);
  font-size: 11px;
}

.kg-semantic-shadow__header,
.kg-semantic-shadow__comparison,
.kg-semantic-shadow__finding,
.kg-semantic-shadow__provenance > div {
  display: flex;
  align-items: center;
}

.kg-semantic-shadow__header {
  justify-content: space-between;
  gap: 18px;
}

.kg-semantic-shadow__header h3 {
  margin: 3px 0 0;
  color: var(--color-text-1);
  font-size: 15px;
  letter-spacing: -.02em;
}

.kg-semantic-shadow__eyebrow,
.kg-semantic-shadow__provenance dt {
  color: #0f766e;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .13em;
}

.kg-semantic-shadow__mode {
  flex: none;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, #0f766e 35%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, #0f766e 8%, var(--color-surface));
  color: #0f766e;
  font-size: 10px;
  font-weight: 800;
}

.kg-semantic-shadow__comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 12px;
}

.kg-semantic-shadow__comparison article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--color-text-1) 9%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface) 88%, var(--bg-page));
}

.kg-semantic-shadow__comparison article > span,
.kg-semantic-shadow__comparison small {
  color: var(--color-text-3);
  font-size: 10px;
}

.kg-semantic-shadow__comparison strong {
  color: var(--color-text-1);
  font-family: var(--font-mono);
  font-size: 21px;
  line-height: 1;
}

.kg-semantic-shadow__axis {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 5px;
  color: var(--color-text-3);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 800;
}

.kg-semantic-shadow__axis i {
  height: 1px;
  background: color-mix(in srgb, var(--color-text-1) 16%, transparent);
}

.kg-semantic-shadow__finding {
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--color-text-1) 3%, transparent);
}

.kg-semantic-shadow__finding > span {
  flex: none;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}

.kg-semantic-shadow__finding p {
  margin: 2px 0 0;
  color: var(--color-text-2);
  font-size: 11px;
  line-height: 1.55;
}

.kg-semantic-shadow__finding.is-agree > span { background: #dcfce7; color: #166534; }
.kg-semantic-shadow__finding.is-stricter > span { background: #fef3c7; color: #92400e; }
.kg-semantic-shadow__finding.is-disagree > span { background: #fee2e2; color: #991b1b; }

.kg-semantic-shadow__provenance {
  display: grid;
  gap: 5px;
  margin: 0;
}

.kg-semantic-shadow__provenance > div { gap: 10px; min-width: 0; }
.kg-semantic-shadow__provenance dt { width: 58px; flex: none; }
.kg-semantic-shadow__provenance dd {
  overflow: hidden;
  margin: 0;
  color: var(--color-text-3);
  font-family: var(--font-mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kg-semantic-shadow__footnote {
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed color-mix(in srgb, var(--color-text-1) 13%, transparent);
  color: var(--color-text-3);
  font-size: 10px;
}

@media (max-width: 760px) {
  .kg-semantic-shadow__comparison { grid-template-columns: 1fr; }
  .kg-semantic-shadow__axis { grid-template-columns: 1fr auto 1fr; }
}

/* ★D141 8/24 (사용자 "너무 실패한게 많아서 누를 수가 없어"): 일괄수리 실패 목록이
   43건이면 패널을 통째로 밀어낸다 — 목록은 제 높이 안에서 스크롤, 행동 버튼은 요약 옆. */
.kg-rail-repair-failures {
  max-height: 140px;
  overflow-y: auto;
  margin: 4px 0;
  padding-left: 16px;
}

/* ── /preview/library/review 문항 확인·수정 시안 ── */
.kg-library-review-page { height: 100%; min-height: 0; overflow: hidden; background: var(--semantic-background-subtle); }
.kg-master-detail:has(.kg-library-review-page) > .kg-work-pill { display: none; }
.kg-library-review-content { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--semantic-background-subtle); }
.kg-library-review-header { flex: 0 0 auto; min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-xl); padding: var(--space-200) var(--space-300); border-bottom: 1px solid var(--border-default); background: var(--semantic-background-default); }
.kg-library-review-header-copy { min-width: 0; }
.kg-library-review-breadcrumb { display: flex; align-items: center; gap: var(--space-100); min-width: 0; color: var(--text-subtle); font-size: 12px; }
.kg-library-review-breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.kg-library-review-breadcrumb a:hover { color: var(--semantic-text-brand); text-decoration: underline; }
.kg-library-review-breadcrumb > span { color: var(--text-disabled); font-size: 18px; line-height: 1; }
.kg-library-review-breadcrumb strong { overflow: hidden; color: var(--text-primary); font-weight: var(--text-style-weight-bold); text-overflow: ellipsis; white-space: nowrap; }
.kg-library-review-title-row { display: flex; align-items: center; gap: var(--gap-sm); margin-top: var(--space-150); }
.kg-library-review-title-row h1 { margin: 0; color: var(--text-primary); font-size: 24px; }
.kg-library-review-progress { padding: var(--space-050) var(--space-100); border-radius: var(--radius-full); background: var(--semantic-fill-muted); color: var(--text-secondary); font-size: 11px; }
.kg-library-review-header-actions { display: flex; align-items: center; gap: var(--gap-sm); }
.kg-library-review-reconvert { align-self: flex-end; flex: 0 0 auto; margin-bottom: 10px; padding: var(--space-050) 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: var(--text-style-weight-bold); cursor: pointer; }
.kg-library-review-reconvert:hover:not(:disabled) { color: var(--semantic-text-brand); }
.kg-library-review-reconvert:disabled { border-bottom: 0; color: var(--semantic-text-success); cursor: default; }
.kg-library-review-body { position: relative; flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(300px, 1fr) minmax(320px, 1fr); overflow: hidden; }
.kg-library-review-body.is-browse { position: static; display: block; overflow: hidden; background: var(--semantic-background-subtle); }
.kg-library-review-body.is-queue-collapsed { grid-template-columns: 64px minmax(300px, 1fr) minmax(320px, 1fr); }
.kg-library-review-browse { width: 100%; height: 100%; min-height: 0; display: flex; flex-direction: column; padding: var(--space-300) var(--space-300) var(--space-500); overflow: hidden; }
.kg-library-review-browse-head { flex: 0 0 auto; margin-bottom: var(--space-200); }
.kg-library-review-browse-head > div { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); }
.kg-library-review-browse-head > div > div:first-child { display: flex; align-items: center; gap: var(--gap-xs); }
.kg-library-review-browse-actions { display: flex; align-items: center; gap: var(--gap-sm); }
.kg-library-review-select-all { min-height: 40px; display: inline-flex; align-items: center; gap: var(--gap-sm); padding: 0 var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); font-size: 14px; font-weight: var(--text-style-weight-medium); cursor: pointer; }
.kg-library-review-select-all-box { position: relative; width: 16px; height: 16px; flex: 0 0 auto; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--semantic-background-default); }
.kg-library-review-select-all-box.is-checked { border-color: var(--fill-primary); background: var(--fill-primary); }
.kg-library-review-selection-notice { color: var(--semantic-text-success); font-size: 12px; font-weight: var(--text-style-weight-medium); white-space: nowrap; }
.kg-library-review-browse-actions > .btn { min-height: 40px; padding-inline: var(--space-200); font-size: 14px; }
.kg-library-review-browse-head h2 { margin: 0; color: var(--text-primary); font-size: 18px; }
.kg-library-review-browse-head > div > div:first-child > span, .kg-library-review-browse-head > p { color: var(--text-subtle); font-size: 11px; }
.kg-library-review-browse-head p { margin: var(--space-050) 0 0; }
.kg-library-review-card-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); align-content: start; gap: var(--space-150); overflow-y: auto; padding: 0 var(--space-050) var(--space-200) 0; }
.kg-library-review-card { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: var(--space-150); padding: var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--semantic-background-default); box-shadow: var(--shadow-xs); color: var(--text-primary); text-align: left; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.kg-library-review-card.is-selected { border-color: var(--fill-primary); box-shadow: 0 0 0 1px var(--fill-primary); }
.kg-library-review-card:hover { border-color: var(--border-focus); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kg-library-review-card:focus-within { border-color: var(--border-focus); outline: 2px solid var(--semantic-status-brand-subtle); outline-offset: 2px; }
.kg-library-review-card-main { min-width: 0; display: grid; grid-template-rows: auto minmax(154px, 1fr); gap: var(--space-150); padding: 0; border: 0; background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; }
.kg-library-review-card-main:focus { outline: 0; }
.kg-library-review-card-head { display: flex; align-items: center; gap: var(--gap-sm); }
.kg-library-review-card-select { min-width: 0; min-height: 28px; display: flex; align-items: center; flex: 1 1 auto; gap: var(--gap-sm); padding: 0; border: 0; background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; }
.kg-library-review-card-select > strong { font-size: 14px; }
.kg-library-review-card-check { position: relative; width: 20px; height: 20px; flex: 0 0 auto; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--semantic-background-default); }
.kg-library-review-card-check.is-checked { border-color: var(--fill-primary); background: var(--fill-primary); }
.kg-library-review-select-all-box.is-checked::after,
.kg-library-review-card-check.is-checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--semantic-text-inverse);
  -webkit-mask: url("/assets/icons/check_small.svg") center / contain no-repeat;
  mask: url("/assets/icons/check_small.svg") center / contain no-repeat;
}
.kg-library-review-card-preview { width: 100%; min-height: 154px; display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-200); padding: var(--space-150); overflow: hidden; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
.kg-library-review-card-preview > span { color: var(--text-secondary); font-size: 12px; line-height: 1.55; word-break: keep-all; }
.kg-library-review-card-preview > strong { padding: var(--space-150) var(--space-100); color: var(--text-primary); font-family: var(--font-mono); font-size: 15px; text-align: center; }
.kg-library-review-card-foot { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); }
.kg-library-review-card-tags { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: var(--gap-xs); }
.kg-library-review-card-tags > span { padding: var(--space-050) var(--space-100); border-radius: var(--radius-full); background: var(--semantic-fill-muted); color: var(--text-secondary); font-size: 10px; line-height: 1.2; }
.kg-library-review-repair-button { min-height: 28px; flex: 0 0 auto; padding: 0 var(--space-100); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 11px; font-weight: var(--text-style-weight-medium); cursor: pointer; }
.kg-library-review-repair-button:hover { border-color: var(--border-focus); color: var(--semantic-text-brand); }
.kg-library-review-detail-backdrop { position: absolute; inset: 0 min(680px, 72%) 0 0; z-index: 20; border: 0; background: var(--semantic-background-dimmed); cursor: default; }
.kg-library-review-detail-drawer { position: absolute; inset: 0 0 0 auto; z-index: 30; width: min(680px, 72%); min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-left: 1px solid var(--border-default); background: var(--semantic-background-default); box-shadow: -8px 0 24px -8px rgba(78, 89, 104, .14); }
.kg-library-review-detail-head { flex: 0 0 auto; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); padding: var(--space-150) var(--space-200); border-bottom: 1px solid var(--border-default); background: var(--semantic-background-default); }
.kg-library-review-detail-head > div { min-width: 0; }
.kg-library-review-detail-head span { display: block; overflow: hidden; color: var(--text-subtle); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.kg-library-review-detail-title-row { display: flex; align-items: center; gap: var(--gap-sm); margin-top: var(--space-050); }
.kg-library-review-detail-item-actions { display: flex; align-items: center; gap: var(--gap-sm); margin-top: var(--space-100); }
.kg-library-review-detail-title { margin: 0; color: var(--text-primary); font-size: 18px; }
.kg-library-review-detail-actions { display: flex; align-items: center; gap: var(--gap-xs); }
.kg-library-review-detail-nav { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 17px; cursor: pointer; }
.kg-library-review-detail-nav:hover:not(:disabled) { border-color: var(--border-focus); color: var(--semantic-text-brand); }
.kg-library-review-detail-nav:disabled { opacity: .35; cursor: not-allowed; }
.kg-library-review-detail-close { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 22px; line-height: 1; cursor: pointer; }
.kg-library-review-detail-close:hover { border-color: var(--border-focus); color: var(--text-primary); }
.kg-library-review-detail-nav img, .kg-library-review-detail-close img { width: 24px; height: 24px; display: block; }
.kg-library-review-detail-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; background: var(--semantic-background-default); }
.kg-library-review-comparison { flex: 0 0 auto; display: grid; gap: var(--space-150); padding: var(--space-200); }
.kg-library-review-comparison-head, .kg-library-review-edit-head { display: grid; gap: var(--space-050); }
.kg-library-review-comparison-head strong, .kg-library-review-edit-head strong { color: var(--text-primary); font-size: 16px; line-height: 1.6; }
.kg-library-review-comparison-head span, .kg-library-review-edit-head span { color: var(--text-subtle); font-size: 14px; line-height: 1.6; }
.kg-library-review-comparison-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-100); }
.kg-library-review-linked-solution { flex: 0 0 auto; display: grid; gap: var(--space-150); padding: var(--space-200); border-top: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); }
.kg-library-review-linked-solution-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-150); }
.kg-library-review-linked-solution-head strong { color: var(--text-primary); font-size: 16px; line-height: 1.6; }
.kg-library-review-linked-solution-head span { color: var(--text-subtle); font-size: 12px; line-height: 1.6; }
.kg-library-review-linked-solution-body { padding: var(--space-200) var(--space-250); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-subtle); }
.kg-library-review-linked-solution-body p { margin: 0; color: var(--text-primary); font-size: 14px; line-height: 1.8; white-space: pre-line; }
.kg-library-review-edit-section { flex: 0 0 auto; display: grid; gap: var(--space-150); padding: var(--space-200); }
.kg-library-review-edit-section.is-locked { display: none; }
.kg-library-review-save-action > button { width: 100%; }
.kg-library-review-queue-backdrop { position: absolute; inset: 0; z-index: 10; border: 0; background: color-mix(in srgb, var(--base-gray-900) 18%, transparent); cursor: default; }
.kg-library-review-queue { position: absolute; inset: 0 auto 0 0; z-index: 20; width: 292px; min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--border-default); background: var(--semantic-background-default); box-shadow: var(--shadow-lg); }
.kg-library-review-queue-collapsed { height: 100%; display: flex; flex-direction: column; align-items: center; gap: var(--space-150); padding: var(--space-150) var(--space-050); }
.kg-library-review-queue-collapsed strong { color: var(--text-secondary); font-size: 11px; writing-mode: vertical-rl; }
.kg-library-review-queue-toggle { width: 32px; height: 32px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 20px; line-height: 1; cursor: pointer; }
.kg-library-review-queue-toggle:hover { border-color: var(--border-focus); color: var(--semantic-text-brand); }
.kg-library-review-queue-head { padding: var(--space-200); border-bottom: 1px solid var(--border-default); }
.kg-library-review-queue-head > div { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); }
.kg-library-review-queue-head strong { color: var(--text-primary); font-size: 14px; }
.kg-library-review-queue-head span, .kg-library-review-queue-head p { color: var(--text-subtle); font-size: 11px; }
.kg-library-review-queue-head p { margin: var(--space-100) 0 0; line-height: 1.45; }
.kg-library-review-queue-back { width: 100%; margin-top: var(--space-150); padding: var(--space-100) var(--space-150); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 11px; font-weight: var(--text-style-weight-medium); cursor: pointer; }
.kg-library-review-queue-back:hover { border-color: var(--border-focus); color: var(--semantic-text-brand); }
.kg-library-review-queue-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: var(--space-100); }
.kg-library-review-item { width: 100%; display: grid; gap: var(--gap-xs); padding: var(--space-150); border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--text-primary); text-align: left; cursor: pointer; }
.kg-library-review-item + .kg-library-review-item { margin-top: var(--space-050); }
.kg-library-review-item:hover { background: var(--semantic-fill-muted); }
.kg-library-review-item.is-active { border-color: var(--border-focus); background: var(--semantic-status-brand-soft-fill); }
.kg-library-review-item-top { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); }
.kg-library-review-item-number { color: var(--text-primary); font-size: 13px; }
.kg-library-review-item-status { font-size: 10px; white-space: nowrap; }
.kg-library-review-item-status--done { color: var(--semantic-text-success); }
.kg-library-review-item-status--issue { color: var(--semantic-text-warning); }
.kg-library-review-item-status--wait { color: var(--text-subtle); }
.kg-library-review-item-excerpt { overflow: hidden; color: var(--text-secondary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.kg-library-review-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--space-100); overflow: hidden; padding: var(--space-150); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-subtle); }
.kg-library-review-panel + .kg-library-review-panel { border-left: 1px solid var(--border-default); }
.kg-library-review-panel-head { flex: 0 0 auto; min-height: 20px; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); padding: 0; border: 0; }
.kg-library-review-panel-title { margin: 0; color: var(--text-primary); font-size: 14px; }
.kg-library-review-panel-meta { margin: var(--space-025) 0 0; color: var(--text-subtle); font-size: 11px; }
.kg-library-review-page-badge { padding: var(--space-050) var(--space-100); border-radius: var(--radius-md); background: var(--semantic-fill-muted); color: var(--text-secondary); font-size: 11px; white-space: nowrap; }
.kg-library-review-panel-body { flex: 1 1 auto; min-height: 0; overflow: visible; padding: 0; background: transparent; }
.kg-library-review-source-image { max-height: 360px; overflow: auto; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); }
.kg-library-review-source-image img { width: 100%; height: auto; display: block; }
.kg-library-review-paper { width: 100%; min-height: 0; margin: 0; padding: 0; border: 0; background: var(--semantic-background-default); box-shadow: none; }
.kg-library-review-paper-ghost { padding: var(--space-250) 0; color: var(--text-subtle); font-size: 12px; opacity: .6; }
.kg-library-review-paper-problem { position: relative; padding: var(--space-150) var(--space-100); border: 0; border-radius: 0; background: var(--semantic-background-default); }
.kg-library-review-paper-problem p, .kg-library-review-result p { margin: var(--space-100) 0; color: var(--text-primary); font-size: 14px; line-height: 1.6; letter-spacing: -.01em; word-break: normal; overflow-wrap: anywhere; }
.kg-library-review-problem-number { display: block; color: var(--text-primary); font-size: 14px; }
.kg-library-review-math { margin: var(--space-200) 0; padding: var(--space-200); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); font-family: var(--font-mono); font-size: 17px; text-align: center; }
.kg-library-review-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--gap-xs); color: var(--text-secondary); font-size: 12px; text-align: center; }
.kg-library-review-result { min-height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; }
.kg-library-review-result-tags { display: flex; flex-wrap: wrap; gap: var(--gap-xs); margin-bottom: var(--space-150); }
.kg-library-review-tag { padding: var(--space-050) var(--space-100); border-radius: var(--radius-full); background: var(--semantic-fill-muted); color: var(--text-secondary); font-size: 10px; }
.kg-library-review-notice { display: grid; gap: var(--gap-xs); margin-top: var(--space-150); padding: var(--space-150); border: 1px solid color-mix(in srgb, var(--semantic-fill-warning) 35%, var(--border-default)); border-radius: var(--radius-md); background: color-mix(in srgb, var(--semantic-fill-warning) 10%, var(--semantic-background-default)); color: var(--semantic-text-warning); }
.kg-library-review-notice strong { font-size: 12px; }
.kg-library-review-notice span { font-size: 11px; }
.kg-library-review-editor { display: grid; gap: var(--gap-sm); margin-top: var(--space-150); padding: var(--space-150); border: 1px solid var(--border-focus); border-radius: var(--radius-md); background: var(--semantic-background-default); }
.kg-library-review-editor label { color: var(--text-primary); font-size: 12px; font-weight: var(--text-style-weight-bold); }
.kg-library-review-editor-field { display: grid; gap: var(--gap-xs); }
.kg-library-review-editor-field > span { color: var(--text-secondary); font-size: 11px; }
.kg-library-review-textarea { width: 100%; min-height: 112px; resize: vertical; padding: var(--space-150); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); font: inherit; font-size: 13px; line-height: 1.6; }
.kg-library-review-editor-field + .kg-library-review-editor-field .kg-library-review-textarea { min-height: 72px; font-family: var(--font-mono); }
.kg-library-review-edit-workspace { overflow: hidden; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); }
.kg-library-review-repair { overflow: hidden; border: 0; border-radius: 0; background: var(--semantic-background-default); }
.kg-library-review-repair-head { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); padding: 0 var(--space-200); border-top: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); }
.kg-library-review-repair-head strong { color: var(--text-primary); font-size: 14px; }
.kg-library-review-repair-head span { color: var(--text-subtle); font-size: 12px; }
.kg-library-review-repair-thread { min-height: 150px; max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: var(--gap-sm); padding: var(--space-200); background: var(--semantic-background-subtle); }
.kg-library-review-repair-message { width: fit-content; max-width: 88%; padding: var(--space-100) var(--space-150); border: 0; border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 12px; line-height: 1.6; }
.kg-library-review-repair-message.is-user { align-self: flex-end; border: 0; background: var(--semantic-background-inverse); color: var(--semantic-text-inverse); }
.kg-library-review-repair-message strong { display: block; margin-bottom: var(--space-025); color: var(--text-subtle); font-size: 10px; }
.kg-library-review-repair-message p { margin: 0; }
.kg-library-review-repair-composer { min-height: 48px; display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; gap: var(--gap-xs); padding: 0 var(--space-100) 0 var(--space-200); border-top: 1px solid var(--border-default); }
.kg-library-review-repair-composer .kg-detail-chat-input { width: 100%; height: 40px; border: 0; outline: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 13px; }
.kg-library-review-repair-send { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; }
.kg-library-review-repair-send:disabled { opacity: .35; cursor: not-allowed; }
.kg-library-review-repair-send img { width: 24px; height: 24px; display: block; }
.kg-library-review-direct-edit { overflow: hidden; background: var(--semantic-background-default); }
.kg-library-review-direct-edit-summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-sm); padding: 0 var(--space-200); color: var(--text-primary); }
.kg-library-review-direct-edit-summary strong { font-size: 14px; }
.kg-library-review-direct-edit-summary span { color: var(--text-subtle); font-size: 12px; }
.kg-library-review-direct-edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border-default); }
.kg-library-review-direct-edit-grid > * { min-width: 0; padding: var(--space-150); }
.kg-library-review-direct-edit-grid > * + * { border-left: 1px solid var(--border-default); }
.kg-library-review-direct-edit-grid .kg-library-review-textarea { min-height: 190px; border: 0; padding: 0; font-family: var(--font-mono); font-size: 14px; line-height: 1.6; }
.kg-library-review-latex-preview { min-height: 190px; max-height: 300px; overflow: auto; background: var(--semantic-background-subtle); color: var(--text-primary); font-size: 14px; line-height: 1.6; }
.kg-library-review-editor-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--gap-xs); margin-top: var(--space-100); }
.kg-library-review-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: var(--gap-md); padding: var(--space-150) var(--space-200); border-top: 1px solid var(--border-default); background: var(--semantic-background-default); }
.kg-library-review-footer > div { display: flex; align-items: center; gap: var(--gap-sm); }
.kg-library-review-footer-copy { margin: 0; color: var(--text-subtle); font-size: 11px; }

/* ── /preview/library/variant-request 변형 요청 시안 ── */
.kg-library-variant-content { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--semantic-background-subtle); }
.kg-library-variant-header { flex: 0 0 auto; padding: var(--space-200) var(--space-300) var(--space-250); border-bottom: 1px solid var(--border-default); background: var(--semantic-background-default); }
.kg-library-variant-header-copy { width: 100%; }
.kg-library-variant-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--gap-lg); margin-top: var(--space-150); }
.kg-library-variant-title-main { min-width: 0; display: flex; align-items: center; gap: var(--space-100); }
.kg-library-variant-back { flex: 0 0 40px; width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: var(--radius-md); color: var(--text-primary); text-decoration: none; }
.kg-library-variant-back svg { display: block; width: 24px; height: 24px; }
.kg-library-variant-back:hover { background: var(--state-hover); }
.kg-library-variant-back:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.kg-library-variant-title-row h1 { margin: 0; color: var(--text-primary); font-size: 24px; }
.kg-library-variant-header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-100); }
.kg-library-variant-header-actions .btn { min-width: 152px; text-decoration: none; }
.kg-library-variant-body { width: 100%; min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 400px); gap: var(--space-250); padding: var(--space-250) var(--space-300) var(--space-400); overflow: hidden; }
.kg-library-variant-selected, .kg-library-variant-settings { min-width: 0; min-height: 0; }
.kg-library-variant-selected { display: flex; flex-direction: column; }
.kg-library-variant-section-head { flex: 0 0 auto; margin-bottom: var(--space-150); }
.kg-library-variant-section-head > div { display: flex; align-items: center; gap: var(--gap-xs); }
.kg-library-variant-section-head .kg-library-variant-selected-title-row { justify-content: space-between; gap: var(--space-150); }
.kg-library-variant-selected-title-row > div { display: flex; align-items: center; gap: var(--gap-xs); }
.kg-library-variant-section-head h2 { margin: 0; color: var(--text-primary); font-size: 18px; }
.kg-library-variant-section-head > div > span { color: var(--semantic-text-brand); font-size: 12px; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-selected-title-row > div > span { color: var(--semantic-text-brand); font-size: 12px; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-select-all { min-height: 44px; display: inline-flex; align-items: center; gap: var(--space-050); padding: 0 var(--space-100) 0 var(--space-050); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 12px; font-weight: var(--text-style-weight-medium); cursor: pointer; }
.kg-library-variant-select-all input, .kg-library-variant-card-check input { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; flex: 0 0 24px; margin: 4px; border: 1.5px solid var(--border-default); border-radius: var(--radius-sm); background-color: var(--semantic-background-default); background-position: center; background-repeat: no-repeat; background-size: 24px 24px; cursor: pointer; }
.kg-library-variant-select-all input:checked, .kg-library-variant-card-check input:checked { border: 2px solid var(--fill-primary); background-color: var(--fill-primary); background-image: url('/assets/library-review/checkbox-check.svg'); }
.kg-library-variant-select-all input:focus-visible, .kg-library-variant-card-check input:focus-visible { outline: 2px solid var(--semantic-status-brand-subtle); outline-offset: 2px; }
.kg-library-variant-section-head p { margin: var(--space-050) 0 0; color: var(--text-subtle); font-size: 11px; }
.kg-library-variant-selected-list { min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); align-content: start; gap: var(--space-150); overflow-y: auto; padding: 2px var(--space-100) var(--space-150) 2px; }
.kg-library-variant-selected-card { box-sizing: border-box; width: 100%; min-width: 0; max-width: 500px; min-height: 310px; display: flex; flex-direction: column; gap: var(--space-100); padding: var(--space-200) var(--space-200) var(--space-300); border: 1px solid transparent; border-radius: var(--radius-xl); background: var(--semantic-background-default); box-shadow: var(--shadow-card); color: var(--text-primary); text-align: left; transition: background-color 120ms ease, border-color 120ms ease; }
.kg-library-variant-selected-card:hover, .kg-library-variant-selected-card.is-active:not(.is-selected) { border-color: var(--semantic-border-subtle); background: var(--semantic-background-subtle); }
.kg-library-variant-selected-card.is-selected { border: 2px solid var(--semantic-status-brand-subtle); }
.kg-library-variant-selected-card.is-unselected { opacity: 1; }
.kg-library-variant-selected-card:focus-within:not(.is-selected) { border-color: var(--semantic-status-brand-subtle); }
.kg-library-variant-selected-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--space-100); }
.kg-library-variant-card-check { min-height: 32px; display: inline-flex; align-items: center; gap: var(--space-050); cursor: pointer; }
.kg-library-variant-selected-meta strong { font-size: 14px; font-weight: var(--text-style-weight-medium); line-height: 1.4; letter-spacing: -.14px; }
.kg-library-variant-selected-details { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-075); margin-top: auto; color: var(--text-subtle); font-size: 11px; }
.kg-library-variant-selected-details > span { width: 100%; }
.kg-library-variant-selected-config { width: fit-content; margin-top: var(--space-050); padding: var(--space-025) var(--space-075); border-radius: var(--radius-full); background: var(--semantic-status-brand-subtle); color: var(--semantic-text-brand); font-size: 10px; font-style: normal; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-selected-requested { width: fit-content; padding: var(--space-025) var(--space-075); border-radius: var(--radius-full); background: color-mix(in srgb, var(--semantic-fill-success) 10%, var(--semantic-background-default)); color: var(--semantic-text-success); font-size: 10px; font-style: normal; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-selected-preview { box-sizing: border-box; height: 142px; overflow: hidden; padding: var(--space-150); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 12px; line-height: 1.65; }
.kg-library-variant-selected-preview-button { min-width: 0; display: block; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.kg-library-variant-selected-preview-button .kg-library-variant-selected-preview { display: block; }
.kg-library-variant-settings { align-self: start; max-height: 100%; overflow-y: auto; padding: var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-xl); background: var(--semantic-background-default); box-shadow: var(--shadow-xs); }
.kg-library-variant-success { display: grid; gap: var(--space-200); margin-bottom: var(--space-200); padding: var(--space-150); border: 1px solid color-mix(in srgb, var(--semantic-fill-success) 35%, var(--border-default)); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--semantic-fill-success) 10%, var(--semantic-background-default)); }
.kg-library-variant-success strong { color: var(--semantic-text-success); font-size: 14px; }
.kg-library-variant-success p { margin: var(--space-050) 0 0; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.kg-library-variant-success-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-075); }
.kg-library-variant-success-actions a, .kg-library-variant-success-actions button { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0 var(--space-100); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font: inherit; font-size: 11px; font-weight: var(--text-style-weight-medium); text-decoration: none; cursor: pointer; }
.kg-library-variant-success-actions button { border-color: var(--fill-primary); background: var(--fill-primary); color: var(--semantic-text-inverse); }
.kg-library-variant-fieldset { min-width: 0; display: grid; gap: var(--space-100); margin: 0; padding: var(--space-200) 0; border: 0; border-top: 1px solid var(--border-default); color: var(--text-primary); }
.kg-library-variant-fieldset legend, .kg-library-variant-fieldset > span { padding: 0; color: var(--text-primary); font-size: 13px; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-select-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-100); }
.kg-library-variant-select-field { min-width: 0; display: grid; gap: var(--space-050); color: var(--text-secondary); font-size: 11px; font-weight: var(--text-style-weight-medium); }
.kg-library-variant-select-field select { width: 100%; min-height: 40px; padding: 0 var(--space-100); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); font: inherit; font-size: 12px; cursor: pointer; }
.kg-library-variant-option-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-075); }
.kg-library-variant-option { min-width: 0; min-height: 48px; display: flex; align-items: center; justify-content: flex-start; padding: var(--space-150) var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); text-align: left; cursor: pointer; }
.kg-library-variant-option strong { color: var(--text-primary); font-size: 13px; }
.kg-library-variant-option span { color: var(--text-subtle); font-size: 10px; line-height: 1.35; }
.kg-library-variant-option:hover { border-color: var(--border-focus); }
.kg-library-variant-option.is-active { border-color: var(--semantic-status-brand-subtle); background: var(--semantic-status-brand-soft-fill); color: var(--semantic-text-brand); box-shadow: none; }
.kg-library-variant-count-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-075); }
.kg-library-variant-count-options .kg-library-variant-option { min-height: 40px; align-items: center; padding: var(--space-075); text-align: center; }
.kg-library-variant-textarea { width: 100%; min-height: 84px; resize: vertical; padding: var(--space-125); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); font: inherit; font-size: 12px; line-height: 1.55; }
.kg-library-variant-level-guide { margin: 0; color: var(--text-subtle); font-size: 11px; line-height: 1.45; }
.kg-library-variant-level-list { display: grid; gap: var(--space-100); padding: 0 var(--space-100); }
.kg-library-variant-level-row { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-150); padding: var(--space-150) var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); }
.kg-library-variant-level-row.is-active { border-color: var(--semantic-status-brand-subtle); background: var(--semantic-status-brand-soft-fill); box-shadow: none; }
.kg-library-variant-level-copy { min-width: 0; display: grid; gap: var(--space-025); }
.kg-library-variant-level-copy strong { color: var(--text-primary); font-size: 13px; }
.kg-library-variant-level-row.is-active .kg-library-variant-level-copy strong { color: var(--semantic-text-brand); }
.kg-library-variant-level-copy span { color: var(--text-subtle); font-size: 10px; line-height: 1.4; }
.kg-library-variant-level-rule { margin: 0; color: var(--text-subtle); font-size: 11px; }
.kg-library-variant-level-rule.is-error { color: var(--semantic-text-danger); }
.kg-library-variant-duplicate-notice { margin: var(--space-100) 0 0; padding: var(--space-100); border-radius: var(--radius-md); background: color-mix(in srgb, var(--semantic-fill-warning) 10%, var(--semantic-background-default)); color: var(--semantic-text-warning); font-size: 11px; line-height: 1.5; }
.kg-library-variant-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; margin-top: var(--space-100); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); }
.kg-library-variant-summary > div { display: grid; gap: var(--space-025); padding: var(--space-100); }
.kg-library-variant-summary > div + div { border-left: 1px solid var(--border-default); }
.kg-library-variant-summary span { color: var(--text-subtle); font-size: 10px; }
.kg-library-variant-summary strong { color: var(--text-primary); font-size: 14px; }
.kg-library-variant-summary .kg-library-variant-summary-total { background: var(--semantic-status-brand-soft-fill); }
.kg-library-variant-summary-total strong { color: var(--semantic-text-brand); }
.kg-library-variant-footer { display: grid; gap: var(--space-100); padding-top: var(--space-200); }
.kg-library-variant-footer > .btn { width: 100%; min-height: 44px; }

/* 변형 요청 이후: 접수 → 생성 → 완료/일부 실패 */
.kg-library-variant-status-body { width: min(100%, 1180px); min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--space-250); margin: 0 auto; padding: var(--space-250) var(--space-300) var(--space-400); overflow-y: auto; }
.kg-library-variant-status-main, .kg-library-variant-status-sidebar { min-width: 0; display: grid; align-content: start; gap: var(--space-200); }
.kg-library-variant-status-card { padding: var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-xl); background: var(--semantic-background-default); box-shadow: var(--shadow-xs); }
.kg-library-variant-status-card > h2 { margin: 0 0 var(--space-100); color: var(--text-primary); font-size: 16px; }
.kg-library-variant-status-card > p { margin: 0 0 var(--space-150); color: var(--text-subtle); font-size: 11px; line-height: 1.5; }
.kg-library-variant-status-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-200); }
.kg-library-variant-status-top span { color: var(--text-subtle); font-size: 11px; }
.kg-library-variant-status-top h2 { margin: var(--space-050) 0; color: var(--text-primary); font-size: 18px; }
.kg-library-variant-status-top p { margin: 0; color: var(--text-secondary); font-size: 12px; }
.kg-library-variant-status-badge, .kg-library-variant-status-item-head > em { flex: 0 0 auto; padding: var(--space-050) var(--space-100); border-radius: var(--radius-full); background: var(--semantic-background-subtle); color: var(--text-secondary); font-size: 11px; font-style: normal; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-status-badge.is-running, .kg-library-variant-status-item-head > em.is-running { background: var(--semantic-status-brand-subtle); color: var(--semantic-text-brand); }
.kg-library-variant-status-badge.is-completed, .kg-library-variant-status-item-head > em.is-completed { background: color-mix(in srgb, var(--semantic-fill-success) 11%, var(--semantic-background-default)); color: var(--semantic-text-success); }
.kg-library-variant-status-badge.is-failed, .kg-library-variant-status-item-head > em.is-failed { background: color-mix(in srgb, var(--semantic-fill-danger) 9%, var(--semantic-background-default)); color: var(--semantic-text-danger); }
.kg-library-variant-status-badge.is-cancelled, .kg-library-variant-status-item-head > em.is-cancelled { background: var(--semantic-background-muted); color: var(--text-subtle); }
.kg-library-variant-status-progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: var(--space-250); }
.kg-library-variant-status-step { position: relative; display: grid; justify-items: center; gap: var(--space-075); color: var(--text-subtle); font-size: 11px; }
.kg-library-variant-status-step::before { content: ""; position: absolute; top: 14px; left: 0; right: 0; height: 2px; background: var(--border-default); }
.kg-library-variant-status-step:first-child::before { left: 50%; }
.kg-library-variant-status-step:last-child::before { right: 50%; }
.kg-library-variant-status-step i { position: relative; z-index: 1; width: 28px; height: 28px; display: inline-grid; place-items: center; border: 2px solid var(--border-default); border-radius: 50%; background: var(--semantic-background-default); color: inherit; font-style: normal; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-status-step.is-active, .kg-library-variant-status-step.is-done { color: var(--semantic-text-brand); font-weight: var(--text-style-weight-bold); }
.kg-library-variant-status-step.is-active::before, .kg-library-variant-status-step.is-done::before { background: var(--fill-primary); }
.kg-library-variant-status-step.is-active i { border-color: var(--fill-primary); box-shadow: 0 0 0 4px var(--semantic-status-brand-subtle); }
.kg-library-variant-status-step.is-done i { border-color: var(--fill-primary); background: var(--fill-primary); color: var(--semantic-text-inverse); }
.kg-library-variant-status-list { display: grid; gap: var(--space-125); }
.kg-library-variant-status-item { padding: var(--space-175); border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--semantic-background-subtle); }
.kg-library-variant-status-item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-150); margin-bottom: var(--space-100); }
.kg-library-variant-status-item-head > div { display: flex; align-items: center; gap: var(--space-075); }
.kg-library-variant-status-item-head strong { color: var(--text-primary); font-size: 14px; }
.kg-library-variant-status-item-head span { padding: var(--space-025) var(--space-075); border-radius: var(--radius-full); background: var(--semantic-status-brand-subtle); color: var(--semantic-text-brand); font-size: 10px; font-weight: var(--text-style-weight-bold); }
.kg-library-variant-status-item-preview { max-height: 94px; overflow: hidden; padding: var(--space-125); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font-size: 12px; line-height: 1.55; }
.kg-library-variant-status-item-meta { display: flex; flex-wrap: wrap; gap: var(--space-050); margin-top: var(--space-100); }
.kg-library-variant-status-item-meta span { padding: var(--space-025) var(--space-075); border-radius: var(--radius-full); background: var(--semantic-background-muted); color: var(--text-subtle); font-size: 10px; }
.kg-library-variant-status-result { display: flex; align-items: center; justify-content: space-between; gap: var(--space-100); margin-top: var(--space-125); padding-top: var(--space-125); border-top: 1px solid var(--border-default); color: var(--text-secondary); font-size: 11px; }
.kg-library-variant-status-result a, .kg-library-variant-status-result button { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 var(--space-100); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--semantic-text-brand); font: inherit; font-size: 11px; font-weight: var(--text-style-weight-bold); text-decoration: none; cursor: pointer; }
.kg-library-variant-status-summary { display: grid; gap: var(--space-100); margin: 0; }
.kg-library-variant-status-summary > div { display: flex; align-items: center; justify-content: space-between; gap: var(--space-100); padding-bottom: var(--space-100); border-bottom: 1px solid var(--border-default); }
.kg-library-variant-status-summary > div:last-child { padding-bottom: 0; border-bottom: 0; }
.kg-library-variant-status-summary dt { color: var(--text-subtle); font-size: 11px; }
.kg-library-variant-status-summary dd { margin: 0; color: var(--text-primary); font-size: 12px; font-weight: var(--text-style-weight-bold); text-align: right; }
.kg-library-variant-status-switcher { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-075); }
.kg-library-variant-status-switcher button { min-height: 36px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-secondary); font: inherit; font-size: 11px; cursor: pointer; }
.kg-library-variant-status-switcher button.is-active { border-color: var(--fill-primary); background: var(--semantic-status-brand-subtle); color: var(--semantic-text-brand); font-weight: var(--text-style-weight-bold); }
.kg-library-variant-status-actions { display: grid; gap: var(--space-075); }
.kg-library-variant-status-actions .btn { width: 100%; min-height: 42px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

@media (max-width: 1180px) {
  .kg-library-review-body { grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr); }
  .kg-library-review-detail-body { display: block; overflow-y: auto; }
  .kg-library-review-detail-body > .kg-library-review-panel { min-height: 620px; }
  .kg-library-review-detail-body > .kg-library-review-panel + .kg-library-review-panel { border-top: 1px solid var(--border-default); border-left: 0; }
  .kg-library-variant-body { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 980px) {
  .kg-library-variant-body { display: block; overflow-y: auto; }
  .kg-library-variant-selected-list { max-height: 520px; overflow-y: auto; }
  .kg-library-variant-settings { margin-top: var(--space-250); max-height: none; overflow: visible; }
  .kg-library-variant-status-body { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .kg-master-detail:has(.kg-library-page),
  .kg-master-detail:has(.kg-library-review-page) { grid-template-columns: minmax(0, 1fr); }
  .kg-master-detail:has(.kg-library-page) > .kg-sidebar,
  .kg-master-detail:has(.kg-library-review-page) > .kg-sidebar { display: none; }
  .kg-library-workspace { min-height: 0; overflow-y: auto; }
  .kg-library-rail { max-height: 280px; }
  .kg-library-main { padding: var(--space-300) var(--space-200) var(--space-200); }
  .kg-library-section-head,
  .kg-library-review-header,
  .kg-library-variant-title-row,
  .kg-library-variant-status-top { align-items: flex-start; flex-direction: column; }
  .kg-library-review-header,
  .kg-library-variant-header { min-height: auto; padding: var(--space-175) var(--space-200); }
  .kg-library-review-reconvert { align-self: flex-start; margin-bottom: 0; }
  .kg-library-review-browse { padding: var(--space-200); }
  .kg-library-review-browse-head > div,
  .kg-library-review-browse-actions { align-items: flex-start; flex-direction: column; }
  .kg-library-review-browse-actions { width: 100%; }
  .kg-library-review-card-grid { grid-template-columns: 1fr; }
  .kg-library-review-detail-drawer { width: 100vw; }
  .kg-library-variant-body,
  .kg-library-variant-status-body { padding: var(--space-200); }
  .kg-library-variant-header-actions,
  .kg-library-variant-header-actions .btn { width: 100%; }
  .kg-library-variant-select-grid,
  .kg-library-variant-option-grid,
  .kg-library-variant-summary { grid-template-columns: 1fr; }
  .kg-library-variant-summary > div + div { border-top: 1px solid var(--border-default); border-left: 0; }
  .kg-library-variant-status-progress { overflow-x: auto; }
}
.kg-decision-trace { display: grid; margin-top: var(--space-200); padding-top: var(--space-175); border-top: var(--border-width-default) solid var(--border-divider); }
.kg-decision-trace__trigger { justify-self: start; display: inline-flex; align-items: center; gap: var(--space-075); }
.kg-decision-trace__backdrop { position: fixed; inset: 0; z-index: var(--decision-trace-layer-backdrop); border: 0; background: var(--decision-trace-backdrop-scrim); cursor: pointer; }
.kg-decision-trace__drawer { position: fixed; inset: 0 0 0 auto; z-index: var(--decision-trace-layer-drawer); width: min(var(--decision-trace-drawer-width), 100vw); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; border-left: var(--border-width-default) solid var(--border-default); background: var(--semantic-background-default); box-shadow: var(--shadow-section); animation: kg-decision-trace-in var(--motion-medium) var(--motion-easing); }
@keyframes kg-decision-trace-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.kg-decision-trace__drawer-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-150); padding: var(--space-200) var(--space-250); border-bottom: var(--border-width-default) solid var(--border-divider); }
.kg-decision-trace__drawer-header > div { min-width: 0; display: grid; gap: var(--space-025); }
.kg-decision-trace__drawer-header span { color: var(--text-subtle); font-size: var(--text-style-caption-small-font-size); }
.kg-decision-trace__drawer-header h2 { margin: 0; color: var(--text-primary); font-size: var(--text-style-heading-small-font-size); }
.kg-decision-trace__close { width: var(--space-400); height: var(--space-400); flex: none; border: var(--border-width-default) solid var(--border-default); border-radius: var(--radius-md); background: var(--semantic-background-default); color: var(--text-primary); cursor: pointer; }
.kg-decision-trace__drawer-body { min-height: 0; display: grid; align-content: start; gap: var(--space-200); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-250); }
.kg-decision-trace__intro { display: grid; justify-items: start; gap: var(--space-075); padding: var(--space-175); border-radius: var(--radius-lg); background: var(--semantic-background-subtle); }
.kg-decision-trace__intro p, .kg-decision-trace__intro small { margin: 0; color: var(--text-secondary); font-size: var(--text-style-caption-small-font-size); line-height: var(--text-style-caption-line-height); overflow-wrap: anywhere; }
.kg-decision-trace__flow { display: grid; gap: var(--space-150); }
.kg-decision-trace__flow-step { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-125); }
.kg-decision-trace__flow-marker { width: var(--space-400); height: var(--space-400); display: grid; place-items: center; border-radius: var(--radius-full); background: var(--semantic-background-strong); color: var(--semantic-text-brand); font-weight: var(--text-style-weight-bold); }
.kg-decision-trace__flow-content { min-width: 0; display: grid; gap: var(--space-100); padding: var(--space-175); border: var(--border-width-default) solid var(--border-default); border-radius: var(--radius-lg); background: var(--semantic-background-default); }
.kg-decision-trace__flow-content > header { display: grid; gap: var(--space-025); }
.kg-decision-trace__flow-content > header strong { color: var(--text-primary); font-size: var(--text-style-body-small-font-size); }
.kg-decision-trace__flow-content > header span, .kg-decision-trace__reaction { margin: 0; color: var(--text-secondary); font-size: var(--text-style-caption-small-font-size); line-height: var(--text-style-caption-line-height); }
.kg-decision-trace__reaction { padding: var(--space-075) var(--space-100); border-radius: var(--radius-md); background: var(--semantic-background-subtle); }
.kg-decision-trace__evidence { border: var(--border-width-default) solid var(--border-divider); border-radius: var(--radius-md); background: var(--semantic-background-subtle); }
.kg-decision-trace__evidence summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-100); padding: var(--space-100) var(--space-125); color: var(--text-primary); cursor: pointer; }
.kg-decision-trace__evidence summary span { color: var(--text-subtle); font-size: var(--text-style-caption-small-font-size); }
.kg-decision-trace__evidence pre { margin: 0; padding: var(--space-125); border-top: var(--border-width-default) solid var(--border-divider); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-secondary); font-size: var(--text-style-caption-small-font-size); }
.kg-decision-trace__decision { display: grid; gap: var(--space-075); padding: var(--space-125); border-radius: var(--radius-md); background: var(--semantic-background-subtle); }
.kg-decision-trace__decision p { margin: 0; color: var(--text-secondary); font-size: var(--text-style-caption-small-font-size); line-height: var(--text-style-caption-line-height); }
.kg-decision-trace__loading { color: var(--text-subtle); font-size: var(--text-style-caption-small-font-size); }
.kg-decision-trace__error { color: var(--semantic-text-danger); font-size: var(--text-style-caption-small-font-size); }
.kg-decision-trace__gap { padding: var(--space-125); border-radius: var(--radius-md); background: var(--semantic-status-warning-soft-fill); color: var(--semantic-text-warning); font-size: var(--text-style-caption-small-font-size); }
.kg-decision-trace__raw { padding: var(--space-125); border: var(--border-width-default) solid var(--border-divider); border-radius: var(--radius-md); color: var(--text-subtle); }
.kg-decision-trace__raw summary { cursor: pointer; font-size: var(--text-style-caption-small-font-size); }
.kg-decision-trace__raw > div { display: grid; gap: var(--space-025); padding: var(--space-100) 0; border-top: var(--border-width-default) solid var(--border-divider); }
.kg-decision-trace__raw > div span { color: var(--text-secondary); font-size: var(--text-style-caption-small-font-size); }

/* Multiline form control shares TextInput focus and color tokens. */
.input-control--multiline { height: auto; padding: var(--space-150) var(--pad-lg); }
.input-control--multiline textarea.input { height: auto; resize: vertical; line-height: var(--text-style-body-line-height); }

/* Compact metadata row, aligned with the adjacent review sections. */
.kg-library-review-difficulty { flex: 0 0 auto; display: flex; align-items: center; gap: var(--space-200); padding: var(--space-100) var(--space-200); border-top: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); }
.kg-library-review-difficulty > strong { flex: 0 0 auto; font-weight: var(--text-style-weight-bold); color: var(--text-primary); }
.kg-library-review-difficulty-options { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: var(--space-150); }
.kg-library-review-difficulty-options > .radio { width: auto; min-width: 0; }

.kg-library-review-linked-solution + .kg-library-review-difficulty { border-top: 0; }
.kg-library-solution-actions { display: flex; flex-wrap: wrap; gap: var(--space-100); }
.kg-library-solution-editor { display: grid; gap: var(--space-150); padding: var(--space-200); border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.kg-library-solution-editor > p { margin: 0; color: var(--text-secondary); font-size: var(--text-style-body-small-font-size); }
.kg-library-solution-figure { display: grid; gap: var(--space-150); padding: var(--space-200); background: var(--bg-page); border-radius: var(--radius-md); }
.kg-library-solution-figure svg { width: 100%; height: 150px; color: var(--text-primary); }
.kg-library-solution-figure > span { color: var(--text-secondary); font-size: var(--text-style-body-small-font-size); }
.kg-library-solution-page { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-300); background: var(--bg-page); }
.kg-library-solution-tabs { display: flex; flex-wrap: wrap; gap: var(--space-150); margin-bottom: var(--space-250); }
.kg-library-solution-tabs button { gap: var(--space-150); }
.kg-library-solution-tab-item { display: inline-flex; align-items: center; gap: var(--space-075); }
.kg-library-solution-tab-check { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 40px; cursor: pointer; }
.kg-library-solution-tab-check span { width: 16px; height: 16px; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-surface); position: relative; }
.kg-library-solution-tab-check input:checked + span { background: var(--color-accent); border-color: var(--color-accent); }
.kg-library-solution-tab-check input:checked + span::after { content: ""; position: absolute; left: 4px; top: 1px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.kg-library-solution-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; gap: var(--space-250); }
.kg-library-solution-columns > section { background: var(--semantic-background-default); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
@media (max-width: 1000px) { .kg-library-solution-columns { grid-template-columns: minmax(0, 1fr); } }

.kg-library-solution-reference { display: grid; gap: var(--space-250); }
.kg-library-solution-reference > section { background: var(--semantic-background-default); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.kg-library-solution-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .kg-library-solution-columns { grid-template-columns: minmax(0, 1fr); } }

.kg-library-solution-figure svg { height: 280px; }

.kg-library-figure-workspace-preview { display: grid; gap: var(--space-250); }
.kg-library-figure-workspace-preview h2 { margin: 0; font-size: var(--text-style-heading-small-font-size); }

.kg-library-solution-inline-figure { display: flex; flex-direction: column; align-items: center; gap: var(--space-100); margin: var(--space-250) 0; }
.kg-library-solution-inline-figure svg { width: 100%; max-width: 420px; height: 280px; color: var(--text-primary); }

/* Solution content keeps one body surface, without a surrounding card. */
.kg-library-solution-reference > section,
.kg-library-solution-columns > .kg-library-review-linked-solution {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.kg-library-repair-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr); gap: var(--space-250); align-items: start; }
.kg-library-repair-canvas, .kg-library-repair-chat { padding: var(--space-250); background: var(--semantic-background-default); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.kg-library-repair-canvas { display: grid; gap: var(--space-250); max-height: calc(100vh - 260px); overflow: auto; }
.kg-library-repair-side { display: grid; gap: var(--space-150); }
.kg-library-repair-chat { display: flex; flex-direction: column; gap: var(--space-200); height: calc(100vh - 320px); min-height: 620px; }
.kg-library-repair-chat h2, .kg-library-repair-canvas h2 { margin: 0; }
.kg-library-repair-log { flex: 1; min-height: 100px; overflow: auto; }
.kg-library-repair-graph { width: 100%; padding: var(--space-250); background: var(--semantic-background-default); border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: auto; cursor: pointer; }
.kg-library-repair-graph[aria-pressed="true"] { outline: 2px solid var(--color-primary); }
.kg-library-repair-graph svg { width: 100%; height: auto; }
.kg-library-repair-attach input { display: none; }
.kg-library-repair-attach { cursor: pointer; padding: var(--space-100); }
@media (max-width: 1100px) { .kg-library-repair-layout { grid-template-columns: 1fr; } }

.kg-library-repair-editor-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-150); }

button.kg-library-variant-back { padding: 0; border: 0; background: transparent; color: var(--text-primary); cursor: pointer; }
button.kg-library-variant-back:hover { background: var(--state-hover); }

.kg-library-variant-title-row > .kg-library-solution-actions { align-items: center; }

/* Library selection and teacher-facing exam builder (Figma 441:1487). */
.kg-library-exam-selection {
  position: sticky; bottom: 20px; z-index: 10; margin: 24px auto 0;
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-150);
  padding: var(--space-200); max-width: 760px; background: var(--semantic-background-default);
  border: 1px solid var(--border-default); border-radius: 12px;
  box-shadow: 0 4px 20px #191f281a;
}
.kg-library-exam-selection strong { margin-right: auto; }
.kg-exam-builder { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: var(--semantic-background-subtle); color: var(--text-primary); }
.kg-exam-header { display:flex; align-items:center; justify-content:space-between; gap:24px; padding:16px 40px; background:var(--semantic-background-default); border-bottom:1px solid var(--border-default); }
.kg-exam-header h1 { margin:0; }
.kg-exam-header .kg-library-breadcrumb { margin-bottom:8px; }
.kg-exam-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.kg-exam-row strong:first-child { margin-right:auto; }
.kg-exam-steps { display:flex; gap:24px; padding:12px 40px; background:var(--semantic-background-default); border-bottom:1px solid var(--border-default); }
.kg-exam-steps button { padding:10px 8px; border:0; background:transparent; color:var(--text-secondary); font:inherit; }
.kg-exam-steps button[aria-current="step"] { color:var(--semantic-fill-brand); font-weight:700; box-shadow:inset 0 -2px var(--semantic-fill-brand); }
.kg-exam-steps button:disabled { opacity:.35; }
.kg-exam-setup { display:grid; grid-template-columns:minmax(0, 640px) 300px; gap:20px; width:min(100%,1020px); padding:24px 40px; margin:0 auto; overflow:auto; flex:1; align-items:start; }
.kg-exam-panel { display:flex; flex-direction:column; gap:20px; padding:20px; background:var(--semantic-background-default); border:1px solid var(--border-default); border-radius:12px; min-width:0; }
.kg-exam-panel h2 { font-size:18px; margin:0; }
.kg-exam-panel p, .kg-exam-card > p { font-size:12px; line-height:1.6; color:var(--text-secondary); margin:0; }
.kg-exam-panel label { display:block; font-size:14px; line-height:1.6; }
.kg-exam-panel select, .kg-exam-panel input.control-state { display:block; width:100%; height:48px; margin-top:8px; border:1px solid var(--border-default); border-radius:8px; padding:0 12px; background:var(--semantic-background-default); color:inherit; font:inherit; }
.kg-exam-builder input[type="checkbox"] { width:20px; height:20px; vertical-align:middle; margin-right:8px; accent-color:var(--semantic-fill-brand); }
.kg-exam-workspace { display:grid; grid-template-columns:308px minmax(0,1fr); min-height:0; flex:1; }
.kg-exam-workspace > .kg-exam-panel { border-radius:0; overflow:auto; border-top:0; }
.kg-exam-results { overflow:auto; padding:20px; min-width:0; }
.kg-exam-results > .kg-exam-row { justify-content:flex-start; gap:var(--space-075); margin-bottom:24px; font-size:14px; }
.kg-exam-results > .kg-exam-row > .check:last-child { margin-left:auto; }
.kg-exam-results .kg-library-problem-grid { grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); align-items:start; }
.kg-exam-card { background:var(--semantic-background-default); border:1px solid var(--border-default); border-radius:16px; padding:16px; display:grid; gap:12px; box-shadow:0 4px 12px #4e59681a; }
.kg-exam-card[data-selected="true"] { border-color:var(--semantic-fill-brand); }
.kg-exam-card label { display:flex; align-items:center; min-height:32px; font-size:14px; }
.kg-exam-card .kg-library-problem-preview { min-height:180px; height:auto; padding:12px; }
.kg-exam-footer { display:flex; align-items:center; justify-content:flex-end; gap:12px; padding:16px 40px; background:var(--semantic-background-default); border-top:1px solid var(--border-default); }
.kg-exam-footer > strong { margin-right:auto; }
.kg-exam-paper { padding:32px; background:var(--semantic-background-default); border:1px solid var(--border-default); border-radius:8px; min-width:0; }
.kg-exam-paper h1 { text-align:center; font-size:24px; }
.kg-exam-paper > p { text-align:right; font-size:12px; }
.kg-exam-paper article { padding:24px 0; border-top:1px solid var(--border-default); line-height:1.8; }
.kg-exam-paper article p { white-space:pre-line; }
.kg-exam-paper > h2 { margin-top:40px; }
@media (max-width:1000px) {
  .kg-exam-workspace { grid-template-columns:240px minmax(0,1fr); }
  .kg-exam-setup { grid-template-columns:minmax(0,1fr) 260px; padding:20px; }
  .kg-exam-header,.kg-exam-footer { padding:16px 20px; }
}
@media (max-width:720px) {
  .kg-exam-workspace { display:block; overflow:auto; }
  .kg-exam-setup { display:block; }
  .kg-exam-panel { margin-bottom:16px; }
  .kg-exam-results { overflow:visible; }
  .kg-exam-header { flex-wrap:wrap; }
  .kg-exam-steps { gap:8px; padding:8px 16px; }
}
body:has(.kg-exam-builder) { overflow:hidden; }
.kg-master-detail:has(.kg-exam-builder) { height:100dvh; overflow:hidden; }
.kg-main-detail:has(.kg-exam-builder) { padding:0; overflow:hidden; min-width:0; }
.kg-exam-builder { height:100dvh; }
.kg-exam-header,.kg-exam-steps,.kg-exam-footer { flex-shrink:0; }
.kg-exam-panel > .kg-exam-row { justify-content:space-between; }
.kg-library-problem-card:has(input:checked) { border-color:var(--semantic-fill-brand); }
.kg-exam-builder a.btn,.kg-library-exam-selection a.btn { text-decoration:none; }
.kg-exam-paper article p { color:var(--text-primary); font-size:14px; }
.kg-exam-card .kg-library-problem-preview { cursor:default; }
.kg-exam-card .kg-library-problem-preview:hover { border-color:var(--border-default); box-shadow:none; }

.kg-my-exams .kg-library-main { padding:var(--space-300) var(--space-300) 40px; }
.kg-my-exams .kg-library-section { margin-bottom:32px; }
.kg-my-exams h1 { font-size:20px; margin:0; }
.kg-my-exams .kg-library-rail a.btn { text-decoration:none; width:100%; }
.kg-my-exams .kg-library-smart-link,.kg-my-exams .kg-library-smart-link.is-active { width:100%; }
.kg-my-exam-folders { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; margin-top:16px; }
.kg-my-exam-folders button { display:flex; align-items:center; gap:12px; text-align:left; padding:12px; min-height:64px; border:1px solid var(--border-default); border-radius:var(--radius-md); background:var(--semantic-background-default); color:var(--text-primary); }
.kg-my-exam-folders button div { display:grid; gap:4px; }
.kg-my-exam-folders span { font-size:12px; color:var(--text-secondary); }
.kg-my-exam-folders strong { font-size:14px; }
.kg-my-exam-filters { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:12px 0; flex-wrap:wrap; }
.kg-my-exam-filters select { appearance:none; -webkit-appearance:none; padding:8px 40px 8px 12px; border:1px solid var(--border-default); border-radius:var(--radius-md); background-color:var(--semantic-background-default); background-image:var(--select-chevron-mask); background-repeat:no-repeat; background-position:right 12px center; background-size:16px 16px; color:var(--text-primary); }
.kg-my-exam-filters label { display:flex; align-items:center; gap:8px; font-size:14px; }
.kg-my-exam-filters .check__label > span { color:var(--text-subtle); }
.kg-my-exam-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,400px),1fr)); align-items:stretch; justify-content:start; gap:var(--gap-md); margin-top:var(--gap-md); }
.kg-my-exam-cards .kg-library-doc-card[data-selected=true] { border-color:var(--border-focus); }
.kg-my-exam-cards .kg-my-exam-check { top:var(--pad-lg); left:var(--pad-lg); z-index:2; }
.kg-my-exam-cards .kg-library-doc-card:hover .kg-my-exam-check,
.kg-my-exam-cards .kg-library-doc-card:focus-within .kg-my-exam-check,
.kg-my-exam-cards .kg-library-doc-card[data-selected=true] .kg-my-exam-check { opacity:1; }
.kg-my-exam-cards[data-list=true] { grid-template-columns:minmax(0,1fr); }
.kg-my-exam-card { background:var(--semantic-background-default); border:1px solid var(--border-default); border-radius:var(--radius-md); padding:16px; display:grid; gap:20px; }
.kg-my-exam-card[data-selected=true] { border-color:var(--semantic-fill-brand); }
.kg-my-exam-card header { position:relative; display:flex; align-items:flex-start; gap:12px; }
.kg-my-exam-thumb { display:flex; align-items:center; justify-content:center; width:52px; height:68px; flex-shrink:0; border-radius:var(--radius-xs); background:var(--semantic-status-brand-subtle); }
.kg-my-exam-copy { display:grid; gap:6px; color:var(--text-primary); text-decoration:none; min-width:0; }
.kg-my-exam-copy strong { font-size:16px; line-height:1.4; }
.kg-my-exam-copy span,.kg-my-exam-copy small { font-size:12px; color:var(--text-secondary); }
.kg-my-exam-card footer { display:flex; align-items:center; justify-content:space-between; color:var(--text-subtle); font-size:11px; }
.kg-my-exam-card [data-status] { color:var(--semantic-text-brand); }
.kg-my-exam-card [data-status="출제 완료"] { color:var(--semantic-text-success); }
.kg-my-exams input[type=checkbox]:not(.kg-visually-hidden) { width:20px; height:20px; accent-color:var(--semantic-fill-brand); }
.kg-my-exams .kg-exam-row > input { padding:10px; border:1px solid var(--border-default); border-radius:var(--radius-md); }
@media(max-width:1100px) { .kg-my-exam-folders {grid-template-columns:repeat(2,minmax(0,1fr));} }
.kg-my-exams .kg-library-tree-wrap button { justify-content:flex-start; gap:8px; }
.kg-my-exams .kg-library-tree-wrap button > span:last-child { margin-left:0; }
.kg-my-exams .tabs--line { width:100%; }
.kg-my-exams a.btn { text-decoration:none; }

.kg-my-exam-menu { position: relative; }
.kg-my-exam-menu > div { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 240px; padding: 8px; border: 1px solid var(--border-default); border-radius: 12px; background: var(--semantic-background-default); box-shadow: 0 8px 24px #18202c22; }
.kg-my-exam-menu [role=menuitem] { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 12px 16px; border-radius: 6px; font: inherit; cursor: pointer; }
.kg-my-exam-menu [role=menuitem]:hover { background: var(--semantic-background-subtle); }
.kg-my-exam-menu [role=menuitem]:disabled { opacity: .4; cursor: default; }
.kg-my-exam-menu [role=menuitem]:nth-last-child(2) { color: var(--semantic-text-danger); border-top: 1px solid var(--border-default); }
.kg-my-exam-reader { flex: 1; min-width: 0; padding: 32px; overflow: auto; background: var(--semantic-background-subtle); }
.kg-my-exam-reader .kg-exam-header { align-items: center; margin-bottom: 28px; }
.kg-my-exam-reader .kg-exam-header a { text-decoration: none; }
.kg-my-exam-reader .kg-exam-paper { max-width: 1000px; margin: 0 auto; display: grid; gap: 20px; }
.kg-my-exam-reader .kg-exam-panel { padding: 28px; line-height: 1.9; }
.kg-my-exam-menu > div { max-height: 55vh; overflow-y: auto; }

.kg-my-exam-check { position: absolute; top: -4px; left: -4px; z-index: 1; opacity: 0; width: 24px; align-items: flex-start; gap: 0; transition: opacity 120ms ease; }
.kg-my-exam-check .check__copy { position: absolute; }
.kg-my-exam-card:hover .kg-my-exam-check,
.kg-my-exam-card:focus-within .kg-my-exam-check,
.kg-my-exam-card[data-selected=true] .kg-my-exam-check { opacity: 1; }
@media (hover: none) { .kg-my-exam-check { opacity: 1; } }

.kg-my-exam-reader { padding: 0; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
.kg-my-exam-reader > .kg-library-variant-header { flex-shrink: 0; }
.kg-my-exam-questions { padding: 0 24px 32px; overflow: auto; min-height: 0; flex: 1; }
.kg-my-exam-question-tools { position: sticky; top: 0; z-index: 5; padding: 12px 0; background: var(--semantic-background-subtle); }
.kg-my-exam-question-tools h2 { margin: 0; font-size: 16px; }
.kg-my-exam-question-tools .kg-my-exam-filters:first-child { padding-bottom: 16px; border-bottom: 1px solid var(--border-default); }
.kg-my-exam-question-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px; align-items: start; }
.kg-my-exam-question-grid[data-density=large] { grid-template-columns: repeat(3,minmax(0,1fr)); }
.kg-my-exam-question-grid .kg-library-problem-card { max-width: none; padding: var(--space-200) var(--space-200) var(--space-400); gap: 16px; background: var(--semantic-background-subtle); border-radius: var(--radius-xl); }
.kg-my-exam-question-grid .kg-library-problem-card-head .check { width: auto; }
.kg-my-exam-question-grid .kg-library-problem-preview { height: 320px; padding: 20px; overflow-y: auto; }
.kg-my-exam-question-grid .kg-library-problem-preview > span { white-space: pre-line; line-height: 1.9; }
.kg-my-exam-question-grid .kg-library-problem-meta { min-height: 60px; }
@media(max-width:1400px) { .kg-my-exam-question-grid {grid-template-columns:repeat(3,minmax(0,1fr));} .kg-my-exam-question-grid[data-density=large] {grid-template-columns:repeat(2,minmax(0,1fr));} }
@media(max-width:1000px) { .kg-my-exam-question-grid {grid-template-columns:repeat(2,minmax(0,1fr));} }
@media(max-width:700px) { .kg-my-exam-question-grid,.kg-my-exam-question-grid[data-density=large] {grid-template-columns:minmax(0,1fr);} }
.kg-my-exam-question-grid .kg-library-problem-preview { display: flex; align-items: flex-start; }
.kg-my-exam-question-grid .kg-library-problem-card { background: var(--semantic-background-default); }
.kg-my-exam-reader a.btn { text-decoration: none; }

.kg-main-detail:has(> .kg-my-exam-reader) { padding: 0; overflow: hidden; min-width: 0; }
.kg-my-exam-reader .kg-library-review-breadcrumb > [data-breadcrumb-label] { font-size: inherit; line-height: inherit; color: var(--text-secondary); }

.kg-my-exam-question-grid[data-mode=both] { grid-template-columns: minmax(0,1fr); }
.kg-my-exam-question-grid .kg-library-problem-card[data-view-mode=both] { grid-template-columns: minmax(0,1fr) minmax(0,1fr); column-gap: 32px; grid-template-rows: 44px 320px min-content minmax(60px,1fr); }
.kg-library-problem-card[data-view-mode=both] > .kg-library-problem-card-head,
.kg-library-problem-card[data-view-mode=both] > .kg-library-problem-preview,
.kg-library-problem-card[data-view-mode=both] > .kg-library-problem-badges,
.kg-library-problem-card[data-view-mode=both] > .kg-library-problem-meta { grid-column: 1; }
.kg-my-exam-paired-solution { grid-column: 2; grid-row: 1 / span 4; min-width: 0; margin: -16px -16px -16px 0; padding: 16px; border-left: 1px solid var(--border-default); display: flex; flex-direction: column; gap: 16px; }
.kg-my-exam-paired-solution h3 { min-height: 44px; display: flex; align-items: center; margin: 0; color: var(--text-secondary); font-size: 16px; }
.kg-my-exam-paired-solution > div { padding: 20px; min-height: 320px; border: 1px solid var(--border-default); border-radius: var(--radius-md); line-height: 1.9; font-size: 13px; }
.kg-my-exam-paired-solution p { margin: 0 0 20px; white-space: pre-line; color: var(--text-primary); }
.kg-my-exam-paired-solution p:last-child { margin-bottom: 0; }
@media(max-width:700px) {
 .kg-my-exam-question-grid .kg-library-problem-card[data-view-mode=both] { grid-template-columns: minmax(0,1fr); grid-template-rows: auto; }
 .kg-my-exam-paired-solution { grid-column: 1; grid-row: auto; border-left: 0; border-top: 1px solid var(--border-default); margin: 0 -16px -16px; }
}

/* Exam setup: Figma 430:2067 form and summary proportions. */
.kg-exam-setup[data-setup] { width:min(100%,880px); grid-template-columns:minmax(0,480px) 300px; padding:20px 40px 40px; gap:20px; }
.kg-exam-setup-form { padding:16px; min-height:620px; }
.kg-exam-setup-form > h2 { padding:12px 16px; background:var(--semantic-fill-muted); border-radius:var(--radius-md); font-size:14px; text-align:center; }
.kg-exam-setup-form select { appearance:none; padding-right:44px; background-image:var(--select-chevron-mask); background-repeat:no-repeat; background-position:right 16px center; background-size:20px; }
.kg-exam-setup-form .check { display:inline-flex; align-items:center; }
.kg-exam-setup-summary { padding:24px; min-height:500px; gap:20px; }
.kg-exam-setup-summary > .kg-exam-row { align-items:flex-start; justify-content:flex-start; gap:8px; font-size:14px; }
.kg-exam-setup-summary > .kg-exam-row > span { width:84px; flex-shrink:0; color:var(--text-secondary); }
.kg-exam-setup-summary > .kg-exam-row > strong { min-width:0; overflow-wrap:anywhere; font-weight:500; }
.kg-exam-setup-summary > .btn { margin-top:auto; width:100%; }
.kg-exam-setup-stat { display:flex; flex-direction:column; gap:4px; padding:12px 20px; border-radius:var(--radius-md); background:var(--semantic-status-brand-soft-fill); }
.kg-exam-setup-stat > span { font-size:12px; color:var(--text-secondary); }
.kg-exam-setup-stat > strong { font-size:24px; line-height:1.3; color:var(--semantic-text-brand); }
@media (max-width:900px) { .kg-exam-setup[data-setup] { padding:20px; grid-template-columns:minmax(0,1fr) 280px; } }
@media (max-width:700px) { .kg-exam-setup[data-setup] { display:flex; flex-direction:column; } .kg-exam-setup-form,.kg-exam-setup-summary { width:100%; min-height:0; } }

.kg-exam-setup[data-setup] { width:min(100%,880px); padding-top:20px; }
.kg-exam-setup-form { min-height:calc(100dvh - 153px); gap:20px; }
.kg-exam-setup-form > .tabs--capsule { width:100%; height:48px; padding:4px; }
.kg-exam-setup-form > .tabs--capsule > button { flex:1; height:40px; justify-content:center; }
.kg-exam-setup-form label { font-size:14px; font-weight:500; line-height:1.4; }
.kg-exam-setup-form select,.kg-exam-setup-form input.control-state { margin-top:6px; padding-left:16px; font-size:16px; font-weight:400; }
.kg-exam-setup-form input::placeholder { color:var(--text-tertiary); }
.kg-exam-setup-field { display:flex; flex-direction:column; gap:6px; font-size:14px; }
.kg-exam-setup-field small { font-size:12px; color:var(--text-tertiary); line-height:1.4; }
.kg-exam-setup-field > .stepper { width:100%; height:48px; }
.kg-exam-setup-form .stepper input { border:0; margin:0; padding:0; height:100%; min-width:0; width:100%; text-align:center; font-size:16px; }
.kg-exam-setup-choices { display:flex; gap:8px; }
.kg-exam-setup-choices > label { display:flex; flex:1; align-items:center; min-width:0; }
.kg-exam-difficulty { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:-8px; }
.kg-exam-difficulty > div { display:flex; flex-direction:column; align-items:center; gap:4px; font-size:12px; color:var(--text-secondary); }
.kg-exam-difficulty .stepper { width:100%; padding:4px; gap:0; }
.kg-exam-difficulty .stepper input { font-size:14px; }
.kg-exam-summary-rows { display:flex; flex-direction:column; gap:12px; }
.kg-exam-summary-rows .kg-exam-row { flex-wrap:nowrap; align-items:flex-start; font-size:14px; }
.kg-exam-summary-rows .kg-exam-row > span { width:84px; flex-shrink:0; color:var(--text-secondary); }
.kg-exam-summary-rows .kg-exam-row > strong { flex:1; min-width:0; font-weight:500; overflow-wrap:anywhere; }
.kg-exam-setup-summary { height:500px; min-height:500px; position:sticky; top:0; }
.kg-exam-setup-summary h2 { line-height:24px; }
.kg-exam-setup[data-random=true] .kg-exam-setup-summary { height:auto; min-height:500px; }
.kg-exam-header > .kg-exam-row > .btn { min-width:112px; height:40px; }
@media(max-width:700px) { .kg-exam-setup-form { min-height:0; } .kg-exam-setup-summary { position:static; height:auto; min-height:0; } }
.kg-exam-setup-form > .tabs--capsule { border-radius:8px; }
.kg-exam-setup-form > .tabs--capsule > button { border-radius:4px; box-shadow:none; }
.kg-exam-setup-form .stepper .stepper__value { flex:1 1 0; width:0; }
.kg-exam-setup-field > small,.kg-exam-setup-form input::placeholder { color:var(--semantic-text-tertiary); }
.kg-exam-header .kg-library-breadcrumb { height:36px; display:flex; align-items:center; margin-bottom:0; font-size:12px; }
.kg-exam-header .kg-exam-breadcrumb { display:flex; align-items:center; gap:8px; min-width:0; height:auto; min-height:18px; margin-bottom:8px; color:var(--text-secondary); font-size:12px; line-height:18px; white-space:nowrap; }
.kg-exam-breadcrumb > a { flex:0 0 auto; color:var(--text-secondary); text-decoration:none; }
.kg-exam-breadcrumb > a:hover { color:var(--semantic-text-brand); text-decoration:underline; }
.kg-exam-breadcrumb > span { flex:0 0 auto; color:var(--text-subtle); }
.kg-exam-breadcrumb > span[aria-hidden="true"] { color:var(--border-strong); }
.kg-exam-breadcrumb > strong { min-width:0; overflow:hidden; text-overflow:ellipsis; font-weight:600; color:var(--text-primary); }
.kg-exam-breadcrumb > strong:nth-of-type(1) { max-width:260px; }
.kg-exam-breadcrumb > strong:last-child { flex:0 1 auto; max-width:120px; }
@media(max-width:700px) { .kg-exam-header .kg-exam-breadcrumb { gap:6px; } .kg-exam-breadcrumb > strong:nth-of-type(1) { max-width:120px; } .kg-exam-breadcrumb > span:nth-of-type(2) { display:none; } }
.kg-exam-setup-dropdown { position:relative; }
.kg-exam-setup-dropdown > .select-menu { position:absolute; top:calc(100% + 6px); left:0; z-index:20; }
.kg-exam-setup-dropdown .select-option { flex-shrink:0; }

/* Shared form-state contract for the teacher-facing preview screens. */
:root { --control-focus-ring:0 0 0 3px color-mix(in srgb,var(--border-focus) 15%,transparent); --control-error-ring:0 0 0 3px color-mix(in srgb,var(--status-danger) 15%,transparent); }
.bound-dropdown { position:relative; min-width:0; width:100%; }
.bound-dropdown[data-label=false] > .field > .field-label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.bound-dropdown > .field > .select-menu { position:absolute; z-index:30; top:calc(100% + 6px); left:0; max-height:240px; }
.select-menu > .select-option { flex-shrink:0; }
.kg-exam-setup-form .bound-dropdown .select-trigger { margin-top:0; }
.kg-my-exam-filters > .bound-dropdown { width:140px; }
.kg-my-exam-filters .kg-exam-row > .kg-exam-setup-field { flex-direction:row; align-items:center; white-space:nowrap; }
.kg-my-exam-filters .kg-exam-row .bound-dropdown { width:120px; }
.control-state { transition:border-color var(--motion-fast),box-shadow var(--motion-fast),background-color var(--motion-fast); }
:is(.control-state,.input,.input-control):where(:hover:not(:disabled):not([aria-disabled=true]):not(.input--disabled):not(.input--error):not([aria-invalid=true])) { border-color:var(--semantic-border-strong); }
:is(.control-state,.input):focus:not(:disabled),.input-control:focus-within:not(.input--disabled),.select-trigger.input--open { outline:none; outline-offset:0; border-color:var(--border-focus); box-shadow:var(--control-focus-ring); }
.input-control .input:focus { box-shadow:none; }
.control-state:disabled { cursor:not-allowed; background:var(--semantic-fill-muted); color:var(--text-subtle); border-color:var(--border-default); opacity:var(--state-disabled-opacity); box-shadow:none; }
:is(.control-state,.input)[aria-invalid=true],.control-state.input--error { border-color:var(--status-danger); }
:is(.control-state,.input)[aria-invalid=true]:focus,.control-state.input--error:focus { border-color:var(--status-danger); box-shadow:var(--control-error-ring); }
.field--error .input:focus,.input.input--error:focus,.input-control.input--error:focus-within { border-color:var(--status-danger); box-shadow:var(--control-error-ring); }
.kg-library-rail-search-wrap:focus-within { border-color:var(--border-focus); box-shadow:var(--control-focus-ring); }
.kg-library-rail-search-wrap .control-state:focus { border:0; outline:0; box-shadow:none; }

/* Exam search panel — Figma 449:1889, shared form controls. */
.kg-exam-search-panel { display:flex; flex-direction:column; gap:20px; padding:20px; min-height:0; min-width:0; background:var(--semantic-background-default); border-right:1px solid var(--border-default); overflow:auto; }
.kg-exam-search-stack { display:flex; flex-direction:column; gap:20px; flex:1 0 auto; }
.kg-exam-search-stack h2 { margin:0; font-size:16px; line-height:1.4; font-weight:700; }
.kg-exam-search-section { display:flex; flex-direction:column; gap:6px; min-width:0; }
.kg-exam-search-section h3 { margin:0; font-size:14px; line-height:1.4; font-weight:700; }
.kg-exam-search-controls { display:flex; flex-direction:column; gap:6px; padding:8px 0; }
.kg-exam-search-range { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); gap:8px; align-items:center; padding:8px 0; }
.kg-exam-search-options { display:flex; flex-wrap:wrap; gap:var(--gap-lg); min-height:44px; align-content:start; }
.kg-exam-search-options .check { width:auto; height:32px; min-height:32px; gap:4px; }
.kg-exam-search-text-row { display:flex; gap:6px; }
.kg-exam-search-text-row > .input-control { flex:1; min-width:0; }
.kg-exam-search-text-row > button { width:88px; flex-shrink:0; }
.kg-exam-search-controls .tabs--capsule { width:100%; }
.kg-exam-search-controls .tab--capsule { flex:1; }
.kg-exam-search-chips { display:flex; flex-wrap:wrap; gap:4px; }
.kg-exam-search-chip { display:inline-flex; align-items:center; gap:6px; min-height:32px; padding:0 12px; border:1.5px solid var(--border-default); border-radius:999px; background:var(--semantic-background-default); color:var(--text-primary); font-family:inherit; font-size:12px; font-weight:500; line-height:1.4; cursor:pointer; }
.kg-exam-search-error { margin:0; color:var(--status-danger); font-size:12px; }
.kg-exam-search-panel > .btn { width:100%; flex-shrink:0; }
.kg-exam-search-options .check__label { font-size:var(--text-style-label-medium-font-size); }
.kg-exam-search-controls > .btn { width:100%; justify-content:space-between; }

/* Exam search modal — Figma 608:3058. */
.kg-exam-filter-modal { width:760px; max-width:calc(100vw - 32px); height:auto; max-height:calc(100vh - 32px); box-sizing:border-box; padding:var(--pad-xl); overflow:auto; border:1px solid var(--border-default); border-radius:var(--radius-lg); }
.kg-exam-filter-modal .modal__header { width:704px; max-width:100%; min-height:26px; margin:0 0 var(--pad-md); padding-right:var(--space-400); }
.kg-exam-filter-modal .modal__title { font-size:22px; line-height:26px; }
.kg-exam-filter-modal .modal__body { width:704px; max-width:100%; }
.kg-exam-filter-modal-body { display:grid; gap:var(--pad-md); }
.kg-exam-filter-modal-search { width:100%; }
.kg-exam-filter-modal-search > .input-control { width:100%; height:var(--space-600); font-size:var(--text-style-body-small-font-size); }
.kg-exam-filter-modal-search .input { font-size:var(--text-style-body-small-font-size); }
.kg-exam-filter-modal-info { display:flex; align-items:center; min-height:44px; margin:0; padding:0 var(--pad-md); border-radius:var(--radius-md); background:var(--semantic-status-brand-soft-fill); color:var(--semantic-text-brand); font-size:14px; line-height:1.4; font-weight:500; }
.kg-exam-filter-picker { display:grid; grid-template-columns:repeat(3,minmax(0,226px)); gap:var(--gap-md); height:clamp(180px,calc(100vh - 364px),388px); }
.kg-exam-filter-picker-column { display:flex; flex-direction:column; gap:6px; min-height:0; padding:var(--pad-md); border:1px solid var(--border-default); border-radius:var(--radius-md); background:var(--semantic-background-subtle); overflow:auto; }
.kg-exam-filter-picker-column > h3 { margin:0; color:var(--text-secondary); font-size:14px; line-height:20px; font-weight:700; }
.kg-exam-filter-picker-item { display:flex; width:100%; min-height:40px; align-items:center; justify-content:space-between; gap:6px; padding:0 var(--pad-md); border:1px solid transparent; border-radius:var(--radius-md); background:transparent; color:var(--text-primary); font:inherit; font-size:14px; line-height:1.4; text-align:left; cursor:pointer; }
.kg-exam-filter-picker-item > span { flex:0 0 auto; color:var(--semantic-text-tertiary); font-size:20px; font-weight:700; line-height:1; }
.kg-exam-filter-picker-item:hover { background:var(--semantic-background-default); }
.kg-exam-filter-picker-item[data-selected="true"] { border-color:var(--semantic-fill-brand); background:var(--semantic-background-default); color:var(--semantic-text-brand); font-weight:700; }
.kg-exam-filter-picker-item[data-selected="true"] > span { color:inherit; }
.kg-exam-filter-modal-chips { display:flex; flex-wrap:wrap; gap:6px; min-height:40px; align-items:center; }
.kg-exam-filter-modal .kg-exam-search-chip { min-height:32px; padding:0 var(--pad-lg); font-size:14px; font-weight:700; cursor:default; }
.kg-exam-filter-modal-actions { display:flex; justify-content:flex-start; gap:var(--gap-md); padding-top:0; }
.kg-exam-filter-modal-actions > .btn { min-height:44px; }
.kg-exam-filter-modal-actions > .btn:first-child { min-width:88px; }
.kg-exam-filter-modal-actions > .btn:last-child { min-width:132px; }
/* Distinct Figma bodies: Tag 608:3296 and equation 608:3608. */
.kg-exam-tag-modal { width:920px; height:724px; }
.kg-exam-tag-modal .modal__header, .kg-exam-tag-modal .modal__body { width:864px; }
.kg-exam-tag-modal .kg-exam-filter-modal-info { min-height:46px; justify-content:center; text-align:center; font-weight:700; }
.kg-exam-tag-modal .select-trigger { height:48px; min-height:48px; font-size:14px; }
.kg-exam-tag-accordions { display:flex; flex-direction:column; gap:var(--gap-md); height:clamp(180px,calc(100vh - 332px),424px); overflow:auto; }
.kg-exam-tag-accordion { flex:none; }
.kg-exam-tag-accordion > button { width:100%; display:flex; align-items:center; gap:var(--gap-sm); min-height:44px; padding:var(--pad-md); border:1px solid var(--border-default); border-radius:var(--radius-md); background:var(--semantic-background-default); color:var(--text-primary); text-align:left; font:inherit; font-size:14px; cursor:pointer; }
.kg-exam-tag-accordion > button > strong { min-width:130px; }
.kg-exam-tag-accordion > button > :first-child, .kg-exam-tag-accordion > button > strong { color:var(--semantic-text-brand); font-weight:700; }
.kg-exam-tag-accordion[data-open="true"] > button { min-height:20px; padding:0; border-color:transparent; font-weight:700; }
.kg-exam-tag-accordion[data-open="true"] > button > strong { min-width:0; }
.kg-exam-tag-accordion > button:focus-visible { outline:2px solid var(--border-focus); outline-offset:2px; }
.kg-exam-tag-options { display:grid; grid-template-columns:repeat(3,minmax(0,210px)); gap:6px 20px; padding:var(--pad-md); }
.kg-exam-tag-options .check { width:auto; min-width:0; height:32px; min-height:32px; }
.kg-exam-tag-modal .kg-exam-filter-modal-chips { min-height:36px; }
.kg-exam-formula-modal { width:560px; height:auto; padding:var(--pad-xl); }
.kg-exam-formula-modal .modal__header { margin-bottom:var(--gap-xl); }
.kg-exam-formula-modal .kg-exam-filter-modal-body { gap:var(--gap-xl); }
.kg-exam-formula-section { display:grid; gap:var(--gap-lg); }
.kg-exam-formula-modal .modal__header, .kg-exam-formula-modal .modal__body { width:504px; }
.kg-exam-formula-modal h3 { margin:0; font-size:14px; line-height:20px; font-weight:700; }
.kg-exam-formula-preview { display:flex; align-items:center; justify-content:center; height:64px; padding:0 var(--pad-md); border-radius:var(--radius-md); background:var(--semantic-status-brand-soft-fill); color:var(--semantic-text-tertiary); font-size:14px; overflow:auto; }
.kg-exam-formula-preview[data-empty="true"] .kg-math { color:var(--semantic-text-tertiary); }
.kg-exam-formula-templates .kg-math { color:inherit; }
.kg-exam-formula-preview .katex { color:var(--text-primary); }
.kg-exam-formula-templates { display:grid; grid-template-columns:repeat(6,minmax(0,77.3px)); grid-auto-rows:36px; gap:6px; min-height:128px; align-content:start; }
.kg-exam-formula-templates > .btn { min-width:0; width:100%; height:36px; min-height:36px; padding:0; font-size:14px; color:var(--text-secondary); }
.kg-exam-formula-modal .input-control { width:100%; height:44px; }
.kg-exam-formula-modal .input { font-size:14px; }
.kg-exam-formula-modal .kg-exam-filter-modal-actions > .btn:last-child { min-width:112px; }
/* Keep the design-system search affordance at the trailing edge shown in Figma. */
.kg-exam-filter-modal-search .input__affordance--search { order:2; }
@media (max-width:700px) {
  .kg-exam-filter-modal { width:calc(100vw - 24px); height:auto; max-height:calc(100vh - 24px); padding:16px; }
  .kg-exam-filter-picker { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .kg-exam-filter-picker-column { padding:8px; }
  .kg-exam-filter-picker-item { padding:0 4px; overflow-wrap:anywhere; }
  .kg-exam-tag-options { grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
  .kg-exam-formula-templates { grid-template-columns:repeat(6,minmax(0,1fr)); }
}
@media (min-width:721px) { .kg-exam-workspace:has(.kg-exam-search-panel) { grid-template-columns:308px minmax(0,1fr); } }

/* Shared question cards and controls in the exam builder. */
.kg-exam-results > .kg-exam-row > .check { width:auto; flex-shrink:0; }
.kg-exam-results .kg-library-problem-card { max-width:none; }
.kg-exam-results .kg-library-problem-card-head .check { width:auto; }
.kg-exam-results .kg-library-problem-grid[data-mode=both] { grid-template-columns:minmax(0,1fr); }
.kg-exam-results .kg-library-problem-card[data-view-mode=both] { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
/* Editor fills the viewport between the shared header and persistent footer. */
.kg-exam-editor { flex:1; min-height:0; overflow:auto; display:flex; flex-direction:column; gap:16px; padding:24px 40px; background:var(--semantic-background-subtle); }
.kg-exam-footer { margin-top:auto; position:relative; z-index:2; flex-shrink:0; }
.kg-exam-editor-header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:0 0 16px; border-bottom:1px solid var(--border-default); }
.kg-exam-editor-header h2 { margin:0; font-size:16px; line-height:1.4; }
.kg-exam-editor-header > .kg-exam-row { flex-wrap:wrap; }
.kg-exam-editor-header .kg-exam-setup-field { display:flex; align-items:center; gap:8px; }
.kg-exam-editor-header .bound-dropdown { width:160px; }
.kg-exam-editor-tools { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.kg-exam-editor-tools > .check { width:auto; }
.kg-exam-editor-tools > .kg-exam-row { flex-wrap:wrap; justify-content:flex-end; }
.kg-exam-editor-tools .bound-dropdown { width:164px; }
.kg-exam-editor-hint { margin:0; color:var(--text-secondary); font-size:14px; }
.kg-exam-editor-drag-help { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.kg-exam-editor-grid { flex:none; }
.kg-exam-editor-card { position:relative; min-width:0; border-radius:var(--radius-xl); cursor:grab; }
.kg-exam-editor-card:active { cursor:grabbing; }
.kg-exam-editor-card[data-dragging="true"] { opacity:0.45; }
.kg-exam-editor-card[data-drop-target="true"] { outline:3px solid var(--semantic-fill-brand); outline-offset:4px; }
.kg-exam-editor-card:focus-visible { outline:2px solid var(--border-focus); outline-offset:4px; }
.kg-exam-editor-card .kg-library-problem-card-head { gap:8px; }
.kg-exam-editor-card .kg-library-problem-card-head > .check { margin-right:auto; flex-shrink:0; }
.kg-exam-editor-card .kg-library-problem-card-head > span { white-space:nowrap; }
.kg-exam-editor-delete.btn { min-width:32px; width:32px; height:32px; min-height:32px; padding:6px; flex:none; }
.kg-exam-editor-delete img { width:20px; height:20px; }
@media (max-width:700px) { .kg-exam-editor { padding:16px; } .kg-exam-editor-header { align-items:flex-start; flex-direction:column; } .kg-exam-editor-tools > .kg-exam-row { justify-content:flex-start; } }
.kg-exam-setup-form > label > .input-control { margin-top:6px; }
.kg-exam-setup-form > label > .input-control > .input { height:100%; border:0; margin:0; padding:0; background:transparent; border-radius:0; }
/* Current routing: major function, then its stages. */
.kg-routing-topics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-075); padding: var(--space-150); border-bottom: var(--border-width-default) solid var(--border-divider); }
.kg-routing-topics button { padding: var(--space-150); min-width: 0; gap: var(--space-075); }
.kg-routing-topics button strong { overflow-wrap: anywhere; }
.kg-routing-topics button span { color: var(--text-subtle); }
.kg-routing-effort { display: flex; flex-wrap: wrap; gap: var(--space-100); margin-bottom: var(--space-250); }
.kg-routing-effort button { width: auto; padding: var(--space-150) var(--space-200); }

.kg-exam-search-unit-path { max-width:100%; min-width:0; text-align:left; }
.kg-exam-search-unit-path > span:first-child { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.kg-exam-search-unit-path > span:last-child { flex-shrink:0; }

.kg-exam-output { display:grid; grid-template-columns:minmax(300px, 440px) minmax(0, 1fr); gap:var(--space-300); padding:var(--space-300); overflow:auto; flex:1; align-items:start; }
.kg-exam-flow-stack { display:flex; flex-direction:column; gap:var(--space-200); }
.kg-exam-flow-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:var(--space-100); }
.kg-exam-score-list { display:flex; flex-direction:column; gap:var(--space-150); }
.kg-exam-score-row { display:grid; grid-template-columns:1fr 100px auto; align-items:center; gap:var(--space-150); }
.kg-exam-output-preview { display:grid; gap:var(--space-200); padding:var(--space-200); border:1px solid var(--border-default); border-radius:var(--radius-md); }
.kg-exam-output-preview[data-columns="two"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
.kg-exam-output-preview > div { min-height:180px; overflow-wrap:anywhere; padding:var(--space-150); border-bottom:1px solid var(--border-default); }
@media(max-width:900px) { .kg-exam-output { grid-template-columns:minmax(0,1fr); } }
.kg-exam-output { width:min(100%, 1440px); margin-inline:auto; box-sizing:border-box; }
.kg-exam-output h3 { margin:0; font-size:16px; line-height:1.5; }
.kg-exam-output .check { display:inline-flex; align-items:center; gap:var(--space-100); width:fit-content; font-weight:400; }
.kg-exam-output .kg-exam-row { flex-wrap:nowrap; }
.kg-exam-output .kg-exam-row > .input-control { flex:1; min-width:0; width:auto; }
.kg-exam-output .kg-exam-row > .btn { flex-shrink:0; }
.kg-exam-output .kg-math { font-size:14px; line-height:1.8; color:var(--text-primary); }

.kg-exam-copy-notice { margin:0; padding:var(--space-150) var(--space-300); background:var(--semantic-background-default); color:var(--text-secondary); font-size:14px; border-bottom:1px solid var(--border-default); flex-shrink:0; }
.kg-exam-undo { display:flex; align-items:center; justify-content:space-between; gap:var(--space-200); background:var(--semantic-background-default); padding:var(--space-150); border:1px solid var(--border-default); border-radius:var(--radius-md); }
.kg-exam-compare { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:var(--space-200); }
.kg-exam-compare article { padding:var(--space-200); border:1px solid var(--border-default); border-radius:var(--radius-md); min-height:220px; }
.kg-exam-compare h3 { font-size:16px; margin:0 0 var(--space-200); }
.kg-exam-search-summary { font-size:12px; line-height:1.7; color:var(--text-secondary); }
.kg-exam-output-preview[data-margin="narrow"] { padding:var(--space-100); }
.kg-exam-output-preview[data-margin="wide"] { padding:var(--space-400); }
.kg-exam-output-preview[data-spacing="compact"] > div { min-height:100px; }
.kg-exam-output-preview[data-spacing="wide"] > div { min-height:300px; }
.kg-exam-output-preview[data-paper="B4"] { max-width:100%; }
@media(max-width:700px) {.kg-exam-compare {grid-template-columns:minmax(0,1fr);}}

.kg-exam-workbench-modal { max-height:calc(100dvh - 40px); overflow:auto; padding:var(--pad-xl); }
.kg-exam-workbench-modal .kg-exam-flow-stack > label { display:flex; flex-direction:column; gap:var(--gap-sm); }
.kg-exam-editor-card > .kg-exam-flow-actions { padding:var(--pad-md); }

/* Editor sorting: lift the actual card, shift siblings into their future slots. */
.kg-exam-editor-card { transform:translate3d(var(--sort-x,0px),var(--sort-y,0px),0); touch-action:pan-y; }
.kg-exam-editor-grid { position:relative; }
.kg-exam-editor-grid[data-sorting="true"] { user-select:none; touch-action:none; }
.kg-exam-editor-grid[data-sorting="true"] > .kg-exam-editor-card { transition:transform 240ms cubic-bezier(0.22,1,0.36,1); will-change:transform; }
.kg-exam-editor-card[data-dragging="true"] { opacity:1; z-index:30; box-shadow:var(--shadow-lg); transition:none; cursor:grabbing; }
.kg-exam-editor-card[data-drop-target="true"] { outline:none; }
.kg-exam-editor-grid[data-sorting="true"]::after { content:""; position:absolute; z-index:31; left:var(--insert-left,0px); top:var(--insert-top,0px); height:var(--insert-height,0px); width:3px; opacity:var(--insert-visible,0); background:var(--semantic-fill-brand); border-radius:var(--radius-sm); pointer-events:none; }
.kg-exam-editor-grid[data-sorting="true"] > .kg-exam-editor-card[data-dragging="true"] { transition:none; }
.kg-exam-editor-grid[data-sorting="true"] .kg-exam-editor-card > .kg-exam-insert-slot { visibility:hidden; pointer-events:none; }
.kg-exam-card-menu { position:relative; margin-left:auto; }
.kg-exam-card-menu > summary { list-style:none; cursor:pointer; padding:var(--pad-sm) var(--pad-md); border-radius:var(--radius-md); background:var(--semantic-background-subtle); }
.kg-exam-card-menu > div { position:absolute; right:0; top:100%; z-index:40; display:flex; flex-direction:column; gap:var(--gap-xs); padding:var(--pad-sm); min-width:180px; background:var(--semantic-background-default); border:1px solid var(--border-default); border-radius:var(--radius-md); box-shadow:var(--shadow-dropdown); }
.kg-exam-insert-slot.btn { min-height:28px; margin-bottom:var(--pad-sm); }
.kg-exam-content-table { display:flex; flex-direction:column; gap:var(--gap-md); overflow:auto; }
.kg-exam-content-row { display:grid; grid-template-columns:80px 100px minmax(160px,1fr) minmax(100px,1fr) 100px 110px 36px; gap:var(--gap-sm); min-width:760px; padding-bottom:var(--pad-md); border-bottom:1px solid var(--border-default); }
.kg-exam-content-paste { width:100%; min-height:120px; padding:var(--pad-md); border:1px solid var(--border-default); border-radius:var(--radius-md); background:var(--semantic-background-default); color:var(--text-primary); font:inherit; resize:vertical; }
.kg-exam-content-paste:focus { outline:none; border-color:var(--border-focus); box-shadow:0 0 0 2px var(--base-blue-100); }
@media(prefers-reduced-motion:reduce) { .kg-exam-editor-grid[data-sorting="true"] > .kg-exam-editor-card { transition:none; } }
.kg-exam-editor[data-inserting="true"] .kg-exam-editor-card > .kg-exam-flow-actions { visibility:hidden; }
.kg-exam-editor[data-inserting="true"] .kg-exam-editor-delete { display:none; }
.kg-exam-editor-card .kg-exam-panel img,.kg-exam-output .kg-exam-panel img { max-width:100%; height:auto; }
.kg-exam-editor-card .kg-exam-panel { overflow-wrap:anywhere; }

/* Compact editing workspace; shared library cards retain their own sizing. */
.kg-exam-editor { gap:var(--space-100); padding:var(--pad-xl) var(--space-500); }
@media (max-width:1000px) { .kg-exam-editor { padding-inline:var(--space-250); } }
.kg-exam-editor-header { padding-bottom:var(--space-100); gap:var(--space-100); }
.kg-exam-editor-header .kg-exam-setup-field { flex-direction:row; }
.kg-exam-editor-header .kg-exam-setup-field > span { white-space:nowrap; }
.kg-exam-editor-header .bound-dropdown { width:112px; }
.kg-exam-editor-tools { gap:var(--space-100); padding-bottom:var(--space-100); }
.kg-exam-editor-tools > .kg-exam-row { flex:0 1 auto; gap:var(--space-100); }
.kg-exam-editor-more { position:relative; }
.kg-exam-editor-more > summary { list-style:none; white-space:nowrap; }
.kg-exam-editor-more > div { position:absolute; z-index:60; top:100%; right:0; width:240px; padding:var(--pad-md); display:flex; flex-direction:column; gap:var(--space-100); background:var(--semantic-background-default); border:1px solid var(--border-default); border-radius:var(--radius-md); box-shadow:var(--shadow-lg); }
.kg-exam-editor-options { display:flex; flex-direction:column; gap:var(--space-150); padding:var(--pad-md); border-top:1px solid var(--border-default); }
.kg-exam-editor-options .check { width:auto; }
.kg-exam-editor-grid { padding-top:var(--space-150); }
.kg-exam-editor-card .kg-library-problem-card { padding:var(--pad-md) var(--pad-md) var(--space-300); gap:var(--space-150); }
.kg-exam-editor-card .kg-library-problem-preview { height:224px; min-height:0; padding:var(--pad-md); }
.kg-exam-editor-card .kg-library-problem-meta { min-height:0; }
.kg-exam-editor-card .kg-library-problem-card[data-view-mode=both] { grid-template-rows:auto 224px auto auto; }
.kg-exam-editor-card .kg-my-exam-paired-solution { margin:0; padding:var(--pad-md); gap:var(--space-100); }
.kg-exam-editor-card .kg-my-exam-paired-solution > div { min-height:224px; max-height:320px; overflow:auto; padding:var(--pad-md); }
.kg-exam-editor-card > .kg-exam-flow-actions { position:absolute; left:var(--pad-md); right:var(--pad-md); bottom:var(--pad-md); background:var(--semantic-background-default); border-radius:var(--radius-md); padding:var(--pad-sm); opacity:0; pointer-events:none; }
.kg-exam-editor-card:hover > .kg-exam-flow-actions,.kg-exam-editor-card:focus-within > .kg-exam-flow-actions,.kg-exam-editor-card:has(details[open]) > .kg-exam-flow-actions { opacity:1; pointer-events:auto; }
.kg-exam-editor-card:has(details[open]) { z-index:40; }
.kg-exam-editor-card .kg-exam-editor-delete { opacity:1; pointer-events:auto; }
/* Insertion overlays the gutter without reserving space between cards. */
.kg-exam-editor-card > .kg-exam-insert-slot.btn { position:absolute; z-index:2; left:calc((var(--space-250) + 36px) / -2); top:0; display:flex; align-items:center; justify-content:center; width:36px; min-width:0; height:100%; margin:0; padding:0; opacity:1; background:transparent; border:0; box-shadow:none; }
.kg-exam-editor-card > .kg-exam-insert-slot::before { content:""; position:absolute; top:var(--space-150); bottom:var(--space-150); left:50%; width:2px; transform:translateX(-50%); background:var(--semantic-fill-brand); opacity:0; pointer-events:none; }
.kg-exam-editor-card > .kg-exam-insert-slot > span { position:relative; display:grid; place-items:center; flex:none; width:36px; height:36px; border-radius:var(--radius-full); font-size:28px; line-height:1; color:var(--text-inverse); background:var(--semantic-fill-brand); opacity:0; }
.kg-exam-editor-card > .kg-exam-insert-slot:hover::before,.kg-exam-editor-card > .kg-exam-insert-slot:focus-visible::before,.kg-exam-editor-card > .kg-exam-insert-slot:hover > span,.kg-exam-editor-card > .kg-exam-insert-slot:focus-visible > span { opacity:1; }
.kg-exam-editor-card:has(> .kg-exam-insert-slot:hover),.kg-exam-editor-card:has(> .kg-exam-insert-slot:focus-visible) { z-index:20; }
.kg-exam-editor-grid.kg-my-exam-question-grid { column-gap:var(--space-250); padding-inline:0; }
@media(hover:none) { .kg-exam-editor-card > .kg-exam-insert-slot > span { opacity:1; } }
.kg-exam-editor[data-inserting=true] .kg-exam-editor-grid { padding-top:var(--space-200); row-gap:var(--space-200); }
.kg-exam-editor[data-inserting=true] > .kg-exam-row { display:none; }
.kg-exam-insert-modal.modal { width:calc(100vw - 48px); max-width:1600px; height:calc(100dvh - 48px); max-height:calc(100dvh - 48px); display:flex; flex-direction:column; }
.kg-exam-insert-modal > .modal__body { flex:1; min-height:0; display:flex; flex-direction:column; gap:var(--space-150); overflow:hidden; }
.kg-exam-insert-modal > .modal__body > .kg-exam-row { flex:none; justify-content:flex-start; gap:var(--space-150); }
.kg-exam-insert-modal > .modal__body > .kg-exam-row .bound-dropdown { width:200px; }
.kg-exam-insert-workspace { flex:1; min-height:0; display:grid; grid-template-columns:280px minmax(0,1fr); gap:var(--space-200); }
.kg-exam-insert-workspace .kg-exam-search-panel { border:0; background:var(--semantic-background-subtle); border-radius:var(--radius-xl); padding:var(--pad-md); }
.kg-exam-insert-workspace .kg-exam-search-stack { gap:var(--space-200); }
.kg-exam-insert-workspace .kg-exam-search-panel h2,.kg-exam-insert-workspace .kg-exam-search-summary { display:none; }
.kg-exam-insert-results { min-width:0; overflow:auto; display:flex; flex-direction:column; gap:var(--space-150); }
.kg-exam-insert-results > .kg-exam-row { justify-content:flex-start; gap:var(--space-050); }
.kg-exam-insert-results > .kg-exam-row > .check { width:auto; flex:0 0 auto; }
.kg-exam-insert-results > .kg-exam-row > span { white-space:nowrap; }
.kg-exam-insert-results > .kg-exam-row > .check:last-child { margin-left:auto; }
.kg-library-problem-card-head > .check { width:auto; min-width:0; }
.kg-library-problem-kind { flex-shrink:0; white-space:nowrap; }
.kg-exam-insert-results > p { margin:auto; text-align:center; color:var(--text-secondary); }
.kg-exam-insert-results .kg-library-problem-grid { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); align-items:start; }
.kg-exam-insert-results .kg-library-problem-card { max-width:none; }
.kg-exam-insert-results .kg-library-problem-grid[data-mode=both] { grid-template-columns:minmax(0,1fr); }
.kg-exam-insert-modal .modal-backdrop { z-index:1100; }
.kg-exam-insert-modal .kg-library-problem-drawer { z-index:1201; }
.kg-exam-insert-modal .kg-library-problem-drawer-backdrop { z-index:1200; }
.kg-exam-insert-modal > .modal__body > .kg-exam-flow-actions { align-items:center; padding-top:var(--pad-md); border-top:1px solid var(--border-default); }
.kg-exam-insert-modal > .modal__body > .kg-exam-flow-actions > span { margin-right:auto; }
@media(hover:none) { .kg-exam-editor-card > .kg-exam-flow-actions { position:static; opacity:1; pointer-events:auto; } .kg-exam-editor-card .kg-exam-editor-delete { opacity:1; pointer-events:auto; } }
@media(max-width:760px) { .kg-exam-insert-modal.modal { width:calc(100vw - 24px); height:calc(100dvh - 24px); max-height:calc(100dvh - 24px); } .kg-exam-insert-workspace { grid-template-columns:220px minmax(0,1fr); gap:var(--space-100); } }
.kg-exam-editor[data-inserting=false] > .kg-exam-insert-slot { display:none; }
.kg-exam-editor[data-inserting=true] .kg-exam-editor-card > .kg-exam-flow-actions { display:none; }

.kg-exam-picker-modal.modal { width:calc(100vw - 64px); max-width:1600px; height:calc(100dvh - 64px); max-height:calc(100dvh - 64px); display:flex; flex-direction:column; }
.kg-exam-picker-modal > .modal__body { flex:1; min-height:0; display:flex; flex-direction:column; gap:var(--space-250); overflow:hidden; }
.kg-exam-picker-toolbar { display:flex; align-items:center; gap:var(--space-200); flex:none; }
.kg-exam-picker-toolbar > nav { flex:1; }
.kg-exam-picker-toolbar > .bound-dropdown { width:160px; }
.kg-exam-insert-results > .kg-exam-picker-toolbar { justify-content:flex-start; gap:var(--space-050); }
.kg-exam-insert-results > .kg-exam-picker-toolbar > .check { width:auto; flex:0 0 auto; }
.kg-exam-insert-results > .kg-exam-picker-toolbar > span { white-space:nowrap; }
.kg-exam-picker-workspace { display:grid; grid-template-columns:320px minmax(0,1fr); gap:var(--space-250); flex:1; min-height:0; }
.kg-exam-picker-source { overflow:auto; padding:var(--space-250); background:var(--semantic-background-subtle); border-radius:var(--radius-xl); display:flex; flex-direction:column; gap:var(--space-200); }
.kg-exam-picker-source h3,.kg-exam-picker-source p { margin:0; }
.kg-exam-picker-source .kg-math { padding:var(--space-200); background:var(--semantic-background-default); border-radius:var(--radius-md); }
.kg-exam-picker-source dl { display:grid; grid-template-columns:1fr 1fr; gap:var(--space-150); margin:0; }
.kg-exam-picker-source dd { margin:0; }
.kg-exam-picker-workspace .kg-exam-search-panel { border:0; min-height:0; overflow:auto; border-radius:var(--radius-xl); background:var(--semantic-background-subtle); }
.kg-exam-picker-workspace .kg-library-problem-grid { grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); align-items:start; }
.kg-exam-picker-workspace .kg-library-problem-grid[data-mode=both] { grid-template-columns:minmax(0,1fr); }
.kg-exam-picker-candidate { position:relative; min-width:0; }
.kg-exam-picker-candidate .kg-library-problem-card { max-width:none; }

.kg-exam-picker-candidate > span { display:block; padding:var(--space-100); color:var(--text-secondary); }
.kg-exam-picker-footer { display:flex; align-items:center; justify-content:flex-end; gap:var(--space-100); border-top:1px solid var(--border-default); padding-top:var(--space-200); flex:none; }
.kg-exam-picker-footer > span { margin-right:auto; }
.kg-exam-picker-modal .modal-backdrop { z-index:1100; }
.kg-exam-picker-modal .kg-library-problem-drawer { z-index:1201; }
.kg-exam-picker-modal .kg-library-problem-drawer-backdrop { z-index:1200; }
@media(max-width:900px) { .kg-exam-picker-workspace { grid-template-columns:250px minmax(0,1fr); } .kg-exam-picker-toolbar { flex-wrap:wrap; } }
.kg-exam-picker-workspace .kg-library-problem-grid { grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); }
.kg-exam-picker-workspace .kg-library-problem-card-head > span { white-space:nowrap; flex-shrink:0; }
.kg-exam-picker-source h3 { font-size:var(--font-size-lg,18px); }
.kg-exam-paper-preview { min-width:0; display:flex; flex-direction:column; gap:var(--space-250); padding:var(--space-250); background:var(--semantic-background-subtle); border-radius:var(--radius-xl); }
.kg-exam-paper-summary h2,.kg-exam-paper-summary p { margin:0 0 var(--space-100); }
.kg-exam-paper-summary small { color:var(--text-secondary); }
.kg-exam-paper-sheet { container-type:inline-size; position:relative; width:100%; aspect-ratio:210 / 297; box-sizing:border-box; margin:0; background:var(--semantic-background-default); border:1px solid var(--border-default); box-shadow:var(--shadow-sm); }
.kg-exam-paper-sheet[data-paper=B4] { aspect-ratio:257 / 364; }
.kg-exam-paper-sheet > header { position:absolute; top:4%; left:7.6%; right:7.6%; display:flex; justify-content:space-between; font-size:2cqw; min-height:3%; border-bottom:1px solid var(--border-default); }
.kg-exam-paper-columns { position:absolute; top:10%; left:7.6%; right:7.6%; bottom:7%; display:flex; gap:3.8%; }
.kg-exam-paper-columns > div { flex:1; min-width:0; }
.kg-exam-paper-block { padding-bottom:12%; }
.kg-exam-paper-sheet .kg-math { font-size:1.75cqw; line-height:1.65; white-space:pre-wrap; overflow-wrap:anywhere; margin:0; }
.kg-exam-paper-sheet[data-paper=B4] .kg-math { font-size:1.43cqw; }
.kg-exam-paper-sheet .kg-exam-panel { padding:4%; font-size:1.75cqw; }
.kg-exam-paper-sheet img { max-width:100%; max-height:18cqw; object-fit:contain; }
.kg-exam-paper-sheet > figcaption { position:absolute; bottom:3%; left:0; right:0; text-align:center; font-size:1.8cqw; color:var(--text-secondary); }
.kg-exam-paper-block { padding-bottom:0; box-sizing:border-box; }
.kg-exam-paper-preview { height:calc(100dvh - 220px); min-height:360px; box-sizing:border-box; gap:var(--space-150); position:sticky; top:0; }
.kg-exam-paper-summary { flex:none; }
.kg-exam-paper-summary h2 { font-size:18px; }
.kg-exam-paper-viewport { flex:1; min-height:0; container-type:size; display:flex; align-items:center; justify-content:center; }
.kg-exam-paper-viewport > .kg-exam-paper-sheet { flex:none; width:min(100cqw,calc(100cqh * 210 / 297)); }
.kg-exam-paper-viewport > .kg-exam-paper-sheet[data-paper=B4] { width:min(100cqw,calc(100cqh * 257 / 364)); }
.kg-exam-paper-paging { flex:none; display:flex; align-items:center; justify-content:center; gap:var(--space-150); }
.kg-exam-paper-paging .bound-dropdown { width:180px; }
.kg-exam-include-row { display:flex; flex-wrap:wrap; align-items:center; gap:var(--space-250); }
.kg-exam-paper-preview { padding:0; background:transparent; border-radius:0; }
.kg-exam-complete { flex:1; display:flex; align-items:center; justify-content:center; padding:var(--space-400); background:var(--semantic-background-default); min-height:480px; }
.kg-exam-complete-content { width:min(100%,640px); display:flex; flex-direction:column; align-items:center; gap:var(--space-300); text-align:center; }
.kg-exam-complete-content h2 { margin:var(--space-300) 0 0; font-size:clamp(24px,2.5vw,36px); line-height:1.4; color:var(--text-primary); }
.kg-exam-complete-content p { margin:0 0 var(--space-300); color:var(--text-secondary); font-size:18px; overflow-wrap:anywhere; }
.kg-exam-complete-content > .btn { width:100%; }

/* @sync ExamVariantRequestSpec: compact title action, modal above nested drawers. */
.kg-library-problem-drawer-title { display:flex; align-items:center; gap:var(--space-150); }
.kg-exam-variant-overlay { position:fixed; inset:0; z-index:1300; }
.kg-exam-variant-modal { max-height:calc(100dvh - 2 * var(--pad-lg)); overflow-y:auto; }
.kg-exam-variant-modal .kg-exam-flow-stack p { margin:0; }
.kg-exam-variant-modal .kg-exam-row { justify-content:space-between; }

.kg-library-problem-detail-head { display:flex; align-items:center; justify-content:space-between; gap:var(--space-150); }
.kg-exam-variant-modal h3 { margin:0; font-size:var(--text-style-label-medium-font-size); font-weight:var(--text-style-weight-bold); line-height:var(--text-style-label-line-height); }
.kg-exam-variant-modal [data-text-style="Caption/Medium-Regular"] { color:var(--text-subtle); }
/* Figma 970:10667 — compact validation notice. */
.kg-exam-variant-validation {
  display:flex; align-items:center; justify-content:center; align-self:flex-start;
  gap:var(--gap-xs); padding:var(--space-050) var(--pad-sm);
  border-radius:var(--radius-xs);
  background:var(--semantic-status-danger-soft-fill); color:var(--semantic-text-danger);
  font-family:var(--font-body); font-size:var(--text-style-caption-medium-font-size);
  font-weight:var(--text-style-weight-regular); line-height:var(--text-style-caption-line-height);
  letter-spacing:-0.008em;
}
.kg-exam-variant-validation img { flex:none; }
