/*
 * 管理画面の見た目(docs/admin.md §4)。試作は
 * https://claude.ai/artifact/4HDYUNWwstRjxnXhHt2TQQ で、色と寸法はそこから写した。
 *
 * - アクセントはロゴの紺(#174386)と青(#2f72bf)のあいだ。灰色もその青に寄せる
 * - 区切り線は引かない。区画はサイドバー → 一覧 → 詳細の順に明るくなる地色の段で分ける
 * - 余白は4の倍数。文字は 12 / 13 / 15 の3段
 * - インラインの style は書かない(CSP の style-src 'self' で落ちる)
 *
 * 画面ごとの部品(一覧の行・引用・表…)は、その画面と一緒にこのファイルへ足す。
 */

:root {
  --bg: #eff2f6;
  --surface: #ffffff;
  --side: #e9edf3;
  --pane: #f5f7fa;
  --hover: rgba(30, 50, 90, 0.06);
  --btn-hover: #f0f3f7;
  --field: #f6f8fb;
  --fg: #232a35;
  --meta: #5d6675;
  --line-strong: rgba(30, 45, 75, 0.28);
  --accent: #2a64ad;
  --accent-hover: #1f5296;
  --accent-soft: rgba(47, 114, 191, 0.12);
  --on-accent: #ffffff;
  --warn: #b8462a;
  --warn-hover: #a33d24;
  --warn-soft: rgba(217, 93, 57, 0.1);
  --on-warn: #ffffff;
  --quote: #f2f5f9;
  --chip: #e7ecf3;
  --warn-chip: rgba(217, 93, 57, 0.15);
  --toast-shadow: 0 4px 16px rgba(15, 25, 45, 0.18);
  --logo-filter: none;
  /* Google のログインボタン(ブランドの決まりの配色) */
  --gsi-bg: #ffffff;
  --gsi-line: #747775;
  --gsi-fg: #1f1f1f;
  /* 周辺検索の地図の下絵。地色はサイドバーの灰、水はアクセントを22%、緑地は文字色を7%混ぜたもの
     (MapLibre は color-mix を読めないので、混ぜた値で持つ) */
  --map-land: #e9edf3;
  --map-water: #bfcfe4;
  --map-park: #dbdfe6;
  --map-building: #e1e5eb;
  --map-road: #ffffff;
  --map-rail: rgba(30, 45, 75, 0.28);
  --map-label: #5d6675;
  --map-label-halo: #e9edf3;
  --map-area: rgba(42, 100, 173, 0.07);
  --font-sans: "Spline Sans", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --r: 4px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1218;
    --surface: #1a1f27;
    --side: #12161d;
    --pane: #161b22;
    --hover: rgba(255, 255, 255, 0.05);
    --btn-hover: #232a34;
    --field: #12161d;
    --fg: #e6eaf0;
    --meta: #9ba4b2;
    --line-strong: rgba(255, 255, 255, 0.24);
    --accent: #8fb5ea;
    --accent-hover: #a9c7f0;
    --accent-soft: rgba(143, 181, 234, 0.15);
    --on-accent: #0e1a2c;
    --warn: #e57a5a;
    --warn-hover: #ec8f72;
    --warn-soft: rgba(229, 122, 90, 0.14);
    --on-warn: #1f0f0a;
    --quote: #222834;
    --chip: #2a313c;
    --warn-chip: rgba(229, 122, 90, 0.2);
    --toast-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --logo-filter: brightness(1.35);
    --gsi-bg: #131314;
    --gsi-line: #8e918f;
    --gsi-fg: #e3e3e3;
    --map-land: #12161d;
    --map-water: #2e394a;
    --map-park: #212530;
    --map-building: #1a1e25;
    --map-road: #2a313c;
    --map-rail: rgba(255, 255, 255, 0.24);
    --map-label: #9ba4b2;
    --map-label-halo: #12161d;
    --map-area: rgba(143, 181, 234, 0.08);
    color-scheme: dark;
  }
}

