/* ============================================================
   style.css – MYMAP v2.8.0
   Light Theme: Trắng + Xanh + Viền Vàng
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── VARIABLES ─────────────────────────────────────────────── */
:root {
  --bg-deep:      #f0f4f8;
  --bg-card:      rgba(255, 255, 255, 0.92);
  --bg-glass:     rgba(255, 255, 255, 0.7);
  --bg-glass-hover: rgba(255, 255, 255, 0.9);
  --border:       rgba(234, 179, 8, 0.3);
  --border-focus: rgba(37, 99, 235, 0.6);
  --accent:       #2563eb;
  --accent-light: #3b82f6;
  --accent-glow:  rgba(37, 99, 235, 0.2);
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted:   #94a3b8;
  --success:      #16a34a;
  --error:        #dc2626;
  --info:         #2563eb;
  --gold:         #eab308;
  --gold-light:   #fbbf24;
  --sidebar-w:    360px;
  --radius:       12px;
  --radius-lg:    18px;
  --shadow-card:  0 4px 16px rgba(0,0,0,0.08);
  --transition:   0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; font-family: 'Inter', sans-serif; background: var(--bg-deep); color: var(--text-primary); touch-action: manipulation; }

/* iOS Safari: 100dvh = dynamic viewport (trừ toolbar tự động) */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, textarea, select { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ── LAYOUT ────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ── SIDEBAR ───────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 400;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(234,179,8,0.08));
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: block;
  object-fit: contain;
  box-shadow: 0 4px 15px var(--accent-glow);
  border: 2px solid var(--gold);
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(to right, var(--accent-light), #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .version-badge {
  font-size: 10px;
  background: var(--accent-glow);
  color: var(--accent-light);
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: auto;
  border: 1px solid rgba(37,99,235,0.3);
}

.sidebar-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.sidebar-stats .stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-light);
}

/* Chỉ báo trạng thái kết nối server */
.sync-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  cursor: help;
  transition: all var(--transition);
}

.sync-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #facc15;
  animation: syncBlink 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.sync-status.connected .sync-dot { background: #4ade80; animation: none; }
.sync-status.local-only .sync-dot { background: #facc15; }

.sync-text {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.sync-status.connected .sync-text { color: #4ade80; }
.sync-status.local-only .sync-text { color: #facc15; }

@keyframes syncBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.sidebar-toolbar {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.toolbar-btn {
  flex: 1;
  min-width: 80px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.toolbar-btn:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

.toolbar-btn.btn-export { color: var(--success); border-color: rgba(74,222,128,0.2); }
.toolbar-btn.btn-import { color: var(--info); border-color: rgba(96,165,250,0.2); }

/* Tìm kiếm & lọc */
.sidebar-filters {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.search-wrapper {
  position: relative;
}
.search-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}
.search-wrapper input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition);
}
.search-wrapper input:focus {
  outline: none;
  border-color: var(--border-focus);
}
.search-wrapper input::placeholder { color: var(--text-muted); }

/* ── Toggle Cá nhân / Cộng đồng (inline) ──────────────── */
.mode-toggle-btn {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  white-space: nowrap;
  flex-shrink: 0;
}
.mode-toggle-btn:hover {
  background: rgba(99, 102, 241, 0.2);
}
.mode-toggle-btn.community {
  background: rgba(74, 222, 128, 0.1);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.25);
}
.mode-toggle-btn.community:hover {
  background: rgba(74, 222, 128, 0.2);
}

/* ── Preview marker khi long press ──────────────────── */
@keyframes pinDrop {
  0% { transform: translateY(-20px); opacity: 0; }
  60% { transform: translateY(2px); opacity: 1; }
  80% { transform: translateY(-4px); }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes pinFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes shadowPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.6); opacity: 0.15; }
}
.pin-preview-marker {
  z-index: 800 !important;
  pointer-events: none;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}
.pin-preview-drop {
  animation: pinDrop 0.4s ease-out forwards, pinFloat 1.5s ease-in-out 0.4s infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.pin-preview-shadow {
  width: 14px; height: 6px;
  background: rgba(0,0,0,0.3);
  border-radius: 50%;
  margin: 0 auto;
  animation: shadowPulse 1.5s ease-in-out infinite;
}

#filter-type {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--transition);
}
#filter-type:focus { outline: none; border-color: var(--border-focus); }
#filter-type option { background: #ffffff; }

/* Nút toggle bộ lọc nâng cao */
.filter-row-main {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filter-row-main .search-wrapper { flex: 1; }

.btn-filter-toggle {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  gap: 3px; font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-filter-toggle:hover,
.btn-filter-toggle.active {
  background: rgba(37,99,235,0.15);
  border-color: var(--border-focus);
  color: var(--accent-light);
}
.filter-chevron {
  font-size: 10px;
  transition: transform 0.25s ease;
}
.btn-filter-toggle.active .filter-chevron {
  transform: rotate(180deg);
}

/* Bộ lọc nâng cao – mặc định ẩn, hiện khi .open */
.filter-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
  overflow: hidden;
}
.filter-collapse > * { min-height: 0; }
.filter-collapse.open {
  grid-template-rows: 1fr;
}
.filter-collapse-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  min-height: 0;
}

/* Lọc theo giá */
.price-filter-wrap {
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.price-filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.price-filter-label i { font-size: 11px; color: var(--accent-light); }
.price-filter-label span { flex: 1; }
#btn-clear-price {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 11px; padding: 0 2px;
  transition: color var(--transition);
}
#btn-clear-price:hover { color: var(--error); }
.price-filter-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;  /* Ngăn overflow */
}
.price-filter-inputs input {
  flex: 1;
  min-width: 0;      /* Fix flex overflow – không để input stretch vượt container */
  width: 0;          /* Buộc flex tính lại */
  padding: 6px 8px;
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--transition);
}
.price-filter-inputs input:focus { border-color: var(--border-focus); }
.price-filter-inputs input::placeholder { color: var(--text-muted); }
.price-sep { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }

