* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Noto Sans KR', sans-serif;
  background: #f0f2f5;
}

/* ─── 전체 레이아웃 ──────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── 지도 영역 ───────────────────────────────── */
#map-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

#map-wrap {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
}

#main-map {
  width: 100%;
  height: 100%;
}

/* ─── 컨트롤 패널 ─────────────────────────────── */
#ctrl-panel {
  height: 200px;
  min-height: 8px;
  max-height: calc(100vh - 40px);
  flex-shrink: 0;
  background: #1e2533;
  color: #cdd4e0;
  border-top: 2px solid #2d3748;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#ctrl-view-title {
  text-align: center;
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #e2e8f0;
  background: #111827;
  border-bottom: 1px solid #2d3748;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ctrl-view-title .view-modified-tag {
  font-size: 11px;
  font-weight: 500;
  color: #f5a623;
  margin-left: 6px;
}

#ctrl-panel-header {
  display: flex;
  align-items: center;
  padding: 3px 10px;
  border-bottom: 1px solid #2d3748;
  flex-shrink: 0;
  gap: 8px;
  background: #171e2d;
}

#ctrl-panel-inner {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  transition: opacity .2s;
}

#ctrl-panel-inner.ctrl-panel-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ─── 6열 컬럼 ────────────────────────────────── */
.ctrl-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #2d3748;
  overflow: hidden;
}

.ctrl-col:last-child {
  border-right: none;
}

.ctrl-col-title {
  font-size: 10px;
  font-weight: 700;
  color: #718096;
  letter-spacing: .7px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-bottom: 1px solid #2d3748;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ctrl-col-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  gap: 4px;
  min-height: 0;
}

.ctrl-col-body::-webkit-scrollbar { width: 6px; }
.ctrl-col-body::-webkit-scrollbar-track { background: transparent; }
.ctrl-col-body::-webkit-scrollbar-thumb { background: #718096; border-radius: 3px; }
.ctrl-col-body::-webkit-scrollbar-thumb:hover { background: #a0aec0; }

/* ─── 레이어 서브 타이틀 ──────────────────────── */
.layer-sub-title {
  font-size: 9px;
  font-weight: 600;
  color: #718096;
  padding: 3px 8px;
  border-bottom: 1px solid #2d3748;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ─── 뷰 관리 ─────────────────────────────────── */
.ctrl-save-view-btn {
  padding: 4px 8px;
  background: #2d3748;
  border: 1px solid #4a5568;
  color: #a0aec0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
  transition: all .12s;
}

.ctrl-save-view-btn:hover {
  border-color: #1a73e8;
  color: #1a73e8;
}

.view-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #2d3748;
  font-size: 10px;
  color: #a0aec0;
  margin-bottom: 3px;
  transition: all .12s;
}

.view-item:hover {
  border-color: #4a5568;
  background: rgba(255, 255, 255, 0.04);
}

.view-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.view-item-name:hover {
  color: #e2e8f0;
}

.view-item-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.view-item-btn {
  background: none;
  border: none;
  color: #4a5568;
  cursor: pointer;
  font-size: 11px;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1;
  transition: color .12s;
}

.view-item-btn:hover {
  color: #a0aec0;
}

.view-edit-input {
  width: 100%;
  background: #1a2035;
  border: 1px solid #1a73e8;
  color: #e2e8f0;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  outline: none;
}

/* ─── AI 최근 질문 목록 ─────────────────────── */
.ai-recent-item {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 2px;
}

.ai-recent-text {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  color: #a0aec0;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid #2d3748;
  transition: all .12s;
}

.ai-recent-text:hover {
  color: #e2e8f0;
  border-color: #4a5568;
  background: rgba(255, 255, 255, 0.04);
}

.ai-recent-copy-btn {
  background: none;
  border: none;
  color: #4a5568;
  cursor: pointer;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: color .12s;
}

.ai-recent-copy-btn:hover {
  color: #a0aec0;
}

/* ─── 레이어 가져오기 패널 ────────────────────── */
#layer-import-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a2030;
  z-index: 10;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#layer-import-panel.open {
  display: flex;
}

/* ─── 전체 레이어 패널 ────────────────────────── */
#layer-all-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a2030;
  z-index: 10;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#layer-all-panel.open {
  display: flex;
}