/* ---- 土台 ---- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
h1,
h2,
h3 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}
p {
  margin: 0;
}
[hidden] {
  display: none !important;
}
.small {
  font-size: 12px;
  color: var(--meta);
}
.muted {
  color: var(--meta);
}
/* 等幅は ID にだけ使う */
.id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--meta);
}
.logo {
  width: 20px;
  height: 20px;
  display: block;
  filter: var(--logo-filter);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
/* アイコン(Ionicons。static/icons.svg)。文字に添えるだけで、色は隣の文字に従う。
   文字 13px の横は 16px、メニューは 18px、チップと小さいボタンは 14px、空のときは 32px */
.ic {
  width: 16px;
  height: 16px;
  flex: none;
  display: inline-block;
  vertical-align: -3px;
  fill: currentColor;
}
.ic.xl {
  width: 32px;
  height: 32px;
  color: var(--meta);
}
/* アイコンと文字を並べる。間は 6px */
.it {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

/* ---- 画面の枠: サイドバー + 作業領域 ---- */

.app {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  height: 100%;
  background: var(--surface);
}
.side {
  background: var(--side);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
}
.side .brand {
  padding: 20px 20px 16px;
}
.menu {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 4px 12px;
}
.menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--r);
  color: var(--fg);
  text-decoration: none;
}
.menu a:hover {
  background: var(--hover);
}
.menu a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.menu .ml {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
/* 選んでいない項目のアイコンは補助文字の色にして、名前より目立たせない */
.menu .ic {
  width: 18px;
  height: 18px;
  color: var(--meta);
}
.menu a[aria-current="page"] .ic {
  color: var(--accent);
}
/* サイドバーの件数(いまは通報だけ)。18時間を超えた通報があれば警告色で塗る */
.badge {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  background: var(--chip);
  color: var(--fg);
}
.badge.warn {
  background: var(--warn);
  color: var(--on-warn);
}
/* 通報のほかの件数(非表示・フィードバック)はチップにせず、補助文字の色の数字で添える */
.count {
  font-size: 12px;
  font-weight: 400;
  color: var(--meta);
}
.menu a[aria-current="page"] .count {
  color: var(--accent);
}
/* まとまりは余白で分ける(線は引かない) */
.menu .gap {
  height: 20px;
}
.me {
  padding: 16px 20px 20px;
  font-size: 12px;
  color: var(--meta);
  display: grid;
  gap: 2px;
  justify-items: start;
}
.me b {
  color: var(--fg);
  font-weight: 600;
}
.me [data-expired] {
  color: var(--warn);
  font-weight: 600;
}
.main {
  min-width: 0;
  min-height: 0;
  display: grid;
}

/* ---- 一覧系の画面の頭と中身 ---- */

.sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}
.sheethead {
  padding: 22px 32px 8px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.sheetbody {
  overflow: auto;
  min-height: 0;
  padding: 8px 32px 32px;
}
/* 空のときは、その場所に1行の文を左寄せで置く。アイコンは置かない */
.empty {
  padding: 16px 0;
  color: var(--meta);
}

/* ---- 部品 ---- */

.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 3px 12px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.6;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--fg);
  text-decoration: none;
}
.btn:hover {
  background: var(--btn-hover);
}
.btn.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
/* 警告色のボタンは確認の段階でだけ出す */
.btn.danger {
  background: var(--warn);
  color: var(--on-warn);
  border-color: var(--warn);
  font-weight: 600;
}
.btn.danger:hover {
  background: var(--warn-hover);
  border-color: var(--warn-hover);
}
.btn.small {
  padding: 1px 8px;
  font-size: 12px;
}
/* 文字だけのボタン(サイドバーのログアウト) */
.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--meta);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link:hover {
  color: var(--fg);
}
kbd {
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  border: 1px solid currentColor;
  border-radius: var(--r);
  padding: 0 4px;
  min-width: 1.7em;
  text-align: center;
  display: inline-block;
}
.btn kbd {
  opacity: 0.75;
}
/* チップは状態と種類にだけ使う(期限の段・サイドバーの通報件数・操作ログの操作・
   ID検索の結果の種類)。通報理由と件数には使わない */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
  background: var(--chip);
  color: var(--fg);
}
.chip.warn {
  background: var(--warn-chip);
  color: var(--warn);
  font-weight: 600;
}
.chip.danger {
  background: var(--warn);
  color: var(--on-warn);
  font-weight: 600;
}
.chip {
  gap: 4px;
}
.chip .ic,
.btn.small .ic {
  width: 14px;
  height: 14px;
}
.chip > .ic:first-child,
.btn > .ic:first-child {
  margin-left: -2px;
}

