/* ═══ 기본 레이아웃 ═══ */
body {
  background: var(--c-bg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════
   헤더
   ═══════════════════════════════════════════════ */
#main-header {
  background: var(--c-navy);
  color: #fff;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 3px solid var(--c-gold);
  padding: 0 20px 0 24px;
}

/* 브랜드 영역 */
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-right: 20px;
  border-right: 1px solid rgba(255,255,255,0.18);
}

.header-brand::before {
  content: '';
  display: block;
  width: 3px;
  height: 20px;
  background: var(--c-gold);
  border-radius: 2px;
  flex-shrink: 0;
}

.page-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

/* 탭 네비게이션 */
.tab-nav {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex: 1;
  height: 100%;
  padding: 0 12px;
}

.tab-btn {
  height: 100%;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.01em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  margin-bottom: -3px;
}

.tab-btn:hover {
  color: rgba(255,255,255,0.90);
  background: rgba(255,255,255,0.07);
}

.tab-btn.active {
  color: #fff;
  border-bottom-color: #fff;
  background: rgba(255,255,255,0.10);
}

/* 헤더 우측 액션 */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,0.18);
}

/* 지도 토글 */
#map-type-toggle {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--r-sm);
  padding: 3px;
  flex-shrink: 0;
}
#map-type-toggle.hidden { display: none !important; }

.map-type-btn {
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  background: transparent;
  color: rgba(255,255,255,0.65);
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: background 0.12s, color 0.12s;
}
.map-type-btn.active { background: #fff; color: var(--c-navy); }

/* 헤더 버튼 */
.btn-logout {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  transition: background 0.12s;
}
.btn-logout:hover { background: rgba(255,255,255,0.20); }

.btn-feedback {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  align-self: center;
  margin-left: 12px;
  transition: background 0.12s;
}
.btn-feedback:hover { background: rgba(255,255,255,0.20); }
.btn-feedback-label-mobile { display: none; }

/* 다운로드 드롭다운 */
.dl-dropdown {
  position: relative;
}

.btn-download {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  transition: background 0.12s;
}
.btn-download:hover,
.btn-download.active { background: rgba(255,255,255,0.20); }

.dl-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(10,20,50,0.20);
  padding: 6px;
  z-index: 700;
}
.dl-menu.hidden { display: none; }

.dl-menu-item {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink);
  border-radius: var(--r-sm);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s;
}
.dl-menu-item:hover { background: rgba(15,40,86,0.08); }

/* ═══════════════════════════════════════════════
   메인 레이아웃 (사이드바 + 지도)
   ═══════════════════════════════════════════════ */
#main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* 사이드바 */
#main-sidebar {
  width: 240px;
  min-width: 160px;
  max-width: 480px;
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1.5px solid var(--c-border-dark);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 탭 패널 */
.tab-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.tab-panel.hidden { display: none !important; }

/* 사이드바 본문 (스크롤 목록 영역) */
.sb-body-fill {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  min-height: 0;
}
.sb-body-fill > .scroll-list {
  flex: 1;
  max-height: none;
  overflow-y: auto;
}

/* 리사이저 */
.panel-resizer {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: var(--c-border);
  transition: background 0.15s;
}
.panel-resizer:hover,
.panel-resizer:active { background: var(--c-blue); }

/* 지도 컨테이너 */
#map-container {
  flex: 1;
  position: relative;
  min-width: 200px;
  overflow: hidden;
}
#map {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
}

/* 지도 위에 현재 표시 중인 환승 경로 안내 배지 */
.tf-route-badge {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--c-navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  white-space: nowrap;
  pointer-events: none;
}
.tf-route-badge.hidden { display: none; }

/* ═══════════════════════════════════════════════
   사이드바 섹션 헤더
   ═══════════════════════════════════════════════ */
.sb-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.sb-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-navy);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sb-count {
  font-size: 11px;
  color: var(--c-muted);
  font-weight: 600;
}

/* 헤더 내 정렬 그룹 */
.sb-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sb-sort-group {
  font-size: 10px;
  color: var(--c-muted);
  display: flex;
  align-items: center;
  gap: 3px;
}

.sb-sort-btn {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border: 1px solid var(--c-border-dark);
  border-radius: 2px;
  background: var(--c-surface);
  color: var(--c-navy);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
}
.sb-sort-btn:hover { background: var(--c-blue-light); }

