/* 個人情報流出マップ 共通スタイル */
:root {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --panel-2: #f1f0ec;
  --line: #e2e0da;
  --line-2: #cfccc4;
  --text: #1b1b1b;
  --text-2: #474744;
  --muted: #7b7a75;
  --brand: #c8102e;
  --link: #1a4fa0;
  --focus: #1a4fa0;
  --radius: 3px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .14);
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sev5: #d6204b; --sev4: #f0661c; --sev3: #d99a00; --sev2: #2a9d8f; --sev1: #4c7bd9;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, select, input, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- ボタン ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 2px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--panel-2); }
.btn-primary { background: var(--text); color: #fff; border-color: var(--text); }
.btn-primary:hover { background: #3a3a38; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); }
.nl-btn { display: inline-flex; align-items: center; justify-content: center; padding: 7px 14px; border-radius: 2px;
  background: var(--panel); color: var(--text); font-weight: 600; font-size: 13.5px; text-decoration: none; border: 1px solid var(--text); cursor: pointer; }
.nl-btn:hover { background: var(--text); color: #fff; }
.topbar .nl-btn { border: 0; padding: 6px 4px; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.topbar .nl-btn:hover { background: none; color: var(--text); }

/* ---------- ヘッダー（全ページ共通） ---------- */
.topbar { position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; gap: 20px; height: 56px; padding: 0 20px;
  background: #fff; border-top: 3px solid var(--brand); border-bottom: 1px solid var(--text); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex-shrink: 0; }
.brand-mark { display: none; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: .06em; line-height: 1.1; }
.brand-sub { display: inline; margin-left: 10px; font-family: var(--font); font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { padding: 6px 12px; border-radius: 2px; color: var(--text-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); background: none; box-shadow: inset 0 -2px 0 var(--brand); border-radius: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-btn { display: none; }

/* ---------- 地図ページのレイアウト ---------- */
body.map-page { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.layout { display: grid; grid-template-columns: 420px 1fr; min-height: 0; }
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #dfe7f0; }

/* 検索（パネル上部） */
.finder { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.finder h1 { margin: 0 0 10px; font-family: var(--serif); font-size: 20px; line-height: 1.4; letter-spacing: .02em; }
.finder p.lead { margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 46px; padding: 0 40px 0 42px; border: 1px solid var(--text); border-radius: 2px; background: var(--panel); font-size: 16px; }
.search input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 2px rgba(26,79,160,.25); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.search .clear:hover { background: var(--panel-2); }
.finder-hint { margin: 6px 2px 0; font-size: 12px; color: var(--muted); }
.summary { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.summary b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }

/* タブ */
.tabs { display: flex; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); }
.tab { position: relative; padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--brand); }
.tab .count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 2px; background: var(--brand); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.tab .count.plain { background: none; color: var(--muted); padding: 0 2px; font-weight: 500; }
.pane { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 0 24px; }
.pane-pad { padding: 12px 18px; }

/* 一覧 */
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px 6px; font-size: 13px; color: var(--text-2); }
.list-tools select { border: 1px solid var(--line-2); border-radius: 2px; padding: 4px 8px; background: var(--panel); font-size: 13px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 6px; }
.af { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 10px; border-radius: 2px; background: var(--panel-2); font-size: 12px; color: var(--text-2); border: 0; cursor: pointer; }
.af::after { content: "×"; font-size: 13px; color: var(--muted); padding: 0 3px; }
.af:hover { background: var(--line); }
.list { list-style: none; margin: 0; padding: 0; }
.item { display: grid; grid-template-columns: 12px minmax(0,1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 12px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.item:hover { background: #f7f6f2; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.dot.possible { background: transparent; box-shadow: inset 0 0 0 3px var(--c); }
.dot.claimed { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.item-org { display: block; font-weight: 700; font-size: 14.5px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-right { text-align: right; }
.item-num { display: block; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.item-num.unknown { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.list-more { display: block; margin: 14px auto 0; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; }

/* まとめてチェックの結果 */
.check-sum { margin: 10px 18px 4px; padding: 10px 0 10px 14px; border-left: 3px solid var(--text); font-size: 13.5px; }
.check-sum h3 { margin: 0 0 6px; font-size: 14px; }
.check-sum ul { list-style: none; margin: 0; padding: 0; }
.check-sum li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.check-sum .hit { color: var(--sev5); font-weight: 700; }
.check-sum .nohit { color: var(--sev2); font-weight: 700; }

/* 状態バッジ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 2px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-sev { background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); }
.badge-sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.status { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 2px; white-space: nowrap; }
.status-confirmed { background: #fde8ec; color: #a3122f; }
.status-possible { background: #fff3e0; color: #9a4a00; }
.status-claimed { background: #eef0f4; color: #5a6272; }

/* お知らせ */
.news { list-style: none; margin: 0; padding: 0; }
.news li { border-bottom: 1px solid var(--line); }
.news-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 12px 18px; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; text-decoration: none; }
.news-item:hover { background: #f7f6f2; }
.news-title { display: block; font-weight: 700; font-size: 14px; line-height: 1.45; }
.news-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.news-srcs { display: block; padding: 0 18px 10px 62px; margin-top: -6px; font-size: 12px; color: var(--muted); }
.nk { flex-shrink: 0; margin-top: 1px; width: 44px; text-align: center; font-size: 11px; font-weight: 700; padding: 2px 0; border-radius: 2px; }
.nk-new { background: #fde8ec; color: #a3122f; }
.nk-upd { background: #e6f0ff; color: #1f4fa8; }
.nk-pend { background: #eef0f4; color: #5a6272; }
.sec-title { margin: 18px 18px 6px; padding-bottom: 4px; font-size: 13px; color: var(--text); font-weight: 700; border-bottom: 1px solid var(--text); }

/* 絞り込み */
.fgroup { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.fgroup h3 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; align-items: baseline; }
.fgroup h3 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line-2); border-radius: 2px; }
.seg button { border: 0; border-right: 1px solid var(--line-2); background: none; padding: 6px 12px; border-radius: 0; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--text); color: #fff; }
.row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.row select { border: 1px solid var(--line-2); border-radius: 2px; padding: 6px 8px; background: var(--panel); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 2px; border: 1px solid var(--line-2); background: var(--panel); font-size: 13px; cursor: pointer; color: var(--muted); }
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); opacity: .35; }
.chip.on { color: var(--text); border-color: var(--text); background: #fff; font-weight: 600; }
.chip.on i { opacity: 1; }
.chip:hover { border-color: var(--text-2); }
.fnote { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.filter-actions { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; }

/* 年別グラフ */
.timeline { display: flex; align-items: flex-end; gap: 2px; height: 96px; margin-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; min-width: 0; }
.bar-fill { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 3px 3px 0 0; overflow: hidden; }
.bar-fill span { display: block; width: 100%; }
.bar-label { font-size: 10px; color: var(--muted); margin-top: 3px; }
.bar.dim .bar-fill { opacity: .25; }
.bar:hover .bar-fill { opacity: .85; }

/* 傾向 */
.ins-bar { display: grid; grid-template-columns: 130px 1fr 40px; gap: 8px; align-items: center; font-size: 12.5px; margin: 5px 0; }
.ins-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.ins-bar i { height: 8px; border-radius: 4px; background: var(--text-2); opacity: .7; }
.ins-bar b { text-align: right; font-variant-numeric: tabular-nums; }
.ins-facts { margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--text-2); }
.ins-facts li { padding: 5px 0; border-top: 1px dashed var(--line); }
.ins-facts b { color: var(--text); }

/* 詳細 */
.detail { padding: 0 0 24px; }
.detail-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.detail-body { padding: 16px 18px 0; }
.detail h2 { margin: 8px 0 2px; font-family: var(--serif); font-size: 22px; line-height: 1.4; }
.detail .meta { margin: 0; color: var(--muted); font-size: 13px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 16px 0; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts div { background: var(--panel); padding: 10px 12px; }
.facts dt { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; font-weight: 700; font-size: 14.5px; line-height: 1.4; }
.facts dd.big { font-size: 20px; font-variant-numeric: tabular-nums; }
.facts dd small { font-weight: 500; color: var(--muted); font-size: 12px; }
.facts .wide { grid-column: 1 / -1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 3px 10px; border-radius: 2px; background: var(--panel-2); font-size: 12.5px; color: var(--text-2); }
.tag.hot { background: #fde8ec; color: #a3122f; font-weight: 600; }
.d-sec { margin: 18px 0 0; }
.d-sec h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.d-sum { margin: 0; font-size: 15px; line-height: 1.85; }
.advice { padding: 12px 0 12px 14px; border-left: 3px solid #1d6b5f; }
.advice h3 { color: #1d6b5f; margin-bottom: 6px; }
.advice ul { margin: 0; padding-left: 18px; font-size: 14px; }
.advice li { margin: 4px 0; }
.advice a { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600; }
.adv-note { margin: 0 0 6px; font-size: 13px; color: #8a5a00; }
.srcs { list-style: none; margin: 0; padding: 0; }
.srcs li { margin: 4px 0; }
.srcs a { font-size: 13.5px; word-break: break-all; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.related { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.related .item { padding: 10px 12px; }
.related li:last-child .item { border-bottom: 0; }
.d-note { margin-top: 18px; font-size: 12px; color: var(--muted); }

/* 地図上の要素 */
.map-legend { position: absolute; left: 12px; bottom: 26px; z-index: 500; max-width: calc(100% - 24px); padding: 10px 12px; border-radius: var(--radius); background: rgba(255,255,255,.96); border: 1px solid var(--line-2); font-size: 12px; }
.lg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; color: var(--text-2); }
.lg-toggle { border: 0; background: none; color: var(--link); cursor: pointer; font-size: 12px; padding: 0; }
.lg-sev { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.lg-sev span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lg-sev i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.lg-more { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--text-2); }
.lg-more p { margin: 4px 0; }
.lg-more .row-sz { display: flex; align-items: flex-end; gap: 12px; margin: 6px 0; }
.lg-more .row-sz span { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; }
.lg-more svg circle { fill: rgba(122,131,148,.18); stroke: var(--muted); }
.lg-line { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.map-count { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500; padding: 6px 14px; border-radius: 2px; background: #fff; border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.map-count b { font-variant-numeric: tabular-nums; }

/* Leaflet */
.leaflet-container { font: inherit; background: #dfe7f0; }
.leaflet-tooltip { background: #fff; color: var(--text); border: 0; border-radius: 2px; box-shadow: var(--shadow); font-size: 12.5px; padding: 6px 10px; }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow) !important; }
.leaflet-bar a { color: var(--text); }
.leaflet-control-attribution { background: rgba(255,255,255,.8) !important; font-size: 10px; }
.tt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 5px; }
.cluster { background: none; }
.cluster-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; position: relative;
  background: var(--ring); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: pointer; }
.cluster-inner::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.cluster-inner b, .cluster-inner small { position: relative; line-height: 1.1; }
.cluster-inner b { font-size: 13px; color: var(--text); }
.cluster-inner small { font-size: 10px; color: var(--muted); }

.leaflet-interactive.sel { filter: drop-shadow(0 0 4px rgba(0,0,0,.45)); }
.leaflet-gl-layer { opacity: .9; }

/* フッター（地図以外のページ） */
.foot { padding: 28px 20px 36px; border-top: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 12.5px; }
.foot-in { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }
.foot a { color: var(--text-2); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.panel-foot { padding: 16px 18px 4px; font-size: 12px; color: var(--muted); line-height: 1.7; border-top: 1px solid var(--line); margin-top: 16px; }
.panel-foot a { color: var(--text-2); }
.nl-card { margin: 18px 18px 0; padding: 14px 0 0; border-top: 1px solid var(--text); }
.nl-card h3 { margin: 0 0 4px; font-size: 14.5px; }
.nl-card p { margin: 0 0 10px; font-size: 13px; color: var(--text-2); }

/* ---------- スマホ ---------- */
@media (max-width: 900px) {
  .topbar { gap: 10px; padding: 0 12px; height: 54px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 17px; }
  .nav { display: none; position: absolute; top: 54px; left: 0; right: 0; flex-direction: column; gap: 0; margin: 0; padding: 8px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .menu-btn { display: inline-flex; }
  .topbar-right .nl-btn { display: none; }
  .layout { grid-template-columns: 1fr; position: relative; }
  .panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1000; height: 46%; border-right: 0; border-radius: 0; border-top: 1px solid var(--text); box-shadow: 0 -2px 8px rgba(0,0,0,.08); transition: height .25s; }
  .panel.full { height: calc(100% - 8px); }
  .panel.mini { height: 150px; }
  .grab { display: block !important; width: 100%; height: 18px; border: 0; background: none; cursor: pointer; flex-shrink: 0; }
  .grab::before { content: ""; display: block; width: 40px; height: 4px; margin: 7px auto; border-radius: 2px; background: var(--line-2); }
  .finder { padding: 4px 14px 10px; }
  .finder h1, .finder p.lead { display: none; }
  .summary { display: none; }
  .map-wrap { position: absolute; inset: 0; }
  .map-legend { bottom: auto; top: 56px; left: 8px; }
  .map-count { top: 8px; }
  .facts { grid-template-columns: 1fr 1fr; }
}
.grab { display: none; }