/* ── PRICE STATS PANEL ──────────────────────────────── */
.price-stats {
  margin: 0 10px 4px;
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(59,130,246,0.06));
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 10px;
  padding: 8px 10px;
  flex-shrink: 0;
}
.stats-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
}
.stats-header i { color: var(--accent-light); font-size: 11px; }
.stats-count {
  margin-left: auto;
  font-size: 10px;
  background: rgba(37,99,235,0.2);
  color: var(--accent-light);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  background: rgba(0,0,0,0.2);
  border-radius: 7px;
  padding: 5px 4px;
}
.stat-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stat-val {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  word-break: break-all;
}
.stat-avg-val  { color: var(--accent-light); }
.stat-low-val  { color: var(--success); }
.stat-high-val { color: var(--error); }

/* ── PRICE ZONE OVERLAY ─────────────────────────────── */
.zone-icon { background: transparent; border: none; }

/* Bỏ nền Leaflet mặc định trên DivIcon wrapper */
.zone-marker-icon,
.zone-marker-icon:focus {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.zone-label {
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
  text-align: center;
  pointer-events: none;
  display: inline-block;
  white-space: nowrap;
}
.zl-name {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9), 0 0 6px rgba(0,0,0,0.7);
  margin-bottom: 3px;
  white-space: nowrap;
}
.zl-count { font-size: 9px; color: #ddd; margin-bottom: 3px; text-shadow: 0 1px 3px rgba(0,0,0,0.9); }
.zl-avg   { font-size: 11px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.9); }
.zl-avg b { color: #a78bfa; font-weight: 700; }
.zl-range { font-size: 9px; color: #bbb; margin-top: 1px; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
.zl-ppm2  { font-size: 9px; color: #6ee7b7; margin-top: 1px; text-shadow: 0 1px 2px rgba(0,0,0,0.9); }

/* Dòng 2: stats gộp TB · min–max · /m² */
.zl-stats  {
  font-size: 10px; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  margin-top: 2px; white-space: nowrap;
}
.zl-stats b { color: #a78bfa; }

/* Số ghim nhỏ trong tên xã */
.zl-cnt { font-size: 9px; opacity: 0.75; font-weight: 400; }

/* Variant: chỉ tên xã (không có pin) – chỉ thu nhỏ chữ */
.zone-label--empty .zl-name {
  font-size: 9px;
  opacity: 0.65;
}
/* Variant: có pin – không cần thêm gì (text-shadow đủ) */

/* Loading toast trên map */
.zone-toast {
  position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(255,255,255,0.95); border: 1px solid rgba(37,99,235,0.3);
  color: var(--text-primary); font-size: 12px; font-weight: 500;
  padding: 6px 16px; border-radius: 20px; z-index: 900;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  white-space: nowrap;
}

/* Danh sách pin */
#pin-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px;
  display: block;   /* KHÔNG dùng flex – flex làm card bị shrink thay vì scroll */
}

#pin-list::-webkit-scrollbar { width: 5px; }
#pin-list::-webkit-scrollbar-track { background: transparent; }
#pin-list::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.35); border-radius: 4px; }

/* Phân trang danh sách pin */
.pin-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 0 4px;
  flex-shrink: 0;
}
.pgn-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.pgn-btn:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.pgn-btn:disabled { opacity: .35; cursor: not-allowed; }
.pgn-info { font-size: 13px; font-weight: 600; color: var(--text-secondary); min-width: 52px; text-align: center; }

/* Empty state */
#empty-state {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}
#empty-state .empty-icon { font-size: 48px; opacity: 0.4; }
#empty-state p { font-size: 14px; line-height: 1.6; }

/* Pin card */
.pin-card {
  margin-bottom: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.pin-card:hover,
.pin-card.active {
  border-color: rgba(37,99,235,0.4);
  background: var(--bg-glass-hover);
  transform: translateX(3px);
  box-shadow: 0 4px 20px rgba(37,99,235,0.15);
}

.pin-card-img {
  width: 60px;
  min-width: 60px;
  position: relative;
  overflow: hidden;
  background: rgba(0,0,0,0.03);
}

.pin-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.no-img-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
}

.pin-card-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 7px;
  font-weight: 600;
  color: #000;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 56px;
}

.pin-card-body {
  flex: 1;
  padding: 6px 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.pin-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-card-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pin-card-badge-inline {
  font-size: 8px;
  font-weight: 600;
  color: #000;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.pin-card-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-light);
}

.pin-card-note {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-card-coords {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: auto;
}

.pin-card-actions {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 5px;
  justify-content: center;
}

.btn-icon {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  transition: all var(--transition);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-icon:hover { transform: scale(1.1); }
.btn-edit:hover { background: rgba(37,99,235,0.2); color: var(--accent-light); border-color: var(--accent); }
.btn-delete:hover { background: rgba(248,113,113,0.2); color: var(--error); border-color: var(--error); }

/* ── MAP ───────────────────────────────────────────────────── */
#map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Hint bar – nút toggle chế độ ghim ở cuối bản đồ */
#map-hint {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 8px 22px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  z-index: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  animation: floatUp 4s ease-in-out infinite;
}

#map-hint:hover {
  background: rgba(37,99,235,0.25);
  border-color: var(--accent);
  color: var(--accent-light);
  animation: none;
  transform: translateX(-50%) translateY(-2px);
}

/* Trạng thái ACTIVE – chế độ ghim đang bật */
#map-hint.active {
  background: rgba(139, 92, 246, 0.3);
  border-color: var(--accent);
  color: var(--accent-light);
  animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4); transform: translateX(-50%); }
  50%       { box-shadow: 0 0 0 8px rgba(37,99,235,0);  transform: translateX(-50%) translateY(-3px); }
}