/* 검색 영역 */
.sb-search-wrap {
  position: relative;
  padding: 8px 10px 4px;
  flex-shrink: 0;
}
.sb-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 28px 5px 10px;
  height: 34px;
  font-size: 13px;
  border: 1.5px solid var(--c-border-dark);
  border-radius: var(--r-sm);
  outline: none;
  font-family: inherit;
  color: var(--c-body);
  background: var(--c-surface);
  transition: border-color 0.15s;
}
.sb-search-input:focus { border-color: var(--c-blue); }
.sb-search-clear {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  line-height: 1;
  color: var(--c-muted);
  cursor: pointer;
  display: none;
  background: none;
  border: none;
  padding: 2px;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════
   스크롤 목록
   ═══════════════════════════════════════════════ */
.scroll-list {
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  overflow-y: auto;
}

.list-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-divider);
  cursor: pointer;
  gap: 5px;
  transition: background 0.1s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--c-surface-2); }
.list-item.active {
  background: var(--c-blue-light);
  box-shadow: inset 3px 0 0 var(--c-blue);
  font-weight: 600;
}

.item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-body);
  font-size: 13px;
}
.item-id {
  font-size: 10px;
  color: var(--c-muted);
  font-weight: normal;
  margin-left: 3px;
}
.item-stop-id {
  color: var(--c-navy);
  font-size: 13px;
  font-weight: 700;
  min-width: 32px;
  text-align: center;
  flex-shrink: 0;
}

.empty-msg {
  padding: 24px;
  color: var(--c-muted);
  text-align: center;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════
   노선 목록 아이템
   ═══════════════════════════════════════════════ */
.route-list-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--c-divider);
  cursor: pointer;
  transition: background 0.1s;
}
.route-list-item:last-child { border-bottom: none; }
.route-list-item:hover { background: var(--c-surface-2); }
.route-list-item.active {
  background: var(--c-blue-light);
  box-shadow: inset 3px 0 0 var(--c-blue);
}

