/* =====================================================
   出雲観光交通モニター  スタイル
   白・ライトグレー・落ち着いたネイビー。混雑の色は4色だけ（満車/混雑/空き/情報なし）
   ===================================================== */
:root {
  --navy: #16283f; --navy2: #20364f; --ink: #1b2a3c; --sub: #5a6a7d; --mute: #8593a3;
  --bg: #eef1f5; --card: #fff; --line: #dde3ea; --line2: #eaeef3;
  --full: #c4393f; --busy: #d1841a; --free: #2a8a58; --none: #8a97a6;
  --full-bg: #fbe8e9; --busy-bg: #fcf0dc; --free-bg: #e2f2e9; --none-bg: #eceff3;
  --ai: #14b8a6; --ai-dk: #0b7f73; --blue: #3a6ea5;
  --r: 12px; --shadow: 0 2px 10px rgba(20, 40, 65, .12);
  --hdr: 56px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', 'メイリオ', sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.55; overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- ヘッダー ---------- */
.hdr { height: var(--hdr); background: var(--navy); color: #fff; display: flex; align-items: center; padding: 0 22px; gap: 28px; position: relative; z-index: 1200; }
.brand { font-size: 20px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.tabs { display: flex; gap: 6px; flex: 1; justify-content: center; margin-left: -120px; }
.tabs button { padding: 9px 24px; border-radius: 10px; font-weight: 700; font-size: 15px; color: #c5d1e0; transition: background .15s; }
.tabs button:hover { background: rgba(255, 255, 255, .1); }
.tabs button.on { background: #fff; color: var(--navy); }
.hdr-r { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.demo { color: #b9c6d6; font-size: 14px; }
.hbtn { color: #fff; font-weight: 700; font-size: 15px; padding: 7px 10px; border-radius: 8px; }
.hbtn:hover { background: rgba(255, 255, 255, .12); }

main { height: calc(100% - var(--hdr)); }
.view { display: none; height: 100%; }
.view.on { display: flex; }

/* ---------- 交通モニター：地図 70% ＋ モニター 30% ---------- */
.mapwrap { flex: 7 1 0; min-width: 0; position: relative; }
#map { position: absolute; inset: 0; background: #eef1f5; }
.side { flex: 3 1 0; min-width: 390px; max-width: 520px; background: #f3f5f8; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#sideBody { flex: 1; overflow-y: auto; padding: 14px 16px 4px; }
.side-foot { padding: 7px 18px 8px; font-size: 11px; color: var(--sub); border-top: 1px solid var(--line); background: #eef1f5; line-height: 1.5; }

.ovl { position: absolute; z-index: 800; background: rgba(255, 255, 255, .96); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }

.wx { left: 14px; bottom: 14px; padding: 9px 16px; display: flex; align-items: center; gap: 14px; }
.wx small { display: block; color: var(--sub); font-size: 12px; }
.wx b { font-size: 22px; font-weight: 800; }
.wx .loc { color: var(--sub); font-size: 13px; }

.timebar { left: 50%; transform: translateX(-50%); bottom: 14px; width: min(560px, calc(100% - 330px)); min-width: 360px; padding: 9px 16px 6px; display: flex; align-items: center; gap: 12px; }
.timebar .play { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; flex: none; }
.timebar .play:hover { background: var(--navy2); }
.timebar .slw { flex: 1; position: relative; }
.timebar input[type=range] { width: 100%; accent-color: var(--navy); margin: 4px 0 0; }
.timebar .ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); padding: 0 6px; }
.timebar .tnow { font-size: 20px; font-weight: 800; min-width: 58px; text-align: right; }

.mapctl { right: 12px; top: 12px; display: flex; flex-direction: column; overflow: hidden; }
.mapctl button { width: 40px; height: 40px; font-size: 20px; font-weight: 700; color: var(--navy); border-bottom: 1px solid var(--line2); }
.mapctl button:last-child { border-bottom: 0; }
.mapctl button:hover { background: #f0f3f7; }
.mapctl button svg { width: 20px; height: 20px; }
.osm-pale { filter: grayscale(1) contrast(.72) brightness(1.2); opacity: .8; }
.leaflet-control-attribution { font-size: 10px !important; background: rgba(255, 255, 255, .7) !important; }
.leaflet-bottom.leaflet-right { margin-bottom: 0; }

/* 地図のピン */
.place { white-space: nowrap; font-size: 15px; font-weight: 800; color: #5c6b60; letter-spacing: .06em; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 5px #fff; pointer-events: none; transform: translate(-50%, -50%); }
.rline-lbl { font-size: 11.5px; font-weight: 700; color: #fff; background: var(--navy); border-radius: 9px; padding: 1px 8px; white-space: nowrap; transform: translate(-50%, -50%); }
.leaflet-tooltip.tip { background: var(--navy); color: #fff; border: 0; font-weight: 700; font-size: 13px; border-radius: 8px; padding: 5px 10px; box-shadow: var(--shadow); }
.leaflet-tooltip.tip::before { display: none; }

/* ---------- 右のモニター ---------- */
.side h2 { font-size: 20px; font-weight: 800; letter-spacing: .02em; margin: 0 2px 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; margin-bottom: 11px; box-shadow: 0 1px 3px rgba(20, 40, 65, .05); position: relative; }
.card.hl { box-shadow: 0 0 0 2.5px var(--ai); }
.media { position: relative; overflow: hidden; border-radius: 8px; background: #8f98a3; aspect-ratio: var(--iar, 16 / 9) !important; cursor: zoom-in; }
.media .fit { position: absolute; left: 0; top: calc(var(--fy, .5) * 100%); width: 100%; transform: translateY(calc(var(--fy, .5) * -100%)); aspect-ratio: var(--iar, 16 / 9); }
.media img { width: 100%; height: 100%; display: block; object-fit: cover; }
.media svg.boxes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.media svg.boxes rect { fill: rgba(94, 230, 208, .10); stroke: #5ee6d0; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 10px; line-height: 1.5; white-space: nowrap; }
.chip.ai { background: #d7f5f0; color: var(--ai-dk); }
.chip.plan { background: #e6ecf5; color: #3a5a86; }
.chip.real { background: #e4f3ea; color: #1f6e46; }
.chip.demo { background: #fdf0d6; color: #8a5a0a; }
.chip.hand { background: #eceff3; color: #51606f; }
.media .tl { position: absolute; left: 8px; top: 8px; display: flex; gap: 5px; flex-wrap: wrap; z-index: 2; }
.media .tl .chip { background: rgba(255, 255, 255, .93); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.media .br { position: absolute; right: 8px; bottom: 8px; z-index: 2; background: rgba(22, 40, 63, .8); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 8px; }
.media .zoomhint { position: absolute; right: 8px; top: 8px; z-index: 2; width: 26px; height: 26px; border-radius: 7px; background: rgba(22, 40, 63, .72); display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.media:hover .zoomhint { opacity: 1; }
.media .zoomhint svg { width: 15px; height: 15px; fill: none; stroke: #fff; stroke-width: 2; }
.cbody { padding: 7px 5px 2px; }
.cbody .row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cbody .ttl { font-size: 17px; font-weight: 800; }
.cbody .val { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cbody .val small { font-size: 15px; font-weight: 700; margin-left: 1px; }
.cbody .row2 { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--sub); margin-top: 1px; align-items: center; }
.cbody .row2 .lv { font-weight: 800; }
.cbody .acts { display: flex; gap: 16px; margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line2); }
.lnk { color: var(--blue); font-weight: 700; font-size: 13px; padding: 2px 0; }
.lnk:hover { text-decoration: underline; }
.lnk.on { color: var(--ai-dk); }
.camthumbs { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 4px; z-index: 3; cursor: default; }
.camthumbs button { flex: 1; aspect-ratio: 16 / 9; border-radius: 5px; overflow: hidden; border: 2px solid rgba(255, 255, 255, .85); opacity: .86; padding: 0; background: #555; }
.camthumbs button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.camthumbs button.on { border-color: var(--ai); opacity: 1; box-shadow: 0 0 0 1px rgba(0, 0, 0, .3); }
.camthumbs button:hover { opacity: 1; }
.camname { position: absolute; left: 8px; top: 8px; z-index: 2; background: rgba(22, 40, 63, .82); color: #fff; font-weight: 700; font-size: 12.5px; padding: 2px 10px; border-radius: 8px; }

/* 詳細 */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--blue); font-weight: 700; font-size: 14px; padding: 4px 6px 4px 0; margin-bottom: 8px; }
.back:hover { text-decoration: underline; }
.dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dhead h2 { margin: 0; font-size: 21px; }
.dhead .chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.pill { font-size: 14px; font-weight: 800; padding: 3px 14px; border-radius: 14px; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 11px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; }
.kpi small { display: block; font-size: 12px; color: var(--sub); }
.kpi b { white-space: nowrap; font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi b small { display: inline; font-size: 13px; color: inherit; }
.kpi .sub { font-size: 11.5px; color: var(--sub); }
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px; margin-bottom: 12px; }
.box h3 { font-size: 14.5px; font-weight: 800; margin-bottom: 2px; }
.box .cap { font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.callout { background: #eaf7f5; border: 1px solid #bfe9e2; border-radius: 10px; padding: 10px 13px; font-size: 13.5px; margin-bottom: 12px; }
.callout b { color: var(--ai-dk); }
.callout.neutral { background: #f0f3f7; border-color: var(--line); }
.callout.neutral b { color: var(--ink); }
.noimg { aspect-ratio: 16 / 7; border-radius: 8px; background: repeating-linear-gradient(135deg, #f3f5f8, #f3f5f8 10px, #eaeef3 10px, #eaeef3 20px); display: grid; place-items: center; text-align: center; color: var(--sub); font-size: 13px; border: 1px dashed #c3ccd7; padding: 8px; }
.noimg b { display: block; color: var(--ink); font-size: 14px; }
.lgd { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--sub); margin-top: 2px; align-items: center; }
.lgd i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; margin-right: 5px; vertical-align: middle; }
.lgd i.d { border-top-style: dashed; }
.lgd i.sq { width: 12px; height: 12px; border: 0; background: currentColor; opacity: .25; border-radius: 3px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .ax { font-size: 11px; fill: #6c7b8d; }
svg.chart .mk { font-size: 11.5px; font-weight: 800; }
.minor { font-size: 12px; color: var(--sub); }

/* ---------- 分析・レポート ---------- */
#vAnalysis { overflow-y: auto; display: none; flex-direction: column; background: var(--bg); }
#vAnalysis.on { display: block; }
.an { max-width: 1340px; margin: 0 auto; padding: 16px 24px 40px; }
.antool { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 16px; margin-bottom: 14px; }
.antool label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); font-weight: 600; }
.antool select { font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); padding: 7px 30px 7px 11px; border: 1px solid #c9d2dc; border-radius: 8px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235a6a7d' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; max-width: 330px; }
.antool .sp { flex: 1; }
.btn { font-weight: 700; font-size: 14px; padding: 8px 16px; border-radius: 9px; border: 1px solid #c3ccd7; background: #fff; color: var(--ink); }
.btn:hover { background: #f0f3f7; }
.btn.pri { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.pri:hover { background: var(--navy2); }
.btn.danger { color: var(--full); border-color: #e6b9bc; }
.btn[disabled] { opacity: .5; cursor: default; }
.menu { position: relative; }
.menu .pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 190px; z-index: 50; display: none; }
.menu.open .pop { display: block; }
.menu .pop button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 7px; font-weight: 600; font-size: 14px; }
.menu .pop button:hover { background: #f0f3f7; }
.ins { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 13px 16px; border-top: 4px solid var(--navy); }
.ins .k { font-size: 12.5px; color: var(--sub); font-weight: 600; }
.ins .v { font-size: 26px; font-weight: 800; line-height: 1.3; font-variant-numeric: tabular-nums; }
.ins .v small { font-size: 14px; font-weight: 700; margin-left: 2px; }
.ins .d { font-size: 13px; color: #34475d; margin-top: 2px; line-height: 1.5; }
.ins.c1 { border-top-color: var(--full); } .ins.c2 { border-top-color: var(--busy); } .ins.c3 { border-top-color: var(--ai); } .ins.c4 { border-top-color: var(--blue); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.pan { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 12px; margin-bottom: 14px; min-width: 0; }
.grid2 .pan { margin-bottom: 0; }
.pan h3 { font-size: 16px; font-weight: 800; }
.pan .sub { font-size: 12.5px; color: var(--sub); margin: 1px 0 6px; }
.pan .note { font-size: 12px; color: var(--sub); margin-top: 6px; line-height: 1.6; }
.pan .note.warn { color: #8a5a0a; background: #fdf4e1; border-radius: 8px; padding: 6px 10px; }
.hero { border-left: 5px solid var(--ai); }
.hero .grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; align-items: center; }
.story { font-size: 13.5px; line-height: 1.7; }
.story .row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line2); }
.story .row:last-child { border-bottom: 0; }
.story .tag { flex: none; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 10px; margin-top: 1px; }
.story .tag.h { background: #eceff3; color: #51606f; } .story .tag.a { background: #d7f5f0; color: var(--ai-dk); }
.use { background: #f4f7fb; border: 1px solid #d8e2ef; border-radius: var(--r); padding: 13px 18px; margin-bottom: 14px; font-size: 13.5px; }
.use b { color: #274a77; }
.use ul { margin: 4px 0 2px 20px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 12px; color: var(--sub); font-weight: 700; padding: 6px 8px; border-bottom: 2px solid var(--line); white-space: nowrap; }
table.t td { padding: 7px 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
table.t td.w { white-space: normal; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:last-child td { border-bottom: 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.heat { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 11.5px; }
.heat th { font-weight: 600; color: var(--sub); font-size: 11.5px; padding: 0 2px; }
.heat th.l { text-align: right; padding-right: 8px; white-space: nowrap; font-size: 12.5px; color: var(--ink); font-weight: 700; }
.heat td { text-align: center; height: 31px; border-radius: 5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.heat td.na { background: repeating-linear-gradient(135deg, #f1f3f6, #f1f3f6 4px, #e6eaef 4px, #e6eaef 8px); color: transparent; }
.heat td.f { background: var(--full); color: #fff; } .heat td.b { background: #f0b866; color: #5b3a05; } .heat td.g { background: #bfe3cf; color: #1d5a3a; }
.empty { color: var(--sub); text-align: center; padding: 26px 10px; font-size: 13.5px; background: #f6f8fa; border-radius: 10px; }

/* ---------- 管理ドロワー / ダイアログ / ライトボックス ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 28, 45, .38); z-index: 2000; display: none; }
.scrim.on { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100%); background: #fff; z-index: 2001; box-shadow: -8px 0 30px rgba(0, 0, 0, .2); transform: translateX(105%); transition: transform .22s; display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.drawer .dh { padding: 16px 20px 0; display: flex; align-items: center; justify-content: space-between; }
.drawer .dh h2 { font-size: 18px; font-weight: 800; }
.x { width: 34px; height: 34px; border-radius: 8px; font-size: 22px; color: var(--sub); line-height: 1; }
.x:hover { background: #f0f3f7; }
.dtabs { display: flex; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); }
.dtabs button { padding: 9px 12px; font-weight: 700; font-size: 13.5px; color: var(--sub); border-bottom: 3px solid transparent; }
.dtabs button.on { color: var(--navy); border-bottom-color: var(--navy); }
.dbody { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.dbody h4 { font-size: 14px; font-weight: 800; margin: 16px 0 6px; }
.dbody h4:first-child { margin-top: 0; }
.dbody p.lead { font-size: 13px; color: var(--sub); margin-bottom: 10px; line-height: 1.6; }
.frm { display: grid; gap: 10px; }
.frm label { display: grid; gap: 3px; font-size: 12.5px; font-weight: 700; color: var(--sub); }
.frm input, .frm select, .frm textarea { font: inherit; font-size: 14px; color: var(--ink); padding: 8px 10px; border: 1px solid #c3ccd7; border-radius: 8px; width: 100%; background: #fff; }
.frm .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line2); font-size: 13.5px; }
.lrow .nm { flex: 1; font-weight: 700; min-width: 0; }
.lrow .nm small { display: block; font-weight: 500; color: var(--sub); font-size: 12px; }
.lrow input[type=number] { width: 84px; text-align: right; font: inherit; padding: 6px 8px; border: 1px solid #c3ccd7; border-radius: 7px; }
.msg { font-size: 13px; margin-top: 8px; padding: 8px 11px; border-radius: 8px; }
.msg.ok { background: var(--free-bg); color: #1d5a3a; } .msg.ng { background: var(--full-bg); color: #8f2b30; }
.modal { position: fixed; inset: 0; z-index: 2100; display: none; align-items: center; justify-content: center; background: rgba(15, 28, 45, .45); padding: 20px; }
.modal.on { display: flex; }
.modal .mb { background: #fff; border-radius: 14px; width: min(460px, 100%); padding: 20px 22px; box-shadow: 0 14px 50px rgba(0, 0, 0, .3); max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 17px; font-weight: 800; margin-bottom: 12px; }
.modal .ft { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 2200; background: rgba(10, 20, 33, .9); display: none; align-items: center; justify-content: center; flex-direction: column; padding: 24px; gap: 12px; }
.lightbox.on { display: flex; }
.lightbox .lbwrap { position: relative; max-width: min(1200px, 100%); max-height: calc(100vh - 130px); aspect-ratio: var(--iar, 16 / 9); height: min(calc(100vh - 130px), calc((100vw - 48px) * 9 / 16)); }
.lightbox .lbwrap img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 8px; }
.lightbox .lbwrap svg.boxes { position: absolute; inset: 0; width: 100%; height: 100%; }
.lightbox .lbwrap svg.boxes rect { fill: rgba(94, 230, 208, .1); stroke: #5ee6d0; stroke-width: 2.4; vector-effect: non-scaling-stroke; }
.lightbox .cap { color: #dbe4ee; font-size: 14px; text-align: center; max-width: 900px; }
.lightbox .cap b { color: #fff; font-size: 17px; }
.lightbox .x { position: absolute; right: 18px; top: 14px; color: #fff; font-size: 30px; width: 44px; height: 44px; }
.lightbox .x:hover { background: rgba(255, 255, 255, .15); }
.toast { position: fixed; left: 50%; top: 70px; transform: translate(-50%, -20px); background: var(--navy); color: #fff; padding: 10px 20px; border-radius: 10px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 3000; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ng { background: var(--full); }
.drawbar { position: absolute; left: 50%; top: 74px; transform: translateX(-50%); z-index: 900; background: var(--navy); color: #fff; padding: 10px 14px 10px 20px; border-radius: 12px; box-shadow: var(--shadow); display: none; align-items: center; gap: 14px; font-weight: 700; }
.drawbar.on { display: flex; }
.drawbar .btn { padding: 5px 12px; font-size: 13px; }

/* ---------- 画面が狭いとき ---------- */
@media (max-width: 1100px) {
  .sumrow { grid-template-columns: 1fr 1fr; } .grid2 { grid-template-columns: 1fr; } .hero .grid { grid-template-columns: 1fr; }
  .tabs { margin-left: 0; } .timebar { width: calc(100% - 28px); left: 14px; transform: none; bottom: 70px; }
  .wx { bottom: 14px; }
}
@media (max-width: 820px) {
  body { overflow: auto; }
  .view.on { flex-direction: column; height: auto; }
  main { height: auto; }
  .mapwrap { flex: none; height: 70vh; }
  .side { max-width: none; min-width: 0; border-left: 0; }
  #sideBody { overflow: visible; }
  .brand { font-size: 16px; } .hdr { gap: 10px; padding: 0 12px; } .tabs button { padding: 8px 12px; font-size: 13px; }
  .demo { display: none; } .layerbar label { padding: 5px 6px; font-size: 13px; } .layerbar .when { display: none; }
  .sumrow { grid-template-columns: 1fr; }
  #vAnalysis { overflow: visible; }
}

@media print {
  .hdr, .antool, .drawer, .scrim, .toast, .modal, .lightbox { display: none !important; }
  body { overflow: visible; background: #fff; height: auto; }
  main { height: auto; } #vMonitor { display: none !important; }
  #vAnalysis { display: block !important; overflow: visible; }
  .an { max-width: none; padding: 0; } .pan, .ins, .use { break-inside: avoid; }
  .anpane { display: block !important; margin-bottom: 18px; } .antabs, .anhead .antool { display: none !important; } .resdet:not([open]) > :not(summary) { display: block; }
  .printhead { display: block !important; }
}
.printhead { display: none; margin-bottom: 10px; }
.printhead h1 { font-size: 20px; }


@media (max-height: 800px) and (min-width: 821px) {
  .side h2 { font-size: 18px; margin-bottom: 8px; }
  .cbody .ttl, .cbody .val { font-size: 16px; }
  .card { margin-bottom: 9px; }
}

.cam-card.sel { box-shadow: 0 0 0 2px var(--navy); }
.cam-card .cbody { padding-top: 6px; }

/* ---------- 地図の上の部品（控えめに） ---------- */
.maptop { top: 12px; left: 12px; display: flex; align-items: center; gap: 4px; padding: 3px 4px; font-size: 13px; box-shadow: 0 1px 4px rgba(20, 40, 65, .12); max-width: calc(100% - 80px); }
.lyr { position: relative; }
.lyrbtn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 7px; font-weight: 700; font-size: 13px; color: var(--navy); }
.lyrbtn svg { width: 16px; height: 16px; }
.lyrbtn:hover, .lyrbtn.on { background: #eaeff5; }
.lyrmenu { position: absolute; top: calc(100% + 6px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; z-index: 5; }
.lyrmenu[hidden] { display: none; }
.lyrmenu label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.lyrmenu label:hover { background: #f0f3f7; }
.lyrmenu input { accent-color: var(--navy); width: 15px; height: 15px; margin: 0; }
.lyrmenu .lg { display: inline-block; width: 26px; height: 4px; border-radius: 2px; margin-left: auto; }
.sumrow { display: flex; align-items: center; gap: 12px; padding: 0 10px 0 8px; border-left: 1px solid var(--line); height: 28px; white-space: nowrap; overflow: hidden; }
.sumrow .k { color: var(--sub); font-size: 12px; }
.sumrow .v { font-weight: 600; font-size: 13px; }
.sumrow .v b { font-weight: 800; font-variant-numeric: tabular-nums; }
.sumrow .dt { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -0.5px; }
.sumrow .sep { width: 1px; height: 16px; background: var(--line); }

.hdr .wxl { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #c5d1e0; }
.hdr .wxl b { color: #fff; }
.hdr .wxl[hidden] { display: none; }

/* 地図のピン・アイコン：小さく、影なし */
.pin { position: relative; width: 0; height: 0; }
.pin .sq { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #fff; color: #fff; font-weight: 800; font-size: 11px; line-height: 1; display: grid; place-items: center; }
.pin.sel .sq { outline: 2px solid var(--navy); outline-offset: 1px; }
.pin .lb { position: absolute; white-space: nowrap; font-size: 12px; font-weight: 700; color: #3d4c5f; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 5px #fff; pointer-events: none; line-height: 1.25; }
.pin .lb .dt { display: none; font-size: 11.5px; font-weight: 700; }
.pin .lb.b { left: 0; top: 11px; transform: translateX(-50%); text-align: center; }
.pin .lb.t { left: 0; bottom: 11px; transform: translateX(-50%); text-align: center; }
.pin .lb.r { left: 14px; top: -9px; }
.pin .lb.l { right: 14px; top: -9px; text-align: right; }
.pin .lb span { display: block; }
.mapwrap.zlow .pin .lb { display: none; }
.mapwrap.zhi .pin .lb .dt { display: block; }
.cam { position: relative; width: 0; height: 0; }
.cam .dot { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: #5b6b7e; border: 2px solid #fff; display: grid; place-items: center; }
.cam .dot svg { width: 12px; height: 12px; fill: #fff; }
.cam.sel .dot { background: var(--navy); outline: 2px solid var(--ai); outline-offset: 1px; }
.cam .nm { display: none; position: absolute; left: 0; top: 13px; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 700; color: #34475d; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 4px #fff; pointer-events: none; }
.cam:hover .nm, .cam.sel .nm { display: block; }
.stn { position: relative; width: 0; height: 0; }
.stn .dot { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.stn.big .dot { left: -14px; top: -14px; width: 28px; height: 28px; font-size: 12px; }
.stn.sel .dot { outline: 2px solid var(--navy); outline-offset: 1px; }
.stn .nm { position: absolute; left: 0; top: 14px; transform: translateX(-50%); white-space: nowrap; font-size: 12px; font-weight: 700; color: #2a4f7a; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 4px #fff; pointer-events: none; }
.stn.big .nm { top: 18px; }
.mapwrap.zlow .stn:not(.big) .nm { display: none; }

/* Google の渋滞：通常（緑）は目立たせず、混雑・規制を目立たせる */
#map img[src*="traffic"] { filter: url(#trafficMute); }

/* 右のモニター：一覧性 */
#sideBody { padding: 10px 12px 4px; }
.side h2 { font-size: 15px; margin: 0 2px 7px; }
.h2row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card { padding: 6px; margin-bottom: 8px; box-shadow: none; }
.media { aspect-ratio: 16 / 8.6 !important; }
.cbody { padding-top: 2px; }
.camgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.cam-card { border: 1px solid var(--line); border-radius: 8px; background: var(--card); padding: 3px; position: relative; }
.cam-card .media { aspect-ratio: 16 / 9 !important; border-radius: 6px; }
.cam-card.sel { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.cam-card.hl { box-shadow: 0 0 0 2.5px var(--ai); }
.cam-card .camname { font-size: 11px; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis; }
.lyrbtn { white-space: nowrap; }
@media (max-width: 820px) { .maptop { flex-wrap: wrap; } .sumrow { height: auto; flex-wrap: wrap; white-space: normal; padding: 4px 8px; row-gap: 2px; } }
.pin .sq { display: none; }
.pin .lb.r { left: 0; top: -9px; transform: translateX(-50%); text-align: center; }
.pin .lb.l, .pin .lb.b, .pin .lb.t { left: 0; right: auto; top: -9px; bottom: auto; transform: translateX(-50%); text-align: center; }
.camgrid { grid-template-columns: 1fr; }
.cam-card .camname { font-size: 12.5px; }
.camjump { font-size: 12px; font-weight: 700; color: var(--navy); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 3px 11px; }
.camjump:hover { background: #eaeff5; }
.camwall { position: fixed; inset: 0; z-index: 2050; background: #f3f5f8; display: none; flex-direction: column; }
.camwall.on { display: flex; }
.cwh { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--navy); color: #fff; }
.cwh h2 { font-size: 18px; font-weight: 800; }
.cwh .x { margin-left: auto; color: #fff; font-size: 28px; width: 40px; height: 40px; border-radius: 8px; }
.cwh .x:hover { background: rgba(255, 255, 255, .15); }
.cwgrid { flex: 1; overflow-y: auto; padding: 20px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; align-content: start; }
.cwitem { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: left; cursor: zoom-in; }
.cwitem:hover { border-color: var(--navy); }
.cwimg { display: block; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #8f98a3; }
.cwimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cwnm { display: block; font-weight: 800; font-size: 16px; padding: 8px 2px 2px; }
.cwimg { position: relative; }
.cwimg img { object-fit: contain; }
.cwimg svg.boxes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cwimg svg.boxes rect { fill: rgba(94, 230, 208, .10); stroke: #5ee6d0; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.cwchips { position: absolute; left: 8px; top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.cwsub { display: block; font-size: 13px; color: var(--sub); padding: 0 2px 2px; }
.cwgrid { align-items: start; }
.cwgrid.fit { overflow: hidden; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 12px 16px; }
.cwgrid.fit .cwitem { display: flex; flex-direction: column; align-items: flex-start; min-height: 0; min-width: 0; overflow: hidden; }
.cwgrid.fit .cwnm { font-size: 14px; padding-top: 6px; }
.cwgrid.fit .cwsub { font-size: 12px; }
.cwgrid { min-height: 0; }
.cwgrid.fit { align-items: stretch; }
/* Google の地図が描けるまで、渋滞タイルは出さない（読み込み中のちらつき防止） */
.mapwrap:not(.gready) #map img[src*="traffic"] { visibility: hidden; }
#map .leaflet-layer { transition: opacity .35s; }
#map img[src*="traffic"]:not([data-ok]) { opacity: 0 !important; }
#map img[src*="traffic"][data-ok] { opacity: 1; transition: opacity .3s; }

/* ---------- 分析・レポート：3タブ・フラットな見た目 ---------- */
.an { padding: 0 24px 32px; }
.anhead { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 14px 0 0; }
.antool { background: transparent; border: 0; padding: 0 0 10px; margin: 0; gap: 18px; }
.antabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.antabs button { padding: 10px 22px 9px; font-weight: 700; font-size: 15px; color: var(--sub); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.antabs button:hover { color: var(--ink); }
.antabs button.on { color: var(--navy); border-bottom-color: var(--navy); }
.anbody { background: #fff; border-radius: 0 0 12px 12px; padding: 22px 26px 16px; min-height: 420px; }
.anpane { display: none; }
.anpane.on { display: block; }
.ansum { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
.ins { background: transparent; border: 0; border-top: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 2px 20px; }
.ins:first-child { border-left: 0; padding-left: 0; }
.ins .k { font-size: 13px; }
.ins .v { font-size: 30px; line-height: 1.25; }
.ins .v small { font-size: 15px; }
.ins .d { font-size: 13px; color: var(--sub); }
.railstats { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 20px; }
.railstats .ins:first-child { padding-left: 0; }
.pan { background: transparent; border: 0; border-radius: 0; padding: 0; margin-bottom: 0; }
.grid2 { gap: 32px; margin-bottom: 22px; align-items: start; }
.grid2.wide { grid-template-columns: 1.55fr 1fr; }
.pan h3 { font-size: 16px; }
.pan .note { margin-top: 8px; }
.lotbar { margin-bottom: 14px; }
.lotbar label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); font-weight: 600; }
.lotbar select { font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); padding: 7px 12px; border: 1px solid #c9d2dc; border-radius: 8px; background: #fff; }
.anpane > .pan { margin-bottom: 22px; }
.resdet { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line2); }
.resdet summary { cursor: pointer; font-weight: 800; font-size: 15px; padding: 4px 0; }
.resdet[open] summary { margin-bottom: 8px; }
.anbody .foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line2); }
table.t th { border-bottom-width: 1px; }
@media (max-width: 1100px) { .ansum, .railstats { grid-template-columns: repeat(2, 1fr); row-gap: 14px; } .grid2, .grid2.wide { grid-template-columns: 1fr; } .ins:nth-child(odd) { border-left: 0; padding-left: 0; } }

/* ---------- 分析・レポート：1画面のシンプル版 ---------- */
.anhead { padding-top: 14px; }
.antool { padding-bottom: 12px; align-items: center; }
.antool .cmpchk { color: var(--ink); cursor: pointer; }
.antool .cmpchk input { accent-color: var(--navy); width: 16px; height: 16px; margin: 0; }
.anbody { border-radius: 12px; padding: 18px 24px 14px; }
.ansum { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line2); }
.ins .v { font-size: 25px; }
.ins .v small { font-size: 13px; }
.ins .d { font-size: 12.5px; }
.grid2 { gap: 28px; margin-bottom: 18px; }
.phead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.phead select { font: inherit; font-size: 13px; font-weight: 700; color: var(--ink); padding: 4px 8px; border: 1px solid #c9d2dc; border-radius: 7px; background: #fff; max-width: 52%; }
.anbody > .pan { margin-bottom: 18px; }
.folds { border-top: 1px solid var(--line2); }
.folds .resdet { margin-top: 0; padding: 10px 0; border-top: 0; border-bottom: 1px solid var(--line2); }
.folds .resdet summary { font-size: 14.5px; }
.heat td { height: 28px; }

/* ---------- 詳細ページ（駐車場・駅） ---------- */
#vDetail { overflow-y: auto; display: none; background: var(--bg); }
#vDetail.on { display: block; }
.dtpage { padding-bottom: 36px; }
.dthead { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px 0 12px; position: sticky; top: 0; z-index: 20; background: var(--bg); }
.dthead .back { font-weight: 700; font-size: 14px; color: var(--navy); padding: 7px 12px; border-radius: 8px; border: 1px solid #c3ccd7; background: #fff; }
.dthead .back:hover { background: #eaeff5; }
.dttl h2 { font-size: 21px; font-weight: 800; line-height: 1.25; }
.dttl .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.dtsel { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); font-weight: 600; }
.dtsel select { font: inherit; font-size: 14px; font-weight: 700; color: var(--ink); padding: 7px 12px; border: 1px solid #c9d2dc; border-radius: 8px; background: #fff; }
.dtpage .ansum { background: #fff; border-radius: 12px 12px 0 0; padding: 18px 24px 14px; margin: 0; border-bottom: 1px solid var(--line2); }
.dtgrid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 28px; background: #fff; padding: 18px 24px 18px; }
.dtgrid .pan { margin-bottom: 18px; }
.dtgrid .pan:last-child { margin-bottom: 0; }
.dtchart svg { cursor: crosshair; display: block; width: 100%; height: auto; }
.seg { display: inline-flex; border: 1px solid #c9d2dc; border-radius: 8px; overflow: hidden; }
.seg button { padding: 4px 14px; font-size: 13px; font-weight: 700; color: var(--sub); background: #fff; }
.seg button.on { background: var(--navy); color: #fff; }
.recwrap { max-height: 280px; overflow-y: auto; border-top: 1px solid var(--line2); }
.recs thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.recs tbody tr { cursor: pointer; }
.recs tbody tr:hover { background: #f3f6fa; }
.recs tbody tr.sel { background: #e4edf8; }
.lvchip { display: inline-block; font-size: 12px; font-weight: 800; padding: 1px 9px; border-radius: 10px; }
.dtright { position: relative; }
.dtright .pan { position: sticky; top: 76px; }
.selhead { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.seltime { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dtright .big { font-size: 34px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.dtright .big small { font-size: 16px; }
.dtright .big .cnt { font-size: 16px; font-weight: 700; color: var(--ink); }
.dtimg { position: relative; overflow: hidden; border-radius: 8px; background: #8f98a3; margin: 10px 0 6px; max-height: 360px; }
.dtimg img { width: 100%; height: 100%; display: block; object-fit: cover; }
.dtimg svg.boxes, .timg svg.boxes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dtimg svg.boxes rect, .timg svg.boxes rect { fill: rgba(94, 230, 208, .10); stroke: #5ee6d0; stroke-width: 2; vector-effect: non-scaling-stroke; }
.dtimg .tl { position: absolute; left: 8px; top: 8px; display: flex; gap: 5px; }
.dtimg .tl .chip { background: rgba(255, 255, 255, .93); }
.dtimg .br { position: absolute; right: 8px; bottom: 8px; background: rgba(22, 40, 63, .8); color: #fff; font-size: 12px; padding: 1px 9px; border-radius: 8px; }
.minor.warn { color: #8a5a0a; }
.dtstrip { background: #fff; padding: 4px 24px 18px; border-top: 1px solid var(--line2); }
.dtstrip h3 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 10px; padding-top: 14px; }
.dtstrip .sub { font-size: 12.5px; color: var(--sub); margin: 1px 0 10px; }
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.thumb { text-align: left; border: 2px solid transparent; border-radius: 9px; padding: 3px; background: #f3f5f8; }
.thumb:hover { border-color: #b7c4d4; }
.thumb.on { border-color: var(--navy); background: #e4edf8; }
.timg { position: relative; display: block; overflow: hidden; border-radius: 6px; background: #8f98a3; }
.timg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcap { display: flex; justify-content: space-between; padding: 4px 3px 1px; font-size: 13px; font-variant-numeric: tabular-nums; }
.tcap span { font-weight: 800; }
.dtpage .foot { background: #fff; border-radius: 0 0 12px 12px; margin: 0; padding: 10px 24px 14px; border-top: 1px solid var(--line2); }
.dtlinks { display: flex; align-items: center; gap: 14px; margin: 4px 0 10px; flex-wrap: wrap; }
.dtlinks .btn { padding: 7px 14px; }
.heat th.l .dtlink { font-weight: 700; color: var(--ink); text-decoration: underline; text-decoration-color: #b7c4d4; text-underline-offset: 3px; font-size: 12.5px; }
.heat th.l .dtlink:hover { color: var(--navy); text-decoration-color: var(--navy); }
table.t .dtlink { text-align: left; color: var(--ink); text-decoration: underline; text-decoration-color: #b7c4d4; text-underline-offset: 3px; }
@media (max-width: 1100px) { .dtgrid { grid-template-columns: 1fr; } .thumbs { grid-template-columns: repeat(3, 1fr); } .dtright .pan { position: static; } }
@media print { #vDetail { display: none !important; } }
