/* ══════════════════════════════════════════
   桂林市规划设计研究院 · 一张图平台
   app.css — 完整样式（PC + 移动端）
   Updated to be more mobile friendly.
══════════════════════════════════════════ */

:root {
  --bg: #080d18; --bgp: #0b1220; --bgc: #0f1a2a; --bgd: #13202e;
  --bd: rgba(0,200,180,.14); --bd2: rgba(0,200,180,.32);
  --teal: #00c8b4; --blue: #1a8fff; --gold: #f0b429;
  --pink: #ff5fa0; --grn: #2ecc71; --red: #ff4444; --pur: #a040ff;
  --tp: #ddeef8; --ts: #6a9ab5; --td: #3a5a70;
  --glow: 0 0 18px rgba(0,200,180,.22);
  --shadow: 0 4px 24px rgba(0,0,0,.55);
  --hdr-h: 52px; --tbr-h: 38px; --btm-h: 24px; --cbar-h: 28px;
  --lp-w: 245px; --rp-w: 228px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  background: var(--bg); color: var(--tp);
  height: 100%; display: flex; flex-direction: column;
  overflow: hidden; -webkit-font-smoothing: antialiased;
}

/* ════ LOADING ════ */
.ls {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease;
}
.ls.hide { opacity: 0; pointer-events: none; }
.ls-inner { text-align: center; padding: 20px; }
.ls-hex { animation: spin 4s linear infinite; display: block; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.logo-spin { animation: spin 8s linear infinite; transform-origin: center; transform-box: fill-box; }
.ls-title { font-size: 15px; font-weight: 700; letter-spacing: 2px; color: var(--tp); line-height: 1.7; margin-bottom: 20px; }
.ls-bar-wrap { width: 220px; height: 3px; background: rgba(0,200,180,.15); border-radius: 2px; margin: 0 auto 10px; overflow: hidden; }
.ls-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--blue)); transition: width .3s; }
.ls-status { font-size: 11px; color: var(--td); letter-spacing: 1px; }