.rli-main {
  flex: 1;
  min-width: 0;
}
.rli-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rli-id {
  font-size: 10px;
  color: var(--c-muted);
  font-weight: normal;
}
.rli-dir {
  font-size: 11px;
  color: var(--c-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rli-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.rli-detail-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--c-border-dark);
  border-radius: var(--r-sm);
  color: var(--c-muted);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.rli-detail-btn:hover {
  background: var(--c-blue-light);
  color: var(--c-blue);
  border-color: var(--c-blue);
}

/* ═══════════════════════════════════════════════
   배지
   ═══════════════════════════════════════════════ */
.badge-run {
  background: var(--c-success-bg);
  color: var(--c-success);
  border: 1px solid #A7F3C2;
  border-radius: var(--r-sm);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-stop {
  background: var(--c-danger-bg);
  color: var(--c-danger);
  border: 1px solid #FECACA;
  border-radius: var(--r-sm);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   노선 정류소 패널 (노선탭 하단)
   ═══════════════════════════════════════════════ */
.route-stops-panel {
  flex-shrink: 0;
  max-height: 50%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1.5px solid var(--c-border-dark);
}
.route-stops-panel.hidden { display: none !important; }
.route-stops-panel .scroll-list {
  flex: 1;
  overflow-y: auto;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--c-border);
}

.rs-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
  white-space: nowrap;
}
.rs-badge-start { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.rs-badge-turn  { background: #fef9c3; color: #92400e; border: 1px solid #fde047; }
.rs-badge-end   { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ═══════════════════════════════════════════════
   환승 조회 탭 — 출발/도착 선택 패널
   ═══════════════════════════════════════════════ */
.tf-selection-panel {
  flex-shrink: 0;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tf-od-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tf-stop-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}

.tf-swap-btn {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--c-border-dark);
  background: var(--c-surface);
  color: var(--c-muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  box-shadow: 0 1px 3px rgba(10,20,50,.15);
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.tf-swap-btn:hover {
  color: var(--c-blue);
  border-color: var(--c-blue);
  background: var(--c-blue-light);
}

.tf-stop-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
  padding: 2px 4px;
  border-radius: 3px;
}
.tf-label-origin { background: #dcfce7; color: #166534; border: 1px solid #a7f3c2; }
.tf-label-dest   { background: #fff3e0; color: #92400e; border: 1px solid #fcd34d; }

.tf-inline-wrap {
  flex: 1;
  position: relative;
}

.tf-inline-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--c-border-dark);
  border-radius: var(--r-sm);
  padding: 5px 24px 5px 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--c-body);
  background: var(--c-surface);
  outline: none;
  transition: border-color 0.1s;
}
.tf-inline-input:focus { border-color: var(--c-blue); }
.tf-inline-input.tf-selected {
  border-color: #86efac;
  background: #f0fdf4;
  color: var(--c-navy);
  font-weight: 600;
}

.tf-inline-clear {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-muted);
  font-size: 13px;
  padding: 2px 3px;
  line-height: 1;
}
.tf-inline-clear:hover { color: var(--c-danger); }

.tf-stop-dropdown {
  display: none;
  position: fixed;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border-dark);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 14px rgba(10,20,50,0.18);
  max-height: 220px;
  overflow-y: auto;
  z-index: 500;
}

.tf-dd-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-divider);
}
.tf-dd-item:last-child { border-bottom: none; }
.tf-dd-item:hover { background: var(--c-blue-light); }
.tf-dd-name { flex: 1; font-size: 12px; color: var(--c-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-dd-id   { font-size: 10px; color: var(--c-muted); flex-shrink: 0; }
.tf-dd-empty { padding: 10px; text-align: center; font-size: 12px; color: var(--c-muted); }

.tf-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.tf-btn-row .btn { flex: 1; }

/* 환승 결과 정렬 드롭다운 */
.tf-sort-select {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid var(--c-border-dark);
  border-radius: 2px;
  background: var(--c-surface);
  color: var(--c-navy);
  cursor: pointer;
  font-family: inherit;
  outline: none;
}

/* 결과 리스트 영역 */
.tf-results-list {
  flex: 1;
  overflow-y: auto;
}

/* ═══════════════════════════════════════════════
   환승 결과 요약
   ═══════════════════════════════════════════════ */
.tf-result-summary {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
  font-size: 12px;
}
.tf-summary-name  { font-weight: 700; color: var(--c-navy); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-summary-arrow { color: var(--c-muted); flex-shrink: 0; }
.tf-summary-count { margin-left: auto; color: var(--c-muted); font-size: 11px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   여정 카드
   ═══════════════════════════════════════════════ */
.tf-journey-card {
  border-bottom: 2px solid var(--c-border-dark);
  background: var(--c-surface);
  transition: background 0.1s;
}
.tf-journey-card.active { background: #f0f5ff; }
.tf-journey-card.loading { opacity: 0.6; pointer-events: none; }

.tf-journey-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 4px;
  font-size: 11px;
  color: var(--c-muted);
}

.tf-journey-badge {
  background: var(--c-navy);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.tf-map-btn {
  margin: 0 12px 6px;
  width: calc(100% - 24px);
}

/* ═══════════════════════════════════════════════
   탑승 구간 (leg)
   ═══════════════════════════════════════════════ */
.tf-leg-container {
  padding: 0 0 4px;
}

.tf-leg-item {
  border-top: 1px solid var(--c-divider);
}

.tf-leg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
}
.tf-leg-header.clickable { cursor: pointer; }
.tf-leg-header.clickable:hover { background: var(--c-surface-2); }

.tf-leg-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-ink);
}

.tf-leg-stop-count {
  font-size: 10px;
  color: var(--c-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.tf-leg-stop-list {
  border-top: 1px solid var(--c-divider);
  background: var(--c-surface-2);
  max-height: 160px;
  overflow-y: auto;
}

.tf-leg-stop-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 16px;
  font-size: 11px;
  color: var(--c-body);
  border-bottom: 1px solid var(--c-divider);
}
.tf-leg-stop-item:last-child { border-bottom: none; }

.tf-stop-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-blue);
  flex-shrink: 0;
}

/* 환승 행 */
.tf-transfer-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 5px 12px;
  background: var(--c-surface-3);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}

.tf-transfer-arrow {
  font-size: 11px;
  font-weight: 700;
  color: #6B46C1;
  flex-shrink: 0;
}

