body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; margin: 0; }
#apMap { position: absolute; top: 62px; left: 0; right: 0; bottom: 80px; z-index: 1; }
.map-footer { position:fixed; bottom:0; left:0; right:0; height:auto; min-height:40px; background:var(--bg2); border-top:1px solid var(--border); display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; z-index:2; padding:6px 16px; }
.map-footer .footer-row { display:flex; align-items:center; justify-content:center; gap:12px; width:100%; flex-wrap:wrap; }
.map-footer .footer-row + .footer-row { border-top:1px solid var(--border); padding-top:6px; margin-top:2px; }
.map-footer .icon-btn { background:none; border:1px solid var(--border); border-radius:6px; color:var(--text2); cursor:pointer; padding:5px 10px; display:inline-flex; align-items:center; gap:5px; font-size:11px; transition:all 0.2s; }
.map-footer .icon-btn:hover { background:var(--bg3); color:var(--text); border-color:var(--text2); }
.map-footer .icon-btn.force-sync-btn:hover { color:var(--primary); border-color:var(--primary); }
.map-footer .icon-btn.logout-btn:hover { color:var(--red); border-color:var(--red); }
.map-footer .icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
.map-footer .icon-btn svg { width:16px; height:16px; display:block; }
.map-footer .sync-status { font-size:10px; color:var(--text2); white-space:nowrap; transition:opacity 0.3s; }
.map-footer .footer-copyright { font-size:10px; color:var(--text2); }
.map-footer .footer-version { font-size:9px; color:var(--text2); opacity:0.5; letter-spacing:1px; }
.map-header { padding: 4px 12px 4px; background: var(--bg2); border-bottom: 1px solid var(--border); position: relative; z-index: 2; }
.map-header .back-link { color: var(--primary); text-decoration: none; font-size: 11px; display: inline-flex; align-items: center; gap: 2px; }
.map-header .back-link:hover { text-decoration: underline; }
.map-header .title-row { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.map-header .title-row span { color: var(--text2); font-weight: 300; }
.map-header .actions-row { display: flex; align-items: center; gap: 6px; }
.map-header .actions-row .stats { font-size: 11px; color: var(--text2); }
.map-header .actions-row .stats strong { color: var(--text); }
.map-header .actions-row .btn { padding: 3px 8px; font-size: 10px; }

.leaflet-container { background: #1a1a2e; }
.leaflet-control-zoom a { background: var(--bg3) !important; color: var(--text) !important; border-color: var(--border) !important; }
.leaflet-control-zoom a:hover { background: var(--card) !important; }
.leaflet-popup-content-wrapper { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; }
.leaflet-popup-tip { background: var(--card); border: 1px solid var(--border); }
.leaflet-popup-content { margin: 10px 14px; font-size: 13px; }
.leaflet-popup-content h3 { font-size: 15px; margin-bottom: 6px; }
.leaflet-popup-content .row { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; font-size: 12px; }
.leaflet-popup-content .row .lbl { color: var(--text2); }
.leaflet-popup-content .row .val { font-weight: 500; }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.marker-disconnected div { animation: blink 1.2s ease-in-out infinite !important; }
.leaflet-marker-icon { border-radius: 50%; text-align: center; line-height: 26px; font-size: 11px; font-weight: 700; color: #fff; border: 2px solid #fff; }
.marker-cluster { background: rgba(59,130,246,0.3); border: 2px solid var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; }
.map-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 1000; text-align: center; }
.map-loading .spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top: 3px solid var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.legend { background: var(--card); padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.coord-modal { position: fixed; inset:0; z-index:9999; background:rgba(0,0,0,0.6); display:flex; align-items:center; justify-content:center; }
.coord-modal.hidden { display:none; }
.coord-panel { background:var(--card); border:1px solid var(--border); border-radius:12px; max-width:600px; width:90%; max-height:80vh; display:flex; flex-direction:column; }
.coord-panel h2 { font-size:16px; font-weight:600; padding:16px 20px; border-bottom:1px solid var(--border); }
.coord-panel .body { overflow-y:auto; padding:12px 20px; flex:1; }
.coord-panel .footer { border-top:1px solid var(--border); padding:12px 20px; display:flex; justify-content:flex-end; gap:8px; }
.coord-row { display:grid; grid-template-columns:1fr 100px 100px 1fr 30px; gap:6px; align-items:center; padding:6px 0; border-bottom:1px solid var(--border); font-size:13px; }
.coord-row .name { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12px; }
.coord-search { width:100%; background:var(--bg3); border:1px solid var(--border); color:var(--text); padding:7px 10px; border-radius:6px; font-size:12px; outline:none; box-sizing:border-box; }
.coord-search:focus { border-color:var(--primary); }
.coord-row input { background:var(--bg3); border:1px solid var(--border); color:var(--text); padding:4px 6px; border-radius:6px; font-size:11px; width:100%; outline:none; box-sizing:border-box; }
.coord-row input:focus { border-color:var(--primary); }
.coord-row .tag-wrap { position:relative; }
.coord-row .tag-wrap input { padding-right:34px; }
.coord-row .tag-add-btn { position:absolute; right:16px; top:50%; transform:translateY(-50%); background:none; border:none; color:var(--primary); cursor:pointer; font-size:12px; padding:0 2px; line-height:1; }
.coord-row .tag-clear-btn { position:absolute; right:2px; top:50%; transform:translateY(-50%); background:none; border:none; color:var(--red); cursor:pointer; font-size:14px; padding:0 2px; line-height:1; opacity:0.6; }
.coord-row .tag-clear-btn:hover { opacity:1; }
.coord-row .del-btn { background:none; border:none; color:var(--red); cursor:pointer; font-size:16px; padding:2px; line-height:1; }
.tag-manage-popup { position:fixed; inset:0; z-index:10000; background:rgba(0,0,0,0.5); display:flex; align-items:center; justify-content:center; }
.tag-manage-popup.hidden { display:none; }
.tag-manage-card { background:var(--card); border:1px solid var(--border); border-radius:12px; max-width:400px; width:90%; padding:20px; }
.tag-manage-card h3 { font-size:15px; font-weight:600; margin-bottom:12px; }
.tag-manage-card .tag-item { display:flex; align-items:center; justify-content:space-between; padding:6px 0; border-bottom:1px solid var(--border); font-size:13px; }
.tag-manage-card .tag-item button { background:none; border:none; color:var(--red); cursor:pointer; font-size:16px; padding:2px 6px; }
.click-hint { position:absolute; bottom:20px; left:50%; transform:translateX(-50%); z-index:1000; background:var(--card); border:1px solid var(--border); border-radius:8px; padding:8px 16px; font-size:12px; color:var(--text2); pointer-events:none; opacity:0; transition:opacity 0.3s; }
.click-hint.show { opacity:1; }

@media (max-width: 768px) {
  body { min-height: 0; }
  .map-header { padding: 2px 8px; }
  .map-header .back-link { font-size: 10px; display: inline-flex; align-items: center; }
  .map-header .back-link svg, .map-header .back-link span { display: inline; }
  .map-header .title-row { font-size: 12px; margin: 0; }
  .map-header .title-row span { font-size: 10px; }
  .map-header .actions-row { flex-wrap: wrap; gap: 2px; margin-top: 2px; }
  .map-header .actions-row .stats { font-size: 10px; }
  .map-header .actions-row .btn { padding: 2px 6px; font-size: 9px; }
  .map-header select { font-size: 10px !important; padding: 2px 4px !important; max-width: 90px !important; }
  #apMap { top: 100px; bottom: 64px; }
  .map-footer { min-height: 32px; padding: 3px 8px; }
  .map-footer .icon-btn { padding: 3px 6px; font-size: 10px; }
  .map-footer .icon-btn svg { width: 14px; height: 14px; }
  .map-footer .footer-row + .footer-row { padding-top: 3px; margin-top: 1px; }
  .map-footer .footer-copyright { font-size: 8px; }
  .map-footer .footer-version { display: none; }
  .map-footer .sync-status { font-size: 9px; }
  .coord-panel { max-width: 100%; width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .coord-panel h2 { font-size: 14px; padding: 12px 16px; }
  .coord-panel .body { padding: 8px 12px; }
  .coord-panel .footer { padding: 10px 16px; }
  .coord-row { grid-template-columns: 1fr 80px 80px 1fr 24px; gap: 4px; font-size: 11px; }
  .coord-row input { font-size: 10px; padding: 3px 4px; }
  .coord-search { font-size: 11px; padding: 5px 8px; }
  .tag-manage-card { max-width: 100%; width: 95%; padding: 14px; }
  .tag-manage-card h3 { font-size: 13px; }
  .tag-manage-card .tag-item { font-size: 12px; }
  .actions-row .icon-btn { font-size: 10px; padding: 2px 6px; }
  .actions-row .icon-btn svg { width: 12px; height: 12px; }
  .leaflet-popup-content { font-size: 11px; margin: 8px 10px; }
  .leaflet-popup-content h3 { font-size: 13px; }
  .leaflet-popup-content .row { font-size: 10px; gap: 8px; }
  .leaflet-control-zoom a { width: 28px !important; height: 28px !important; line-height: 28px !important; font-size: 16px !important; }
}

@media (max-width: 560px) {
  .map-header { padding: 1px 6px; }
  .map-header .back-link { font-size: 9px; }
  .map-header .back-link span.desk-label { display: none; }
  .map-header .title-row { font-size: 11px; }
  .map-header .title-row span { font-size: 9px; }
  .map-header .actions-row .stats { font-size: 9px; }
  .map-header .actions-row:last-child .btn { padding: 1px 5px; font-size: 9px; }
  #apMap { top: 94px; bottom: 56px; }
  .map-footer { min-height: 28px; padding: 2px 4px; }
  .map-footer .icon-btn { padding: 2px 4px; font-size: 9px; }
  .map-footer .icon-btn svg { width: 12px; height: 12px; }
  .map-footer .sync-status { display: none; }
  .map-footer .footer-row { gap: 4px; }
  .map-footer .footer-row + .footer-row { border-top: none; padding-top: 0; }
  .coord-row { grid-template-columns: 1fr 60px 60px 1fr 20px; font-size: 10px; }
  .coord-row input { font-size: 9px; }
  .leaflet-popup-content-wrapper { border-radius: 6px; }
  .leaflet-popup-content { font-size: 10px; margin: 6px 8px; }
  .leaflet-popup-content h3 { font-size: 12px; }
  .leaflet-popup-content .row { font-size: 9px; gap: 4px; }
  .marker-cluster { width: 30px !important; height: 30px !important; font-size: 11px; line-height: 30px !important; }
  .legend { padding: 6px 10px; font-size: 10px; }
}
