/* ---- 物件位置推定パネル ---- */
.prop-loc-panel {
  position: absolute;
  top: 60px;
  right: 60px;
  width: 320px;
  max-height: calc(100% - 80px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  z-index: 55;
  font-size: 13px;
  color: var(--text);
}
.prop-loc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.prop-loc-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 0 4px;
  line-height: 1;
}
.prop-loc-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.prop-loc-label { font-size: 12px; color: var(--text-muted); }
.prop-loc-textarea {
  width: 100%;
  height: 110px;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}
.prop-loc-btn {
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.prop-loc-btn:disabled { opacity: .5; cursor: not-allowed; }
.prop-loc-result { border-top: 1px solid var(--border); padding-top: 10px; }
.prop-loc-loading { color: var(--text-muted); font-size: 12px; }
.prop-loc-error { color: #d32f2f; font-size: 12px; }
.prop-loc-area-info { font-size: 12px; padding: 6px 10px; border-radius: 6px; margin-bottom: 8px; font-weight: 600; }
.prop-loc-area-selected { background: #1e3a5f; color: #60a5fa; }
.prop-loc-area-warn { background: #3a2a00; color: #f59e0b; }
.prop-loc-facilities { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.prop-loc-facility {
  display: grid;
  grid-template-columns: 18px 1fr auto auto auto auto;
  gap: 4px;
  font-size: 11px;
  align-items: center;
}
.prop-loc-facility-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prop-loc-facility-dist { color: var(--text-muted); white-space: nowrap; }
.prop-loc-facility-src {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-stripe);
  color: var(--text-muted);
  white-space: nowrap;
}
.prop-loc-facility-diff { font-size: 11px; white-space: nowrap; padding: 1px 4px; border-radius: 3px; }
.prop-loc-facility-diff.diff-ok { color: #22c55e; }
.prop-loc-facility-diff.diff-warn { color: #f59e0b; }
.prop-loc-facility-outlier { opacity: 0.45; }
.prop-loc-outlier-badge { font-size: 10px; padding: 1px 5px; border-radius: 3px; background: #7f1d1d; color: #fca5a5; white-space: nowrap; }
.prop-loc-summary {
  font-size: 13px;
  font-weight: 600;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

/* ---- ツールチップ（data-tooltip 属性で使用） ---- */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,30,.92);
  color: #f0f0f0;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-width: 220px;
  width: max-content;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0,0,0,.3);
  font-weight: 400;
}
[data-tooltip]:hover::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%; transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(20,20,30,.92);
  z-index: 9999; pointer-events: none;
}

/* ---- CSS カスタムプロパティ（ライトテーマ） ---- */
:root {
  --accent: #e66767;
  --accent-dark: #c44e4e;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #202124;
  --text-muted: #5f6368;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.12);
  --shadow-md: 0 2px 8px rgba(0,0,0,.16);
  --radius: 12px;
  --up-color: #d32f2f;
  --down-color: #2E7D32;
  /* 派生カラー */
  --bg-hover: #f0f0f0;
  --bg-active: color-mix(in srgb, var(--accent) 12%, var(--bg));
  --bg-stripe: #f5f5f5;
  --bg-subtle: #fafafa;
  --badge-bg: #eeeeee;
  --rate-up-bg: #fce8e8;
  --rate-down-bg: #e8f5e9;
  --score-good-bg: #e8f5e9;
  --score-ok-bg: #fff3e0;
  --score-stub-bg: #fafafa;
  --alert-warn-bg: #FFF3E0;
  --alert-warn-border: #FFB74D;
  --alert-warn-text: #BF360C;
}

/* ---- ダークテーマ ---- */
[data-theme="dark"] {
  --accent: #4da6ff;
  --accent-dark: #80bdff;
  --bg: #111318;
  --surface: #1c1f26;
  --border: #2e3138;
  --text: #e3e5e8;
  --text-muted: #8a9099;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.5);
  --shadow-md: 0 2px 8px rgba(0,0,0,.7);
  --up-color: #f28b82;
  --down-color: #81c995;
  --bg-hover: #2d3139;
  --bg-active: #1a2e52;
  --bg-stripe: #181b22;
  --bg-subtle: #181b22;
  --badge-bg: #2d3139;
  --rate-up-bg: #3d1515;
  --rate-down-bg: #152a18;
  --score-good-bg: #152a18;
  --score-ok-bg: #2d2200;
  --score-stub-bg: #1e2128;
  --alert-warn-bg: #2d2200;
  --alert-warn-border: #a66a00;
  --alert-warn-text: #FFB74D;
}

/* ---- トランジション（テーマ切り替え時） ---- */
*, *::before, *::after {
  box-sizing: border-box;
  transition: background-color .2s ease, border-color .2s ease, color .15s ease;
}

/* ---- 分析ページ 3カラムグリッド + ドラッグ ---- */
.analysis-grid-wrap { padding: 12px; max-width: 1200px; margin: 0 auto; }
.analysis-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: start;
}
.a-card-wrap {
  min-width: 0; /* gridオーバーフロー防止 */
}
.a-card-wrap.dragging { opacity: .45; }
.a-card-wrap.drag-over > .card { outline: 2px dashed var(--accent); outline-offset: 2px; }
.gs-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.gs-drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 16px;
  user-select: none;
  touch-action: none;
}
.gs-drag-handle:hover { color: var(--text); background: var(--bg-hover); }
.gs-drag-handle:active { cursor: grabbing; }
.gs-hide-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 14px; padding: 2px 8px;
  border-radius: 4px; line-height: 1;
}
.gs-hide-btn:hover { background: var(--bg-hover); color: var(--text); }
.gs-restore-bar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 8px 12px; background: var(--bg-stripe);
  border-radius: 8px; margin: 0 12px 8px;
  font-size: 12px;
}
.gs-restore-btn {
  padding: 4px 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-size: 12px; font-family: inherit;
  color: var(--text);
}
.gs-restore-btn:hover { background: var(--bg-hover); }
.a-card-wrap.a-span-full { grid-column: 1 / -1; }
.a-card-wrap.a-col-1 { grid-column: span 1; }
.a-card-wrap.a-col-2 { grid-column: span 2; }
.a-card-wrap.a-col-3 { grid-column: 1 / -1; }
@media (max-width: 768px) {
  .analysis-3col { grid-template-columns: 1fr; }
  .a-card-wrap.a-col-1, .a-card-wrap.a-col-2, .a-card-wrap.a-col-3 { grid-column: 1 / -1; }
}

/* フォーカスセクション 折りたたみパネル */
.fp-wrap [data-fp-toggle] {
  user-select: none;
}
.fp-wrap [data-fp-toggle]:hover span:last-child {
  color: var(--accent);
}

/* 推移比較チャート: グラスモーフィズム（すりガラス）装飾。背景の重なりが透けて見える
   ように半透明+backdrop-filterを使う。backdrop-filter未対応ブラウザは通常の半透明背景に
   フォールバックする（@supportsで分岐、致命的な見た目崩れを避ける）。 */
.fp-wrap[data-fp="fp-trend"] {
  border-radius: 14px;
  padding: 14px 16px 4px;
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  box-shadow: 0 4px 24px rgba(0, 0, 0, .06), inset 0 1px 0 color-mix(in srgb, white 12%, transparent);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .fp-wrap[data-fp="fp-trend"] {
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
  }
}

/* ---- 設定ボタン・パネル ---- */
.settings-btn {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 4px 8px; border-radius: 6px;
  color: var(--text-muted); line-height: 1; flex-shrink: 0;
}
.settings-btn:hover { background: var(--bg-hover); color: var(--text); }

.settings-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35); z-index: 2500;
}
.settings-overlay.open { display: block; }

.settings-panel {
  position: fixed; top: 56px; right: 0; bottom: 0; width: 280px;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-md); z-index: 2501;
  transform: translateX(100%); transition: transform .25s ease;
}
.settings-panel.open { transform: translateX(0); }

