:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  font-family: "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: #c8ddc0;
}

.page {
  position: relative;
  min-height: 100vh;
}

.map-card {
  min-height: 100vh;
}

#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  /* iOS Safari: タイルがoverflow:hiddenを突き抜ける複合バグ対策 */
  -webkit-clip-path: inset(0);
  clip-path: inset(0);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  contain: layout paint;
}

.grayscale-layer {
  filter: grayscale(100%);
}

/* ===== ベースマップ 乗算合成 ===== */
.bm-multiply {
  mix-blend-mode: multiply;
}

/* ─── レイヤコントロール 凡例 ─────────────────── */
.leaflet-control-layers-overlays label:has(.layer-legend) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.lgnd-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.leaflet-control-layers label:has(input:checked) {
  background: rgba(45, 125, 60, 0.09);
  border-radius: 5px;
  color: #1a6030;
  font-weight: 600;
}
.layer-legend {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 6px;
  padding: 4px 0 3px 20px;
  font-size: 9.5px;
  color: #555;
  font-weight: normal;
}
.leaflet-control-layers-overlays label:has(input:checked) .layer-legend {
  display: flex;
}
.lgnd-swatch { display: inline-block; flex-shrink: 0; vertical-align: middle; }
.lgnd-poly   { width: 14px; height: 10px; border-radius: 2px; }
.lgnd-line   { width: 20px; height: 3px;  border-radius: 2px; }

/* ─── ポップアップ ─── */
.forest-popup table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 180px;
}
.forest-popup th {
  text-align: left;
  color: #555;
  font-weight: normal;
  padding: 2px 6px 2px 0;
  white-space: nowrap;
}
.forest-popup td {
  font-weight: bold;
  color: #222;
  padding: 2px 0;
}
.forest-popup .popup-title {
  font-size: 13px;
  font-weight: bold;
  color: #1a6030;
  border-bottom: 1px solid #ccc;
  margin-bottom: 5px;
  padding-bottom: 3px;
}

/* ─── 読み込みインジケーター ─── */
#loadingIndicator {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s;
}
#loadingIndicator.hidden {
  opacity: 0;
  pointer-events: none;
}
#loadingInner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 24px 36px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
#loadingSpinner {
  width: 36px;
  height: 36px;
  border: 4px solid #e0f0e0;
  border-top-color: #2d7a3a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
#loadingText {
  font-size: 14px;
  color: #444;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── レイヤコントロール 見出し ─── */
