/* 練馬区 外国人住民・在留資格ダッシュボード — style */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #5a6878;
  --line: #e2e6eb;
  --line-strong: #c7cdd4;
  --accent: #C8324C;       /* 練馬区を強調する基準色（app.js の COLOR_NERIMA と一致） */
  --accent-soft: #FFF1F4;
  --neutral: #1f6f9a;      /* 折れ線2本目用 */
  --positive: #2a7a2a;
  --negative: #b3361a;
  --warn-bg: #fff7e0;
  --warn-border: #e0b649;
  --sample-bg: #fff2f4;
  --sample-border: #d77a87;
  --card-bg: #f7f9fb;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", "Segoe UI", sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--neutral); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.popup-status-banner {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 3px;
  padding: 4px 7px;
  font-size: 11.5px;
  margin: 4px 0 8px;
}
.page-header {
  background: linear-gradient(180deg, #f5f8fb 0%, #ffffff 100%);
  border-bottom: 1px solid var(--line);
  padding: 28px 0 24px;
}
.page-header .container { position: relative; padding-left: 64px; }
.jp-flag-corner {
  position: absolute;
  top: 0;
  left: 0;
  line-height: 0;
}
.jp-flag-corner svg {
  display: block;
  width: 48px;
  height: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  border-radius: 1px;
}
@media (max-width: 700px) {
  .page-header .container { padding-left: 44px; }
  .jp-flag-corner svg { width: 32px; height: 21px; }
}
.page-header h1 {
  margin: 6px 0 4px;
  font-size: 1.85rem;
  letter-spacing: 0.01em;
}
.subtitle {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 4px;
}
.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.meta-list li strong {
  color: var(--fg);
  font-weight: 600;
}

/* Banner */
.banner {
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 0.92rem;
}
.banner-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
}
.banner-sample {
  background: var(--sample-bg);
  border: 1px solid var(--sample-border);
}
.banner code {
  background: rgba(0,0,0,0.06);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}
.hidden { display: none; }

/* Sections */
.section {
  padding: 32px 0 16px;
  border-bottom: 1px solid var(--line);
}
.section:last-of-type {
  border-bottom: none;
}
.section h2 {
  font-size: 1.35rem;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}
.section h3 {
  font-size: 1.05rem;
  margin: 22px 0 6px;
  color: #2a3744;
}
.caption {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 14px;
}

/* Summary cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 14px 0;
}
.summary-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
}
.summary-card .label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.summary-card .value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.summary-card .sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}
.summary-card.accent { background: var(--accent-soft); border-color: var(--accent); }

/* Tables */
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 8px 0 4px;
}
.ranking-table th, .ranking-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: right;
}
.ranking-table th {
  background: #f5f7fa;
  font-weight: 600;
  text-align: right;
  color: #2a3744;
}
.ranking-table th:first-child,
.ranking-table td:first-child {
  text-align: left;
}
.ranking-table tr:hover td {
  background: #fafbfd;
}
.num { font-variant-numeric: tabular-nums; }
.bold { font-weight: 700; }
.pos { color: var(--positive); font-variant-numeric: tabular-nums; }
.neg { color: var(--negative); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.tag-na {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: #ececec;
  color: #555;
}

/* Charts */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 360px;
  margin: 6px 0 4px;
}
.chart-tall { height: 420px; }
.chart-doughnut { height: 320px; }

/* split layout: doughnut + table */
.split-2col {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(340px, 1.4fr);
  gap: 18px;
  align-items: start;
  margin: 8px 0 4px;
}
@media (max-width: 720px) {
  .split-2col { grid-template-columns: 1fr; }
}
.table-wrap { overflow-x: auto; }

/* source citation under each chart */
.source-cite {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 2px 0 18px;
  line-height: 1.5;
}
.source-cite strong { color: var(--fg); font-weight: 600; }