.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.settings-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted); padding: 2px 6px;
  border-radius: 4px;
}
.settings-close:hover { background: var(--bg-hover); color: var(--text); }
.settings-body { padding: 16px 18px; }
.settings-label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin: 0 0 8px;
}
.settings-radio-group { display: flex; flex-direction: column; gap: 8px; }
.settings-radio {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer; padding: 6px 8px;
  border-radius: 6px;
}
.settings-radio:hover { background: var(--bg-hover); }
.settings-radio input { accent-color: var(--accent); }
.settings-note { font-size: 11px; color: var(--text-muted); margin: 6px 0 0; }
.settings-color-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* ---- Material Symbols (outline, no fill, thin) ----
   自前vendor化(@fontsource-variable)に伴い、Google Fontsが自動付与していたfont-family宣言を
   明示する必要がある（@fontsourceは@font-faceのみ提供しヘルパークラスは提供しないため）。 */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined Variable';
  font-weight: normal;
  font-style: normal;
  font-size: 2em;
  vertical-align: middle;
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' -25, 'opsz' 24;
  color: inherit;
}
.inline-icon {
  font-size: 14px;
  vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' -25, 'opsz' 20;
}
.map-icon {
  font-size: 20px;
  vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' -25, 'opsz' 24;
}

/* ---- グローバル検索バー ---- */
.nav-search {
  position: relative;
  flex: 1;
  max-width: 260px;
  min-width: 0;
}
.nav-search input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0 14px;
  font-size: 12px;
  background: var(--bg-stripe);
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.nav-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}
.nav-search-results {
  position: absolute;
  top: 38px;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  z-index: 3000;
  max-height: 360px;
  overflow-y: auto;
}
.nav-search-cat {
  padding: 7px 14px 3px;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.nav-search-item {
  padding: 8px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.nav-search-item:hover { background: var(--bg-hover); }
.nav-search-item .ns-icon { font-size: 15px; flex-shrink: 0; }
.nav-search-item .ns-main { font-weight: 500; }
.nav-search-item .ns-sub  { font-size: 11px; color: var(--text-muted); }
.nav-search-empty { padding: 12px 14px; color: var(--text-muted); font-size: 13px; }
@media (max-width: 768px) {
  .nav-search { max-width: none; order: 10; width: 100%; margin: 4px 0; }
}

/* ---- ベース ---- */
/* テーブルやチップ列など横スクロールが必要な要素は各コンポーネント側で overflow-x:auto を
   持たせている。それ以外の要素が意図せず画面幅を超えると、ページ全体が横スクロール可能になり、
   position:sticky のナビバー等（幅は元のビューポート基準のまま）が画面右端まで届かなくなって
   見える不具合が起きる（iPhone実機で確認）。html側でページ全体の横スクロールを封じることで、
   内部の individual overflow-x:auto コンテナだけがスクロールする状態を保証する。 */
html {
  overflow-x: hidden;
}
body {
  /* htmlだけでなくbody側にもoverflow-x:hiddenが無いと、settings-panel等
     transform:translateX(100%)で画面外へ逃がしているposition:fixed要素の分だけ
     横スクロールが可能になってしまう（実機・iframe幅390pxで再現確認済み） */
  overflow-x: hidden;
  margin: 0;
  font-family: 'Roboto', 'Helvetica Neue', Arial, 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  /* 設定ページのフォントサイズ選択（--user-font-scale、既定1）をサイト全体に反映。
     サイト内の文字サイズはfs-11px等の固定px指定が大半でrem連動していないため、
     font-sizeではなくzoomでページ全体を拡大縮小する（主要ブラウザは対応済み）。 */
  zoom: var(--user-font-scale, 1);
}

/* ---- ナビゲーション ---- */
#app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 56px;
  gap: 8px;
}

#app-nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  margin-right: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-logo-svg {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.cube-axis {
  stroke: #334155;
}

[data-theme="dark"] .cube-axis {
  stroke: #334155;
}

:root .cube-axis {
  stroke: #CBD5E1;
}

.nav-logo-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -0.5px;
}

.nav-logo-t {
  color: var(--accent);
  font-weight: 900;
}

.nav-logo-labs {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 16px;
  margin-left: 2px;
  color: var(--text-muted);
}

/* ---- ドロワー ブランド（ナビバー本体のロゴと高さを揃える） ---- */
.drawer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.drawer-logo-svg {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.drawer-logo-text {
  font-family: 'Share Tech Mono', monospace;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.5px;
  color: var(--text);
}

/* ---- ドロワー エリア検索（旧「データ絞り込み」アコーディオンから独立） ---- */
.drawer-search-block {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* ---- ドロワー 設定（常時表示） ---- */
.drawer-settings-inline {
  padding: 4px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#app-nav .nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
}

#app-nav .nav-link {
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

#app-nav .nav-link:hover { background: var(--bg-hover); color: var(--text); }
#app-nav .nav-link.active { background: var(--bg-active); color: var(--accent); }

#app-nav .nav-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- 年範囲デュアルスライダー ---- */
.drawer-year-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.dual-range-wrap {
  position: relative;
  width: 110px;
  height: 22px;
}
.dual-range-wrap.drawer-dual-range {
  width: 100%;
}
.dual-range-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  pointer-events: none;
  z-index: 0;
}
.dual-range-wrap input[type="range"] {
  position: absolute;
  width: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  height: 22px;
  vertical-align: middle;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.dual-range-wrap input[type="range"]::-webkit-slider-runnable-track {
  background: transparent;
  height: 4px;
}
.dual-range-wrap input[type="range"]::-webkit-slider-thumb {
  pointer-events: all;
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px; /* webkit: track height 4px → thumb 14px の中央合わせ: (4-14)/2 = -5 */
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
  position: relative;
  z-index: 2;
}
.dual-range-wrap input[type="range"]:active::-webkit-slider-thumb { cursor: grabbing; }
.dual-range-wrap input[type="range"]::-moz-range-track { background: transparent; height: 4px; }
.dual-range-wrap input[type="range"]::-moz-range-thumb {
  pointer-events: all;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}

/* ---- ランキングカード コンテナ ---- */
.ranking-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 16px;
  padding: 16px;
  max-width: 1600px;
  margin: 0 auto;
}
.ranking-card-wrapper {
  position: relative;
}
/* ランキング詳細ページ（1カードのみをフル幅表示） */
.ranking-cards-detail-mode {
  display: block;
  max-width: 900px;
}
.ranking-cards-detail-mode .ranking-card-wrapper {
  display: none;
}
.ranking-cards-detail-mode .ranking-card-wrapper.ranking-detail-target {
  display: block;
}
.ranking-detail-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 16px 0;
  padding: 8px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ranking-detail-back-btn:hover {
  background: var(--bg-stripe);
}
.ranking-detail-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 16px 0;
  padding: 10px 14px;
  background: var(--bg-stripe);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.ranking-cards-detail-mode .rank-card-title {
  cursor: default;
}
.ranking-card-wrapper.dragging {
  opacity: 0.5;
}
.ranking-card-wrapper.drag-over > .card {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}
.ranking-card-wrapper:nth-child(1) { order: 1; }
.ranking-card-wrapper:nth-child(2) { order: 2; }
.ranking-card-wrapper:nth-child(3) { order: 3; }
.ranking-card-wrapper:nth-child(4) { order: 4; }
.ranking-card-wrapper:nth-child(5) { order: 5; }
.ranking-card-wrapper:nth-child(6) { order: 6; }
.ranking-card-wrapper:nth-child(7) { order: 7; }
.ranking-card-wrapper:nth-child(8) { order: 8; }
.ranking-card-wrapper:nth-child(9) { order: 9; }
.ranking-card-wrapper:nth-child(10) { order: 10; }

/* ---- Tailwind風 Styled Select（アイコン付き）---- */
.sel-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.sel-wrap .sel-icon {
  position: absolute;
  left: 7px;
  pointer-events: none;
  font-size: 18px;
  color: var(--text-muted);
  z-index: 1;
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
.sel-wrap select {
  height: 34px;
  padding: 0 28px 0 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 100px;
}
.sel-wrap select:hover  { border-color: var(--accent); }
.sel-wrap select:focus  { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.sel-wrap .sel-chevron {
  position: absolute;
  right: 6px;
  pointer-events: none;
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

/* ---- 地図: 色塗り指標/治安/古地図 統合ドロップダウン ---- */
.map-metric-dd { position: relative; flex-shrink: 0; }
.map-metric-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s;
  white-space: nowrap;
}
.map-metric-btn:hover { border-color: var(--accent); }
.map-metric-btn .material-symbols-outlined { font-size: 18px; color: var(--text-muted); font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.map-metric-btn .map-metric-btn-chevron { font-size: 16px; margin-left: 2px; }
.map-metric-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 80;
  width: 280px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  padding: 8px;
}
/* Proパネル内の折りたたみ式セクション（投資分析指標・地番界・都市計画地図） */
.map-pro-section > summary { cursor: pointer; list-style: none; }
.map-pro-section > summary::-webkit-details-marker { display: none; }
.map-metric-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 6px 8px 4px;
}
.map-metric-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 8px 6px;
  line-height: 1.5;
}
.map-metric-info {
  cursor: help;
  color: var(--text-muted);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.map-metric-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.map-metric-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.map-metric-item:hover { background: var(--bg-hover); }
.map-metric-item.active { background: var(--bg-hover); font-weight: 600; color: var(--accent); }
.map-metric-item .material-symbols-outlined { font-size: 18px; color: var(--text-muted); font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.map-metric-item.active .material-symbols-outlined { color: var(--accent); }
.map-metric-item.locked { color: var(--text-muted); }
.map-metric-item.locked span { flex: 1; }
.map-metric-item .pro-lock-badge { font-size: 15px !important; color: var(--text-muted) !important; margin-left: auto; }

/* Pro限定カード（ランキング・分析ページ共通） */
.pro-locked-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 32px 16px;
  color: var(--text-muted);
}
.pro-locked-card .pro-locked-icon { font-size: 28px; }
.pro-locked-text { font-size: 13px; margin: 0; }
.pro-locked-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.pro-locked-cta:hover { opacity: 0.9; }
.map-metric-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.map-metric-check-row:hover { background: var(--bg-hover); }
.map-metric-check-row .material-symbols-outlined { font-size: 18px; color: var(--text-muted); font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.map-metric-check-row small { display: block; color: var(--text-muted); font-size: 10px; font-weight: 400; }
.map-hist-opacity-row {
  align-items: center;
  gap: 6px;
  margin: 0 8px 6px 34px;
  font-size: 10px;
  color: var(--text-muted);
}
.map-hist-opacity-row input[type="range"] { flex: 1; }

/* ---- ランキングカードタイトル（アイコン付き）---- */
.rank-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  padding: 14px 14px 10px;
  cursor: pointer;
}

/* ---- スクロールトップボタン ---- */
#scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.22);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .22s, transform .22s;
  pointer-events: none;
  z-index: 999;
}
#scroll-top-btn.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
#scroll-top-btn:hover { filter: brightness(1.1); }
#scroll-top-btn .material-symbols-outlined { font-size: 22px; }

/* 印刷ボタン: 全ページ共通、端に小さくアイコンのみ表示（scroll-top-btnの対角に配置） */
#print-btn {
  position: fixed;
  bottom: 28px;
  left: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  z-index: 998;
}
#print-btn:hover { color: var(--accent); border-color: var(--accent); }
#print-btn .material-symbols-outlined { font-size: 18px; }
@media print {
  #print-btn { display: none !important; }
}