.lc-section-label {
  font-size: 9px;
  font-weight: 700;
  color: #999;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 2px 2px;
  display: block;
  user-select: none;
}
.lc-section-label:hover { color: #555; }
.lc-section-arrow {
  display: inline-block;
  transition: transform 0.2s;
}
.lc-section-collapsed .lc-section-arrow { transform: rotate(-90deg); }

/* ─── 属性表示チェックボックス ─── */
.leaflet-control-layers-overlays > label {
  display: flex;
  align-items: center;
}
.leaflet-control-layers-overlays > label > div {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.attr-chk-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 6px;
}
.attr-chk {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid #bbb;
  border-radius: 50%;
  cursor: pointer;
  background: #fff;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  background-size: 9px;
  background-repeat: no-repeat;
  background-position: center;
}
.attr-chk:checked {
  background-color: #1565c0;
  border-color: #1565c0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 5l2.5 2.5L8 3' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.attr-chk-txt {
  font-size: 9px;
  color: #aaa;
  white-space: nowrap;
}
.attr-chk:checked + .attr-chk-txt { color: #1565c0; font-weight: 700; }

/* ─── 市町村グループラベル（折り畳み式） ─── */
.lc-group-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: #4a6741;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  margin: 6px -8px 2px;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
}
.lc-group-label:hover { background: #3a5431; }
.lc-group-arrow {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 11px;
  line-height: 1;
}
.lc-group-collapsed .lc-group-arrow { transform: rotate(-90deg); }

/* ─── 気象レイヤチェックボックス ─── */
#wxLayers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 4px 0;
}
.wx-chk-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  color: #444;
  background: #fff;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  user-select: none;
}
.wx-chk-item input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: #0066ff;
  cursor: pointer;
  flex-shrink: 0;
}
.wx-chk-item .ico { font-size: 13px; }
.wx-chk-item.active,
.wx-chk-item:has(input:checked) { background: #eef4ff; border-color: #4488dd; color: #1a5fa0; font-weight: 600; }
.wx-chk-item:hover { background: #f0f4ff; }

/* レイヤコントロール スクロール（PC） */
@media (min-width: 768px) {
  .leaflet-control-layers-expanded {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
}

/* ─── レイヤコントロール 最小化 ─── */
.leaflet-control-layers.lc-hidden { display: none !important; }
.lc-close-btn {
  display: block; width: 100%; text-align: right;
  background: none; border: none; font-size: 14px;
  line-height: 1; padding: 4px 4px 6px; cursor: pointer; color: #555;
  touch-action: manipulation; -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}
.lc-close-btn:hover { color: #000; }
.lc-open-btn {
  position: fixed;
  top: max(10px, calc(env(safe-area-inset-top, 0px) + 10px));
  right: 10px; z-index: 1000;
  background: #fff; border: 2px solid rgba(0,0,0,0.2); border-radius: 4px;
  padding: 6px 12px; font-size: 14px; font-weight: bold; cursor: pointer;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4); display: none;
}
.lc-open-btn:hover { background: #f4f4f4; }

/* ─── ツールボックス ─── */
#tbLayers { padding: 2px 0 4px; }
.tb-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 5px 8px; margin: 2px 0;
  background: #f5f7f5; border: 1px solid #c8d8c8; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: #1e4d2b; text-align: left;
  transition: background 0.15s;
}
.tb-btn:hover  { background: #e0eee0; }
.tb-btn:active { background: #cce0cc; }
.tb-btn .ico   { font-size: 15px; }
.tb-btn.loading { opacity: 0.7; pointer-events: none; }
.tb-btn.active  { background: #d0ecff; border-color: #2979ff; color: #0d47a1; }

/* ─── ベースマップスライダー ─── */
.bm-item { padding: 2px 4px 4px; }
.bm-row  { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #1e4d2b; margin-bottom: 2px; }
.bm-row label { flex: 1; cursor: pointer; }
.bm-pct   { font-size: 11px; color: #888; min-width: 28px; text-align: right; }
.bm-slider { width: 100%; height: 4px; accent-color: #4caf50; cursor: pointer; }
.bm-cs-sel-row { padding: 2px 0 3px; }
.bm-cs-sel { width: 100%; font-size: 12px; padding: 3px 4px; border: 1px solid #ccc; border-radius: 4px; background: #fff; color: #1e4d2b; cursor: pointer; }

/* ─── GPSログコントロール ─── */
.track-ctrl { display: flex; flex-direction: column; gap: 4px; }
.track-btn {
  display: block; width: 100%; padding: 6px 12px;
  background: #fff; border: 2px solid rgba(0,0,0,0.2); border-radius: 4px;
  font-size: 13px; font-weight: bold; cursor: pointer; box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  text-align: left; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  font-family: sans-serif;
}
.track-btn:hover  { background: #f4f4f4; }
.track-btn:active { background: #e8e8e8; }
.track-info {
  background: rgba(229,57,53,0.08); border: 2px solid #e53935; border-radius: 4px;
  padding: 5px 10px; font-size: 12px; font-weight: bold; color: #e53935;
  white-space: nowrap; font-family: sans-serif;
}

/* ─── トースト ─── */
#toast {
  display: none; position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 9999; background: rgba(0,0,0,0.72); color: #fff;
  padding: 8px 18px; border-radius: 20px; font-size: 13px;
  white-space: pre-line; text-align: center; pointer-events: none;
  max-width: calc(100vw - 32px);
}

/* ─── iOS 安全領域 ─── */
.leaflet-top    { padding-top:    env(safe-area-inset-top,    0px); }
.leaflet-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ─── CRS表示 ─── */
.crs-display {
  background: rgba(255,255,255,0.85);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: monospace;
  color: #333;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  white-space: nowrap;
  pointer-events: none;
}
.crs-label {
  font-weight: bold;
  color: #1a6030;
  margin-right: 6px;
}
.crs-coords { color: #444; }

/* ─── モバイル対応 ─── */
@media (max-width: 767px) {
  .leaflet-control-layers {
    max-height: calc(100vh - 120px); max-width: min(240px, calc(100vw - 56px));
    overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
    font-size: 11px !important;
  }
  .leaflet-control-layers-expanded { padding: 4px 8px !important; }
  .leaflet-control-layers label { padding: 1px 0 !important; margin: 0 !important; }
  .leaflet-control-layers input[type="checkbox"],
  .leaflet-control-layers input[type="radio"] { width: 12px; height: 12px; margin-right: 4px; }
  .leaflet-control-layers-separator { margin: 3px 0 !important; }
  .track-btn { font-size: 12px; padding: 5px 10px; }
}

/* ─── Excel連携 統計カード ─── */
#xlsxStatCard {
  display: none; position: fixed; bottom: 56px; left: 50%; transform: translateX(-50%);
  z-index: 8000; background: rgba(230,81,0,0.92); color: #fff;
  border-radius: 20px; padding: 6px 8px 6px 14px;
  font-size: 12px; white-space: nowrap; align-items: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
#xlsxStatClose {
  background: rgba(255,255,255,0.2); border: none; color: #fff;
  font-size: 11px; cursor: pointer; padding: 3px 7px; border-radius: 10px;
}

/* ─── Excel連携 モーダル ─── */
#xlsxModal {
  display: none; position: fixed; inset: 0; z-index: 11000;
  background: rgba(0,0,0,0.45); align-items: center; justify-content: center;
}
#xlsxModal.show { display: flex; }
#xlsxModalBox {
  background: #fff; border-radius: 14px; padding: 20px 20px 16px;
  width: min(340px,calc(100vw - 32px)); box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}
#xlsxModalTitle { font-size: 14px; font-weight: bold; color: #333; margin-bottom: 16px; }
.xlsxRow { margin-bottom: 12px; }
.xlsxLabel { display: block; font-size: 11px; color: #888; margin-bottom: 4px; }
.xlsxRow select {
  width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 8px;
  font-size: 16px; background: #fafafa;
}
#xlsxModalInfo { font-size: 11px; color: #555; margin-bottom: 12px; min-height: 14px; }
.xlsxBtns { display: flex; gap: 8px; justify-content: flex-end; }
.xlsxBtns button { padding: 8px 18px; border-radius: 8px; border: none; font-size: 13px; cursor: pointer; }
.xlsxBtns button:first-child { background: #eee; color: #333; }
.xlsxOk { background: #0066ff; color: #fff; font-weight: bold; }

/* ─── Excel連携 ポップアップ ─── */
table.xl-popup { font-size: 12px; border-collapse: collapse; min-width: 180px; }
table.xl-popup th { color: #666; font-weight: normal; padding: 2px 8px 2px 0; white-space: nowrap; }
table.xl-popup td { padding: 2px 0; }
table.xl-popup .xl-sep { font-size: 10px; color: #aaa; text-align: center; padding: 4px 0; }
table.xl-popup .xl-row th { color: #0066ff; }

/* ─── Excel連携 色分け凡例 ─── */
#xlsxLegend {
  position: fixed; bottom: 80px; left: 12px; z-index: 8000;
  background: rgba(255,255,255,0.92); border-radius: 8px;
  padding: 8px 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.22);
  font-size: 12px; min-width: 90px; backdrop-filter: blur(4px);
}
.xl-leg-title { font-size: 10px; font-weight: 700; color: #555; letter-spacing: 0.04em; margin-bottom: 5px; }
.xl-leg-item  { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; color: #222; }
.xl-leg-sw    { display: inline-block; width: 16px; height: 12px; border-radius: 2px; border: 1px solid #aaa; flex-shrink: 0; }

/* ─── 凡例パネル ─── */
#legend {
  position: fixed;
  bottom: 28px;
  right: 10px;
  background: rgba(255,255,255,0.92);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  font-size: 11px;
  z-index: 800;
  min-width: 110px;
}
#legend h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #1a6030;
}
.lgd-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
}
.lgd-box {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ─── 印刷フレーム ─── */
#printFrame {
  display: none; position: fixed; inset: 0; z-index: 10500;
  pointer-events: none;
}
#printFrame.show { display: block; }
#printFrameBox {
  position: absolute;
  border: 3px dashed #0066ff;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.38);
  box-sizing: border-box; border-radius: 2px;
}
#printFrameBar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: center; align-items: center; gap: 10px;
  padding: 10px 0 max(14px, env(safe-area-inset-bottom));
  pointer-events: auto;
}
#printFrameCancel {
  background: rgba(255,255,255,0.9); color: #333; border: 1px solid #ccc;
  border-radius: 20px; padding: 8px 16px;
  font-size: 13px; font-family: sans-serif; cursor: pointer;
}
#printFrameOrient {
  background: rgba(255,255,255,0.92); border: 1px solid #ccc;
  border-radius: 20px; padding: 5px 14px;
  font-size: 12px; font-family: sans-serif; cursor: pointer;
  font-weight: bold; color: #444;
}
#printFrameNext {
  background: #0066ff; color: #fff; border: none;
  border-radius: 20px; padding: 8px 22px;
  font-size: 13px; font-weight: bold; font-family: sans-serif;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,102,255,0.35);
}
#printFrameLabel {
  position: absolute; top: -28px; left: 0; right: 0;
  text-align: center; font-size: 12px; font-family: sans-serif;
  color: #fff; font-weight: bold; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
#printFrameNorth {
  position: absolute; bottom: 10px; right: 10px;
  background: none; border: none; padding: 0;
  pointer-events: none; line-height: 0;
}

/* ─── 印刷モーダル ─── */
#printModal {
  display: none; position: fixed; inset: 0; z-index: 11000;
  background: rgba(0,0,0,0.45); align-items: center; justify-content: center;
}
#printModal.show { display: flex; }
#printModalBox {
  background: #fff; border-radius: 14px; padding: 20px 20px 16px;
  width: min(340px, calc(100vw - 32px));
  box-shadow: 0 8px 32px rgba(0,0,0,0.22); font-family: sans-serif;
}
#printModalTitle { font-size: 14px; font-weight: bold; color: #333; margin-bottom: 14px; }
#printMapTitle {
  width: 100%; box-sizing: border-box; border: 1px solid #ddd;
  border-radius: 8px; padding: 8px 10px; font-size: 16px; margin-bottom: 10px;
  font-family: sans-serif;
}
#printScaleRow {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 14px; font-family: sans-serif;
}
#printScaleLabel { font-size: 12px; color: #666; font-weight: bold; }
#printScaleSep { font-size: 14px; color: #333; font-weight: bold; white-space: nowrap; }
#printScaleInput {
  width: 110px; border: 1px solid #ddd; border-radius: 8px;
  padding: 7px 8px; font-size: 16px; font-family: sans-serif;
  -moz-appearance: textfield;
}
#printScaleInput::-webkit-outer-spin-button,
#printScaleInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ─── 印刷ヘッダー（@media print で表示） ─── */
#printHeader {
  display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 99999;
  background: #fff; border-bottom: 2px solid #333;
  padding: 8px 16px 6px; font-family: sans-serif;
  flex-direction: column; gap: 4px;
}
#printHeaderTop { display: flex; align-items: center; gap: 12px; }
#printHeaderMapTitle { font-size: 18px; font-weight: bold; color: #111; flex: 1; }
#printHeaderMeta { font-size: 10px; color: #666; white-space: nowrap; }
#printHeaderScale { font-size: 11px; color: #444; font-weight: bold; padding-bottom: 1px; }
#printNorthOnMap { display: none; }
#printMapScale { display: none; }