@keyframes floatUp {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.75; }
  50% { transform: translateX(-50%) translateY(-5px); opacity: 1; }
}

/* Long press – đang giữ */
#map-hint.holding {
  background: rgba(139, 92, 246, 0.3);
  border-color: var(--accent);
  color: var(--accent-light);
  animation: none;
  transform: translateX(-50%);
  overflow: hidden;
}

/* Long press – ghim thành công */
#map-hint.success {
  background: rgba(74, 222, 128, 0.3);
  border-color: var(--success);
  color: var(--success);
  animation: none;
  transform: translateX(-50%);
}

/* Cursor bản đồ theo mode */
#map.pin-mode-on  { cursor: crosshair !important; }
#map.pin-mode-off { cursor: grab !important; }
#map.pin-mode-off:active { cursor: grabbing !important; }

/* Quy hoạch row – viền cam nhấn mạnh */
.view-option-planning {
  border-top: 1px solid rgba(251,146,60,0.2);
  background: linear-gradient(to right, rgba(251,146,60,0.05), transparent);
}
.view-option-planning .view-option-label { color: #fb923c; }

/* Toggle sidebar (mobile) */
#btn-toggle-sidebar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  width: 40px; height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 16px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
}
#btn-toggle-sidebar:hover { background: var(--bg-glass-hover); }

@keyframes pinPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(37,99,235,0.2), var(--shadow-card); }
  50%       { box-shadow: 0 0 0 6px rgba(37,99,235,0.1), var(--shadow-card); }
}

.pin-mode-icon { font-size: 16px; line-height: 1; }
.pin-mode-label { letter-spacing: 0.2px; }

/* Cursor bản đồ theo mode */
#map.pin-mode-on  { cursor: crosshair !important; }
#map.pin-mode-off { cursor: grab !important; }
#map.pin-mode-off:active { cursor: grabbing !important; }


/* ── NÚT VIEW ───────────────────────────────────────────────── */
#btn-view-toggle {
  position: absolute;
  top: 54px;
  right: 10px;
  z-index: 500;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 15px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  cursor: pointer;
}

#btn-view-toggle:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: rgba(96,165,250,0.4);
}

#btn-view-toggle.open {
  background: rgba(96,165,250,0.2);
  border-color: var(--info);
  color: var(--info);
}

/* ── VIEW PANEL ─────────────────────────────────────────────── */
#view-panel {
  position: absolute;
  top: 100px;
  right: 10px;
  z-index: 500;
  width: 240px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  overflow: hidden;
  /* Ẩn mặc định */
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#view-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.view-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(96,165,250,0.12), rgba(37,99,235,0.08));
  font-size: 12px;
  font-weight: 700;
  color: var(--info);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.view-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background var(--transition);
}

.view-option:last-child { border-bottom: none; }

.view-option:hover {
  background: var(--bg-glass-hover);
}

.view-option-icon { font-size: 15px; flex-shrink: 0; }

.view-option-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.view-option-label {
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}

.view-option-desc {
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
}