/* ---- 分析ページ サイドバーレイアウト ---- */
.analysis-layout {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 56px);
}
.analysis-sidebar {
  width: 240px;
  min-width: 240px;
  padding: 16px 14px;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  background: var(--surface);
  flex-shrink: 0;
}
.analysis-sidebar-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 0 0 12px;
}
.sidebar-field {
  margin-bottom: 12px;
}
/* 取引データ検索の絞り込み条件（#tx-search-card内）は、横広画面では縦に長くならないよう
   3カラムグリッドに配置する。それ以外の.analysis-sidebar（学区詳細等の狭い固定幅サイドバー）
   には影響しないよう、tx-filter-gridクラスを持つラッパーだけを対象にする */
.tx-filter-grid { display: contents; }
@media (min-width: 900px) {
  .tx-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 16px;
  }
  .tx-filter-grid .sidebar-field { margin-bottom: 8px; }
}
.sidebar-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 500;
}
.sidebar-field .sel-wrap { width: 100%; }
.sidebar-field .sel-wrap select { width: 100%; min-width: unset; font-size: 12px; }
.sidebar-slider-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sidebar-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 3px;
}
.sidebar-result-count {
  font-size: 11px;
  color: var(--text-muted);
  margin: 8px 0 0;
  min-height: 16px;
}
.analysis-main {
  flex: 1;
  min-width: 0;
  padding: 16px;
}
/* エリアフォーカスのミニ地図: PCでは1/3幅程度に収め、モバイルは全幅 */
#focus-mini-map {
  width: 33%;
  min-width: 260px;
  height: 140px;
}
/* ヘッダー行（エリア名等）とミニ地図の並び: 幅に余裕がある場合のみ横2カラム（右にミニ地図）、
   狭い場合はミニ地図を上・ヘッダーを下に積む（DOM順はミニ地図が先のため row-reverse で右寄せ）。 */
.focus-header-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (min-width: 861px) {
  .focus-header-grid { flex-direction: row-reverse; align-items: stretch; }
  .focus-header-grid .focus-header-text { flex: 1; min-width: 0; }
}
@media (max-width: 860px) {
  .analysis-layout { flex-direction: column; }
  .analysis-sidebar { width: 100%; min-width: unset; position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  #focus-mini-map { width: 100%; min-width: unset; }
}

/* ---- area-focus 3カラムカードグリッド ---- */
.focus-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.focus-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-height: 80px;
  position: relative;
}
/* カード表示カスタマイズ（ドラッグ移動・非表示） */
.focus-card-close-btn {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; line-height: 20px; text-align: center;
  border-radius: 50%; border: none; background: none; color: var(--text-muted);
  cursor: pointer; font-size: 15px; opacity: 0; transition: opacity .15s, background .15s;
}
.focus-card:hover .focus-card-close-btn { opacity: .6; }
.focus-card-close-btn:hover { opacity: 1 !important; background: var(--bg-stripe); }
.focus-cards-grid.customizing .focus-card { cursor: grab; }
.focus-cards-grid.customizing .focus-card.dragging { opacity: .4; }
.focus-cards-grid.customizing .focus-card.drag-over { outline: 2px dashed var(--accent); outline-offset: 2px; }
/* 集計期間プルダウン変更後、値が更新されたカードへ視線誘導するための一時的なハイライト（#10） */
@keyframes focus-card-flash {
  0%   { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 55%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.focus-card-flash { animation: focus-card-flash 1.2s ease-out; }
.focus-card-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.focus-card-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}
.focus-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.focus-card-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
  margin-left: 4px;
}
.focus-card-badge.up { background: rgba(56,142,60,.12); color: #388e3c; }
.focus-card-badge.dn { background: rgba(211,47,47,.1); color: #d32f2f; }
@media (max-width: 700px) {
  .focus-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- 単身・賃貸需要/犯罪率/外国人構成のコンパクトグリッド表示 ---- */
.focus-compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.focus-compact-grid .fp-wrap { margin-bottom: 0; }
/* echartsはコンテナのinit時点の幅を保持するため、ResizeObserverでresize()を呼んでいても
   フォント読み込み等での一瞬のレイアウトずれで横にはみ出すことがある。保険としてクリップする */
#focus-crime-bar { max-width: 100%; overflow: hidden; }
@media (max-width: 768px) {
  .focus-compact-grid { grid-template-columns: 1fr; }
}

/* ---- 都道府県タブ ---- */
#nav-pref-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-stripe);
  border-radius: 8px;
  padding: 2px;
  flex-shrink: 0;
}
.nav-pref-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  font-family: inherit;
}
.nav-pref-btn:hover { background: var(--bg-hover); color: var(--text); }
.nav-pref-btn.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
@media (max-width: 768px) { #nav-pref-tabs { display: none; } }

/* ---- テーマ切り替えボタン ---- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 15px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ---- メインコンテンツ ---- */
#app-root {
  min-height: calc(100vh - 56px - 40px);
}

/* ---- カード ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 12px;
}

/* ---- フィルタバー ---- */
.filter-bar {
  position: sticky;
  top: 56px;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
}

/* 地図ページのフィルター行全体。「周辺環境から場所をみつける」ボタンだけは横スクロール
   する.filter-bar-wrapの外に置き、モバイルで横スクロールしても隠れず常に見えるようにする
   （重ね合わせUI再編、2026-08-01）。幅が足りない場合はflex-wrapで下段に折り返す。 */
.map-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
}
.map-filter-row .map-filter-bar-wrap { flex: 1 1 auto; min-width: 0; }

