/* 메인 화면(index.html) 디자인 레이어. /next 미리보기로 시작해서 파일 이름이
   next.css이고, body 클래스도 next-ui다. styles.css 위에 얹어서 배치·형태·
   타이포·색을 바꾼다. 이전 화면(classic.html, /classic)은 이 파일을 불러오지 않는다.

   배치: 모바일은 얇은 상단 바 → 검색 카드 → 지도 → 결과를 촘촘하게 쌓고,
   900px 이상은 왼쪽 사이드바(검색+결과)와 오른쪽 전체 높이 지도로 나눈다.

   색: 테마마다 같은 구조의 팔레트를 쓴다. 회색 계열 바탕(--bg) 위에 카드
   (--nx-card), 카드 안 조작 영역은 옅은 필드(--nx-field), 선택·주요 버튼은
   강조색(--accent), 도착지·추천 정차는 보조색(--warm). 테마 선택 UI는 그대로
   두고 /next에서만 각 테마를 이 구조로 다시 칠한다. */

body.next-ui {
  --nx-font: "IBM Plex Sans KR", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --nx-data: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --nx-pad: 12px;
  --nx-r-lg: 16px;
  --nx-r-md: 12px;
  --nx-r-sm: 9px;
  --nx-chip-h: 30px;
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
  font-family: var(--nx-font);
  word-break: keep-all;
  overflow-wrap: anywhere;
  background: var(--bg);
}

/* styles.css는 여러 테마에서 --ui-ink-*·--ui-accent-*를 이름보다 3~4배 진하게
   (예: --ui-ink-04 = 16%) 다시 정의하고, Tesla 테마는 청록으로 고정한다.
   /next에서는 모든 테마에서 이름 그대로의 농도로 맞추고 현재 강조색을 따르게 한다. */
body.next-ui[class] {
  --ui-ink-03: color-mix(in srgb, var(--ink) 3%, transparent);
  --ui-ink-04: color-mix(in srgb, var(--ink) 4%, transparent);
  --ui-ink-05: color-mix(in srgb, var(--ink) 5%, transparent);
  --ui-ink-06: color-mix(in srgb, var(--ink) 6%, transparent);
  --ui-ink-08: color-mix(in srgb, var(--ink) 8%, transparent);
  --ui-ink-10: color-mix(in srgb, var(--ink) 10%, transparent);
  --ui-ink-12: color-mix(in srgb, var(--ink) 12%, transparent);
  --ui-ink-13: color-mix(in srgb, var(--ink) 13%, transparent);
  --ui-ink-14: color-mix(in srgb, var(--ink) 14%, transparent);
  --ui-ink-15: color-mix(in srgb, var(--ink) 15%, transparent);
  --ui-ink-18: color-mix(in srgb, var(--ink) 18%, transparent);
  --ui-ink-20: color-mix(in srgb, var(--ink) 20%, transparent);
  --ui-ink-22: color-mix(in srgb, var(--ink) 22%, transparent);
  --ui-ink-25: color-mix(in srgb, var(--ink) 25%, transparent);
  --ui-ink-72: color-mix(in srgb, var(--ink) 72%, transparent);
  --ui-ink-78: color-mix(in srgb, var(--ink) 78%, transparent);
  --ui-ink-82: color-mix(in srgb, var(--ink) 82%, transparent);
  --ui-ink-92: color-mix(in srgb, var(--ink) 92%, transparent);
  --ui-accent-05: color-mix(in srgb, var(--accent) 5%, transparent);
  --ui-accent-07: color-mix(in srgb, var(--accent) 7%, transparent);
  --ui-accent-08: color-mix(in srgb, var(--accent) 8%, transparent);
  --ui-accent-09: color-mix(in srgb, var(--accent) 9%, transparent);
  --ui-accent-10: color-mix(in srgb, var(--accent) 10%, transparent);
  --ui-accent-12: color-mix(in srgb, var(--accent) 12%, transparent);
  --ui-accent-14: color-mix(in srgb, var(--accent) 14%, transparent);
  --ui-accent-16: color-mix(in srgb, var(--accent) 16%, transparent);
  --ui-accent-18: color-mix(in srgb, var(--accent) 18%, transparent);
  --ui-accent-20: color-mix(in srgb, var(--accent) 20%, transparent);
  --ui-accent-22: color-mix(in srgb, var(--accent) 22%, transparent);
  --ui-accent-24: color-mix(in srgb, var(--accent) 24%, transparent);
  --ui-accent-28: color-mix(in srgb, var(--accent) 28%, transparent);
  --ui-accent-32: color-mix(in srgb, var(--accent) 32%, transparent);
  --ui-accent-34: color-mix(in srgb, var(--accent) 34%, transparent);
  --ui-accent-42: color-mix(in srgb, var(--accent) 42%, transparent);
  --ui-accent-45: color-mix(in srgb, var(--accent) 45%, transparent);
  --ui-accent-50: color-mix(in srgb, var(--accent) 50%, transparent);
  --ui-plan-surface: var(--nx-card);
  --ui-plan-recommend-bg: color-mix(in srgb, var(--accent-soft) 55%, var(--nx-card));
  --ui-dock-surface: var(--nx-card);
  --ui-card: var(--nx-card);
  --ui-card-solid: var(--nx-card);
  --ui-panel-glass-border: var(--nx-hairline);
  --ui-highlight-row: color-mix(in srgb, var(--accent) 10%, var(--nx-card));
  --ui-planner-highlight: color-mix(in srgb, var(--accent) 8%, var(--nx-card));
  --success: var(--accent-strong);
  --warn-text: color-mix(in srgb, var(--warm) 80%, var(--ink));
  --cache-text: color-mix(in srgb, var(--accent) 75%, var(--ink));
  --link-blue-bg: var(--accent-soft);
  --link-blue-text: var(--accent-strong);
  --map-popup-ink: var(--ink);
  --map-popup-muted: var(--muted);
}