/* ─── 공개 뷰 전체목록 패널 ───────────────────── */
#public-view-all-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a2030;
  z-index: 10;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

#public-view-all-panel.open {
  display: flex;
}

.import-layer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 11px;
  color: #a0aec0;
  cursor: pointer;
  transition: background .12s;
}

.import-layer-item:hover {
  background: rgba(26, 115, 232, 0.15);
  color: #e2e8f0;
}

/* ─── 듀얼 레인지 슬라이더 ───────────────────── */
#dual-range-bg {
  width: 100%;
  height: 4px;
  background: #2d3748;
  border-radius: 2px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

#dual-range-fill {
  height: 4px;
  background: #1a73e8;
  border-radius: 2px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.dual-range-input {
  position: absolute;
  width: 100%;
  height: 4px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  outline: none;
  margin: 0;
  padding: 0;
  top: 50%;
  transform: translateY(-50%);
}

.dual-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1a73e8;
  pointer-events: all;
  cursor: pointer;
  border: 2px solid #1e2533;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.dual-range-input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1a73e8;
  pointer-events: all;
  cursor: pointer;
  border: 2px solid #1e2533;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

#ctrl-resize-handle {
  height: 6px;
  width: 100%;
  background: #2d3748;
  cursor: ns-resize;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}

#ctrl-resize-handle:hover,
#ctrl-resize-handle.dragging {
  background: #4a5568;
}

#ctrl-resize-handle::before {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: #4a5568;
}

#ctrl-resize-handle:hover::before,
#ctrl-resize-handle.dragging::before {
  background: #718096;
}

/* ctrl-left 제거됨 — 6열 레이아웃으로 전환 */

.layer-add-btn {
  background: transparent;
  border: 1px solid #4a5568;
  color: #718096;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1.4;
  transition: all .12s;
}

.layer-add-btn:hover {
  border-color: #1a73e8;
  color: #1a73e8;
}

.toggle-all-btn {
  background: transparent;
  border: 1px solid #4a5568;
  color: #718096;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
}

.toggle-all-btn:hover {
  border-color: #1a73e8;
  color: #1a73e8;
}

#layer-list-panel {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.layer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 2px;
  transition: background .1s;
}

.layer-item.drag-over {
  border-top: 2px solid #1a73e8;
}

.layer-drag-handle {
  cursor: grab;
  color: #4a5568;
  font-size: 12px;
  padding: 4px 3px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

.layer-drag-handle:active {
  cursor: grabbing;
}

.layer-item label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 5px 8px;
  font-size: 11px;
  color: #cdd4e0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-item input[type=checkbox] {
  width: 13px;
  height: 13px;
  cursor: pointer;
  accent-color: #1a73e8;
  flex-shrink: 0;
}

.layer-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.layer-badge-pub {
  font-size: 9px;
  background: rgba(104, 211, 145, 0.2);
  color: #68d391;
  border-radius: 3px;
  padding: 0 4px;
  flex-shrink: 0;
}

.layer-item-btns {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.layer-icon-btn {
  background: transparent;
  border: none;
  color: #4a5568;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  transition: all .12s;
}

.layer-icon-btn:hover {
  color: #a0aec0;
  background: rgba(255, 255, 255, 0.08);
}

.layer-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── 카카오맵 오버레이 섹션 ──────────────────── */
#kakao-layer-section {
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 4px;
}

.kakao-layer-header {
  font-size: 10px;
  font-weight: 600;
  color: #a0aec0;
  padding: 4px 8px 2px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ctrl-right 제거됨 — 6열 레이아웃으로 전환 */

#app.fullscreen #sidebar {
  display: none;
}

#app.fullscreen #ctrl-panel {
  display: none;
}


/* ─── 전체 표시 체크박스 ──────────────────────── */
.ctrl-show-all {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #a0aec0;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.ctrl-show-all input[type=checkbox] {
  width: 13px;
  height: 13px;
  cursor: pointer;
  accent-color: #1a73e8;
}

