/* notam.ezoe.net。地図アプリなので明るい配色が基本、パネル類は暗い設定にも合わせる。 */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #1b2430; --ink2: #5a6676; --line: #dde3ea; --accent: #1d3b6a; --accent2: #2a6fdb;
  --act: #d33a2c; --fut: #2a6fdb; --win: #e08a00; --old: #8a94a3; --ok: #1e8e3e; --warn-bg: #fff4d6; --warn-ink: #7a4d00; --bad-bg: #fde8e6; --bad-ink: #9b2116;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Noto Sans Mono CJK JP", monospace;
  --hdr: 46px; --panel-w: 420px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #12161c; --panel: #1b2129; --ink: #e6ebf1; --ink2: #9aa6b4; --line: #2c3540; --warn-bg: #3a2f12; --warn-ink: #ffd27a; --bad-bg: #3d1b18; --bad-ink: #ffb4ab; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; font-size: 14px; }
body { display: flex; flex-direction: column; position: fixed; inset: 0; overflow: hidden; }
button { font: inherit; cursor: pointer; }

#hdr { height: var(--hdr); flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px; background: var(--accent); color: #fff; }
.brand { white-space: nowrap; font-weight: 700; letter-spacing: .02em; }
.brand-main { font-size: 17px; }
.brand-sub { font-size: 12px; opacity: .85; margin-left: 2px; }
.tools { display: flex; gap: 4px; overflow-x: auto; }
.tools button { display: flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; background: rgba(255,255,255,.08); color: #fff; white-space: nowrap; }
.tools button:hover { background: rgba(255,255,255,.18); }
.tools button.on { background: #ffb020; color: #1b2430; border-color: #ffb020; }
.tools .ic { font-size: 15px; line-height: 1; }

#banner { flex: none; padding: 6px 12px; font-size: 13px; background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--line); }
#banner.ok { background: #e8f3ec; color: #1e5a33; }
#banner.bad { background: var(--bad-bg); color: var(--bad-ink); }
#banner:empty { display: none; }
#banner .sub { opacity: .85; }
@media (prefers-color-scheme: dark) { #banner.ok { background: #16301f; color: #a8e0b8; } }

#main { flex: 1; min-height: 0; display: flex; }
#panel { width: var(--panel-w); flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
#map { flex: 1; min-width: 0; position: relative; }
#cond { flex: none; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink2); }
#cond:empty { display: none; }
#cond .clr { margin-left: 6px; font-size: 12px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--ink); }
#cond b { color: var(--ink); }
#jumpbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
#jump { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
#count { font-size: 12px; color: var(--ink2); white-space: nowrap; }
#list { flex: 1; overflow-y: auto; overscroll-behavior: contain; outline: none; }

.grp-h { position: sticky; top: 0; z-index: 2; padding: 5px 10px; background: color-mix(in srgb, var(--panel) 85%, var(--line)); border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.grp-h .n { color: var(--ink2); font-weight: 400; }
.sec-h { padding: 6px 10px; background: var(--bg); border-bottom: 1px solid var(--line); font-weight: 700; font-size: 13px; color: var(--accent2); cursor: default; }
.sec-h.fold { cursor: pointer; }
.item { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:hover { background: color-mix(in srgb, var(--panel) 92%, var(--accent2)); }
.item.sel { background: color-mix(in srgb, var(--panel) 82%, #ffb020); box-shadow: inset 4px 0 0 #ffb020; }
.item .h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.item .key { font-weight: 700; font-family: var(--mono); }
.badge { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; line-height: 18px; border: 1px solid transparent; white-space: nowrap; }
.b-map { background: var(--accent2); color: #fff; }
.b-nomap { border-color: var(--line); color: var(--ink2); }
.b-type { border-color: var(--line); }
.b-new { background: #ffb020; color: #1b2430; font-weight: 700; }
.st-active { background: var(--act); color: #fff; }
.st-future { background: var(--fut); color: #fff; }
.st-window, .st-est { background: var(--win); color: #fff; }
.st-old { background: var(--old); color: #fff; }
.b-src { border-color: var(--line); color: var(--ink2); }
.b-cat { background: color-mix(in srgb, var(--panel) 80%, var(--accent2)); color: var(--ink); }
.item .qja { margin-top: 3px; font-size: 13px; color: var(--accent2); font-weight: 600; }
.item .per { margin-top: 2px; font-size: 12.5px; }
.item .per .utc { color: var(--ink2); font-family: var(--mono); font-size: 11.5px; }
.item .alt, .item .sch, .item .gl { margin-top: 1px; font-size: 12.5px; color: var(--ink2); }
.item .gl { color: var(--ink); }
.item pre { margin: 6px 0 0; padding: 6px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; white-space: pre-wrap; word-break: break-word; font: 12px/1.45 var(--mono); }
.item .ft { margin-top: 4px; font-size: 11.5px; color: var(--ink2); }
.empty { padding: 30px 16px; text-align: center; color: var(--ink2); }
.more { padding: 10px; text-align: center; color: var(--ink2); font-size: 12px; }
abbr.ab { text-decoration: underline dotted; cursor: help; }

#mobileTabs { display: none; }
#ftr { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 4px 10px; font-size: 11.5px; color: var(--ink2); background: var(--panel); border-top: 1px solid var(--line); }
#ftr a { color: var(--accent2); }
#ftr .upd { margin-left: auto; }

/* 地図のポップアップ */
.maplibregl-popup-content { padding: 0; border-radius: 8px; overflow: hidden; max-width: min(360px, 86vw); font-size: 13px; color: #1b2430; }
.pp-h { background: var(--accent); color: #fff; padding: 6px 28px 6px 10px; font-weight: 700; font-family: var(--mono); }
.pp-b { padding: 8px 10px; max-height: 46vh; overflow-y: auto; }
.pp-e { font-weight: 700; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; }
.pp-r { margin-top: 5px; font-size: 12.5px; }
.pp-r .k { color: #5a6676; }
.pp-a { display: inline-block; margin-top: 6px; color: var(--accent2); cursor: pointer; text-decoration: underline; }
.pp-list { list-style: none; margin: 0; padding: 0; }
.pp-list li { padding: 5px 10px; border-bottom: 1px solid #e4e8ee; cursor: pointer; }
.pp-list li:hover { background: #eef3fb; }
.maplibregl-popup-close-button { color: #fff; font-size: 18px; padding: 2px 8px; }

/* 地図の左下: 凡例と描画の注意 */
.legend { position: absolute; left: 8px; bottom: 26px; z-index: 2; background: rgba(255,255,255,.92); color: #1b2430; border-radius: 8px; padding: 6px 8px; font-size: 11.5px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.legend i { display: inline-block; width: 12px; height: 10px; margin: 0 4px 0 8px; border-radius: 2px; vertical-align: -1px; }
.legend i:first-child { margin-left: 0; }
.legend .dash { background: transparent !important; border: 2px dashed #666; height: 10px; }
.basemap { position: absolute; right: 8px; top: 8px; z-index: 2; display: flex; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.basemap button { border: 0; padding: 5px 10px; background: rgba(255,255,255,.95); color: #1b2430; font-size: 12px; }
.basemap button.on { background: var(--accent); color: #fff; }
.overlays { position: absolute; right: 8px; top: 44px; z-index: 2; background: rgba(255,255,255,.95); color: #1b2430; border-radius: 8px; padding: 6px 8px; font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.overlays summary { cursor: pointer; }
.overlays label { display: block; margin-top: 3px; white-space: nowrap; }
.ctxmenu { position: absolute; z-index: 5; background: #fff; color: #1b2430; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.3); padding: 4px 0; font-size: 13px; }
.ctxmenu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 14px; }
.ctxmenu button:hover { background: #eef3fb; }

/* ダイアログ */
.dlg { border: 0; border-radius: 12px; padding: 0; width: min(560px, 94vw); max-height: 88vh; background: var(--panel); color: var(--ink); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.dlg-wide { width: min(860px, 96vw); height: 88vh; }
.dlg::backdrop { background: rgba(0,0,0,.4); }
.dlg-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; max-height: 88vh; overflow-y: auto; }
.dlg-wide .dlg-body { height: 100%; overflow: hidden; }
.dlg h2 { margin: 0 0 4px; font-size: 17px; }
.dlg label { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.dlg label.chk, .dlg .row label, .dlg .cats label { flex-direction: row; align-items: center; gap: 5px; }
.dlg input[type=text], .dlg input:not([type]), .dlg input[type=number], .dlg input[type=date], .dlg input[type=time], .dlg select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); }
.dlg input[type=number] { width: 90px; }
.dlg .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.dlg .row .lbl { min-width: 64px; font-size: 13px; color: var(--ink2); }
.dlg .center { margin-left: auto; flex-direction: row; align-items: center; }
.dlg fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.dlg legend { font-size: 13px; color: var(--ink2); padding: 0 4px; }
.dlg .jst { font-size: 12px; color: var(--ink2); }
.hint { margin: 0; font-size: 12px; color: var(--ink2); }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 6px; position: sticky; bottom: -14px; background: var(--panel); padding: 8px 0 4px; }
.actions button, .dlg .row > button { padding: 6px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.actions .primary { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.actions .ver { margin-right: auto; font-size: 12px; color: var(--ink2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--line); padding: 5px 10px; background: var(--panel); color: var(--ink); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent2); color: #fff; }
#pkGroups { display: flex; flex-direction: column; gap: 6px; }
.pk-g { border: 1px solid var(--line); border-radius: 8px; }
.pk-g summary { padding: 6px 10px; cursor: pointer; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; list-style: none; }
.pk-g summary::-webkit-details-marker { display: none; }
.pk-g summary > span:first-child::before { content: "▸ "; color: var(--ink2); }
.pk-g[open] summary > span:first-child::before { content: "▾ "; }
.pk-g .nsel { margin-left: 4px; font-size: 11.5px; font-weight: 400; color: var(--accent2); }
.pk-g summary .gtools button { font-size: 11px; padding: 0 6px; margin-left: 4px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--ink2); }
.pk-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 10px; padding: 4px 10px 8px; }
.pk-items label { flex-direction: row; align-items: center; gap: 5px; font-size: 12.5px; }
.pk-items .code { font-family: var(--mono); font-weight: 700; }
.pk-items .cnt { color: var(--ink2); font-size: 11.5px; }
.pk-items .zero { opacity: .55; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 3px 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 13px; }
.tabs button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
#helpFrame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* スマホ: 下からのシート+リスト/地図の切り替え */
@media (max-width: 760px) {
  :root { --hdr: 44px; }
  .tools .lb { display: none; }
  .tools button { padding: 0 9px; }
  .brand-sub { display: none; }
  #main { flex-direction: column; }
  #panel { width: 100%; border-right: 0; order: 2; height: 46%; border-top: 1px solid var(--line); }
  #map { order: 1; }
  body.v-list #map { display: none; }
  body.v-list #panel { height: 100%; }
  body.v-map #panel { display: none; }
  #mobileTabs { display: flex; flex: none; border-top: 1px solid var(--line); background: var(--panel); }
  #mobileTabs button { flex: 1; border: 0; padding: 8px; background: transparent; color: var(--ink); font-weight: 700; }
  #mobileTabs button.on { color: var(--accent2); box-shadow: inset 0 -3px 0 var(--accent2); }
  #ftr { font-size: 10.5px; }
  #ftr .upd { display: none; }
  .legend { bottom: 22px; font-size: 10.5px; }
  body:not(.v-map) .legend { display: none; }
  #banner { font-size: 12px; padding: 4px 10px; }
  #banner .sub { display: none; }
}
@media print {
  #hdr .tools, #mobileTabs, .basemap, .overlays, .legend, #jumpbar { display: none !important; }
}
