/* 모달 ds-modal · 확인 대화상자 ds-confirm · 뒤 어둡게 ds-scrim · 대화상자 층 ds-dialog-layer (DESIGN 6-3-0 · 6-3-1 · 6-3-2 · C4 · C5 · C10 · C24 · C26) */

/* ── 1. 뒤 어둡게 — 띄운 문서(업무 화면이면 그 탭 iframe) 뷰포트에 fixed. 탭 본문만 덮는다(C26) ── */
.ds-scrim {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--scrim);
  cursor: default;
  z-index: var(--z-modal);
  animation: ds-scrim-in var(--dur-base) var(--ease-out);
}
.ds-scrim[hidden] { display: none; }
.ds-scrim--drawer { z-index: var(--z-drawer); }
.ds-scrim--confirm { z-index: var(--z-confirm); }
.ds-scrim--blocking { z-index: var(--z-blocking); }

/* ── 2. 대화상자 층 — 가운데 정렬 · 패딩 24 · 누름은 면만 받는다 ── */
.ds-dialog-layer {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  pointer-events: none;
}
.ds-dialog-layer[hidden] { display: none; }
.ds-dialog-layer--confirm { z-index: calc(var(--z-confirm) + 1); }
.ds-dialog-layer > * { pointer-events: auto; }

/* ── 3. 모달 ── */
.ds-modal {
  display: flex;
  flex-direction: column;
  width: 560px;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--pop-shadow);
  outline: none;
  animation: ds-dialog-in var(--dur-modal) var(--ease-enter);
}
.ds-modal[hidden] { display: none; }
.ds-modal:focus-visible { outline: var(--focus-ring-width) solid var(--accent-text); outline-offset: var(--focus-ring-offset); }
.ds-modal--sm { width: 400px; }
.ds-modal--md { width: 560px; }
.ds-modal--lg { width: 800px; }
/* L7 수행형만 — 화면 inset 16 24 · 층 패딩 없음 · 본문만 스크롤 (C+1) */
.ds-modal--full {
  position: fixed;
  inset: var(--space-4) var(--space-6);
  width: auto;
  max-width: none;
  max-height: none;
}

.ds-modal__head {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 52px;
  padding: 0 var(--space-3) 0 var(--space-5);
  border-bottom: 1px solid var(--line);
}
.ds-modal__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: var(--fs-16);   /* 제목 체계 2단 팝업 제목 16/600 --text (2026-10-27 §3-E) */
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ds-modal__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5) var(--space-5);
  font-size: var(--fs-13);
}
/* 560 — 2열 격자 · 전체 폭 칸은 ds-modal__span */
.ds-modal--md .ds-modal__body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3-5) var(--space-4);
  align-content: start;
}
.ds-modal__span { grid-column: 1 / -1; }
.ds-modal__foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);   /* 발 버튼 사이 12 — 사용자 테스트 2026-10-29 「넓게」(옛 8) */
  height: 56px;
  padding: 0 var(--space-5);
  border-top: 1px solid var(--line);
}
.ds-modal__note {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-12);
  color: var(--muted);
}
/* 왼쪽 글이 없으면 버튼을 오른쪽으로 */
.ds-modal__foot > .ds-btn:first-child { margin-left: auto; }

/* 머리·바닥 닫기 버튼 28(아이콘 14) — 버튼 모양은 ds-btn 이 정본, 여기서는 크기만 */
.ds-modal__head > .ds-btn--icon,
.ds-drawer__head > .ds-btn--icon { flex: none; width: 28px; height: 28px; min-height: 28px; }
.ds-modal__head > .ds-btn--icon .ds-ic,
.ds-drawer__head > .ds-btn--icon .ds-ic { width: 14px; height: 14px; }

/* ── 4. 확인 대화상자 — 폭 400 · 머리 줄·닫기 버튼 없음 ── */
.ds-confirm {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 400px;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-5) var(--space-5) var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--pop-shadow);
  outline: none;
  animation: ds-dialog-in var(--dur-modal) var(--ease-enter);
}
.ds-confirm[hidden] { display: none; }
.ds-confirm:focus-visible { outline: var(--focus-ring-width) solid var(--accent-text); outline-offset: var(--focus-ring-offset); }
.ds-confirm__title {
  margin: 0;
  font-size: var(--fs-16);   /* 제목 체계 2단 */
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text);
}
.ds-confirm__desc {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--fs-13);
  line-height: var(--lh-loose);
  color: var(--text2);
}
.ds-confirm__desc p { margin: 0; }
.ds-confirm__desc b { font-weight: var(--fw-semibold); color: var(--text); }
/* 경고 상자 — 본문 안 면이라 모서리 3 (C10) */
.ds-confirm__warn {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2-5) var(--space-3);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 32%, var(--line));
  font-size: var(--fs-12);
  line-height: var(--lh-loose);
  color: var(--text);
}
.ds-confirm__warn > .ds-ic { width: 14px; height: 14px; margin-top: 3px; color: var(--warn); }
.ds-confirm__warn > .ds-list { flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; }
.ds-confirm__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-3);   /* 발 버튼 사이 12 — 사용자 테스트 2026-10-29 「넓게」(옛 8) */
  padding-top: var(--space-3);
}
.ds-confirm__foot > .ds-btn:last-child { min-width: 72px; }

/* ── 5. 열림 움직임 — 닫힘은 바로(C23). fill-mode 없음 → 끝나면 transform 이 남지 않아 안쪽 펼침 면 fixed 기준이 그대로(C15) ── */
@keyframes ds-scrim-in { from { opacity: 0; } }
@keyframes ds-dialog-in { from { opacity: 0; transform: translateY(4px) scale(0.985); } }