/* ─── 적용 버튼 (dirty 상태일 때만 파란색) ─────── */
.ctrl-apply-btn {
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  background: #2d3748;
  color: #718096;
  border: 1px solid #4a5568;
  border-radius: 5px;
  cursor: pointer;
  transition: all .15s;
}

.ctrl-apply-btn.dirty,
.ctrl-apply-btn:hover {
  background: #1a73e8;
  border-color: #1a73e8;
  color: white;
}

.ctrl-reset-btn {
  padding: 4px 10px;
  font-size: 11px;
  background: transparent;
  color: #718096;
  border: 1px solid #4a5568;
  border-radius: 5px;
  cursor: pointer;
  margin-right: 6px;
  transition: all .15s;
}

.ctrl-reset-btn:hover {
  border-color: #a0aec0;
  color: #a0aec0;
}

/* ctrl-body / ctrl-view 제거됨 — ctrl-col-body 사용 */

.tag-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 8px;
  background: #2d3748;
  border: 1px solid #4a5568;
  color: #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  outline: none;
  margin: 5px 0 6px;
  transition: border-color .15s;
}

.tag-search-input:focus {
  border-color: #1a73e8;
}

.tag-search-input::placeholder {
  color: #4a5568;
}

/* ─── AI 뷰 ───────────────────────────────────── */
.ai-view-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.ai-input-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ai-prompt-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px;
  border: 1px solid #4a5568;
  background: #2d3748;
  color: #e2e8f0;
  border-radius: 5px;
  font-size: 11px;
  font-family: inherit;
  outline: none;
  resize: none;
  transition: border-color .15s;
}

.ai-prompt-input:focus {
  border-color: #1a73e8;
}

.ai-prompt-input::placeholder {
  color: #4a5568;
}

.ai-search-btn {
  width: 100%;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ai-search-btn:hover {
  background: #1558b0;
}

.ai-search-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.ai-status {
  font-size: 11px;
  color: #718096;
  line-height: 1.5;
}

/* ─── 레이어 뷰 ───────────────────────────────── */
.layer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  color: #4a5568;
  gap: 4px;
}

.ctrl-section {
  min-width: 160px;
  padding: 8px 14px;
  border-right: 1px solid #2d3748;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.ctrl-section:last-child {
  border-right: none;
  flex: 1;
}

.ctrl-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #718096;
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* ─── 태그 칩 ─────────────────────────────────── */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  border: 1px solid #4a5568;
  color: #a0aec0;
  background: transparent;
  transition: all .12s;
  white-space: nowrap;
}

.tag-chip:hover {
  border-color: #718096;
  color: #cbd5e0;
}

.tag-chip.selected {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #ffffff;
  font-weight: 600;
}

/* ─── 유형 체크박스 ──────────────────────────── */
.type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.type-chip {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  border: 1px solid #4a5568;
  color: #a0aec0;
  background: transparent;
  transition: all .12s;
  white-space: nowrap;
}

.type-chip.selected {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #ffffff;
  font-weight: 600;
}

/* ─── 날짜 입력 ───────────────────────────────── */
.ctrl-date-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.ctrl-date-row label {
  color: #718096;
  white-space: nowrap;
}

.ctrl-date-row input[type=date] {
  background: #2d3748;
  border: 1px solid #4a5568;
  color: #e2e8f0;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
  width: 126px;
}

.ctrl-date-row input[type=date]:focus {
  outline: none;
  border-color: #1a73e8;
}

/* ─── 색상/농도 ───────────────────────────────── */
.ctrl-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.ctrl-color-row label {
  color: #718096;
  white-space: nowrap;
  min-width: 40px;
}

.ctrl-toggle {
  display: flex;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #4a5568;
}

.ctrl-toggle button {
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: transparent;
  color: #718096;
  transition: all .12s;
}

.ctrl-toggle button.active {
  background: #1a73e8;
  color: white;
}

input[type=color].ctrl-color-picker {
  width: 28px;
  height: 22px;
  border: none;
  padding: 0;
  border-radius: 3px;
  cursor: pointer;
  background: transparent;
}

.ctrl-slider {
  width: 100%;
  accent-color: #1a73e8;
}