/* 地図ページの filter-bar: モバイル横スクロール時に隠れたボタンがあることを示す
   左右矢印（ranking-tocと同じUXパターン）。overflowしない限りJSでdisplay:noneのまま。 */
.map-filter-bar-wrap {
  display: flex;
  align-items: stretch;
  position: relative;
}
.map-filter-bar-wrap .filter-bar {
  flex: 1;
  min-width: 0;
}
.filter-bar-scroll-arrow {
  flex-shrink: 0;
  width: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  position: sticky;
  top: 56px;
  z-index: 51;
}
.filter-bar-scroll-arrow:hover { color: var(--accent); }
.filter-bar-scroll-arrow .material-symbols-outlined { font-size: 20px; }

.filter-bar select,
.filter-bar input {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  outline: none;
}
/* sel-wrap の padding が filter-bar の汎用 select padding に負けないよう上書き */
.filter-bar .sel-wrap select,
.sidebar-field .sel-wrap select {
  padding: 0 28px 0 34px !important;
}

.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--accent); }

/* ---- ランキング Pro/フリー タブ切替 ---- */
.ranking-tab-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px 0;
}
.ranking-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.ranking-tab-btn .material-symbols-outlined { font-size: 16px; }
.ranking-tab-btn:hover { color: var(--accent); border-color: var(--accent); }
.ranking-tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- 閲覧ランキングの期間タブ（全期間/月間/週間）。.ranking-tab-btnと同系統の見た目だが
   別クラスにしている——applyRankingTab()が.ranking-tab-btn全体のactiveクラスを
   フリー/Proタブの状態に合わせて一括トグルするため、同じクラスだと巻き込まれて消えてしまう */
.ranking-period-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.ranking-period-btn:hover { color: var(--accent); border-color: var(--accent); }
.ranking-period-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- ランキング目次（各カードへジャンプ） ---- */
.ranking-toc-wrap {
  position: sticky;
  top: 108px;
  z-index: 49;
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ranking-toc {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(to right, transparent 0, black 20px, black calc(100% - 20px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 20px, black calc(100% - 20px), transparent 100%);
}
.ranking-toc::-webkit-scrollbar { display: none; }
.ranking-toc-arrow {
  flex-shrink: 0;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  z-index: 1;
}
.ranking-toc-arrow:hover { color: var(--accent); }
.ranking-toc-arrow .material-symbols-outlined { font-size: 20px; }
.ranking-toc-chip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.ranking-toc-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---- ランキングテーブル ---- */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ranking-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-stripe);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  position: sticky;
  top: 0;
}

.ranking-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.ranking-table tr:hover td { background: var(--bg-subtle); cursor: pointer; }

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  background: var(--badge-bg);
  color: var(--text-muted);
}

.rank-badge.top1 { background: #ffd700; color: #333; }
.rank-badge.top2 { background: #c0c0c0; color: #333; }
.rank-badge.top3 { background: #cd7f32; color: #fff; }

.rate-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
}

.rate-badge.up { background: var(--rate-up-bg); color: var(--up-color); }
.rate-badge.down { background: var(--rate-down-bg); color: var(--down-color); }

/* ---- スピナー（小さい箇所のみ残す） ---- */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
  gap: 12px;
}

.spinner::before {
  content: "";
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- スケルトンローダー ---- */
@keyframes sk-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.sk {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--bg-stripe) 0%, var(--bg-stripe) 35%,
    var(--bg-hover)  50%,
    var(--bg-stripe) 65%, var(--bg-stripe) 100%
  );
  background-size: 800px 100%;
  animation: sk-shimmer 1.4s ease-in-out infinite;
}

.sk-text  { height: 14px; margin: 6px 0; border-radius: 4px; }
.sk-title { height: 20px; margin: 0 0 12px; border-radius: 4px; width: 60%; }
.sk-stat  { height: 72px; border-radius: 8px; }
.sk-chart { border-radius: 8px; }
.sk-row   { height: 36px; margin: 3px 0; border-radius: 4px; }
.sk-card  { padding: 14px; display: flex; flex-direction: column; gap: 8px; }


/* ---- フッター ---- */
#app-footer {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  background: var(--surface);
}

/* ---- 地図ビュー ---- */
#map-container {
  display: flex;
  height: calc(100vh - 56px - 40px);
}

#google-map { flex: 1; }

#map-side-panel {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 16px;
}
/* エリア未選択時は非表示（.has-selection が付いたときだけ表示） */
#map-side-panel:not(.has-selection) {
  display: none;
}
/* パネルの閉じるボタンもパネルと連動して表示（locate-panelの閉じるボタンと同じUX） */
#map-side-panel-close { display: none; }
#map-side-panel.has-selection ~ #map-side-panel-close { display: flex; }
#map-side-panel-close:hover { color: var(--accent); }

/* map-side-panel/locate-panelの幅ドラッグリサイズ用ハンドル（#20）。
   map-side-panelはinnerHTMLで中身が丸ごと差し替わるため子要素にできず、
   マップとの間に挟むsiblingとして配置し:has()で表示状態を連動させる */
.panel-resize-handle {
  width: 8px;
  flex-shrink: 0;
  cursor: col-resize;
  position: relative;
  z-index: 20;
}
.panel-resize-handle::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 3px;
  width: 2px;
  border-radius: 1px;
  background: var(--border);
  transition: background .15s;
}
.panel-resize-handle:hover::after,
.panel-resize-handle.dragging::after {
  background: var(--accent);
}
#map-container:not(:has(#map-side-panel.has-selection)) #map-side-panel-resize-handle {
  display: none;
}

/* ---- 2カラムレイアウト ---- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  #map-container { flex-direction: column; }
  #map-side-panel {
    /* デスクトップでドラッグリサイズ保存したinline widthをモバイルでは無効化する */
    width: 100% !important;
    height: 260px;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .panel-resize-handle { display: none !important; }
}

.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

/* ============================================================
   ハンバーガーナビ
   ============================================================ */
.nav-hamburger {
  display: block;  /* 常時表示 */
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}
.nav-hamburger:hover { background: var(--bg-hover); }