/* ── TOGGLE SWITCH ──────────────────────────────────────────── */
.view-switch-wrap {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.view-switch-wrap input {
  opacity: 0;
  width: 0; height: 0;
  position: absolute;
}

.view-switch {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.2s ease;
}

.view-switch::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.view-switch-wrap input:checked + .view-switch {
  background: var(--accent);
  border-color: var(--accent);
}

.view-switch-wrap input:checked + .view-switch::before {
  transform: translateX(16px);
}


/* Wrapper 0×0 do Leaflet tạo ra: phải overflow:visible để marker hiển thị */
.leaflet-custom-icon {
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
}

.custom-marker {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  /*
   * FIX v1.1.1 – Zoom anchor chính xác:
   * iconAnchor:[0,0] → Leaflet đặt góc trên-trái wrapper TẠI lat/lng pixel.
   * translate(-50%, -100%) → dịch trái 50% chiều rộng bản thân + lên 100% chiều cao bản thân.
   * Kết quả: bottom-center của .custom-marker (tip của tail) luôn khớp với lat/lng ở mọi zoom.
   */
  transform: translate(-50%, -100%);
}

.marker-price {
  background: var(--marker-color, #8b5cf6);
  color: #000;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.3);
  animation: markerPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.marker-dot {
  width: 8px; height: 8px;
  background: var(--marker-color, #8b5cf6);
  border-radius: 50%;
  margin-top: -1px;
}

.marker-tail {
  width: 2px; height: 14px;
  background: var(--marker-color, #8b5cf6);
  margin-top: -1px;
  border-radius: 0 0 2px 2px;
}

@keyframes markerPop {
  from { transform: scale(0) translateY(-10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ── LEAFLET POPUP ─────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
.leaflet-popup-tip-container { display: none; }

.pin-popup {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 240px;
  max-width: 300px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  animation: popupIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Layout có ảnh: ảnh trên + body dưới */
.pin-popup.has-img {
  display: flex;
  flex-direction: column;
  min-width: 260px;
  max-width: 300px;
}

@keyframes popupIn {
  from { transform: scale(0.8) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Ảnh banner trên popup */
.popup-thumb {
  flex-shrink: 0;
  width: 100%;
  height: 120px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.popup-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
.popup-thumb:hover img { transform: scale(1.05); }
.popup-thumb-zoom {
  position: absolute;
  bottom: 6px; right: 6px;
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.5);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10px;
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.popup-thumb:hover .popup-thumb-zoom { opacity: 1; }

/* Địa chỉ compact 1 dòng */
.popup-addr-compact {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 3px 0;
}
.popup-addr-compact i { color: var(--accent-light); margin-right: 4px; font-size: 10px; }

.popup-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.popup-header-row .popup-name { margin-bottom: 0; }

/* Lightbox overlay xem ảnh gốc */
#img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 0.2s ease;
}
#img-lightbox.show { display: flex; }
#img-lightbox img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 80px rgba(0,0,0,0.6);
  animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#img-lightbox .lightbox-close {
  position: absolute;
  top: 20px; right: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
#img-lightbox .lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* Ẩn popup-img cũ (backward compat) */
.popup-img { display: none; }

.popup-body { padding: 16px; }

.popup-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #000;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}

.popup-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.popup-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-light);
  margin-bottom: 8px;
}

.popup-note {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.popup-sale {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-light);
  background: rgba(37,99,235,0.1);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  margin-bottom: 4px;
}
.popup-sale i { font-size: 11px; opacity: 0.8; }

.pin-card-sale {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--accent-light);
  margin-top: 4px;
  opacity: 0.85;
}
.pin-card-sale i { font-size: 10px; }

.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.popup-btn {
  flex: 1;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
}

.btn-edit-popup {
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent);
  border: 1px solid rgba(37, 99, 235, 0.2);
}
.btn-edit-popup:hover {
  background: rgba(37,99,235,0.35);
  transform: translateY(-1px);
}

.btn-delete-popup {
  background: rgba(248,113,113,0.15);
  color: var(--error);
  border: 1px solid rgba(248,113,113,0.25);
}
.btn-delete-popup:hover {
  background: rgba(248,113,113,0.3);
  transform: translateY(-1px);
}

/* Share buttons */
.popup-share-row { margin-top: 4px !important; }
.popup-share-row .popup-btn { font-size: 11px; padding: 6px; font-weight: 500; }

.btn-share-gmap {
  background: rgba(74,222,128,0.12);
  color: var(--success);
  border: 1px solid rgba(74,222,128,0.25);
}
.btn-share-gmap:hover { background: rgba(74,222,128,0.25); transform: translateY(-1px); }

.btn-share-link {
  background: rgba(96,165,250,0.12);
  color: var(--info);
  border: 1px solid rgba(96,165,250,0.25);
}
.btn-share-link:hover { background: rgba(96,165,250,0.25); transform: translateY(-1px); }

/* Diện tích & giá/m² */
.price-per-m2 {
  font-size: 13px; color: var(--success); font-weight: 600;
  padding: 6px 12px; margin-top: 4px;
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.15);
  border-radius: 8px; text-align: center;
}
.popup-area {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 6px;
}
.popup-ppm2 { color: var(--success); font-weight: 600; }
.pin-card-area {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}

/* ── MODAL ─────────────────────────────────────────────────── */
#pin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  padding: 20px;
}

#pin-modal.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: rgba(255,255,255,0.98);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(37,99,235,0.1);
  animation: modalSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlide {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box::-webkit-scrollbar { width: 4px; }
.modal-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(37,99,235,0.1), rgba(59,130,246,0.05));
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 700;
}

#modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
#modal-close:hover { background: rgba(248,113,113,0.2); color: var(--error); border-color: rgba(248,113,113,0.3); }

#pin-coords {
  padding: 5px 18px;
  font-size: 11px;
  color: var(--accent-light);
  background: rgba(37,99,235,0.07);
  border-bottom: 1px solid var(--border);
}

/* Address block compact */
#address-block { padding: 4px 18px; border-bottom: 1px solid var(--border); }
.addr-oneline {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addr-oneline strong { color: var(--text-secondary); font-weight: 500; }

.modal-body {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control option { background: #ffffff; }
textarea.form-control { resize: vertical; min-height: 60px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Price input */
.price-wrapper {
  position: relative;
}
.price-wrapper .currency-symbol {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-light);
  font-weight: 700;
  font-size: 13px;
  pointer-events: none;
}
.price-wrapper input { padding-right: 40px; }

/* Image upload */
#image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  min-height: 80px;
}
#image-upload-area:hover,
#image-upload-area.drag-over {
  border-color: var(--border-focus);
  background: rgba(37,99,235,0.05);
}
#image-upload-area.drag-over { border-style: solid; }

#image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  color: var(--text-muted);
  text-align: center;
  min-height: 80px;
}
#image-placeholder i { font-size: 22px; }
#image-placeholder span { font-size: 11px; }

/* Image preview grid – nhiều ảnh */
#image-preview {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 8px;
}
.preview-thumb {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1;
}
.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preview-remove {
  position: absolute;
  top: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(248,113,113,0.85);
  color: #fff;
  border: none;
  font-size: 12px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.preview-remove:hover { background: var(--error); }

/* Sidebar card image count badge */
.pin-card-img { position: relative; }
.pin-card-img-count {
  position: absolute;
  bottom: 3px; right: 3px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
}

/* Lightbox prev/next/counter */
.lightbox-prev, .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 10001;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.3); }
.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.8);
  font-size: 14px; font-weight: 500;
  background: rgba(0,0,0,0.4);
  padding: 4px 14px;
  border-radius: 20px;
}

