/* =============================================
   消火栓管理システム - Stylesheet  v4
   ============================================= */

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', 'Meiryo', sans-serif; font-size: 13px; background: #f0f2f5; overflow: hidden; }
button { cursor: pointer; }

/* ---------- Layout ---------- */
#app { display: flex; height: 100vh; width: 100vw; }

#sidebar {
  width: 280px; min-width: 220px; max-width: 340px;
  background: #1e2736; color: #c8d0dc;
  display: flex; flex-direction: column;
  overflow: hidden; z-index: 500;
  box-shadow: 2px 0 8px rgba(0,0,0,.4);
}

#sidebar-header {
  padding: 12px 14px 10px;
  background: #161e2b;
  border-bottom: 1px solid #2d3a4f;
  flex-shrink: 0;
}
#sidebar-header-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 6px;
}
#sidebar-header h1 { font-size: 14px; font-weight: 700; color: #e8edf3; line-height: 1.3; }
#sidebar-header small { font-size: 10px; color: #7a8899; }
#header-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0;
}

/* ロールバッジ */
.role-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px; white-space: nowrap;
}
.role-badge.editor   { background: #1a4b8c; color: #90caf9; border: 1px solid #2a6db5; }
.role-badge.readonly { background: #2e3b2e; color: #a5d6a7; border: 1px solid #4caf50; }

/* ログアウトボタン */
#btn-logout {
  background: none; border: 1px solid #3a4a60; color: #7a8899;
  border-radius: 4px; padding: 2px 6px; font-size: 13px;
  cursor: pointer; transition: background .15s, color .15s;
}
#btn-logout:hover { background: #c0392b; color: #fff; border-color: #c0392b; }

#sidebar-body { flex: 1; overflow-y: auto; padding: 10px 0; }
#sidebar-body::-webkit-scrollbar { width: 5px; }
#sidebar-body::-webkit-scrollbar-track { background: #1e2736; }
#sidebar-body::-webkit-scrollbar-thumb { background: #3a4a60; border-radius: 3px; }

/* ---------- Sidebar Sections ---------- */
.sb-section { padding: 8px 14px; border-bottom: 1px solid #2a3547; }
.sb-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  color: #5d7a99; text-transform: uppercase; margin-bottom: 6px;
}

/* ---------- Stats ---------- */
#stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.stat-card {
  background: #263248; border-radius: 6px; padding: 7px 10px;
  text-align: center; border: 1px solid #2d3a4f;
}
.stat-card .stat-num { font-size: 20px; font-weight: 700; color: #e8edf3; line-height: 1.1; }
.stat-card .stat-lbl { font-size: 10px; color: #7a8899; margin-top: 2px; }
.stat-card.yellow .stat-num { color: #FFD700; }
.stat-card.blue   .stat-num { color: #42A5F5; }
.stat-card.red    .stat-num { color: #EF5350; }
.stat-card.dark   .stat-num { color: #B0BEC5; }

/* ---------- Legend ---------- */
.legend-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; }
.legend-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.15);
}
.legend-dot.unchecked  { background: #FFD700; }
.legend-dot.checked_ok { background: #1E88E5; }
.legend-dot.checked_ng { background: #E53935; }
.legend-dot.disabled   { background: #E53935; animation: legendBlink .8s step-start infinite; }
.legend-dot.usable     { background: #43A047; }

@keyframes legendBlink { 0%,100%{opacity:1} 50%{opacity:0} }

/* ---------- Station Filter ---------- */
.station-filter-row {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 0; border-bottom: 1px solid #273347;
}
.station-filter-row:last-child { border-bottom: none; }
.station-filter-row input[type=checkbox] { accent-color: #4d9fff; flex-shrink: 0; }
.station-filter-row label {
  font-size: 12px; cursor: pointer; user-select: none; flex: 1;
  color: #c8d0dc;
}
.station-badge {
  font-size: 10px; font-weight: 700;
  background: #2d3a4f; color: #7a8899;
  padding: 1px 6px; border-radius: 10px; flex-shrink: 0;
}

/* ---------- Layer Toggles ---------- */
.layer-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.layer-row label { font-size: 12px; cursor: pointer; user-select: none; }
.layer-toggle { width: 14px; height: 14px; cursor: pointer; accent-color: #4d9fff; }

/* ---------- Filter Tree ---------- */
#filter-tree { font-size: 12px; }
.filter-city  { margin-bottom: 4px; }
.filter-division { margin-left: 14px; margin-top: 2px; }
.filter-district { margin-left: 28px; margin-top: 1px; }
.filter-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.filter-row input[type=checkbox] { accent-color: #4d9fff; }
.filter-row label { cursor: pointer; user-select: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-toggle { background: none; border: none; color: #7a8899; font-size: 11px; width: 14px; padding: 0; }
.filter-toggle:hover { color: #c8d0dc; }

/* ---------- Bottom Buttons ---------- */
#sidebar-footer { padding: 10px 14px; border-top: 1px solid #2a3547; flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; }
.btn-primary {
  width: 100%; padding: 9px; border: none; border-radius: 6px;
  background: #2a6db5; color: #fff; font-size: 13px; font-weight: 600;
  transition: background .15s;
}
.btn-primary:hover { background: #3580cc; }
.btn-primary.active { background: #1e7e34; }
.btn-danger  { background: #b52a2a; }
.btn-danger:hover  { background: #cc3535; }
.btn-reset   { background: #6c4e9e; }
.btn-reset:hover   { background: #7f5fb8; }

/* ---------- Map ---------- */
#map-wrap { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

/* ---------- Map Cursor ---------- */
#map.add-mode { cursor: crosshair; }

/* ---------- Hydrant Marker Icons ---------- */
.hydrant-icon-wrap {
  position: relative; width: 36px; height: 36px;
}
.hydrant-status-halo {
  position: absolute; inset: 4px;
  border-radius: 50%;
  pointer-events: none;
}
.hydrant-sign-img {
  position: absolute; top: 3px; left: 3px;
  width: 28px; height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}
/* 防火水槽は正方形PNGのため、消火栓と視覚的サイズを合わせて縮小 */
.hydrant-sign-img.sign-suisou {
  width: 22px; height: 22px;
  top: 7px; left: 7px;
}

/* Status halos（シンプル単色：グラデーション廃止で描画軽量化） */
.status-halo-unchecked  { background: rgba(255,215,0,.72); }
.status-halo-checked_ok { background: rgba(30,136,229,.78); }
.status-halo-checked_ng { background: rgba(229,57,53,.82); }
.status-halo-disabled   { background: rgba(229,57,53,.82); animation: statusBlink 1s step-start infinite; }
.status-halo-usable     { background: rgba(67,160,71,.82); }

@keyframes statusBlink { 0%,100%{opacity:1} 50%{opacity:0} }

/* シンプルドット（低ズーム時マーカー） */
.simple-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.35);
}
.simple-dot-blink { animation: statusBlink 1s step-start infinite; }

/* ---------- Hydrant Labels ---------- */
.hydrant-label {
  display: none;
  position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 10px; font-weight: 600;
  color: #1a1a2e; background: rgba(255,255,255,.82);
  padding: 1px 5px; border-radius: 3px;
  pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
#map.map-labels-visible .hydrant-label { display: block; }

/* ---------- Modal Overlay ---------- */
#modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 1000;
  align-items: flex-start; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
#modal-overlay.open { display: flex; }

/* ---------- Modal ---------- */
.modal-wide {
  background: #fff; border-radius: 10px;
  width: 100%; max-width: 740px;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
  margin: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e0e5ee;
  background: #f7f9fc; border-radius: 10px 10px 0 0;
}
.modal-header h2 { font-size: 16px; font-weight: 700; color: #1a2540; }
.modal-close { background: none; border: none; font-size: 22px; color: #6b7c93; line-height: 1; }
.modal-close:hover { color: #1a2540; }
.modal-body { padding: 18px 20px; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid #e0e5ee;
  display: flex; gap: 8px; justify-content: flex-end;
  background: #f7f9fc; border-radius: 0 0 10px 10px;
}

/* ---------- Form Section Titles ---------- */
.form-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  color: #5d6e88; text-transform: uppercase;
  margin: 16px 0 8px; padding-bottom: 4px;
  border-bottom: 1px solid #e0e5ee;
}
.form-section-title:first-child { margin-top: 0; }

/* ---------- Form Rows ---------- */
.form-row { display: flex; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 160px; }
.form-row-3 > * { flex: 1; min-width: 130px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11px; font-weight: 600; color: #5d6e88; }
.form-group input, .form-group select, .form-group textarea {
  padding: 7px 9px; border: 1px solid #cdd6e3;
  border-radius: 5px; font-size: 13px; color: #1a2540;
  background: #fff; transition: border .15s;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #2a6db5;
  box-shadow: 0 0 0 3px rgba(42,109,181,.12);
}
.form-group textarea { resize: vertical; min-height: 60px; }

/* ---------- Status Cards ---------- */
.form-status-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.status-card {
  flex: 1; min-width: 120px;
  border: 2px solid #dde3ee; border-radius: 8px;
  padding: 10px 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: border-color .15s, background .15s;
  background: #f7f9fc;
}
.status-card:hover { border-color: #a0b0c8; background: #eef2f8; }
.status-card input[type=radio] { display: none; }
.status-card .sc-dot {
  width: 20px; height: 20px; border-radius: 50%;
}
.status-card .sc-label { font-size: 11px; font-weight: 600; text-align: center; color: #3a4a62; line-height: 1.3; }

.status-card.unchecked  .sc-dot { background: #FFD700; }
.status-card.checked_ok .sc-dot { background: #1E88E5; }
.status-card.checked_ng .sc-dot { background: #E53935; }
.status-card.disabled   .sc-dot { background: #E53935; animation: statusBlink 1s step-start infinite; }
.status-card.usable     .sc-dot { background: #43A047; }

.status-card.selected { border-color: #2a6db5; background: #e8f0fc; }
.status-card.selected.unchecked  { border-color: #ccaa00; background: #fffacc; }
.status-card.selected.checked_ok { border-color: #1565C0; background: #e3f0fc; }
.status-card.selected.checked_ng { border-color: #b71c1c; background: #fce8e8; }
.status-card.selected.disabled   { border-color: #b71c1c; background: #fce8e8; }
.status-card.selected.usable     { border-color: #2e7d32; background: #e8f5e9; }

/* ---------- Inspection Grid ---------- */
/* ---------- LISTB点検フォーム（旧inspection-gridを置き換え） ---------- */
.listb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px; margin-bottom: 10px;
}
.lb-item {
  display: flex; flex-direction: column; gap: 3px;
}
.lb-item.lb-wide { grid-column: span 2; }
.lb-label {
  font-size: 10px; font-weight: 700; color: #5d7a99;
  text-transform: uppercase; letter-spacing: .05em;
  line-height: 1.3;
}
.lb-label small { font-size: 9px; font-weight: 400; color: #8a9bb5; text-transform: none; }
.lb-select {
  width: 100%; padding: 6px 8px; border-radius: 5px;
  border: 1px solid #c8d4e4; background: #f6f8fc;
  font-size: 12px; color: #1a2540;
  outline: none; transition: border-color .15s;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235d7a99'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  padding-right: 22px;
}
select.lb-select { cursor: pointer; }
.lb-select:focus { border-color: #2a6db5; background: #fff; }
/* datalist inputは矢印不要 */
input.lb-select {
  background-image: none; padding-right: 8px;
}
/* 使用可否セレクト：使用不能選択時は赤く強調 */
.usability-select.danger {
  border-color: #E53935;
  background: #fff5f5;
  color: #c62828;
  font-weight: 700;
}

/* (後方互換) 旧inspectionフォームが残る場合 */
.inspection-grid { display: none; }
.insp-options { display: flex; gap: 10px; }
.insp-options input[type=radio] { accent-color: #2a6db5; }

/* ---------- Inline number/depth field ---------- */
.form-row-inline { display: flex; gap: 12px; margin-bottom: 10px; align-items: flex-end; }
.form-row-inline > * { flex: 1; }

/* ---------- Defect Row ---------- */
#defect-row { margin-bottom: 10px; }

/* ---------- History ---------- */
#history-section { margin-top: 12px; }
.history-entry {
  background: #f4f6fa; border-radius: 6px;
  padding: 8px 12px; margin-bottom: 6px;
  border-left: 3px solid #b0bec5;
}
.history-entry-header { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.history-entry-date { font-size: 11px; color: #5d6e88; font-weight: 600; }
.history-entry-status { font-size: 11px; padding: 1px 8px; border-radius: 10px; font-weight: 600; }
.history-entry-status.unchecked  { background: #fff3cd; color: #856404; }
.history-entry-status.checked_ok { background: #cce5ff; color: #004085; }
.history-entry-status.checked_ng { background: #f8d7da; color: #721c24; }
.history-entry-status.disabled   { background: #f8d7da; color: #721c24; }
.history-entry-status.usable     { background: #d4edda; color: #155724; }
.history-entry-inspector { font-size: 11px; color: #7a8899; }
.history-entry-notes, .history-entry-defect { font-size: 11px; color: #3a4a62; margin-top: 3px; }
.history-entry-defect { color: #b71c1c; }

/* ---------- Form Buttons ---------- */
.form-btn {
  padding: 9px 20px; border: none; border-radius: 6px;
  font-size: 13px; font-weight: 600; transition: background .15s;
}
.form-btn-primary { background: #2a6db5; color: #fff; }
.form-btn-primary:hover { background: #3580cc; }
.form-btn-secondary { background: #e8edf5; color: #3a4a62; }
.form-btn-secondary:hover { background: #d5dde8; }
.form-btn-danger { background: #E53935; color: #fff; margin-right: auto; }
.form-btn-danger:hover { background: #c62828; }

/* ---------- Hidden utility ---------- */
.hidden { display: none !important; }

/* ---------- Reset Modal ---------- */
#reset-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 2000;
  align-items: center; justify-content: center;
}
#reset-modal-overlay.open { display: flex; }
.reset-modal {
  background: #fff; border-radius: 10px; padding: 28px 32px;
  max-width: 440px; width: 90%; text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
}
.reset-modal h3 { font-size: 17px; margin-bottom: 10px; color: #1a2540; }
.reset-modal p  { font-size: 13px; color: #5d6e88; margin-bottom: 18px; line-height: 1.6; }
.reset-modal-btns { display: flex; gap: 10px; justify-content: center; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: #1a2540; color: #fff; padding: 10px 22px;
  border-radius: 24px; font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
  z-index: 3000; opacity: 0; pointer-events: none;
  transition: opacity .25s;
  white-space: nowrap;
}
#toast.show { opacity: 1; }
#toast.success { background: #2e7d32; }
#toast.error   { background: #b71c1c; }

/* ---------- Add-mode hint ---------- */
#add-mode-hint {
  display: none; position: absolute; bottom: 30px; left: 50%;
  transform: translateX(-50%);
  background: rgba(30,39,54,.85); color: #fff;
  padding: 8px 18px; border-radius: 20px; font-size: 13px;
  z-index: 600; pointer-events: none; white-space: nowrap;
}
#map-wrap.add-mode-on #add-mode-hint { display: block; }

/* ---------- 市街地区分バッジ（第4レイヤー） ---------- */
.area-type-badge {
  position: absolute;
  bottom: -14px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; font-size: 9px; font-weight: 700;
  color: #fff; padding: 1px 4px; border-radius: 3px;
  pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  z-index: 10;
}

/* =============================================
   検索パネル
   ============================================= */

/* 検索ボタン */
.btn-search { background: #1a6b4a; }
.btn-search:hover { background: #22885e; }

/* オーバーレイ */
.search-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35); z-index: 800;
}
.search-overlay.open { display: block; }

/* パネル本体 */
.search-panel {
  position: fixed; top: 0; right: -440px;
  width: 420px; max-width: 96vw; height: 100vh;
  background: #1e2736; color: #c8d0dc;
  display: flex; flex-direction: column;
  z-index: 900; box-shadow: -4px 0 24px rgba(0,0,0,.5);
  transition: right .28s cubic-bezier(.4,0,.2,1);
}
.search-panel.open { right: 0; }

/* ヘッダー */
.search-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  background: #161e2b; border-bottom: 1px solid #2d3a4f;
  flex-shrink: 0;
}
.search-panel-title { font-size: 15px; font-weight: 700; color: #e8edf3; }
.search-panel-close {
  background: none; border: none; font-size: 24px;
  color: #7a8899; cursor: pointer; line-height: 1; padding: 0 4px;
}
.search-panel-close:hover { color: #e8edf3; }

/* フリーワード */
.search-section { padding: 12px 16px 8px; flex-shrink: 0; }
.search-input-wrap {
  position: relative; display: flex; align-items: center;
}
.search-input-wrap input {
  width: 100%; padding: 9px 36px 9px 12px;
  background: #263248; border: 1px solid #3a4a60;
  border-radius: 8px; color: #e8edf3; font-size: 14px;
  font-family: inherit; outline: none;
  transition: border .15s;
}
.search-input-wrap input:focus { border-color: #4d9fff; }
.search-input-wrap input::placeholder { color: #5d7a99; }
.search-clear-btn {
  position: absolute; right: 10px;
  background: none; border: none; color: #5d7a99;
  font-size: 14px; cursor: pointer; padding: 2px 4px;
}
.search-clear-btn:hover { color: #c8d0dc; }

/* フィルター */
.search-filters {
  padding: 0 16px 8px; flex-shrink: 0;
  border-bottom: 1px solid #2a3547;
}
.search-filter-group { margin-bottom: 8px; }
.sf-label {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  color: #5d7a99; text-transform: uppercase;
  display: block; margin-bottom: 5px;
}
.sf-options { display: flex; flex-wrap: wrap; gap: 5px; }
.sf-chip {
  display: flex; align-items: center; gap: 4px;
  background: #263248; border: 1px solid #3a4a60;
  border-radius: 14px; padding: 3px 10px;
  cursor: pointer; font-size: 12px; color: #c8d0dc;
  transition: background .12s, border-color .12s;
  user-select: none;
}
.sf-chip:hover { background: #2d3e58; }
.sf-chip input { display: none; }
.sf-chip:has(input:checked) {
  background: #1a3a5c; border-color: #4d9fff; color: #7ec8ff;
}
/* ステータス色 */
.sf-chip:has(input[value="unchecked"]:checked)  { background: #3a3000; border-color: #FFD700; color: #FFD700; }
.sf-chip:has(input[value="checked_ok"]:checked) { background: #0d2a4a; border-color: #1E88E5; color: #64b5f6; }
.sf-chip:has(input[value="checked_ng"]:checked) { background: #3a0a0a; border-color: #E53935; color: #ef9a9a; }
.sf-chip:has(input[value="disabled"]:checked)   { background: #3a0a0a; border-color: #E53935; color: #ef9a9a; }

/* 件数・リセット行 */
.search-result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 6px; flex-shrink: 0;
}
#search-result-count { font-size: 12px; color: #7a8899; font-weight: 600; }
.search-reset-btn {
  background: none; border: 1px solid #3a4a60; border-radius: 12px;
  color: #7a8899; font-size: 11px; padding: 2px 10px; cursor: pointer;
}
.search-reset-btn:hover { border-color: #7a8899; color: #c8d0dc; }

/* 結果一覧 */
.search-result-list {
  flex: 1; overflow-y: auto; padding: 0 10px 16px;
}
.search-result-list::-webkit-scrollbar { width: 5px; }
.search-result-list::-webkit-scrollbar-track { background: #1e2736; }
.search-result-list::-webkit-scrollbar-thumb { background: #3a4a60; border-radius: 3px; }

/* 結果カード */
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; transition: background .12s;
  border-bottom: 1px solid #263248;
}
.search-result-item:hover { background: #263248; }
.search-result-item:last-child { border-bottom: none; }

.sri-status-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
}
.sri-status-dot.unchecked  { background: #FFD700; }
.sri-status-dot.checked_ok { background: #1E88E5; }
.sri-status-dot.checked_ng { background: #E53935; }
.sri-status-dot.disabled   { background: #E53935; animation: statusBlink 1s step-start infinite; }
.sri-status-dot.usable     { background: #43A047; }

.sri-body { flex: 1; min-width: 0; }
.sri-title {
  font-size: 13px; font-weight: 600; color: #e8edf3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sri-title mark {
  background: #3a6030; color: #b9f0a0;
  border-radius: 2px; padding: 0 2px;
}
.sri-sub {
  font-size: 11px; color: #7a8899; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sri-sub mark {
  background: #3a3000; color: #ffe066;
  border-radius: 2px; padding: 0 2px;
}

.sri-type-badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; flex-shrink: 0; color: #fff;
}
.sri-type-badge.消火栓   { background: #c0392b; }
.sri-type-badge.防火水槽 { background: #2980b9; }
.sri-type-badge.指定水利 { background: #27ae60; }

.search-no-result {
  text-align: center; color: #5d7a99;
  padding: 40px 16px; font-size: 13px; line-height: 2;
}

/* ---------- Zoom hint ---------- */
#zoom-hint {
  display: none; position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.6); color: #fff;
  padding: 5px 14px; border-radius: 14px; font-size: 12px;
  z-index: 600; pointer-events: none;
}

/* ---------- 印刷メニュー ---------- */
.btn-print-menu { background: #5b4a8a; }
.btn-print-menu:hover { background: #7060a8; }

.print-menu-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1500;
}
.print-menu-overlay.open { display: block; }

.print-menu {
  display: none; position: fixed;
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: #fff; border-radius: 12px;
  width: 94%; max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
  z-index: 1600; overflow: hidden;
}
.print-menu.open { display: block; }
.print-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: #f7f9fc;
  border-bottom: 1px solid #e0e5ee;
  font-size: 15px; font-weight: 700; color: #1a2540;
}
.print-menu-body { padding: 10px 12px 16px; }
.print-option-card {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 8px;
  border: 1px solid #e0e5ee; margin-bottom: 8px;
  cursor: pointer; transition: background .12s, border-color .12s;
}
.print-option-card:hover { background: #f0f5ff; border-color: #2a6db5; }
.print-option-card:last-child { margin-bottom: 0; }
.print-opt-icon { font-size: 24px; flex-shrink: 0; width: 36px; text-align: center; }
.print-opt-title { font-size: 14px; font-weight: 700; color: #1a2540; margin-bottom: 3px; }
.print-opt-desc  { font-size: 11px; color: #6b7c93; line-height: 1.5; }

/* 印刷プレビューエリア（非表示） */
#print-preview-area { display: none; }

/* =============================================
   ログイン画面
   ============================================= */
#login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #0d1520 0%, #1a2540 50%, #0d1520 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .3s;
}
#login-overlay.hidden { display: none; }

/* ログイン中はappを操作不能に */
#app.login-active { pointer-events: none; filter: blur(4px); }

#login-box {
  width: 100%; max-width: 380px;
  background: #1e2a3a;
  border: 1px solid #2d3f56;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  padding: 40px 36px 32px;
  text-align: center;
}

#login-logo { margin-bottom: 28px; }
#login-icon { font-size: 48px; margin-bottom: 10px; }
#login-logo h1 {
  font-size: 20px; font-weight: 700; color: #e8edf3;
  margin-bottom: 4px;
}
#login-logo p { font-size: 12px; color: #7a8899; }

#login-form { text-align: left; }

/* メール・パスワード入力欄 */
.login-field { margin-bottom: 12px; }
.login-field label {
  display: block; font-size: 12px; font-weight: 700;
  color: #90caf9; margin-bottom: 5px;
}
.login-field input {
  width: 100%; padding: 11px 13px; box-sizing: border-box;
  background: #1e2e42; border: 1.5px solid #2a4060;
  border-radius: 8px; color: #e3f2fd; font-size: 15px;
  outline: none; transition: border-color .2s;
}
.login-field input:focus { border-color: #4d9fff; }
.login-field input::placeholder { color: #4a6080; }

/* 手順ステップ */
#login-steps {
  margin-bottom: 14px;
}
.login-step {
  display: flex; align-items: center; gap: 12px;
  background: #263248; border: 1px solid #3a4e68;
  border-radius: 10px; padding: 10px 14px;
}
.login-step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2a6db5; color: #fff;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.login-step-text {
  font-size: 13px; color: #c8d4e4; line-height: 1.5;
}
.login-step-text b { color: #90caf9; }
.login-step-arrow {
  text-align: center; color: #3a4e68;
  font-size: 18px; line-height: 1; padding: 2px 0;
}

/* 初回案内 */
#login-first-time {
  background: #1a3520; border: 1px solid #2e5c3a;
  border-radius: 8px; padding: 10px 12px;
  font-size: 12px; color: #a5d6a7; line-height: 1.6;
  margin-bottom: 12px;
}
#login-first-time b { color: #69f0ae; }
#login-pw-label {
  display: block; font-size: 11px; font-weight: 700;
  color: #5d7a99; text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 6px;
}

#login-pw-wrap {
  display: flex; gap: 6px; margin-bottom: 6px;
}
#login-password {
  flex: 1; padding: 11px 14px; border-radius: 8px;
  background: #263248; border: 1px solid #3a4e68;
  color: #e8edf3; font-size: 15px;
  outline: none; transition: border-color .2s;
}
#login-password:focus { border-color: #2a6db5; }
#login-pw-toggle {
  background: #263248; border: 1px solid #3a4e68;
  color: #7a8899; border-radius: 8px;
  padding: 0 12px; font-size: 16px; cursor: pointer;
  transition: background .15s;
}
#login-pw-toggle:hover { background: #2e3f58; }

#login-error {
  min-height: 18px; font-size: 12px;
  color: #ef5350; margin-bottom: 4px; padding-left: 2px;
}

#login-btn {
  width: 100%; padding: 12px; margin-top: 4px;
  background: linear-gradient(135deg, #1a5fb4, #2a6db5);
  color: #fff; font-size: 15px; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 4px 16px rgba(42,109,181,.35);
}
#login-btn:hover   { opacity: .9; }
#login-btn:active  { transform: scale(.98); }

#login-hint {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid #2d3f56;
}
.login-role-hint {
  font-size: 11px; padding: 4px 10px; border-radius: 6px;
}
.editor-hint   { background: #1a3a5c; color: #90caf9; }
.readonly-hint { background: #1a2e1a; color: #a5d6a7; }

/* =============================================
   @media print — 印刷スタイル
   ============================================= */
@media print {
  /* 通常のUI要素を全て非表示 */
  #sidebar, #mobile-fab, #mobile-drawer, #mobile-drawer-overlay,
  #search-panel, #search-overlay,
  #modal-overlay, #reset-modal-overlay,
  #print-menu, #print-menu-overlay,
  #login-overlay,
  #toast, #add-mode-hint,
  .leaflet-control-container { display: none !important; }

  body { overflow: visible; background: #fff; font-size: 11pt; color: #000; }
  #app { display: block; height: auto; }
  #map-wrap { display: none; }

  /* 印刷コンテンツを表示 */
  #print-preview-area {
    display: block !important;
    padding: 0; margin: 0;
  }

  /* 地図印刷時のみ map-wrap を表示 */
  body.print-map #map-wrap  { display: block !important; width: 100%; height: 100vh; }
  body.print-map #print-preview-area { display: none !important; }

  /* ページ区切り */
  .print-page-break { page-break-after: always; break-after: always; }

  /* 印刷ヘッダー */
  .print-header {
    text-align: center; margin-bottom: 16px; border-bottom: 2px solid #000; padding-bottom: 8px;
  }
  .print-header h1 { font-size: 16pt; font-weight: bold; margin-bottom: 4px; }
  .print-header p  { font-size: 10pt; }

  /* 一覧テーブル */
  .print-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .print-table th {
    background: #1e2736; color: #fff; padding: 5px 6px;
    border: 1px solid #333; text-align: center; font-weight: bold;
  }
  .print-table td { padding: 4px 6px; border: 1px solid #ccc; }
  .print-table tr:nth-child(even) td { background: #f5f5f5; }
  .print-table .status-cell { text-align: center; font-weight: bold; }
  .print-table .st-unchecked  { color: #b8860b; }
  .print-table .st-checked_ok { color: #1565C0; }
  .print-table .st-checked_ng { color: #b71c1c; }
  .print-table .st-disabled   { color: #b71c1c; font-weight: bold; }
  .print-table .st-usable     { color: #2e7d32; }

  /* 点検票 */
  .print-sheet { font-size: 10pt; max-width: 180mm; margin: 0 auto; }
  .print-sheet-title { font-size: 14pt; font-weight: bold; text-align: center; margin-bottom: 12px; }
  .print-sheet-info { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
  .print-sheet-info th {
    background: #eee; font-weight: bold; padding: 4px 8px;
    border: 1px solid #999; width: 30%; font-size: 9pt;
  }
  .print-sheet-info td { padding: 4px 8px; border: 1px solid #999; font-size: 9pt; }
  .print-insp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 8px 0; }
  .print-insp-cell { border: 1px solid #999; padding: 4px 6px; font-size: 9pt; }
  .print-insp-cell-label { font-weight: bold; font-size: 8pt; color: #555; }
  .print-insp-cell-val   { font-size: 10pt; }
  .print-val-ok  { color: #1565C0; font-weight: bold; }
  .print-val-ng  { color: #b71c1c; font-weight: bold; }
  .print-signature { display: flex; gap: 16px; margin-top: 16px; }
  .print-sign-box {
    flex: 1; border: 1px solid #999; padding: 6px 10px; min-height: 40px;
    font-size: 9pt;
  }
  .print-sign-box-label { font-size: 8pt; color: #555; margin-bottom: 4px; }
}

/* =============================================
   モバイル / タブレット レスポンシブ
   ============================================= */
#mobile-fab { display: none; }
#mobile-drawer        { display: none; }
#mobile-drawer-overlay{ display: none; }

@media (max-width: 768px) {

  /* サイドバーを非表示 */
  #sidebar { display: none; }

  /* アプリ全体を縦積みに */
  #app { flex-direction: column; }

  /* 地図がフル表示 */
  #map-wrap {
    flex: 1; position: relative;
    /* ボトムナビ分の余白 */
    padding-bottom: 0;
  }

  /* FABボタン群（右下） */
  #mobile-fab {
    display: flex; flex-direction: column; gap: 10px;
    position: absolute; bottom: 24px; right: 14px;
    z-index: 600;
  }
  .fab-btn {
    width: 52px; height: 52px; border-radius: 50%;
    border: none; font-size: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,.35);
    display: flex; align-items: center; justify-content: center;
    transition: transform .12s;
  }
  .fab-btn:active { transform: scale(.92); }
  .fab-search { background: #1a6b4a; color: #fff; }
  .fab-add    { background: #2a6db5; color: #fff; }
  .fab-print  { background: #5b4a8a; color: #fff; }
  .fab-menu   { background: #1e2736; color: #c8d0dc; }

  /* ドロワーオーバーレイ */
  #mobile-drawer-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 700;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  #mobile-drawer-overlay.open { opacity: 1; pointer-events: auto; }

  /* ドロワー本体（下からスライドアップ） */
  #mobile-drawer {
    display: flex; flex-direction: column;
    position: fixed; bottom: 0; left: 0; right: 0;
    max-height: 80vh;
    background: #1e2736; color: #c8d0dc;
    border-radius: 18px 18px 0 0;
    z-index: 800;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 -4px 24px rgba(0,0,0,.4);
  }
  #mobile-drawer.open { transform: translateY(0); }

  .mobile-drawer-handle {
    width: 40px; height: 4px; border-radius: 2px;
    background: #3a4a60; margin: 10px auto 0;
    flex-shrink: 0;
  }
  .mobile-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px 8px; flex-shrink: 0;
    border-bottom: 1px solid #2a3547;
    font-size: 14px; font-weight: 700; color: #e8edf3;
  }
  .mobile-drawer-body {
    overflow-y: auto; padding: 12px 16px 24px; flex: 1;
  }
  .mobile-drawer-body::-webkit-scrollbar { width: 4px; }
  .mobile-drawer-body::-webkit-scrollbar-track { background: #1e2736; }
  .mobile-drawer-body::-webkit-scrollbar-thumb { background: #3a4a60; border-radius: 2px; }

  /* モバイル統計バー */
  .mob-stats-row {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 6px; margin-bottom: 14px;
  }
  .mob-stat {
    background: #263248; border-radius: 8px;
    padding: 8px 4px; text-align: center;
    border: 1px solid #2d3a4f;
  }
  .mob-stat-num { font-size: 20px; font-weight: 700; color: #e8edf3; }
  .mob-stat-lbl { font-size: 9px; color: #7a8899; margin-top: 2px; }
  .mob-stat.yellow .mob-stat-num { color: #FFD700; }
  .mob-stat.blue   .mob-stat-num { color: #42A5F5; }
  .mob-stat.red    .mob-stat-num { color: #EF5350; }
  .mob-stat.dark   .mob-stat-num { color: #B0BEC5; }

  /* モバイルセクションタイトル */
  .mob-section-title {
    font-size: 10px; font-weight: 700; letter-spacing: .07em;
    color: #5d7a99; text-transform: uppercase;
    margin: 12px 0 6px; padding-bottom: 4px;
    border-bottom: 1px solid #2a3547;
  }

  /* モバイルレイヤーグリッド */
  .mob-layer-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  }
  .mob-layer-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 5px; padding: 8px 6px;
    background: #263248; border-radius: 8px;
    border: 1px solid #3a4a60;
    font-size: 12px; color: #c8d0dc; cursor: pointer;
    user-select: none;
  }
  .mob-layer-btn input { display: none; }
  .mob-layer-btn:has(input:checked) {
    background: #1a3a5c; border-color: #4d9fff; color: #7ec8ff;
  }

  /* モバイルでの検索パネル（全画面化） */
  .search-panel {
    width: 100%; right: -100%;
    max-width: none;
  }

  /* モバイルでのフォームモーダル */
  #modal-overlay { padding: 0; align-items: flex-end; }
  .modal-wide {
    border-radius: 18px 18px 0 0;
    max-width: 100%;
    max-height: 92vh;
    display: flex; flex-direction: column;
  }
  .modal-body {
    overflow-y: auto; flex: 1;
  }

  /* タッチ向けフォーム要素の拡大 */
  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 11px;
    font-size: 16px; /* iOSズーム防止 */
  }
  .form-btn { padding: 12px 20px; font-size: 14px; }
  .status-card { padding: 12px 8px; }
  .insp-options label { font-size: 14px; gap: 6px; }
  .insp-options input[type=radio] { width: 18px; height: 18px; }

  /* 印刷メニューをフルスクリーン */
  .print-menu {
    top: auto; left: 0; right: 0; bottom: 0;
    transform: none;
    border-radius: 18px 18px 0 0;
    width: 100%; max-width: 100%;
  }
}