/* 기본: 차가운 회색 + 청록, 보조는 주황 */
body.next-ui:not([class*="theme-"]) {
  --bg: #e9edf0;
  --bg-strong: #e9edf0;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f3f5f7;
  --ink: #15201c;
  --muted: #5a6670;
  --line: #dbe1e6;
  --accent: #0b6e63;
  --accent-strong: #075249;
  --accent-soft: #e0f2ee;
  --warm: #b54a17;
  --warm-soft: #fdebe1;
  --sky: #e0f2ee;
  --nx-card: #ffffff;
  --nx-field: #f3f5f7;
  --nx-hairline: #dbe1e6;
  --nx-on-accent: #ffffff;
  --nx-tesla: #d0101c;
  --nx-shadow: 0 1px 2px rgba(20, 32, 40, 0.06), 0 6px 18px rgba(20, 32, 40, 0.05);
}

/* Tesla 레드: 무채색 회색 + 빨강, 보조는 흑연색 */
body.next-ui.theme-tesla {
  --bg: #ececee;
  --bg-strong: #ececee;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f4f4f5;
  --ink: #18181b;
  --muted: #5f5f67;
  --line: #dfdfe3;
  --accent: #cc0000;
  --accent-strong: #9b0000;
  --accent-soft: #fde8e8;
  --warm: #3f3f46;
  --warm-soft: #ececee;
  --sky: #fde8e8;
  --nx-card: #ffffff;
  --nx-field: #f4f4f5;
  --nx-hairline: #dfdfe3;
  --nx-on-accent: #ffffff;
  --nx-tesla: #cc0000;
  --nx-shadow: 0 1px 2px rgba(24, 24, 27, 0.06), 0 6px 18px rgba(24, 24, 27, 0.05);
}

/* 쿨 블루: 푸른 회색 + 파랑, 보조는 청록 */
body.next-ui.theme-cool {
  --bg: #e7ecf4;
  --bg-strong: #e7ecf4;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f2f5fa;
  --ink: #172036;
  --muted: #55627c;
  --line: #d8dfeb;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #e3edff;
  --warm: #0e7490;
  --warm-soft: #dcf3f8;
  --sky: #e3edff;
  --nx-card: #ffffff;
  --nx-field: #f2f5fa;
  --nx-hairline: #d8dfeb;
  --nx-on-accent: #ffffff;
  --nx-tesla: #d0101c;
  --nx-shadow: 0 1px 2px rgba(23, 32, 54, 0.06), 0 6px 18px rgba(23, 32, 54, 0.05);
}

/* 라벤더: 보랏빛 회색 + 보라, 보조는 자홍 */
body.next-ui.theme-lavender {
  --bg: #ebe8f2;
  --bg-strong: #ebe8f2;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f5f3f9;
  --ink: #221a33;
  --muted: #625977;
  --line: #dfdae9;
  --accent: #7c3aed;
  --accent-strong: #6327d1;
  --accent-soft: #efe7fe;
  --warm: #c0266d;
  --warm-soft: #fce6ef;
  --sky: #efe7fe;
  --nx-card: #ffffff;
  --nx-field: #f5f3f9;
  --nx-hairline: #dfdae9;
  --nx-on-accent: #ffffff;
  --nx-tesla: #d0101c;
  --nx-shadow: 0 1px 2px rgba(34, 26, 51, 0.06), 0 6px 18px rgba(34, 26, 51, 0.05);
}

/* 포레스트: 초록빛 회색 + 숲 초록, 보조는 호박색 */
body.next-ui.theme-forest {
  --bg: #e5ebe5;
  --bg-strong: #e5ebe5;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f1f5f1;
  --ink: #15241a;
  --muted: #4a6151;
  --line: #d5dfd6;
  --accent: #1e7a3c;
  --accent-strong: #155f2e;
  --accent-soft: #e0f1e5;
  --warm: #9a4508;
  --warm-soft: #fcefdc;
  --sky: #e0f1e5;
  --nx-card: #ffffff;
  --nx-field: #f1f5f1;
  --nx-hairline: #d5dfd6;
  --nx-on-accent: #ffffff;
  --nx-tesla: #d0101c;
  --nx-shadow: 0 1px 2px rgba(21, 36, 26, 0.06), 0 6px 18px rgba(21, 36, 26, 0.05);
}

/* 선셋: 따뜻한 회색 + 주황, 보조는 진홍 */
body.next-ui.theme-sunset {
  --bg: #f0eae4;
  --bg-strong: #f0eae4;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f8f4f0;
  --ink: #2a1a10;
  --muted: #6c584a;
  --line: #e6dcd2;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #ffeadb;
  --warm: #be123c;
  --warm-soft: #fde4ea;
  --sky: #ffeadb;
  --nx-card: #ffffff;
  --nx-field: #f8f4f0;
  --nx-hairline: #e6dcd2;
  --nx-on-accent: #ffffff;
  --nx-tesla: #be123c;
  --nx-shadow: 0 1px 2px rgba(42, 26, 16, 0.06), 0 6px 18px rgba(42, 26, 16, 0.05);
}

/* 로즈: 분홍빛 회색 + 로즈, 보조는 보라 */
body.next-ui.theme-rose {
  --bg: #f0e8eb;
  --bg-strong: #f0e8eb;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f8f3f5;
  --ink: #2a1520;
  --muted: #6b5461;
  --line: #e7dae0;
  --accent: #cf1f6f;
  --accent-strong: #a8155a;
  --accent-soft: #fde6f0;
  --warm: #6d28d9;
  --warm-soft: #efe7fe;
  --sky: #fde6f0;
  --nx-card: #ffffff;
  --nx-field: #f8f3f5;
  --nx-hairline: #e7dae0;
  --nx-on-accent: #ffffff;
  --nx-tesla: #d0101c;
  --nx-shadow: 0 1px 2px rgba(42, 21, 32, 0.06), 0 6px 18px rgba(42, 21, 32, 0.05);
}

/* 앰버: 모래빛 회색 + 호박, 보조는 청록 */
body.next-ui.theme-amber {
  --bg: #eeeae0;
  --bg-strong: #eeeae0;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-tint: #f7f4ec;
  --ink: #261d0b;
  --muted: #695b3e;
  --line: #e3dcca;
  --accent: #a84c06;
  --accent-strong: #863c04;
  --accent-soft: #fcefd6;
  --warm: #0f766e;
  --warm-soft: #daf2ee;
  --sky: #fcefd6;
  --nx-card: #ffffff;
  --nx-field: #f7f4ec;
  --nx-hairline: #e3dcca;
  --nx-on-accent: #ffffff;
  --nx-tesla: #d0101c;
  --nx-shadow: 0 1px 2px rgba(38, 29, 11, 0.06), 0 6px 18px rgba(38, 29, 11, 0.05);
}

