/* =========================================================
   WebEditor v2.0 — 전체 스타일
   ========================================================= */

/* --- 래퍼 --- */
.we-wrapper {
  display: flex;
  flex-direction: column;
  border: 1px solid #c0c4cc;
  border-radius: 6px;
  background: #fff;
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', '맑은 고딕', sans-serif;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  position: relative;
}

/* =========================================================
   메뉴바 — 상단 드롭다운 (v2.4+)
   ========================================================= */
.we-menubar {
  display: flex;
  align-items: stretch;
  background: #f9fafb;
  border-bottom: 1px solid #d1d5db;
  height: 28px;
  padding: 0 4px;
  user-select: none;
}
.we-menubar-trigger {
  border: none;
  background: transparent;
  padding: 0 12px;
  height: 100%;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #1a1a2e;
  letter-spacing: -0.2px;
}
.we-menubar-trigger:hover,
.we-menubar-trigger.active {
  background: #2563eb;
  color: #fff;
}
.we-menubar-trigger:focus { outline: none; }
.we-menubar-trigger:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
.we-menubar-dropdown {
  position: absolute;
  z-index: 9500;
  min-width: 200px;
  background: #fff;
  border: 1px solid #c8cdd6;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
  font-size: 13px;
  border-radius: 0 0 4px 4px;
}
.we-menubar-item {
  display: flex;
  align-items: center;
  padding: 6px 14px 6px 10px;
  cursor: pointer;
  color: #1a1a2e;
  white-space: nowrap;
  gap: 8px;
  /* 키보드 포커스 지원을 위해 기본 outline 제거 (아래서 재정의) */
  outline: none;
}
.we-menubar-item:hover,
.we-menubar-item:focus {
  background: #e6f0ff;
  color: #1d4ed8;
  outline: none;
}
.we-menubar-item:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}
.we-menubar-item.disabled {
  color: #6b7280;  /* 명도 대비 개선: #9ca3af → #6b7280 (4.5:1 이상) */
  cursor: not-allowed;
}
.we-menubar-item.disabled:hover,
.we-menubar-item.disabled:focus { background: transparent; color: #6b7280; }
.we-menubar-item-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #555;
}
.we-menubar-item:hover .we-menubar-item-icon { color: #1d4ed8; }
.we-menubar-item-icon svg {
  width: 16px;
  height: 16px;
}
.we-menubar-item-icon.text {
  font-size: 14px;
  line-height: 1;
}
.we-menubar-item-label { flex: 1; }
.we-menubar-item-shortcut {
  margin-left: 24px;
  color: #4b5563;  /* 명도 대비 개선: #6b7280(4.0:1) → #4b5563(6.1:1) */
  font-size: 11px;
  font-family: 'Consolas', 'Courier New', monospace;
}
.we-menubar-sep {
  height: 1px;
  background: #e5e7eb;
  margin: 4px 8px;
}

/* 전체 화면 모드 */
.we-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999;
  background: #fff;
  width: 100% !important;
  height: 100% !important;
  border-radius: 0;
}
.we-fullscreen .we-body {
  min-height: calc(100vh - 120px) !important;
  max-height: calc(100vh - 120px) !important;
  overflow-y: auto !important;
}
/* 전체화면(.we-fullscreen, z-index:9999) 활성 시 — body에 append되는 팝업들을
   전체화면 레이어 위로 올려 가려지지 않게 함 (모달 backdrop 10000보다는 아래) */
body.we-fullscreen-active .we-menubar-dropdown,
body.we-fullscreen-active .we-context-menu,
body.we-fullscreen-active .we-table-palette,
body.we-fullscreen-active .we-popup,
body.we-fullscreen-active .we-find-panel,
body.we-fullscreen-active .we-table-overlay,
body.we-fullscreen-active .we-img-overlay,
body.we-fullscreen-active .we-img-actionbar,
body.we-fullscreen-active .we-inline-toolbar {
  z-index: 10001 !important;
}

/* =========================================================
   툴바 — 3행
   ========================================================= */
.we-toolbar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, #f6f8fa, #eef0f4);
  border-bottom: 1px solid #d0d5de;
  border-radius: 6px 6px 0 0;
  user-select: none;
}

.we-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1px;
  padding: 4px 6px;
}

.we-toolbar-row + .we-toolbar-row {
  border-top: 1px solid #e2e6ec;
}

.we-toolbar-sep {
  width: 1px;
  height: 20px;
  background: #c8cdd5;
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── 툴바 버튼 ───────────────────────────────────── */
.we-btn-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  color: #3c4252;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
  font-size: 11px;
}

.we-btn-tool:hover {
  background: #dde4ef;
  border-color: #b8c3d6;
}

.we-btn-tool:focus { outline: none; }
.we-btn-tool:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.we-btn-tool.active {
  background: #cfe1ff;
  border-color: #4a8fe8;
  color: #1a5fc8;
}

.we-btn-tool[aria-pressed="true"] {
  background: #cfe1ff;
  border-color: #4a8fe8;
  color: #1a5fc8;
}

.we-icon {
  width: 16px;
  height: 16px;
  pointer-events: none;
  display: block;
}