.nav-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 240px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  z-index: 2000;
  transform: translateX(-100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  padding: 64px 0 24px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.nav-drawer.open { transform: translateX(0); }
.nav-drawer a {
  display: block;
  padding: 14px 24px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-drawer a:hover { background: var(--bg-hover); }
.nav-drawer a.active { color: var(--accent); border-left-color: var(--accent); background: var(--bg-active); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1999;
}
.nav-overlay.show { display: block; }

/* ---- nav レスポンシブ ブレークポイント ---- */
@media (max-width: 1100px) {
  .nav-meta { display: none !important; }
}
@media (max-width: 980px) {
  #nav-search-wrap { min-width: 100px; }
}
@media (max-width: 880px) {
  #nav-search-wrap { display: none !important; }
}
@media (max-width: 768px) {
  .nav-links { display: none !important; }
  /* 注意: ここより前（378行目付近）に同じ#app-navへのmax-width:768pxルールを置くと、
     405行目の無条件ベースルール（height:56px）と詳細度が同点になり、後勝ちで
     ベースルールの固定高さが勝ってしまいflex-wrapした2行目（ユーザーボタン等）が
     はみ出す不具合になる（実機で発生確認済み）。ベースルールより後ろのこのブロックで
     上書きすること。 */
  #app-nav { flex-wrap: wrap; height: auto; gap: 0; padding: 8px 8px; }
  /* スマホでは nav の混雑要素を非表示 → drawer へ */
  #nav-pref-tabs, #nav-search-wrap, .nav-meta {
    display: none !important;
  }
}

/* ---- ドロワー内追加スタイル ---- */
.drawer-section-label {
  font-size: 11px; color: var(--text-muted); padding: 12px 16px 4px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
}

/* ---- ドロワー アコーディオン（ページリンク／絞り込み／設定／サービス情報の4大項目） ---- */
.drawer-accordion-group {
  border-bottom: 1px solid var(--border);
}
.drawer-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: left;
}
.drawer-accordion-header:hover { background: var(--bg-hover); }
.drawer-accordion-header .material-symbols-outlined:first-child { font-size: 19px; color: var(--text-muted); }
.drawer-accordion-header span:nth-child(2) { flex: 1; }
.drawer-accordion-chevron {
  font-size: 18px !important;
  color: var(--text-muted) !important;
  transition: transform .2s ease;
}
.drawer-accordion-group.open .drawer-accordion-chevron { transform: rotate(90deg); }
.drawer-accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}
.drawer-accordion-group.open .drawer-accordion-body {
  max-height: 2000px;
}
.drawer-year-range { margin-top: 4px; }
.current-location-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #4FC3F7; border: 2px solid #9E9E9E;
  box-shadow: 0 0 0 2px rgba(255,255,255,.6);
}
.drawer-pref-block { padding: 6px 12px 10px; }
.drawer-pref-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.drawer-pref-block select {
  width: 100%; box-sizing: border-box; height: 36px;
  border: 1px solid var(--border); border-radius: 8px; padding: 0 10px;
  font-size: 13px; font-family: inherit; color: var(--text);
  background: var(--bg-stripe); outline: none;
}
.drawer-pref-block select:focus { border-color: var(--accent); }
.drawer-search-wrap { padding: 6px 12px 10px; }
.drawer-search-wrap input {
  width: 100%; box-sizing: border-box; height: 36px;
  border: 1px solid var(--border); border-radius: 8px; padding: 0 10px;
  font-size: 13px; font-family: inherit; color: var(--text);
  background: var(--bg-stripe); outline: none;
}
.drawer-search-wrap input:focus { border-color: var(--accent); }
.drawer-search-results { margin-top: 6px; max-height: 200px; overflow-y: auto; }
.drawer-settings-btn {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 14px; color: var(--text); width: 100%;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.drawer-settings-btn:hover { background: var(--bg-hover); }
.drawer-settings-dropdown {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-stripe);
}
.drawer-settings-dropdown .settings-label {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}
.drawer-settings-dropdown .settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.drawer-settings-dropdown .settings-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
}
.drawer-settings-dropdown .settings-radio:hover { background: var(--bg-hover); }
.drawer-settings-dropdown .settings-color-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- カスタムスクロールバー ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ---- Tailwind風 チェックボックス ---- */
.tx-col-panel input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px;
  border: 2px solid var(--border); border-radius: 4px;
  background: var(--surface); cursor: pointer;
  position: relative; flex-shrink: 0;
  transition: background .12s, border-color .12s;
  vertical-align: middle;
}
.tx-col-panel input[type="checkbox"]:checked {
  background: var(--accent); border-color: var(--accent);
}
.tx-col-panel input[type="checkbox"]:checked::after {
  content: ""; position: absolute;
  left: 3px; top: 0px; width: 5px; height: 9px;
  border: 2px solid #fff; border-top: none; border-left: none;
  transform: rotate(45deg);
}
.tx-col-panel input[type="checkbox"]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- 隣接町カード ---- */
.nearby-towns-card {
  background: var(--bg-stripe);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.nearby-town-chip {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 12px; cursor: pointer;
  font-family: inherit; transition: border-color .15s, color .15s;
}
.nearby-town-chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---- 丁目→親町 誘導 ---- */
.chome-parent-hint {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.chome-parent-hint p { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }
.chome-parent-btn {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px;
  padding: 6px 14px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
}

/* ---- トレンド矢印 ---- */
.trend-up   { color: var(--up-color); font-weight: 700; }
.trend-dn   { color: var(--down-color); font-weight: 700; }
.trend-flat { color: var(--text-muted); }

/* ============================================================
   ボトムシート
   ============================================================ */
.bs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
}
.bs-overlay.open { display: block; }

.bs-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
  z-index: 1001;
  transform: translateY(110%);
  transition: transform .32s cubic-bezier(.4,0,.2,1);
  -webkit-overflow-scrolling: touch;
}
.bs-sheet.open { transform: translateY(0); }