/* 다크: 짙은 녹회색 + 밝은 청록, 보조는 살구색 */
body.next-ui.theme-dark {
  --bg: #0f1412;
  --bg-strong: #0f1412;
  --surface: #19201d;
  --surface-strong: #19201d;
  --surface-tint: #222b27;
  --ink: #e3eee9;
  --muted: #9cb2a9;
  --line: #2d3934;
  --accent: #34c9b4;
  --accent-strong: #6fdccb;
  --accent-soft: #173c36;
  --warm: #f08a4b;
  --warm-soft: #3b2618;
  --sky: #173c36;
  --nx-card: #19201d;
  --nx-field: #222b27;
  --nx-hairline: #2d3934;
  --nx-on-accent: #06231f;
  --nx-tesla: #ff5a64;
  --nx-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* 미드나잇: 짙은 남색 + 연보라, 보조는 분홍 */
body.next-ui.theme-midnight {
  --bg: #0b0e16;
  --bg-strong: #0b0e16;
  --surface: #151a27;
  --surface-strong: #151a27;
  --surface-tint: #1e2434;
  --ink: #e2e8f8;
  --muted: #a1acd4;
  --line: #29304a;
  --accent: #8b95fa;
  --accent-strong: #b4bcff;
  --accent-soft: #252a52;
  --warm: #f472b6;
  --warm-soft: #3a1d31;
  --sky: #252a52;
  --nx-card: #151a27;
  --nx-field: #1e2434;
  --nx-hairline: #29304a;
  --nx-on-accent: #0b0e2a;
  --nx-tesla: #ff5a64;
  --nx-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

/* hidden 속성은 언제나 숨김. styles.css의 .summary-grid {display:flex} 같은 규칙이
   hidden을 이겨서, 이전 '전체 경로 비교' 요약이 다른 검색 결과 위에 남아 있었다. */
body.next-ui [hidden] {
  display: none !important;
}

body.next-ui::before,
body.next-ui::after {
  display: none;
}

/* 상단 바에 스토어 링크가 있어 설치 배너는 띄우지 않는다. */
body.next-ui .beta-banner {
  display: none !important;
}

body.next-ui button,
body.next-ui input,
body.next-ui select,
body.next-ui textarea {
  font-family: inherit;
}

body.next-ui :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 상단 바 ---------- */

/* 아래 여백은 떠 있는 AI 도우미 버튼(56px + 여백)만큼 둬서, 페이지 끝까지 내렸을 때
   마지막 줄의 접기 버튼을 가리지 않게 한다. */
body.next-ui .page-shell {
  padding: max(8px, calc(var(--saf-top) + 4px)) max(12px, var(--saf-right)) calc(84px + var(--saf-bottom)) max(12px, var(--saf-left));
}

.nx-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin-bottom: 8px;
}

.nx-wordmark {
  flex: none;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.nx-links {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  margin-left: auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.nx-links::-webkit-scrollbar {
  display: none;
}

.nx-link {
  flex: none;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.nx-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

[data-nx-platform="ios"] .nx-store-android,
[data-nx-platform="android"] .nx-store-ios {
  display: none;
}

/* 아주 좁은 폰(≤380px)에서는 상단 링크가 넘치지 않게 스토어 링크를 '앱'으로 줄인다.
   폰에서는 기기에 맞는 스토어 링크 하나만 보이므로 뜻이 통한다. */
@media (max-width: 380px) {
  .nx-link .nx-long {
    display: none;
  }

  .nx-link {
    padding-inline: 6px;
  }
}

.nx-bar .theme-popover-wrap {
  flex: none;
}

/* ---------- 패널 ---------- */

body.next-ui .panel {
  min-height: 0;
  padding: var(--nx-pad);
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-lg);
  background: var(--nx-card);
  box-shadow: 0 1px 2px var(--ui-ink-04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.next-ui.theme-tesla .controls-panel {
  background: var(--nx-card);
}

body.next-ui .workspace {
  gap: 10px;
}

/* 한 줄 가로 스크롤 칩이 그리드 칸을 넓히지 않도록 */
body.next-ui .workspace > *,
body.next-ui .desktop-rail > *,
body.next-ui .search-form,
body.next-ui .planner-overview,
body.next-ui .section-title,
body.next-ui .section-actions,
body.next-ui .overview-filter-stack {
  min-width: 0;
}

/* 검색 패널 제목은 상단 바가 대신하므로 화면에서는 숨긴다(스크린리더용은 유지). */
body.next-ui .controls-panel > .panel-head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body.next-ui .controls-panel {
  position: static;
  gap: 0;
}

/* ---------- 경로/주변 탭: 밑줄 탭 ---------- */

body.next-ui .controls-panel {
  padding: 4px 14px 14px;
}

body.next-ui .tabs {
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--nx-hairline);
  border-radius: 0;
  background: transparent;
}

body.next-ui .tab-button {
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: inset 0 -2px 0 transparent;
}

body.next-ui .tab-button[aria-selected="true"] {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---------- 충전 모드: 세그먼트 컨트롤 ---------- */

body.next-ui .controls-panel .route-option-row.charger-mode-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 14px 0 0;
  padding: 3px;
  overflow: visible;
  border-radius: var(--nx-r-md);
  background: var(--ui-ink-05);
}

body.next-ui .controls-panel .route-option-row.charger-mode-row .route-option-label {
  position: absolute;
  width: 1px;
  height: 1px;
  min-width: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body.next-ui .controls-panel .route-option-row.charger-mode-row .kw-btn,
body.next-ui .controls-panel .route-option-row.charger-mode-row .kw-btn.is-active {
  min-height: 34px;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--nx-r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: none;
}

body.next-ui .controls-panel .route-option-row.charger-mode-row .kw-btn.is-active {
  background: var(--nx-card);
  color: var(--accent);
  box-shadow: 0 1px 3px var(--ui-ink-12);
}

body.next-ui .controls-panel .route-option-row.charger-mode-row .charger-mode-tesla.is-active {
  color: var(--nx-tesla);
}

/* ---------- 출발·도착: 하나로 묶은 입력 상자 ---------- */

body.next-ui .search-form.is-active {
  display: block;
}

body.next-ui .search-form .form-grid {
  position: relative;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 12px;
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: var(--nx-card);
}

body.next-ui .search-form .form-grid:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ui-accent-18);
}

body.next-ui .search-form .form-grid .field {
  gap: 0;
}

body.next-ui .search-form .form-grid .field + .field {
  border-top: 1px solid var(--nx-hairline);
}

body.next-ui .search-form .form-grid .field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body.next-ui .search-form .form-grid input {
  min-height: 44px;
  padding-left: 40px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
}

body.next-ui .search-form .form-grid input:focus {
  border: 0;
  box-shadow: none;
}

/* 출발 ○ / 도착 ● 표시 */
body.next-ui .search-form .form-grid .input-quick-wrap::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--nx-card);
  pointer-events: none;
}

body.next-ui .search-form .form-grid .field:last-child .input-quick-wrap::before {
  border-color: var(--warm);
  background: var(--warm);
}

/* 출발·도착 전환은 두 칸 사이 왼쪽에 둥근 버튼으로 */
body.next-ui .route-field-label-row {
  position: absolute;
  left: 7px;
  top: 50%;
  z-index: 3;
  min-height: 0;
  transform: translateY(-50%);
}

body.next-ui .route-swap-button {
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--nx-hairline);
  border-radius: 50%;
  background: var(--nx-card);
  color: var(--accent);
  font-size: 0.85rem;
  box-shadow: 0 1px 3px var(--ui-ink-10);
}