/* ─── @media print ─── */
@media print {
  #toast, #printFrame, #printModal,
  #xlsxModal, #xlsxStatCard, #xlsxLegend,
  .lc-open-btn, #loadingIndicator,
  .leaflet-control-zoom, .leaflet-control-attribution,
  .leaflet-control-layers, .crs-display { display: none !important; }

  .leaflet-control-scale { display: block !important; }

  html, body { margin: 0; padding: 0; }

  #printHeader {
    display: flex !important;
    position: fixed; top: 0; left: 0; right: 0;
    padding: 6px 12px 5px;
  }
  #map {
    position: fixed !important;
    left: 0 !important; right: 0 !important;
    top: 64px !important;
    width: 100vw !important;
    height: calc(100vh - 64px) !important;
  }
  #printMapScale {
    display: block !important;
    position: fixed; bottom: 12px; left: 12px; z-index: 99999;
    background: rgba(255,255,255,0.92);
    border: 1px solid #bbb; border-radius: 4px;
    padding: 5px 10px; font-size: 12px; font-weight: bold;
    font-family: sans-serif; color: #333;
  }
  #printNorthOnMap {
    display: block !important;
    position: fixed; top: 82px; right: 14px; z-index: 99999;
    background: none; border: none; padding: 0; line-height: 0;
  }
}