.ctrl-slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.ctrl-slider-row label {
  color: #718096;
  white-space: nowrap;
  min-width: 40px;
}

.ctrl-slider-row span {
  color: #e2e8f0;
  min-width: 28px;
  text-align: right;
}

/* ─── 지도 위 컨트롤들 ───────────────────────── */
.map-top-left {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-btn {
  background: white;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
  white-space: nowrap;
}

.map-btn:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.map-btn.active {
  background: #1a73e8;
  color: white;
}

.map-btn i {
  font-size: 13px;
}

#measure-result {
  position: absolute;
  bottom: 54px;
  left: 12px;
  z-index: 20;
  background: white;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #222;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  display: none;
  align-items: center;
  gap: 10px;
}

#measure-result span {
  color: #1a73e8;
  font-weight: 700;
}

#measure-result button {
  background: none;
  border: none;
  color: #888;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
}

/* ─── 모드 전환 배지 ──────────────────────────── */
.mode-badge {
  background: white;
  border: none;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}

.mode-badge:hover {
  transform: scale(1.04);
}

.badge-to-public {
  background: #27ae60;
  color: white;
}

.badge-to-admin {
  background: #e74c3c;
  color: white;
}

/* ─── 범례 ────────────────────────────────────── */
.legend-box {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 20;
  background: white;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 12px;
  line-height: 2.1;
}

.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

/* ─── Entity 마커 ─────────────────────────────── */
.e-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform .1s;
}

.e-dot:hover {
  transform: scale(1.3);
}

.e-dot-private {
  opacity: 0.55;
}

/* ─── 기사 팝업 ───────────────────────────────── */
.custom-overlay {
  position: absolute;
  background: white;
  border-radius: 10px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  font-size: 13px;
  min-width: 220px;
  max-width: 280px;
}

.custom-overlay .ov-close {
  position: absolute;
  top: 7px;
  right: 9px;
  cursor: pointer;
  font-size: 16px;
  color: #999;
}

.custom-overlay h6 {
  font-size: 13px;
  font-weight: 600;
  margin: 4px 0 8px;
  line-height: 1.4;
}

.custom-overlay .ov-meta {
  font-size: 12px;
  color: #555;
  margin-bottom: 6px;
}

.custom-overlay .ov-btn {
  display: block;
  text-align: center;
  padding: 5px;
  border: 1px solid #1a73e8;
  border-radius: 5px;
  color: #1a73e8;
  text-decoration: none;
  font-size: 12px;
  margin-top: 6px;
}

.custom-overlay .ov-btn:hover {
  background: #1a73e8;
  color: white;
}

/* ─── 사이드바 ────────────────────────────────── */
#sidebar {
  width: 320px;
  min-width: 320px;
  align-self: stretch;
  background: #ffffff;
  border-left: 1px solid #e8eaed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 16px 18px 14px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #2d3748;
  letter-spacing: -0.5px;
}

.logo-text span {
  color: #1a73e8;
}

.logo-sub {
  font-size: 11px;
  color: #888;
  margin-top: 1px;
}

.sidebar-auth a {
  font-size: 12px;
  color: #666;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid #ddd;
}

.sidebar-auth a:hover {
  background: #f5f5f5;
}

.sidebar-auth .sep {
  color: #ccc;
  margin: 0 4px;
}

/* ─── 날씨 카드 ───────────────────────────────── */
.weather-card {
  margin: 12px 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  border-radius: 10px;
  border-left: 4px solid #1a73e8;
  font-size: 13px;
  font-weight: 500;
  color: #1a237e;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.weather-card i {
  font-size: 16px;
  color: #1a73e8;
}

#weather-text,
#dust-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Entity List Panel ────────────────────────── */
#entity-list-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.el-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 6px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  flex-shrink: 0;
}

#el-list {
  flex: 1;
  overflow-y: auto;
}

.el-item {
  border-bottom: 1px solid #f0f0f0;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .12s;
}

.el-item:hover {
  background: #f0f6ff;
}

.el-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 2px;
}

.el-item-type {
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
}