/* tab nav */
.tab-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 2px solid var(--line);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.tab-nav .container {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 20px;
}
.tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  font-size: 0.92rem;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  color: var(--muted);
  font-family: inherit;
  border-bottom: 3px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tab-btn:hover { color: var(--fg); background: #f6fafc; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel h2 { font-size: 1.4rem; margin: 24px 0 8px; }

/* period selector */
.period-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 14px;
  padding: 8px 12px;
  background: #f5f7fa;
  border-radius: 4px;
}
.period-selector select {
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.note-list { font-size: 0.88rem; line-height: 1.6; }
.note-list li { margin: 4px 0; }

/* per-component metadata block */
.meta-block {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 14px;
  margin-top: 6px;
  padding: 8px 12px;
  background: #f7f9fb;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--fg);
}
.meta-block span { line-height: 1.5; }
.meta-block strong { color: #2a3744; font-weight: 600; }

/* matrix validation collapsible */
.validation-block {
  margin: 12px 0;
  padding: 8px 12px;
  background: #fafbfd;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.85rem;
}
.validation-block summary {
  cursor: pointer;
  font-weight: 600;
  color: #2a3744;
  padding: 4px 0;
}
.validation-block summary:hover { color: var(--accent); }
.validation-block table { margin-top: 8px; }

/* country flag (image from flagcdn.com) */
.flag-img {
  display: inline-block;
  width: auto;
  vertical-align: -3px;
  border: 1px solid #d8dde3;
  border-radius: 2px;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.04);
}
.flag-fallback {
  display: inline-block;
  width: 18px;
  height: 14px;
  background: #f0f0f0;
  border: 1px solid #d8dde3;
  border-radius: 2px;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  vertical-align: -2px;
}
.flag-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.name-cell { display: inline-block; }

/* summary card 「最多国籍」用 */
.value-flag { display: inline-block; margin-right: 6px; vertical-align: -4px; }

/* custom legend */
.custom-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 4px 0 6px;
  padding: 4px 0;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--fg);
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.legend-item.static {
  cursor: default;
  background: transparent;
  border-color: transparent;
  padding: 2px 6px;
}
.legend-item .legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-item .legend-label { line-height: 1.2; }
.legend-item .legend-meta { color: var(--muted); font-size: 0.8em; margin-left: 2px; }
.interactive-legend .legend-item:hover {
  border-color: var(--neutral);
  background: #f6fafc;
}
.interactive-legend .legend-item.focused {
  border-color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.interactive-legend .legend-item.dimmed {
  opacity: 0.4;
}
.doughnut-legend {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

/* explanation box (matrix etc.) */
.explanation-box {
  background: #f7fafd;
  border-left: 4px solid var(--neutral);
  padding: 14px 16px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 0.92rem;
}
.explanation-box h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: #2a3744;
}
.explanation-box p {
  margin: 4px 0;
  line-height: 1.6;
}

/* Matrix */
.matrix-wrap {
  overflow-x: auto;
}
.matrix-table {
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 8px 0;
}
.matrix-table th, .matrix-table td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: right;
  min-width: 70px;
  font-variant-numeric: tabular-nums;
}
.matrix-table th {
  background: #f5f7fa;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.matrix-table th:first-child,
.matrix-table td:first-child {
  text-align: left;
  background: #f5f7fa;
  font-weight: 600;
  min-width: 110px;
  position: sticky;
  left: 0;
}

/* Increase cards */
.increase-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.increase-card h3 {
  margin-top: 0;
  font-size: 1rem;
}

/* Policy */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.policy-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.policy-card h4 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: #2a3744;
}
.policy-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.55;
}

/* Sources */
.sources-list {
  padding-left: 18px;
  margin: 6px 0 18px;
  font-size: 0.9rem;
}
.sources-list li {
  margin: 4px 0;
}
.notes ul {
  padding-left: 18px;
  font-size: 0.88rem;
  color: #2a3744;
  margin: 6px 0;
}
.notes li {
  margin: 4px 0;
  line-height: 1.55;
}