body.next-ui .route-swap-button > span:not(.route-swap-icon) {
  display: none;
}

/* ---------- 옵션: 접힌 요약 줄 + 펼친 칩 ---------- */

body.next-ui .nx-options {
  margin-top: 10px;
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-md);
}

body.next-ui .nx-options-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

body.next-ui .nx-options-summary::-webkit-details-marker {
  display: none;
}

body.next-ui .nx-options-label {
  flex: none;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
}

/* 고른 옵션이 길면(예: 고속도로우선 · 전체 · 전체 EV 충전소) 잘라내지 않고 두 줄로 */
body.next-ui .nx-options-values {
  flex: 1 1 auto;
  min-width: 0;
  padding-block: 10px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.35;
}

body.next-ui .nx-options-edit {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

body.next-ui .nx-options-edit::after {
  content: "▾";
  font-size: 0.8rem;
  line-height: 1;
}

body.next-ui .nx-options[open] .nx-options-edit::after {
  content: "▴";
}

body.next-ui .nx-options[open] .nx-options-summary {
  border-bottom: 1px solid var(--nx-hairline);
}

body.next-ui .nx-options-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
}

/* 펼친 칩은 줄바꿈해서 모두 보이게, 라벨은 왼쪽 고정 칸 */
body.next-ui .controls-panel .route-option-row {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0 0 0 44px;
}

body.next-ui .controls-panel .option-button-group {
  display: contents;
}

body.next-ui .controls-panel .route-option-label {
  position: absolute;
  left: 0;
  top: 8px;
  margin: 0;
  padding: 0;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

body.next-ui #nearby-form .route-option-row {
  margin-top: 12px;
}

/* 부드러운 칩: 테두리 없이 옅은 바탕, 선택하면 청록 */
body.next-ui .kw-btn {
  border-radius: 999px;
  border-color: var(--nx-hairline);
}

body.next-ui .controls-panel .kw-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid transparent;
  background: var(--ui-ink-05);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

body.next-ui .controls-panel .kw-btn:hover {
  border-color: var(--ui-accent-34);
  color: var(--accent-strong);
}

body.next-ui .controls-panel .kw-btn.is-active {
  border-color: var(--ui-accent-34);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

body.next-ui .map-label-row .kw-btn,
body.next-ui .planner-overview .kw-btn {
  flex: 0 0 auto;
  min-height: var(--nx-chip-h);
  padding: 3px 11px;
  background: var(--nx-card);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

body.next-ui .map-label-row .kw-btn.is-active,
body.next-ui .planner-overview .kw-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--nx-on-accent);
  font-weight: 600;
}

body.next-ui .poi-dist-hint {
  flex: none;
  white-space: nowrap;
}

/* 집·회사·현위치: 테두리 없는 글자 버튼 */
body.next-ui .quick-place-btn {
  min-height: 28px;
  padding: 2px 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

body.next-ui .quick-place-btn[data-place-action="location"] {
  color: var(--accent);
}

body.next-ui .quick-place-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* ---------- 버튼·상태 ---------- */

body.next-ui .form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
  padding-top: 0;
  border-top: 0;
}

body.next-ui #nearby-form .form-actions {
  grid-template-columns: 1fr;
}

body.next-ui .button {
  min-height: 42px;
  border-radius: var(--nx-r-md);
  font-weight: 600;
}

body.next-ui .form-actions .button {
  width: 100%;
}

body.next-ui .button-primary {
  background: var(--accent);
  color: var(--nx-on-accent);
  box-shadow: none;
}

body.next-ui .button-primary:hover {
  background: var(--accent-strong);
}

body.next-ui .button-secondary {
  padding: 0 14px;
  border: 1px solid var(--nx-hairline);
  background: var(--nx-card);
  color: var(--ink);
}

body.next-ui .status {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: var(--nx-r-sm);
  font-size: 0.8rem;
  line-height: 1.45;
}

/* "…입력하세요." 같은 처음 안내 문구는 '옵션' 줄과 내용이 겹쳐 숨기고,
   진행·완료·오류 메시지만 보인다(data-nx-quiet는 next.html 스크립트가 붙인다). */
body.next-ui .status-idle,
body.next-ui .status[data-nx-quiet="1"] {
  display: none;
}

/* ---------- 상세 설정 ---------- */