.el-sub-item {
  font-size: 11px;
  color: #4a5568;
  padding: 2px 0 2px 8px;
  border-left: 2px solid #e2e8f0;
  margin-bottom: 2px;
  line-height: 1.4;
}

.el-sub-date {
  color: #999;
  font-size: 10px;
  margin-left: 5px;
}

.el-sub-label {
  display: inline-block;
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 4px;
  font-weight: 600;
}

.el-sub-label.ev {
  background: #e8f4fd;
  color: #1a73e8;
}

.el-sub-label.attr {
  background: #f0fdf4;
  color: #16a34a;
}

.el-sub-label.data {
  background: #fef9e7;
  color: #d97706;
}

.ep-back {
  float: left;
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  margin-right: 4px;
  margin-top: 1px;
}

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

/* ─── Entity 패널 ─────────────────────────────── */
#entity-panel {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: #bbb;
  font-size: 13px;
  padding: 40px 20px;
  text-align: center;
}

.panel-empty i {
  font-size: 36px;
  color: #ddd;
}

.ep-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

.ep-header .ep-name {
  font-size: 15px;
  font-weight: 700;
  color: #222;
  margin-bottom: 2px;
}

.ep-header .ep-type {
  font-size: 11px;
  color: #999;
}

.ep-header .ep-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 16px;
  cursor: pointer;
  float: right;
  margin-top: -2px;
}

.ep-header .ep-close:hover {
  color: #555;
}

.ep-tabs {
  display: flex;
  border-bottom: 1px solid #eee;
}

.ep-tab {
  flex: 1;
  padding: 9px 0;
  font-size: 12px;
  font-weight: 600;
  color: #999;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}

.ep-tab.active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
}

.attr-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}

.attr-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: top;
}

.attr-table td:first-child {
  font-weight: 600;
  color: #444;
  white-space: nowrap;
  width: 40%;
}

.ev-card {
  border-left: 3px solid #e8eaed;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.ev-card:hover {
  border-left-color: #1a73e8;
  background: #fafcff;
}

.ev-cat {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #e8f0fe;
  color: #1a73e8;
  margin-right: 5px;
  font-weight: 600;
}

.ev-title {
  font-weight: 600;
  line-height: 1.4;
}

.ev-meta {
  font-size: 11px;
  color: #aaa;
  margin-top: 3px;
}

.ev-content {
  font-size: 12px;
  color: #666;
  margin-top: 5px;
  white-space: pre-wrap;
  max-height: 72px;
  overflow-y: auto;
  line-height: 1.5;
}

/* ─── 페이저 ──────────────────────────────────── */
.mini-pager {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-top: 1px solid #f0f0f0;
  font-size: 12px;
}

.mini-pager button {
  padding: 2px 9px;
  font-size: 11px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

.mini-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.mini-pager button:not(:disabled):hover {
  background: #f5f5f5;
}

.mini-pager .pager-info {
  flex: 1;
  text-align: center;
  color: #888;
}

.per-select {
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #ddd;
}

.ep-section {
  padding: 12px 14px;
  flex: 1;
}

/* ─── 스크롤바 ────────────────────────────────── */
#entity-panel::-webkit-scrollbar {
  width: 4px;
}

#entity-panel::-webkit-scrollbar-track {
  background: #f5f5f5;
}

#entity-panel::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* ─── 반응형 ──────────────────────────────────── */
@media (max-width: 1280px) {
  #ctrl-panel-inner {
    overflow-x: auto;
  }

  .ctrl-col {
    min-width: 140px;
  }
}

@media (max-width: 1024px) {
  .ctrl-col {
    min-width: 120px;
  }

  .ctrl-col-title {
    font-size: 9px;
    letter-spacing: .4px;
  }
}

@media (max-width: 800px) {
  .ctrl-col {
    min-width: 100px;
  }

  .ctrl-col-body {
    padding: 4px 6px;
  }
}

/* 모바일 드래그 핸들: 기본 숨김 (모바일에서만 표시) */
#mobile-map-handle { display: none; }
#mobile-sidebar-handle { display: none; }