/* Footer */
.page-footer {
  background: #f5f7fa;
  border-top: 1px solid var(--line);
  padding: 18px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.page-footer p {
  margin: 4px 0;
}

/* Responsive */
@media (max-width: 640px) {
  .page-header h1 { font-size: 1.45rem; }
  .summary-card .value { font-size: 1.4rem; }
  .section h2 { font-size: 1.15rem; }
  .chart-wrap { height: 280px; }
}

/* ================================================================
 * 2026-05-28 改修：要点パネル・解説カード・横棒ランキング・コラム
 * ================================================================ */

/* key-stats（このページの要点） */
.key-stats {
  background: #FFF7FA;
  border: 1px solid var(--accent);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  padding: 16px 20px 14px;
  margin: 12px 0 22px;
}
.key-stats-title {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.01em;
}
.key-stats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 6px 18px;
  font-size: 0.95rem;
  line-height: 1.55;
}
.key-stats-list li {
  position: relative;
  padding-left: 18px;
}
.key-stats-list li::before {
  content: '●';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-size: 0.6em;
  line-height: 1.9;
}
.key-stats-list li.placeholder { color: var(--muted); }

/* 住基 vs 在留外国人統計 コラム */
.info-column {
  background: #f7fafd;
  border: 1px solid #d6e3ee;
  border-radius: 10px;
  padding: 18px 22px 14px;
  margin: 28px 0 8px;
}
.info-column-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: #1e4a6e;
  font-weight: 700;
}
.info-column-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.info-column-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
}
.info-column-card h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #1e4a6e;
  font-weight: 700;
}
.info-column-card p {
  margin: 4px 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #2a3744;
}
.info-column-meta {
  font-size: 0.78rem !important;
  color: var(--muted) !important;
  margin-top: 6px !important;
}

/* chart-note（各グラフのワンポイント解説） */
.chart-note {
  background: #fafbfd;
  border: 1px solid var(--line);
  border-left: 3px solid var(--neutral);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 8px 0 26px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.chart-note .note-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 14px;
  margin: 4px 0;
}
.chart-note .note-row + .note-row {
  border-top: 1px dashed #e5e9ee;
  padding-top: 6px;
}
.chart-note .note-label {
  font-weight: 700;
  color: #1e4a6e;
  font-size: 0.82rem;
  white-space: nowrap;
}
.chart-note .note-row span:last-child {
  color: #2a3744;
}