body.next-ui .form-extra {
  margin-top: 6px;
}

body.next-ui .form-extra-toggle {
  min-height: 34px;
  padding: 6px 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

body.next-ui .form-extra-toggle:hover {
  background: transparent;
  color: var(--accent);
}

body.next-ui .form-extra[open] {
  padding: 4px 10px 10px;
  border-color: var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: transparent;
  box-shadow: none;
}

body.next-ui .form-extra[open] .form-extra-toggle {
  border: 0;
  background: transparent;
  color: var(--accent);
}

body.next-ui .field span {
  font-size: 0.74rem;
  font-weight: 600;
}

body.next-ui .field input,
body.next-ui .field select,
body.next-ui .field-compact select {
  border-color: var(--nx-hairline);
  border-radius: var(--nx-r-sm);
  background: var(--nx-card);
}

/* ---------- 지도 ---------- */

body.next-ui .map-panel {
  gap: 8px;
  padding: 8px;
}

body.next-ui .map-panel > .panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "labels expand"
    "caption caption";
  align-items: center;
  gap: 4px 8px;
}

body.next-ui .map-panel > .panel-head h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

body.next-ui .map-label-row {
  grid-area: labels;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

body.next-ui .map-label-row::-webkit-scrollbar {
  display: none;
}

body.next-ui .map-label-row .route-option-label {
  flex: none;
  font-size: 0.72rem;
  font-weight: 600;
}

body.next-ui .map-label-row .option-button-group {
  display: contents;
}

body.next-ui .map-expand-btn {
  grid-area: expand;
  position: static;
  width: var(--nx-chip-h);
  height: var(--nx-chip-h);
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-sm);
  background: var(--nx-card);
}

body.next-ui #map-caption {
  grid-area: caption;
  margin: 0;
  overflow: hidden;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.next-ui #map {
  height: min(38vh, 320px);
  min-height: 220px;
  max-height: none;
  border-radius: var(--nx-r-md);
  overflow: hidden;
}

body.next-ui .map-panel--fullscreen #map {
  height: auto;
  max-height: none;
}

/* ---------- 결과: 충전 플랜 요약 띠 ---------- */

body.next-ui .results-panel > .panel-head h2 {
  font-size: 1rem;
  font-weight: 700;
}

body.next-ui .results-meta-inline {
  font-size: 0.76rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

body.next-ui .empty-state {
  border: 1px dashed var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: transparent;
  box-shadow: none;
}

body.next-ui .trip-plan-card {
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: var(--nx-card);
  box-shadow: none;
}

body.next-ui .trip-plan-route {
  font-weight: 700;
}

body.next-ui .trip-plan-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 8px 2px;
  border: 0;
  border-radius: var(--nx-r-sm);
  background: var(--accent-soft);
}

body.next-ui .trip-plan-metrics .summary-item {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 1px;
  min-width: 0;
  padding: 0 8px;
  border: 0;
  background: transparent;
}

body.next-ui .trip-plan-metrics .summary-item + .summary-item {
  border-left: 1px solid var(--nx-hairline);
}

body.next-ui .trip-plan-metrics .summary-item em {
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}

body.next-ui .trip-plan-metrics .summary-item strong {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

/* 1차·2차 추천 정차 */

body.next-ui .situation-plan-card {
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: var(--nx-card);
  box-shadow: none;
}

body.next-ui .situation-plan-rank {
  font-family: var(--nx-data);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--warm);
}

body.next-ui .situation-plan-name {
  font-weight: 600;
}

body.next-ui .situation-plan-distance,
body.next-ui .situation-avail,
body.next-ui .ov-distance-emphasis,
body.next-ui .ov-avail-emphasis,
body.next-ui .ov-group-nums,
body.next-ui .overview-rank,
body.next-ui .station-rank {
  font-family: var(--nx-data);
  font-variant-numeric: tabular-nums;
}

body.next-ui .situation-plan-distance,
body.next-ui .ov-distance-emphasis {
  color: var(--muted);
  font-weight: 600;
}

/* 한눈에 보기 */

body.next-ui .section-title h3 {
  font-size: 0.96rem;
  font-weight: 700;
}

body.next-ui .overview-filter-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

/* 필터도 줄바꿈 대신 한 줄 가로 스크롤. 오른쪽 끝을 흐리게 해서 칩이 잘린 게
   아니라 더 밀어 볼 수 있다는 걸 보여 준다(넘치지 않을 때는 안쪽 여백만 흐려져
   보이지 않는다). */
body.next-ui .overview-filter-group {
  flex-wrap: nowrap;
  max-width: 100%;
  padding-right: 24px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}

/* 칩은 줄어들지 않고 한 줄로. 한 줄 가로 스크롤 줄에서 칩이 줄어들 수 있으면
   AI 도우미 결과의 사업자 필터처럼 '전/체', '현대/자동/차'로 글자가 쪼개졌다. */