/* ─── GeoTIFF ドロップ・カード ─── */
#map.drag-over::after {
  content: '🖼️ ジオタグ写真  /  🗺 GeoTIFF  /  📍 GPX  /  GeoJSON  をドロップ';
  position: absolute; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(41,121,255,0.12);
  border: 3px dashed #2979ff;
  font-size: 18px; font-weight: bold; color: #2979ff;
  pointer-events: none; box-sizing: border-box;
}

#vectorDropCard {
  display: flex; position: fixed; bottom: 90px;
  left: 50%; transform: translateX(-50%);
  z-index: 8000; background: rgba(100,30,120,0.92); color: #fff;
  border-radius: 20px; padding: 6px 8px 6px 14px;
  font-size: 12px; white-space: nowrap; align-items: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
#vectorDropCard button {
  background: rgba(255,255,255,0.22); border: none; color: #fff;
  border-radius: 12px; padding: 3px 10px; font-size: 11px;
  cursor: pointer;
}

#geotiffCard {
  display: flex; position: fixed; bottom: 56px;
  left: 50%; transform: translateX(-50%);
  z-index: 8000; background: rgba(27,94,32,0.92); color: #fff;
  border-radius: 20px; padding: 6px 8px 6px 14px;
  font-size: 12px; white-space: nowrap; align-items: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: padding 0.3s, font-size 0.3s;
}
#geotiffCard button {
  background: rgba(255,255,255,0.22); border: none; color: #fff;
  border-radius: 12px; padding: 3px 10px; font-size: 11px;
  cursor: pointer;
}
#geotiffCard.geotiff-card-mini {
  padding: 7px 11px; font-size: 16px; cursor: pointer; gap: 0;
}

