/*!*************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[3]!./app/globals.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************/
html,
body {
  margin: 0;
  padding: 0;
  font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Noto Sans KR", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(199, 239, 87, 0.18), transparent 28rem),
    linear-gradient(135deg, #101510 0%, #1d271d 58%, #080b08 100%);
  color: #f1f0e8;
}

* {
  box-sizing: border-box;
}

/* CAD UX. viewport-fit chain. html/body가 100vh를 차지하고 그 안 main/workflow/workspace-grid가 flex column으로
   남은 공간을 자식에게 정확히 분배한다. 페이지 전체에서 스크롤이 발생하지 않고 한 화면 안에 모든 영역 fit. */
html,
body {
  height: 100vh;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

header,
main,
footer {
  margin: 0;
  max-width: none;
  padding: 0.85rem 1.4rem;
}

/* CAD UX. main은 좌우 padding만 유지하고 위아래는 제거해 캔버스 영역이 viewport에 정확히 fit. */
main {
  padding-block: 0;
}

/* CAD UX. header를 가장 작게 — title + features link + WS/Locale 한 줄(약 36px). */
header {
  padding-block: 0.3rem;
}

header h1 {
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  max-width: none;
}

/* footer thin row — 한 줄 텍스트만 표시. status bar와 함께 두 줄 정보 영역. */
footer {
  padding-block: 0.25rem;
  font-size: 0.72rem;
  color: rgba(185, 199, 170, 0.7);
}

.app-header-row {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

/* 헤더 한 줄 통합(canvas-maximize P5) — 페이지 툴바가 포털로 꽂히는 가운데 영역.
   좌(타이틀)/중(도구)/우(계정·워크스페이스·언어)를 구분선으로 분리한다. */
.app-header-toolbar {
  flex: 1 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.app-header-toolbar:not(:empty) {
  border-inline: 1px solid rgba(255, 255, 255, 0.12);
  padding-inline: 0.9rem;
  margin-inline: 0.25rem;
}

/* 헤더 안에서는 툴바의 자체 박스 스타일을 제거해 한 줄 높이에 맞춘다. */
.app-header-toolbar .top-toolbar {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0;
}

/* 툴바 풀다운 메뉴가 헤더 아래(캔버스 위)로 떠야 하므로 헤더를 쌓임 문맥 위쪽에 둔다. */
header {
  position: relative;
  z-index: 30;
}

.app-header-controls {
  align-items: center;
  display: flex;
  gap: 0.85rem;
}

.workspace-selector {
  align-items: center;
  display: inline-flex;
  font-size: 0.8rem;
  gap: 0.5rem;
}

.workspace-user {
  color: #b9c7aa;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-selector select {
  background: #17200f;
  border: 1px solid rgba(218, 255, 139, 0.32);
  border-radius: 999px;
  color: #f1f0e8;
  cursor: pointer;
  font: inherit;
  padding: 0.3rem 0.65rem;
}

/* 워크스페이스 커스텀 드롭다운 — 행마다 [선택] + [붉은 삭제]. 텍스트가 길어 폭을 넓게. */
.workspace-dropdown {
  min-width: 18rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.3rem;
}

/* 기업체(테넌트)별 영역을 구분선으로 나눈다 — 둘째 그룹부터 상단 경계선. */
.workspace-dropdown__group + .workspace-dropdown__group {
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(218, 255, 139, 0.18);
}

/* 기업체(테넌트) 아코디언 헤더 — 클릭 시 워크스페이스 목록 펼침/접힘. */
.workspace-dropdown__tenant {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #d8e3c8;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  text-align: left;
}

.workspace-dropdown__tenant:hover {
  background: rgba(218, 255, 139, 0.1);
}

.workspace-dropdown__caret {
  flex: 0 0 auto;
  width: 0.8rem;
  color: #b9c7aa;
  font-size: 0.7rem;
}

.workspace-dropdown__tenant-name {
  flex: 1 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 기업체 옆 워크스페이스 총개수 배지. */
.workspace-dropdown__count {
  flex: 0 0 auto;
  min-width: 1.4rem;
  text-align: center;
  background: rgba(218, 255, 139, 0.16);
  color: #dafe8b;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
}

/* 펼쳐진 워크스페이스 행은 화살표 폭만큼 들여쓴다. */
.workspace-dropdown__row,
.workspace-dropdown__empty {
  margin-left: 0.6rem;
}

.workspace-dropdown__row {
  display: flex;
  align-items: stretch;
  gap: 0.25rem;
}

.workspace-dropdown__select {
  flex: 1 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #f1f0e8;
  cursor: pointer;
  font: inherit;
  padding: 0.4rem 0.55rem;
  overflow-wrap: anywhere;
}

.workspace-dropdown__select:hover,
.workspace-dropdown__select.is-active {
  background: rgba(218, 255, 139, 0.14);
}

.workspace-dropdown__delete {
  flex: 0 0 auto;
  width: 1.9rem;
  border: 1px solid rgba(255, 120, 110, 0.4);
  border-radius: 8px;
  background: transparent;
  color: #ff7a6e;
  cursor: pointer;
  font-weight: 700;
}

.workspace-dropdown__delete:hover {
  background: rgba(255, 120, 110, 0.18);
}

.workspace-dropdown__delete-icon {
  width: 15px;
  height: 15px;
  display: block;
  margin: 0 auto;
}

.workspace-dropdown__empty {
  color: #8a978a;
  font-size: 0.78rem;
  padding: 0.3rem 0.55rem;
}

.workspace-create {
  align-items: center;
  background: #dafe8b;
  border-radius: 999px;
  color: #17200f;
  display: inline-flex;
  font-weight: 700;
  height: 26px;
  justify-content: center;
  text-decoration: none;
  width: 26px;
}

.workspace-create:hover {
  background: #c8f06a;
}

.workspace-logout {
  background: transparent;
  border: 1px solid rgba(218, 255, 139, 0.32);
  border-radius: 999px;
  color: #f1f0e8;
  cursor: pointer;
  font: inherit;
  padding: 0.3rem 0.7rem;
}

.workspace-logout:hover {
  background: rgba(218, 255, 139, 0.18);
}

/* 로그아웃 확인 모달 — 화면 전체를 덮는 오버레이 위에 카드 형태로 띄운다. */
.logout-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 6, 0.62);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}

.logout-confirm-card {
  background: #121712;
  border: 1px solid rgba(218, 255, 139, 0.24);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: #f1f0e8;
  max-width: 320px;
  padding: 1.5rem 1.5rem 1.25rem;
  width: calc(100% - 2.5rem);
}

.logout-confirm-message {
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 0 0 1.25rem;
  text-align: center;
}

.logout-confirm-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.logout-confirm-cancel,
.logout-confirm-yes {
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  padding: 0.45rem 1.1rem;
}

.logout-confirm-cancel {
  background: transparent;
  border: 1px solid rgba(241, 240, 232, 0.3);
  color: #f1f0e8;
}

.logout-confirm-cancel:hover {
  background: rgba(241, 240, 232, 0.12);
}

.logout-confirm-yes {
  background: #daff8b;
  border: 1px solid #daff8b;
  color: #1a2208;
  font-weight: 600;
}

.logout-confirm-yes:hover {
  background: #c9f06f;
}

/* 로그인 화면 — 타이틀 이미지를 화면 전체 배경으로 깔고 그 위에 로그인 팝업을 띄운다. */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: auto;
  background-color: #0a0e0a; /* 베이스 검정 — 이미지 가장자리가 이 색으로 페이드아웃된다. */
}

/* 타이틀 이미지 레이어 — contain으로 전체 표시하되, radial 마스크로 가장자리를 투명하게 페이드아웃해
   테두리 경계선이 검정 배경으로 부드럽게 사라지게 한다(블랙 스모그). */
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("/title.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 78% 82% at 50% 50%, #000 46%, rgba(0, 0, 0, 0) 100%);
  mask-image: radial-gradient(ellipse 78% 82% at 50% 50%, #000 46%, rgba(0, 0, 0, 0) 100%);
}

/* 팝업 가독성을 위한 어둠 막(이미지 레이어 위). */
.login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(2, 6, 23, 0.45);
}

/* 로그인 화면 우상단 언어 전환기 — 풀스크린 오버레이가 헤더를 가리므로 여기서 제공. */
.login-locale-switcher {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  z-index: 2; /* scrim 위로 */
}

.login-page {
  position: relative; /* scrim 위로 */
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(218, 255, 139, 0.28);
  border-radius: 22px;
  padding: 2rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}

/* AltsCodex DeOAuth 로그인 primary 버튼 */
.altscodex-login-button {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
  background: #dafe8b;
  color: #17200f;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.altscodex-login-button:not(:disabled):hover {
  filter: brightness(0.95);
}

.altscodex-login-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login-page h2 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

.login-error {
  color: #ff9eb1;
  font-size: 0.85rem;
  margin: 0;
}

.locale-switcher {
  align-items: center;
  display: inline-flex;
  font-size: 0.8rem;
  gap: 0.5rem;
}

.locale-switcher-label {
  color: #b9c7aa;
  font-weight: 600;
  font-size: 0.8rem;
}

.locale-switcher select {
  background: #17200f;
  border: 1px solid rgba(218, 255, 139, 0.32);
  border-radius: 999px;
  color: #f1f0e8;
  cursor: pointer;
  font: inherit;
  padding: 0.3rem 0.65rem;
}

footer {
  color: #b9c7aa;
  font-size: 0.9rem;
}

button,
input {
  font: inherit;
}

.workflow {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1 1;
  min-height: 0;
  padding-block: 0.35rem;
}

.hero-panel,
.panel {
  background: rgba(238, 236, 218, 0.08);
  border: 1px solid rgba(218, 255, 139, 0.2);
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

.hero-panel {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.45rem 0.9rem;
  /* CAD UX. snapshot 노출 race condition 또는 첫 진입 시에도 hero-panel이 캔버스 영역을 거대하게
     점유하지 못하도록 명시적 상한 + 내부 스크롤. */
  max-height: 30vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.hero-panel h2 {
  font-size: 1rem;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 0;
}

.hero-panel .eyebrow {
  color: rgba(218, 254, 139, 0.78);
  margin: 0 0 0.25rem;
}

.hero-panel > p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0.35rem 0 0.6rem;
  max-width: 56ch;
}

.eyebrow {
  color: #dafe8b;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-line {
  /* CAD UX. 세로 플렉스(.workflow) 안에서 flex:1 이면 한 줄 텍스트가 캔버스 영역의 절반을
     세로로 잡아먹는다. 자연 높이만 차지하도록 flex 성장 금지. */
  flex: 0 0 auto;
  font-size: 0.82rem;
  color: rgba(218, 254, 139, 0.92);
  margin: 0;
  text-align: right;
}

.upload-card {
  align-items: center;
  background: #dafe8b;
  border-radius: 999px;
  color: #17200f;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  gap: 0.65rem;
  margin: 0;
  padding: 0.45rem 0.75rem;
}

.upload-card span {
  font-size: 0.8rem;
}

.upload-card input {
  max-width: 14rem;
}

.pending-files {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  font-size: 0.78rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
}

.pending-files-count {
  color: #dafe8b;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.pending-files-list {
  color: #b9c7aa;
  display: grid;
  grid-gap: 0.15rem;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  max-height: 6rem;
  overflow-y: auto;
  padding: 0;
}

.load-button {
  background: #dafe8b;
  border: 0;
  border-radius: 12px;
  color: #17200f;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

.load-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.load-button-spinner {
  animation: stencil-spin 0.8s linear infinite;
  border: 2px solid rgba(23, 32, 15, 0.3);
  border-radius: 50%;
  border-top-color: #17200f;
  display: inline-block;
  height: 14px;
  margin-right: 0.45rem;
  vertical-align: -3px;
  width: 14px;
}

@keyframes stencil-spin {
  to { transform: rotate(360deg); }
}

.processing-bar {
  background: rgba(218, 255, 139, 0.12);
  border-radius: 6px;
  flex-basis: 100%;
  height: 16px;
  overflow: hidden;
  position: relative;
  margin-top: 0.4rem;
}

.processing-bar-fill {
  background: linear-gradient(90deg, #b6e35a, #dafe8b);
  height: 100%;
  transition: width 220ms ease-out;
  border-radius: 6px;
}

.processing-bar-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.72rem;
  font-weight: 700;
  color: #17200f;
  pointer-events: none;
}

.load-warning {
  align-items: center;
  background: rgba(255, 158, 177, 0.12);
  border: 1px solid rgba(255, 158, 177, 0.45);
  border-radius: 10px;
  color: #ff9eb1;
  display: flex;
  flex-basis: 100%;
  font-size: 0.9rem;
  font-weight: 600;
  gap: 0.5rem;
  margin: 0;
  padding: 0.55rem 0.85rem;
}

.load-warning-link {
  background: #dafe8b;
  border-radius: 999px;
  color: #17200f;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  text-decoration: none;
  white-space: nowrap;
}

.load-warning-link:hover {
  background: #c8f06a;
}

.onboarding-page {
  background: rgba(238, 236, 218, 0.08);
  border: 1px solid rgba(218, 255, 139, 0.2);
  border-radius: 22px;
  margin: 2rem auto;
  max-width: 32rem;
  padding: 2rem;
  /* main이 overflow:hidden(CAD 캔버스 viewport-fit)이라, 카드가 화면보다 크면 하단(제출 버튼)이
     잘리고 페이지 스크롤도 안 됐다. 부모 높이에 맞춰 카드 자체가 내부 스크롤하도록 한다. */
  max-height: calc(100% - 4rem);
  overflow-y: auto;
}

.onboarding-page h2 {
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
}

.onboarding-note {
  color: #b9c7aa;
  font-size: 0.85rem;
  margin: 0 0 1.5rem;
}

.onboarding-form {
  display: grid;
  grid-gap: 1.25rem;
  gap: 1.25rem;
}

.onboarding-form fieldset {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  display: grid;
  grid-gap: 0.95rem;
  gap: 0.95rem;
  padding: 1.1rem 1.15rem;
}

.onboarding-form legend {
  color: #dafe8b;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0 0.5rem;
}

.onboarding-section-help {
  color: #b9c7aa;
  font-size: 0.8rem;
  margin: 0 0 0.25rem;
}

.onboarding-field {
  display: grid;
  grid-gap: 0.3rem;
  gap: 0.3rem;
}

.onboarding-label {
  color: #f1f0e8;
  font-size: 0.85rem;
  font-weight: 600;
}

.onboarding-hint {
  color: #b9c7aa;
  font-size: 0.72rem;
  line-height: 1.4;
}

.onboarding-form label {
  display: grid;
  font-size: 0.85rem;
  grid-gap: 0.35rem;
  gap: 0.35rem;
}

.onboarding-form input {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: #f1f0e8;
  font: inherit;
  padding: 0.6rem 0.85rem;
}

.onboarding-form button {
  background: #dafe8b;
  border: 0;
  border-radius: 999px;
  color: #17200f;
  cursor: pointer;
  font-weight: 700;
  padding: 0.7rem 1rem;
}

.onboarding-form button[disabled] {
  cursor: not-allowed;
  opacity: 0.6;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* 취소는 보조 액션 — 주 액션(녹색 채움 '만들고 시작하기')과 위계를 두려 외곽선 스타일로. */
.onboarding-form .onboarding-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #cdd6c2;
  font-weight: 600;
}

.onboarding-error {
  color: #ff9eb1;
  font-size: 0.85rem;
  margin: 0;
}

.workspace-grid {
  display: grid;
  grid-gap: 0.75rem;
  gap: 0.75rem;
  grid-template-columns: 320px minmax(0, 1fr) 320px 320px;
  transition: grid-template-columns 320ms ease;
  flex: 1 1;
  min-height: 0;
  overflow: hidden;
}

.panel--collapsed {
  padding: 0;
  margin: 0;
  border: none;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  min-width: 0;
  overflow: hidden;
  transition: opacity 200ms ease, padding 320ms ease, visibility 0s linear 320ms;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.panel-header h3 {
  margin: 0;
  /* 전역 h3 규칙이 없어 기본(~1.17em)으로 커져 좁은 패널에서 닫기 버튼과 겹친다.
     크기를 줄이고 min-width:0로 flex 안에서 줄어들게 해 겹침을 막는다. */
  font-size: 0.95rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.panel-close {
  width: 26px;
  height: 26px;
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(203, 213, 245, 0.3);
  border-radius: 6px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.panel-close:hover {
  background: rgba(218, 254, 139, 0.1);
  border-color: #dafe8b;
  color: #dafe8b;
}

.canvas-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.canvas-panel-toggles {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.panel-open-button {
  background: transparent;
  color: #dafe8b;
  border: 1px solid rgba(218, 254, 139, 0.55);
  border-radius: 6px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.panel-open-button:hover {
  background: rgba(218, 254, 139, 0.1);
}

.dock-icon-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.2rem;
  min-width: 0;
}

.dock-icon-button {
  width: 32px;
  height: 32px;
  background: transparent;
  color: #dafe8b;
  border: 1px solid rgba(218, 254, 139, 0.55);
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.dock-icon-button:hover {
  background: rgba(218, 254, 139, 0.12);
}

.dock-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* 우측 그리드 열 래퍼 — 자동 추출 컨트롤 스트립 + 도크를 세로로 쌓는다(스트립 고정, 도크가 잔여 높이). */
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.right-rail > .dock-shell,
.right-rail > .dock-icon-rail {
  flex: 1 1;
  min-height: 0;
}

/* 우측 레일용 마스크 유도 배너 — 좁은 폭이라 세로 적층(canvas-maximize P2 완전 이동). */
.mask-derived-banner--rail {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.mask-derived-banner--rail .mask-derived-banner__ack {
  margin-left: 0;
}

/* 검수 현황 카드 — 캔버스 상단에서 이동한 트리아지+검토 큐(canvas-maximize P1). */
.review-status-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 0 0 auto;
}

/* 우측 레일에 카드가 늘어나도 전체가 화면을 넘지 않게 세로 스크롤을 허용한다. */
.right-rail {
  overflow-y: auto;
  min-height: 0;
}

/* 자동 추출 명령 전용 컨트롤 스트립(우측 상단). 캔버스 헤더에서 이동해 캔버스 영역을 세로로 넓힌다. */
.auto-extract-strip {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  flex: 0 0 auto;
}

.auto-extract-strip .auto-extract-button {
  width: 100%;
}

/* 실행 버튼 + "i" 정보 버튼 한 행. 실행 버튼이 남는 폭을 모두 차지한다. */
.auto-extract-run-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.auto-extract-run-row .auto-extract-button {
  flex: 1 1;
  width: auto;
}

.auto-extract-info-button {
  flex: 0 0 auto;
  width: 1.7rem;
  border-radius: 8px;
  border: 1px solid rgba(218, 254, 139, 0.45);
  background: transparent;
  color: #dafe8b;
  font-style: italic;
  font-weight: 700;
  cursor: pointer;
}

.auto-extract-info-button:hover {
  background: rgba(218, 254, 139, 0.15);
}

/* "검사·스텐실 룰 적용" 설명 모달 — 두께 모달과 동일 톤. */
.auto-extract-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.auto-extract-info-card {
  background: #1b2410;
  border: 1px solid rgba(218, 254, 139, 0.35);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  width: min(460px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.auto-extract-info-title {
  font-weight: 700;
  color: #dafe8b;
}

.auto-extract-info-intro,
.auto-extract-info-note {
  font-size: 0.85rem;
  line-height: 1.5;
}

.auto-extract-info-note {
  color: #ffe28a;
}

.auto-extract-info-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.auto-extract-info-actions {
  display: flex;
  justify-content: flex-end;
}

.auto-extract-info-close {
  border: 1px solid rgba(218, 254, 139, 0.45);
  border-radius: 8px;
  background: rgba(218, 254, 139, 0.12);
  color: #dafe8b;
  padding: 0.35rem 1rem;
  cursor: pointer;
}

/* 레이어 타입 충돌 모달 — 경고(앰버) 톤으로 정보 모달과 구분. */
.layer-conflict-overlay {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.layer-conflict-card {
  background: #241c10;
  border: 1px solid rgba(255, 200, 90, 0.4);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  width: min(500px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.layer-conflict-title {
  font-weight: 700;
  color: #ffc85a;
}

.layer-conflict-intro,
.layer-conflict-note {
  font-size: 0.85rem;
  line-height: 1.5;
}

.layer-conflict-note {
  color: #ffe28a;
}

.layer-conflict-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.layer-conflict-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(255, 200, 90, 0.25);
  border-radius: 8px;
  font-size: 0.85rem;
}

.layer-conflict-type {
  font-weight: 600;
}

.layer-conflict-files {
  color: #cdd6c2;
}

.layer-conflict-actions {
  display: flex;
  justify-content: flex-end;
}

.layer-conflict-close {
  border: 1px solid rgba(255, 200, 90, 0.45);
  border-radius: 8px;
  background: rgba(255, 200, 90, 0.12);
  color: #ffc85a;
  padding: 0.35rem 1rem;
  cursor: pointer;
}

.dock-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.dock-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.dock-panel-title {
  margin: 0;
  font-size: 1rem;
  color: #f3fff0;
}

.dock-panel-close {
  width: 26px;
  height: 26px;
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(203, 213, 245, 0.3);
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.dock-panel-close:hover {
  background: rgba(218, 254, 139, 0.1);
  border-color: #dafe8b;
  color: #dafe8b;
}

.dock-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  min-height: 0;
}

.dock-tabs {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  /* 자동 추출 컨트롤이 별도 탭으로 빠진 뒤, 도크가 우측 레일의 잔여 높이를 실제로 채우도록 성장시킨다.
     dock-tabs-body(flex:1, overflow-y:auto)가 이 높이 안에서 세로 스크롤을 담당한다. */
  flex: 1 1;
}

/* 룰 적용 탭 콘텐츠 — 자동 추출 컨트롤(설정 박스) + 파이프라인 진행바를 세로로 적층한다. */
.dock-right-controls {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}

.dock-tabs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dock-tabs-buttons {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.dock-tab-button {
  background: transparent;
  color: #cbd5f5;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.dock-tab-button:hover {
  color: #dafe8b;
  border-color: rgba(218, 254, 139, 0.35);
}

.dock-tab-button.is-active {
  color: #dafe8b;
  background: rgba(218, 254, 139, 0.12);
  border-color: rgba(218, 254, 139, 0.55);
}

.dock-tabs-close {
  width: 26px;
  height: 26px;
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(203, 213, 245, 0.3);
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.dock-tabs-close:hover {
  background: rgba(218, 254, 139, 0.1);
  border-color: #dafe8b;
  color: #dafe8b;
}

.dock-tabs-body {
  display: flex;
  flex-direction: column;
  padding: 0.9rem;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1;
}

.dock-tabpanel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
}

/* 비활성 탭은 hidden 속성으로 숨긴다. display:flex가 [hidden]의 기본 display:none을 덮어쓰므로
   명시적으로 다시 숨겨야 한다(안 그러면 모든 탭이 동시에 쌓여 박스가 겹친다). */
.dock-tabpanel[hidden] {
  display: none;
}

.top-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  margin-bottom: 0.6rem;
}

.top-toolbar-section {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pulldown {
  position: relative;
  display: inline-block;
}

.pulldown-trigger {
  background: transparent;
  color: #dafe8b;
  border: 1px solid rgba(218, 254, 139, 0.55);
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pulldown-trigger:hover,
.pulldown-trigger.is-open {
  background: rgba(218, 254, 139, 0.12);
}

.pulldown-caret {
  font-size: 0.7rem;
  opacity: 0.7;
}

.pulldown-panel {
  position: absolute;
  top: calc(100% + 4px);
  z-index: 600;
  min-width: 220px;
  background: #0c110c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.55rem;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

.pulldown-panel--left {
  left: 0;
}

.pulldown-panel--right {
  right: 0;
}

.pulldown-empty {
  color: #b9c7aa;
  font-size: 0.85rem;
  margin: 0;
  padding: 0.6rem 0.4rem;
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}

.export-pulldown-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 260px;
}

/* CAD 어플리케이션 하단 status bar. 마우스 좌표·줌·units·두께를 thin row에 노출. */
.status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.35rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  color: #b9c7aa;
  flex-shrink: 0;
}

.status-bar-segment {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.status-bar-label {
  color: #7f9072;
  text-transform: lowercase;
}

/* CAD UX. WorkflowStepper compact 모드 — status bar 좌측에 inline dots + 활성 step 라벨. */
.workflow-stepper-compact {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.workflow-step-compact {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  line-height: 1;
}

.workflow-step-compact-dot {
  color: rgba(218, 254, 139, 0.25);
  font-size: 0.7rem;
}

.workflow-step-compact[data-state="active"] .workflow-step-compact-dot {
  color: #dafe8b;
  font-size: 0.85rem;
}

.workflow-step-compact[data-state="done"] .workflow-step-compact-dot {
  color: rgba(218, 254, 139, 0.7);
}

.workflow-step-compact-active-label {
  margin-left: 0.4rem;
  color: #dafe8b;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.panel {
  min-width: 0;
  padding: 1.1rem;
}

.panel h3 {
  margin: 0 0 0.85rem;
}

.panel ul {
  display: grid;
  grid-gap: 0.65rem;
  gap: 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.panel li,
.recommendation-card,
.edit-controls {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 0.8rem;
  margin: 1rem 0 0;
  min-width: 0;
}

/* fieldset에 display:grid/flex를 주면 일부 브라우저에서 <legend>가 첫 행과 겹친다(Chromium 버그).
   기본 block 레이아웃을 쓰고 자식 간격은 margin으로 준다. */
.edit-controls > * + * {
  margin-top: 0.75rem;
}

.edit-controls legend {
  font-weight: 600;
  padding: 0;
}

.panel li span,
.recommendation-card span,
.opening small {
  color: #b9c7aa;
  display: block;
  font-size: 0.85rem;
}

.canvas-panel {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 0;
  overflow: hidden;
  /* 페어 리스트 패널(absolute)의 기준 컨테이너 — 내부 기존 absolute는 canvas-stage(relative) 기준이라 영향 없음. */
  position: relative;
}

/* 아이콘 툴바 — 캔버스 컨테이너의 좌/우 플렉스 형제(좌=화면·보기·히스토리, 우=편집).
   DOM 순서상 좌측 레일 → 캔버스 → 우측 레일이라 우측 레일은 오른쪽에 놓인다. 캔버스/룰러 좌표계 영향 0. */
.canvas-stage-wrap {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
  flex: 1 1;
  min-height: 0;
}

.canvas-tool-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.35rem;
  background: rgba(9, 13, 6, 0.72);
  border: 1px solid rgba(218, 255, 139, 0.18);
  border-radius: 10px;
  align-self: flex-start;
  /* overflow 금지: 툴팁이 레일 내부에서 옆으로 튀어나오므로 overflow-y:auto 백스톱은
     툴팁을 클리핑한다(overflow-x도 auto로 계산됨). 스크롤 백스톱 재도입은 포털 툴팁 전환이 선행 조건. */
}

.canvas-tool-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.canvas-tool-divider {
  width: 60%;
  height: 1px;
  margin: 0.15rem 0;
  background: rgba(218, 255, 139, 0.18);
}

.canvas-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: #17200f;
  border: 1px solid rgba(218, 255, 139, 0.32);
  border-radius: 8px;
  color: #f1f0e8;
  cursor: pointer;
}

.canvas-tool-btn:hover {
  background: rgba(218, 255, 139, 0.18);
}

.canvas-tool-btn:focus-visible {
  outline: 2px solid #dafe8b;
  outline-offset: 1px;
}

/* 활성 도구 라임 하이라이트(기존 액센트 어휘). */
.canvas-tool-btn.is-active {
  background: rgba(218, 254, 139, 0.16);
  border-color: #dafe8b;
  color: #dafe8b;
}

.canvas-tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.canvas-tool-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}

.canvas-stage {
  display: grid;
  /* 툴바(auto) + 캔버스(남는 높이). flex column 부모 안에서 자라고 줄어들어, 하단 패널이 잘리지 않게. */
  grid-template-rows: auto minmax(0, 1fr);
  grid-gap: 0.45rem;
  gap: 0.45rem;
  position: relative;
  flex: 1 1;
  min-height: 0;
}

/* 옵션 바 행이 있을 때: 표시 스트립(auto) + 옵션 바(auto) + 캔버스(1fr). 뷰포트는 그대로 1fr 행. */
.canvas-stage.has-options {
  grid-template-rows: auto auto minmax(0, 1fr);
}

/* 대용량 캔버스 렌더 준비 동안 캔버스 위에 띄우는 로딩 오버레이 */
.canvas-rendering-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: rgba(8, 10, 14, 0.6);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: none;
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}

.canvas-rendering-spinner {
  animation: stencil-spin 0.8s linear infinite;
  border: 3px solid rgba(218, 254, 139, 0.25);
  border-top-color: #dafe8b;
  border-radius: 50%;
  display: inline-block;
  width: 22px;
  height: 22px;
}

.canvas-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  gap: 0.5rem;
}

.canvas-toolbar button {
  background: #17200f;
  border: 1px solid rgba(218, 255, 139, 0.32);
  border-radius: 999px;
  color: #f1f0e8;
  cursor: pointer;
  font: inherit;
  padding: 0.28rem 0.7rem;
}

.canvas-toolbar button:hover {
  background: rgba(218, 255, 139, 0.18);
}

.canvas-zoom-group {
  align-items: stretch;
  background: #17200f;
  border: 1px solid rgba(218, 255, 139, 0.32);
  border-radius: 8px;
  display: inline-flex;
  overflow: hidden;
}

.canvas-zoom-group button.canvas-icon-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #f1f0e8;
  cursor: pointer;
  display: inline-flex;
  font-size: 1.05rem;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 30px;
}

.canvas-zoom-group button.canvas-icon-button + button.canvas-icon-button {
  border-left: 1px solid rgba(218, 255, 139, 0.32);
}

.canvas-zoom-group button.canvas-icon-button:hover {
  background: rgba(218, 255, 139, 0.18);
}

.canvas-coords {
  color: #dafe8b;
  flex: 1 1;
}

.canvas-zoom {
  color: #b9c7aa;
}

/* 옵션 바 행(뎁스2) — 표시 스트립과 톤 정합(다크·라임 테두리). 선택 칩 영역 + 편집/cap 폼 영역을
   가운데로 모은다(justify-content: center). 각 영역은 자기 콘텐츠 폭만 차지(스트레치 금지), 좁으면 줄바꿈. */
.canvas-options-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  background: rgba(9, 13, 6, 0.72);
  border: 1px solid rgba(218, 255, 139, 0.18);
  border-radius: 10px;
  font-size: 0.78rem;
}

/* 선택 컨텍스트 칩 — 남는 폭을 독식하지 않는 컴팩트 pill. 라벨+메타+버튼을 inline 정렬. */
.selection-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid rgba(218, 255, 139, 0.2);
  border-radius: 999px;
  background: rgba(218, 254, 139, 0.06);
  color: #dafe8b;
  font-weight: 500;
}

.selection-context-chip.is-empty {
  border-color: rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

.selection-context-chip__meta {
  color: #b9c7aa;
}

/* 영역 구분 — 선택 칩 뒤에 편집/cap 폼이 올 때만 얇은 세로 구분선(폼 없으면 미표시). */
.selection-context-chip + .canvas-options-edit-form {
  border-left: 1px solid rgba(218, 255, 139, 0.18);
  padding-left: 0.6rem;
}

/* 칩 액션 버튼 — 명확한 버튼 affordance(실선 테두리·충분한 패딩). 의미별로 --part/--clear 분리. */
.chip-action {
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.1;
  padding: 0.24rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}

/* 부품 선택 — 긍정 동작. 중립/강조 solid, 중립 hover(빨강 금지). */
.chip-action--part {
  background: rgba(218, 254, 139, 0.15);
  border-color: rgba(218, 255, 139, 0.45);
  color: #dafe8b;
}

.chip-action--part:hover {
  background: rgba(218, 254, 139, 0.28);
  border-color: #dafe8b;
}

/* 선택 해제·그룹 해제 — 아웃라인 버튼. 실선 테두리로 버튼감, subtle 적색 hover. */
.chip-action--clear {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.72);
}

.chip-action--clear:hover {
  background: rgba(255, 138, 138, 0.12);
  border-color: rgba(255, 138, 138, 0.5);
  color: #ff8a8a;
}

/* 승격된 "허용된 편집" 폼 — 가로 컴팩트 배치(도크 세로 폼과 별개, 스텝3에서 도크 폼 제거). */
.canvas-options-edit-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.canvas-options-edit-form .options-edit-field {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #b9c7aa;
}

.canvas-options-edit-form .options-edit-field input[type="number"] {
  width: 5.5rem;
  padding: 0.3rem 0.45rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.35);
  background: #10131c;
  color: rgba(255, 255, 255, 0.92);
  font: inherit;
}

.canvas-options-edit-form .options-edit-field input[type="checkbox"] {
  margin: 0;
}

.canvas-options-save {
  padding: 0.35rem 0.8rem;
  border: 1px solid rgba(218, 255, 139, 0.45);
  border-radius: 8px;
  background: #dafe8b;
  color: #17200f;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.canvas-options-save:hover {
  background: #e8ffab;
}

.canvas-placeholder {
  fill: rgba(218, 255, 139, 0.55);
  font-family: inherit;
  font-size: 22px;
}

/* 캔버스 래퍼 — 언더레이(canvas)+SVG를 함께 담고 팬 transform을 받는다.
   배경/테두리는 svg에서 이곳으로 이동(언더레이가 svg 뒤에서 비치게 — feature-underlay 설계). */
.geometry-viewport {
  background: rgba(4, 7, 4, 0.62);
  border: 1px solid rgba(218, 255, 139, 0.18);
  border-radius: 14px;
  /* CAD UX. canvas-stage의 1fr 행을 가득 채워 비율로 커지지 않게(하단 패널 잘림 방지). */
  flex: 1 1;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* 팬 레이어 — 캔버스 언더레이 + SVG를 함께 담아 드래그 중 transform으로 슬라이드시킨다. 정적인
   부모 .geometry-viewport(overflow:hidden)가 클립하므로 보드가 캔버스 영역 밖으로 넘치지 않는다. */
.geometry-pan-layer {
  position: relative;
  height: 100%;
  width: 100%;
}

/* 팬 드래그 중 컴포지터 레이어 승격 힌트 — transform 팬이 GPU에서 처리되게 한다. */
.geometry-pan-layer.is-dragging {
  will-change: transform;
}

/* 비인터랙티브 feature 언더레이 — SVG 뒤에 깔리고 입력은 통과시킨다. */
.geometry-underlay {
  height: 100%;
  inset: 0;
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.geometry-svg {
  aspect-ratio: auto;
  background: transparent;
  cursor: default;
  display: block;
  height: 100%;
  max-height: none;
  min-height: 0;
  position: relative;
  touch-action: none;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  width: 100%;
}

.geometry-svg.is-dragging {
  cursor: default;
}

.geometry-board {
  fill: rgba(218, 255, 139, 0.025);
  stroke: rgba(218, 255, 139, 0.16);
}

.geometry-feature {
  fill: none;
  stroke: rgba(185, 199, 170, 0.34);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.25;
  /* 줌과 무관하게 선 두께를 화면 픽셀로 고정(CAD 동작). 없으면 stroke가 user-unit이라
     확대 시 지오메트리와 함께 같이 굵어져 선이 안 얇아지고 디테일을 가린다. */
  vector-effect: non-scaling-stroke;
}

circle.geometry-feature {
  fill: rgba(185, 199, 170, 0.26);
}

/* flash(패드) 점: 0-길이 세그먼트를 round linecap으로 그려 점을 만든다. non-scaling-stroke로
   stroke-width가 곧 화면 픽셀 지름이 되어, 줌과 무관하게 점 크기가 화면에 고정된다(선과 동일). */
.geometry-flash {
  fill: none;
  stroke-linecap: round;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

/* 보드 아웃라인 경계 — 화면 맞춤의 기준이 되는 보드 윤곽(비인터랙티브 강조 사각). */
.board-outline-rect {
  fill: none;
  stroke: rgba(158, 203, 255, 0.65);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* 반응형 룰러(눈금자) — SVG 안 viewBox 좌표계에 그려 기하와 정확히 정렬. 다크 톤(어두운 스트립·흐린
   라벨·얇은 눈금). 입력은 통과시켜(pointer-events:none) 스트립 위에서도 팬/줌이 동작한다. */
/* 룰러/크로스헤어 오버레이 SVG — 팬 레이어 밖(뷰포트 직속)이라 드래그 CSS transform이 닿지 않는다.
   메인 SVG와 같은 viewBox·preserveAspectRatio·박스(inset:0)라 좌표 매핑 동일. 입력은 아래로 통과. */
.geometry-ruler-overlay {
  height: 100%;
  inset: 0;
  pointer-events: none;
  position: absolute;
  width: 100%;
}

.canvas-ruler {
  pointer-events: none;
}

.canvas-ruler-strip {
  fill: rgba(9, 14, 8, 0.92);
}

.canvas-ruler-corner {
  fill: rgba(9, 14, 8, 0.98);
}

.canvas-ruler-tick {
  stroke: rgba(218, 255, 139, 0.5);
  stroke-width: 1;
  /* 줌과 무관하게 눈금선을 화면 픽셀로 고정(기존 feature/opening과 동일 규약). */
  vector-effect: non-scaling-stroke;
}

.canvas-ruler-tick.is-minor {
  stroke: rgba(185, 199, 170, 0.28);
}

.canvas-ruler-label {
  fill: rgba(218, 255, 139, 0.72);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Ctrl+포인터 크로스헤어 가이드 — 커서를 지나는 얇은 라임 1px 헤어라인(화면 픽셀 고정) +
   룰러 마커·보드 기준 값 라벨. 커서 칩 톤(라임 위주 다크)과 정합. 입력은 통과. */
.canvas-crosshair {
  pointer-events: none;
}

.canvas-crosshair-line {
  stroke: rgba(218, 255, 139, 0.45);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.canvas-crosshair-marker-line {
  stroke: #dafe8b;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.canvas-crosshair-label-bg {
  fill: rgba(23, 32, 15, 0.95);
  stroke: rgba(218, 255, 139, 0.4);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.canvas-crosshair-label {
  fill: #dafe8b;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.geometry-opening {
  cursor: default;
  fill: rgba(218, 255, 139, 0.38);
  stroke: rgba(218, 255, 139, 0.86);
  stroke-width: 1.4;
  /* 개구부 외곽선을 화면 픽셀로 고정(CAD). 채움(패드 면적)은 그대로 스케일되고 테두리만 일정.
     선택/잠금/배치하이라이트 변종도 같은 요소라 이 vector-effect가 cascade로 적용된다. */
  vector-effect: non-scaling-stroke;
}

.geometry-opening.is-selected {
  fill: rgba(255, 243, 176, 0.82);
  stroke: #fff5ad;
  stroke-width: 2.2;
}

.geometry-opening.is-locked {
  pointer-events: none;
  stroke-dasharray: 3 3;
}

/* Shift 클릭으로 묶은 그룹 선택 — 점선 라임 외곽으로 강조한다. 배치 하이라이트(is-batch-highlighted,
   펄스 글로우)와 시각적으로 구분되고, 잠금(is-locked, 짧은 3 3 대시)보다 대시 간격을 넓혀 구별한다. */
.geometry-opening.is-group-selected {
  fill: rgba(218, 255, 139, 0.24);
  stroke: #dafe8b;
  stroke-width: 2;
  stroke-dasharray: 5 2.5;
}

/* 캡(apply_cap)으로 대체된 원본 개구 — 점선 외곽으로 감쇠해 "이 개구는 캡으로 대체됨"을 표시한다.
   채움 옅게는 renderOpening 인라인 스타일(fillOpacity)이 담당하고, 여기선 점선만 얹는다.
   편집 전후 비교를 위해 개구를 숨기지는 않는다. */
.geometry-opening.is-capped {
  stroke-dasharray: 3 2;
}

.geometry-empty {
  border: 1px dashed rgba(218, 255, 139, 0.24);
  border-radius: 18px;
  color: #b9c7aa;
  margin: 0;
  padding: 1rem;
}

.opening-map {
  display: grid;
  grid-gap: 0.5rem;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

/* 캔버스 하단 오프닝/피처 펼침 패널 — 토글로 열고 닫으며, 열면 스크롤 영역에 표시(뷰포트 잘림 방지). */
.canvas-bottom-panel {
  margin-top: 0.5rem;
  flex-shrink: 0;
}

.canvas-bottom-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  background: rgba(218, 254, 139, 0.08);
  border: 1px solid rgba(218, 255, 139, 0.22);
  border-radius: 8px;
  color: #f1f0e8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.canvas-bottom-toggle:hover {
  background: rgba(218, 254, 139, 0.14);
}

.canvas-bottom-body {
  margin-top: 0.4rem;
  max-height: 38vh;
  overflow-y: auto;
  display: grid;
  grid-gap: 0.5rem;
  gap: 0.5rem;
}

.feature-strip {
  /* 진단용 raw feature ID 칩 strip — 사용자 워크플로우에는 의미 없으므로 기본 숨김.
     향후 ?debug=true 또는 devtool toggle로 노출 검토. */
  display: none;
}

.feature-strip span {
  background: rgba(218, 255, 139, 0.08);
  border-radius: 999px;
  color: #d9e7ca;
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
}

.opening,
.decision-row button,
.edit-controls button {
  background: #17200f;
  border: 1px solid rgba(218, 255, 139, 0.28);
  border-radius: 12px;
  color: #f1f0e8;
  cursor: pointer;
  font: inherit;
  overflow: hidden;
  padding: 0.55rem 0.7rem;
  text-align: left;
}

.opening > span,
.opening > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opening.is-selected,
.decision-row button[aria-pressed="true"],
.edit-controls button {
  background: #dafe8b;
  color: #17200f;
}

.edit-controls button {
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  text-align: center;
  white-space: nowrap;
}

.decision-row button {
  text-align: center;
}

.edit-summary {
  color: #dafe8b;
  margin: 0;
}

.edit-summary-strong {
  font-size: 1.05rem;
  font-weight: 700;
  background: rgba(218, 254, 139, 0.12);
  border: 1px solid rgba(218, 254, 139, 0.45);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  display: inline-block;
}

.decision-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 4px;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  cursor: help;
}

.decision-badge.is-accepted {
  background: #dafe8b;
  color: #17200f;
  border: 1px solid #b6e35a;
}

.decision-badge.is-rejected {
  background: #fecaca;
  color: #7f1d1d;
  border: 1px solid #ef4444;
}

/* 추천 카드는 세로로 쌓는다. kind/rationale/신뢰도/오프닝 텍스트가 길어질 수 있어
   가로 배열 시 줄바꿈·정렬이 어긋난다(수직 정렬로 좌측 정렬 고정). */
.recommendation-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

/* 카드 안 p 기본 마진 제거 — 카드 gap이 유일한 세로 리듬이 되도록. */
.recommendation-card p {
  margin: 0;
}

.decision-row {
  display: flex;
  gap: 0.5rem;
}

/* 추천 설명 버튼 — 카드 안에서 텍스트 링크 형태의 작은 보조 버튼. */
.recommendation-explain-button {
  align-self: flex-start;
  background: transparent;
  border: 1px solid rgba(218, 255, 139, 0.4);
  border-radius: 999px;
  color: #daff8b;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.7rem;
}

.recommendation-explain-button:hover {
  background: rgba(218, 255, 139, 0.16);
}

/* 추천 설명 모달 — 화면 전체를 덮는 오버레이 위에 스크롤 가능한 카드. */
.explain-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(6, 9, 6, 0.66);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}

.explain-modal-card {
  background: #121712;
  border: 1px solid rgba(218, 255, 139, 0.24);
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: #f1f0e8;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  max-width: 520px;
  width: 100%;
}

.explain-modal-header {
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 1rem 1.25rem;
}

.explain-modal-title {
  font-size: 1.05rem;
  margin: 0;
}

.explain-modal-close {
  background: transparent;
  border: none;
  color: #b9c7aa;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem;
}

.explain-modal-close:hover {
  color: #f1f0e8;
}

.explain-modal-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding: 1.1rem 1.25rem;
}

.explain-modal-intro {
  color: #cdd9c0;
  line-height: 1.55;
  margin: 0;
}

.explain-modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.explain-modal-section-title {
  color: #daff8b;
  font-size: 0.92rem;
  margin: 0;
}

.explain-modal-section p,
.explain-modal-list li {
  line-height: 1.55;
  margin: 0;
}

.explain-modal-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.1rem;
}

.explain-modal-code {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  font-size: 0.85em;
  padding: 0.05rem 0.35rem;
}

.explain-modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: flex-end;
  padding: 0.9rem 1.25rem;
}

.explain-modal-confirm {
  background: #daff8b;
  border: 1px solid #daff8b;
  border-radius: 999px;
  color: #1a2208;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0.45rem 1.3rem;
}

.explain-modal-confirm:hover {
  background: #c9f06f;
}

.edit-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

/* 첫 라벨(개구부 제거 체크박스)은 체크박스+텍스트를 가로로. */
.edit-controls label:first-of-type {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.edit-controls input[type="number"] {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: #f1f0e8;
  padding: 0.65rem;
}

.layer-list {
  display: grid;
  grid-gap: 0.4rem;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 실시간 레이어 로딩: 파싱 중 점증하는 레이어 목록(메타데이터만, 스냅샷 도착 전). */
.parsing-layer-row {
  align-items: center;
  color: #cdd6c2;
  display: flex;
  font-size: 0.82rem;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
}
.parsing-layer-dot {
  animation: parsing-pulse 1s ease-in-out infinite;
  background: #dafe8b;
  border-radius: 50%;
  flex: 0 0 auto;
  height: 7px;
  width: 7px;
}
.parsing-layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.parsing-layer-count {
  color: #b9c7aa;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
}
@keyframes parsing-pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* TOP/BOTTOM 메탈마스크 스텐실 면 그룹 — 좌측 패널에서 면별로 확인·가시성 토글. */
.stencil-sides {
  margin: 0 0 0.6rem;
  padding: 0.4rem 0.5rem;
  background: rgba(120, 200, 255, 0.06);
  border: 1px solid rgba(120, 200, 255, 0.25);
  border-radius: 8px;
}

.stencil-sides__title {
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.8;
  margin-bottom: 0.35rem;
}

/* 스텐실 오버레이 토글 — solo 중에도 메탈마스크를 겹쳐 보이게 하는 체크박스형 버튼. */
.stencil-overlay-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.3rem 0.45rem;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(218, 255, 139, 0.06);
  border: 1px solid rgba(218, 255, 139, 0.18);
  border-radius: 8px;
  cursor: pointer;
}

.stencil-overlay-toggle.is-on {
  color: #dafe8b;
  background: rgba(218, 255, 139, 0.16);
  border-color: rgba(218, 255, 139, 0.5);
}

.stencil-overlay-toggle__box {
  font-size: 0.85rem;
  line-height: 1;
}

.stencil-sides__list {
  display: grid;
  grid-gap: 0.3rem;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stencil-sides__toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.3rem 0.45rem;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}

.stencil-sides__toggle.is-visible {
  border-color: rgba(120, 200, 255, 0.5);
  background: rgba(120, 200, 255, 0.12);
}

.stencil-sides__label {
  font-weight: 600;
}

.stencil-sides__count {
  margin-left: auto;
  opacity: 0.7;
  font-size: 0.74rem;
}

/* 레이어 행 — 레이어 하나의 정보(색·이름·액션·역할)를 카드 하나로 묶는다.
   1행: 색 피커+이름(전체 폭), 2행: 액션 버튼, 3행: 역할 선택. 버튼을 이름과 같은
   행에 두면 좁은 사이드바에서 이름이 잘리므로(액션 6개 ≈ 170px) 버튼을 아래 행으로 내린다. */
.layer-list > li {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  cursor: -webkit-grab;
  cursor: grab;
  display: grid;
  grid-gap: 0.3rem 0.3rem;
  gap: 0.3rem 0.3rem;
  grid-template-columns: 18px minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  padding: 0.45rem 0.5rem;
}

.layer-list > li > .layer-color-input {
  grid-column: 1;
  grid-row: 1;
}

.layer-list > li > .layer-item {
  grid-column: 2;
  grid-row: 1;
}

.layer-list > li > .layer-actions {
  grid-column: 1 / -1;
  grid-row: 2;
}

.layer-list > li > .layer-role-select {
  grid-column: 1 / -1;
  grid-row: 3;
}

/* AI 검출 배지 — 레이어 행 하단 전체 폭. 결정론 분류와 다르거나 불확실한 레이어만 노출된다. */
.layer-list > li > .layer-advisory {
  grid-column: 1 / -1;
  grid-row: 4;
}

.layer-advisory {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  padding: 0.4rem 0.5rem;
  background: rgba(255, 196, 0, 0.08);
  border: 1px solid rgba(255, 196, 0, 0.4);
  border-radius: 8px;
  font-size: 0.74rem;
}

.layer-advisory-badge {
  font-weight: 700;
  color: #ffce4a;
  white-space: nowrap;
}

.layer-advisory-detail {
  color: #e6e9f5;
  min-width: 0;
  overflow-wrap: anywhere;
}

.layer-advisory-reason {
  flex-basis: 100%;
  margin: 0;
  color: #b9c1dd;
  font-size: 0.7rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.layer-advisory-cited {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.layer-advisory-cited__label {
  color: #8d96b8;
  font-size: 0.68rem;
  white-space: nowrap;
}

.layer-advisory-cited__chip {
  padding: 0.05rem 0.35rem;
  background: rgba(203, 213, 245, 0.12);
  border: 1px solid rgba(203, 213, 245, 0.25);
  border-radius: 999px;
  color: #cbd5f5;
  font-size: 0.66rem;
  overflow-wrap: anywhere;
}

.layer-advisory-actions {
  display: flex;
  gap: 0.3rem;
  margin-left: auto;
}

.layer-advisory-accept,
.layer-advisory-keep {
  border-radius: 6px;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.layer-advisory-accept {
  background: #dafe8b;
  color: #10131c;
  border: 1px solid #dafe8b;
}

.layer-advisory-keep {
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(203, 213, 245, 0.4);
}

.layer-list > li:active {
  cursor: -webkit-grabbing;
  cursor: grabbing;
}

.layer-list > li.is-dragging {
  opacity: 0.45;
}

.layer-list > li.is-drop-before {
  box-shadow: inset 0 3px 0 #dafe8b;
}

.layer-list > li.is-drop-after {
  box-shadow: inset 0 -3px 0 #dafe8b;
}

.layer-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}

.layer-action {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: #b9c7aa;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  height: 24px;
  padding: 0;
  width: 24px;
}

.layer-action:hover {
  background: rgba(218, 255, 139, 0.16);
  color: #f1f0e8;
}

.layer-action.is-active {
  background: #dafe8b;
  border-color: #dafe8b;
  color: #17200f;
}

/* 카드(li)가 박스를 담당하므로 이름 버튼 자체는 평탄하게 — 중첩 박스 느낌 방지. */
.layer-item {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  display: grid;
  grid-gap: 0.55rem;
  gap: 0.55rem;
  grid-template-columns: minmax(0, 1fr) 18px;
  padding: 0.3rem 0.35rem;
  text-align: left;
  width: 100%;
}

.layer-item:hover {
  background: rgba(218, 255, 139, 0.1);
}

.layer-item.is-hidden {
  opacity: 0.4;
}

/* 레이어 색 피커 — 스와치 겸용 네이티브 컬러 입력. 클릭하면 색 선택기가 열린다. */
.layer-color-input {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  cursor: pointer;
  height: 18px;
  padding: 0;
  width: 18px;
}

.layer-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.layer-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

.layer-color-input::-moz-color-swatch {
  border: none;
  border-radius: 3px;
}

.layer-meta strong {
  display: block;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-meta small {
  color: #b9c7aa;
  display: block;
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-eye {
  font-size: 0.95rem;
  opacity: 0.85;
  text-align: center;
}

.layer-item.is-hidden .layer-eye {
  opacity: 0.35;
}

.violation-panel {
  display: grid;
  grid-gap: 0.65rem;
  gap: 0.65rem;
}

.violation-params {
  display: grid;
  grid-gap: 0.55rem;
  gap: 0.55rem;
}

/* .violation-params label 레이아웃은 공통 프리미티브 .field로 통일(중복 규칙 제거). */

.violation-params input {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: #f1f0e8;
  font: inherit;
  padding: 0.5rem 0.65rem;
}

.violation-run-button {
  background: #dafe8b;
  border: 0;
  border-radius: 12px;
  color: #17200f;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0.55rem 1rem;
  white-space: nowrap;
}

.violation-run-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.violation-hint {
  color: #b9c7aa;
  font-size: 0.78rem;
  margin: 0;
}

.violation-error {
  color: #ff9eb1;
  font-size: 0.8rem;
  margin: 0;
}

.violation-summary {
  color: #dafe8b;
  font-size: 0.8rem;
  font-weight: 700;
  margin: 0;
}

.violation-summary-row {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}

.violation-export-button {
  background: transparent;
  border: 1px solid rgba(218, 255, 139, 0.4);
  border-radius: 999px;
  color: #dafe8b;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  padding: 0.3rem 0.65rem;
}

.violation-export-button:hover {
  background: rgba(218, 255, 139, 0.14);
}

.violation-export-button[disabled] {
  cursor: not-allowed;
  opacity: 0.4;
}

.violation-persist-toggle {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  font-size: 0.78rem;
  grid-gap: 0.45rem;
  gap: 0.45rem;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 0.5rem 0.65rem;
}

.violation-persist-toggle strong {
  display: block;
  font-size: 0.82rem;
}

.violation-persist-toggle small {
  color: #b9c7aa;
  display: block;
  font-size: 0.7rem;
  margin-top: 0.15rem;
}

.violation-filters {
  display: flex;
  gap: 0.3rem;
}

.violation-filters button {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #b9c7aa;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  padding: 0.3rem 0.65rem;
}

.violation-filters button.is-active {
  background: #dafe8b;
  border-color: #dafe8b;
  color: #17200f;
}

.violation-empty {
  color: #b9c7aa;
  font-size: 0.78rem;
  margin: 0;
}

.violation-list {
  display: grid;
  grid-gap: 0.4rem;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  max-height: 22rem;
  overflow-y: auto;
  padding: 0;
}

.violation-list > li {
  margin: 0;
  padding: 0;
}

.violation-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: inherit;
  cursor: pointer;
  display: grid;
  font: inherit;
  grid-gap: 0.2rem;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  text-align: left;
  width: 100%;
}

.violation-item:hover {
  background: rgba(218, 255, 139, 0.12);
}

.violation-item.severity-critical {
  border-left: 3px solid #ff9eb1;
}

.violation-item.severity-warning {
  border-left: 3px solid #ffe28a;
}

/* review = HITL 검토 대상(예외 A·모호 겹침·비아). critical/warning과 구분되는 청색 계열. */
.violation-item.severity-review {
  border-left: 3px solid #8ab4ff;
}

.violation-item strong {
  font-size: 0.85rem;
}

.violation-item small {
  color: #b9c7aa;
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1280px) {
  /* 우측/좌측 열 폭은 JS 인라인 템플릿(도크 collapse 연동: 열림 280/360·닫힘 40)이 단일 진실이다.
     과거 여기 있던 grid-template-columns !important 오버라이드는 인라인을 덮어써 닫아도 280px가 남던
     버그였다(도크 닫아도 마진 잔존) → 제거. .violation-panel 전폭 규칙만 유지. */
  .violation-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 1fr !important;
  }

  /* 좁은 화면 높이 규칙은 래퍼(viewport)가 받는다 — svg는 래퍼를 100% 채움. */
  .geometry-viewport {
    height: 60vh;
    min-height: 22rem;
  }
}

.onboarding-tenant-summary {
  margin: 0;
  padding: 0.65rem 0.85rem;
  background: rgba(218, 254, 139, 0.1);
  border: 1px solid rgba(218, 254, 139, 0.4);
  border-radius: 8px;
  color: #dafe8b;
  font-weight: 600;
}

.workspace-entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.workspace-entry {
  border: 1px solid rgba(218, 254, 139, 0.25);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.workspace-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.workspace-entry-index {
  font-weight: 700;
  color: #dafe8b;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.workspace-entry-remove {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fecaca;
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.workspace-entry-remove:hover {
  background: rgba(239, 68, 68, 0.15);
}

.workspace-add-button {
  margin-top: 0.75rem;
  background: transparent;
  border: 1px dashed rgba(218, 254, 139, 0.55);
  color: #dafe8b;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.workspace-add-button:hover {
  background: rgba(218, 254, 139, 0.08);
}

/* 커스텀 아이콘 툴팁(호버 지연·키보드 포커스) — 다크 칩 톤. 브라우저 title 속성 대체. */
.ui-tooltip-wrap {
  position: relative;
  display: inline-flex;
}

.ui-tooltip {
  position: absolute;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: max-content;
  max-width: 18rem;
  padding: 6px 9px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  border: 1px solid rgba(218, 255, 139, 0.28);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  line-height: 1.3;
  pointer-events: none;
}

.ui-tooltip[data-placement="right"] {
  top: 50%;
  left: 100%;
  margin-left: 8px;
  transform: translateY(-50%);
}

.ui-tooltip[data-placement="left"] {
  top: 50%;
  right: 100%;
  margin-right: 8px;
  transform: translateY(-50%);
}

.ui-tooltip[data-placement="top"] {
  bottom: 100%;
  left: 50%;
  margin-bottom: 8px;
  transform: translateX(-50%);
}

.ui-tooltip[data-placement="bottom"] {
  top: 100%;
  left: 50%;
  margin-top: 8px;
  transform: translateX(-50%);
}

.ui-tooltip-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: #dafe8b;
}

.ui-tooltip-desc {
  font-size: 0.72rem;
  color: #cbd5e1;
}

.cursor-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  max-width: 22rem;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 0.78rem;
  line-height: 1.35;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  white-space: pre-wrap;
  word-break: break-word;
}

.inspector-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 800;
  width: 24rem;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  color: #e2e8f0;
  border-left: 1px solid #1e293b;
  box-shadow: -10px 0 28px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: inspector-slide-in 180ms ease-out;
}

@keyframes inspector-slide-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.inspector-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  grid-gap: 8px;
  gap: 8px;
  padding: 10px 12px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.inspector-kind {
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: #94a3b8;
  background: #0f172a;
  padding: 2px 8px;
  border-radius: 999px;
}

.inspector-title {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #cbd5f5;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
}

.inspector-close:hover {
  background: #334155;
}

.inspector-body {
  padding: 12px;
  overflow: auto;
  flex: 1 1 auto;
}

.inspector-body dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inspector-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  grid-gap: 8px;
  gap: 8px;
  /* baseline은 라벨이 여러 줄로 래핑될 때 값과 어긋나 보이므로 start로 정렬. 폰트는 축소해 빽빽함 완화. */
  align-items: start;
  font-size: 0.76rem;
}

.inspector-row dt {
  color: #94a3b8;
  font-weight: 500;
  /* grid 아이템 기본 min-width:auto면 라벨이 고정 6rem 칸을 넘쳐 값 칸과 겹친다.
     min-width:0 + overflow-wrap으로 칸 안에서 줄바꿈되게 해 겹침을 막는다. */
  min-width: 0;
  overflow-wrap: anywhere;
}

.inspector-row dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.inspector-swatch-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inspector-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.inspector-raw {
  border-top: 1px solid #1e293b;
  padding: 8px 12px;
  font-size: 0.76rem;
  background: #0b1220;
}

.inspector-raw summary {
  cursor: pointer;
  color: #94a3b8;
  padding: 4px 0;
}

.inspector-raw pre {
  margin: 6px 0 0;
  max-height: 14rem;
  overflow: auto;
  background: #020617;
  padding: 8px;
  border-radius: 6px;
  color: #cbd5f5;
}

.violation-suggest-cap {
  width: 100%;
  margin-top: 0.35rem;
  background: transparent;
  border: 1px dashed rgba(218, 254, 139, 0.55);
  color: #dafe8b;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.violation-suggest-cap:hover {
  background: rgba(218, 254, 139, 0.1);
}

.inspector-footer {
  border-top: 1px solid #1e293b;
  padding: 10px 12px;
  background: #0b1220;
}

.inspector-cap-button {
  width: 100%;
  background: #dafe8b;
  color: #17200f;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.inspector-cap-button:hover {
  filter: brightness(0.95);
}

/* 인스펙터 footer 버튼 정리 — 연속 버튼 사이 간격, 보조 동작(룰 저장)은 아웃라인으로 위계 분리. */
.inspector-cap-button + .inspector-cap-button {
  margin-top: 0.5rem;
}

.inspector-cap-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.inspector-cap-button-secondary {
  background: transparent;
  color: #dafe8b;
  border: 1px solid rgba(218, 254, 139, 0.55);
  font-weight: 600;
}

.inspector-cap-button-secondary:hover:not(:disabled) {
  filter: none;
  border-color: #dafe8b;
  background: rgba(218, 254, 139, 0.1);
}

/* 스텝3-B cap 편집 옵션 바 인라인 폼 — 우측 도크 드로어에서 이관(design-p3 §1.9). 승격 폼 관례
   (.canvas-options-edit-form) 위에 cap 전용 요소(종류 라디오·상태·메트릭스·닫기)를 가로 컴팩트로 얹는다. */
/* cap 폼은 논리 그룹을 시각적 행으로 정돈한다 — 공용 승격 폼(.canvas-options-edit-form)은 가로
   flex-wrap 유지, cap 폼만 세로 컬럼으로 재정의(다른 옵션 바 폼에 영향 없음). */
.options-cap-form {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.options-cap-form input[type="range"] {
  width: 7rem;
}

/* 각 그룹 행 — 옵션 바 폭을 넘칠 때 행 내부만 wrap. 콘텐츠를 가운데로 모은다. */
.cap-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.9rem;
}

/* 그룹 행 사이 얇은 구분선 — "관련 변수별 영역"을 시각화(라임 톤, 과하지 않게). */
.cap-form-row + .cap-form-row {
  border-top: 1px solid rgba(218, 255, 139, 0.1);
  padding-top: 0.5rem;
}

/* 파라미터 행 — 라벨:값 필드를 라벨 최소폭 고정으로 값 열 정렬. */
.cap-form-params .options-edit-field > span {
  min-width: 6.5rem;
  text-align: right;
}

/* 메트릭스 행 — 상태·에러·수치를 한 영역에 baseline 정렬. */
.cap-form-metrics-row {
  align-items: baseline;
  gap: 0.3rem 0.9rem;
}

/* 액션 행 — 저장·닫기(×)를 가운데로 모은다(옵션 바 센터 정렬 정합). */
.cap-form-actions {
  justify-content: center;
}

.cap-kind-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cap-kind-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #b9c7aa;
  cursor: pointer;
}

.cap-form-status {
  color: #cbd5f5;
  font-size: 0.82rem;
  /* 로딩 문구가 비어도 한 줄 폭을 예약해 정당한 재계산 중에도 레이아웃이 밀리지 않게 한다. */
  min-width: 6rem;
}

.cap-form-error {
  color: #fecaca;
  font-size: 0.82rem;
}

.cap-metrics {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem 0.7rem;
  font-size: 0.78rem;
}

.cap-metrics h4 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}

.cap-metrics dl {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.7rem;
}

.cap-metric-row {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.cap-metric-row dt {
  color: #94a3b8;
}

.cap-metric-row dd {
  margin: 0;
}

/* 현재 편집 리드아웃 — 증분 입력칸 아래 읽기 전용 행. cap-metrics 언어 재사용, 상단 구분선으로 분리. */
.canvas-options-edit-form .edit-readout {
  width: 100%;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.canvas-options-edit-form .edit-readout dt {
  color: #94a3b8;
}

.canvas-options-edit-form .edit-readout-none {
  color: #94a3b8;
  font-size: 0.78rem;
}

.cap-metric-ok {
  color: #dafe8b;
}

.cap-metric-warn {
  color: #fbbf24;
}

.cap-form-close {
  width: 28px;
  height: 28px;
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(203, 213, 245, 0.35);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.cap-form-close:hover {
  background: #334155;
}

.options-cap-form .canvas-options-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 방향 편집 옵션 바 폼 — cap 폼과 동일 언어(세로 컬럼·그룹 행). 공용 승격 폼(.canvas-options-edit-form)
   가로 flex-wrap을 방향 폼만 세로로 재정의(다른 폼에 영향 없음). */
.options-direction-form {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

/* 안내 행 — 모드/폴백 힌트를 뮤트·중앙 정렬로 한 줄에. */
.direction-form-hints {
  color: #94a3b8;
  font-size: 0.82rem;
}

/* 4면 그리드 — 2×2 배치, 면 간 라벨/값/단위/버튼이 고정폭으로 열 정렬. */
.direction-face-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: center;
  grid-gap: 0.4rem 1.2rem;
  gap: 0.4rem 1.2rem;
}

/* 각 면 — [라벨 고정폭][값][단위][expand/cut] 한 행. 라벨 min-width로 값 열을 맞춘다. */
.canvas-options-edit-form .options-edit-field.direction-face {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.direction-face-label {
  min-width: 3.5rem;
  text-align: right;
  color: #b9c7aa;
}

/* expand/cut 토글 — 명확한 버튼 affordance. 확대=중립(라임), 컷=구분(앰버, 기존 토큰). */
.direction-mode-toggle {
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1.1;
  padding: 0.24rem 0.6rem;
  min-width: 3.6rem;
  border: 1px solid rgba(218, 255, 139, 0.45);
  border-radius: 6px;
  background: rgba(218, 254, 139, 0.15);
  color: #dafe8b;
  cursor: pointer;
}

.direction-mode-toggle:hover {
  background: rgba(218, 254, 139, 0.28);
  border-color: #dafe8b;
}

/* 컷 — 앰버 토큰(cap-metric-warn)으로 의미 구분(신규 색 없음). */
.direction-mode-toggle.is-cut {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
}

.direction-mode-toggle.is-cut:hover {
  background: rgba(251, 191, 36, 0.24);
  border-color: #fbbf24;
}

.cap-preview-polygon {
  fill: rgba(218, 254, 139, 0.18);
  stroke: #dafe8b;
  stroke-width: 1.6;
  stroke-dasharray: 4 3;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

/* 저장된 캡(apply_cap)의 확정 형상 — 일반 캔버스 뷰에서 개구 위에 겹쳐 그린다. 캡 프리뷰
   (.cap-preview-polygon 점선)·편집 diff(.edit-diff-rect 점선)와 달리 실선+반투명 채움으로
   "확정 적용된 모양"으로 읽히게 한다. 클릭은 원본 개구가 받도록 pointer-events 없음. */
.geometry-cap-applied {
  fill: rgba(218, 255, 139, 0.5);
  stroke: #dafe8b;
  stroke-width: 1.6;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.export-stencil-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.export-stencil-download {
  background: transparent;
  color: #dafe8b;
  border: 1px solid #dafe8b;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.export-stencil-download:not(:disabled):hover {
  background: rgba(218, 254, 139, 0.1);
}

/* Gerber 다운로드 진행 중 서클 스피너 (stencil-spin keyframe 재사용) */
/* 확인 모달 busy 서클 스피너 — 대용량 레이어 삭제 등 서버 왕복 레이턴시 표시. */
.confirm-dialog-spinner {
  animation: stencil-spin 0.8s linear infinite;
  border: 2px solid rgba(255, 143, 127, 0.35);
  border-top-color: #ff8f7f;
  border-radius: 50%;
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 0.45rem;
  vertical-align: -2px;
}

.export-download-spinner {
  animation: stencil-spin 0.8s linear infinite;
  border: 2px solid rgba(218, 254, 139, 0.3);
  border-top-color: #dafe8b;
  border-radius: 50%;
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 0.4rem;
  vertical-align: -2px;
}

.export-stencil-download:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Export 게이트 차단 사유 — 비활성 다운로드 버튼 아래 작은 안내. */
.export-gate-reason {
  color: #ffb4a8;
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0.5rem 0 0;
}

/* Export 사인오프 승인 버튼 — 미승인이 유일한 차단 사유일 때 다운로드 버튼 위에 노출. */
.export-signoff-approve {
  background: #dafe8b;
  color: #14210a;
  border: 1px solid #dafe8b;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.export-signoff-approve:not(:disabled):hover {
  background: #c8f06e;
}

.export-signoff-approve:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 승인 처리 중 서클 로딩 — 연녹색 버튼 위라 어두운 스피너로 대비를 준다(load-button-spinner와 동형). */
.export-signoff-spinner {
  animation: stencil-spin 0.8s linear infinite;
  border: 2px solid rgba(20, 33, 10, 0.3);
  border-top-color: #14210a;
  border-radius: 50%;
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 0.45rem;
  vertical-align: -2px;
}

/* 현재 스냅샷이 승인된 상태 표시 — 다운로드 버튼 위 작은 배지. */
.export-signoff-status {
  color: #dafe8b;
  font-size: 0.8rem;
  font-weight: 700;
}

/* 검수 트리아지 헤더 — 캔버스 위에 critical/warning 개수와 검사 상태를 띠 형태로. */
.review-triage {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.4rem 0.85rem;
}

.review-triage--pending {
  background: rgba(255, 196, 92, 0.1);
  border-color: rgba(255, 196, 92, 0.35);
}

.review-triage--fresh {
  background: rgba(218, 255, 139, 0.08);
  border-color: rgba(218, 255, 139, 0.28);
}

.review-triage-count {
  font-size: 0.85rem;
  font-weight: 600;
}

.review-triage-count--critical {
  color: #ff8f7f;
}

.review-triage-count--review {
  color: #8ab4ff;
}

/* 거버 신뢰 모드 토글 + 배너. */
.trust-gerber-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.trust-gerber-toggle.is-active {
  color: #ffd479;
  font-weight: 700;
}

/* 일반 SMD 축소율(%) 입력 — 자동추출 컨트롤 스트립 내. cad.md §1 개구부 5~7% 축소. */
.reduce-percent-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.reduce-percent-field__input {
  width: 3.4rem;
  padding: 0.2rem 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  font-size: 0.8rem;
}

.trust-gerber-banner {
  margin: 0.5rem 0;
  padding: 0.45rem 0.7rem;
  border: 1px solid rgba(255, 212, 121, 0.45);
  border-radius: 8px;
  background: rgba(255, 212, 121, 0.08);
  color: #ffd479;
  font-size: 0.82rem;
}

/* 원클릭 파이프라인 진행 모달 — 긴 단계에서도 멈춘 듯 보이지 않게 경과/현재단계를 팝업으로. */
.pipeline-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.pipeline-modal-card {
  background: #1b2410;
  border: 1px solid rgba(138, 180, 255, 0.4);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.pipeline-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.8rem;
}

.pipeline-modal-title {
  font-weight: 700;
  margin: 0;
}

.pipeline-elapsed {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: #8ab4ff;
  font-size: 0.85rem;
}

.pipeline-current {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #dafe8b;
  font-weight: 700;
  margin: 0;
}

/* 진행 중 스피너 (stencil-spin keyframe 재사용). */
.pipeline-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(218, 254, 139, 0.3);
  border-top-color: #dafe8b;
  animation: stencil-spin 0.8s linear infinite;
  flex: 0 0 auto;
}

/* 원클릭 자동추출 파이프라인 진행바 — 캔버스 헤더 아래 띠. */
.pipeline-progress {
  border: 1px solid rgba(138, 180, 255, 0.35);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  margin: 0.5rem 0;
  background: rgba(138, 180, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pipeline-progress-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.pipeline-progress-fill {
  height: 100%;
  background: #8ab4ff;
  transition: width 0.3s ease;
}

.pipeline-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
}

.pipeline-stage {
  display: flex;
  flex-direction: column;
  color: rgba(255, 255, 255, 0.45);
}

.pipeline-stage--running {
  color: #dafe8b;
  font-weight: 700;
}

.pipeline-stage--done {
  color: #8ab4ff;
}

.pipeline-stage--error {
  color: #ff8f7f;
  font-weight: 700;
}

.pipeline-stage-detail {
  font-size: 0.72rem;
  opacity: 0.8;
}

.pipeline-error {
  color: #ff8f7f;
  font-size: 0.8rem;
  margin: 0;
}

.pipeline-summary {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 0.5rem;
}

.pipeline-summary-title {
  font-weight: 700;
  margin: 0 0 0.3rem;
}

.pipeline-summary-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
}

.pipeline-close {
  align-self: flex-end;
  background: transparent;
  color: #dafe8b;
  border: 1px solid #dafe8b;
  border-radius: 8px;
  padding: 0.35rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

/* 완료 후 다음 수순 안내 + 닫기 유도. */
.pipeline-next-steps {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #cfe0b6;
}

.pipeline-finish {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-end;
}

.pipeline-close-hint {
  margin: 0;
  font-size: 0.82rem;
  color: #8ab4ff;
}

/* 닫기를 CTA로 강조 — 채운 버튼 + 약한 펄스. */
.pipeline-close--cta {
  background: #dafe8b;
  color: #14210a;
  align-self: stretch;
  padding: 0.55rem 0.9rem;
  animation: pipeline-close-pulse 1.6s ease-in-out infinite;
}

@keyframes pipeline-close-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(218, 254, 139, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(218, 254, 139, 0); }
}

.review-triage-count--warning {
  color: #ffd479;
}

.review-triage-status {
  color: #b9c7aa;
  font-size: 0.8rem;
  margin-left: auto;
}

/* 면 격리 스코프 배지 — 카운트가 한 면만 집계 중임을 알린다. */
.review-triage-scope {
  color: #9ecbff;
  border: 1px solid rgba(158, 203, 255, 0.45);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

/* 가이드 검토 큐 바 — 진행률과 다음/마킹 버튼. */
.review-queue-bar {
  align-items: center;
  background: rgba(134, 217, 255, 0.08);
  border: 1px solid rgba(134, 217, 255, 0.28);
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.4rem 0.85rem;
}

.review-queue-progress {
  color: #cde6ff;
  font-size: 0.85rem;
  font-weight: 600;
}

.review-queue-next,
.review-queue-mark {
  background: transparent;
  border: 1px solid rgba(134, 217, 255, 0.4);
  border-radius: 999px;
  color: #cdeeff;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.25rem 0.8rem;
}

.review-queue-mark {
  margin-left: auto;
}

.review-queue-next:not(:disabled):hover,
.review-queue-mark:not(:disabled):hover {
  background: rgba(134, 217, 255, 0.16);
}

.review-queue-next:disabled,
.review-queue-mark:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 검토 완료된 위반 항목 — 흐리게 + 체크 표시. */
.violation-item.is-reviewed {
  opacity: 0.55;
}

.violation-reviewed-tag {
  color: #9be38a;
  font-weight: 700;
  margin-left: 0.35rem;
}

/* 구리 패드 오버레이 토글(캔버스 모드 바). */
.canvas-overlay-toggle {
  background: transparent;
  border: 1px solid rgba(255, 196, 92, 0.4);
  border-radius: 999px;
  color: #ffd479;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.7rem;
}

.canvas-overlay-toggle.is-active {
  background: rgba(255, 196, 92, 0.18);
}

/* 측정 모드 커서 + 측정선/점/수치 칩. */
.geometry-svg.is-measure-mode {
  cursor: crosshair;
}

.measure-line {
  stroke: #ffd479;
  stroke-width: 1.25;
  stroke-dasharray: 5 3;
  /* 줌과 무관하게 화면 픽셀로 선 두께 고정. */
  vector-effect: non-scaling-stroke;
}

.measure-cross line {
  stroke: #ffd479;
  stroke-width: 1.25;
  /* 줌과 무관하게 화면 픽셀로 선 두께 고정(measure-line 관례). */
  vector-effect: non-scaling-stroke;
}

.canvas-measure-readout {
  color: #ffd479;
  font-size: 0.8rem;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 편집 전/후 diff — 편집본(적용 결과)을 점선 라임 아웃라인으로 원본 위에 겹쳐 표시. */
.edit-diff-rect {
  fill: none;
  stroke: #daff8b;
  stroke-width: 1.5;
  stroke-dasharray: 4 2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.edit-diff-rect.is-suppressed {
  stroke: #ff8f7f;
  stroke-dasharray: 2 2;
}

/* P4 실시간 간격 가드 — 위반 개구·이웃을 적색 점선으로 겹쳐 표시(렌더 전용·클릭 불가·팬 무영향). */
.geometry-guard-violation {
  fill: none;
  stroke: #ff5d73;
  stroke-width: 2;
  stroke-dasharray: 5 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* 간격 가드 방패 배지(옵션 바 우측) + 설정 팝오버(뎁스2 인라인, 중첩 모달 없음). */
.canvas-guard-wrap {
  position: relative;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}

.canvas-guard-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(218, 255, 139, 0.28);
  background: rgba(9, 13, 6, 0.72);
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.76rem;
  cursor: pointer;
}

.canvas-guard-badge:hover {
  border-color: rgba(218, 255, 139, 0.5);
}

.canvas-guard-badge.is-violation {
  border-color: #ff5d73;
  background: rgba(255, 93, 115, 0.16);
  color: #ff9eb1;
}

.guard-settings-popover {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 13rem;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(218, 255, 139, 0.28);
  background: rgba(9, 13, 6, 0.96);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.guard-settings-popover label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.76rem;
}

.guard-settings-popover input[type="number"] {
  width: 5rem;
}

/* edit 모드 드래그 핸들 + 실시간 미리보기. */
.edit-preview-rect {
  fill: rgba(218, 255, 139, 0.12);
  stroke: #daff8b;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.edit-handle {
  fill: #daff8b;
  stroke: #1a2208;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  pointer-events: auto;
}

.edit-handle:hover {
  fill: #ffffff;
}

.edit-handle-move {
  fill: #86d9ff;
}

.stencil-preview-rect,
.stencil-preview-poly {
  fill: rgba(218, 254, 139, 0.85);
  stroke: #17200f;
  stroke-width: 0.6;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

/* 원클릭 파이프라인 두께 입력 모달. */
.pipeline-thickness-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
}

.pipeline-thickness-card {
  background: #1b2410;
  border: 1px solid rgba(218, 254, 139, 0.35);
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.pipeline-thickness-title {
  font-weight: 700;
  margin: 0;
}

.pipeline-thickness-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.pipeline-thickness-field input {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #0f1607;
  color: inherit;
}

.pipeline-thickness-error {
  color: #ff8f7f;
  font-size: 0.8rem;
  margin: 0;
}

/* 두께 권장 범위 밖 경고(차단 아님) — 모달·검사 사이드바 공통 톤(앰버). */
.pipeline-thickness-range-warning,
.violation-thickness-warning {
  color: #ffd166;
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
  line-height: 1.4;
}

.pipeline-thickness-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.pipeline-thickness-confirm {
  background: #dafe8b;
  color: #14210a;
  border: 1px solid #dafe8b;
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.pipeline-thickness-confirm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pipeline-thickness-cancel {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
}

/* window-pane 분할 sub-opening — 실제 뚫리는 구멍이므로 다른 개구와 같은 라임으로 채우고,
   파란 점선 테두리로 "자동 분할됨"을 표시한다. 사이의 web은 채우지 않아(배경색) 막힌 것으로 보인다. */
.windowpane-overlay-rect {
  fill: rgba(218, 254, 139, 0.85);
  stroke: #8ab4ff;
  stroke-width: 1;
  stroke-dasharray: 3 2;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}


/* 상단 툴바의 메탈마스크 스텐실 추출 primary 버튼 */
.extract-stencil-button {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  background: #dafe8b;
  color: #17200f;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.extract-stencil-button:not(:disabled):hover {
  filter: brightness(0.95);
}

.extract-stencil-button:disabled {
  background: rgba(218, 254, 139, 0.25);
  color: rgba(241, 240, 232, 0.55);
  cursor: not-allowed;
}

/* 미리보기 상/하면 격리 세그먼트 토글 */
.stencil-preview-side-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(218, 254, 139, 0.5);
  border-radius: 8px;
  overflow: hidden;
}

.stencil-preview-side-toggle__btn {
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border: none;
  border-left: 1px solid rgba(218, 254, 139, 0.35);
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.stencil-preview-side-toggle__btn:first-child {
  border-left: none;
}

.stencil-preview-side-toggle__btn.is-active {
  background: #dafe8b;
  color: #17200f;
}

.stencil-preview-side-toggle__btn:not(.is-active):hover {
  background: rgba(218, 254, 139, 0.18);
}

/* 추출 연산 중 서클 로딩 스피너 (stencil-spin keyframe 재사용) */
.extract-stencil-spinner {
  animation: stencil-spin 0.8s linear infinite;
  border: 2px solid rgba(23, 32, 15, 0.3);
  border-radius: 50%;
  border-top-color: #17200f;
  display: inline-block;
  height: 14px;
  width: 14px;
  margin-right: 0.45rem;
  vertical-align: -3px;
}

.workspace-required-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.7);
  padding: 1rem;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

/* 워크스페이스 전환 중 데이터 로드 오버레이 */
.workspace-switching-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.72);
  padding: 1rem;
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}

.workspace-switching-card {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: #1a1d23;
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(218, 254, 139, 0.32);
  border-radius: 12px;
  padding: 1.1rem 1.5rem;
  font-weight: 600;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
}

/* 서클 로딩 스피너 (stencil-spin keyframe 재사용) */
.workspace-switching-spinner {
  animation: stencil-spin 0.8s linear infinite;
  border: 3px solid rgba(218, 254, 139, 0.25);
  border-top-color: #dafe8b;
  border-radius: 50%;
  display: inline-block;
  width: 22px;
  height: 22px;
}

.workspace-required-card {
  max-width: 26rem;
  width: 100%;
  background: #0f172a;
  color: #f1f0e8;
  border: 1px solid rgba(218, 254, 139, 0.45);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.workspace-required-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  color: #dafe8b;
}

.workspace-required-card p {
  margin: 0 0 1rem;
  line-height: 1.55;
  color: #cbd5f5;
  font-size: 0.92rem;
}

.workspace-required-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
}

.workspace-required-create {
  background: #dafe8b;
  color: #17200f;
  text-decoration: none;
  font-weight: 700;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
}

.workspace-required-create:hover {
  filter: brightness(0.95);
}

.workspace-required-dismiss {
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(203, 213, 245, 0.4);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

.workspace-required-dismiss:hover {
  background: rgba(203, 213, 245, 0.08);
}

.layer-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.layer-panel-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.layer-button-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(218, 254, 139, 0.35);
  border-top-color: #dafe8b;
  margin-right: 0.35rem;
  vertical-align: -2px;
  animation: layer-button-spin 800ms linear infinite;
}

@keyframes layer-button-spin {
  to {
    transform: rotate(360deg);
  }
}

.layer-auto-classify-button:disabled,
.layer-reparse-button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.layer-auto-classify-button {
  background: transparent;
  color: #dafe8b;
  border: 1px solid #dafe8b;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.layer-auto-classify-button:hover {
  background: rgba(218, 254, 139, 0.1);
}

.layer-reparse-button {
  background: #dafe8b;
  color: #17200f;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.layer-reparse-button:hover {
  filter: brightness(0.95);
}

.layer-role-select {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  background: rgba(15, 23, 42, 0.6);
  color: #cbd5f5;
  border: 1px solid rgba(218, 254, 139, 0.3);
  border-radius: 4px;
  padding: 0.15rem 0.3rem;
  max-width: 100%;
}

.layer-role-select:focus-visible {
  outline: 1px solid #dafe8b;
}

.app-header-link {
  color: #dafe8b;
  text-decoration: none;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(218, 254, 139, 0.45);
  border-radius: 8px;
}

.app-header-link:hover {
  background: rgba(218, 254, 139, 0.1);
}

.features-page {
  max-width: 56rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.features-header {
  margin-bottom: 1.5rem;
}

.features-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
  color: #f1f0e8;
}

.features-subtitle {
  margin: 0 0 0.75rem;
  color: #cbd5f5;
}

.features-back {
  display: inline-block;
  margin-top: 0.4rem;
  color: #dafe8b;
  text-decoration: none;
  font-size: 0.9rem;
}

.features-back:hover {
  text-decoration: underline;
}

.features-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  counter-reset: features;
}

.features-card {
  counter-increment: features;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(218, 254, 139, 0.25);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.features-card::before {
  content: counter(features) ".";
  display: inline-block;
  font-weight: 700;
  color: #dafe8b;
  margin-right: 0.5rem;
}

.features-card h3 {
  display: inline;
  margin: 0;
  font-size: 1.05rem;
  color: #f1f0e8;
}

.features-card p {
  margin: 0.5rem 0 0;
  color: #d9d6c7;
  line-height: 1.55;
  font-size: 0.92rem;
}

.smd-candidate {
  fill: rgba(99, 102, 241, 0.12);
  stroke: #818cf8;
  stroke-width: 1.2;
  stroke-dasharray: 3 2;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

/* 페어링 모드 오버레이 — 실크 글자 후보(bbox)·부품 후보(center). 픽 상태는 is-selected로 강조. */
.silk-label-candidate {
  fill: rgba(250, 204, 21, 0.14);
  stroke: #facc15;
  stroke-width: 1.2;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.silk-label-candidate.is-selected {
  fill: rgba(250, 204, 21, 0.35);
  stroke: #f59e0b;
  stroke-width: 2;
}

/* 판독 커버리지 뷰 — 판독한 전 글자를 상태별 색으로 마킹(박스 없는 글자 = 미검출을 사람이 스캔).
   :not(.is-selected)로 한정해 위 .is-selected 강조가 항상 커버리지 색을 이기게 한다(선택 강조 보존).
   외곽선은 기존 1.2로 가늘게 두고 채움만 옅게 얹어 글자 가독을 해치지 않는다. */
.silk-label-candidate.coverage-matched:not(.is-selected) {
  fill: rgba(52, 211, 153, 0.1);
  stroke: #34d399; /* 초록 — 저장 페어 매칭 완료 */
}

.silk-label-candidate.coverage-merged:not(.is-selected) {
  fill: rgba(167, 139, 250, 0.1);
  stroke: #a78bfa; /* 보라 — 분리 성공 부모(merged) */
}

.silk-label-candidate.coverage-graphic:not(.is-selected) {
  fill: rgba(148, 163, 184, 0.1);
  stroke: #94a3b8; /* 청회색 — 그래픽 블롭 */
}

.silk-label-candidate.coverage-non-refdes:not(.is-selected) {
  fill: rgba(251, 146, 60, 0.1);
  stroke: #fb923c; /* 주황 — 비부품명 */
}

.silk-label-candidate.coverage-unread:not(.is-selected) {
  fill: rgba(250, 204, 21, 0.14);
  stroke: #facc15; /* 노랑 — 검출됐으나 미판독(강조 유지) */
}

/* 커버리지 범례 캡션(패널) — 색 의미를 1줄로 안내. 작고 옅게 두어 리스트를 밀지 않는다. */
.refdes-coverage-legend {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.4;
  opacity: 0.75;
}

.component-candidate {
  fill: rgba(52, 211, 153, 0.25);
  stroke: #34d399;
  stroke-width: 1.2;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.component-candidate.is-selected {
  fill: rgba(52, 211, 153, 0.6);
  stroke: #059669;
  stroke-width: 2;
}

/* 페어 리스트 패널 — 기본은 플로팅, is-embedded는 우측 도크 탭 내장(도크가 폭·스크롤 제공). */
.refdes-pair-panel {
  position: absolute;
  top: 52px;
  right: 12px;
  width: 300px;
  max-height: calc(100% - 72px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border, #cbd5f5);
  border-radius: 10px;
  background: var(--surface, #ffffff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  font-size: 12px;
  z-index: 30;
}

.refdes-pair-panel.is-embedded {
  position: static;
  width: auto;
  max-height: none;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  z-index: auto;
}

.refdes-pair-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refdes-pair-count {
  color: var(--muted-foreground, #64748b);
}

.refdes-pair-close {
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.refdes-pair-hint {
  margin: 0 0 6px;
  color: var(--muted-foreground, #64748b);
}

.refdes-pair-draft dl {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-gap: 2px 8px;
  gap: 2px 8px;
  margin: 0 0 8px;
}

.refdes-pair-draft dl > div {
  display: contents;
}

.refdes-pair-draft dt {
  color: var(--muted-foreground, #64748b);
}

.refdes-pair-draft dd {
  margin: 0;
}

.refdes-pair-draft-actions {
  display: flex;
  gap: 6px;
}

.refdes-pair-draft-actions input {
  flex: 1 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--border, #cbd5f5);
  border-radius: 6px;
}

.refdes-pair-empty {
  margin: 0;
  color: var(--muted-foreground, #64748b);
}

.refdes-pair-table {
  width: 100%;
  border-collapse: collapse;
}

.refdes-pair-table th,
.refdes-pair-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  text-align: left;
  white-space: nowrap;
}

.refdes-pair-text {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  -webkit-text-decoration: underline dotted;
          text-decoration: underline dotted;
}

.refdes-pair-footer {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.refdes-section-title {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.refdes-queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
}

.refdes-queue-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-bottom: 1px solid var(--border, #eef2f7);
}

.refdes-queue-row:last-child {
  border-bottom: none;
}

.refdes-queue-row.is-active {
  background: rgba(250, 204, 21, 0.18);
  outline: 1px solid #f59e0b;
}

.refdes-queue-row.is-matched .refdes-queue-status {
  color: #059669;
  font-weight: 600;
}

.refdes-queue-select {
  flex: 1 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: none;
  background: transparent;
  padding: 3px 2px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.refdes-queue-status {
  color: var(--muted-foreground, #64748b);
  white-space: nowrap;
}

.refdes-queue-coords {
  color: var(--muted-foreground, #94a3b8);
  white-space: nowrap;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.refdes-pair-actions {
  display: flex;
  gap: 2px;
}

.refdes-pair-actions button {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px 4px;
  color: var(--muted-foreground, #64748b);
}

.refdes-pair-actions button:hover {
  color: inherit;
}

/* 자동 판독 제안 섹션(Phase B UI 폴리시, §7) — 크롭 썸네일 고정 박스·카드형 행·은은한 배지.
   --border·--muted-foreground는 위 .refdes-pair-*·.refdes-queue-* 규칙과 동일한 폴백을 재사용한다.
   --surface(폴백 #ffffff)는 실사용 시 흰 카드가 되어 이 다크 도크와 충돌하므로 배경엔 쓰지 않고,
   이 도크 안 다른 카드(.dock-tabs·.panel-section)와 같은 반투명 화이트 오버레이 관례를 따른다. */
.refdes-auto {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.refdes-auto-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.refdes-auto-read {
  align-self: flex-start;
  border: 1px solid var(--border, #cbd5f5);
  border-radius: 6px;
  background: transparent;
  padding: 4px 10px;
  font: inherit;
  font-weight: 600;
  color: var(--foreground, #f1f0e8);
  cursor: pointer;
}

.refdes-auto-read:hover:not(:disabled) {
  border-color: #dafe8b;
  background: rgba(218, 254, 139, 0.1);
  color: #dafe8b;
}

.refdes-auto-read:disabled {
  opacity: 0.5;
  cursor: default;
}

.refdes-auto-disabled {
  margin: 0;
  color: var(--muted-foreground, #64748b);
  font-size: 11px;
}

.refdes-auto-suggestions-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.refdes-auto-suggestions-head .refdes-section-title {
  margin: 0;
}

/* 임계 슬라이더 행 — 슬라이더가 남는 폭을 채우고, 현재 %와 승인 버튼이 우측에 붙는다. */
.refdes-auto-threshold-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refdes-auto-threshold {
  /* 고정폭 — 슬라이더가 flex:1이면 옆 버튼 라벨 폭 변화에 밀려 드래그 중 트랙이 흔들린다. */
  flex: 0 0 96px;
  width: 96px;
  accent-color: #dafe8b;
  cursor: pointer;
}

.refdes-auto-threshold:disabled {
  opacity: 0.5;
  cursor: default;
}

.refdes-auto-threshold-value {
  min-width: 34px;
  text-align: right;
  color: var(--foreground, #f1f0e8);
  font-size: 11px;
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.refdes-auto-approve-all {
  /* 남는 폭을 채우는 고정 박스 — 라벨(퍼센트·건수) 글자수가 변해도 박스는 그대로라 슬라이더가 안 밀린다. */
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border, #cbd5f5);
  border-radius: 6px;
  background: transparent;
  padding: 3px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground, #64748b);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.refdes-auto-approve-all:hover:not(:disabled) {
  border-color: #dafe8b;
  color: #dafe8b;
}

.refdes-auto-approve-all:disabled {
  opacity: 0.5;
  cursor: default;
}

.refdes-auto-list {
  list-style: none;
  /* 위쪽 임계 슬라이더 행과 첫 썸네일 카드가 붙어 보이지 않게 상단 간격 확보. */
  margin: 6px 0 0;
  padding: 0 2px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

/* 카드형 행 — 썸네일(왼쪽)과 텍스트 스택(오른쪽)을 grid로, 승인/거절은 우측 별도 열. */
.refdes-auto-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.refdes-auto-row:hover {
  border-color: rgba(218, 254, 139, 0.5);
  background: rgba(218, 254, 139, 0.07);
}

.refdes-auto-select {
  flex: 1 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 96px 1fr auto;
  grid-template-areas:
    "thumb text conf"
    "thumb coords coords";
  align-items: center;
  grid-column-gap: 8px;
  column-gap: 8px;
  grid-row-gap: 1px;
  row-gap: 1px;
  border: none;
  background: transparent;
  padding: 5px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

/* 고정 크기 박스 — 세로형(C27)·가로형(RP594) 등 크롭 종횡비가 제각각이어도 모두 이 박스에 맞춘다.
   src 로딩 전에도 width/height가 고정이라 레이아웃 점프가 없다. 검은 배경 크롭과 자연스럽게 blend되도록
   배경은 앱 다크 팔레트(body 그라디언트 어두운 쪽)와 맞춘 하드코딩 색을 쓴다(불가피한 예외). */
.refdes-auto-crop {
  grid-area: thumb;
  width: 96px;
  height: 60px;
  object-fit: contain;
  background: #0a0d08;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

/* blob objectURL이 아직 없는 로딩 구간 — src 속성 자체가 없다(RefdesCropThumbnail이 undefined로 둔다).
   그대로 두면 크롬이 깨진 이미지 아이콘 + alt 텍스트를 그려 목록이 지저분해지므로, src가 붙기 전엔
   박스 자리만 유지하고 내용은 숨긴다(레이아웃 점프 없이 로드 완료 시 자연스럽게 나타난다). */
.refdes-auto-crop:not([src]) {
  visibility: hidden;
}

.refdes-auto-text {
  grid-area: text;
  min-width: 0;
  overflow: hidden;
  color: var(--foreground, #f1f0e8);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refdes-auto-confidence {
  grid-area: conf;
  justify-self: end;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  color: var(--muted-foreground, #64748b);
  font-size: 10px;
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.refdes-auto-coords {
  grid-area: coords;
  min-width: 0;
  overflow: hidden;
  color: var(--muted-foreground, #94a3b8);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.refdes-auto-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 4px 6px 4px 0;
}

.refdes-auto-actions button {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  padding: 0;
  color: var(--muted-foreground, #64748b);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

/* 순서가 고정(승인 ✓ 먼저, 거절 × 나중)이라 JSX에 클래스를 더하지 않고 위치로 구분한다. */
.refdes-auto-actions button:first-child:hover:not(:disabled) {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.14);
  color: #34d399;
}

.refdes-auto-actions button:last-child:hover:not(:disabled) {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

.refdes-auto-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

.feature-chip {
  border: 1px solid var(--border, #cbd5f5);
  background: transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.feature-chip:hover {
  background: rgba(99, 102, 241, 0.1);
}

.auto-classify-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 1rem;
}

.auto-classify-card {
  background: #1a1d23;
  border: 1px solid rgba(218, 254, 139, 0.32);
  border-radius: 12px;
  padding: 1.5rem 1.75rem 1.4rem;
  width: min(440px, 100%);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
}

.auto-classify-card[data-phase="done"] {
  border-color: rgba(218, 254, 139, 0.6);
}

.auto-classify-card[data-phase="error"] {
  border-color: rgba(255, 138, 138, 0.55);
}

.auto-classify-card h3 {
  margin: 0 0 0.85rem;
  font-size: 1.02rem;
  color: #dafe8b;
}

.auto-classify-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(218, 254, 139, 0.22);
  border-top-color: #dafe8b;
  margin: 0.4rem auto 1rem;
  animation: auto-classify-spin 800ms linear infinite;
}

@keyframes auto-classify-spin {
  to {
    transform: rotate(360deg);
  }
}

.auto-classify-body {
  margin: 0 0 0.75rem;
  font-size: 0.93rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
}

.auto-classify-body--done {
  color: #dafe8b;
  font-weight: 500;
}

.auto-classify-body--error {
  color: #ff8a8a;
}

.auto-classify-steps {
  margin: 0 0 0.75rem 1.1rem;
  padding: 0;
  font-size: 0.86rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.72);
}

.auto-classify-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(218, 254, 139, 0.14);
  overflow: hidden;
  margin: 0.4rem 0 1rem;
}

.auto-classify-progress__fill {
  height: 100%;
  border-radius: 999px;
  /* 흐르는 그라데이션 — 진행률이 상한에 가까워 폭 변화가 작아져도 바가 계속 살아 움직여 멈춘 느낌을 없앤다. */
  background: linear-gradient(90deg, #a9d94f 0%, #dafe8b 50%, #a9d94f 100%);
  background-size: 200% 100%;
  animation: auto-classify-shimmer 1.1s linear infinite;
  transition: width 220ms linear;
}

@keyframes auto-classify-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.auto-classify-reviewing {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.35rem;
  font-size: 0.94rem;
  font-weight: 500;
  color: #dafe8b;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.auto-classify-reviewing__role {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
}

.auto-classify-progress__count {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.auto-classify-hint {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
}

.auto-classify-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.9rem;
}

.auto-classify-ok {
  background: #dafe8b;
  color: #0e1116;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.4rem;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}

.auto-classify-ok:hover {
  background: #c8ed72;
}

.auto-classify-ok:focus-visible {
  outline: 2px solid #dafe8b;
  outline-offset: 2px;
}

.export-stencil-warning {
  display: inline-block;
  color: #ffd166;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-radius: 6px;
  background: rgba(255, 209, 102, 0.08);
}

.export-stencil-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.export-stencil-toggle input[type="checkbox"] {
  cursor: pointer;
  accent-color: #dafe8b;
}

.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1200;
  max-width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem 0.7rem 1rem;
  border-radius: 10px;
  background: #1a1d23;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  border-left: 4px solid #94a3b8;
  pointer-events: auto;
  animation: toast-slide-in 220ms ease-out;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast[data-kind="error"] {
  border-left-color: #ff8a8a;
}

.toast[data-kind="warning"] {
  border-left-color: #ffd166;
}

.toast[data-kind="info"] {
  border-left-color: #dafe8b;
}

.toast-message {
  flex: 1 1;
  white-space: pre-wrap;
}

.toast-dismiss {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.15rem;
  margin-top: -1px;
}

.toast-dismiss:hover {
  color: rgba(255, 255, 255, 0.95);
}

.toast-dismiss:focus-visible {
  outline: 2px solid rgba(218, 254, 139, 0.6);
  outline-offset: 2px;
}

.workflow-stepper {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.4rem;
  margin: 0;
  list-style: none;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  overflow-x: auto;
  scrollbar-width: thin;
}

.workflow-step {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.85rem 0.32rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
  color: rgba(255, 255, 255, 0.5);
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.workflow-step + .workflow-step::before {
  content: "→";
  margin-right: 0.45rem;
  margin-left: -0.1rem;
  color: rgba(255, 255, 255, 0.22);
}

.workflow-step[data-state="active"] {
  background: rgba(218, 254, 139, 0.12);
  border-color: rgba(218, 254, 139, 0.5);
  color: #dafe8b;
  font-weight: 500;
}

.workflow-step[data-state="done"] {
  color: rgba(218, 254, 139, 0.78);
}

.workflow-step-index {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.75);
}

.workflow-step[data-state="active"] .workflow-step-index {
  background: #dafe8b;
  color: #0e1116;
}

.workflow-step[data-state="done"] .workflow-step-index {
  background: rgba(218, 254, 139, 0.15);
  color: #dafe8b;
}

.opening-map-more {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.75rem;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  align-self: center;
}

.canvas-mode-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

.tools-menu {
  position: relative;
  display: inline-block;
}

.tools-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(218, 254, 139, 0.32);
  border-radius: 7px;
  padding: 0.32rem 0.7rem;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
}

.tools-menu-trigger:hover,
.tools-menu-trigger.is-open {
  border-color: #dafe8b;
  color: #dafe8b;
}

.tools-menu-trigger-label {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: rgba(218, 254, 139, 0.75);
}

.tools-menu-trigger-active {
  font-size: 0.82rem;
  color: inherit;
}

.tools-menu-caret {
  font-size: 0.7rem;
  opacity: 0.7;
}

.tools-menu-list {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #1a1d23;
  border: 1px solid rgba(218, 254, 139, 0.3);
  border-radius: 9px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.55);
  z-index: 60;
  min-width: 240px;
}

.tools-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  grid-gap: 0.55rem;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.tools-menu-item:hover {
  background: rgba(218, 254, 139, 0.1);
  border-color: rgba(218, 254, 139, 0.35);
}

.tools-menu-item.is-active {
  background: rgba(218, 254, 139, 0.15);
  border-color: rgba(218, 254, 139, 0.5);
}

.tools-menu-item-icon {
  font-size: 1.05rem;
  line-height: 1.3;
}

.tools-menu-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.tools-menu-item-label {
  font-size: 0.88rem;
  color: #f4f8e7;
  font-weight: 500;
}

.tools-menu-item-desc {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.35;
}

.tools-menu-item-check {
  color: #dafe8b;
  font-size: 0.9rem;
  align-self: center;
}

.canvas-mode-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  padding: 0.32rem 0.85rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
}

.canvas-mode-btn:hover {
  border-color: rgba(218, 254, 139, 0.5);
  color: #dafe8b;
}

.canvas-mode-btn.is-active {
  background: #dafe8b;
  border-color: #dafe8b;
  color: #0e1116;
  font-weight: 600;
}

.canvas-mode-count {
  margin-left: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(218, 254, 139, 0.15);
  color: #dafe8b;
  font-size: 0.78rem;
  font-weight: 500;
}

.geometry-svg.is-select-mode {
  cursor: crosshair;
}

/* Shift 홀드 = 그룹 추가 모드. OS가 화살표 옆에 + 배지를 그려 "추가된다"는 느낌을 준다.
   개구 위에서도 배지를 유지하도록 .geometry-opening(default)까지 함께 덮는다.
   리사이즈 핸들·페어링 픽 등 기능 커서는 인라인 style이라 우선순위로 영향받지 않는다. */
.geometry-svg.is-shift-grouping {
  cursor: copy;
}

.geometry-svg.is-shift-grouping .geometry-opening {
  cursor: copy;
}

.canvas-selection-box {
  fill: rgba(218, 254, 139, 0.08);
  stroke: #dafe8b;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.batch-action-panel {
  background: rgba(218, 254, 139, 0.06);
  border-bottom: 1px solid rgba(218, 254, 139, 0.22);
  padding: 0.6rem 0.9rem 0.75rem;
  display: grid;
  grid-gap: 0.55rem;
  gap: 0.55rem;
  font-size: 0.85rem;
}

.batch-action-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 0.35rem;
  gap: 0.35rem;
}

.batch-action-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  padding: 0.5rem 0.4rem 0.55rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.batch-action-tab:hover {
  border-color: rgba(218, 254, 139, 0.45);
  color: #dafe8b;
}

.batch-action-tab.is-active {
  border-color: #dafe8b;
  background: rgba(218, 254, 139, 0.15);
  color: #dafe8b;
  font-weight: 600;
}

.batch-action-tab-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.batch-action-tab-label {
  font-size: 0.78rem;
  line-height: 1.25;
}

.batch-action-card {
  display: grid;
  grid-gap: 0.45rem;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem 0.6rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(218, 254, 139, 0.18);
  border-radius: 8px;
}

.batch-action-card-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.85rem;
  line-height: 1.45;
}

.batch-action-card-example {
  margin: 0;
  color: rgba(218, 254, 139, 0.78);
  font-size: 0.76rem;
  line-height: 1.4;
}

.batch-action-card-warning {
  margin: 0;
  color: #ffd166;
  font-size: 0.78rem;
  line-height: 1.4;
}

.batch-action-card-note {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
  font-style: italic;
}

.batch-action-apply-danger {
  background: #ff8a8a !important;
  border-color: #ff8a8a !important;
  color: #1a0606 !important;
}

.batch-action-apply-danger:hover:not(:disabled) {
  background: #ff6b6b !important;
}

.batch-action-distribution {
  margin: 0;
  padding: 0.32rem 0.6rem;
  font-size: 0.78rem;
  color: rgba(218, 254, 139, 0.85);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
}

.geometry-opening.is-batch-highlighted {
  stroke: #dafe8b !important;
  stroke-width: 2.5 !important;
  filter: drop-shadow(0 0 4px rgba(218, 254, 139, 0.85));
  animation: batch-highlight-pulse 1.4s ease-in-out infinite;
}

@keyframes batch-highlight-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 3px rgba(218, 254, 139, 0.7));
  }
  50% {
    filter: drop-shadow(0 0 7px rgba(218, 254, 139, 1));
  }
}

.batch-action-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.batch-action-header strong {
  color: #dafe8b;
  font-size: 0.92rem;
}

.batch-action-target-count {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.8rem;
}

.batch-action-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  line-height: 1.45;
}

.batch-action-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.batch-action-field > span {
  color: rgba(255, 255, 255, 0.85);
}

.batch-action-percent-row {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.batch-action-percent-row input {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(218, 254, 139, 0.3);
  border-radius: 6px;
  color: #f4f8e7;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  font-size: 0.9rem;
  width: 5rem;
}

.batch-action-percent-row input:focus-visible {
  outline: 2px solid rgba(218, 254, 139, 0.6);
  outline-offset: 1px;
}

.batch-action-percent-row > span {
  color: rgba(255, 255, 255, 0.7);
}

.batch-action-explainer {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.74rem;
  line-height: 1.4;
}

.batch-action-buttons {
  display: flex;
  gap: 0.45rem;
  justify-content: flex-end;
}

.batch-action-clear,
.batch-action-apply {
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: 6px;
  padding: 0.42rem 1rem;
  cursor: pointer;
}

.batch-action-clear {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.7);
}

.batch-action-clear:hover {
  border-color: rgba(255, 138, 138, 0.5);
  color: #ff8a8a;
}

.batch-action-apply {
  background: #dafe8b;
  border: 1px solid #dafe8b;
  color: #0e1116;
  font-weight: 600;
}

.batch-action-apply:hover:not(:disabled) {
  background: #c8ed72;
}

.batch-action-apply:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================================================
   우측 패널 재편성 — 공통 토큰 + 레이아웃 프리미티브
   (PLAN_RIGHT_PANEL_REDESIGN.md Phase 1)
   목적: 320px 폭에서 어떤 콘텐츠도 겹치지 않도록 모든 패널 섹션/행을 한 패턴으로 통일.
   핵심 규칙 — 모든 grid/flex 아이템에 min-width:0, 모든 텍스트에 overflow-wrap:anywhere.
   ============================================================================ */
:root {
  --panel-font-sm: 0.72rem; /* 라벨·메타 */
  --panel-font-md: 0.82rem; /* 본문·값 */
  --panel-font-lg: 0.95rem; /* 섹션/패널 제목 */
  --panel-gap: 0.6rem;      /* 행 간격 */
  --panel-pad: 0.75rem;     /* 카드 패딩 */
}

/* 섹션 카드 — 모든 우측 패널 섹션 공통(fieldset 대신 div로 legend 버그 회피) */
.panel-section {
  display: flex;
  flex-direction: column;
  gap: var(--panel-gap);
  padding: var(--panel-pad);
  margin: 0;
  min-width: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
}

.panel-section__title {
  margin: 0;
  font-size: var(--panel-font-lg);
  font-weight: 600;
  color: #f3fff0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 라벨+컨트롤 단위 — 기본 세로 stack(라벨 위/값 아래). 좁은 폭에서 절대 안 겹친다. */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  font-size: var(--panel-font-md);
}

.field__label {
  font-size: var(--panel-font-sm);
  color: #94a3b8;
  min-width: 0;
  overflow-wrap: anywhere;
}

.field__value {
  margin: 0;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* 짧은 라벨/값을 한 줄로 — 양쪽 min-width:0로 오버플로 겹침 차단 */
.field--inline {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  grid-gap: 0.5rem;
  gap: 0.5rem;
  align-items: start;
}

/* 가로 배치(체크박스 등) */
.field--row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

/* 입력 컨트롤은 패널 폭에 맞게 줄어들게 */
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* 텍스트류 입력을 우측 레일 다크 테마로(체크박스 제외). */
.field input:not([type="checkbox"]),
.field select,
.field textarea {
  padding: 0.4rem 0.6rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.35);
  background: #10131c;
  color: rgba(255, 255, 255, 0.92);
  font-size: var(--panel-font-md);
}

.field input:disabled,
.field select:disabled {
  opacity: 0.5;
}

/* 체크박스는 전폭 규칙에서 제외 — 라벨과 나란히 좌측 정렬(가로 행이 밀리지 않게). */
.field--row input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* 패널 저장/실행 버튼 — 강조(녹색), 패널 폭에 맞게 */
.panel-save-button {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid rgba(218, 255, 139, 0.45);
  border-radius: 12px;
  background: #dafe8b;
  color: #17200f;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.panel-save-button:hover {
  background: #e6ffa0;
}

.panel-save-button:disabled {
  background: rgba(218, 254, 139, 0.25);
  color: rgba(241, 240, 232, 0.55);
  cursor: not-allowed;
}

/* 거버 다운로드 차단 모달 — 다운로드 중 화면을 덮어 클릭을 가로채(취소 방지) 진행바로 진행율을 보여준다. */
.export-download-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 1rem;
}

.export-download-card {
  background: #1a1d23;
  border: 1px solid rgba(218, 254, 139, 0.32);
  border-radius: 12px;
  padding: 1.5rem 1.75rem 1.4rem;
  width: min(420px, 100%);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
}

.export-download-title {
  margin: 0 0 0.9rem;
  font-size: 1rem;
}

.export-download-bar {
  position: relative;
  height: 18px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
}

.export-download-fill {
  height: 100%;
  background: linear-gradient(90deg, #b6e35a, #dafe8b);
  border-radius: 6px;
  transition: width 200ms ease-out;
}

.export-download-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #10131c;
}

.export-download-body {
  margin: 0.8rem 0 0;
  font-size: 0.8rem;
  color: #cbd5f5;
}

/* RefDes 자동 판독 진행 모달 — AutoClassify/ExportDownload와 같은 전체 화면 차단 모달 계열.
   서버 판독은 실제 % 진행률이 없어 무한(indeterminate) 바 + 경과 시간(초)만 정직하게 보여준다.
   z-index 1350: confirm-dialog(1300)·toast(1200) 등 기존 모든 모달 오버레이 위(호버 툴팁 9999은 차단 중 무관).
   카드 배경은 var(--surface)(폴백 #ffffff=흰색)를 피하고, 이 앱 다크 차단 모달 관례(#1a1d23)를 따른다(위 export-download 참조). */
.refdes-auto-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1350;
  padding: 1rem;
}

.refdes-auto-modal-card {
  background: #1a1d23;
  border: 1px solid rgba(218, 254, 139, 0.32);
  border-radius: 12px;
  padding: 1.5rem 1.75rem 1.4rem;
  width: min(420px, 100%);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
}

.refdes-auto-modal-title {
  margin: 0 0 1rem;
  font-size: 1.02rem;
  color: #dafe8b;
}

.refdes-auto-modal-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: rgba(218, 254, 139, 0.14);
  overflow: hidden;
  margin: 0.4rem 0 1rem;
}

/* 좌→우로 반복 이동하는 하이라이트 세그먼트 — 실제 % 없이 '작업 진행 중'을 무한 표현한다. */
.refdes-auto-modal-bar__seg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(218, 254, 139, 0) 0%,
    #dafe8b 50%,
    rgba(218, 254, 139, 0) 100%
  );
  animation: refdes-auto-modal-indeterminate 1.3s ease-in-out infinite;
}

@keyframes refdes-auto-modal-indeterminate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

.refdes-auto-modal-elapsed {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

.refdes-auto-modal-hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
}

/* 파괴적 동작(영구 삭제) 확인 모달 — 화면을 덮어 확인/취소 전까지 다른 조작을 막는다. */
.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  padding: 1rem;
}

.confirm-dialog-card {
  background: #1a1d23;
  border: 1px solid rgba(255, 120, 120, 0.35);
  border-radius: 12px;
  padding: 1.4rem 1.6rem;
  width: min(420px, 100%);
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
}

.confirm-dialog-title {
  margin: 0 0 0.7rem;
  font-size: 1rem;
}

.confirm-dialog-message {
  margin: 0 0 1.1rem;
  font-size: 0.85rem;
  color: #cbd5f5;
  line-height: 1.5;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.confirm-dialog-cancel,
.confirm-dialog-confirm {
  border-radius: 7px;
  padding: 0.4rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.confirm-dialog-cancel {
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(203, 213, 245, 0.4);
}

.confirm-dialog-confirm {
  background: #ff6b6b;
  color: #10131c;
  border: 1px solid #ff6b6b;
}

.confirm-dialog-confirm:disabled,
.confirm-dialog-cancel:disabled {
  opacity: 0.5;
  cursor: default;
}

/* 룰 저장 이름 입력 다이얼로그 — confirm-dialog 골격 재사용, 입력과 저장(긍정) 버튼만 별도 스타일. */
.vendor-rule-capture-input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1.1rem;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.35);
  background: #10131c;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.85rem;
}

.vendor-rule-capture-input:disabled {
  opacity: 0.5;
  cursor: default;
}

/* n=1 제네릭 풋프린트 경고 — 저장은 그대로 가능, 오인매칭 주의만 알린다(호박색). */
.vendor-rule-capture-warning {
  margin: -0.3rem 0 0.9rem;
  padding: 0.5rem 0.7rem;
  border-radius: 7px;
  border: 1px solid rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.1);
  color: #f6d873;
  font-size: 0.78rem;
  line-height: 1.5;
}

.vendor-rule-capture-confirm {
  background: #dafe8b;
  border-color: #dafe8b;
  color: #17200f;
}

/* 프리픽스 룰 생성 폼 — 필드를 균일한 세로 스택(라벨 위·입력 아래)으로 정렬, confirm-dialog 골격 재사용. */
.vendor-prefix-rule-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vendor-prefix-rule-card .confirm-dialog-title {
  margin: 0;
}

.vendor-prefix-rule-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: #cbd5f5;
}

.vendor-prefix-rule-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.35);
  background: #10131c;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.85rem;
}

.vendor-prefix-rule-input:disabled {
  opacity: 0.5;
  cursor: default;
}

.vendor-prefix-rule-ops {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
}

.vendor-prefix-rule-ops label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.vendor-prefix-rule-warning {
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 7px;
  border: 1px solid rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.1);
  color: #f6d873;
  font-size: 0.78rem;
  line-height: 1.5;
}

.vendor-prefix-rule-error {
  margin: 0;
  color: #ff8f8f;
  font-size: 0.78rem;
}

/* 인스펙터 실크 연결 섹션 — 글자 후보 목록·refdes 입력을 패널 다크 테마로 정렬(기본 불릿·브라우저 스타일 제거). */
.silk-link {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(203, 213, 245, 0.15);
}

.silk-link-title {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.92);
}

.silk-link-saved {
  margin: 0;
  font-size: 0.8rem;
  color: #cbd5f5;
}

.silk-link-empty {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(203, 213, 245, 0.6);
}

.silk-link-create-prefix-rule {
  align-self: flex-start;
  padding: 0.35rem 0.8rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.4);
  background: transparent;
  color: #cbd5f5;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.silk-link-create-prefix-rule:hover:not(:disabled) {
  border-color: #dafe8b;
  color: #dafe8b;
}

.silk-link-create-prefix-rule:disabled {
  opacity: 0.5;
  cursor: default;
}

.silk-link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.silk-link-select {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.25);
  background: #10131c;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
}

.silk-link-select:hover {
  border-color: rgba(218, 254, 139, 0.6);
}

.silk-link-row.is-active .silk-link-select {
  border-color: #dafe8b;
  background: rgba(218, 254, 139, 0.12);
}

.silk-link-distance {
  color: rgba(203, 213, 245, 0.6);
  font-size: 0.74rem;
  white-space: nowrap;
}

.silk-link-draft {
  display: flex;
  gap: 0.5rem;
}

.silk-link-draft input {
  flex: 1 1;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.4rem 0.6rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.35);
  background: #10131c;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
}

.silk-link-draft input:disabled {
  opacity: 0.5;
}

.silk-link-draft button {
  padding: 0.4rem 0.8rem;
  border-radius: 7px;
  border: 1px solid #dafe8b;
  background: #dafe8b;
  color: #17200f;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.silk-link-draft button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* 저장된 룰 관리 모달 — 목록 카드를 화면 중앙에 띄운다(삭제 확인은 별도 ConfirmDialog가 위에 겹친다). */
.vendor-rule-list-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1280;
  padding: 1rem;
}

.vendor-rule-list-card {
  background: #1a1d23;
  border: 1px solid rgba(120, 160, 255, 0.28);
  border-radius: 12px;
  padding: 1.3rem 1.5rem;
  width: min(640px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.92);
}

.vendor-rule-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

/* 제목 + 워크스페이스(고객사) 부제 스택 — 룰이 어느 고객사 자산인지 헤더에서 바로 보인다. */
.vendor-rule-list-heading {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.vendor-rule-list-workspace {
  font-size: 0.78rem;
  color: #9fb0d9;
}

.vendor-rule-list-close {
  background: transparent;
  border: none;
  color: #cbd5f5;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.vendor-rule-list-error {
  margin: 0 0 0.8rem;
  font-size: 0.82rem;
  color: #ff9b9b;
}

.vendor-rule-list-empty {
  margin: 0.6rem 0;
  font-size: 0.85rem;
  color: #cbd5f5;
}

.vendor-rule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.vendor-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) auto auto;
  align-items: center;
  grid-gap: 0.7rem;
  gap: 0.7rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.vendor-rule-row-name {
  display: flex;
  gap: 0.4rem;
}

.vendor-rule-name-input {
  min-width: 0;
  flex: 1 1;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(203, 213, 245, 0.35);
  background: #10131c;
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.8rem;
}

.vendor-rule-name-save {
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  border: 1px solid rgba(120, 160, 255, 0.5);
  background: transparent;
  color: #cbd5f5;
  font-size: 0.78rem;
  cursor: pointer;
}

.vendor-rule-row-sig {
  font-size: 0.76rem;
  color: #9fb0d0;
  word-break: break-all;
}

.vendor-rule-row-active {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #cbd5f5;
  white-space: nowrap;
}

.vendor-rule-row-delete {
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: transparent;
  color: #ff9b9b;
  font-size: 0.78rem;
  cursor: pointer;
}

.vendor-rule-row-delete:hover {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.vendor-rule-name-save:disabled,
.vendor-rule-name-input:disabled,
.vendor-rule-row-delete:disabled {
  opacity: 0.5;
  cursor: default;
}

.vendor-rule-suggest-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 제안 가져오기·룰 관리 — 다크 테마 아웃라인 보조 버튼(브라우저 기본 흰 버튼 제거). */
.vendor-rule-suggest-actions button {
  padding: 0.35rem 0.8rem;
  border-radius: 7px;
  border: 1px solid rgba(203, 213, 245, 0.4);
  background: transparent;
  color: #cbd5f5;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.vendor-rule-suggest-actions button:hover:not(:disabled) {
  border-color: #dafe8b;
  color: #dafe8b;
}

.vendor-rule-suggest-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* 룰 적용 전체 취소 — 파괴적 동작이라 적색 톤으로 구분. */
.vendor-rule-suggest-actions .vendor-rule-revert-all {
  color: #ff9b9b;
  border-color: rgba(255, 107, 107, 0.5);
}

.vendor-rule-suggest-actions .vendor-rule-revert-all:hover:not(:disabled) {
  background: rgba(255, 107, 107, 0.15);
  border-color: #ff6b6b;
  color: #ff6b6b;
}

/* 레이어 행 삭제 버튼 + 헤더 모두 삭제 버튼(빨강 강조). */
.layer-action-delete {
  color: #ff9b9b;
}

.layer-action-delete:hover {
  background: rgba(255, 107, 107, 0.15);
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.layer-delete-all-button {
  background: transparent;
  color: #ff9b9b;
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.layer-delete-all-button:hover {
  background: rgba(255, 107, 107, 0.15);
  border-color: #ff6b6b;
  color: #ff6b6b;
}

/* flash를 실제 aperture 모양(사각/원)으로 그릴 때의 채움 스타일. */
.geometry-flash-shape {
  fill-opacity: 0.9;
  stroke: none;
}

/* 마스크 유도 스텐실 경고 배너 — 페이스트 레이어 없이 유도된 개구부는 확인 전 export 불가(cad.md §1.1). */
.mask-derived-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 170, 60, 0.12);
  border: 1px solid rgba(255, 170, 60, 0.5);
  border-radius: 8px;
  font-size: 0.82rem;
  color: #ffd79a;
}

.mask-derived-banner.is-acknowledged {
  background: rgba(120, 200, 120, 0.1);
  border-color: rgba(120, 200, 120, 0.4);
  color: #b7e6b7;
}

.mask-derived-banner__text {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* 드릴(DRL/NC) 부재 경고 — 유도 배너 안에서 한 단계 더 강한 톤으로 구분한다. */
.mask-derived-banner__drill-warning {
  flex-basis: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #ffb4a2;
  font-weight: 600;
}

.mask-derived-banner__ack {
  margin-left: auto;
  font-weight: 600;
}

.mask-derived-banner__button {
  margin-left: auto;
  background: #ffce4a;
  color: #10131c;
  border: none;
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}

/* 소스 면(top/bottom) 토글 — 마스크 유도 단면 스텐실의 소스 면을 바꾼다(CAM350식). */
.mask-derived-banner__source {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.mask-derived-banner__source-label {
  font-size: 0.76rem;
  opacity: 0.85;
}

.mask-derived-banner__source-button {
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  border: 1px solid rgba(255, 170, 60, 0.5);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.mask-derived-banner__source-button.is-selected {
  background: #ffce4a;
  color: #10131c;
  border-color: #ffce4a;
}

.mask-derived-banner__source-button:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* 백오피스 admin 콘솔 — 다크 톤, BEM 관례(admin__element, is-active/is-disabled). Stage 2에서 카드로 확장. */
.admin {
  display: flex;
  gap: 16px;
  height: 100%;
  padding: 16px;
  box-sizing: border-box;
  color: #e6e9f2;
}

.admin__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  padding: 12px;
  background: #12151f;
  border: 1px solid #232838;
  border-radius: 8px;
}

.admin__nav-item {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #9aa3ba;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.admin__nav-item.is-active {
  background: #1d2740;
  color: #e6e9f2;
  font-weight: 600;
}

.admin__nav-item.is-disabled {
  color: #575e73;
  cursor: not-allowed;
}

.admin__content {
  flex: 1 1;
  min-width: 0;
  padding: 12px 4px;
}

.admin__dashboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #e6e9f2;
}

.admin__placeholder {
  margin: 0;
  font-size: 13px;
  color: #9aa3ba;
}

.admin--pending {
  min-height: 1px;
}

/* admin usage view — 기간·축 토글 + 사용량 표(Stage 0 다크 톤 유지) */
a.admin__nav-item {
  text-decoration: none;
  cursor: pointer;
}

.admin__usage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin__usage-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.admin__usage-axis,
.admin__usage-period {
  display: flex;
  gap: 4px;
}

.admin__toggle {
  padding: 6px 12px;
  font-size: 13px;
  color: #9aa3ba;
  background: #12151f;
  border: 1px solid #232838;
  border-radius: 6px;
  cursor: pointer;
}

.admin__toggle.is-active {
  background: #1d2740;
  color: #e6e9f2;
  border-color: #2f3a5c;
  font-weight: 600;
}

.admin__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin__table th,
.admin__table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #232838;
  vertical-align: top;
}

.admin__table th {
  color: #9aa3ba;
  font-weight: 600;
}

.admin__table tfoot td {
  font-weight: 600;
  color: #e6e9f2;
}

.admin__usage-features {
  margin: 0;
  padding-left: 14px;
  color: #9aa3ba;
}

.admin__usage-status {
  font-size: 13px;
  color: #9aa3ba;
}

.admin__usage-status--error {
  color: #f2a3a3;
}

/* admin dashboard — 요약 카드 그리드(총계·7일 활동·7일 LLM·업로드). 다크 톤·BEM 유지 */
.admin__cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.admin__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin__section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7f889e;
}

.admin__card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-gap: 12px;
  gap: 12px;
}

.admin__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: #12151f;
  border: 1px solid #232838;
  border-radius: 8px;
}

.admin__card--wide {
  grid-column: 1 / -1;
}

.admin__card-title {
  font-size: 12px;
  font-weight: 600;
  color: #9aa3ba;
}

.admin__card-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: #e6e9f2;
}

.admin__card-sub {
  font-size: 12px;
  color: #7f889e;
}

.admin__card-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  grid-gap: 10px 16px;
  gap: 10px 16px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.admin__card-metrics li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin__card-metrics span {
  font-size: 12px;
  color: #9aa3ba;
}

.admin__card-metrics strong {
  font-size: 18px;
  font-weight: 700;
  color: #e6e9f2;
}

/* Stage 3 — 공용 AdminTable(정렬·페이지네이션)·Modal·테넌트 브라우저. 다크 톤·BEM 유지. */
.admin-table__wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-table__sort {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #9aa3ba;
  cursor: pointer;
}

.admin-table__sort.is-active {
  color: #e6e9f2;
}

.admin-table__row.is-clickable {
  cursor: pointer;
}

.admin-table__row.is-clickable:hover {
  background: #161a26;
}

.admin-table__pagination {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-table__page-info {
  font-size: 12px;
  color: #7f889e;
}

.admin__toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal__overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 12, 0.66);
}

.modal__card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(720px, 100%);
  max-height: 84vh;
  overflow: auto;
  padding: 18px 20px;
  background: #12151f;
  border: 1px solid #2f3a5c;
  border-radius: 10px;
  color: #e6e9f2;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal__close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #9aa3ba;
  cursor: pointer;
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin__tenants {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin__tenants-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.admin__tenants-search {
  padding: 6px 10px;
  font-size: 13px;
  color: #e6e9f2;
  background: #12151f;
  border: 1px solid #232838;
  border-radius: 6px;
  min-width: 220px;
}

.admin__tenants-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #9aa3ba;
}

.admin__tenant-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin__member-list,
.admin__ws-list,
.admin__project-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #c3c9da;
}

.admin__member {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-bottom: 1px solid #232838;
}

.admin__member-email {
  font-weight: 600;
  color: #e6e9f2;
}

.admin__member-login {
  font-size: 12px;
  color: #7f889e;
}

.admin__role-options {
  display: flex;
  flex-direction: column;
  min-width: 120px;
}

.admin__role-option {
  padding: 6px 10px;
  text-align: left;
  background: none;
  border: none;
  font: inherit;
  color: #c3c9da;
  cursor: pointer;
}

.admin__role-option:hover {
  background: #1d2740;
  color: #e6e9f2;
}