/* 横棒ランキング */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 4px;
}
.ranking-row {
  display: grid;
  grid-template-columns: 28px minmax(120px, 1.2fr) minmax(160px, 2fr) 90px 60px;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.ranking-row:hover { background: #fafbfd; }
.ranking-row .rank-num {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: right;
  font-weight: 600;
}
.ranking-row .rank-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-row .rank-bar-wrap {
  position: relative;
  height: 14px;
  background: #f1f3f6;
  border-radius: 3px;
  overflow: hidden;
}
.ranking-row .rank-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #d76b80 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.ranking-row:nth-child(n+6) .rank-bar {
  background: linear-gradient(90deg, #9aa6b2 0%, #c4cdd5 100%);
}
.ranking-row .rank-count {
  text-align: right;
  font-weight: 700;
  color: #1a1a1a;
}
.ranking-row .rank-pct {
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .ranking-row {
    grid-template-columns: 22px 1fr auto auto;
    grid-template-areas:
      'num label count pct'
      'num bar bar bar';
    row-gap: 4px;
  }
  .ranking-row .rank-num { grid-area: num; }
  .ranking-row .rank-label { grid-area: label; }
  .ranking-row .rank-bar-wrap { grid-area: bar; }
  .ranking-row .rank-count { grid-area: count; }
  .ranking-row .rank-pct { grid-area: pct; }
}

/* 折りたたみ詳細セクション（advanced-detail） */
.advanced-detail {
  margin: 14px 0 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}
.advanced-detail > summary {
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: #2a3744;
  background: #f5f7fa;
  border-radius: 8px 8px 0 0;
  list-style: revert;
}
.advanced-detail[open] > summary {
  border-bottom: 1px solid var(--line);
}
.advanced-detail > summary:hover { color: var(--accent); }
.advanced-detail > *:not(summary) { padding: 0 16px; }
.advanced-detail > *:first-of-type:not(summary) { padding-top: 12px; }
.advanced-detail > *:last-child { padding-bottom: 14px; }

/* 出典折りたたみ（コンパクト表示） */
.source-collapsed {
  margin: 10px 0 24px;
  font-size: 0.82rem;
  color: var(--muted);
}
.source-collapsed > summary {
  cursor: pointer;
  padding: 4px 0;
  color: #2a3744;
  font-weight: 500;
}
.source-collapsed > summary:hover { color: var(--accent); }
.source-collapsed > div {
  margin-top: 4px;
}

/* 指標切替セレクタ（他区比較） */
.indicator-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 14px;
  padding: 8px 12px;
  background: #f5f7fa;
  border-radius: 6px;
}
.indicator-selector label { font-weight: 600; font-size: 0.9rem; }
.indicator-selector select {
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}

/* svg-chart-wrap */
.svg-chart-wrap {
  margin: 8px 0 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}

/* グラフ周辺の余白増 */
section.tab-panel h3 {
  margin-top: 28px;
}
section.tab-panel > .chart-wrap,
section.tab-panel > .chart-tall {
  margin-bottom: 6px;
}

/* small-screen tabs */
@media (max-width: 720px) {
  .tab-btn { font-size: 0.85rem; padding: 8px 10px; }
  .tab-nav .container { padding: 4px 8px; gap: 1px; }
  .key-stats { padding: 14px 16px 12px; }
  .key-stats-list { font-size: 0.9rem; }
  .info-column { padding: 14px 16px; }
  .chart-note .note-row { grid-template-columns: 1fr; gap: 2px; }
  .chart-note .note-label { font-size: 0.78rem; }
}

/* ================================================================
 * 町丁目タブ（2020年国勢調査参考）
 * ================================================================ */

/* 参考バッジ */
.reference-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  background: #6b7280;
  border-radius: 999px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

#tab-neighborhood h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
#tab-neighborhood h3 { margin-top: 28px; }
#tab-neighborhood h4 { margin: 14px 0 8px; font-size: 0.95rem; color: #2a3744; }

.neighborhood-key-stats {
  border-left-color: #6b7280; /* 参考データなので灰寄り */
  background: #f5f7fa;
  border-color: #cbd5e1;
}

/* 2カラム：地図 + ランキング */
.neighborhood-2col {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 18px;
  margin: 14px 0 8px;
}
.neighborhood-map-col { min-width: 0; }
.neighborhood-rank-col { min-width: 0; }
@media (max-width: 900px) {
  .neighborhood-2col { grid-template-columns: 1fr; }
}

/* 地図 */
.map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 10px;
  padding: 8px 12px;
  background: #f5f7fa;
  border-radius: 6px;
}
.map-toolbar select {
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}
.map-wrap {
  width: 100%;
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f5f7fa;
}
#map-neighborhood { width: 100%; height: 100%; }
@media (max-width: 720px) {
  .map-wrap { height: 380px; }
}

/* 地図凡例 */
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 8px 0 10px;
  font-size: 0.78rem;
  color: #2a3744;
  padding: 8px 10px;
  background: #fafbfd;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.map-legend .legend-title {
  font-weight: 700;
  margin-right: 8px;
}
.legend-item-map {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.legend-item-map i {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #94a3b8;
  border-radius: 2px;
}

/* ポップアップ */
.map-popup { font-size: 0.85rem; min-width: 200px; }
.map-popup h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #1a1a1a;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.map-popup dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0;
}
.map-popup dt { color: var(--muted); font-size: 0.78rem; }
.map-popup dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }
.map-popup dd.bold { font-weight: 700; color: var(--accent); }
.popup-meta {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px dashed #e5e9ee;
  padding-top: 4px;
}

/* Leaflet コンテナの調整 */
.leaflet-container { font-family: inherit; }
.leaflet-popup-content { margin: 12px 14px; min-width: 200px; }