body.next-ui .overview-filter-group > .kw-btn,
body.next-ui .overview-filter-group > .overview-filter-label {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* AI 도우미 결과의 필터 칩도 본문 '한눈에 보기' 칩과 같은 크기로 */
body.next-ui .ai-overview-filters .kw-btn {
  min-height: var(--nx-chip-h);
  padding: 3px 11px;
  font-size: 0.78rem;
}

/* 슈퍼차저 모드에서는 필터 묶음이 제목 밖(카드 바로 아래)에 있어 안쪽 여백이 없었다. */
body.next-ui .planner-overview .planner-section > .overview-filter-stack {
  padding: 0 12px 12px;
}

/* 우회 시간 필터는 버튼 다섯 개뿐이라 스크롤 대신 줄바꿈으로 모두 보이게 하고,
   폰에서는 짧은 이름(5분·10분…)을 쓴다. '우회' 라벨이 뜻을 알려 준다. */
body.next-ui .overview-filter-group.tesla-detour-filter {
  flex-wrap: wrap;
  padding-right: 0;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}

@media (max-width: 560px) {
  body.next-ui .tesla-detour-filter .kw-btn-text--long {
    display: none;
  }

  body.next-ui .tesla-detour-filter .kw-btn-text--short {
    display: inline;
  }
}

body.next-ui .overview-filter-group::-webkit-scrollbar {
  display: none;
}

body.next-ui .overview-table-wrap,
body.next-ui .overview-empty {
  border-color: var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: var(--nx-card);
  box-shadow: none;
}

body.next-ui .overview-table th {
  background: transparent;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

body.next-ui .overview-rank {
  color: var(--muted);
  font-size: 0.78rem;
}

body.next-ui .ov-name-link strong {
  font-weight: 600;
}

/* 충전소 상세 카드 */

body.next-ui .station-card,
body.next-ui .recommend-card,
body.next-ui .planner-row,
body.next-ui .route-choice-card,
body.next-ui .situation-plan-card {
  border-color: var(--nx-hairline);
  border-radius: var(--nx-r-md);
  box-shadow: none;
}

body.next-ui .station-card {
  background: var(--nx-card);
}

body.next-ui .station-rank {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--nx-on-accent);
  font-size: 0.78rem;
  font-weight: 600;
}

body.next-ui .station-title-link {
  font-weight: 700;
}

body.next-ui .pill {
  border: 1px solid var(--nx-hairline);
  border-radius: 999px;
  background: var(--nx-card);
  font-weight: 500;
}

body.next-ui .pill-accent {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 600;
}

body.next-ui .pill-warm {
  border-color: transparent;
  background: var(--warm-soft);
  color: var(--warm);
  font-weight: 600;
}

body.next-ui .station-actions .focus-button,
body.next-ui .station-actions .action-link,
body.next-ui .station-actions .copy-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--nx-chip-h);
  padding: 0 12px;
  border: 1px solid var(--nx-hairline);
  border-radius: 999px;
  background: var(--nx-card);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
}

body.next-ui .station-actions .focus-button {
  border-color: transparent;
  background: var(--accent);
  color: var(--nx-on-accent);
}

body.next-ui .situation-dock-btn {
  border-color: var(--nx-hairline);
  border-radius: var(--nx-r-md);
}

/* ---------- AI 도우미 버튼 ---------- */

body.next-ui .ai-fab {
  border: 0;
  color: var(--nx-on-accent);
}

body.next-ui .ai-fab .ai-beta-badge {
  border: 0;
  background: var(--nx-on-accent);
  color: var(--accent-strong);
}

body.next-ui .seo-links-panel {
  margin-top: 12px;
}

/* ---------- 영역 구분: 카드 / 필드 / 결과 ---------- */

body.next-ui .panel {
  border-color: var(--nx-hairline);
  box-shadow: var(--nx-shadow);
}

/* 조작 영역은 필드 바탕(테두리 없이 면으로 구분) */
body.next-ui .search-form .form-grid {
  border-color: transparent;
  background: var(--nx-field);
}

body.next-ui .search-form .form-grid:focus-within {
  border-color: var(--accent);
  background: var(--nx-card);
}

body.next-ui .search-form .form-grid .field + .field {
  border-top-color: var(--nx-hairline);
}

body.next-ui .search-form .form-grid .input-quick-wrap::before {
  background: var(--nx-field);
}

body.next-ui .search-form .form-grid:focus-within .input-quick-wrap::before {
  background: var(--nx-card);
}

body.next-ui .controls-panel .route-option-row.charger-mode-row {
  background: var(--nx-field);
}

body.next-ui .nx-options {
  border-color: transparent;
  background: var(--nx-field);
}

body.next-ui .nx-options[open] .nx-options-summary {
  border-bottom-color: var(--nx-hairline);
}

/* 칩: 흰 바탕 + 선. 선택은 청록 면 */
body.next-ui .controls-panel .kw-btn {
  border-color: var(--nx-hairline);
  background: var(--nx-card);
}

body.next-ui .controls-panel .kw-btn.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--nx-on-accent);
}

body.next-ui .button-secondary {
  border-color: var(--nx-hairline);
  background: var(--nx-card);
}

body.next-ui .form-extra[open] {
  background: var(--nx-field);
  border-color: transparent;
}

/* 결과: 패널 껍데기를 걷어내고 각 블록을 바탕 위 독립 카드로 */
body.next-ui .results-panel {
  padding: 4px 0 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.next-ui .results-panel > .panel-head {
  padding: 0 4px;
}

body.next-ui .results-panel > .panel-head h2 {
  font-size: 1.08rem;
}

body.next-ui .trip-plan-card,
body.next-ui .overview-table-wrap,
body.next-ui .station-card,
body.next-ui .overview-empty {
  border: 1px solid var(--nx-hairline);
  background: var(--nx-card);
  box-shadow: var(--nx-shadow);
}

body.next-ui .station-card.is-recommended {
  border-color: var(--warm);
  background: var(--nx-card);
}

body.next-ui .empty-state {
  border-color: var(--nx-hairline);
  background: var(--nx-card);
}

body.next-ui .section-title {
  padding: 0 4px;
}

body.next-ui .overview-table th {
  background: var(--nx-field);
}

body.next-ui .result-section > .detail-section-summary,
body.next-ui .detail-section-summary {
  padding-inline: 4px;
}

/* '한눈에 보기'는 충전 플랜 요약과 다른 일(충전소 비교)을 하므로 간격을 넓히고
   제목·필터·표를 한 장의 카드로 묶는다. 표는 카드 폭을 그대로 쓰도록 가장자리까지 붙인다. */
body.next-ui .results-panel {
  gap: 12px;
}

body.next-ui .planner-overview {
  margin-top: 10px;
}

body.next-ui .planner-overview .planner-section {
  overflow: hidden;
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-lg);
  background: var(--nx-card);
  box-shadow: var(--nx-shadow);
}

body.next-ui .planner-overview .section-title {
  margin: 0;
  padding: 14px 12px 12px;
}

body.next-ui .planner-overview .section-title h3 {
  font-size: 1.02rem;
}

body.next-ui .planner-overview .overview-table-wrap {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--nx-hairline);
  border-radius: 0;
  box-shadow: none;
}

/* styles.css가 밝은 배경을 직접 박아 둔 요소들: 다크 계열 테마에서 글자가 묻히지
   않도록 /next에서는 테마 토큰으로 다시 칠한다. */
