.gtb-wrap { max-width: 900px; margin: 20px auto; }
.gtb-toolbar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.gtb-toolbar button { padding:6px 10px; border:1px solid #ccc; background:#fff; border-radius:8px; cursor:pointer; }

.A4 { width: 210mm; min-height: 297mm; margin: 0 auto; background:white; box-shadow: 0 0 4px rgba(0,0,0,.1); }
@media print {
  .gtb-wrap { max-width: none; }
  .A4 { box-shadow:none; width:auto; min-height:auto; }
  .gtb-toolbar { display:none; }
}

.gtb-canvas { padding: 16mm 14mm; }

/* 전체 편집 영역 (한글 문서 한 페이지 느낌) */
.gtb-page.A4 {
  background: #f4f4f4;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.gtb-canvas {
  min-height: 900px;           /* 페이지 높이 느낌 */
  width: 100%;
  max-width: 800px;            /* A4 비율 비슷하게 */
  padding: 24px;
  border: 1px solid #ddd;
  background: #fff;
  box-sizing: border-box;
  outline: none;               /* 클릭 시 파란 테두리 제거 */
  font-family: '맑은 고딕', system-ui, sans-serif;
  font-size: 14px;
}

/* 캔버스 안의 표 스타일(있다면 유지 + 확장) */
.gtb-canvas table.gtb-table {
  border-collapse: collapse;
  margin: 8px 0;
}

.gtb-canvas table.gtb-table td,
.gtb-canvas table.gtb-table th {
  border: 1px solid #999;
  padding: 4px 6px;
}


.gtb-table { border-collapse: collapse; width: 100%; margin: 8px 0; table-layout: fixed; }
.gtb-table td, .gtb-table th { border:1px solid #111; padding:4px 6px; vertical-align:top; position:relative; }
.gtb-table td[contenteditable="true"] { outline: none; }
.gtb-table td:focus { background: #fff9c4; }

.gtb-selected { outline: 2px solid #2f6fed; outline-offset:-2px; background:#eef5ff; }

/* 표·셀 복사/선택 허용 */
.gtb-canvas, .gtb-canvas table, .gtb-canvas td, .gtb-canvas th, .gtb-canvas span, .gtb-canvas div {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}
/* 버튼은 선택 방지 */
.gtb-toolbar button { user-select: none; }

.gtb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 8px;
}

.gtb-toolbar-sep {
  margin: 0 4px;
  color: #aaa;
}

.gtb-toolbar button {
  padding: 4px 8px;
  font-size: 12px;
}

#gtb-font-select {
  padding: 2px 4px;
  font-size: 12px;
}

/* 다중 선택 하이라이트 */
.gtb-table td.gtb-selected,
.gtb-table th.gtb-selected {
  background: rgba(47,111,237,0.12);
  box-shadow: inset 0 0 0 2px #2f6fed;
}

/* ===== Context Menu ===== */
.gtb-menu {
  position: fixed;
  z-index: 99999;
  min-width: 220px;
  background: #fff;
  border: 1px solid #dcdfe6;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
  padding: 6px;
  display: none;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans KR", Arial, sans-serif;
}
.gtb-menu h6 {
  margin: 6px 8px 4px;
  font-size: 11px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.gtb-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #111827;
}
.gtb-menu .menu-item:hover {
  background: #f3f4f6;
}
.gtb-menu .danger {
  color: #b00020;
}
.gtb-menu .sep {
  height: 1px;
  background: #eee;
  margin: 6px 0;
}
.gtb-menu .kbd {
  margin-left: auto;
  font-size: 11px;
  color: #9ca3af;
}