.bs-handle {
  width: 44px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

/* PC: 右サイドパネル */
@media (min-width: 769px) {
  .bs-sheet {
    left: auto; right: 0;
    width: 390px;
    top: 56px; bottom: 0;
    max-height: none;
    border-radius: 0;
    transform: translateX(110%);
    border-left: 1px solid var(--border);
  }
  .bs-sheet.open { transform: translateX(0); }
  .bs-handle { display: none; }
}

/* ============================================================
   ソートテーブルヘッダー
   ============================================================ */
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable::after {
  content: ' ↕';
  opacity: .3;
  font-size: 10px;
  font-weight: 400;
}
th.sort-asc::after  { content: ' ▲'; opacity: 1; color: var(--accent); }
th.sort-desc::after { content: ' ▼'; opacity: 1; color: var(--accent); }

/* ============================================================
   モバイル全般
   ============================================================ */
@media (max-width: 768px) {
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar select,
  .filter-bar input,
  .filter-bar label { flex-shrink: 0; }

  /* 隠れたボタンがあることを示すフェードグラデーション（矢印が出ない端はJSがdata-fade-*で制御） */
  .map-filter-bar-wrap .filter-bar[data-fade-left] {
    mask-image: linear-gradient(to right, transparent 0, black 16px, black 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 16px, black 100%);
  }
  .map-filter-bar-wrap .filter-bar[data-fade-right] {
    mask-image: linear-gradient(to left, transparent 0, black 16px, black 100%);
    -webkit-mask-image: linear-gradient(to left, transparent 0, black 16px, black 100%);
  }
  .map-filter-bar-wrap .filter-bar[data-fade-left][data-fade-right] {
    mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
  }

  .page-container { padding: 8px; }
  .two-col { padding: 8px; gap: 10px; }
  .card { border-radius: 10px; padding: 12px; }

  /* ranking-cards-container の minmax(400px,1fr) がモバイル幅（390px前後）を超えて
     body全体を横スクロールさせ、position:stickyのナビバーが左右100%表示にならなく
     見える原因になっていたため、モバイル幅では1カラムに切り替える。
     ただし単純な1frはグリッドトラックの自動最小幅がauto（＝子要素のテーブル分の
     content幅）になり、依然としてカードが画面幅を超えて右側が見切れる。
     minmax(0,1fr)にしてトラックの最小幅を0にすることで、内部の.ov-x-auto
     コンテナが正しくビューポート内で横スクロールするようになる */
  .ranking-cards-container { grid-template-columns: minmax(0, 1fr); padding: 8px; }
  .ranking-card-wrapper { min-width: 0; }

  /* タッチターゲット最小44px */
  button, select, input[type="checkbox"] { min-height: 36px; }
  .nav-link { padding: 8px 10px; }

  /* 地図メニュー等、モバイルでは小さすぎて読みにくいため拡大 */
  .filter-bar select, .filter-bar input, .map-metric-btn { font-size: 15px; }
  .map-metric-item, .map-metric-check-row { font-size: 14px; padding: 9px 8px; }
  .map-metric-section-title { font-size: 12px; }

  /* テーブルスクロール */
  .ranking-table { font-size: 12px; }
  .ranking-table th, .ranking-table td { padding: 8px 6px; }

  /* フッター */
  #app-footer { font-size: 11px; padding: 10px 12px; }
}

/* ============================================================
   法的ページ（legalView）
   ============================================================ */
.legal-content section { margin-bottom: 24px; }
.legal-content h2 { font-size: 15px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.legal-content p { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin: 0 0 8px; }
.legal-content ul { font-size: 13px; color: var(--text-muted); line-height: 1.7; padding-left: 20px; margin: 0 0 8px; }
.legal-content table { width: 100%; border-collapse: collapse; font-size: 13px; }
.legal-content table th { text-align: left; padding: 8px 12px; color: var(--text-muted); width: 30%; border-bottom: 1px solid var(--border); }
.legal-content table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.legal-content a { color: var(--accent); }
.disclaimer-warning {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(255,152,0,.08); border: 1px solid rgba(255,152,0,.3);
  border-radius: 8px; padding: 12px 14px;
}
.disclaimer-warning .material-symbols-outlined { color: #f57c00; font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.disclaimer-warning p { margin: 0; }

/* ============================================================
   分析ページ タブUI
   ============================================================ */
.analysis-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.analysis-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: inherit;
  border-radius: 4px 4px 0 0;
  transition: color .15s, border-color .15s;
}
.analysis-tab:hover { color: var(--text); background: var(--bg-hover); }
.analysis-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================================
   ナビバー ユーザーボタン
   ============================================================ */
.nav-user-wrap {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
}
.nav-user-btn {
  background: var(--accent);
  border: none;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: filter .15s;
  flex-shrink: 0;
}
.nav-user-btn:hover { filter: brightness(1.1); }
.nav-user-btn:has(> span[style*="border-radius:50%"]) { background: none; padding: 0; color: var(--text); }
.nav-user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md, 0 4px 16px rgba(0,0,0,.2));
  padding: 6px;
  z-index: 200;
}
.nav-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  box-sizing: border-box;
}
.nav-user-dropdown-item:hover { background: var(--bg-stripe, rgba(128,128,128,.1)); }
.nav-user-dropdown-signout { color: #d32f2f; }
.nav-user-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

/* ============================================================
   認証モーダル
   ============================================================ */
.auth-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1100;
  backdrop-filter: blur(2px);
}
.auth-overlay.open { display: block; }
.auth-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.95);
  background: var(--surface);
  border-radius: 14px;
  padding: 28px 24px;
  width: min(420px, 94vw);
  z-index: 1101;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  transition: transform .2s, opacity .2s;
  opacity: 0;
}
.auth-modal.open { display: block; transform: translate(-50%, -50%) scale(1); opacity: 1; }
.auth-modal-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none; border: none; cursor: pointer;
  font-size: 20px; color: var(--text-muted); line-height: 1;
}
.auth-modal-close:hover { color: var(--text); }
.auth-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 8px; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text-muted); font-family: inherit; transition: color .15s, border-color .15s;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; color: var(--text); }
.auth-input {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--bg); color: var(--text); font-family: inherit;
  transition: border-color .15s;
}
.auth-input:focus { outline: none; border-color: var(--accent); }
.auth-error { color: #d32f2f; font-size: 13px; padding: 6px 10px; background: #ffeaea; border-radius: 6px; }
.auth-submit {
  padding: 11px; background: var(--accent); color: #fff; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit; transition: opacity .15s;
}
.auth-submit:hover { opacity: .88; }
.auth-submit:disabled { opacity: .5; cursor: not-allowed; }
.auth-switch { font-size: 13px; color: var(--text-muted); text-align: center; margin: 12px 0 0; }
.auth-switch-btn { background: none; border: none; cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: underline; }
.auth-pro-msg {
  background: #fff8e1; border: 1px solid #ffe082; border-radius: 8px;
  padding: 10px 12px; font-size: 13px; color: #795548; margin-bottom: 16px;
}
/* ---- 地図フィルターバー 追加コントロール ---- */
.map-prop-loc-btn-bar {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-family: inherit;
  transition: opacity .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.map-prop-loc-btn-bar:hover { opacity: .88; }

/* Proパネル専用のモダングラデーション装飾。「（Pro）」というテキスト表記の代わりに、
   このタブ・パネルヘッダーだけに適用する（重ね合わせUI再編、2026-08-01）。
   パネル内の行自体は通常の.map-metric-check-row等のスタイルのまま可読性を優先する。 */
.map-pro-btn {
  background: linear-gradient(135deg, var(--pro-gradient-start, #7C3AED), #F59E0B);
  color: #fff;
  border: none;
  font-weight: 700;
}
.map-pro-btn:hover { opacity: .92; border-color: transparent; }
.map-pro-btn .material-symbols-outlined { color: #fff; }
.locate-panel-header-pro {
  background: linear-gradient(135deg, var(--pro-gradient-start, #7C3AED), #F59E0B);
  color: #fff;
  margin: -12px -16px 8px;
  padding: 12px 16px;
  border-radius: 10px 10px 0 0;
}
.locate-panel-header-pro button { color: #fff; }

/* エリア照合: オレンジ破線のライン中間に表示する施設名ラベル */
.locate-route-label {
  background: #fff;
  color: #E64A19;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #FF6B35;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

/* ---- エリア照合パネル（地図右にドッキング。#map-side-panelと同じflex子要素方式で
   地図に重ならないようにする）---- */
.locate-panel {
  width: 280px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 12px 16px 16px;
}
.locate-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  margin-bottom: 8px;
}
.locate-image-drop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  padding: 16px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.locate-image-drop:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.locate-upload-icon {
  font-size: 32px !important;
  color: var(--accent);
  flex-shrink: 0;
}
#locate-progress { padding: 6px 0 4px; }
.locate-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg-stripe);
  overflow: hidden;
  position: relative;
}
.locate-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #34D399, var(--accent));
  background-size: 200% 100%;
  animation: locate-progress-shimmer 1.4s linear infinite;
  transition: width .15s linear;
}
@keyframes locate-progress-shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}
.locate-progress-label {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
@media (max-width: 768px) {
  /* #map-containerがflex-direction:columnに切り替わる幅と合わせる（640pxのままだと
     641-768pxの中間幅でlocate-panelだけ横幅280pxのflex子要素として残りレイアウトが崩れる）。
     ボトムシート化はposition:fixedでflexレイアウトから切り離す。 */
  .locate-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    /* デスクトップでドラッグリサイズ保存したinline widthを無効化する（position:fixedでも
       widthが明示指定されているとleft/rightより優先されてしまうため!important必須） */
    width: 100% !important;
    max-height: 65vh;
    border-left: none;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,.3);
    z-index: 50;
  }
  .panel-resize-handle { display: none !important; }
}
.map-school-radio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  white-space: nowrap;
}
.map-school-radio label {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.map-school-radio input[type="radio"] {
  accent-color: var(--accent);
}
[data-theme="dark"] .auth-pro-msg { background: #332800; border-color: #664d00; color: #ffd54f; }

/* ---- 管理者ページ（原価・売上試算） ---- */
.admin-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}
.admin-field-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.admin-field-grid input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 13px;
}
.admin-edit-table, .admin-calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-edit-table th, .admin-calc-table th {
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.admin-edit-table td, .admin-calc-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.admin-edit-table input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--text);
  font-size: 12px;
}
.admin-calc-table td:not(:first-child), .admin-calc-table th:not(:first-child) {
  text-align: right;
}

/* === ユーティリティクラス（自動生成、繰り返し使われるインラインstyleの置き換え） === */
.c-text-muted { color: var(--text-muted); }
.fs-13px { font-size: 13px; }
.fs-11px { font-size: 11px; }
.d-flex { display: flex; }
.fw-700 { font-weight: 700; }
.fs-12px { font-size: 12px; }
.m-0 { margin: 0; }
.ta-right { text-align: right; }
.items-center { align-items: center; }
.fw-600 { font-weight: 600; }
.cursor-pointer { cursor: pointer; }
.rounded-8px { border-radius: 8px; }
.p-8px { padding: 8px; }
.gap-8px { gap: 8px; }
.p-16px { padding: 16px; }
.c-d32f2f { color: var(--up-color); }
.font-inherit { font-family: inherit; }
.bg-bg-stripe { background: var(--bg-stripe); }
.bd-1px-solid-border { border: 1px solid var(--border); }
.fs-14px { font-size: 14px; }
.bd-none { border: none; }
.m-0-0-12px { margin: 0 0 12px; }
.c-accent { color: var(--accent); }
.d-grid { display: grid; }
.c-text { color: var(--text); }
.w-100 { width: 100%; }
.d-none { display: none; }
/* 印刷タイトル用要素。画面表示では常に非表示（印刷時のみprint.css側で内容があれば表示） */
.print-only-title { display: none; }
.ov-hidden { overflow: hidden; }
.fs-15px { font-size: 15px; }
.p-10px { padding: 10px; }
.c-fff { color: #fff; }
.bg-accent { background: var(--accent); }
.fw-800 { font-weight: 800; }
.flex-wrap-wrap { flex-wrap: wrap; }
.fs-10px { font-size: 10px; }
.mb-12px { margin-bottom: 12px; }
.rounded-6px { border-radius: 6px; }
.gap-6px { gap: 6px; }
.p-12px { padding: 12px; }
.m-0-0-4px { margin: 0 0 4px; }
.m-0-0-8px { margin: 0 0 8px; }
.ta-center { text-align: center; }
.gap-4px { gap: 4px; }
.bd-b-1px-solid-border { border-bottom: 1px solid var(--border); }
.m-4px-0-0 { margin: 4px 0 0; }
.p-20px { padding: 20px; }
.fs-22px { font-size: 22px; }
.justify-space-between { justify-content: space-between; }
.gap-12px { gap: 12px; }
.bg-none { background: none; }
.m-0-0-6px { margin: 0 0 6px; }
.lh-1-7 { line-height: 1.7; }
.mt-4px { margin-top: 4px; }
.lh-1-6 { line-height: 1.6; }
.mb-24px { margin-bottom: 24px; }
.op-6 { opacity: .6; }
.flex-1 { flex: 1; }
.mb-8px { margin-bottom: 8px; }
.gap-10px { gap: 10px; }
.mt-12px { margin-top: 12px; }
.mt-8px { margin-top: 8px; }
.bd-t-1px-solid-border { border-top: 1px solid var(--border); }
.mb-20px { margin-bottom: 20px; }
.flex-dir-column { flex-direction: column; }
.bg-surface { background: var(--surface); }
.p-14px { padding: 14px; }
.fw-400 { font-weight: 400; }
.d-block { display: block; }
.bd-b-2px-solid-accent { border-bottom: 2px solid var(--accent); }
.mb-16px { margin-bottom: 16px; }
.p-0-20px-20px { padding: 0 20px 20px; }
.fs-16px { font-size: 16px; }
.fs-18px { font-size: 18px; }
.c-388e3c { color: var(--down-color); }
.grid-cols-1fr-1fr { grid-template-columns: 1fr 1fr; }
.box-border-box { box-sizing: border-box; }
.bg-bg { background: var(--bg); }
.m-4px-0-8px { margin: 4px 0 8px; }
.mt-16px { margin-top: 16px; }
.shadow-none { box-shadow: none; }
.m-6px-0-0 { margin: 6px 0 0; }
.m-8px-0-0 { margin: 8px 0 0; }
.bg-bg-active { background: var(--bg-active); }
.rounded-12px { border-radius: 12px; }
.m-0-0-14px { margin: 0 0 14px; }
.fs-20px { font-size: 20px; }
.mb-6px { margin-bottom: 6px; }
.decoration-none { text-decoration: none; }
.pb-12px { padding-bottom: 12px; }
.mb-4px { margin-bottom: 4px; }
.rounded-20px { border-radius: 20px; }
.ta-left { text-align: left; }
.rounded-10px { border-radius: 10px; }
.p-8px-12px { padding: 8px 12px; }
.pt-8px { padding-top: 8px; }
.ws-nowrap { white-space: nowrap; }
.c-333 { color: #333; }
.grid-cols-1fr-1fr-1fr { grid-template-columns: 1fr 1fr 1fr; }
.h-160px { height: 160px; }
.p-16px-20px { padding: 16px 20px; }
.c-f57c00 { color: var(--alert-warn-text); }
/* 地番の「推定位置」用。地図レイヤーparcel-*-estimatedのline-colorと同色（mapView.js参照） */
.c-7b1fa2 { color: #7B1FA2; }
.p-32px { padding: 32px; }
.p-6px-12px { padding: 6px 12px; }
.shrink-0 { flex-shrink: 0; }
.mb-14px { margin-bottom: 14px; }
.p-8px-18px { padding: 8px 18px; }
.h-28px { height: 28px; }
.m-0-0-10px { margin: 0 0 10px; }
.justify-center { justify-content: center; }
.rounded-14px { border-radius: 14px; }
.p-0-8px { padding: 0 8px; }
.bd-1px-solid-accent44 { border: 1px solid var(--accent)44; }
.op-7 { opacity: .7; }
.mb-10px { margin-bottom: 10px; }
.p-10px-12px { padding: 10px 12px; }
.bd-b-2px-solid-border { border-bottom: 2px solid var(--border); }
.d-inline-block { display: inline-block; }
.c-111 { color: #111; }
.c-856404 { color: #856404; }
.p-4px-8px { padding: 4px 8px; }
.m-10px-0-6px { margin: 10px 0 6px; }
.mt-6px { margin-top: 6px; }
.mt-10px { margin-top: 10px; }
.resize-vertical { resize: vertical; }
.p-0-10px { padding: 0 10px; }
.bd-1px-solid-accent { border: 1px solid var(--accent); }
.pt-80px { padding-top: 80px; }
.p-24px { padding: 24px; }
.lh-1 { line-height: 1; }
.m-0-0-2px { margin: 0 0 2px; }
.pb-8px { padding-bottom: 8px; }
.p-3px-8px { padding: 3px 8px; }
.p-0-12px { padding: 0 12px; }
.h-34px { height: 34px; }
.bd-collapse-collapse { border-collapse: collapse; }
.p-3px-6px { padding: 3px 6px; }
.p-4px-6px { padding: 4px 6px; }
.m-2px-0-0 { margin: 2px 0 0; }
.rounded-4px { border-radius: 4px; }
.p-6px-14px { padding: 6px 14px; }
.max-w-640px { max-width: 640px; }
.m-0-auto { margin: 0 auto; }
.p-24px-20px { padding: 24px 20px; }
.mb-32px { margin-bottom: 32px; }
.m-0-0-16px { margin: 0 0 16px; }
.h-1px { height: 1px; }
.p-8px-0 { padding: 8px 0; }
.items-baseline { align-items: baseline; }
.pt-12px { padding-top: 12px; }
.p-8px-14px { padding: 8px 14px; }
.p-2px-16px-2px-0 { padding: 2px 16px 2px 0; }
.p-12px-14px { padding: 12px 14px; }

/* ---- 初回訪問時のCookie/プライバシー通知バナー（components/consentBanner.js） ---- */
#consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2600; /* bottomSheet(2500/2501)より前面、モーダル(3000)より背面 */
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.12);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}
#consent-banner .consent-banner-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
@media (max-width: 640px) {
  #consent-banner .consent-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    text-align: left;
  }
}
.bd-1px-solid-d32f2f { border: 1px solid var(--up-color); }
.h-36px { height: 36px; }
.bd-1px-solid-388e3c { border: 1px solid var(--down-color); }
.ml-6px { margin-left: 6px; }
.p-18px { padding: 18px; }
.fs-12-5px { font-size: 12.5px; }
.c-inherit { color: inherit; }
.grid-cols-repeat-auto-fit-minmax-220px-1fr { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); }
.ov-x-auto { overflow-x: auto; }
.m-10px-0-0 { margin: 10px 0 0; }
.ml-8px { margin-left: 8px; }
.p-10px-24px { padding: 10px 24px; }
.p-0-10px-0-34px { padding: 0 10px 0 34px; }
.to-ellipsis { text-overflow: ellipsis; }
.justify-flex-end { justify-content: flex-end; }
.fs-48px { font-size: 48px; }
.p-6px-10px { padding: 6px 10px; }
.p-0 { padding: 0; }
.d-inline-flex { display: inline-flex; }
.cursor-default { cursor: default; }
.select-none { user-select: none; }
.p-8px-10px { padding: 8px 10px; }
.h-140px { height: 140px; }
.items-flex-start { align-items: flex-start; }
.p-0-2px { padding: 0 2px; }
.ml-2px { margin-left: 2px; }
.cursor-help { cursor: help; }
.max-h-200px { max-height: 200px; }
.ov-y-auto { overflow-y: auto; }
.gap-16px { gap: 16px; }
.h-180px { height: 180px; }
.grid-cols-repeat-auto-fill-minmax-150px-1fr { grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); }
.mb-0 { margin-bottom: 0; }
.gap-2px { gap: 2px; }
.p-2px-6px { padding: 2px 6px; }
.self-flex-start { align-self: flex-start; }
.lh-1-8 { line-height: 1.8; }
.bg-linear-gradient-135deg-rgba-230-103-103-08-rgba-230-103-103-04 { background: linear-gradient(135deg,rgba(230,103,103,.08),rgba(230,103,103,.04)); }
.p-5px-12px { padding: 5px 12px; }
.m-0-0-20px { margin: 0 0 20px; }
.fs-40px { font-size: 40px; }
.fs-28px { font-size: 28px; }
.m-0-0-24px { margin: 0 0 24px; }
.bg-border { background: var(--border); }
.m-12px-0 { margin: 12px 0; }
.pos-absolute { position: absolute; }
.h-40px { height: 40px; }
.p-6px-4px { padding: 6px 4px; }
.m-0-0-5px { margin: 0 0 5px; }
.mt-3px { margin-top: 3px; }
.p-6px-8px { padding: 6px 8px; }
.p-10px-22px { padding: 10px 22px; }
.fs-24px { font-size: 24px; }
.mt-14px { margin-top: 14px; }
.decoration-underline { text-decoration: underline; }
.m-8px-0-6px { margin: 8px 0 6px; }

/* ---- スクロール連動フェードイン（landingView.js以外でも再利用可） ---- */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal-on-scroll.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal-on-scroll { opacity: 1; transform: none; transition: none; }
}
/* グリッド内で並ぶ要素は少しずつ遅延させ、順番に浮かび上がるスタガー演出にする */
.landing-stats-grid > .reveal-on-scroll:nth-child(2),
.landing-usecase-grid > .reveal-on-scroll:nth-child(2),
.landing-plans-grid > .reveal-on-scroll:nth-child(2)   { transition-delay: .08s; }
.landing-stats-grid > .reveal-on-scroll:nth-child(3),
.landing-usecase-grid > .reveal-on-scroll:nth-child(3) { transition-delay: .16s; }
.landing-stats-grid > .reveal-on-scroll:nth-child(4),
.landing-usecase-grid > .reveal-on-scroll:nth-child(4) { transition-delay: .24s; }
.landing-stats-grid > .reveal-on-scroll:nth-child(5),
.landing-usecase-grid > .reveal-on-scroll:nth-child(5) { transition-delay: .32s; }
.landing-stats-grid > .reveal-on-scroll:nth-child(6)   { transition-delay: .4s; }