/* ---- 通報(docs/admin.md §2.1): 一覧 + 詳細 ---- */

.reports,
.users {
  display: grid;
  min-height: 0;
}
.inbox {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 0;
}
.queue {
  background: var(--pane);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-height: 0;
}
.queuehead {
  padding: 20px 20px 12px;
  display: grid;
  gap: 4px;
}
.queuetitle {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.summary {
  font-size: 12px;
  color: var(--meta);
}
.summary b {
  color: var(--fg);
  font-weight: 600;
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  overflow: auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 2px;
}
.row {
  display: grid;
  gap: 4px;
  padding: 12px 12px 13px;
  border-radius: var(--r);
  color: var(--fg);
  text-decoration: none;
}
.row:hover {
  background: var(--hover);
}
.row[aria-current="true"] {
  background: var(--accent-soft);
}
.rowtop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--meta);
}
.agewrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.age {
  color: var(--fg);
}
.age[data-urgency="normal"] {
  color: var(--meta);
}
/* 期限の段のチップ: 注意は灰、急ぎは淡い警告色、超過は警告色で塗る */
.chip[data-urgency] {
  font-weight: 600;
}
.chip[data-urgency="urgent"] {
  background: var(--warn-chip);
  color: var(--warn);
}
.chip[data-urgency="overdue"] {
  background: var(--warn);
  color: var(--on-warn);
}
.words {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.why {
  font-size: 12px;
  color: var(--meta);
}
.more {
  padding: 12px 20px 0;
}
/* キーの印はボタンに付けず、一覧の下の1行にまとめる */
.keys {
  padding: 12px 20px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.keys kbd {
  color: var(--fg);
}

.cases {
  display: grid;
  min-width: 0;
  min-height: 0;
}
.case {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
}
.casehead {
  padding: 22px 32px 6px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.casetitle {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.deadline {
  white-space: nowrap;
  color: var(--meta);
}
.deadline[data-urgency="attention"] {
  color: var(--fg);
}
.deadline[data-urgency="urgent"] {
  color: var(--warn);
}
.deadline[data-urgency="overdue"] {
  color: var(--warn);
  font-weight: 600;
}
.casebody {
  overflow: auto;
  min-height: 0;
  padding: 16px 32px 24px;
  display: grid;
  align-content: start;
  gap: 28px;
}
.block {
  display: grid;
  gap: 10px;
}
.block > .label {
  font-size: 12px;
  font-weight: 400;
  color: var(--meta);
}
.thread {
  display: grid;
  gap: 8px;
}
/* ユーザーの文は一段大きく、引用の地に置いて管理画面の文字と混ぜない。
   通報対象だけ地を警告の淡い色にする */
.say {
  background: var(--quote);
  border-radius: var(--r);
  padding: 14px 18px 16px;
  display: grid;
  gap: 6px;
}
.say.target {
  background: var(--warn-soft);
}
.by {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--meta);
}
.nick {
  color: var(--fg);
  font-weight: 600;
}
.nick.muted {
  color: var(--meta);
  font-weight: 400;
}
.say.target .role {
  color: var(--warn);
  font-weight: 600;
}
.text {
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* しるし。円で切る(アプリと同じ形) */
.av {
  width: 16px;
  height: 16px;
  flex: none;
  display: block;
  border-radius: 50%;
}
.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}
.shot {
  display: block;
  width: auto;
  height: auto;
  max-width: 240px;
  max-height: 240px;
  border-radius: var(--r);
}
.props {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 32px;
  margin: 0;
}
.props dt {
  color: var(--meta);
}
.props dd {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.casefoot {
  padding: 16px 32px 24px;
  display: grid;
  gap: 8px;
}
/* 確認のあいだは地を沈めて、いま答えを待っていると分かるようにする */
.casefoot.asking {
  background: var(--side);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.actions form {
  display: contents;
}
.confirm {
  display: grid;
  gap: 8px;
}
.confirm .q {
  font-weight: 600;
}

.emptystate {
  padding: 24px 32px;
  display: grid;
  gap: 12px;
  align-content: start;
  justify-items: start;
}

/* ---- 非表示(docs/admin.md §2.2): 表 ---- */

/* 表は線を引かない。行は上下12pxの余白で分ける */
.tbl {
  width: 100%;
  border-collapse: collapse;
}
.tbl th {
  text-align: left;
  font-weight: 400;
  font-size: 12px;
  color: var(--meta);
  padding: 8px 24px 8px 0;
  white-space: nowrap;
}
.tbl td {
  padding: 12px 24px 12px 0;
  vertical-align: top;
}
.tbl th:last-child,
.tbl td:last-child {
  padding-right: 0;
}
/* 折らない欄。通報理由は理由ごとにこれで包み、理由の途中では折らない */
.tbl .nw,
.tbl .act {
  white-space: nowrap;
}
/* 操作の列は右に寄せる。幅は見出しの .sizer が、1度押したあとの長い文で取っておく */
.tbl .act {
  text-align: right;
}
.tbl .sizer {
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
}
.tbl form {
  display: inline;
}
.sub {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--meta);
  white-space: nowrap;
}
.celltext {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pager {
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pager > span {
  margin-right: 4px;
}

/* ---- フィードバック(docs/admin.md §2.3): 送り主ごとの束 ---- */

/* 束は線で区切らず、余白で分ける。本文は通報と同じ引用の地(.say)に置く */
.letters {
  display: grid;
  gap: 32px;
  max-width: 760px;
  padding-top: 12px;
}
.sender {
  display: grid;
  gap: 10px;
}
.sender .say {
  gap: 10px;
}
.letter {
  display: grid;
}
.sheetbody .more {
  padding: 24px 0 0;
}

/* ---- ID検索(docs/admin.md §2.5): 検索欄と、見つかった1件 ---- */

.lookup {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  max-width: 720px;
}
.field {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* 入れるのは ID だけなので、等幅で書く */
.input {
  flex: 1;
  min-width: 0;
  appearance: none;
  padding: 3px 10px;
  line-height: 1.6;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--field);
  font-family: var(--font-mono);
  font-size: 13px;
}
.lookup .empty {
  padding: 12px 0 0;
}
.result {
  display: grid;
  gap: 12px;
  padding-top: 24px;
}
.resulthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
/* 返信のスレッドでは、引いた返信を選択中の地にして前後と分ける(警告色は通報対象だけ) */
.say.found {
  background: var(--accent-soft);
}
.say.found .role {
  color: var(--accent);
  font-weight: 600;
}
/* ID を押すと ID検索で開く(操作ログの対象) */
a.id {
  color: var(--accent);
}
.foundfoot {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}
/* 確認のあいだは地を沈める(通報の詳細の足元と同じ) */
.foundfoot.asking {
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--side);
}

/* ---- ユーザー検索(docs/admin.md §2.7): 探した結果 + 選んだ人。並べ方は通報と同じ ---- */

.users .field {
  padding-top: 8px;
}
/* ニックネームとメールアドレスも入れるので、等幅にしない */
.input.sans {
  font-family: var(--font-sans);
}
.users .summary {
  padding-top: 4px;
}
.users .queue > .empty {
  padding: 4px 20px;
}
.who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.who .nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail {
  overflow-wrap: anywhere;
}
.usertitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.users .casehead {
  display: grid;
  gap: 2px;
}
.users .casehead > .mail {
  color: var(--meta);
}
.states {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* 浮いて出るのはトーストだけ(影もここだけ)。詳細の操作のボタンは左下に並ぶので、
   重ならないよう右下に出す */
.toast {
  position: fixed;
  right: 32px;
  bottom: 24px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 8px 10px 8px 16px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--surface);
  box-shadow: var(--toast-shadow);
}
.toast[data-plain] {
  padding-right: 16px;
}
.tbtn {
  border: 1px solid currentColor;
  border-radius: var(--r);
  background: none;
  color: inherit;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  gap: 4px;
}
.tbtn .ic {
  width: 14px;
  height: 14px;
}

/* ---- 入場の前の画面(ログイン・権限なし) ---- */

.gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.gate-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 32px;
  width: min(100%, 400px);
  display: grid;
  gap: 16px;
  justify-items: start;
}
.gate-card h1 {
  font-size: 15px;
}
.gate-card form {
  display: contents;
}
.notice {
  color: var(--warn);
}
.gsi {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--gsi-line);
  border-radius: var(--r);
  background: var(--gsi-bg);
  color: var(--gsi-fg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.gsi svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ---- 周辺検索(docs/admin.md §2.6): 条件・地図・一覧 ----
   左に地図、右に一覧(スレッドを開くと一覧の場所に出る)。一覧だけが中で流れ、地図は動かない。
   点と一覧の番号は状態を色だけでなく形でも分ける: 通報ありは警告色の塗り、非表示は白抜き、
   選んでいるものは外側にアクセント色の輪 */
.near .nearbody {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.nearnotice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--r);
  background: var(--side);
  font-size: 12px;
}
.nearnotice > .ic {
  margin-top: 2px;
}
.neargeo {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
}
.nearfield {
  display: grid;
  gap: 4px;
}
.nearfield > .label {
  font-size: 12px;
  color: var(--meta);
}
.neargeo .input {
  flex: none;
  width: 200px;
}
/* 期間は選ぶ欄。矢印はブラウザのものを使う(CSP で data: の画像は描けない) */
.neargeo select.input {
  appearance: auto;
  width: auto;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 3px;
  cursor: pointer;
}
.check input {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}
.neargeo > .btn {
  margin-bottom: 1px;
}
/* 切り替え(半径・並べ順)。選んでいるものを明るい地とアクセント色で示す */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r);
  background: var(--side);
}
.seg label {
  position: relative;
  display: inline-flex;
}
.seg input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.seg label > span,
.seg button {
  padding: 1px 10px;
  line-height: 1.6;
  border: 0;
  border-radius: calc(var(--r) - 1px);
  background: none;
  color: var(--meta);
  cursor: pointer;
}
.seg input:checked + span,
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  font-weight: 600;
}
.seg input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
/* 地図は 460px まで。狭いときは一覧に 300px を残して地図のほうを縮める */
.nearsplit {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 460px) minmax(300px, 1fr);
  gap: 32px;
}
.nearmapcol {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}
.nearmap {
  height: clamp(280px, calc(100vh - 320px), 560px);
  border-radius: var(--r);
  background: var(--map-land);
  overflow: hidden;
}
.nearmap > noscript > p,
.nearmap.failed {
  padding: 16px;
  color: var(--meta);
}
.nearside {
  display: grid;
  min-width: 0;
  min-height: 0;
}
.nearresults {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}
.nearresultshead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.nearresultshead h2 {
  font-weight: 400;
  line-height: inherit;
}
/* 一覧の行。選ぶのは行のボタンで、選んだ行にだけ「スレッドを開く」「通報を開く」を出す
   (JS が無ければ全部の行に出す) */