/* Popup thumb zoom badge – hiện số lượng ảnh */
.popup-thumb-zoom span {
  font-size: 9px; font-weight: 700;
  margin-left: 3px;
}

#btn-remove-image {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(248,113,113,0.8);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
#btn-remove-image:hover { background: var(--error); }

#pin-image { display: none; }

/* Modal footer */
.modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
}

.btn-cancel {
  flex: 1;
  padding: 11px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-cancel:hover { background: var(--bg-glass-hover); color: var(--text-primary); }

.btn-save {
  flex: 2;
  padding: 11px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: white;
  border: none;
  transition: all var(--transition);
  box-shadow: 0 4px 15px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 25px var(--accent-glow);
  filter: brightness(1.1);
}

/* ── TOAST ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  opacity: 0;
  transform: translateX(40px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 220px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success { border-color: rgba(74,222,128,0.3); }
.toast-error   { border-color: rgba(248,113,113,0.3); }
.toast-info    { border-color: rgba(96,165,250,0.3); }
.toast-icon    { font-size: 16px; }

/* ── LEAFLET OVERRIDES ─────────────────────────────────────── */
.leaflet-control-layers {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  backdrop-filter: blur(12px) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card) !important;
}

/* Nút toggle (icon 📚) của Leaflet layer control – đồng nhất với #btn-view-toggle */
.leaflet-control-layers-toggle {
  width: 36px !important;
  height: 36px !important;
  background-size: 20px 20px !important;
  border-radius: 8px !important;
}

.leaflet-control-layers-selector + span {
  color: var(--text-primary) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
}

.leaflet-touch .leaflet-bar {
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border) !important;
}

.leaflet-bar a:hover {
  background: var(--bg-glass-hover) !important;
}

.leaflet-control-scale-line {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(255,255,255,0.2) !important;
  color: var(--text-secondary) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 11px !important;
}

/* ── ADDRESS BLOCK (modal) ─────────────────────────────────── */
#address-block {
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(37,99,235,0.04);
}

#address-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0;
}

.addr-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(37,99,235,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#address-detail { display: none; }

.addr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12.5px;
  line-height: 1.4;
}

.addr-icon { flex-shrink: 0; font-size: 13px; }

.addr-label {
  flex-shrink: 0;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 88px;
  font-size: 11.5px;
}

.addr-val {
  color: var(--text-primary);
  font-weight: 500;
}