/* ─── 모바일 (≤600px) ────────────────────────── */
@media (max-width: 600px) {

  /* html/body: 세로 스크롤 허용 */
  html,
  body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  /* 전체 앱: 세로 쌓기 켄테이너 */
  #app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
  }

  /* 지도 영역: 자연 흐름 */
  #map-area {
    height: auto;
    flex: none;
    min-height: 0;
    overflow: visible;
  }

  /* 지도 래퍼: 고정 높이 */
  #map-wrap {
    height: 50vh;
    flex: none;
    min-height: 200px;
  }

  /* 컨트롤 패널: 프레임 없이 내용 전체 표시 */
  #ctrl-panel {
    position: relative;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    flex-shrink: 0;
    z-index: 10;
  }

  /* 리사이즈 핸들: 모바일에서 숨김 */
  #ctrl-resize-handle {
    display: none;
  }

  /* 컨트롤 패널 내부 */
  #ctrl-panel-inner {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: visible;
    flex: none;
    height: auto;
    pointer-events: auto;
  }

  /* 각 컬럼: 전체 폭, 충분한 최소 높이 */
  .ctrl-col {
    width: 100%;
    flex: none;
    min-width: 0 !important;
    height: auto;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid #2d3748;
    overflow: visible;
  }

  .ctrl-col:last-child {
    border-bottom: none;
  }

  .ctrl-col-title {
    font-size: 9px;
    padding: 3px 6px;
  }

  #col-ai .ctrl-col-title { background: rgba(81, 88, 145, 0.4); color: #d0d4fc; border-bottom: none; }
  #col-layer .ctrl-col-title { background: rgba(56, 102, 92, 0.4); color: #bdf2df; border-bottom: none; }
  #col-time .ctrl-col-title { background: rgba(102, 59, 115, 0.4); color: #ebccf5; border-bottom: none; }
  #col-tag .ctrl-col-title { background: rgba(121, 91, 57, 0.4); color: #fae0c5; border-bottom: none; }
  #col-marker .ctrl-col-title { background: rgba(119, 65, 65, 0.4); color: #fad3cf; border-bottom: none; }
  #col-view .ctrl-col-title { background: rgba(168, 118, 50, 0.4); color: #ffe6bd; border-bottom: none; }
  #title-marker-subview { background: rgba(119, 65, 65, 0.4); color: #fad3cf; border-bottom: none; }



  .ctrl-col-body {
    flex: none;
    padding: 5px 8px;
    gap: 4px;
    overflow-y: visible;
    height: auto;
    min-height: auto;
  }

  /* 사이드바: 전체 폭, 페이지 스크롤로 접근 (별도 프레임 없음) */
  #sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    min-height: 60vh;
    border-left: none;
    border-top: 1px solid #e8eaed;
    flex-shrink: 0;
    overflow: visible;
  }

  /* 지도 위 버튼: 가로 배열, 아이콘만 표시 */
  .map-top-left {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 3px;
    max-width: calc(100vw - 24px);
    top: 8px;
    left: 8px;
  }

  .map-btn {
    font-size: 0;
    padding: 7px 9px;
    gap: 0;
    border-radius: 6px;
  }

  .map-btn i {
    font-size: 14px;
  }

  .mode-badge {
    font-size: 0;
    padding: 7px 9px;
  }

  .mode-badge i {
    font-size: 14px;
  }

  /* 범례: 더 작게 */
  .legend-box {
    font-size: 10px;
    padding: 6px 9px;
    line-height: 1.7;
    bottom: 6px;
    right: 6px;
  }

  /* 엔티티 팝업 */
  #entity-popup {
    max-width: calc(100vw - 24px);
    font-size: 12px;
  }

  /* 지도↔패널 드래그 핸들 — 태블릿의 ctrl-resize-handle과 동일한 디자인 */
  #mobile-map-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 6px;
    width: 100%;
    background: #2d3748;
    cursor: ns-resize;
    flex-shrink: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: background .15s;
  }
  #mobile-map-handle:hover,
  #mobile-map-handle.dragging {
    background: #4a5568;
  }
  #mobile-map-handle::before {
    content: '';
    display: block;
    width: 36px;
    height: 3px;
    border-radius: 2px;
    background: #4a5568;
  }
  #mobile-map-handle:hover::before,
  #mobile-map-handle.dragging::before {
    background: #718096;
  }

  /* 지도↔사이드바 드래그 핸들 — 비로그인 전용, 주변 밝은 톤에 어울리는 스타일 */
  #mobile-sidebar-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 6px;
    width: 100%;
    background: #dde3ee;
    cursor: ns-resize;
    flex-shrink: 0;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: background .15s;
  }
  #mobile-sidebar-handle:hover,
  #mobile-sidebar-handle.dragging {
    background: #c5cfe4;
  }
  #mobile-sidebar-handle::before {
    content: '';
    display: block;
    width: 36px;
    height: 3px;
    border-radius: 2px;
    background: #a0aec0;
  }
  #mobile-sidebar-handle:hover::before,
  #mobile-sidebar-handle.dragging::before {
    background: #718096;
  }
}