.nearrows {
  padding: 0;
}
.nearrows > li {
  border-radius: var(--r);
}
.nearrows > li:hover {
  background: var(--hover);
}
.nearrows > li[data-selected] {
  background: var(--accent-soft);
}
.nearrows .row {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.nearrows .row:hover,
.nearrows .row[aria-current="true"] {
  background: none;
}
.nearrows .rowtop {
  flex-wrap: wrap;
}
.nearkind {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
}
.nearkind > span {
  white-space: nowrap;
}
.words.oneline {
  -webkit-line-clamp: 1;
}
.nearwhy {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}
.rowacts {
  padding: 0 12px 12px;
}
[data-near][data-ready] .nearrows > li:not([data-selected]) > .rowacts {
  display: none;
}
/* 番号の印(一覧と地図の点で同じ形) */
.pin {
  width: 18px;
  height: 18px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  background: var(--fg);
  color: var(--surface);
}
.pin.hot {
  background: var(--warn);
  color: var(--on-warn);
}
.pin.off {
  background: var(--surface);
  color: var(--meta);
  box-shadow: inset 0 0 0 1.5px var(--meta);
}
.pin.off.hot {
  color: var(--warn);
  box-shadow: inset 0 0 0 1.5px var(--warn);
}
.mappin {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  font-family: var(--font-sans);
  cursor: pointer;
}
.mappin.sel {
  z-index: 2;
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}
/* 中心の印(十字)。押せないので、下の地図を押せるようにする */
.mapcenter {
  width: 28px;
  height: 28px;
  pointer-events: none;
  background:
    linear-gradient(var(--accent), var(--accent)) center / 1.5px 100% no-repeat,
    linear-gradient(var(--accent), var(--accent)) center / 100% 1.5px no-repeat;
}
.mapcenter::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--accent);
}
/* 地図のクリックは中心を動かす */
.nearmap .maplibregl-canvas-container.maplibregl-interactive {
  cursor: crosshair;
}
.nearmap .maplibregl-canvas-container.maplibregl-interactive:active {
  cursor: grabbing;
}
.nearmap .maplibregl-ctrl-scale {
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border-color: var(--fg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 11px;
}
/* 開いたスレッド(一覧の場所か、スレッドだけの画面) */
.nearthreadpane {
  min-height: 0;
  overflow: auto;
}
.nearthread {
  display: grid;
  gap: 12px;
  align-content: start;
}
.nearthread:focus {
  outline: none;
}
.threadhead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.sayreports {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--meta);
}
.nearthread .foundfoot {
  padding-top: 0;
}
.nearpage {
  max-width: 760px;
  padding-top: 12px;
}

/* ---- 狭い幅(並べ方はまだ決めていない。admin.md §6。試作の並べ方を仮に置く) ---- */

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .side {
    grid-template-rows: auto;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .side .brand {
    display: none;
  }
  .menu {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 8px;
  }
  .menu .gap {
    display: none;
  }
  .menu a {
    white-space: nowrap;
  }
  .me {
    padding: 8px 16px;
  }
  .me b {
    display: none;
  }
  .sheethead,
  .sheetbody {
    padding-inline: 16px;
  }
  /* 周辺検索は地図を上に、一覧を下に積む(画面ごと流す) */
  .near .nearbody {
    overflow: auto;
  }
  .nearsplit {
    grid-template-columns: minmax(0, 1fr);
  }
  .nearmap {
    height: 320px;
  }
  /* 通報は一覧を上に、詳細を下に積む */
  .inbox {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 40%) minmax(0, 1fr);
  }
  .casehead,
  .casebody,
  .casefoot,
  .emptystate {
    padding-inline: 16px;
  }
  .toast {
    right: 16px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .btn,
  .menu a,
  .row {
    transition: background-color 0.12s ease;
  }
}