/* ── POPUP ADDRESS ─────────────────────────────────────────── */
.popup-address {
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.popup-addr-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.popup-addr-row span:first-child { flex-shrink: 0; font-size: 13px; }
.popup-addr-row span:last-child  { flex: 1; }

/* Card địa chỉ trong sidebar */
.pin-card-addr {
  font-size: 11px;
  color: var(--accent-light);
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Filter row layout ──────────────────────────────────── */
.filter-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-row-main .search-wrapper { flex: 1; }

/* Nút toggle bộ lọc nâng cao */
.btn-filter-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-filter-toggle:hover { border-color: var(--accent-light); color: var(--accent-light); }
.btn-filter-toggle.active { border-color: var(--accent-light); color: var(--accent-light); background: rgba(37,99,235,0.12); }

.filter-chevron {
  font-size: 10px;
  transition: transform 0.25s ease;
}
.btn-filter-toggle.active .filter-chevron { transform: rotate(180deg); }

/* Bộ lọc nâng cao – desktop: luôn hiện (grid 0fr→1fr chỉ dùng khi cần) */

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Toggle button: fixed trên cùng, luôn nổi trên sidebar */
  #btn-toggle-sidebar {
    display: flex;
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: 12px;
    z-index: 700;
  }

  /* Sidebar: trượt từ trái, z-index cao hơn map
     overflow:hidden → chỉ #pin-list cuộn, header/filter đứng yên */
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 85%;
    max-width: 340px;
    min-width: unset;
    z-index: 600;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #sidebar.open { transform: translateX(0); }

  /* Mobile: pin-list cuộn giống desktop */
  #pin-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Backdrop */
  #sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 590;
    backdrop-filter: blur(3px);
  }
  #sidebar-backdrop.show {
    display: block;
    animation: fadeIn 0.2s ease;
  }

  /* ── Mobile controls: chỉ cần margin nhỏ (map container đã fill đúng viewport) ── */

  /* Hint bar (nút ghim) */
  #map-hint {
    bottom: 20px;
    padding: 7px 16px;
    font-size: 11px;
  }

  /* Zoom controls Leaflet – giữ vị trí mặc định, không thêm offset */

  /* Scale control – giữ mặc định */

  /* Layer control (top-right) */
  .leaflet-top.leaflet-right {
    top: env(safe-area-inset-top, 0px) !important;
    right: env(safe-area-inset-right, 0px) !important;
  }

  /* Nút VIEW – dưới layer control */
  #btn-view-toggle {
    top: calc(56px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
  }

  /* View panel */
  #view-panel {
    top: calc(102px + env(safe-area-inset-top, 0px));
    right: calc(10px + env(safe-area-inset-right, 0px));
  }

  /* Toast container */
  #toast-container {
    bottom: 20px;
    right: 12px;
    left: 12px;
  }

  /* Compact header mobile */
  .sidebar-header { padding: 10px 12px 8px; }
  .sidebar-logo { font-size: 1rem; }
  .sidebar-user { font-size: 11px; padding: 4px 0; }
  .sidebar-stats { font-size: 11px; }
  .sidebar-toolbar { padding: 6px 10px; gap: 6px; }
  .toolbar-btn { padding: 6px 8px; font-size: 11px; }

  /* Compact filters mobile */
  .sidebar-filters { padding: 8px 10px; gap: 6px; }
  .search-wrapper input { padding: 7px 10px 7px 30px; font-size: 12px; }
  .search-wrapper i { left: 10px; font-size: 12px; }
  #filter-type { padding: 7px 10px; font-size: 12px; }
  .price-filter-wrap { padding: 6px 8px; gap: 5px; }
  .price-filter-label { font-size: 11px; }
  .price-filter-inputs input { padding: 5px 6px; font-size: 11px; }

  /* Mobile: advanced filters mặc định đóng */
  .filter-collapse { max-height: 0; opacity: 0; pointer-events: none; }
  .filter-collapse.open { max-height: 400px; opacity: 1; pointer-events: auto; }

  /* Pin cards compact */
  #pin-list { padding: 8px; gap: 8px; }
  .pin-card { padding: 8px 10px; gap: 8px; }
  .pin-card-thumb { width: 44px; height: 44px; }
  .pin-card-name { font-size: 13px; }
  .pin-card-price { font-size: 12px; }
  .pin-card-meta { font-size: 10px; }

  /* Modal: full-width trên mobile */
  #pin-modal { padding: 10px; }
  .modal-box {
    max-height: calc(90vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }
}

/* ── ROUTING PANEL ──────────────────────────────────── */
.route-panel {
  position: absolute;
  bottom: 20px; left: 20px;
  width: 320px; max-height: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  z-index: 600;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}
.route-panel.hidden { display: none; }

.route-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(37,99,235,0.08), rgba(59,130,246,0.04));
}
.route-panel-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--accent);
}
.route-panel-close {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(0,0,0,0.04); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.route-panel-close:hover { background: rgba(220,38,38,0.1); color: var(--error); }

.route-panel-body { padding: 12px 16px; overflow-y: auto; flex: 1; }

.route-info {
  display: flex; gap: 16px; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.route-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.route-stat i { color: var(--accent); font-size: 13px; }

.route-dest-name {
  font-size: 13px; font-weight: 600; color: var(--accent);
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}

.route-step {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 12px; color: var(--text-secondary);
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.step-icon { font-size: 14px; flex-shrink: 0; width: 20px; text-align: center; }
.step-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-dist { font-size: 11px; color: var(--text-muted); flex-shrink: 0; font-weight: 500; }

.route-loading, .route-error {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; padding: 12px 0;
}
.route-loading { color: var(--accent); }
.route-error { color: var(--error); }

.route-panel-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.route-btn {
  width: 100%; padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
}
.route-btn-gmaps {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white; border: none;
}
.route-btn-gmaps:hover { background: linear-gradient(135deg, #1d4ed8, #2563eb); }

/* Route start marker */
.route-start-marker { background: none !important; border: none !important; box-shadow: none !important; }
.route-marker-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: white;
}
.route-marker-dot.start {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  box-shadow: 0 2px 8px rgba(22,163,74,0.4);
  animation: routePulse 2s ease infinite;
}
@keyframes routePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(22,163,74,0); }
}

/* Nút chỉ đường trong popup */
.btn-route-popup { color: var(--accent) !important; border-color: rgba(37,99,235,0.2) !important; }
.btn-route-popup:hover { background: rgba(37,99,235,0.1) !important; }

@media (max-width: 768px) {
  .route-panel {
    left: 10px; right: 10px; bottom: 10px;
    width: auto; max-height: 300px;
  }
}

/* ── NAV BAR (thanh dẫn đường trực tuyến) ──────────── */
.nav-bar {
  position: absolute;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  width: 360px; max-width: calc(100% - 120px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 700;
  overflow: hidden;
}
.nav-bar.hidden { display: none; }

.nav-bar-step {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(37,99,235,0.1), rgba(59,130,246,0.05));
}
.nav-step-icon { font-size: 28px; flex-shrink: 0; }
.nav-step-info { flex: 1; min-width: 0; }
.nav-step-text {
  font-size: 15px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-step-dist { font-size: 12px; color: var(--accent); font-weight: 500; margin-top: 2px; }

.nav-bar-bottom {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.nav-remaining { font-weight: 700; color: var(--text-primary); }
.nav-eta { color: var(--text-secondary); flex: 1; }
.nav-stop-btn {
  padding: 5px 12px; border-radius: 8px;
  background: rgba(220,38,38,0.1); border: 1px solid rgba(220,38,38,0.2);
  color: var(--error); font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 4px;
  transition: all 0.2s;
}
.nav-stop-btn:hover { background: rgba(220,38,38,0.2); }
.nav-voice-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(37,99,235,0.1); border: 1px solid rgba(37,99,235,0.2);
  color: var(--accent); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.nav-voice-btn:hover { background: rgba(37,99,235,0.2); }

/* ── User GPS marker ──────────────────────────────── */
.nav-user-marker { background: none !important; border: none !important; box-shadow: none !important; }
.nav-user-dot {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border: 3px solid white;
  box-shadow: 0 2px 12px rgba(37,99,235,0.5);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 14px;
  animation: navUserPulse 2s ease infinite;
}
@keyframes navUserPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37,99,235,0.4), 0 2px 12px rgba(37,99,235,0.5); }
  50% { box-shadow: 0 0 0 10px rgba(37,99,235,0), 0 2px 12px rgba(37,99,235,0.5); }
}

/* Destination flag */
.nav-dest-marker { background: none !important; border: none !important; box-shadow: none !important; }
.nav-dest-flag { font-size: 24px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }

/* ── Nút định vị (My Location) ────────────────────── */
#btn-my-location {
  position: fixed;
  bottom: 100px; right: 14px;
  z-index: 1200;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(37,99,235,0.25);
  color: var(--accent);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: all 0.18s;
}
#btn-my-location:hover {
  background: rgba(37,99,235,0.1);
  border-color: var(--accent);
}
#btn-my-location.locating {
  animation: locatePulse 1s ease infinite;
}
@keyframes locatePulse {
  0%, 100% { color: var(--accent); }
  50% { color: var(--text-muted); }
}