/* PDF로 저장 버튼 — 아이콘 빨강 강조 */
.we-toolbar [data-command="saveAsPDF"] .we-icon { color: #dc2626; }
.we-toolbar [data-command="saveAsPDF"]:hover .we-icon { color: #b91c1c; }

/* ── 셀렉트 드롭다운 ──────────────────────────────── */
.we-select-wrap {
  display: inline-flex;
  align-items: center;
}

.we-select {
  height: 28px;
  border: 1px solid #c4cad4;
  border-radius: 3px;
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  color: #333;
  padding: 0 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.12s;
}

.we-select:hover { border-color: #4a8fe8; }
.we-select:focus { border-color: #4a8fe8; outline: none; }
.we-select:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

.we-select-heading   { width: 88px; }
.we-select-font      { width: 100px; }
.we-select-font-size { width: 68px; }
.we-select-lineheight { width: 68px; }

/* ── 색상 버튼 ───────────────────────────────────── */
.we-color-btn-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.we-color-main-btn {
  width: 28px;
  height: 24px;
}

.we-color-bar {
  width: 20px;
  height: 4px;
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.1s;
}

.we-color-bar:hover { opacity: 0.75; }

/* ── 목록 스타일 드롭다운 버튼 ───────────────────── */
.we-list-dropdown-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.we-list-arrow {
  width: 14px;
  height: 28px;
  font-size: 9px;
  padding: 0;
  border-left: none;
  border-radius: 0 3px 3px 0;
}

.we-list-dropdown-wrap .we-btn-tool:first-child {
  border-radius: 3px 0 0 3px;
}

.we-list-style-popup {
  padding: 4px 0;
  min-width: 120px;
}

.we-list-style-item {
  display: block;
  width: 100%;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #333;
  background: transparent;
  border: none;
  font-family: inherit;
  text-align: left;
}

.we-list-style-item:hover,
.we-list-style-item:focus {
  background: #e8f0fe;
  color: #1a56db;
  outline: none;
}
.we-list-style-item:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

/* =========================================================
   본문 편집 영역
   ========================================================= */
.we-body {
  flex: 1;
  min-height: 300px;
  padding: 18px 22px;
  outline: none;
  overflow-y: auto;
  line-height: 1.75;
  color: #1a1a2e;
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 14px;
  word-break: break-word;
  caret-color: #333;
}

.we-body:empty::before {
  content: attr(data-placeholder);
  color: #b0b8c4;
  pointer-events: none;
  display: block;
}

/* 인라인 태그 */
.we-body p   { margin: 0 0 0.35em; }
.we-body h1  { font-size: 2em;    margin: 0.5em 0 0.3em; font-weight: 700; }
.we-body h2  { font-size: 1.6em;  margin: 0.5em 0 0.3em; font-weight: 700; }
.we-body h3  { font-size: 1.3em;  margin: 0.4em 0 0.25em; font-weight: 600; }
.we-body h4  { font-size: 1.1em;  margin: 0.4em 0 0.2em; font-weight: 600; }
.we-body h5  { font-size: 1em;    margin: 0.4em 0 0.2em; font-weight: 600; }
.we-body h6  { font-size: 0.9em;  margin: 0.4em 0 0.2em; font-weight: 600; color: #555; }
.we-body ul, .we-body ol { padding-left: 2em; margin: 0.35em 0; }
.we-body li  { margin: 0.15em 0; }

.we-body blockquote {
  margin: 0.5em 0 0.5em 0;
  padding: 6px 16px;
  border-left: 4px solid #4a8fe8;
  background: #f4f8ff;
  color: #444;
  border-radius: 0 4px 4px 0;
}

.we-body a { color: #2563eb; text-decoration: underline; }
.we-body a:hover { color: #1a3faa; }

.we-body hr {
  border: none;
  border-top: 2px solid #d0d5de;
  margin: 1em 0;
}

/* 코드 블록 */
.we-body pre.we-code-block,
.we-body pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 6px;
  padding: 14px 16px;
  font-family: 'Consolas', 'D2Coding', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  margin: 0.5em 0;
  white-space: pre;
}

.we-body pre code {
  background: none;
  color: inherit;
  font-size: inherit;
  padding: 0;
}

/* 동영상 래퍼 */
.we-body .we-video-wrapper {
  margin: 8px 0;
}

/* 표 */
.we-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
}
/* Word 도형 텍스트박스(제목 박스 등) — 1×1 표로 가져와 표처럼 크기조정/셀편집 가능.
   테두리/배경은 셀 인라인 style(도형 원본값). 너비 미지정 시 자동(콘텐츠). */
.we-body table.we-textbox {
  width: auto;
}
.we-body table.we-textbox > tbody > tr > td > p:first-child,
.we-body table.we-textbox > tbody > tr > td > *:first-child { margin-top: 0; }
.we-body table.we-textbox > tbody > tr > td > p:last-child,
.we-body table.we-textbox > tbody > tr > td > *:last-child  { margin-bottom: 0; }
.we-body table td,
.we-body table th {
  border: 1px solid #c0c4cc;
  padding: 6px 10px;
  min-width: 32px;
  vertical-align: top;
}
.we-body table th {
  background: #f0f3f8;
  font-weight: 600;
}

/* 이미지 */
.we-body img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  vertical-align: middle;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 2px;
  transition: border-color 0.12s;
}
.we-body img.selected { border-color: #4a8fe8; }

/* 이미지 로딩 */
.we-img-loading {
  display: inline-block;
  padding: 4px 10px;
  background: #f0f4ff;
  border: 1px dashed #90aadf;
  border-radius: 3px;
  color: #6a8cbf;
  font-size: 12px;
  animation: we-blink 1s infinite;
}
@keyframes we-blink { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* =========================================================
   편집 / HTML / 미리보기 탭 바
   ========================================================= */
.we-tab-bar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 0 8px;
  background: #f0f3f8;
  border-top: 1px solid #d4d9e3;
}

.we-tab {
  position: relative;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: #6b7a99;
  background: #e4e8f0;
  border: 1px solid #d4d9e3;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  bottom: -1px;          /* 탭이 경계선 위에 올라오도록 */
}
.we-tab:hover { background: #d8ddf0; color: #1e3a5f; }
.we-tab:focus { outline: none; }
.we-tab:focus-visible { outline: 2px solid #2563eb; outline-offset: -2px; }

.we-tab-active {
  background: #fff;
  color: #1a56db;
  font-weight: 600;
  border-color: #d4d9e3;
  border-bottom-color: #fff;  /* 아래 경계선 감춤 → 탭과 패널이 이어져 보임 */
  z-index: 1;
}

/* =========================================================
   HTML 소스 패널
   ========================================================= */
.we-source-panel {
  background: #1e1e2e;
  border-top: none;
}

.we-source-editor {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 200px;
  max-height: 600px;
  resize: vertical;
  border: none;
  outline: none;
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 14px 18px;
  font-family: 'Consolas', 'D2Coding', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
}

/* =========================================================
   미리보기 패널
   ========================================================= */
.we-preview-panel {
  padding: 24px 28px;
  background: #fff;
  overflow-y: auto;
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  color: #222;
  border-top: none;
}
.we-preview-panel h1,.we-preview-panel h2,.we-preview-panel h3,
.we-preview-panel h4,.we-preview-panel h5,.we-preview-panel h6 {
  margin: 0.6em 0 0.3em;
  font-weight: 700;
}
.we-preview-panel p  { margin: 0 0 0.6em; }
.we-preview-panel table { border-collapse: collapse; width: 100%; margin-bottom: 0.8em; }
.we-preview-panel td,.we-preview-panel th { border: 1px solid #c0c4cc; padding: 6px 10px; }
.we-preview-panel th { background: #f5f7fa; font-weight: 600; }
.we-preview-panel blockquote {
  border-left: 4px solid #3b82f6;
  margin: 0.5em 0;
  padding: 4px 0 4px 16px;
  color: #555;
}
.we-preview-panel pre {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 12px 16px;
  border-radius: 4px;
  overflow-x: auto;
  font-family: 'Consolas', monospace;
  font-size: 13px;
}
.we-preview-panel a { color: #2563eb; }
.we-preview-panel img { max-width: 100%; }

/* =========================================================
   상태바
   ========================================================= */
.we-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 12px;
  border-top: 1px solid #eaedf0;
  background: #f6f8fa;
  border-radius: 0 0 6px 6px;
  font-size: 11px;
  color: #8a92a0;
}

.we-version { color: #b0b8c4; }

/* =========================================================
   팝업 공통
   ========================================================= */
.we-popup {
  position: fixed;
  z-index: 9000;
  background: #fff;
  border: 1px solid #c4cad6;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}

/* =========================================================
   오버레이 + 모달
   ========================================================= */
.we-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.we-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}

.we-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #eaedf0;
  background: #f6f8fa;
}

.we-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e3a5f;
}

.we-modal-close {
  width: 28px; height: 28px;
  border: none; background: transparent;
  font-size: 16px; color: #888; cursor: pointer;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
}
.we-modal-close:hover { background: #eee; color: #333; }
.we-modal-close:focus { outline: none; }
.we-modal-close:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

.we-modal-body {
  padding: 16px 20px;
}

.we-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #eaedf0;
  background: #f6f8fa;
}

/* 모달 폼 요소 */
.we-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.we-form-label {
  font-size: 12px;
  color: #555;
  width: 72px;
  flex-shrink: 0;
}

.we-form-input {
  flex: 1;
  height: 32px;
  border: 1px solid #c4cad4;
  border-radius: 4px;
  padding: 0 9px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.we-form-input:focus {
  border-color: #4a8fe8;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
  outline: none;
}
.we-form-input-sm    { max-width: 90px; }

.we-form-hint {
  font-size: 11px;
  color: #999;
}

.we-tab-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.we-radio-group {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: #444;
}

.we-radio-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* 버튼 */
.we-btn {
  height: 30px;
  padding: 0 14px;
  border-radius: 4px;
  border: 1px solid #c4cad4;
  background: #f5f6f8;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
  white-space: nowrap;
}

.we-btn:hover { background: #e2e8f0; }
.we-btn:focus { outline: none; }
.we-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

.we-btn-primary {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}
.we-btn-primary:hover { background: #1d4ed8; }

.we-btn-secondary {
  background: #f5f6f8;
  color: #444;
}

.we-btn-sm {
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
}

/* =========================================================
   표 피커 팝업
   ========================================================= */
.we-table-picker {
  padding: 10px;
}

.we-table-picker-grid {
  display: grid;
  grid-template-columns: repeat(10, 18px);
  gap: 2px;
}

.we-table-picker-cell {
  width: 18px; height: 18px;
  border: 1px solid #d8dce4;
  border-radius: 2px;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.06s, border-color 0.06s;
}

.we-table-picker-cell.hover {
  background: #c5dcff;
  border-color: #4a8fe8;
}

.we-table-picker-label {
  text-align: center;
  font-size: 12px;
  color: #555;
  margin-top: 7px;
}

/* =========================================================
   색상 피커 팝업
   ========================================================= */
.we-color-picker-popup {
  padding: 10px;
  width: 206px;
}

.we-color-grid {
  display: grid;
  grid-template-columns: repeat(10, 17px);
  gap: 2px;
}

.we-color-swatch {
  width: 17px; height: 17px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.12);
  cursor: pointer;
  display: block;
  box-sizing: border-box;
  padding: 0;
  transition: transform 0.1s;
}
.we-color-swatch:hover { transform: scale(1.3); z-index: 1; position: relative; }
.we-color-swatch:focus { outline: none; }
.we-color-swatch:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  transform: scale(1.2);
  z-index: 1;
  position: relative;
}

.we-color-custom-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
}

.we-color-custom-input {
  flex: 1;
  height: 26px;
  padding: 0 6px;
  border: 1px solid #c4cad4;
  border-radius: 3px;
  font-size: 12px;
  font-family: monospace;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.we-color-custom-input:focus {
  border-color: #4a8fe8;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
  outline: none;
}

/* =========================================================
   이모티콘 팝업
   ========================================================= */
.we-emoji-popup {
  width: 320px;
  padding: 0;
  overflow: hidden;
}

.we-emoji-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid #e2e6ec;
  background: #f6f8fa;
}

.we-emoji-tab {
  width: 30px; height: 26px;
  border: 1px solid transparent;
  border-radius: 4px 4px 0 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.we-emoji-tab:hover  { background: #e2e8f0; }
.we-emoji-tab.active {
  background: #fff;
  border-color: #c4cad4;
  border-bottom-color: #fff;
  margin-bottom: -1px;
  z-index: 1;
}

.we-emoji-panels {
  padding: 8px;
  height: 210px;
  overflow-y: auto;
}

.we-emoji-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.we-emoji-btn {
  width: 32px; height: 32px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.08s;
  padding: 0;
}
.we-emoji-btn:hover { background: #e8f0fe; border-color: #c4cad4; }

/* =========================================================
   특수기호 팝업
   ========================================================= */
.we-special-popup {
  width: 340px;
  padding: 10px;
}

.we-special-title {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 7px;
}

.we-special-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
}

.we-special-btn {
  width: 28px; height: 28px;
  border: 1px solid #d4d8e0;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.08s, border-color 0.08s;
  padding: 0;
}
.we-special-btn:hover { background: #e8f0fe; border-color: #4a8fe8; }

/* =========================================================
   찾기/바꾸기 패널 (floating)
   ========================================================= */
.we-find-panel {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 8000;
  background: #fff;
  border: 1px solid #c4cad6;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.16);
  padding: 10px 12px;
  min-width: 320px;
  font-size: 13px;
}

.we-find-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.we-find-title {
  font-size: 13px;
  font-weight: 600;
  color: #1e3a5f;
}

.we-find-close {
  width: 22px; height: 22px;
  border: none; background: transparent;
  font-size: 14px; color: #888; cursor: pointer;
  border-radius: 3px;
}
.we-find-close:hover { background: #eee; }
.we-find-close:focus { outline: none; }
.we-find-close:focus-visible { outline: 2px solid #2563eb; outline-offset: 1px; }

.we-find-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.we-find-input {
  flex: 1;
  height: 28px;
  border: 1px solid #c4cad4;
  border-radius: 3px;
  padding: 0 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.we-find-input:focus {
  border-color: #4a8fe8;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
  outline: none;
}

.we-find-count {
  font-size: 11px;
  color: #888;
  min-width: 48px;
  text-align: right;
}

.we-find-options {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #555;
}
.we-find-options label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

/* 정규식 모드 — 입력란 monospace + 오류 시각화 (v2.3+) */
.we-find-input.we-find-input-regex {
  font-family: Consolas, 'D2Coding', 'Courier New', monospace;
  font-size: 12.5px;
}
.we-find-input.we-find-error {
  border-color: #ef4444 !important;
  background: #fef2f2;
}
.we-find-count.we-find-error {
  color: #dc2626;
  font-weight: 600;
}
/* 정규식 ON 시 단어 단위 옵션 비활성화 시각 */
.we-find-options label.we-find-opt-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 찾기 하이라이트 */
mark.we-find-mark {
  background: #fff176;
  color: inherit;
  border-radius: 2px;
}
mark.we-find-current {
  background: #ff9800;
  color: #fff;
}

/* =========================================================
   동영상 미리보기 (모달 내)
   ========================================================= */
.we-video-modal { max-width: 520px; }

.we-video-preview {
  margin: 8px 0;
  min-height: 50px;
  background: #f0f3f8;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* =========================================================
   미리보기 모달
   ========================================================= */
.we-preview-modal {
  max-width: 800px;
  width: 90vw;
  max-height: 90vh;
}

.we-preview-body {
  max-height: 60vh;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.75;
  color: #222;
}

.we-preview-body table { border-collapse: collapse; width: 100%; }
.we-preview-body td, .we-preview-body th { border: 1px solid #c0c4cc; padding: 6px 10px; }
.we-preview-body img  { max-width: 100%; }
.we-preview-body a    { color: #2563eb; }
.we-preview-body pre  { background: #1e1e2e; color: #cdd6f4; padding: 12px; border-radius: 4px; overflow-x: auto; }
.we-preview-body blockquote { border-left: 4px solid #4a8fe8; padding-left: 14px; color: #444; }
.we-preview-body hr   { border: none; border-top: 2px solid #d0d5de; margin: 1em 0; }

/* =========================================================
   우클릭 컨텍스트 메뉴
   ========================================================= */
.we-context-menu {
  position: fixed;
  z-index: 9500;
  background: #fff;
  border: 1px solid #c4cad6;
  border-radius: 5px;
  box-shadow: 0 5px 18px rgba(0,0,0,0.18);
  padding: 4px 0;
  min-width: 160px;
}

.we-context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  font-size: 13px;
  color: #222;
  cursor: pointer;
  user-select: none;
}

.we-context-menu-item:hover {
  background: #e8f0fe;
  color: #1a56db;
}

.we-context-menu-item.danger:hover {
  background: #fff0f0;
  color: #c00;
}

.we-context-menu-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.we-context-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: #4a5568;
  flex-shrink: 0;
}
.we-context-menu-item:hover .we-context-menu-icon { color: #1a56db; }
.we-context-menu-item.danger:hover .we-context-menu-icon { color: #c00; }

.we-context-menu-label { flex: 1; }

/* submenu 화살표 */
.we-context-menu-arrow {
  color: #94a3b8;
  font-size: 11px;
  margin-left: 4px;
}
.we-context-menu-item:hover .we-context-menu-arrow { color: #1a56db; }

.we-table-context-menu { min-width: 180px; }

/* ── 셀 배경색 / 테두리 팔레트 (v2.3+) ── */
.we-table-palette {
  position: fixed;
  z-index: 9501;
  background: #fff;
  border: 1px solid #c4cad6;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 10px 12px;
  width: 232px;
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}
.we-table-palette-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 6px;
}
.we-table-palette-sublabel {
  font-size: 11px;
  color: #64748b;
  margin: 8px 0 4px;
  font-weight: 600;
}
.we-table-palette-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.we-table-palette-sw {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
}
.we-table-palette-sw:hover {
  transform: scale(1.18);
  border-color: #2563eb;
  z-index: 1;
  position: relative;
}
.we-table-palette-sw.selected {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.we-table-palette-sw:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}
/* 색 없음 스와치 — 흰 바탕 + 빨간 대각선 */
.we-table-palette-sw.none {
  background:
    linear-gradient(to top right,
      transparent 0%, transparent 43%,
      #e11d48 43%, #e11d48 57%,
      transparent 57%, transparent 100%),
    #fff;
  border-color: #cbd5e1;
}

/* 칩 (굵기/스타일 버튼) */
.we-table-palette-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.we-table-palette-chip {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  transition: all 0.12s;
}
.we-table-palette-chip:hover { background: #f1f5f9; border-color: #2563eb; }
.we-table-palette-chip.selected {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1e40af;
  font-weight: 600;
}

/* 액션 (사용자 정의 / 지우기 / 적용) */
.we-table-palette-extra,
.we-table-palette-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
  gap: 8px;
}
.we-table-palette-custom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}
.we-table-palette-custom input[type="color"] {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
}
.we-table-palette-clear {
  background: #fff;
  border: 1px solid #cbd5e1;
  color: #475569;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.we-table-palette-clear:hover { background: #f1f5f9; color: #1e293b; }

.we-table-palette-apply {
  background: #2563eb;
  border: none;
  color: #fff;
  border-radius: 4px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.we-table-palette-apply:hover { background: #1d4ed8; }

/* 연결형 하위 메뉴 (flyout) — 셀 수직 정렬 등 */
.we-context-menu-item.we-has-flyout { position: relative; }
.we-context-submenu {
  position: absolute;
  top: -5px;            /* 부모 패딩(4px) 보정 */
  left: 100%;
  margin-left: 2px;
  min-width: 130px;
  display: none;
}
.we-context-menu-item.we-has-flyout:hover > .we-context-submenu,
.we-context-submenu:hover { display: block; }
/* 화면 오른쪽 넘칠 때 왼쪽으로 펼침 */
.we-context-submenu.flip-left {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 2px;
}
.we-context-submenu .we-context-menu-item.active {
  background: #e8f0fe;
  color: #1a56db;
  font-weight: 600;
}
.we-context-submenu .we-context-menu-item.active .we-context-menu-icon { color: #1a56db; }

.we-context-menu-sep {
  height: 1px;
  background: #eaedf0;
  margin: 3px 0;
}

/* 다중 셀 선택 하이라이트 */
.we-body td.we-cell-selected,
.we-body th.we-cell-selected {
  background: rgba(74, 143, 232, 0.18) !important;
  outline: 1px solid #4a8fe8;
  outline-offset: -1px;
}

/* =========================================================
   표 전체 리사이즈 오버레이 + SE 코너 핸들
   ========================================================= */
.we-table-overlay {
  position: fixed;
  pointer-events: none;
  z-index: 8400;
  box-sizing: border-box;
}

.we-table-handle {
  position: absolute;
  pointer-events: all;
  box-sizing: border-box;
}

.we-table-handle-se {
  right: -10px;
  bottom: -10px;
  width: 20px;
  height: 20px;
  background: #4a8fe8;
  border: 3px solid #fff;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  cursor: se-resize;
  transition: transform 0.08s, background 0.08s;
}
.we-table-handle-se::after {
  content: '';
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 8px 8px;
  border-color: transparent transparent #fff transparent;
}
.we-table-handle-se:hover {
  background: #2563eb;
  transform: scale(1.2);
}

/* =========================================================
   에디터 정보 (About) 다이얼로그
   ========================================================= */
.we-about-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 45, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: weAboutFade 0.15s ease;
}
@keyframes weAboutFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.we-about-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.28);
  width: 420px;
  max-width: 90vw;
  position: relative;
  overflow: hidden;
  animation: weAboutPop 0.18s ease;
}
@keyframes weAboutPop {
  from { transform: translateY(-12px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1);        opacity: 1; }
}

.we-about-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: rgba(255,255,255,0.85);
  line-height: 1;
  padding: 0 6px;
  z-index: 1;
  border-radius: 4px;
}
.we-about-close:hover { color: #fff; }
.we-about-close:focus { outline: none; }
.we-about-close:focus-visible { outline: 2px solid rgba(255,255,255,0.8); outline-offset: 2px; }

.we-about-header {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  padding: 28px 24px 22px;
  text-align: center;
}
.we-about-logo {
  max-width: 220px;
  max-height: 70px;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.25));
}
.we-about-logo-text {
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.we-about-body {
  padding: 18px 24px 14px;
  font-size: 13.5px;
  color: #1e3a5f;
}
.we-about-name {
  font-size: 18px;
  font-weight: 700;
  color: #1e40af;
}
.we-about-version {
  color: #6b7280;
  font-size: 12.5px;
  margin-top: 2px;
}
.we-about-divider {
  border-top: 1px solid #e5e7eb;
  margin: 12px 0;
}
.we-about-section-title {
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.we-about-row {
  padding: 2px 0;
  line-height: 1.55;
}
.we-about-row b { color: #4b5563; margin-right: 4px; }

.we-about-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.we-about-status.ok      { background: #d1fae5; color: #047857; }
.we-about-status.warn    { background: #fef3c7; color: #b45309; }
.we-about-status.pending { background: #e0e7ff; color: #4338ca; }

.we-about-footer {
  padding: 8px 24px 18px;
  text-align: right;
}
.we-about-ok {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 22px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
}
.we-about-ok:hover { background: #1d4ed8; }

/* =========================================================
   Word Import 다이얼로그
   ========================================================= */
.we-wi-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 45, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.we-wi-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.28);
  width: 460px;
  max-width: 90vw;
  overflow: hidden;
  font-size: 13.5px;
  color: #1e3a5f;
}
.we-wi-header {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
}
.we-wi-body { padding: 16px 22px; }
.we-wi-row { padding: 4px 0; line-height: 1.6; }
.we-wi-row b { color: #4b5563; margin-right: 6px; }
.we-wi-divider { border-top: 1px solid #e5e7eb; margin: 12px 0; }
.we-wi-section { font-weight: 600; color: #374151; margin: 4px 0 8px; }
.we-wi-radio, .we-wi-check {
  display: block;
  padding: 4px 0;
  cursor: pointer;
  user-select: none;
}
.we-wi-radio input, .we-wi-check input { margin-right: 8px; }
.we-wi-engine {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
}
.we-wi-footer {
  padding: 10px 22px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.we-wi-cancel, .we-wi-ok {
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.we-wi-cancel { background: #e5e7eb; color: #374151; }
.we-wi-cancel:hover { background: #d1d5db; }
.we-wi-ok { background: #2563eb; color: #fff; }
.we-wi-ok:hover { background: #1d4ed8; }
.we-wi-spinner {
  width: 36px; height: 36px;
  margin: 0 auto;
  border: 4px solid #e0e7ff;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: weWiSpin 0.8s linear infinite;
}
@keyframes weWiSpin { to { transform: rotate(360deg); } }
.we-imported-table td { border: 1px solid #c0c4cc; padding: 6px 10px; vertical-align: top; }
/* 페이지 나누기 — 편집 화면: 점선 가이드, 인쇄: 강제 개행 */
.we-page-break {
  border: none;
  border-top: 2px dashed #9ca3af;
  margin: 16px 0;
  position: relative;
  height: 0;
  user-select: none;
  page-break-after: always;
  break-after: page;
}
/* div 기반(v2.3.1+) 페이지 나누기에 라벨 표시 */
div.we-page-break {
  height: 16px;
  border-top: 2px dashed #9ca3af;
  border-bottom: 2px dashed #9ca3af;
  background: repeating-linear-gradient(45deg, #fef3c7 0 6px, transparent 6px 12px);
  margin: 18px 0;
}
div.we-page-break::after {
  content: '✂  페이지 나누기  ✂';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  letter-spacing: 0.3px;
  user-select: none;
}
/* 인쇄 모드 — 시각 가이드 숨기고 강제 개행만 적용 */
@media print {
  .we-page-break {
    border: none !important;
    background: none !important;
    height: 0 !important;
    margin: 0 !important;
    page-break-after: always;
    break-after: page;
  }
  .we-page-break::after { display: none !important; }
}

/* =========================================================
   이미지 선택 오버레이 / 리사이즈 핸들
   ========================================================= */
.we-img-overlay {
  position: fixed;
  pointer-events: none;
  z-index: 8500;
  box-sizing: border-box;
}

.we-img-overlay-border {
  position: absolute;
  inset: 0;
  border: 2px solid #4a8fe8;
}

.we-img-handle {
  position: absolute;
  width: 8px; height: 8px;
  background: #4a8fe8;
  border: 2px solid #fff;
  border-radius: 2px;
  pointer-events: all;
  box-sizing: border-box;
}

.we-img-handle[data-pos="tl"] { top:-4px;  left:-4px;  cursor:nw-resize; }
.we-img-handle[data-pos="tc"] { top:-4px;  left:50%; transform:translateX(-50%); cursor:n-resize; }
.we-img-handle[data-pos="tr"] { top:-4px;  right:-4px; cursor:ne-resize; }
.we-img-handle[data-pos="ml"] { top:50%;   left:-4px;  transform:translateY(-50%); cursor:w-resize; }
.we-img-handle[data-pos="mr"] { top:50%;   right:-4px; transform:translateY(-50%); cursor:e-resize; }
.we-img-handle[data-pos="bl"] { bottom:-4px; left:-4px;  cursor:sw-resize; }
.we-img-handle[data-pos="bc"] { bottom:-4px; left:50%; transform:translateX(-50%); cursor:s-resize; }
.we-img-handle[data-pos="br"] { bottom:-4px; right:-4px; cursor:se-resize; }

/* ── 에디터 본문 내 이미지: 브라우저 기본 드래그 비활성화 (복사본 생성 방지) ── */
.we-body img {
  -webkit-user-drag: none;
  user-drag: none;
}

/* ── 이미지 액션 바 (캡션 토글) — 선택 시 오버레이 아래에 표시 ── */
/* 이미지 정렬은 본문 정렬(toolbar의 justifyLeft/Center/Right)로 처리. */
.we-img-actionbar {
  position: fixed;
  z-index: 8501;
  display: flex;
  gap: 2px;
  padding: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  pointer-events: all;
  font-family: 'Malgun Gothic', sans-serif;
}
.we-img-actionbar button {
  background: transparent;
  border: none;
  color: #334155;
  height: 28px;
  padding: 0 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s;
}
.we-img-actionbar button:hover  { background: #f1f5f9; color: #1e293b; }
.we-img-actionbar button.active { background: #dbeafe; color: #2563eb; }
.we-img-actionbar button:focus-visible { outline: 2px solid #60a5fa; outline-offset: 1px; }

/* SVG 아이콘 스타일 — line 요소까지 명시적으로 stroke 강제 (다른 CSS의 override 차단) */
.we-img-actionbar svg {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
  pointer-events: none;
}
.we-img-actionbar svg line,
.we-img-actionbar svg rect,
.we-img-actionbar svg path {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  stroke-linecap: round !important;
}

/* ── 이미지 링크 다이얼로그 (v2.3.2+) ── */
.we-img-link-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 9500;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Malgun Gothic', sans-serif;
}
.we-img-link-dialog {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  width: min(440px, 92vw);
  padding: 20px 22px 16px;
  color: #1e293b;
}
.we-img-link-dialog h3 {
  margin: 0 0 14px;
  font-size: 16px;
  color: #1e3a5f;
  font-weight: 600;
}
.we-img-link-row {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 14px;
  font-size: 13px;
}
.we-img-link-row > span {
  color: #475569;
  font-weight: 500;
}
.we-img-link-url {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #c0c4cc;
  border-radius: 4px;
  font-size: 13px;
  font-family: Consolas, 'Courier New', monospace;
  box-sizing: border-box;
}
.we-img-link-url:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.we-img-link-targets {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px 8px;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}
.we-img-link-targets legend {
  padding: 0 6px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}
.we-img-link-target {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 3px 4px;
  border-radius: 4px;
}
.we-img-link-target:hover { background: #f1f5f9; }
.we-img-link-target input { margin: 0; cursor: pointer; }
.we-img-link-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.we-img-link-spacer { flex: 1; }
.we-img-link-actions button {
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #c0c4cc;
  background: #fff;
  color: #1e293b;
  transition: background 0.12s, border-color 0.12s;
}
.we-img-link-actions button:hover { background: #f8fafc; }
.we-img-link-actions button:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}
.we-img-link-ok {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}
.we-img-link-ok:hover { background: #1d4ed8 !important; }
.we-img-link-remove {
  color: #dc2626 !important;
  border-color: #fecaca !important;
}
.we-img-link-remove:hover { background: #fef2f2 !important; }

/* 캡션 figure 안의 <a>는 inline-block 처리 (레이아웃 유지) */
.we-img-figure > a { display: inline-block; }
/* 편집 영역의 링크 이미지 — 커서가 포인터로 보이지 않게 (편집 가능 표시) */
.we-content a[data-we-img-link] { cursor: default; }

/* =========================================================
   링크 삽입/편집 모달 (v2.3.2 — 메뉴바·툴바 공용)
   ========================================================= */
.we-link-modal { width: min(480px, 92vw); }
.we-link-modal .we-modal-title {
  display: flex; align-items: center;
}
.we-link-modal .we-form-row {
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.we-link-modal .we-form-label {
  width: 80px;
  font-size: 12.5px;
  color: #475569;
  font-weight: 500;
}
.we-link-modal .we-form-input {
  height: 36px;
  font-size: 13px;
}
.we-link-modal .we-form-input#we-link-modal-url,
.we-link-modal input[type="url"] {
  font-family: 'Consolas', 'Courier New', monospace;
}

/* 타겟 라디오 카드 그리드 */
.we-link-targets {
  margin: 14px 0 4px;
  padding: 12px 14px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fafbfc;
}
.we-link-targets legend {
  padding: 0 6px;
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.we-link-targets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.we-link-target {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  user-select: none;
}
.we-link-target:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}
.we-link-target.is-checked {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}
.we-link-target.is-checked .we-link-target-label {
  color: #1d4ed8;
  font-weight: 600;
}
.we-link-target input {
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}

/* 모달 푸터 버튼 (기존 we-btn 시스템과 통일) */
.we-link-spacer { flex: 1; }
.we-link-modal .we-modal-footer {
  align-items: center;
}
.we-link-modal .we-btn {
  padding: 7px 16px;
  border: 1px solid #c0c4cc;
  border-radius: 5px;
  background: #fff;
  color: #1e293b;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.we-link-modal .we-btn:hover  { background: #f1f5f9; }
.we-link-modal .we-btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}
.we-link-modal .we-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.we-link-modal .we-btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}
.we-link-modal .we-btn-danger {
  color: #dc2626;
  border-color: #fecaca;
  background: #fff;
}
.we-link-modal .we-btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* ── 캡션 (figure + figcaption) ── */
/* figure는 부모 단락의 text-align(본문 정렬)에 자동으로 따라감 */
.we-img-figure {
  display: inline-block;
  margin: 0;
  max-width: 100%;
}
.we-img-figure img { display: block; max-width: 100%; }
.we-img-figure figcaption {
  margin-top: 6px;
  padding: 4px 8px;
  font-size: 13px;
  color: #475569;
  text-align: center;
  font-style: italic;
  outline: none;
  min-height: 1em;
}
.we-img-figure figcaption:empty::before {
  content: '캡션을 입력하세요';
  color: #94a3b8;
  font-style: italic;
}
.we-img-figure figcaption:focus {
  background: #f1f5f9;
  border-radius: 3px;
}


/* =========================================================
   showTableGuide — 테두리 없는 표 점선 가이드 (편집 모드)
   ========================================================= */
.we-table-guide .we-body table,
.we-table-guide .we-body td,
.we-table-guide .we-body th {
  outline: 1px dashed #aaa;
}

/* =========================================================
   readOnly — 읽기 전용 모드
   ========================================================= */
.we-readonly .we-body {
  background: #f9f9f9;
  cursor: default;
  user-select: text;
  -webkit-user-select: text;
}
.we-readonly .we-body:focus {
  outline: none;
  box-shadow: none;
}
.we-readonly .we-toolbar {
  pointer-events: none;
  opacity: 0.5;
}

/* ── 부유 미니툴바 (InlineToolbar, v2.5) ── */
.we-inline-toolbar {
  position: absolute;
  z-index: 9999;
  display: flex;
  gap: 2px;
  padding: 4px;
  background: #1e293b;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.we-inline-toolbar::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #1e293b;
}
.we-inline-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #f1f5f9;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.we-inline-btn:hover {
  background: #334155;
}
.we-inline-btn:active {
  background: #475569;
}