/* ─── ウェイポイント・調査セッション ダイアログ ─── */
.survey-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 12000; display: flex; align-items: center; justify-content: center;
}
.survey-dialog {
  background: #fff; border-radius: 14px; padding: 20px 22px;
  width: min(340px, 90vw); box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  display: flex; flex-direction: column; gap: 12px;
}
.survey-dialog-title { font-size: 15px; font-weight: bold; color: #1a6030; }
.survey-dialog input[type=text] {
  border: 1.5px solid #bdbdbd; border-radius: 8px;
  padding: 8px 10px; font-size: 16px; width: 100%; box-sizing: border-box;
}
.survey-dialog-btns { display: flex; gap: 8px; justify-content: flex-end; }
.survey-dialog-btns button {
  border: none; border-radius: 8px; padding: 7px 16px;
  font-size: 13px; cursor: pointer; background: #e0e0e0; color: #333;
}
.survey-ok { background: #2e7d32 !important; color: #fff !important; }

/* 調査履歴モーダル */
.survey-history-box {
  background: #fff; border-radius: 14px; padding: 18px 18px 14px;
  width: min(420px, 95vw); max-height: 80vh;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.survey-history-title { font-size: 15px; font-weight: bold; color: #1a6030; }
.survey-history-list { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.survey-row {
  border: 1px solid #e0e0e0; border-radius: 10px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.survey-row-info { display: flex; flex-direction: column; gap: 2px; }
.survey-row-info b { font-size: 13px; }
.survey-row-info span { font-size: 11px; color: #666; }
.survey-row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.survey-hbtn {
  border: none; border-radius: 8px; padding: 5px 12px;
  font-size: 12px; cursor: pointer; background: #e8f5e9; color: #1a6030;
}
.survey-del { background: #fbe9e7 !important; color: #c62828 !important; }
.survey-empty { color: #9e9e9e; font-size: 13px; text-align: center; padding: 20px; }

.survey-cur-row {
  display: flex; gap: 6px; align-items: center;
}
.survey-cur-row input[type=text] {
  flex: 1; border: 1.5px solid #bdbdbd; border-radius: 8px;
  padding: 7px 10px; font-size: 16px; box-sizing: border-box;
}
.survey-section-title { font-size: 13px; font-weight: bold; color: #555; margin-top: 4px; }
.survey-new-folder-btn {
  align-self: flex-start; background: #e3f2fd !important; color: #1565c0 !important;
  font-size: 13px; padding: 6px 14px;
}
.survey-folder-sel {
  flex: 1; border: 1.5px solid #bdbdbd; border-radius: 8px;
  padding: 7px 8px; font-size: 16px; background: #fff;
}
.survey-folder-header {
  display: flex; align-items: center; justify-content: space-between;
  background: #f1f8e9; border-radius: 8px; padding: 6px 10px;
  font-size: 13px; font-weight: bold; color: #33691e; margin-top: 4px;
}
.survey-folder-actions { display: flex; gap: 6px; }
.survey-empty-folder { font-size: 12px; color: #9e9e9e; padding: 4px 14px 6px; }
.wpt-camera-label { display: block; cursor: pointer; }
.wpt-camera-btn {
  display: block; text-align: center; width: 100%; box-sizing: border-box;
  background: #e3f2fd !important; color: #1565c0 !important;
  padding: 8px; border-radius: 8px; font-size: 13px;
}

/* ─── カメラ・ポイント・印刷 アクションボタン群 ─── */
.action-ctrl {
  display: flex; flex-direction: column; gap: 4px;
  background: none; border: none; padding: 0;
}
.action-btn {
  display: block;
  width: 30px; height: 30px;
  background: #fff; color: #333;
  border: none; border-radius: 4px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.4);
  font-size: 16px; line-height: 30px;
  text-align: center; cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ─── 色分け機能 ─── */
.lc-colorize-btn {
  background: none; border: none; cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 4px;
  border-radius: 4px; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.lc-colorize-btn:hover { background: rgba(255,255,255,0.2); }

#czModal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
}
#czModalBox {
  background: #fff; border-radius: 12px;
  padding: 20px; min-width: 260px; max-width: 90vw;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; gap: 12px;
}
.cz-modal-title { font-size: 15px; font-weight: 700; color: #2d3c5e; }
.cz-modal-note { font-size: 12px; color: #888; }
#czAttrSel {
  width: 100%; padding: 8px; border: 1px solid #ccc;
  border-radius: 6px; font-size: 13px;
}
.cz-modal-btns {
  display: flex; gap: 8px; justify-content: flex-end;
}
.cz-modal-btns button {
  padding: 7px 14px; border: none; border-radius: 6px;
  font-size: 13px; cursor: pointer;
  background: #eee; color: #333;
}
.cz-apply-btn { background: #1565c0 !important; color: #fff !important; }
.cz-apply-btn:hover { background: #1976d2 !important; }

#czLegend {
  position: fixed; bottom: 80px; left: 12px; z-index: 8000;
  background: rgba(255,255,255,0.95); border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  min-width: 140px; max-width: 220px;
  max-height: 50vh; overflow-y: auto;
  font-size: 12px;
}
.cz-leg-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; font-weight: 700; font-size: 12px; color: #333;
  border-bottom: 1px solid #eee; position: sticky; top: 0;
  background: rgba(255,255,255,0.97);
}
.cz-leg-head button {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: #999; padding: 0 2px;
}
.cz-leg-body { padding: 6px 10px; }
.cz-leg-row {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 0;
}
.cz-leg-sw {
  width: 14px; height: 14px; border-radius: 3px;
  flex-shrink: 0; display: inline-block;
  border: 1px solid rgba(0,0,0,0.15);
}
.cz-leg-lbl { flex: 1; white-space: normal; word-break: break-all; }
.cz-leg-foot {
  padding: 8px 10px; border-top: 1px solid #eee;
  display: flex; gap: 6px;
}
.cz-leg-foot button {
  flex: 1; padding: 6px 4px; border: 1px solid #ccc;
  border-radius: 5px; background: #f5f5f5; cursor: pointer;
  font-size: 11px; color: #555;
}
#czLegRefresh { border-color: #1565c0 !important; color: #1565c0 !important; }

/* ─── ジオタグ写真 ライトボックス ─── */
#lightbox {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.9); z-index: 30000;
  align-items: center; justify-content: center;
  cursor: zoom-out;
}
#lightbox.open { display: flex; }
#lightbox img { max-width: 96vw; max-height: 96vh; border-radius: 8px; object-fit: contain; }
.photo-thumb { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; cursor: zoom-in; display: block; }

/* ─── 業務レイヤセレクター ─── */
.task-sel {
  width: 100%; padding: 6px 8px; margin: 4px 0;
  border: 1px solid #ccc; border-radius: 6px;
  font-size: 12px; color: #333; background: #fff;
  cursor: pointer;
}
.task-sel:focus { outline: none; border-color: #4a6741; }

#taskLayerList { padding: 2px 0 4px; }
.task-layer-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 2px; font-size: 12px; color: #333;
  cursor: pointer; user-select: none;
}
.task-layer-row input[type="checkbox"] {
  width: 13px; height: 13px; cursor: pointer; flex-shrink: 0;
}
.task-layer-sw {
  width: 12px; height: 12px; border-radius: 2px;
  flex-shrink: 0; display: inline-block;
  border: 1px solid rgba(0,0,0,0.2);
}
.task-colorize-btn {
  display: block; width: 100%; margin: 4px 0 6px;
  padding: 5px 8px; font-size: 13px; text-align: left;
  background: rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.15);
  border-radius: 6px; cursor: pointer;
}
.task-colorize-btn:hover { background: rgba(0,0,0,0.1); }
.task-layer-legend {
  display: flex; align-items: center; gap: 5px;
  padding: 1px 2px 1px 20px; font-size: 11px; color: #555;
}
.task-layer-legend-dot {
  width: 10px; height: 10px; border-radius: 2px;
  flex-shrink: 0; border: 1px solid rgba(0,0,0,0.2);
}
.emoji-marker {
  background: none; border: none;
  font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* ===== 連絡掲示板 BBS ===== */
#bbsFloatBtn {
  position: fixed; top: 200px; left: 10px; z-index: 9000;
  background: rgba(255,255,255,0.95); border: 1px solid rgba(0,0,0,0.18);
  border-radius: 20px; padding: 6px 14px; overflow: visible;
  font-size: 12px; font-family: sans-serif; font-weight: bold; color: #333;
  cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.15); white-space: nowrap;
  -webkit-tap-highlight-color: transparent; transition: background .15s, border-color .15s, color .15s;
  user-select: none;
}
#bbsFloatBtn:active { background: #f0f0f0; }
#bbsFloatBtn.active { background: #eef4ff; border-color: #9bbfff; color: #0044cc; }
#bbsBadge {
  position: absolute; top: -5px; right: -5px; width: 14px; height: 14px;
  background: #e53935; border-radius: 50%; border: 2px solid #fff;
  display: none; pointer-events: none;
}
#bbsPanel {
  position: fixed; top: 200px; left: 10px; z-index: 9100;
  background: rgba(255,255,255,0.97); border: 1px solid rgba(0,0,0,0.13);
  border-radius: 14px; display: none; flex-direction: column;
  font-family: sans-serif; box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  width: min(300px, calc(100vw - 56px)); max-height: 70vh; overflow: hidden;
  touch-action: none;
}
#bbsHandle {
  display: flex; align-items: center; padding: 7px 12px 6px;
  background: #f4f4f4; border-radius: 14px 14px 0 0;
  border-bottom: 1px solid #e8e8e8; cursor: grab; user-select: none; gap: 8px;
}
#bbsHandle:active { cursor: grabbing; }
#bbsHandleGrip { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; }
#bbsHandleGrip span { display: block; width: 20px; height: 2px; background: #bbb; border-radius: 1px; }
#bbsPanelTitle { font-size: 11px; color: #888; flex: 1; }
#bbsLogBtn, #bbsRefreshBtn, #bbsClose, #bbsCollapseBtn {
  flex-shrink: 0; width: 22px; height: 22px; background: #ddd; border: none;
  border-radius: 50%; font-size: 12px; line-height: 22px; text-align: center;
  cursor: pointer; color: #666; padding: 0; -webkit-tap-highlight-color: transparent;
}
#bbsLogBtn:active, #bbsRefreshBtn:active, #bbsClose:active, #bbsCollapseBtn:active { background: #bbb; }
#bbsCollapseBtn { font-size: 10px; transition: transform .25s; }
#bbsPanel.collapsed #bbsCollapseBtn { transform: rotate(180deg); }
#bbsBody {
  display: flex; flex-direction: column; overflow: hidden;
  max-height: calc(70vh - 36px); transition: max-height .28s cubic-bezier(.4,0,.2,1);
}
#bbsPanel.collapsed #bbsBody { overflow: hidden; max-height: 0 !important; }
#bbsAuthorBar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  padding: 7px 12px; background: #f9f9f9; border-bottom: 1px solid #eee;
  font-family: sans-serif; flex-shrink: 0;
}
#bbsAuthorBarLabel { font-size: 11px; color: #888; }
#bbsAuthorBarInfo { font-size: 12px; font-weight: bold; color: #333; flex: 1; }
#bbsAuthorEditBtn {
  font-size: 12px; padding: 2px 7px; border: 1px solid #ddd;
  border-radius: 6px; background: #f0f0f0; cursor: pointer;
}
#bbsAuthorEditor {
  display: none; align-items: center; gap: 6px;
  padding: 6px 12px; background: #f9f9f9; border-bottom: 1px solid #eee; flex-shrink: 0;
}
#bbsAuthorInput {
  flex: 1; border: 1px solid #ddd; border-radius: 7px; padding: 5px 8px; font-size: 12px;
}
#bbsAuthorSaveBtn {
  padding: 5px 12px; background: #0066ff; color: #fff; border: none;
  border-radius: 7px; font-size: 12px; font-weight: bold; cursor: pointer;
}
.bbs-pane { overflow-y: auto; padding: 8px 10px 16px; }
#bbsListPane { display: flex; flex-direction: column; overflow: hidden; padding: 0 10px; }
#bbsList { overflow-y: auto; flex: 1; padding-bottom: 16px; }
#bbsNewBtn {
  display: block; width: 100%; padding: 10px; margin: 8px 0 6px; flex-shrink: 0;
  background: #ef6c00; color: #fff; border: none; border-radius: 9px;
  font-size: 13px; font-weight: bold; font-family: sans-serif;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#bbsNewBtn:active { background: #e65100; }