/* ── Nút dán link Google Maps ──────────────────────── */
#btn-goto-gmap {
  position: fixed;
  bottom: 190px; right: 14px;
  z-index: 1200;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(234,67,53,0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #ea4335; font-size: 13px;
  transition: all 0.18s;
}
#btn-goto-gmap:hover {
  background: rgba(234,67,53,0.1);
  border-color: #ea4335;
  box-shadow: 0 4px 12px rgba(234,67,53,0.3);
}

/* Route nav button */
.route-btn-nav {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: white; border: none;
}
.route-btn-nav:hover { background: linear-gradient(135deg, #15803d, #16a34a); }
.route-panel-footer { display: flex; gap: 8px; }
.route-panel-footer .route-btn { flex: 1; }
.route-btn-gmaps {
  background: var(--bg-glass); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.route-btn-gmaps:hover { background: var(--bg-glass-hover); color: var(--text-primary); }
.route-info-note {
  font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; padding: 8px 0;
}

/* ═══════════════════════════════════════════════════════════
   OVERLAY – Icon button + Fullscreen modal editor v1.3.0
   ═══════════════════════════════════════════════════════════ */

/* ── Icon button nhỏ trên bản đồ ── */
#overlay-icon-btn {
  position: fixed;
  bottom: 145px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.95);
  border: 1px solid rgba(234,179,8,0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #2563eb; z-index: 1200;
  transition: all 0.18s;
}
#overlay-icon-btn:hover {
  background: #2563eb; color: #fff;
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

/* ── Fullscreen Modal ── */
#overlay-editor-modal {
  display: none;
  position: fixed; inset: 0; z-index: 9000;
  flex-direction: column;
  background: #f1f5f9;
}

/* Topbar */
#oem-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.oem-title { font-size: 15px; font-weight: 700; color: #0f172a; flex:1; }
.oem-controls { display:flex; align-items:center; gap:10px; }
.oem-opacity-row { display:flex; align-items:center; gap:6px; font-size:12px; color:#475569; }
#oem-opacity { width:80px; accent-color:#2563eb; }
#oem-opacity-label { font-size:11px; min-width:30px; }

.oem-btn {
  padding: 6px 14px; border-radius: 8px; border: none;
  font-size: 12px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items:center; gap:5px;
  transition: all 0.15s; white-space: nowrap;
}
.oem-btn-cancel { background:#f1f5f9; color:#64748b; border:1px solid #e2e8f0; }
.oem-btn-cancel:hover { background:#e2e8f0; }
.oem-btn-confirm { background:#2563eb; color:#fff; }
.oem-btn-confirm:hover { background:#1d4ed8; }
.oem-btn:disabled { opacity:0.55; cursor:not-allowed; }

/* Body: sidebar + map */
#oem-body { display:flex; flex:1; overflow:hidden; }

/* ── Sidebar ── */
#oem-sidebar {
  width: 270px; flex-shrink:0;
  background: #fff;
  border-right: 1px solid #e2e8f0;
  display: flex; flex-direction: column;
  padding: 14px 12px;
  overflow-y: auto; gap: 8px;
}
.oem-section-title {
  font-size: 11px; font-weight: 700; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.oem-field { display:flex; flex-direction:column; gap:4px; margin-bottom:10px; }
.oem-field label { font-size:11px; font-weight:600; color:#475569; }
.oem-field input[type="text"] {
  padding:6px 9px; border-radius:7px;
  border:1px solid #dde3ec; font-size:12px;
  outline:none; transition:border 0.15s;
}
.oem-field input[type="text"]:focus { border-color:#2563eb; }

/* File drop zone */
.oem-file-drop {
  display:flex; align-items:center; justify-content:center;
  padding:12px 8px; border-radius:8px;
  border: 2px dashed #c7d2fe;
  background:#eff6ff; cursor:pointer;
  font-size:12px; color:#4338ca; text-align:center;
  transition:all 0.15s;
}
.oem-file-drop:hover { border-color:#2563eb; background:#dbeafe; }

/* Layer list */
.oem-layer-list { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:6px; }
.oem-empty { font-size:12px; color:#94a3b8; text-align:center; padding:10px 0; }
.oem-layer-item {
  background:#f8fafc; border:1px solid #e2e8f0; border-radius:8px;
  padding:8px 10px; display:flex; align-items:center; gap:8px;
}
.oem-layer-name { flex:1; font-size:12px; font-weight:500; color:#334155;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.oem-layer-actions { display:flex; align-items:center; gap:5px; flex-shrink:0; }
.oem-mini-op { width:50px; accent-color:#2563eb; }
.oem-edit-btn, .oem-del-btn {
  background:none; border:none; cursor:pointer; font-size:13px;
  opacity:0.5; transition:opacity 0.15s; padding:0;
}
.oem-edit-btn:hover, .oem-del-btn:hover { opacity:1; }

/* ── Map area ── */
#oem-map-wrap { flex:1; position:relative; }
#oem-map { width:100%; height:100%; }
#oem-hint {
  position:absolute; bottom:16px; left:50%; transform:translateX(-50%);
  background:rgba(15,23,42,0.8); color:#fff;
  padding:7px 18px; border-radius:99px;
  font-size:12px; pointer-events:none; white-space:nowrap;
  backdrop-filter:blur(4px); z-index:100;
}

/* Toggle sidebar button */
#oem-toggle-sidebar {
  position: absolute; top: 10px; left: 10px; z-index: 1000;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,0.95); border: 1px solid #e2e8f0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
#oem-toggle-sidebar:hover { background: #eff6ff; border-color: #2563eb; }

/* Sidebar hidden */
#oem-sidebar.oem-sidebar-hidden {
  display: none !important;
}

/* Corner handle */
.ov-corner-icon {
  width:20px; height:20px; border-radius:50%;
  background:#2563eb; border:3px solid #fff;
  box-shadow:0 2px 6px rgba(0,0,0,0.4); cursor:grab;
}
.ov-corner-icon:active { cursor:grabbing; }


/* ── Basemap selector (góc trên-trái bản đồ editor) ── */
#oem-basemap-ctrl {
  position: absolute; top: 10px; left: 10px; z-index: 800;
  display: flex; flex-wrap: wrap; gap: 5px;
  max-width: 260px;
}
.oem-bm-btn {
  padding: 5px 10px; border-radius: 7px;
  border: 1px solid #cbd5e1; background: rgba(255,255,255,0.92);
  font-size: 12px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  transition: all 0.15s; color: #334155;
}
.oem-bm-btn:hover { background: #eff6ff; border-color: #2563eb; color: #2563eb; }
.oem-bm-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ── Handle icons ── */
.ov-move-icon {
  width: 24px; height: 24px; border-radius: 50%;
  background: #2563eb; border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.5);
  cursor: move;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2l-2 4h4l-2-4zm0 20l2-4h-4l2 4zM2 12l4 2v-4l-4 2zm20 0l-4-2v4l4-2z'/%3E%3C/svg%3E");
  background-size: 14px; background-repeat: no-repeat; background-position: center;
}
.ov-resize-icon {
  width: 18px; height: 18px; border-radius: 4px;
  background: #f59e0b; border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(245,158,11,0.5);
  cursor: nwse-resize;
}

/* Rotation handle */
.ov-rot-icon {
  width: 20px; height: 20px; border-radius: 50%;
  background: #10b981; border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(16,185,129,0.5);
  cursor: grab;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z'/%3E%3C/svg%3E");
  background-size: 12px; background-repeat: no-repeat; background-position: center;
}
.ov-rot-icon:active { cursor: grabbing; }

/* ── Mobile: sidebar → bottom sheet ── */
@media (max-width: 768px) {
  #oem-topbar {
    padding: 8px 10px; gap: 8px; flex-wrap: wrap;
  }
  .oem-title { font-size: 13px; }
  .oem-controls { gap: 6px; }
  .oem-btn { padding: 5px 10px; font-size: 11px; }
  #oem-opacity { width: 60px; }

  #oem-body {
    flex-direction: column-reverse !important;
  }
  #oem-sidebar {
    width: 100% !important;
    max-height: 40vh;
    border-right: none !important;
    border-top: 1px solid #e2e8f0;
    padding: 10px 12px;
    overflow-y: auto;
    flex-shrink: 0;
  }
  #oem-map-wrap {
    flex: 1;
    min-height: 50vh;
  }
  #oem-hint {
    bottom: 8px;
    font-size: 11px;
    padding: 5px 12px;
  }
}

/* ── Ranh giới xã – label tên ────────────────────── */
.xb-icon { background: none !important; border: none !important; }
.xb-label {
  position: relative;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1.5px solid var(--xbc, #6366f1);
  color: var(--xbc, #6366f1);
  background: rgba(255,255,255,0.82);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.2px;
  pointer-events: none;
  text-shadow: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
  backdrop-filter: blur(2px);
}