/* ---- ランディングページ ---- */
.landing-page { max-width: 1100px; margin: 0 auto; padding: 0 20px 64px; }

.landing-hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: 72px 16px 56px;
  margin: 0 -20px 8px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    radial-gradient(circle at 80% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 50%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
/* オリジナルの抽象的な折れ線・棒グラフ装飾（Foursquare等の実素材は使わず自前SVGで表現） */
.landing-hero-graphic {
  position: absolute;
  inset: 0;
  z-index: 0;
  color: var(--accent);
  pointer-events: none;
}
.landing-hero-graphic svg { width: 100%; height: 100%; }
.landing-hero-inner { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }
.landing-hero-title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 0 18px;
  color: var(--text);
}
.landing-hero-lead {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text);
  max-width: 620px;
  margin: 0 auto 14px;
}
.landing-hero-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 28px;
}
.landing-hero-cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.landing-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.landing-btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.landing-btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.landing-btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.landing-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.landing-btn-lg { height: 52px; padding: 0 34px; font-size: 15px; }

.landing-section { padding: 56px 0; }
.landing-section-title { font-size: 22px; font-weight: 800; margin: 0 0 8px; text-align: center; }
.landing-section-desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.8; margin: 0 0 20px; }

.landing-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.landing-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  text-align: center;
}
.landing-stat-number {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.landing-stat-number-sm { font-size: 15px; line-height: 1.5; }
.landing-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.landing-usecase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.landing-usecase-tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.landing-usecase-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.landing-usecase-icon { color: var(--accent); font-size: 28px; }
.landing-usecase-title { font-size: 14.5px; font-weight: 700; margin: 10px 0 6px; }
.landing-usecase-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.7; margin: 0; }