/* 大泉エリアカード */
.oizumi-card {
  background: linear-gradient(135deg, #FFF1F4 0%, #FFE4EA 100%);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 12px 0 18px;
}
.oizumi-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 18px;
  border-bottom: 1px dashed #f4a4b3;
  padding-bottom: 14px;
  margin-bottom: 12px;
}
.oizumi-headline-label {
  font-size: 0.92rem;
  color: #6b1e2e;
  font-weight: 600;
}
.oizumi-headline-value {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.oizumi-headline-value .unit { font-size: 1.1rem; margin-left: 2px; }
.oizumi-headline-meta {
  font-size: 0.78rem;
  color: var(--muted);
}
.oizumi-sub {
  width: 100%;
  font-size: 0.88rem;
  color: #6b1e2e;
}
.oizumi-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 4px 18px;
  font-size: 0.88rem;
  color: #2a3744;
}
.oizumi-meta-grid strong { color: var(--accent); }
.oizumi-meta-grid .muted { color: var(--muted); font-size: 0.82rem; }
.oizumi-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.oizumi-subhead { color: var(--accent); }
.oizumi-tag {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.7rem;
  color: #fff;
  background: var(--accent);
  padding: 1px 6px;
  border-radius: 3px;
  vertical-align: middle;
  font-weight: 600;
}
.ranking-row.oizumi-row {
  background: #FFF7FA;
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}

/* 一覧表 フィルタ */
.neighborhood-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 0;
  padding: 10px 12px;
  background: #f5f7fa;
  border-radius: 6px;
}
.neighborhood-filter input[type="search"] {
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  min-width: 160px;
  flex: 1 1 200px;
  background: #fff;
}
.neighborhood-filter select {
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}
.neighborhood-filter .result-count {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

/* sortable */
.ranking-table.sortable thead th {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.ranking-table.sortable thead th:hover { background: #eaeef3; }
.ranking-table.sortable thead th.num-th { text-align: right; }
.ranking-table.sortable thead th.sorted-asc::after { content: ' ▲'; font-size: 0.7em; color: var(--accent); }
.ranking-table.sortable thead th.sorted-desc::after { content: ' ▼'; font-size: 0.7em; color: var(--accent); }

/* スマホ */
@media (max-width: 720px) {
  .oizumi-card { padding: 14px 16px; }
  .oizumi-headline-value { font-size: 1.9rem; }
  .map-toolbar { flex-direction: column; align-items: stretch; }
  .map-toolbar select { width: 100%; }
  .map-legend { font-size: 0.72rem; }
}

/* ================================================================
 * 町丁目タブ 第2版（2026-05-28 修正版）
 * 警告カード・ページネーション・地図フォールバック・行展開
 * ================================================================ */

.warning-card {
  background: #fffaf0;
  border: 1px solid #f59e0b;
  border-left: 4px solid #d97706;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 0.92rem;
  color: #78350f;
}

/* 中立な注記カード（秘匿・未公表など。結合失敗ではない場合に使う） */
.info-card {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #64748b;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 0.9rem;
  color: #334155;
}

/* 地図フォールバック */
.map-wrap.map-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
}
.map-fallback-inner {
  text-align: center;
  padding: 20px;
  max-width: 360px;
}
.map-fallback-inner h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #475569;
}
.map-fallback-inner p {
  margin: 4px 0;
  font-size: 0.88rem;
  color: #64748b;
}
.map-fallback-inner .muted { font-size: 0.78rem; color: #94a3b8; }

/* ページネーション */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 10px 0 16px;
  padding: 8px 12px;
  background: #f5f7fa;
  border-radius: 6px;
  font-size: 0.88rem;
}
.pagination .pg-btn {
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  color: #2a3744;
  transition: background 0.12s, border-color 0.12s;
}
.pagination .pg-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.pagination .pg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination .pg-info {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* 行展開（詳細） */
#table-neighborhood tbody .data-row { transition: background 0.1s; }
#table-neighborhood tbody .data-row:hover { background: #fafbfd; }
#table-neighborhood tbody .data-row.expanded { background: #fff7fa; }
#table-neighborhood tbody .expand-toggle {
  display: inline-block;
  width: 18px;
  padding: 0;
  background: none;
  border: none;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  margin-right: 6px;
  vertical-align: 1px;
}
#table-neighborhood tbody .expand-toggle:hover { color: var(--accent); }
#table-neighborhood tbody .detail-row {
  background: #fafbfd;
  border-left: 3px solid var(--accent);
}
#table-neighborhood tbody .detail-row td { padding: 10px 14px; }
.detail-dl {
  display: grid;
  grid-template-columns: 100px 1fr 100px 1fr 100px 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 0.85rem;
}
.detail-dl dt { color: var(--muted); white-space: nowrap; }
.detail-dl dd { margin: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .detail-dl { grid-template-columns: 90px 1fr; }
}