/* ─── 태블릿/중형 (601px ~ 1200px) ──────────────── */
@media (min-width: 601px) and (max-width: 1200px) {
  /*
   * 홈 화면: #app은 row 유지 → 지도+사이드바 관계 그대로
   * 지도 영역 하단 컨트롤 패널 칸만 세로로 쌓기
   */

  /* 사이드바: 폭을 줄여서 지도 공간 확보 */
  #sidebar {
    width: 240px;
    min-width: 240px;
  }

  /* 지도 래퍼: 비는 곳 없이 남는 공간을 모두 채워 하단 흰 여백 방지 */
  #map-wrap {
    flex: 1;
    height: auto;
    min-height: 200px;
  }

  /* 컨트롤 패널: 리사이즈 핸들 지원 */
  #ctrl-panel {
    position: relative;
    height: 200px;
    min-height: 8px;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    flex-shrink: 0;
    z-index: 10;
  }

  /* 컨트롤 패널 내부: 칸을 세로로 쌓기 */
  #ctrl-panel-inner {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    pointer-events: auto;
  }

  #ctrl-panel-inner::-webkit-scrollbar { width: 6px; }
  #ctrl-panel-inner::-webkit-scrollbar-thumb { background: #718096; border-radius: 3px; }
  #ctrl-panel-inner::-webkit-scrollbar-track { background: transparent; }

  /* 각 컬럼: 전체 폭, 충분한 최소 높이 */
  .ctrl-col {
    width: 100%;
    flex: none;
    min-width: 0 !important;
    height: auto;
    min-height: auto;
    border-right: none;
    border-bottom: 1px solid #2d3748;
    overflow: visible;
  }

  .ctrl-col:last-child {
    border-bottom: none;
  }

  .ctrl-col-title {
    font-size: 10px;
    padding: 3px 6px;
  }

  #col-ai .ctrl-col-title { background: rgba(81, 88, 145, 0.4); color: #d0d4fc; border-bottom: none; }
  #col-layer .ctrl-col-title { background: rgba(56, 102, 92, 0.4); color: #bdf2df; border-bottom: none; }
  #col-time .ctrl-col-title { background: rgba(102, 59, 115, 0.4); color: #ebccf5; border-bottom: none; }
  #col-tag .ctrl-col-title { background: rgba(121, 91, 57, 0.4); color: #fae0c5; border-bottom: none; }
  #col-marker .ctrl-col-title { background: rgba(119, 65, 65, 0.4); color: #fad3cf; border-bottom: none; }
  #col-view .ctrl-col-title { background: rgba(168, 118, 50, 0.4); color: #ffe6bd; border-bottom: none; }
  #title-marker-subview { background: rgba(119, 65, 65, 0.4); color: #fad3cf; border-bottom: none; }


  .ctrl-col-body {
    flex: none;
    padding: 5px 10px;
    gap: 4px;
    overflow-y: visible;
    height: auto;
    min-height: auto;
  }

  /* 지도 위 버튼: 폰트 약간 줄임 */
  .map-btn {
    font-size: 11px;
    padding: 6px 10px;
  }

  /* 사이드바 사용자/관리 링크 래퍼 - 좁은 영역 고려 */
  .sidebar-auth {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
  }
  .sidebar-auth .sep { display: none; }
}