body.next-ui .share-button {
  border: 1px solid var(--nx-hairline);
  border-radius: 999px;
  background: var(--nx-card);
  color: var(--accent-strong);
}

body.next-ui .detail-section-collapsible {
  border-color: var(--nx-hairline);
  background: transparent;
}

body.next-ui .detail-section-summary,
body.next-ui .detail-section-summary strong {
  color: var(--ink);
}

body.next-ui .detail-section-summary span {
  color: var(--muted);
}

body.next-ui .planner-highlight {
  border-color: transparent;
  background: var(--accent);
  color: var(--nx-on-accent);
}

body.next-ui .amenity-chip {
  border-color: var(--nx-hairline);
  background: var(--nx-field);
  color: var(--ink);
}

/* 입력 글자색: styles.css 다크 테마는 입력칸 글자를 어둡게 고정해 둬서
   /next의 어두운 필드 위에서 안 보인다. 모든 테마에서 본문색으로. */
body.next-ui input,
body.next-ui select,
body.next-ui textarea {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}

body.next-ui input::placeholder,
body.next-ui textarea::placeholder {
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  opacity: 0.8;
}

body.next-ui select option {
  background: var(--nx-card);
  color: var(--ink);
}

/* 장소 추천·최근 검색 드롭다운: 열려 있는 동안 출발·도착 전환 버튼이 위로 비치지
   않게 숨기고, 모양은 카드와 맞춘다. */
body.next-ui .search-form .form-grid:has(.poi-suggest-dropdown, .search-history-dropdown) .route-field-label-row {
  visibility: hidden;
}

body.next-ui .poi-suggest-dropdown,
body.next-ui .search-history-dropdown {
  border-color: var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: var(--nx-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

body.next-ui .poi-suggest-item,
body.next-ui .search-history-item {
  border-color: var(--nx-hairline);
}

body.next-ui .poi-suggest-item:hover,
body.next-ui .poi-suggest-item.is-active,
body.next-ui .search-history-item:hover {
  background: var(--nx-field);
}

/* 전체 경로 비교 요약도 충전 플랜과 같은 요약 띠로 */
body.next-ui #summary.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 10px 2px;
  border: 1px solid var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: var(--nx-card);
  box-shadow: var(--nx-shadow);
}

body.next-ui #summary .summary-item {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 1px;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.next-ui #summary .summary-item + .summary-item {
  border-left: 1px solid var(--nx-hairline);
}

body.next-ui #summary .summary-item em {
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 600;
  color: var(--muted);
}

body.next-ui #summary .summary-item strong {
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 경로 선택 카드: 좁은 화면에서는 한 줄에 하나씩 (2열이면 시간·요금이 줄바꿈된다) */
body.next-ui .route-choice-card {
  border-color: var(--nx-hairline);
  border-radius: var(--nx-r-md);
  background: var(--nx-card);
}

@media (max-width: 560px) {
  body.next-ui .route-choice-grid {
    grid-template-columns: 1fr;
  }
}

/* 지도 위에 뜨는 라벨·안내는 지도 타일이 항상 밝으므로 테마와 상관없이 어둡게.
   (styles.css는 --ui-ink-*로 칠해서 다크 테마에서는 밝은 바탕에 흰 글자가 된다) */
body.next-ui .leaflet-tooltip.map-pin-tooltip,
body.next-ui .map-gesture-hint span,
body.next-ui .map-nav-badge span,
body.next-ui .map-lock-btn {
  background: rgba(18, 22, 26, 0.84);
  color: #fff;
}

body.next-ui .leaflet-tooltip.map-pin-tooltip {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

/* 한눈에 보기에서 강조된 행: 다크 테마의 흰빛 그라디언트 대신 테마 강조색 면 */
body.next-ui .overview-row.is-highlighted {
  background: var(--ui-highlight-row);
}

/* Tesla 모드의 우회 시간 태그는 어두운 빨강(#a80000)이 박혀 있어 다크 계열에서 읽히지
   않는다(1.8:1). 다크·미드나잇에서는 밝은 빨강으로. */
body.next-ui.theme-dark .situation-plan-detour,
body.next-ui.theme-dark .tesla-detour-label,
body.next-ui.theme-dark .tesla-detour-pill,
body.next-ui.theme-midnight .situation-plan-detour,
body.next-ui.theme-midnight .tesla-detour-label,
body.next-ui.theme-midnight .tesla-detour-pill {
  border-color: rgba(255, 110, 118, 0.45);
  background: rgba(255, 90, 100, 0.14);
  color: #ff9aa0;
}

/* AI 도우미: 강조색 위 흰 글자는 다크 계열에서 밝은 강조색 위라 안 읽힌다. */
body.next-ui .ai-avatar,
body.next-ui .ai-send {
  color: var(--nx-on-accent);
}

body.next-ui .ai-beta-badge-title {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

body.next-ui.theme-dark .ai-key-status.is-empty,
body.next-ui.theme-midnight .ai-key-status.is-empty {
  color: #ff9aa0;
}

body.next-ui.theme-dark .ai-error,
body.next-ui.theme-midnight .ai-error {
  background: rgba(255, 90, 100, 0.14);
  color: #ff9aa0;
}

/* 주차 배지: 미드나잇도 다크와 같은 어두운 배지로 */
body.next-ui.theme-midnight .ov-parking-badge.is-free {
  border-color: #2f8f5b;
  background: rgba(47, 143, 91, 0.2);
  color: #8ce0ae;
}

body.next-ui.theme-midnight .ov-parking-badge.is-paid {
  border-color: #bd6532;
  background: rgba(189, 101, 50, 0.2);
  color: #ffc092;
}

body.next-ui.theme-midnight .ov-parking-badge.is-mixed {
  border-color: #7468bd;
  background: rgba(116, 104, 189, 0.2);
  color: #c7c0ff;
}

/* 지도 패널 머리: 지도와 조작 줄 사이를 선으로 나눈다 */
body.next-ui .map-panel > .panel-head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--nx-hairline);
}

/* 경로 타임라인의 선은 장식이다. 점 위에 겹쳐 그려져서 점 가운데를 누르면
   선이 눌렸다(점의 버튼이 반응하지 않음). */