.landing-ranking-panel {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.landing-ranking-text .landing-section-title,
.landing-ranking-text .landing-section-desc { text-align: left; }
.landing-ranking-preview-title { font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 0 0 8px 2px; }
.landing-ranking-preview { background: var(--bg-subtle); border-radius: 10px; padding: 16px; min-height: 96px; }
.landing-rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.landing-rank-row + .landing-rank-row { border-top: 1px solid var(--border); }
.landing-rank-city { flex: 1; font-size: 13.5px; font-weight: 600; }
.landing-rank-rate { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

.landing-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 28px;
  align-items: start;
}
.landing-plan-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.landing-plan-col-title { font-size: 15px; font-weight: 800; margin: 0 0 16px; }
.landing-free-feature-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.landing-free-feature-row + .landing-free-feature-row { border-top: 1px solid var(--border); }

.landing-closing {
  text-align: center;
  padding: 64px 20px;
  margin: 24px -20px 0;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
  border-radius: var(--radius);
}
.landing-closing-title { font-size: 24px; font-weight: 800; margin: 0 0 10px; }
.landing-closing-desc { font-size: 13.5px; color: var(--text-muted); margin: 0 0 24px; }

@media (max-width: 768px) {
  .landing-hero { padding: 48px 16px 40px; }
  .landing-hero-title { font-size: 26px; }
  .landing-ranking-panel { grid-template-columns: 1fr; gap: 20px; padding: 20px; }
  .landing-plans-grid { grid-template-columns: 1fr; }
  .landing-section { padding: 40px 0; }
}

/* ---- AI対話フローティングウィンドウ（components/aiChatWindow.js、2026-08-04追加） ---- */
/* 常時表示のFAB。bottomSheet(1000/1001)より前面・トップレベルモーダル(3000)より背面の帯を使う */
.ai-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  cursor: pointer;
  z-index: 2700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease;
}
.ai-chat-fab:hover { transform: scale(1.06); }
.ai-chat-fab.d-none { display: none; }

.ai-chat-window {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  border: 1px solid var(--border);
  z-index: 2699;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.ai-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-chat-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
  gap: 8px;
}
.ai-chat-window-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-window-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  padding: 2px;
}

.ai-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 0;
}

.ai-chat-msg-row { display: flex; margin-bottom: 8px; }
.ai-chat-msg-row.user { justify-content: flex-end; }
.ai-chat-msg-row.assistant { justify-content: flex-start; }
.ai-chat-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.ai-chat-bubble.user { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ai-chat-bubble.assistant { background: var(--bg-subtle); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

.ai-chat-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  flex-shrink: 0;
}

.ai-chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 0 14px 14px;
  flex-shrink: 0;
}
.ai-chat-input {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  max-height: 100px;
}
.ai-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-chat-send-btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 768px) {
  .ai-chat-window {
    right: 0; left: 0; top: 0; bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .ai-chat-fab { bottom: 16px; right: 16px; }
}