/* 大泉 丁目別折りたたみ */
.oizumi-choume-detail {
  margin-top: 12px;
}
.oizumi-choume-detail > summary {
  font-size: 0.92rem;
  color: var(--accent);
}

/* 表セル: エリア列のオーバーフロー対策 */
#table-neighborhood th[data-sort="area"],
#table-neighborhood td:nth-child(5) {
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
 * 23区拡張：準備中UI／23区一覧
 * ================================================================ */

.availability-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
}
.availability-available    { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.availability-planned      { background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.availability-unavailable  { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.availability-unknown      { background: #F1F5F9; color: #475569; border: 1px solid #CBD5E1; }
.availability-reference_only { background: #E0E7FF; color: #3730A3; border: 1px solid #A5B4FC; }

/* 準備中ページ用 */
.planned-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 22px;
  margin: 16px 0;
}
.planned-card h3 {
  margin: 18px 0 8px;
  font-size: 1rem;
  color: #1e293b;
  font-weight: 700;
}
.planned-card h3:first-of-type { margin-top: 0; }

.planned-info-table,
.planned-availability-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin: 6px 0 12px;
}
.planned-info-table th,
.planned-availability-table th,
.planned-info-table td,
.planned-availability-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}
.planned-info-table th { width: 160px; color: var(--muted); font-weight: 600; background: #f5f7fa; }
.planned-availability-table thead th { background: #f5f7fa; font-weight: 600; color: #2a3744; }
.planned-availability-table td:last-child { text-align: right; width: 130px; }

.planned-links {
  list-style: none;
  padding: 0;
  margin: 6px 0;
  font-size: 0.9rem;
}
.planned-links li { padding: 4px 0; line-height: 1.6; }

.planned-status-line {
  font-size: 0.92rem;
  color: var(--muted);
  margin: 12px 0;
}

/* 23区一覧テーブル */
.tokyo23-table th,
.tokyo23-table td {
  font-size: 0.9rem;
  text-align: left;
}
.tokyo23-table td:nth-child(2) { font-variant-numeric: tabular-nums; }
.tokyo23-table tr:hover td { background: #fafbfd; }

/* 23区サマリーカード行 */
.tokyo23-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.tokyo23-summary .summary-card { padding: 12px 14px; }
.tokyo23-summary .summary-card .value { font-size: 1.4rem; }

/* ヘッダ行（タイトル + 区セレクタ） */
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.header-row h1 { margin: 6px 0; flex: 1 1 auto; min-width: 220px; }

.ward-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  background: #f5f7fa;
  padding: 6px 12px;
  border-radius: 6px;
  flex-shrink: 0;
}
.ward-selector label { font-weight: 600; color: #2a3744; white-space: nowrap; }
.ward-selector select {
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}
.ward-selector-link {
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  padding-left: 4px;
  border-left: 1px solid var(--line);
}
.ward-selector-link:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .header-row { flex-direction: column; align-items: stretch; }
  .ward-selector { width: 100%; justify-content: space-between; }
}

@media (max-width: 720px) {
  .planned-info-table th { width: auto; }
  .planned-availability-table td:last-child { width: auto; }
}