body.next-ui .route-timeline-line {
  pointer-events: none;
}

/* ---------- 터치 기기: 작은 조작 요소의 누르는 영역 넓히기 ----------
   표 안의 '지도·상세·내비'(높이 12px), 사업자 배지(16px), 경로 점(12~14px),
   최근 검색 버튼(24px) 등은 손가락으로 누르기 어렵다. 화면 높이를 늘리지 않도록
   보이지 않는 ::after로 누르는 영역만 넓힌다. */
@media (pointer: coarse) {
  body.next-ui .ov-actions-row .ov-link,
  body.next-ui .ov-link.focus-button,
  body.next-ui .ov-route-info-trigger,
  body.next-ui .quick-place-btn,
  body.next-ui .overview-compact-btn {
    position: relative;
  }

  body.next-ui .ov-actions-row .ov-link::after,
  body.next-ui .ov-link.focus-button::after,
  body.next-ui .ov-route-info-trigger::after,
  body.next-ui .quick-place-btn::after,
  body.next-ui .overview-compact-btn::after {
    content: "";
    position: absolute;
    inset: -8px -3px;
  }

  body.next-ui .op-badge-btn::after,
  body.next-ui .ov-parking-badge::after {
    content: "";
    position: absolute;
    inset: -8px;
  }

  body.next-ui .history-icon-btn::after {
    content: "";
    position: absolute;
    inset: -10px;
  }

  /* 경로 점은 서로 붙어 있을 수 있어 위아래로만 넓힌다(옆 점을 가리지 않게). */
  body.next-ui .route-timeline-dot::after {
    content: "";
    position: absolute;
    inset: -12px 0;
  }

  /* '+'를 ::after로 그리는 접기 줄들은 높이로 영역을 키운다. */
  body.next-ui .amenity-summary,
  body.next-ui .station-detail-summary,
  body.next-ui .station-card details > summary {
    min-height: 36px;
    align-items: center;
  }
}

/* ---------- 900px 이상: 사이드바 + 전체 높이 지도 ---------- */

@media (min-width: 900px) {
  body.next-ui {
    --page-width: none;
  }

  body.next-ui .page-shell {
    max-width: none;
    padding: max(10px, calc(var(--saf-top) + 4px)) 16px calc(84px + var(--saf-bottom));
  }

  body.next-ui .workspace {
    grid-template-columns: minmax(380px, 30rem) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "controls map"
      "results map";
    gap: 12px 14px;
    align-items: start;
  }

  /* 내 충전소 카드(app.js renderSavedStations)가 있을 때만 검색 조건 위에 한 칸을 더한다. */
  body.next-ui .workspace.has-saved-stations {
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "saved map"
      "controls map"
      "results map";
  }

  body.next-ui .desktop-rail {
    display: contents;
    width: auto;
  }

  body.next-ui .controls-panel {
    grid-area: controls;
    width: auto;
    padding: 4px 14px 14px;
  }

  /* 상단 바는 고정(56px)하고 지도는 그 아래에 붙인다. 지도 높이가 스크롤 위치와
     상관없이 상단 바 아래부터 화면 끝 10px 위까지로 정확히 맞는다. */
  body.next-ui .nx-bar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: 56px;
    margin: calc(-1 * max(10px, calc(var(--saf-top) + 4px))) 0 8px;
    padding-top: max(10px, calc(var(--saf-top) + 4px));
    background: var(--bg);
  }

  /* 지도 카드 아래쪽에 떠 있는 AI 도우미 버튼 자리를 비워 둔다. 지도가 화면 끝까지
     내려오면 버튼이 지도 확대·축소 버튼과 NAVER 로고를 늘 가리고 있었다. */
  body.next-ui .map-panel {
    grid-area: map;
    position: sticky;
    top: 64px;
    width: auto;
    height: calc(100vh - 74px);
    padding: 10px 10px 74px;
  }

  /* 스크롤하면 나타나는 '충전 플랜' 바는 사이드바 폭에만 걸치게(지도 위로 넘지 않게). */
  body.next-ui .situation-board-dock {
    left: 16px;
    right: auto;
    width: 30rem;
    border: 1px solid var(--nx-hairline);
    border-top: 0;
    border-radius: 0 0 var(--nx-r-md) var(--nx-r-md);
  }

  body.next-ui #map {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }

  body.next-ui .results-panel {
    grid-area: results;
    /* styles.css의 1181px+ 규칙이 justify-self:start를 주는데, 결과 패널은
       container-type 컨테이너라 내용 폭이 0으로 잡혀 26px로 줄어든다. */
    justify-self: stretch;
    width: auto;
    min-height: 0;
    padding: 4px 0 0;
  }

  /* 사이드바 폭에서는 '한눈에 보기' 제목과 필터를 위아래로 쌓는다. */
  body.next-ui .section-title:has(.section-actions) {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  body.next-ui .section-actions {
    justify-content: flex-start;
    width: 100%;
  }

  body.next-ui .results-panel .summary-grid,
  body.next-ui .results-panel .situation-board,
  body.next-ui .results-panel .situation-board-dock,
  body.next-ui .results-panel .planner-overview,
  body.next-ui .results-panel #results,
  body.next-ui .results-panel .empty-state {
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.next-ui .tab-button,
  body.next-ui .kw-btn {
    transition: none;
  }
}

/* ---------- AI 도우미 마이크 ---------- */
body.next-ui .ai-compose:has(#ai-mic) {
  grid-template-columns: 1fr auto auto;
}

body.next-ui .ai-mic {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--nx-hairline);
  border-radius: 12px;
  background: var(--nx-card);
  color: var(--accent);
  cursor: pointer;
}

body.next-ui .ai-mic.is-recording {
  border-color: #d92d20;
  background: #d92d20;
  color: #fff;
  animation: nx-mic-pulse 1.2s ease-in-out infinite;
}

body.next-ui .ai-mic.is-transcribing {
  opacity: 0.55;
  cursor: progress;
}

@keyframes nx-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(217, 45, 32, 0); }
}

@media (prefers-reduced-motion: reduce) {
  body.next-ui .ai-mic.is-recording { animation: none; }
}