.tf-stop-link {
  font-size: 11px;
  color: var(--c-blue);
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.tf-stop-link:hover { color: var(--c-navy); }
.tf-stop-link-text {
  font-size: 11px;
  color: var(--c-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tf-available-lines {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding-left: 46px;
}

.tf-available-lines-title {
  font-size: 10px;
  color: var(--c-muted);
  margin-right: 2px;
}

.tf-available-line {
  padding: 1px 5px;
  border: 1px solid var(--c-border);
  border-radius: 3px;
  background: var(--c-surface);
  color: var(--c-body);
  font-size: 10px;
  line-height: 1.4;
}

.tf-available-line.selected {
  border-color: var(--c-blue);
  background: var(--c-blue);
  color: #fff;
  font-weight: 700;
}

.tf-alt-lines {
  padding-left: 12px;
  padding-bottom: 6px;
}

.tf-error { color: var(--c-danger) !important; }


/* ═══════════════════════════════════════════════
   정류소 타입 도트
   ═══════════════════════════════════════════════ */
.stop-type-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   인포윈도우
   ═══════════════════════════════════════════════ */
.iw-content       { padding: 4px 2px; min-width: 200px; max-width: 340px; }
.iw-header-row    { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.iw-name          { font-weight: 700; color: var(--c-ink); font-size: 13px; flex: 1; min-width: 0; }
.iw-id            { font-size: 11px; color: var(--c-muted); font-weight: normal; }
.iw-close-btn     { flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 13px; color: var(--c-muted); padding: 0 2px; line-height: 1; border-radius: 3px; }
.iw-close-btn:hover { color: var(--c-ink); background: var(--c-surface-2); }
.iw-routes-label  { font-size: 10px; font-weight: 700; color: var(--c-muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 4px; }
.iw-routes        { display: flex; flex-wrap: wrap; gap: 3px; max-height: 110px; overflow-y: auto; }
.iw-route-tag     { display: inline-block; padding: 2px 7px; background: var(--c-blue-light); color: var(--c-blue); border: 1px solid #b3c7e8; border-radius: 3px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.iw-route-tag em  { font-style: normal; color: var(--c-muted); font-weight: normal; }
.iw-routes-loading{ font-size: 11px; color: var(--c-muted); }
.iw-routes-empty  { font-size: 11px; color: var(--c-muted); }

/* ═══════════════════════════════════════════════
   노선 상세 모달
   ═══════════════════════════════════════════════ */
.rv-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,20,50,0.55);
  z-index: 600;
}
.rv-modal.hidden { display: none !important; }

.rv-modal-box {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90vw; height: 90vh;
  min-width: 480px; min-height: 360px;
  background: var(--c-surface);
  border-radius: var(--r-lg);
  border: 1.5px solid var(--c-border-dark);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(10,20,50,0.28);
  resize: both;
  display: flex;
  flex-direction: column;
}

.modal-drag-bar {
  flex-shrink: 0;
  height: 50px;
  background: var(--c-navy);
  border-bottom: 2px solid var(--c-gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 20px;
  cursor: grab;
  user-select: none;
}
.modal-drag-bar:active { cursor: grabbing; }
.modal-drag-title {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
}
.modal-drag-close {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s;
}
.modal-drag-close:hover { background: rgba(255,255,255,0.22); }

#route-view-frame { flex: 1; width: 100%; border: none; }

#mobile-view-toggle { display: none; }

/* ═══════════════════════════════════════════════
   모바일 대응 (폰 화면, ~600px 이하)
   ═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  /* 헤더: 브랜드 텍스트는 숨기고, 탭은 아이콘+명칭을 작게 표시, 로그아웃은 아이콘만 노출 */
  #main-header { padding: 0 10px; gap: 0; }
  .header-brand { padding-right: 10px; }
  .header-brand .page-title { display: none; }
  .tab-nav { padding: 0 4px; }
  .tab-btn { padding: 0 7px; font-size: 11px; }
  .tab-btn svg { margin-right: 3px !important; }
  .header-actions { padding-left: 8px; gap: 6px; }
  .dl-dropdown { display: none; }
  .btn-logout { padding: 5px 8px; font-size: 0; }
  .btn-logout svg { margin-right: 0 !important; }
  .btn-feedback-label-desktop { display: none; }
  .btn-feedback-label-mobile { display: inline; }

  /* 메인 레이아웃: 지도는 항상 배경에 마운트해두고, 목록은 그 위를 덮는
     오버레이로 띄운다 (지도 컨테이너를 display:none으로 숨기지 않음 —
     0×0 크기로 생성된 카카오맵은 이후 relayout()으로도 복구되지 않기 때문) */
  #panel-resizer { display: none; }
  #main-sidebar {
    position: fixed;
    top: 58px; /* #main-header 높이 */
    left: 0; right: 0; bottom: 0;
    width: auto !important;
    min-width: 0;
    max-width: none;
    z-index: 400;
    border-right: none;
  }
  #main-layout.mobile-show-map #main-sidebar { display: none; }

  /* 목록 ↔ 지도 전환 플로팅 버튼 */
  #mobile-view-toggle {
    display: flex;
    position: fixed;
    right: 16px;
    bottom: 20px;
    z-index: 550;
    align-items: center;
    gap: 6px;
    padding: 11px 18px;
    background: var(--c-navy);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(10,20,50,0.35);
    cursor: pointer;
  }

  /* 노선상세 모달: 전체화면 */
  .rv-modal-box {
    width: 100vw;
    height: 100vh;
    min-width: 0;
    min-height: 0;
    top: 0;
    left: 0;
    transform: none;
    border-radius: 0;
    resize: none;
  }

  /* 터치 타겟 확대 */
  .rli-detail-btn { width: 40px; height: 40px; }
  .tf-inline-clear { padding: 8px; }
  .sb-search-clear { padding: 8px; }
  .sb-sort-btn { padding: 5px 9px; }
  .list-item, .route-list-item { padding-top: 12px; padding-bottom: 12px; }
}