#bbsLoadingMsg, #bbsEmptyMsg { text-align: center; color: #999; font-size: 12px; padding: 24px 0; }
.bbs-card {
  border: 1px solid #eee; border-radius: 8px; padding: 8px 10px; margin-bottom: 8px;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.bbs-card-header { display: flex; align-items: center; gap: 5px; margin-bottom: 5px; flex-wrap: wrap; }
.bbs-cat-badge {
  font-size: 10px; font-weight: bold; padding: 2px 7px; border-radius: 8px; white-space: nowrap;
}
.bbs-time { font-size: 10px; color: #aaa; flex: 1; }
.bbs-icon-btn {
  font-size: 11px; padding: 2px 6px; border: 1px solid #ddd; border-radius: 6px;
  background: #f8f8f8; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.bbs-author { font-size: 10px; color: #666; margin-top: 3px; }
.bbs-comment { font-size: 12px; color: #222; margin-bottom: 5px; line-height: 1.5; white-space: pre-wrap; }
.bbs-photo { max-width: 100%; max-height: 120px; border-radius: 6px; cursor: pointer; display: block; margin-top: 4px; object-fit: cover; }
.bbs-loc { font-size: 10px; color: #888; margin-top: 3px; }
.bbs-type-big-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px;
  margin-bottom: 10px; border: none; border-radius: 12px; font-family: sans-serif;
  font-size: 14px; font-weight: bold; cursor: pointer; -webkit-tap-highlight-color: transparent;
  text-align: left; color: #fff;
}
.bbs-type-big-btn[data-type="notice"]  { background: #1565C0; }
.bbs-type-big-btn[data-type="finding"] { background: #2E7D32; }
.bbs-type-big-btn[data-type="consult"] { background: #6A1B9A; }
.bbs-type-big-btn:active { filter: brightness(.9); }
.bbs-tbig-icon { font-size: 22px; flex-shrink: 0; }
.bbs-tbig-text { display: flex; flex-direction: column; line-height: 1.4; }
.bbs-tbig-text small { font-size: 11px; font-weight: normal; opacity: .9; }
.bbs-back-to-list-btn, .bbs-back-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px;
  margin-bottom: 12px; border: 1px solid #ddd; border-radius: 7px;
  background: #f5f5f5; font-size: 12px; font-family: sans-serif;
  cursor: pointer; -webkit-tap-highlight-color: transparent; color: #555;
}
.bbs-back-btn { margin-bottom: 10px; }
.bbs-back-to-list-btn:active, .bbs-back-btn:active { background: #e8e8e8; }
.bbs-field { margin-bottom: 10px; }
.bbs-field label { display: block; font-size: 10px; color: #888; margin-bottom: 3px; font-weight: bold; }
.bbs-field textarea { width: 100%; box-sizing: border-box; border: 1px solid #ddd; border-radius: 7px; padding: 7px 9px; font-size: 12px; font-family: sans-serif; resize: vertical; }
.bbs-action-btn {
  padding: 6px 12px; border: 1px solid #ccc; border-radius: 7px;
  background: #f5f5f5; font-size: 11px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
#bbsLocStatus { font-size: 10px; color: #888; margin-left: 6px; }
#bbsSubmitBtn {
  width: 100%; padding: 10px; background: #0066ff; color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: bold; cursor: pointer;
}
#bbsSubmitBtn:disabled { background: #aaa; cursor: default; }
#bbsFormStatus { font-size: 11px; color: #888; text-align: center; margin-top: 6px; min-height: 16px; }
/* ログモーダル */
#bbsLogModal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50000; align-items: center; justify-content: center; }
#bbsLogModal.open { display: flex; }
#bbsLogBox { background: #fff; border-radius: 12px; width: 90vw; max-width: 680px; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0,0,0,.3); overflow: hidden; }
#bbsLogModalTitle { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #37474f; color: #fff; font-size: 15px; font-weight: bold; flex-shrink: 0; }
#bbsLogModalClose { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; }
#bbsLogFilterRow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid #eee; flex-shrink: 0; }
#bbsLogFilterRow input[type="date"] { border: 1px solid #ccc; border-radius: 5px; padding: 5px 8px; font-size: 14px; flex: 1; min-width: 120px; }
#bbsLogSearchBtn { background: #37474f; color: #fff; border: none; border-radius: 6px; padding: 6px 16px; font-size: 14px; cursor: pointer; white-space: nowrap; }
#bbsLogCount { padding: 5px 14px; font-size: 12px; color: #666; border-bottom: 1px solid #eee; flex-shrink: 0; }
#bbsLogList { flex: 1; overflow-y: auto; padding: 8px 12px; }
.bbs-log-row { padding: 8px 10px; margin-bottom: 6px; border-radius: 6px; background: #f8f8f8; border-left: 3px solid #999; }
.bbs-log-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.bbs-log-time { font-size: 11px; color: #999; white-space: nowrap; }
.bbs-log-badge { font-size: 11px; color: #fff; border-radius: 3px; padding: 1px 6px; white-space: nowrap; }
.bbs-log-author { font-size: 12px; color: #555; }
.bbs-log-content { font-size: 13px; color: #333; margin-top: 2px; }
#bbsLogFooter { display: flex; justify-content: flex-end; gap: 10px; padding: 10px 14px; border-top: 1px solid #eee; flex-shrink: 0; }
#bbsLogCloseBtn { background: #eee; border: none; border-radius: 6px; padding: 7px 18px; font-size: 14px; cursor: pointer; }
#bbsLogCsvBtn   { background: #2e7d32; color: #fff; border: none; border-radius: 6px; padding: 7px 18px; font-size: 14px; cursor: pointer; }
#bbsLogPrintBtn { background: #1565c0; color: #fff; border: none; border-radius: 6px; padding: 7px 18px; font-size: 14px; cursor: pointer; }