/* ════ HEADER ════ */
.hdr {
  height: var(--hdr-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
  background: linear-gradient(90deg, #040a14 0%, #071228 50%, #040a14 100%);
  border-bottom: 1px solid var(--bd); position: relative; z-index: 100; overflow: hidden;
}
.hdr::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--teal), transparent); pointer-events: none; }
.hdr-l { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.menu-btn { display: none; width: 36px; height: 36px; background: transparent; border: 1px solid var(--bd); border-radius: 6px; color: var(--ts); font-size: 18px; cursor: pointer; flex-shrink: 0; align-items: center; justify-content: center; }
.logo-box { position: relative; width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.logo-word { position: absolute; font-size: 11px; font-weight: 700; color: var(--teal); }
.title-wrap { min-width: 0; }
.t-main { font-size: 14px; font-weight: 700; letter-spacing: 2px; background: linear-gradient(90deg, #c8e8f8, #00c8b4 60%, #1a8fff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-sub { font-size: 9px; color: var(--td); letter-spacing: 2px; }
.pc-nav { display: flex; gap: 2px; flex-shrink: 0; }
.pnb { padding: 5px 12px; font-size: 12px; color: var(--ts); background: transparent; border: 1px solid transparent; border-radius: 3px; cursor: pointer; transition: all .2s; letter-spacing: 1px; }
.pnb:hover { color: var(--teal); border-color: var(--bd); }
.pnb.on { color: var(--teal); background: rgba(0,200,180,.07); border-color: var(--teal); box-shadow: var(--glow); }
.hdr-r { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.sys-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grn); box-shadow: 0 0 8px var(--grn); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.hdr-clk { font-size: 11px; color: var(--ts); font-family: monospace; }
.user-tag { padding: 4px 10px; background: rgba(26,143,255,.1); border: 1px solid rgba(26,143,255,.3); border-radius: 4px; font-size: 11px; color: var(--blue); cursor: pointer; white-space: nowrap; }

/* ════ TOOLBAR ════ */
.tbr {
  height: var(--tbr-h); flex-shrink: 0; display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px;
  background: rgba(4,10,20,.95); border-bottom: 1px solid var(--bd); gap: 8px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  position: relative; z-index: 6000;
}
.tbr::-webkit-scrollbar { display: none; }
.tbr-l { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.bm-grp { display: flex; border: 1px solid var(--bd); border-radius: 4px; flex-shrink: 0; position: relative; z-index: 5000; }
.bm-selector { position: static; display: inline-block; z-index: 5001; }
.bm-dropdown {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #0b1220; border: 1px solid rgba(0,200,180,.2);
  border-radius: 8px; color: #6a9ab5; font-size: 12px;
  min-width: 180px; z-index: 99999; display: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  padding: 8px 0;
}
.bm-dropdown.show { display: block; }
.bm-option {
  padding: 12px 16px; cursor: pointer; transition: all .15s;
  border-bottom: 1px solid rgba(0,200,180,.08);
  white-space: nowrap;
  font-size: 13px;
}
.bm-option:last-child { border-bottom: none; }
.bm-option:hover { background: rgba(0,200,180,.15); }
.bm-option.on { color: #00c8b4; font-weight: bold; }
.bmb { padding: 3px 9px; font-size: 10px; color: var(--ts); background: transparent; border: none; border-right: 1px solid var(--bd); cursor: pointer; transition: all .2s; white-space: nowrap; min-height: 28px; position: relative; z-index: 1; }
.bmb:last-child { border-right: none; }
.bmb.on { color: var(--teal); background: rgba(0,200,180,.1); }
.tb { width: 32px; height: 28px; background: transparent; border: 1px solid transparent; border-radius: 3px; cursor: pointer; transition: all .2s; color: var(--ts); font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tb:hover { color: var(--teal); border-color: var(--bd); }
.tb.on { color: var(--teal); border-color: var(--bd2); background: rgba(0,200,180,.08); }
.tb.measuring { color: var(--gold); border-color: var(--gold); background: rgba(240,180,41,.08); }
.gold-btn { width: auto; padding: 0 10px; font-size: 11px; color: var(--gold); border-color: rgba(240,180,41,.3); }
.sep { width: 1px; height: 18px; background: var(--bd); margin: 0 2px; flex-shrink: 0; }
.srch-wrap { display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: rgba(255,255,255,.03); border: 1px solid var(--bd); border-radius: 4px; min-width: 140px; max-width: 220px; flex: 1; }
.srch-wrap:focus-within { border-color: var(--teal); }
.srch-wrap span { color: var(--td); font-size: 11px; flex-shrink: 0; }
.srch-wrap input { background: none; border: none; outline: none; font-size: 11px; color: var(--tp); width: 100%; }
.srch-wrap input::placeholder { color: var(--td); }
.srch-wrap button { background: none; border: none; color: var(--td); cursor: pointer; font-size: 11px; }
.exp-drop { position: absolute; right: 0; top: 32px; background: var(--bgc); border: 1px solid var(--bd); border-radius: 6px; padding: 6px; z-index: 300; display: none; min-width: 140px; box-shadow: var(--shadow); }
.exp-drop.on { display: block; }
.exp-item { display: flex; align-items: center; gap: 7px; padding: 7px 10px; font-size: 11px; color: var(--ts); cursor: pointer; border-radius: 4px; transition: all .2s; }
.exp-item:hover { background: rgba(0,200,180,.08); color: var(--teal); }

/* ════ MAIN LAYOUT ════ */
.main { flex: 1; display: flex; overflow: hidden; position: relative; min-height: 0; }

/* ════ LEFT PANEL ════ */
.lp {
  width: var(--lp-w); flex-shrink: 0;
  background: var(--bgp); border-right: 1px solid var(--bd);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .28s ease; position: relative;
}
.lp.pc-collapsed { width: 0; }
.sheet-handle { display: none; padding: 8px; cursor: grab; flex-shrink: 0; touch-action: none; }
.handle-bar { width: 40px; height: 4px; background: var(--bd); border-radius: 2px; margin: 0 auto; }
.lp-tabs { display: flex; border-bottom: 1px solid var(--bd); flex-shrink: 0; }
.lpt { flex: 1; padding: 9px 2px; font-size: 10px; text-align: center; color: var(--td); cursor: pointer; transition: all .2s; border-bottom: 2px solid transparent; }
.lpt.on { color: var(--teal); border-bottom-color: var(--teal); }
.pt-pane { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.layer-srch { padding: 7px 9px; border-bottom: 1px solid rgba(0,200,180,.06); flex-shrink: 0; }
.layer-srch input { width: 100%; padding: 6px 9px; background: rgba(255,255,255,.03); border: 1px solid var(--bd); border-radius: 3px; font-size: 11px; color: var(--tp); outline: none; transition: border .2s; }
.layer-srch input:focus { border-color: var(--teal); }
.ll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ll::-webkit-scrollbar { width: 3px; }
.ll::-webkit-scrollbar-thumb { background: var(--bd); border-radius: 2px; }
.grp-hdr { display: flex; align-items: center; gap: 6px; padding: 8px 10px; font-size: 11px; color: var(--ts); cursor: pointer; background: rgba(0,200,180,.025); border-left: 2px solid transparent; }
.grp-hdr.open { border-left-color: var(--teal); color: var(--teal); }
.grp-arr { margin-left: auto; font-size: 9px; color: var(--td); transition: transform .2s; }
.grp-hdr.open .grp-arr { transform: rotate(90deg); }
.grp-body { overflow: hidden; transition: max-height .25s ease; }
.litem { display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 18px; font-size: 11px; color: var(--ts); cursor: pointer; border-left: 2px solid transparent; min-height: 38px; }
.litem.on { color: var(--teal); border-left-color: var(--teal); background: rgba(0,200,180,.04); }
.litem.loading { color: var(--gold); }
.litem.err { color: var(--red); }
.lchk { width: 14px; height: 14px; border-radius: 2px; border: 1px solid var(--bd); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; transition: all .2s; }
.lchk.on { background: var(--teal); border-color: var(--teal); color: #000; }
.layer-color { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.lstar { margin-left: auto; font-size: 12px; color: var(--td); transition: color .2s; flex-shrink: 0; padding: 4px; }
.lstar.on { color: var(--gold); }
.lstat { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.l-op { display: none; align-items: center; gap: 6px; padding: 2px 10px 6px 18px; }
.l-op label { font-size: 9px; color: var(--td); }
.l-op input[type=range] { flex: 1; height: 3px; accent-color: var(--teal); cursor: pointer; }
.l-op-val { font-size: 9px; color: var(--teal); width: 28px; font-family: monospace; }

/* Upload */
.upload-panel { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.drop-zone { border: 2px dashed var(--bd); border-radius: 6px; padding: 24px 14px; text-align: center; color: var(--td); cursor: pointer; transition: all .2s; }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--teal); color: var(--teal); background: rgba(0,200,180,.04); }
.tip-box { font-size: 10px; color: var(--ts); line-height: 2; padding: 8px 10px; background: var(--bgd); border-radius: 4px; border: 1px solid rgba(0,200,180,.06); }

/* Tool panel (mark/analysis) */
.tool-panel { padding: 10px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.tool-section-label { font-size: 10px; color: var(--td); letter-spacing: 1px; padding: 2px 0; }
.tool-btn { padding: 10px 12px; background: var(--bgc); border: 1px solid var(--bd); border-radius: 5px; font-size: 11px; color: var(--ts); cursor: pointer; transition: all .2s; text-align: left; font-family: inherit; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px; }
.tool-btn:hover, .tool-btn.active { color: var(--teal); border-color: var(--teal); background: rgba(0,200,180,.06); }
.tool-btn.active { color: var(--gold); border-color: var(--gold); background: rgba(240,180,41,.06); }
.mark-status { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: rgba(240,180,41,.08); border: 1px solid rgba(240,180,41,.3); border-radius: 5px; font-size: 11px; color: var(--gold); margin-top: 4px; }
.mark-status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex-shrink: 0; }
.mark-status button { margin-left: auto; background: none; border: 1px solid rgba(240,180,41,.3); color: var(--gold); border-radius: 3px; padding: 2px 8px; cursor: pointer; font-size: 10px; }
.analysis-result { padding: 10px; background: var(--bgd); border: 1px solid var(--bd); border-radius: 5px; font-size: 10px; color: var(--ts); line-height: 1.9; margin-top: 4px; }
.analysis-result .av { color: var(--teal); font-size: 13px; font-weight: 600; }

/* ════ MAP ════ */
.map-wrap { flex: 1; position: relative; overflow: hidden; min-width: 0; }
#map {
  width: 100%;
  height: 100%;
  background: var(--bgc);
  z-index: 1; /* Set map to lowest interactive layer */
}

/* Leaflet overrides */
.leaflet-container { background: var(--bgc) !important; }
.leaflet-control-zoom { display: none !important; }
.leaflet-control-attribution { background: rgba(8,13,24,.8) !important; color: var(--td) !important; font-size: 9px !important; border: 1px solid var(--bd) !important; border-radius: 3px !important; }
.leaflet-control-attribution a { color: var(--ts) !important; }
.leaflet-popup-content-wrapper { background: rgba(6,12,22,.97) !important; border: 1px solid var(--teal) !important; border-radius: 8px !important; box-shadow: 0 6px 30px rgba(0,0,0,.7), 0 0 20px rgba(0,200,180,.2) !important; color: var(--tp) !important; }
.leaflet-popup-tip { background: rgba(0,200,180,.4) !important; }
.leaflet-popup-close-button { color: var(--td) !important; font-size: 18px !important; top: 6px !important; right: 8px !important; }
.leaflet-popup-close-button:hover { color: var(--red) !important; }
.leaflet-popup-content { margin: 0 !important; min-width: 180px; }

/* Popup styles */
.pop-hdr { background: linear-gradient(135deg, rgba(0,200,180,.12), rgba(26,143,255,.06)); padding: 9px 13px; border-radius: 8px 8px 0 0; border-bottom: 1px solid rgba(0,200,180,.14); }
.pop-title { font-size: 12px; color: var(--teal); font-weight: 700; letter-spacing: 1px; }
.pop-body { padding: 10px 13px; }
.pop-row { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; margin-bottom: 5px; }
.pop-row .pk { color: var(--td); flex-shrink: 0; }
.pop-row .pv { color: var(--tp); font-family: monospace; font-size: 11px; text-align: right; word-break: break-all; }
.pop-tag { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 10px; font-size: 9px; margin: 4px 3px 0 0; }
.pop-acts { display: flex; gap: 6px; margin-top: 8px; padding-top: 7px; border-top: 1px solid rgba(0,200,180,.08); }
.pop-act { flex: 1; padding: 5px; text-align: center; font-size: 10px; border-radius: 4px; cursor: pointer; transition: all .2s; border: 1px solid; min-height: 30px; display: flex; align-items: center; justify-content: center; }
.pop-act.a { color: var(--teal); border-color: rgba(0,200,180,.3); background: rgba(0,200,180,.08); }
.pop-act.b { color: var(--blue); border-color: rgba(26,143,255,.25); background: rgba(26,143,255,.07); }

/* Measure panel (floating) */
.measure-panel {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(6,12,22,.96); border: 1px solid var(--gold);
  border-radius: 8px; padding: 12px 16px; z-index: 50;
  box-shadow: 0 4px 20px rgba(0,0,0,.6), 0 0 15px rgba(240,180,41,.15);
  min-width: 260px; max-width: 340px; width: 90%;
}
.measure-panel-title { font-size: 12px; color: var(--gold); font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.measure-result { font-size: 16px; color: var(--tp); font-weight: 700; font-family: monospace; margin-bottom: 4px; min-height: 24px; }
.measure-hint { font-size: 10px; color: var(--ts); margin-bottom: 10px; min-height: 16px; }
.measure-actions { display: flex; gap: 6px; }
.ma-btn { flex: 1; padding: 7px 4px; background: var(--bgd); border: 1px solid var(--bd); border-radius: 4px; color: var(--ts); font-size: 11px; cursor: pointer; transition: all .2s; font-family: inherit; }
.ma-btn:hover { border-color: var(--teal); color: var(--teal); }
.ma-btn.primary { background: rgba(0,200,180,.12); color: var(--teal); border-color: rgba(0,200,180,.4); }
.ma-btn.danger { background: rgba(255,68,68,.08); color: var(--red); border-color: rgba(255,68,68,.3); }

/* Text input panel */
.text-input-panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(6,12,22,.97); border: 1px solid var(--teal);
  border-radius: 8px; padding: 16px; z-index: 60; width: 280px;
  box-shadow: 0 6px 30px rgba(0,0,0,.7), 0 0 20px rgba(0,200,180,.15);
}
.tip-title { font-size: 12px; color: var(--teal); font-weight: 700; margin-bottom: 10px; }
.text-input-panel input { width: 100%; padding: 8px 10px; background: var(--bgc); border: 1px solid var(--bd); border-radius: 4px; font-size: 13px; color: var(--tp); outline: none; margin-bottom: 10px; }
.text-input-panel input:focus { border-color: var(--teal); }
.tip-actions { display: flex; gap: 8px; }

/* Year compare */
.cmp-wrap { position: absolute; inset: 0; display: none; z-index: 10; pointer-events: none; }
.cmp-wrap.on { display: block; }
.cmp-lbl { position: absolute; top: 14px; padding: 3px 9px; border-radius: 3px; font-size: 10px; pointer-events: none; }
.cmp-lbl.l { left: 10px; background: rgba(0,200,180,.15); color: var(--teal); border: 1px solid rgba(0,200,180,.25); }
.cmp-lbl.r { right: 10px; background: rgba(240,180,41,.12); color: var(--gold); border: 1px solid rgba(240,180,41,.25); }
.cmp-line { position: absolute; top: 0; bottom: var(--cbar-h); width: 2px; background: var(--teal); box-shadow: 0 0 10px var(--teal); left: 50%; transform: translateX(-50%); pointer-events: all; cursor: ew-resize; }
.cmp-hdl { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 32px; height: 32px; background: var(--teal); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #000; font-weight: 700; font-size: 13px; }

/* Map controls */
.map-ctrl { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 5px; z-index: 20; }
.mc { width: 36px; height: 36px; border-radius: 6px; background: rgba(8,14,24,.92); border: 1px solid var(--bd); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ts); font-size: 16px; transition: all .2s; box-shadow: var(--shadow); }
.mc:hover, .mc:active { color: var(--teal); border-color: var(--teal); }
.mc-val { font-size: 10px; text-align: center; color: var(--td); padding: 3px; background: rgba(8,14,24,.85); border: 1px solid var(--bd); border-radius: 3px; font-family: monospace; }

/* Mobile action buttons */
.mob-actions { position: absolute; right: 12px; bottom: calc(var(--cbar-h) + 120px); display: none; flex-direction: column; gap: 8px; z-index: 20; }
.mob-act-btn { width: 42px; height: 42px; border-radius: 50%; background: rgba(8,14,24,.92); border: 1px solid var(--bd); color: var(--ts); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.mob-act-btn:active { color: var(--teal); border-color: var(--teal); }

/* FABs (mobile only) */
.fab-layers {
  display: none; position: absolute;
  right: 12px; bottom: calc(var(--cbar-h) + 8px);
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--teal); border: none; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 4px 16px rgba(0,200,180,.4); z-index: 25; color: #000;
}
.fab-stats {
  display: none; position: absolute;
  right: 78px; bottom: calc(var(--cbar-h) + 8px);
  width: 44px; height: 44px; border-radius: 14px;
  background: rgba(8,14,24,.92); border: 1px solid var(--bd);
  cursor: pointer; align-items: center; justify-content: center;
  box-shadow: var(--shadow); z-index: 25; font-size: 18px;
  bottom: calc(var(--cbar-h) + 14px);
}
.fab-icon { font-size: 18px; line-height: 1; }
.fab-label { font-size: 9px; font-weight: 700; }

/* Layer loading indicator */
.ll-indicator { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(8,14,24,.92); border: 1px solid var(--teal); border-radius: 5px; padding: 6px 14px; z-index: 50; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--teal); box-shadow: var(--glow); white-space: nowrap; }
.ll-spin { width: 14px; height: 14px; border: 2px solid rgba(0,200,180,.3); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }

/* Coord bar */
.cbar { position: absolute; bottom: 0; left: 0; right: 0; height: var(--cbar-h); background: rgba(4,8,16,.96); border-top: 1px solid var(--bd); display: flex; align-items: center; padding: 0 12px; gap: 12px; font-size: 10px; color: var(--td); z-index: 15; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.cv-item { display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.cv { color: var(--ts); font-family: monospace; }
.cs { color: var(--bd); }
.ms-result { margin-left: auto; color: var(--gold); font-family: monospace; font-weight: 600; font-size: 11px; white-space: nowrap; }

/* Timeline */
.timeline { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--cbar-h) + 6px); background: rgba(6,12,22,.94); border: 1px solid var(--bd); border-radius: 6px; padding: 6px 14px; display: flex; align-items: center; gap: 8px; z-index: 15; backdrop-filter: blur(10px); box-shadow: var(--shadow); white-space: nowrap; }
.tl-lbl { font-size: 10px; color: var(--td); }
.yr, [data-y2] { font-size: 11px; color: var(--td); cursor: pointer; padding: 3px 6px; border-radius: 3px; transition: all .18s; border: 1px solid transparent; }
.yr.on, [data-y2].on { color: var(--teal); background: rgba(0,200,180,.1); border-color: rgba(0,200,180,.35); }
.anim-btn { color: var(--ts); cursor: pointer; font-size: 13px; }
.mob-yr-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ════ RIGHT PANEL ════ */
.rp { width: var(--rp-w); flex-shrink: 0; background: var(--bgp); border-left: 1px solid var(--bd); display: flex; flex-direction: column; overflow: hidden; transition: width .28s ease; position: relative; }
.rp.pc-collapsed { width: 0; }
.rp-tabs { display: flex; border-bottom: 1px solid var(--bd); flex-shrink: 0; }
.rpt { flex: 1; padding: 9px 2px; font-size: 10px; text-align: center; color: var(--td); cursor: pointer; transition: all .2s; border-bottom: 2px solid transparent; }
.rpt.on { color: var(--teal); border-bottom-color: var(--teal); }
.rp-pane { flex: 1; overflow-y: auto; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
.rp-pane::-webkit-scrollbar { width: 3px; }
.rp-pane::-webkit-scrollbar-thumb { background: var(--bd); }
.rp-sec { padding: 9px 11px; border-bottom: 1px solid rgba(0,200,180,.06); }
.sec-title { font-size: 10px; color: var(--ts); letter-spacing: 2px; margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.sec-title::before { content: ''; width: 3px; height: 10px; background: var(--teal); border-radius: 2px; flex-shrink: 0; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sc { background: var(--bgc); border: 1px solid var(--bd); border-radius: 5px; padding: 8px 10px; cursor: pointer; transition: all .25s; position: relative; overflow: hidden; }
.sc::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: 5px 5px 0 0; }
.sc.t::before { background: linear-gradient(90deg, var(--pink), transparent); }
.sc.b::before { background: linear-gradient(90deg, var(--blue), transparent); }
.sc.g::before { background: linear-gradient(90deg, var(--gold), transparent); }
.sc.r::before { background: linear-gradient(90deg, var(--red), transparent); }
.sc:hover { transform: translateY(-1px); box-shadow: var(--glow); }
.sc-l { font-size: 9px; color: var(--td); margin-bottom: 3px; }
.sc-v { font-size: 19px; font-weight: 700; font-family: monospace; line-height: 1; }
.sc-v.pink { color: var(--pink); }
.sc-v.blue { color: var(--blue); }
.sc-v.gold { color: var(--gold); }
.sc-v.red { color: var(--red); }
.sc-u { font-size: 9px; color: var(--td); margin-top: 1px; }
.sc-d { font-size: 9px; font-family: monospace; margin-top: 3px; }
.sc-d.up { color: var(--red); }
.sc-d.dn { color: var(--grn); }
.lgd-row { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--ts); margin-bottom: 5px; cursor: pointer; padding: 3px 4px; border-radius: 3px; transition: background .2s; }
.lgd-row:hover { background: rgba(255,255,255,.04); color: var(--tp); }
.lgd-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.lgd-g { margin-left: auto; font-size: 9px; color: var(--td); }
.layer-status-list { display: flex; flex-direction: column; gap: 1px; }
.lsl-item { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--ts); padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.03); }
.lsl-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.lsl-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lsl-cnt { font-size: 9px; color: var(--td); font-family: monospace; }
.al-item { display: flex; align-items: flex-start; gap: 7px; padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,.04); cursor: pointer; border-radius: 3px; transition: background .2s; }
.al-item:hover { background: rgba(255,255,255,.04); }
.al-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
.al-text { font-size: 10px; color: var(--ts); flex: 1; line-height: 1.5; }
.al-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.al-time { font-size: 9px; color: var(--td); font-family: monospace; white-space: nowrap; }
.al-badge { font-size: 8px; padding: 1px 5px; border-radius: 8px; border: 1px solid; white-space: nowrap; }
.tr-row { display: flex; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.03); }
.tr-lbl { font-size: 10px; color: var(--ts); width: 44px; flex-shrink: 0; }
.tr-bar-bg { flex: 1; height: 5px; background: rgba(255,255,255,.06); border-radius: 3px; overflow: hidden; }
.tr-fill { height: 100%; border-radius: 3px; transition: width .7s ease; }
.tr-val { font-size: 10px; color: var(--tp); width: 30px; text-align: right; font-family: monospace; }
.tr-chg { font-size: 9px; width: 34px; text-align: right; font-family: monospace; }

/* ════ BOTTOM ════ */
.bottom { height: var(--btm-h); flex-shrink: 0; background: rgba(4,8,14,.98); border-top: 1px solid var(--bd); display: flex; align-items: center; padding: 0 14px; gap: 14px; font-size: 10px; color: var(--td); }
.b-ok { color: var(--grn); }
.bsep { color: var(--bd); }
.b-clk { margin-left: auto; color: var(--ts); font-family: monospace; font-size: 10px; }

/* ════ TOAST ════ */
.toast { position: fixed; top: 64px; right: 16px; background: var(--bgc); border: 1px solid var(--teal); border-radius: 6px; padding: 10px 16px; font-size: 12px; color: var(--tp); z-index: 9999; display: none; box-shadow: var(--shadow), var(--glow); max-width: 300px; line-height: 1.6; }

/* ════ MODAL ════ */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.75); z-index: 1000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); padding: 16px; }
.modal-bg.on { display: flex; }
.modal-box { background: var(--bgp); border: 1px solid var(--teal); border-radius: 10px; width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 10px 50px rgba(0,0,0,.8), 0 0 40px rgba(0,200,180,.12); }
.modal-hdr { padding: 14px 18px; border-bottom: 1px solid var(--bd); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(90deg, rgba(0,200,180,.07), transparent); flex-shrink: 0; }
.modal-title { font-size: 14px; font-weight: 700; color: var(--teal); letter-spacing: 2px; }
.modal-sub { font-size: 10px; color: var(--ts); margin-top: 2px; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--td); font-size: 20px; line-height: 1; transition: color .15s; }
.modal-close:hover { color: var(--red); }
.modal-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.modal-body::-webkit-scrollbar { width: 3px; }
.modal-body::-webkit-scrollbar-thumb { background: var(--bd); }
.modal-footer { padding: 10px 18px; border-top: 1px solid var(--bd); display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0; }
.wf { display: flex; align-items: center; margin: 12px 0; overflow-x: auto; }
.ws { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; min-width: 70px; }
.ws:not(:last-child)::after { content: ''; position: absolute; top: 16px; left: 58%; width: 84%; height: 1px; background: var(--bd); }
.ws.done:not(:last-child)::after { background: linear-gradient(90deg, var(--teal), var(--bd)); }
.ws-d { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 2px solid var(--bd); color: var(--td); background: var(--bgc); }
.ws.done .ws-d { background: var(--teal); border-color: var(--teal); color: #000; }
.ws.cur .ws-d { background: rgba(0,200,180,.12); border-color: var(--teal); color: var(--teal); box-shadow: 0 0 14px rgba(0,200,180,.3); }
.ws-l { font-size: 9px; color: var(--td); text-align: center; white-space: nowrap; }
.ws.done .ws-l { color: var(--teal); }
.ws.cur .ws-l { color: var(--ts); }
.form-sec-title { font-size: 10px; color: var(--ts); letter-spacing: 2px; margin-bottom: 10px; }
.form-divider { height: 1px; background: rgba(0,200,180,.06); margin: 10px 0; }
.frow { display: flex; gap: 12px; margin-bottom: 11px; }
.fc { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fc label { font-size: 10px; color: var(--td); }
.fc input, .fc select, .fc textarea { background: var(--bgc); border: 1px solid var(--bd); border-radius: 4px; padding: 7px 10px; font-size: 11px; color: var(--tp); font-family: inherit; outline: none; transition: border .2s; width: 100%; }
.fc input:focus, .fc select:focus, .fc textarea:focus { border-color: var(--teal); }
.fc textarea { resize: none; height: 68px; }
.fc select option { background: var(--bgc); }
.fc input[readonly] { color: var(--td); }
.btn-p { padding: 8px 20px; background: var(--teal); color: #000; border: none; border-radius: 4px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; transition: all .2s; }
.btn-s { padding: 8px 16px; background: transparent; color: var(--ts); border: 1px solid var(--bd); border-radius: 4px; font-size: 12px; cursor: pointer; font-family: inherit; }
.btn-w { padding: 8px 16px; background: rgba(240,180,41,.1); color: var(--gold); border: 1px solid rgba(240,180,41,.3); border-radius: 4px; font-size: 12px; cursor: pointer; font-family: inherit; }

/* ════ UTILITIES ════ */
.blink { animation: blink 1.5s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
.pc-only { /* visible on PC */ }
.mob-only { display: none; }

/* ════════════════════════════════════════
   MOBILE STYLES (max-width: 768px)
════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --hdr-h: 48px; --tbr-h: 44px;
    --btm-h: 0px; --cbar-h: 26px;
  }

  /* Header */
  .hdr { padding: 0 10px; gap: 8px; }
  .menu-btn { display: flex !important; }
  .pc-nav { display: none !important; }
  .t-main { font-size: 12px; letter-spacing: .5px; }
  .t-sub { display: none; }
  .user-tag { display: none; }
  .hdr-clk { font-size: 10px; }

  /* Toolbar */
  .tbr { padding: 0 8px; overflow-x: auto; }
  .pc-only { display: none !important; }
  .mob-only { display: flex !important; }
  .bmb { padding: 4px 8px; font-size: 11px; min-height: 32px; }
  .tb { width: 36px; height: 34px; font-size: 14px; }

  /* Main layout: map fills screen */
  .main { flex-direction: row; }

  /* Left panel: bottom sheet */
  .lp {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    width: 100% !important; z-index: 500;
    height: 0; max-height: 75vh;
    border-right: none; border-top: 1px solid var(--bd);
    border-radius: 16px 16px 0 0;
    transition: height .3s cubic-bezier(.4,0,.2,1);
    background: var(--bgp);
    padding-bottom: var(--safe-bottom);
  }
  .lp.mob-open { height: 72vh; }
  .lp .sheet-handle { display: block; }
  .lpt { padding: 10px 2px; font-size: 11px; }

  /* Right panel: bottom sheet */
  .rp {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important;
    width: 100% !important; z-index: 490;
    height: 0; max-height: 70vh;
    border-left: none; border-top: 1px solid var(--bd);
    border-radius: 16px 16px 0 0;
    transition: height .3s cubic-bezier(.4,0,.2,1);
    background: var(--bgp);
    padding-bottom: var(--safe-bottom);
  }
  .rp.mob-open { height: 60vh; }
  .rp .sheet-handle { display: block; }
  .rpt { padding: 11px 2px; font-size: 11px; }

  /* Map full height */
  .map-wrap { height: calc(100vh - var(--hdr-h) - var(--tbr-h)); width: 100%; }

  /* Map controls */
  .map-ctrl { right: 10px; top: auto; bottom: calc(var(--cbar-h) + 180px); transform: none; }
  .mc { width: 40px; height: 40px; font-size: 18px; }
  .mc-val { font-size: 10px; }

  /* FABs visible */
  .fab-layers { display: flex !important; }
  .fab-stats { display: flex !important; }
  .mob-actions { display: flex !important; }

  /* Timeline hidden on mobile (in rp instead) */
  .timeline { display: none !important; }
  .mob-only { display: flex !important; }

  /* Coord bar */
  .cbar { font-size: 10px; gap: 8px; padding: 0 10px; height: var(--cbar-h); }

  /* Bottom bar hidden on mobile */
  .bottom { display: none !important; }

  /* Search */
  .srch-wrap { min-width: 100px; max-width: 150px; }

  /* Measure panel */
  .measure-panel { top: auto; bottom: calc(var(--cbar-h) + 80px); left: 10px; right: 10px; transform: none; width: auto; }

  /* Toast */
  .toast { top: auto; bottom: calc(var(--cbar-h) + 80px); left: 16px; right: 16px; max-width: none; }

  /* Modal */
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal-box { max-height: 92vh; border-radius: 16px 16px 0 0; max-width: 100%; }
  .modal-hdr { padding: 14px 16px; }
  .modal-title { font-size: 13px; }
  .modal-body { padding: 12px 14px; }
  .frow { flex-direction: column; gap: 8px; }
  .wf { overflow-x: auto; }

  /* Stat cards bigger tap targets */
  .sc { padding: 10px; }
  .sc-v { font-size: 22px; }

  /* Popup */
  .leaflet-popup-content-wrapper { max-width: calc(100vw - 40px) !important; }
}

/* ════ SMALL PHONES ════ */
@media (max-width: 390px) {
  .t-main { font-size: 11px; }
  .bmb { padding: 3px 6px; font-size: 10px; }
}

/* ════ LANDSCAPE MOBILE ════ */
@media (max-width: 896px) and (orientation: landscape) and (max-height: 500px) {
  :root { --hdr-h: 40px; --tbr-h: 36px; }
  .lp.mob-open { height: 85vh; max-height: 85vh; }
  .rp.mob-open { height: 75vh; max-height: 75vh; }
  .map-ctrl { bottom: calc(var(--cbar-h) + 60px); }
  .fab-layers { bottom: calc(var(--cbar-h) + 4px); }
  .fab-stats { bottom: calc(var(--cbar-h) + 10px); }
}

/* ════ TABLET ════ */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --lp-w: 210px; --rp-w: 200px; }
  .t-main { font-size: 13px; }
  .pnb { padding: 4px 9px; font-size: 11px; }
}

/* ════ TOUCH: Remove hover flicker ════ */
@media (hover: none) and (pointer: coarse) {
  .litem, .grp-hdr, .tool-btn { -webkit-tap-highlight-color: rgba(0,200,180,.1); }
  .tb:hover { color: var(--ts); border-color: transparent; background: transparent; }
  .mc:hover { color: var(--ts); border-color: var(--bd); }
}
