:root {
  --bg-dark: #121212;
  --glass-bg: rgba(20, 20, 20, 0.65);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f0f0f0;
  --text-secondary: #aaaaaa;
  --accent: #00d2ff;
  --accent-glow: rgba(0, 210, 255, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

.hidden {
  display: none !important;
}

body, html, #app {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  color: var(--text-primary);
}

.ui-container {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 320px;
  pointer-events: none;
}

.search-box, .sidebar {
  pointer-events: auto;
}

.search-box {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  width: 260px;
  border-radius: 30px;
  transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  background: rgba(20, 20, 20, 0.85);
}

.search-box:focus-within {
  box-shadow: 0 0 20px var(--accent-glow), 0 4px 15px rgba(0, 0, 0, 0.6);
  border-color: var(--accent);
  background: rgba(10, 10, 10, 0.95);
  width: 400px;
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: white;
  font-size: 13px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

#searchInput::placeholder {
  color: var(--text-secondary);
}

#searchBtn {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 16px;
  padding: 0 5px;
  transition: transform 0.2s;
}
#searchBtn:hover {
  transform: scale(1.1);
}

.toggle-box {
  position: absolute;
  bottom: 20px;
  left: 60px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 15px;
  cursor: pointer;
  width: max-content;
  color: var(--text-primary);
  font-size: 0.85rem;
  user-select: none;
  pointer-events: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
}
.toggle-box input[type="checkbox"] {
  accent-color: #00d2ff;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.sidebar {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: top left;
}

.sidebar.hidden {
  opacity: 0;
  transform: scale(0.95) translateY(-10px);
  pointer-events: none;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

#closeSidebar {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  transition: color 0.2s;
}
#closeSidebar:hover {
  color: white;
}

.sidebar-content {
  padding: 20px;
  overflow-y: auto;
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}
.sidebar-content::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.info-row {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}
.info-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.info-value {
  font-size: 15px;
  font-weight: 400;
  word-break: break-word;
}
.info-value.highlight {
  color: var(--accent);
  font-weight: 600;
}

.legend {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  padding: 15px;
  width: 150px;
}
.legend h3 {
  font-size: 13px;
  margin-bottom: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
}
.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
}
.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  margin-right: 10px;
  border: 1px solid rgba(255,255,255,0.2);
}

.leaflet-tooltip {
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border) !important;
  color: white !important;
  backdrop-filter: blur(5px);
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3) !important;
}
.leaflet-tooltip-top:before {
  border-top-color: var(--glass-bg) !important;
}
.leaflet-tooltip-bottom:before {
  border-bottom-color: var(--glass-bg) !important;
}
.leaflet-tooltip-left:before {
  border-left-color: var(--glass-bg) !important;
}
.leaflet-tooltip-right:before {
  border-right-color: var(--glass-bg) !important;
}

/* --- Auth & Modals --- */
.auth-box {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: max-content;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 15px;
  pointer-events: auto;
}

#auth-btn {
  border: 2px solid #00d2ff;
  background: rgba(0, 210, 255, 0.1);
  color: #fff;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}
#auth-btn:hover {
  background: rgba(0, 210, 255, 0.3);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
}

.leaflet-top.leaflet-right {
    margin-top: 70px;
    margin-right: 10px;
  }
#user-info {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  color: #00d2ff;
  text-shadow: 0 0 5px rgba(0, 210, 255, 0.5);
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--glass-bg);
  border: 1px solid rgba(0, 210, 255, 0.3);
  backdrop-filter: blur(10px);
}

.parcel-label {
  color: white;
  font-size: 11px;
  font-weight: 800;
  text-shadow: 
    -1px -1px 0 #000,  
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

.edge-length-label {
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 
    -1px -1px 0 #000,  
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
}
.glass-btn, .primary-btn, .secondary-btn, .text-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Custom Measure Tool */
.custom-measure-btn {
  font-size: 18px;
  text-align: center;
  line-height: 30px;
  background-color: #fff;
  color: #333;
  display: block;
  width: 34px;
  height: 34px;
  text-decoration: none;
}
.custom-measure-btn:hover {
  background-color: #f4f4f4;
}
.custom-measure-btn.active {
  background-color: #ff0000 !important;
  color: #fff !important;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}
.measure-temp-label {
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.measure-permanent-label {
  background: #ff0000;
  color: #fff;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  pointer-events: none;
  border: 1px solid #fff;
  text-align: center;
}
.glass-btn, .primary-btn, .secondary-btn, .text-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-color);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  font-weight: 600;
}
.glass-btn:hover { background: rgba(255, 255, 255, 0.2); }
.primary-btn { background: #00d2ff; color: #1a1a2e; border: none; }
.primary-btn:hover { background: #3aecff; }
.secondary-btn { background: rgba(255,255,255,0.05); }
.secondary-btn:hover { background: rgba(255,255,255,0.15); }
.text-btn { background: transparent; border: none; color: #aaa; }
.text-btn:hover { color: #fff; background: transparent; }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  pointer-events: auto;
}
.modal {
  width: 90%;
  max-width: 400px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  animation: modalFadeIn 0.3s ease;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal h3 {
  margin: 0 0 10px 0;
  font-size: 1.4rem;
  text-align: center;
}
.modal input, .modal textarea {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.modal input:focus, .modal textarea:focus {
  outline: none;
  border-color: #00d2ff;
}
.modal textarea {
  resize: vertical;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  justify-content: flex-end;
}
.error-text {
  color: #ff4d4d;
  font-size: 0.85rem;
  text-align: center;
  margin: 0;
}
.success-text {
  color: #00fa9a;
  font-size: 0.85rem;
  text-align: center;
  margin: 0;
}

/* Styling for User Location Marker */
.google-blue-dot {
  background-color: #4285F4;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 10px rgba(66, 133, 244, 0.8);
  position: relative;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(66, 133, 244, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(66, 133, 244, 0); }
  100% { box-shadow: 0 0 0 0 rgba(66, 133, 244, 0); }
}

.brand-logo { display: flex; align-items: center; flex-shrink: 0; cursor: pointer; }
.logo-text { font-weight: 800; font-size: 15px; letter-spacing: 0.5px; background: linear-gradient(45deg, #00d2ff, #3a7bd5); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-transform: uppercase; }
.search-divider { width: 1px; height: 18px; background: rgba(255,255,255,0.3); margin: 0 10px; flex-shrink: 0; }
#searchBtn { display: flex; align-items: center; justify-content: center; padding: 4px; border-radius: 50%; transition: all 0.2s; }
#searchBtn:hover { background: rgba(0, 210, 255, 0.1); transform: scale(1.1); }

.dghc-tooltip { background: rgba(0,0,0,0.7); border: none; color: white; font-weight: bold; font-size: 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.vungthon-tooltip {
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  color: #ffffff;
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  text-transform: uppercase;
}

.gia-dat-tooltip {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #FF0000;
  border-radius: 4px;
  font-weight: bold;
  color: #D32F2F;
  font-size: 11px;
  padding: 2px 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  white-space: nowrap;
}


/* Disclaimer */
.disclaimer-banner {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  background: rgba(0, 0, 0, 0.6);
  color: #ffeb3b;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 11.5px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  border: 1px solid rgba(255, 235, 59, 0.25);
}


/* ==========================================================================
   MOBILE RESPONSIVE DESIGN (Giao diện tối ưu cho điện thoại)
   ========================================================================== */

@media (max-width: 768px) {
  /* 1. Header & Top Bar: Tự động tránh tai thỏ / Dynamic Island (Safe Area) trên iPhone & Android */
  .auth-box {
    top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
    right: 10px !important;
    gap: 6px !important;
    z-index: 1001 !important;
  }

  /* Nút hồ sơ trên mobile thu gọn thành icon 42x42 hình tròn cực gọn gàng, không lấn khung tìm kiếm */
  #btn-admin-records {
    height: 42px !important;
    width: 42px !important;
    min-width: 42px !important;
    padding: 0 !important;
    border-radius: 21px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    flex-shrink: 0 !important;
  }
  #btn-admin-records.hidden {
    display: none !important;
  }
  #btn-admin-records .admin-rec-text {
    display: none !important; /* Ẩn chữ trên mobile để chống che khung tìm kiếm */
  }
  #btn-admin-records .admin-rec-icon {
    font-size: 19px !important;
    margin: 0 !important;
  }
  #btn-admin-records .admin-rec-badge {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    padding: 1px 5px !important;
    min-width: 16px !important;
    height: 16px !important;
    border-radius: 8px !important;
    line-height: 14px !important;
    border: 1.5px solid #0b1118 !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5) !important;
    margin-left: 0 !important;
  }
  
  #auth-btn {
    height: 42px !important;
    padding: 0 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 21px !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  #user-info {
    display: none !important; /* Ẩn chuỗi email dài trên mobile để thanh trên luôn gọn gàng */
  }

  .ui-container {
    top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
    left: 10px !important;
    right: 142px !important; /* Chừa 142px an toàn tuyệt đối cho nút 📂 (42px) + nút Đăng xuất (~75px) + gap */
    width: auto !important;
    max-width: none !important;
    z-index: 1000 !important;
  }

  .search-box {
    width: 100% !important;
    height: 42px !important;
    padding: 0 8px 0 12px !important;
    border-radius: 21px !important;
    box-sizing: border-box !important;
    border: 1.5px solid rgba(255, 255, 255, 0.65) !important;
    cursor: text !important;
  }

  .search-box:focus-within {
    width: 100% !important;
  }

  .brand-logo svg {
    width: 16px !important;
    height: 16px !important;
    margin-right: 4px !important;
  }

  .logo-text {
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  .search-divider {
    margin: 0 6px !important;
    height: 16px !important;
  }

  #searchInput {
    font-size: 16px !important; /* Chuẩn 16px giúp iOS Safari/PWA mở bàn phím mượt mà, không bị lỗi zoom */
    height: 100% !important;
    padding: 0 4px !important;
    min-width: 0 !important; /* Cho phép co giãn mượt mà trên màn hình nhỏ */
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
  }

  #searchInput::placeholder {
    font-size: 12px !important;
  }

  /* Nút chuyển lớp bản đồ của Leaflet: xếp ngay dưới nút Đăng xuất */
  .leaflet-top.leaflet-right {
    margin-top: calc(env(safe-area-inset-top, 0px) + 62px) !important;
    margin-right: 10px !important;
  }

  /* 2. Footer & Bottom Area: Phân tầng khoa học, tách rời hoàn toàn các nút */
  
  /* Tầng 1 (Sát đáy): Dải cảnh báo pháp lý thanh mảnh, cố định mép dưới */
  .disclaimer-banner {
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    width: 100% !important;
    border-radius: 0 !important;
    font-size: 10px !important;
    padding: 4px 8px !important;
    text-align: center !important;
    background: rgba(0, 0, 0, 0.8) !important;
    border: none !important;
    border-top: 1px solid rgba(255, 235, 59, 0.25) !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    z-index: 998 !important;
    box-sizing: border-box !important;
  }

  /* Tầng 2: Nút Bật màu nền (trái) và Nút Chú giải (phải) cách mép dưới 28px */
  .toggle-box {
    bottom: 28px !important;
    left: 10px !important;
    padding: 6px 10px !important;
    font-size: 11.5px !important;
    height: 32px !important;
    border-radius: 16px !important;
    white-space: nowrap !important;
    gap: 6px !important;
    z-index: 1000 !important;
  }

  .toggle-box input[type="checkbox"] {
    width: 14px !important;
    height: 14px !important;
  }

  .legend {
    bottom: 28px !important;
    right: 10px !important;
    width: auto !important;
    padding: 6px 12px !important;
    height: 32px !important;
    border-radius: 16px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    z-index: 1000 !important;
  }

  .legend h3 {
    font-size: 11.5px !important;
    margin-bottom: 0 !important;
  }

  #legend-items {
    position: absolute !important;
    bottom: 40px !important;
    right: 0 !important;
    width: 220px !important;
    max-height: 48vh !important;
    background: rgba(18, 18, 18, 0.96) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 12px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    z-index: 1002 !important;
  }

  /* Tầng 3: Các nút điều khiển Leaflet (Zoom +/-, Định vị GPS, Thước đo) nâng lên trên nút Bật màu nền */
  .leaflet-bottom.leaflet-left {
    margin-bottom: calc(36px + env(safe-area-inset-bottom, 0px)) !important;
    margin-left: 10px !important;
  }

  /* 3. Sidebar chi tiết thửa đất: Hiển thị dạng Bottom Sheet hiện đại từ đáy màn hình */
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-height: 65vh !important;
    border-radius: 20px 20px 0 0 !important;
    z-index: 10005 !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6) !important;
    background: rgba(18, 18, 18, 0.96) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-bottom: none !important;
    transition: transform 0.3s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.2s ease !important;
    transform: translateY(0) !important;
  }

  .sidebar.hidden {
    opacity: 0 !important;
    transform: translateY(100%) !important;
    pointer-events: none !important;
  }

  .sidebar-header {
    padding: 14px 18px !important;
  }

  .sidebar-header h2 {
    font-size: 15px !important;
  }

  .sidebar-content {
    padding: 14px 18px 24px 18px !important;
    max-height: calc(65vh - 55px) !important;
  }

  /* 4. Hộp thoại Đăng nhập / Phản ánh (Modals) */
  .modal {
    width: 92% !important;
    max-width: 360px !important;
    padding: 22px 18px !important;
    gap: 12px !important;
    border-radius: 16px !important;
  }

  .modal h3 {
    font-size: 1.2rem !important;
  }

  .modal input, .modal textarea {
    padding: 10px 12px !important;
    font-size: 13.5px !important;
  }
}

/* Tinh chỉnh đặc biệt cho điện thoại cỡ nhỏ (màn hình hẹp < 400px như iPhone SE, 8, v.v.) */
@media (max-width: 400px) {
  .logo-text {
    display: none !important; /* Ẩn chữ TÂN HỘI, giữ lại logo biểu tượng vị trí màu xanh cực kỳ gọn gàng */
  }
  .brand-logo {
    margin-right: 0 !important;
  }
  .search-divider {
    margin: 0 4px !important;
  }
  .ui-container {
    right: 135px !important;
  }
  #auth-btn {
    padding: 0 8px !important;
    font-size: 11.5px !important;
  }
}




/* PWA Install Button */
.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 210, 255, 0.15) !important;
  border: 1.5px solid #00d2ff !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.35) !important;
  cursor: pointer;
  transition: all 0.25s ease;
}
.pwa-install-btn:hover {
  background: rgba(0, 210, 255, 0.3) !important;
  box-shadow: 0 0 18px rgba(0, 210, 255, 0.6) !important;
  transform: translateY(-1px);
}
.pwa-install-btn .pwa-icon {
  font-size: 14px;
  line-height: 1;
}
.pwa-install-btn .pwa-label {
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.3px;
}


/* Ẩn dấu X mặc định không nhạy của trình duyệt trên WebKit / Chrome */
#searchInput::-webkit-search-cancel-button,
#searchInput::-webkit-search-decoration,
#searchInput::-webkit-search-results-button,
#searchInput::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

/* Nút xóa nhanh nội dung tìm kiếm (Custom Clear Button) */
.clear-search-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ddd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  margin: 0 4px;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
}
.clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  color: #fff;
  transform: scale(1.1);
}
.clear-search-btn:active {
  transform: scale(0.9);
}


/* Fullscreen Control Button */
.fullscreen-btn {
  background-color: #fff !important;
  color: #333 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease, transform 0.1s ease !important;
}
.fullscreen-btn:hover {
  background-color: #f0f0f0 !important;
}
.fullscreen-btn:active {
  background-color: #e0e0e0 !important;
  transform: scale(0.92);
}

/* Locate Control Button */
.locate-btn {
  background-color: #fff !important;
  color: #333 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 34px !important;
  height: 34px !important;
  text-decoration: none !important;
  transition: background-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease !important;
}
.locate-btn:hover {
  background-color: #f0f0f0 !important;
}
.locate-btn:active {
  transform: scale(0.92);
}
.locate-btn svg {
  transition: fill 0.25s ease, transform 0.25s ease;
}

/* Khi đang bật định vị theo thời gian thực nhưng người dùng đã lướt bản đồ sang chỗ khác */
.locate-btn.active-tracking {
  background-color: #e8f0fe !important;
}
.locate-btn.active-tracking svg {
  fill: #1a73e8 !important;
}

/* Khi đang bật định vị theo thời gian thực VÀ đang theo dõi (căn giữa) */
.locate-btn.active-tracking.following {
  background-color: #1a73e8 !important;
  box-shadow: 0 0 10px rgba(26, 115, 232, 0.6) !important;
}
.locate-btn.active-tracking.following svg {
  fill: #ffffff !important;
  animation: pulse-locate 1.8s infinite;
}

@keyframes pulse-locate {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}


/* Tinh chỉnh chuyên biệt cho iOS (iPhone có Dynamic Island / Tai thỏ) */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    .ui-container {
      top: max(calc(env(safe-area-inset-top, 0px) + 10px), 56px) !important;
    }
    .auth-box {
      top: max(calc(env(safe-area-inset-top, 0px) + 10px), 56px) !important;
    }
    .leaflet-top.leaflet-right {
      margin-top: max(calc(env(safe-area-inset-top, 0px) + 60px), 106px) !important;
    }
    .disclaimer-banner {
      padding-bottom: max(4px, env(safe-area-inset-bottom, 4px)) !important;
    }
    .toggle-box, .legend {
      bottom: calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .leaflet-bottom.leaflet-left {
      margin-bottom: calc(36px + env(safe-area-inset-bottom, 0px)) !important;
    }
    .sidebar-content {
      padding-bottom: calc(24px + env(safe-area-inset-bottom, 12px)) !important;
    }
  }
}


/* ==========================================================================
   PRO UPGRADE: DARK GLASSMORPHISM CONTROLS, LAYER DRAWER, AUTOCOMPLETE,
   CADASTRAL CARD, MEASURE TOOLBAR, GPS BANNER & SLIP MODAL
   ========================================================================== */

/* Ẩn bảng layer mặc định cũ của Leaflet vì đã có Layer Drawer chuyên nghiệp */
.leaflet-control-layers {
  display: none !important;
}

/* Đồng bộ cụm nút công cụ góc dưới trái theo phong cách Dark Glassmorphism */
.leaflet-bottom.leaflet-left .leaflet-bar {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  margin-bottom: 10px !important;
}

.custom-measure-btn,
.locate-btn,
.fullscreen-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 12px !important;
  background: rgba(16, 22, 32, 0.86) !important;
  color: #f0f6fc !important;
  border: 1px solid rgba(0, 210, 255, 0.32) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.22s ease !important;
}

.custom-measure-btn:hover,
.locate-btn:hover,
.fullscreen-btn:hover {
  background: rgba(0, 210, 255, 0.2) !important;
  border-color: #00d2ff !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 210, 255, 0.3) !important;
}

.custom-measure-btn svg,
.locate-btn svg,
.fullscreen-btn svg {
  fill: #e6f1ff !important;
  transition: all 0.22s ease;
}

.custom-measure-btn.active {
  background: linear-gradient(135deg, #ff416c, #ff4b2b) !important;
  border-color: #ff758c !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(255, 65, 108, 0.65) !important;
}

.locate-btn.active-tracking {
  background: rgba(0, 210, 255, 0.22) !important;
  border-color: #00d2ff !important;
}
.locate-btn.active-tracking svg {
  fill: #00d2ff !important;
}

.locate-btn.active-tracking.following {
  background: linear-gradient(135deg, #00d2ff, #0072ff) !important;
  border-color: #80e5ff !important;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.65) !important;
}
.locate-btn.active-tracking.following svg {
  fill: #ffffff !important;
}

/* Nút mở Quản lý Lớp bản đồ */
.layer-manager-btn {
  position: absolute;
  top: 72px;
  right: 20px;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 20px;
  background: rgba(16, 22, 32, 0.88) !important;
  border: 1.5px solid rgba(0, 210, 255, 0.45) !important;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: all 0.22s ease;
}
.layer-manager-btn:hover {
  background: rgba(0, 210, 255, 0.22) !important;
  border-color: #00d2ff !important;
  box-shadow: 0 0 16px rgba(0, 210, 255, 0.4);
}
.layer-badge {
  background: #00d2ff;
  color: #0a1018;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Bảng Quản lý Lớp Bản Đồ (Layer Drawer) */
.layer-drawer {
  position: absolute;
  top: 120px;
  right: 20px;
  width: 320px;
  max-height: calc(100vh - 160px);
  z-index: 10002;
  display: flex;
  flex-direction: column;
  background: rgba(15, 20, 28, 0.95) !important;
  border: 1px solid rgba(0, 210, 255, 0.35) !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65) !important;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.layer-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 210, 255, 0.08);
}
.layer-drawer-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.drawer-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ccc;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s;
}
.drawer-close-btn:hover {
  background: rgba(255, 70, 70, 0.8);
  color: #fff;
}

.layer-drawer-body {
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.layer-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 10px 12px;
}
.layer-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #00d2ff;
  margin-bottom: 8px;
}

.opacity-section {
  background: rgba(0, 210, 255, 0.07);
  border-color: rgba(0, 210, 255, 0.25);
}
.opacity-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #ddd;
  margin-bottom: 6px;
}
.opacity-header strong {
  color: #00d2ff;
}
#overlay-opacity-slider {
  width: 100%;
  accent-color: #00d2ff;
  cursor: pointer;
  height: 5px;
}

.basemap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.basemap-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ccc;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.basemap-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.basemap-pill.active {
  background: rgba(0, 210, 255, 0.22);
  border-color: #00d2ff;
  color: #00d2ff;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.25);
}

.layer-toggle-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 4px;
  cursor: pointer;
  font-size: 12.5px;
  color: #e6edf3;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  user-select: none;
}
.layer-toggle-row:last-child {
  border-bottom: none;
}
.layer-toggle-row input[type="checkbox"] {
  accent-color: #00d2ff;
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.layer-row-name {
  flex: 1;
}
.layer-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.4);
  flex-shrink: 0;
}

/* Gợi ý tìm kiếm thông minh (Autocomplete Dropdown) */
.search-suggestions {
  pointer-events: auto;
  width: 100%;
  max-height: 310px;
  overflow-y: auto;
  background: rgba(15, 20, 28, 0.96) !important;
  border: 1px solid rgba(0, 210, 255, 0.45) !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65) !important;
  padding: 6px 0;
  margin-top: -6px;
  z-index: 10005;
}
.suggestion-header {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #00d2ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
}
.suggestion-item {
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover,
.suggestion-item:active {
  background: rgba(0, 210, 255, 0.16);
}
.sug-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sug-owner {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sug-sub {
  font-size: 11px;
  color: #aaa;
}
.sug-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.sug-badge {
  background: rgba(0, 210, 255, 0.18);
  border: 1px solid rgba(0, 210, 255, 0.45);
  color: #00d2ff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}
.sug-land {
  font-size: 10.5px;
  color: #ddd;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Thiết kế Thẻ Địa Chính Hiện Đại (Cadastral Card) */
.sidebar-drag-handle {
  display: none;
  width: 100%;
  padding: 8px 0 2px 0;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.drag-pill {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.3);
}
.sidebar-collapse-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ddd;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.cadastral-owner-card {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.14), rgba(58, 123, 213, 0.12));
  border: 1px solid rgba(0, 210, 255, 0.35);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 10px;
}
.cadastral-owner-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #8ab4f8;
  margin-bottom: 3px;
}
.cadastral-owner-name {
  font-size: 15.5px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
}

.cadastral-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.cadastral-metric {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}
.cadastral-metric .m-label {
  font-size: 10.5px;
  color: #aaa;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px;
}
.cadastral-metric .m-val {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.cadastral-metric .m-val.accent {
  color: #00d2ff;
}

.land-type-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 10px;
}
.land-swatch {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.land-type-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.land-type-code {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.land-type-desc {
  font-size: 11.5px;
  color: #bbb;
  line-height: 1.3;
}

.legacy-ref-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 105, 180, 0.08);
  border: 1px dashed rgba(255, 105, 180, 0.35);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  color: #ffb6c1;
  margin-bottom: 12px;
}

.parcel-action-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.parcel-act-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  transition: all 0.2s;
}
.parcel-act-btn:hover {
  background: rgba(0, 210, 255, 0.2);
  border-color: #00d2ff;
}
.parcel-act-btn.primary {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #fff;
  border: none;
}
.parcel-act-btn.warn {
  background: rgba(255, 152, 0, 0.16);
  border-color: rgba(255, 152, 0, 0.45);
  color: #ffd54f;
}

/* Thanh trạng thái Đo đạc (Khoảng cách & Diện tích) */
.measure-toolbar {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10003;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 24px;
  background: rgba(15, 20, 28, 0.94) !important;
  border: 1.5px solid #00d2ff !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
}
.measure-metrics {
  font-size: 12.5px;
  color: #eee;
  display: flex;
  align-items: center;
  gap: 8px;
}
.measure-metrics strong {
  color: #00d2ff;
  font-size: 13.5px;
}
.measure-sep {
  opacity: 0.35;
}
.measure-actions {
  display: flex;
  gap: 6px;
}
.measure-action-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.measure-action-btn.danger {
  background: rgba(244, 67, 54, 0.25);
  border-color: #f44336;
  color: #ffcdd2;
}

/* Banner GPS báo thửa đất đang đứng ngoài thực địa */
.gps-parcel-banner {
  position: absolute;
  top: 72px;
  left: 20px;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 20px;
  background: rgba(16, 28, 42, 0.92) !important;
  border: 1.5px solid #00e676 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  font-size: 12px;
  color: #fff;
}
.gps-banner-btn {
  background: #00e676;
  color: #051b11;
  border: none;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* Toast Notification */
.app-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200000;
  background: rgba(15, 22, 32, 0.95);
  border: 1.5px solid #00d2ff;
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  text-align: center;
}

/* Modal Phiếu Thông Tin Thửa Đất */
.parcel-slip-box {
  width: 94% !important;
  max-width: 420px !important;
  background: rgba(16, 22, 30, 0.98) !important;
  border: 1.5px solid rgba(0, 210, 255, 0.45) !important;
}
.slip-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 10px;
}
.slip-agency {
  font-size: 10px;
  font-weight: 700;
  color: #00d2ff;
  letter-spacing: 0.7px;
}
.slip-header h3 {
  font-size: 15px !important;
  margin-top: 3px;
  color: #fff;
}
.slip-body {
  font-size: 12.5px;
  color: #e6edf3;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slip-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
}
.slip-row span {
  color: #999;
}
.slip-row strong {
  color: #fff;
  text-align: right;
}
.slip-canvas-wrap {
  background: #0b1118;
  border: 1px solid rgba(0, 210, 255, 0.3);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px;
}
.slip-footer-note {
  font-size: 10.5px;
  color: #aaa;
  font-style: italic;
  text-align: center;
}

/* Responsive trên điện thoại cho các thành phần mới */
@media (max-width: 768px) {
  .layer-manager-btn {
    top: calc(env(safe-area-inset-top, 0px) + 60px) !important;
    right: 10px !important;
    padding: 8px 11px !important;
    font-size: 12px !important;
  }
  .layer-btn-label {
    display: none;
  }
  .layer-drawer {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 75vh !important;
    border-radius: 20px 20px 0 0 !important;
  }
  .sidebar-drag-handle {
    display: flex !important;
  }
  .sidebar-collapse-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  /* Khi thu gọn Bottom Sheet để quan sát bản đồ */
  .sidebar.collapsed-sheet {
    transform: translateY(calc(100% - 88px)) !important;
  }
  .gps-parcel-banner {
    top: calc(env(safe-area-inset-top, 0px) + 60px) !important;
    left: 10px !important;
    right: 76px !important;
    font-size: 11px !important;
    padding: 6px 10px !important;
  }
  .gps-banner-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
  }
  .measure-toolbar {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    width: 94% !important;
    justify-content: space-between;
    padding: 7px 11px !important;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    .layer-manager-btn {
      top: max(calc(env(safe-area-inset-top, 0px) + 58px), 104px) !important;
    }
    .gps-parcel-banner {
      top: max(calc(env(safe-area-inset-top, 0px) + 58px), 104px) !important;
    }
  }
}

@media print {
  body * {
    visibility: hidden;
  }
  #parcel-slip-modal, #parcel-slip-modal * {
    visibility: visible;
  }
  #parcel-slip-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
  }
}


/* Ẩn nút Bật màu nền thửa đất ngoài màn hình chính (đã tích hợp trong Bảng Lớp Bản Đồ) */
.toggle-box {
  display: none !important;
}

@media (max-width: 768px) {
  .leaflet-bottom.leaflet-left {
    margin-bottom: calc(34px + env(safe-area-inset-bottom, 0px)) !important;
    margin-left: 10px !important;
  }
}

/* CSS cho Chức năng Đối soát Dân cư & Kê khai Đất đai */
.parcel-act-btn.doi-soat {
  background: linear-gradient(135deg, rgba(0, 210, 255, 0.25), rgba(58, 123, 213, 0.4));
  border: 1.5px solid #00d2ff;
  color: #00e5ff;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}
.parcel-act-btn.doi-soat:hover {
  background: linear-gradient(135deg, #00d2ff, #3a7bd5);
  color: #0b1118;
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
}

.doi-soat-status-box {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 12px;
}
.doi-soat-status-box.success {
  border-left: 4px solid #00e676;
  background: rgba(0, 230, 118, 0.08);
}
.doi-soat-status-box.warning {
  border-left: 4px solid #ff9100;
  background: rgba(255, 145, 0, 0.08);
}
.doi-soat-status-box.danger {
  border-left: 4px solid #ff5252;
  background: rgba(255, 82, 82, 0.08);
}

.ds-tab-btn {
  background: transparent;
  border: none;
  color: #9aa4b2;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.ds-tab-btn.active {
  background: rgba(0, 210, 255, 0.18);
  color: #00d2ff;
  font-weight: 700;
}
.preview-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1.5px solid #00d2ff;
}

.ds-preview-container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.preview-card {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #00d2ff;
  background: #111a24;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.preview-card:hover {
  transform: translateY(-2px);
}
.preview-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.preview-card .btn-del-img {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  background: rgba(239, 68, 68, 0.95);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  transition: all 0.15s;
}
.preview-card .btn-del-img:hover {
  background: #ff1744;
  transform: scale(1.15);
}
.preview-card .img-order {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: rgba(11, 17, 24, 0.85);
  color: #00d2ff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(0, 210, 255, 0.3);
}

/* --- ADMIN RECORDS MODAL & TABLE & LIGHTBOX --- */
.admin-records-box {
    padding: 10px 10px !important;
    width: 98vw !important;
    max-width: 98vw !important;
    height: 94vh !important;
    max-height: 96vh !important;
    min-width: auto !important;
    min-height: auto !important;
    gap: 6px !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    margin: auto !important;
    transform: none !important;
  }
  .admin-resize-handle {
    display: none !important;
  }

/* Chế độ Phóng to Toàn màn hình */
.admin-records-box.is-fullscreen {
  width: 99vw !important;
  max-width: 99vw !important;
  height: 97vh !important;
  max-height: 98vh !important;
  border-radius: 8px !important;
  top: 0 !important;
  left: 0 !important;
  margin: auto !important;
  transform: none !important;
}

/* Tay nắm kéo góc để co giãn kích thước (Resize Handle) */
.admin-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 0px;
  width: 24px;
  height: 24px;
  color: #00d2ff;
  font-size: 17px;
  line-height: 22px;
  text-align: center;
  cursor: nwse-resize;
  user-select: none;
  z-index: 1000;
  opacity: 0.65;
  transition: opacity 0.2s, transform 0.2s, color 0.2s;
}

.admin-resize-handle:hover, .admin-resize-handle.active {
  opacity: 1;
  transform: scale(1.25);
  color: #fff;
  text-shadow: 0 0 8px #00d2ff;
}

/* Nút thao tác trên header modal */
.btn-modal-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #00d2ff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s ease;
}

.btn-modal-action:hover {
  background: rgba(0, 210, 255, 0.25);
  color: #fff;
  border-color: #00d2ff;
  transform: scale(1.05);
}

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 12px;
}

.admin-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 250px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: #e0e6ed;
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  background: #131c28;
  color: #00d2ff;
  padding: 11px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 700;
  border-bottom: 2px solid rgba(0, 210, 255, 0.5);
}

.admin-table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(0, 210, 255, 0.08);
}

.admin-img-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1.5px solid #00d2ff;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-block;
  margin-right: 4px;
  background: #000;
}

.admin-img-thumb:hover {
  transform: scale(1.18);
  box-shadow: 0 4px 12px rgba(0, 210, 255, 0.6);
  z-index: 5;
}

.admin-badge-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.admin-badge-status.waiting {
  background: rgba(255, 152, 0, 0.2);
  color: #ffb74d;
  border: 1px solid rgba(255, 152, 0, 0.4);
}

.admin-badge-status.done {
  background: rgba(76, 175, 80, 0.2);
  color: #81c784;
  border: 1px solid rgba(76, 175, 80, 0.4);
}

.btn-table-act {
  padding: 5px 8px;
  border-radius: 6px;
  border: none;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-table-act.locate {
  background: rgba(0, 210, 255, 0.18);
  color: #00d2ff;
  border: 1px solid rgba(0, 210, 255, 0.4);
}
.btn-table-act.locate:hover {
  background: #00d2ff;
  color: #0b1118;
}
.btn-table-act.del {
  background: rgba(255, 82, 82, 0.15);
  color: #ff5252;
  border: 1px solid rgba(255, 82, 82, 0.4);
}
.btn-table-act.del:hover {
  background: #ff5252;
  color: #fff;
}
.btn-table-act.edit {
  background: rgba(255, 193, 7, 0.18);
  color: #ffca28;
  border: 1px solid rgba(255, 193, 7, 0.45);
}
.btn-table-act.edit:hover {
  background: #ffc107;
  color: #0b1118;
}

/* Style cho danh sách ảnh trong Modal Chỉnh sửa hồ sơ */
.edit-img-item {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid rgba(0, 210, 255, 0.45);
  background: #000;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.edit-img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.edit-img-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(255, 23, 68, 0.95);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.7);
  transition: transform 0.15s;
}
.edit-img-remove-btn:hover {
  transform: scale(1.15);
  background: #ff1744;
}

/* Cấu trúc Bộ lọc & Bảng Quản lý hồ sơ trên Mobile */
.admin-filters-collapsible {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  width: 100%;
}
.admin-filter-toggle-btn {
  display: none;
}

@media (max-width: 768px) {
  .admin-records-box {
    padding: 10px 10px !important;
    width: 98% !important;
    max-height: 96vh !important;
    gap: 6px !important;
  }
  .admin-modal-header {
    padding-bottom: 6px !important;
  }
  #admin-modal-title {
    font-size: 13.5px !important;
  }
  #admin-modal-sub {
    font-size: 10.5px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
  }
  .admin-toolbar {
    padding: 6px 8px !important;
    gap: 6px !important;
  }
  .admin-filter-toggle-btn {
    display: inline-flex !important;
  }
  .admin-filters-collapsible {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
  }
  .admin-filters-collapsible.show {
    display: flex !important;
  }
  .admin-table-wrap {
    flex: 1 1 0 !important;
    min-height: 250px !important;
    max-height: none !important;
  }
  .admin-table th, .admin-table td {
    padding: 6px 8px !important;
    font-size: 11px !important;
  }
}

/* Style chuẩn cho nút Quản lý hồ sơ */
#btn-admin-records {
  height: 42px;
  padding: 0 14px;
  border-radius: 21px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 210, 255, 0.18);
  border: 1.5px solid #00d2ff;
  color: #00d2ff;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
#btn-admin-records:hover {
  background: rgba(0, 210, 255, 0.32);
  box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}
#btn-admin-records.hidden {
  display: none !important;
}
#btn-admin-records .admin-rec-badge {
  background: #ff5252;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 2px;
}

/* Badges for Data Source (Nguồn dữ liệu & Độ tin cậy) */
.admin-badge-source {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}
.admin-badge-source.guest {
  background: rgba(255, 193, 7, 0.16);
  color: #ffca28;
  border: 1px solid rgba(255, 193, 7, 0.45);
}
.admin-badge-source.reg {
  background: rgba(0, 230, 118, 0.16);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.45);
}
.btn-table-act.zip {
  background: rgba(0, 210, 255, 0.18);
  color: #00d2ff;
  border: 1px solid rgba(0, 210, 255, 0.4);
}
.btn-table-act.zip:hover {
  background: #00d2ff;
  color: #0b1118;
}


/* --- STYLES CHO TRÌNH QUẢN LÝ TÀI KHOẢN TRỰC QUAN (ADMIN USERS) --- */
#btn-admin-users {
  height: 42px;
  padding: 0 14px;
  border-radius: 21px;
  transition: all 0.2s ease;
  white-space: nowrap;
  background: rgba(168, 85, 247, 0.18);
  border: 1.5px solid #a855f7;
  color: #c084fc;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
#btn-admin-users:hover {
  background: rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
  transform: translateY(-1px);
}
#btn-admin-users.hidden {
  display: none !important;
}

/* Mobile responsive cho nút Quản lý tài khoản */
@media (max-width: 768px) {
  #btn-admin-users {
    display: none !important;
  }
}

/* Badges phân quyền vai trò */
.badge-role {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-role-super {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}
.badge-role-admin {
  background: rgba(0, 210, 255, 0.18);
  color: #00d2ff;
  border: 1px solid rgba(0, 210, 255, 0.5);
}
.badge-role-canbo {
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.5);
}

/* Badges trạng thái */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.badge-status.active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}
.badge-status.active:hover {
  background: rgba(16, 185, 129, 0.35);
}
.badge-status.inactive {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.badge-status.inactive:hover {
  background: rgba(239, 68, 68, 0.35);
}


/* --- STYLES NÂNG CẤP ĐĂNG NHẬP / ĐĂNG KÝ / GOOGLE SIGN-IN --- */
.auth-modal-box {
  background: rgba(15, 23, 42, 0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}
.auth-tab-btn {
  background: transparent;
  color: #94a3b8;
  border: none;
}
.auth-tab-btn.active {
  background: #00d2ff !important;
  color: #000 !important;
  box-shadow: 0 2px 10px rgba(0, 210, 255, 0.35) !important;
}
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: #94a3b8;
  pointer-events: none;
}
.auth-custom-input {
  width: 100% !important;
  padding: 10px 38px 10px 36px !important;
  background: rgba(0, 0, 0, 0.45) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 9px !important;
  color: #fff !important;
  font-size: 13.5px !important;
  box-sizing: border-box !important;
  transition: all 0.2s ease !important;
}
.auth-custom-input:focus {
  border-color: #00d2ff !important;
  outline: none !important;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.3) !important;
}
.auth-pwd-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}
.auth-pwd-toggle:hover {
  color: #00d2ff;
}
.btn-auth-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4);
}
.btn-google-signin:hover {
  background: #f1f5f9 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.25) !important;
}


/* Reset tất cả span và label bên trong modal xác thực để không bị dính khung đen */
.auth-modal-box span {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  text-shadow: none !important;
  border-radius: 0 !important;
}
.auth-modal-box label span {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
}
.auth-input-wrap {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
}
.auth-input-icon {
  position: absolute !important;
  left: 12px !important;
  font-size: 15px !important;
  color: #94a3b8 !important;
  pointer-events: none !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  z-index: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.auth-custom-input {
  width: 100% !important;
  padding: 10px 42px 10px 40px !important;
  background: rgba(0, 0, 0, 0.45) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  border-radius: 9px !important;
  color: #fff !important;
  font-size: 13.5px !important;
  box-sizing: border-box !important;
  line-height: normal !important;
}
.auth-custom-input:focus {
  border-color: #00d2ff !important;
  outline: none !important;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.3) !important;
}
.auth-pwd-toggle {
  position: absolute !important;
  right: 12px !important;
  background: transparent !important;
  border: none !important;
  color: #94a3b8 !important;
  font-size: 16px !important;
  cursor: pointer !important;
  padding: 0 !important;
  box-shadow: none !important;
  z-index: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.btn-google-signin span {
  color: #1f2937 !important;
  font-weight: 600 !important;
}


/* --- DUAL UPLOAD SYSTEM (CCCD 2 MẶT + GIẤY TỜ ĐẤT) --- */
.cccd-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) {
  .cccd-upload-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}
.cccd-slot-box {
  transition: all 0.25s ease;
  background: rgba(15, 23, 42, 0.7);
}
.cccd-slot-box:hover {
  border-color: #00d2ff !important;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.2);
}
.btn-cccd-act {
  transition: all 0.2s ease;
}
.btn-cccd-act:hover {
  transform: translateY(-1px);
  filter: brightness(1.2);
}
.ds-preview-container .preview-card {
  border-color: #38bdf8;
}


/* NÂNG CẤP XEM & TẢI ẢNH TRONG MODAL CHỈNH SỬA HỒ SƠ */
.edit-img-item {
  position: relative !important;
  width: 72px !important;
  height: 72px !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  border: 1.5px solid rgba(0, 210, 255, 0.5) !important;
  background: #0b121c !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5) !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s !important;
}
.edit-img-item:hover {
  transform: translateY(-2px) scale(1.03) !important;
  border-color: #00d2ff !important;
  box-shadow: 0 6px 16px rgba(0, 210, 255, 0.45) !important;
}
.edit-img-item img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  transition: opacity 0.2s !important;
}
.edit-img-view-hint {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
}
.edit-img-item:hover .edit-img-view-hint {
  opacity: 1;
}
.edit-img-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(255, 23, 68, 0.95);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.7);
  transition: transform 0.15s, background 0.15s;
  z-index: 5;
}
.edit-img-remove-btn:hover {
  transform: scale(1.15);
  background: #ff1744;
}
.edit-img-dl-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: rgba(0, 210, 255, 0.9);
  color: #000;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.7);
  transition: transform 0.15s, background 0.15s;
  z-index: 5;
}
.edit-img-dl-btn:hover {
  transform: scale(1.15);
  background: #00e676;
}

/* ========================================================
   DOC SCANNER PRO STYLES
   ======================================================== */
#doc-scanner-modal {
  z-index: 100030;
}
.doc-scanner-box {
  max-width: 680px;
  width: 95%;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border: 1.5px solid rgba(0, 210, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
  padding: 16px 18px;
  overflow: hidden;
}
.scanner-filter-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.scanner-filter-btn:hover {
  background: rgba(0, 210, 255, 0.15);
  border-color: #00d2ff;
  color: #00d2ff;
}
.scanner-filter-btn.active {
  background: linear-gradient(135deg, #00d2ff, #0077b6);
  border-color: #00d2ff;
  color: #0b1118;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}


/* ============================================================================
   NHÃN CÁC XÃ GIÁP RANH (2025) VỚI HIỆU ỨNG MỜ DẦN RA XA
   ============================================================================ */
.xa-giap-ranh-label {
  background: transparent !important;
  border: none !important;
  pointer-events: none !important;
}
.xa-giap-ranh-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.25);
}
.xa-giap-ranh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px rgba(15, 23, 42, 0.18);
}

/* ============================================================================
   GIAO DIỆN SÁNG HIỆN ĐẠI (HIGH-CONTRAST LIGHT THEME) CHO TẤT CẢ POPUP & MODAL
   Dễ đọc ngoài nắng trên điện thoại, nổi bật thông tin cốt lõi cho các thôn
   ============================================================================ */

/* 1. Sidebar Thông tin thửa đất (#sidebar) */
#sidebar.sidebar,
#sidebar.sidebar.glass {
  background: rgba(255, 255, 255, 0.97) !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22) !important;
}
#sidebar .sidebar-header,
#sidebar .cadastral-header {
  border-bottom: 1.5px solid #e2e8f0 !important;
  color: #0f172a !important;
}
#sidebar .sidebar-header h2,
#sidebar .sidebar-header h3,
#sidebar h2,
#sidebar h3 {
  color: #0f172a !important;
  font-weight: 800 !important;
}
#sidebar .close-btn,
#sidebar #close-sidebar {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}
#sidebar .close-btn:hover,
#sidebar #close-sidebar:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Làm nổi bật Chủ sử dụng đất, Số Tờ, Số Thửa, Diện tích, Loại đất */
#sidebar .cadastral-owner-box,
#sidebar .cadastral-owner-card {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
}
#sidebar .cadastral-owner-label {
  color: #475569 !important;
  font-weight: 700 !important;
  font-size: 11.5px !important;
}
#sidebar .cadastral-owner-name {
  color: #0f172a !important;
  font-size: 17px !important;
  font-weight: 900 !important;
  letter-spacing: 0.2px !important;
}
#sidebar .cadastral-metric-card,
#sidebar .cadastral-stat-box,
#sidebar .parcel-stat-box,
#sidebar .info-grid-item {
  background: #f0f9ff !important;
  border: 1.5px solid #bae6fd !important;
  color: #0f172a !important;
  border-radius: 10px !important;
}
#sidebar .cadastral-metric-label,
#sidebar .cadastral-stat-label {
  color: #475569 !important;
  font-weight: 700 !important;
  font-size: 11px !important;
}
#sidebar .cadastral-metric-value,
#sidebar .cadastral-stat-value {
  color: #0369a1 !important;
  font-size: 19px !important;
  font-weight: 900 !important;
}
#sidebar .cadastral-landtype-box,
#sidebar .cadastral-old-ref {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}
#sidebar .cadastral-action-btn,
#sidebar .sidebar-action-btn {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
}
#sidebar .cadastral-action-btn:hover,
#sidebar .sidebar-action-btn:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0369a1 !important;
}
#sidebar .cadastral-action-btn.primary,
#sidebar #btn-open-doi-soat {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3) !important;
}
#sidebar p, #sidebar span:not([style*="background:#"]):not([style*="background: #"]) {
  /* Giữ độ tương phản cao trên nền trắng cho chữ xám nhạt cũ */
}

/* 2. Bảng Quản lý Lớp Bản Đồ (#layer-drawer) */
#layer-drawer.layer-drawer,
#layer-drawer.layer-drawer.glass {
  background: rgba(255, 255, 255, 0.97) !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.24) !important;
}
#layer-drawer .drawer-header {
  background: #f8fafc !important;
  border-bottom: 1.5px solid #e2e8f0 !important;
  color: #0f172a !important;
}
#layer-drawer .drawer-header h3,
#layer-drawer .drawer-section-title,
#layer-drawer .layer-group-title {
  color: #0369a1 !important;
  font-weight: 800 !important;
}
#layer-drawer .drawer-section,
#layer-drawer .layer-group-card,
#layer-drawer .layer-card {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}
#layer-drawer label,
#layer-drawer .layer-name,
#layer-drawer .layer-item {
  color: #1e293b !important;
  font-weight: 600 !important;
}
#layer-drawer .basemap-pill {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}
#layer-drawer .basemap-pill.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
#layer-drawer .drawer-close-btn {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

/* 3. TẤT CẢ CÁC CỬA SỔ MODAL (Đối soát, Kê khai, Chỉnh sửa, Quản lý hồ sơ, Đăng nhập, Phản ánh...) */
#doi-soat-modal,
#edit-record-modal,
#admin-records-modal,
#login-modal,
#feedback-modal,
#parcel-slip-modal,
#modal-workflow-guide,
#admin-users-modal,
#admin-user-form-modal {
  background: rgba(15, 23, 42, 0.45) !important;
  backdrop-filter: blur(4px) !important;
}

#doi-soat-modal > div,
#edit-record-modal > div,
#admin-records-modal > div,
#login-modal > div,
#feedback-modal > div,
#parcel-slip-modal > div,
#modal-workflow-guide > div,
#admin-users-modal > div,
#admin-user-form-modal > div {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28) !important;
}

/* Chữ & tiêu đề trong Modal sáng */
#doi-soat-modal h2, #doi-soat-modal h3, #doi-soat-modal h4,
#edit-record-modal h2, #edit-record-modal h3, #edit-record-modal h4,
#admin-records-modal h2, #admin-records-modal h3,
#login-modal h2, #login-modal h3,
#feedback-modal h2, #feedback-modal h3,
#modal-workflow-guide h2, #modal-workflow-guide h3,
#admin-users-modal h2, #admin-users-modal h3,
#admin-user-form-modal h2, #admin-user-form-modal h3 {
  color: #0f172a !important;
}

#doi-soat-modal label,
#edit-record-modal label,
#admin-records-modal label,
#login-modal label,
#feedback-modal label,
#admin-user-form-modal label {
  color: #1e293b !important;
  font-weight: 700 !important;
}

/* Các ô nhập liệu (Input, Select, Textarea) nền trắng chữ đen cực rõ */
#doi-soat-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#doi-soat-modal select,
#doi-soat-modal textarea,
#edit-record-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#edit-record-modal select,
#edit-record-modal textarea,
#admin-records-modal input:not([type="checkbox"]):not([type="radio"]),
#admin-records-modal select,
#login-modal input,
#feedback-modal input,
#feedback-modal textarea,
#admin-users-modal input,
#admin-user-form-modal input,
#admin-user-form-modal select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
}
#doi-soat-modal input::placeholder,
#doi-soat-modal textarea::placeholder,
#edit-record-modal input::placeholder,
#edit-record-modal textarea::placeholder,
#login-modal input::placeholder {
  color: #64748b !important;
}
#doi-soat-modal input:focus,
#doi-soat-modal select:focus,
#doi-soat-modal textarea:focus,
#edit-record-modal input:focus,
#edit-record-modal select:focus,
#edit-record-modal textarea:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.16) !important;
  outline: none !important;
}

/* Khung nội dung con bên trong Modal (trước đây nền tối rgba(255,255,255,0.05) chữ trắng/xám) */
#doi-soat-modal #ds-current-data-view,
#doi-soat-modal #ds-current-data-view > div,
#doi-soat-modal .doi-soat-section,
#edit-record-modal .edit-section {
  color: #0f172a !important;
}
#doi-soat-modal #ds-current-data-view div[style*="rgba(255,255,255,0.05)"],
#doi-soat-modal #ds-current-data-view div[style*="rgba(0,0,0"] {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}
#doi-soat-modal #ds-current-data-view div[style*="rgba(255, 23, 68"] {
  background: #fef2f2 !important;
  border-color: #dc2626 !important;
  color: #0f172a !important;
}
#doi-soat-modal #ds-current-data-view div[style*="rgba(16, 185, 129"] {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #0f172a !important;
}
#doi-soat-modal #ds-current-data-view b[style*="#fff"],
#doi-soat-modal #ds-current-data-view div[style*="#e2e8f0"],
#doi-soat-modal #ds-current-data-view div[style*="#cbd5e1"],
#doi-soat-modal #ds-current-data-view span[style*="#cbd5e1"] {
  color: #0f172a !important;
}
#doi-soat-modal #ds-current-data-view b[style*="#fde047"] {
  color: #b45309 !important;
}
#doi-soat-modal #ds-current-data-view b[style*="#00d2ff"],
#doi-soat-modal #ds-current-data-view b[style*="#00e5ff"] {
  color: #0369a1 !important;
}
#doi-soat-modal #ds-current-data-view div[style*="#ffb74d"] {
  background: #fffbeb !important;
  border: 1px solid #f59e0b !important;
  color: #92400e !important;
}
#doi-soat-modal .doi-soat-status-box.success {
  background: #ecfdf5 !important;
  border: 1.5px solid #10b981 !important;
  color: #065f46 !important;
}
#doi-soat-modal .doi-soat-status-box.warning {
  background: #fffbeb !important;
  border: 1.5px solid #f59e0b !important;
  color: #92400e !important;
}
#doi-soat-modal .doi-soat-status-box.danger {
  background: #fef2f2 !important;
  border: 1.5px solid #dc2626 !important;
  color: #991b1b !important;
}
#doi-soat-modal .doi-soat-tab-btn {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
}
#doi-soat-modal .doi-soat-tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}

/* Ô Dữ liệu sau rà soát CCCD trong Edit Modal trên nền sáng */
#edit-ra-soat-section {
  background: #ecfdf5 !important;
  border: 2px solid #10b981 !important;
}
#edit-ra-soat-section div[style*="#34d399"] {
  color: #047857 !important;
}
#edit-ra-soat-section div[style*="#a7f3d0"],
#edit-ra-soat-section #edit-rs-meta {
  color: #065f46 !important;
}
#edit-record-modal .drawer-close-btn,
#doi-soat-modal .drawer-close-btn,
#admin-records-modal .drawer-close-btn,
#login-modal .drawer-close-btn {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

/* Bảng quản lý hồ sơ (#admin-records-modal) nền sáng chữ đậm */
#admin-records-modal table {
  background: #ffffff !important;
  color: #0f172a !important;
}
#admin-records-modal thead th {
  background: #e0f2fe !important;
  color: #0c4a6e !important;
  border-bottom: 2px solid #7dd3fc !important;
}
#admin-records-modal tbody tr {
  background: #ffffff !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
#admin-records-modal tbody tr:nth-child(even) {
  background: #f8fafc !important;
}
#admin-records-modal tbody tr:hover {
  background: #f0f9ff !important;
}


/* ============================================================================
   TINH CHỈNH TƯƠNG PHẢN CAO CHO SIDEBAR THỬA ĐẤT & MODAL CHÀO MỪNG (LIGHT V2)
   ============================================================================ */
#sidebar .cadastral-metric {
  background: #f0f9ff !important;
  border: 1.5px solid #bae6fd !important;
  border-radius: 10px !important;
}
#sidebar .cadastral-metric .m-label {
  color: #475569 !important;
  font-weight: 700 !important;
}
#sidebar .cadastral-metric .m-val {
  color: #0f172a !important;
  font-weight: 900 !important;
  font-size: 17px !important;
}
#sidebar .cadastral-metric .m-val.accent {
  color: #0369a1 !important;
  font-size: 19px !important;
}
#sidebar .land-type-card {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 10px !important;
}
#sidebar .land-type-code {
  color: #0f172a !important;
  font-weight: 800 !important;
  font-size: 13.5px !important;
}
#sidebar .land-type-desc {
  color: #334155 !important;
  font-weight: 600 !important;
}
#sidebar .legacy-ref-bar {
  background: #fdf2f8 !important;
  border: 1.5px solid #fbcfe8 !important;
  color: #831843 !important;
  font-weight: 600 !important;
}
#sidebar .legacy-ref-bar b {
  color: #9d174d !important;
  font-weight: 800 !important;
}
#sidebar .parcel-act-btn {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1.5px solid #cbd5e1 !important;
  font-weight: 700 !important;
}
#sidebar .parcel-act-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
}
#sidebar .parcel-act-btn.doi-soat {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.32) !important;
}
#sidebar .parcel-act-btn.primary {
  background: #0ea5e9 !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 800 !important;
}
#sidebar .parcel-act-btn.warn {
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1.5px solid #f59e0b !important;
  font-weight: 800 !important;
}

/* Modal chào mừng: sửa độ tương phản khung cảnh báo vàng trên nền sáng */
#modal-workflow-guide div[style*="rgba(255, 193, 7"],
#modal-workflow-guide div[style*="rgba(255,193,7"],
#modal-workflow-guide div[style*="rgba(245, 158, 11"] {
  background: #fffbeb !important;
  border: 1.5px solid #f59e0b !important;
  color: #78350f !important;
}
#modal-workflow-guide div[style*="rgba(255, 193, 7"] *,
#modal-workflow-guide div[style*="rgba(255,193,7"] *,
#modal-workflow-guide p,
#modal-workflow-guide li {
  color: #1e293b !important;
}
#modal-workflow-guide b,
#modal-workflow-guide strong {
  color: #0f172a !important;
}


/* ============================================================================
   KHẮC PHỤC TRIỆT ĐỂ MỌI CHỮ MÀU SÁNG/XANH NHẠT KHÓ ĐỌC TRÊN NỀN SÁNG (LIGHT V3)
   ============================================================================ */
/* 1. Chữ xanh lá nhạt cũ (#86efac, #a7f3d0, #6ee7b7, #69f0ae, #b9f6ca, #bbf7d0, #34d399, #00e676, #4ade80) -> Xanh rêu đậm dễ đọc */
#doi-soat-modal [style*="#86efac"],
#doi-soat-modal [style*="#a7f3d0"],
#doi-soat-modal [style*="#6ee7b7"],
#doi-soat-modal [style*="#69f0ae"],
#doi-soat-modal [style*="#b9f6ca"],
#doi-soat-modal [style*="#bbf7d0"],
#doi-soat-modal [style*="#34d399"],
#doi-soat-modal [style*="#00e676"],
#doi-soat-modal [style*="#4ade80"],
#doi-soat-modal [style*="#4caf50"],
#doi-soat-modal [style*="#4CAF50"],
#edit-record-modal [style*="#86efac"],
#edit-record-modal [style*="#a7f3d0"],
#edit-record-modal [style*="#6ee7b7"],
#edit-record-modal [style*="#34d399"],
#edit-record-modal [style*="#00e676"],
#modal-workflow-guide [style*="#86efac"],
#modal-workflow-guide [style*="#34d399"] {
  color: #065f46 !important;
}

/* Các khối thông báo xanh lá (VD: THỬA ĐẤT ĐÃ CÓ GIẤY CHỨNG NHẬN & THÔNG TIN CHUẨN) -> Nền mint rõ viền đậm, chữ xanh đen siêu nét */
#doi-soat-modal #ds-form-gcn-hint,
#doi-soat-modal #ds-form-gcn-hint *,
#doi-soat-modal #ds-form-case-hint,
#doi-soat-modal #ds-form-case-hint *,
#doi-soat-modal div[style*="rgba(76, 175, 80"],
#doi-soat-modal div[style*="rgba(76,175,80"],
#doi-soat-modal div[style*="rgba(16, 185, 129"],
#doi-soat-modal div[style*="rgba(16,185,129"],
#doi-soat-modal div[style*="rgba(34, 197, 94"],
#doi-soat-modal div[style*="rgba(0, 230, 118"] {
  color: #064e3b !important;
}
#doi-soat-modal div[style*="rgba(76, 175, 80"],
#doi-soat-modal div[style*="rgba(76,175,80"],
#doi-soat-modal div[style*="rgba(16, 185, 129"],
#doi-soat-modal div[style*="rgba(16,185,129"],
#doi-soat-modal div[style*="rgba(34, 197, 94"],
#doi-soat-modal div[style*="rgba(0, 230, 118"] {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
}

/* 2. Chữ xanh dương nhạt / cyan cũ (#00d2ff, #00e5ff, #00ffff, #38bdf8, #7dd3fc, #bae6fd) -> Xanh dương đậm #0369a1 */
#doi-soat-modal [style*="#00d2ff"]:not(button),
#doi-soat-modal [style*="#00e5ff"]:not(button),
#doi-soat-modal [style*="#00ffff"]:not(button),
#doi-soat-modal [style*="#38bdf8"]:not(button),
#doi-soat-modal [style*="#7dd3fc"]:not(button),
#doi-soat-modal [style*="#bae6fd"]:not(button),
#edit-record-modal [style*="#00d2ff"]:not(button),
#edit-record-modal [style*="#00e5ff"]:not(button),
#edit-record-modal [style*="#7dd3fc"]:not(button),
#edit-record-modal [style*="#bae6fd"]:not(button),
#modal-workflow-guide [style*="#00d2ff"]:not(button),
#admin-records-modal [style*="#00d2ff"]:not(button) {
  color: #0369a1 !important;
}

/* 3. Chữ vàng / cam nhạt cũ (#fde047, #fcd34d, #fef08a, #ffb74d, #fbbf24) -> Nâu cam đậm #92400e */
#doi-soat-modal [style*="#fde047"]:not(button),
#doi-soat-modal [style*="#fcd34d"]:not(button),
#doi-soat-modal [style*="#fef08a"]:not(button),
#doi-soat-modal [style*="#ffb74d"]:not(button),
#doi-soat-modal [style*="#fbbf24"]:not(button),
#edit-record-modal [style*="#fde047"]:not(button),
#edit-record-modal [style*="#ffb74d"]:not(button),
#modal-workflow-guide [style*="#fde047"]:not(button),
#modal-workflow-guide [style*="#ffb74d"]:not(button),
#modal-workflow-guide [style*="#fef08a"]:not(button) {
  color: #92400e !important;
}

/* 4. Chữ xám nhạt / trắng nhạt trong form & ghi chú (#cbd5e1, #e2e8f0, #94a3b8, #a0aec0, #aaa, #ccc, #888) -> Đậm rõ #1e293b */
#doi-soat-modal [style*="#cbd5e1"]:not(button),
#doi-soat-modal [style*="#e2e8f0"]:not(button),
#doi-soat-modal [style*="#94a3b8"]:not(button),
#doi-soat-modal [style*="#a0aec0"]:not(button),
#doi-soat-modal [style*="#aaa"]:not(button),
#doi-soat-modal [style*="#ccc"]:not(button),
#doi-soat-modal [style*="#888"]:not(button),
#edit-record-modal [style*="#cbd5e1"]:not(button),
#edit-record-modal [style*="#e2e8f0"]:not(button),
#edit-record-modal [style*="#94a3b8"]:not(button),
#edit-record-modal [style*="#a0aec0"]:not(button),
#edit-record-modal [style*="#aaa"]:not(button),
#edit-record-modal [style*="#888"]:not(button),
#modal-workflow-guide [style*="#cbd5e1"]:not(button),
#modal-workflow-guide [style*="#e2e8f0"]:not(button),
#modal-workflow-guide [style*="#94a3b8"]:not(button) {
  color: #1e293b !important;
}

/* 5. Nút Tab đang chọn ở Modal Đối soát (tránh bị nền xanh nhạt chữ xanh nhạt) */
#doi-soat-modal .doi-soat-tabs button.active,
#doi-soat-modal button.doi-soat-tab.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
#doi-soat-modal .doi-soat-tabs button:not(.active),
#doi-soat-modal button.doi-soat-tab:not(.active) {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

/* 6. Khối xác thực tài khoản kê khai & Khối bước 1 trên Tab Kê khai */
#doi-soat-modal div[style*="rgba(0, 210, 255"],
#doi-soat-modal div[style*="rgba(0,210,255"] {
  background: #f0f9ff !important;
  border-color: #38bdf8 !important;
  color: #0f172a !important;
}
#doi-soat-modal small,
#edit-record-modal small {
  color: #334155 !important;
  font-weight: 500 !important;
}


/* ============================================================================
   GỌN NHẸ, TỐI GIẢN HƯỚNG DẪN & CHỮ SIÊU NÉT TRÊN MỌI CỬA SỔ (LIGHT V4)
   ============================================================================ */
/* 1. Ẩn các khung hướng dẫn/ghi chú dài dòng gây rối mắt, giúp các thôn tập trung nhập & đối soát */
#edit-tinhtrang-hint,
#ds-tinhtrang-hint,
#ds-print-buttons-notice,
#ds-doc-upload-hint,
#doi-soat-modal small,
#edit-record-modal small,
#doi-soat-modal .field-hint,
#edit-record-modal .field-hint {
  display: none !important;
}

/* 2. Ép chữ đậm rõ 100% cho mọi văn bản trong cửa sổ Chỉnh sửa & Đối soát (trừ nút bấm & nhãn nền màu đậm) */
#edit-record-modal,
#edit-record-modal p,
#edit-record-modal li,
#edit-record-modal span:not([style*="background:#"]):not([style*="background: #"]):not([style*="linear-gradient"]),
#edit-record-modal div:not([style*="linear-gradient"]),
#doi-soat-modal p,
#doi-soat-modal li {
  color: #0f172a !important;
}

/* Giữ màu chữ trắng sắc nét trên các nút bấm có nền màu đậm */
#edit-record-modal button[style*="linear-gradient"],
#edit-record-modal button[style*="background:#"],
#edit-record-modal button[style*="background: #"],
#doi-soat-modal button[style*="linear-gradient"],
#doi-soat-modal button[style*="background:#"],
#doi-soat-modal button[style*="background: #"] {
  color: #ffffff !important;
}
#edit-record-modal #btn-save-edit-record,
#edit-record-modal #btn-save-ra-soat-only,
#edit-record-modal #btn-auto-read-cccd {
  color: #ffffff !important;
}
#edit-record-modal button[onclick*="copyOriginalToRaSoat"],
#edit-record-modal button[onclick*="configureGeminiApiKey"],
#edit-record-modal button[onclick*="closeEditRecordModal"] {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #94a3b8 !important;
}
#edit-record-modal button[onclick*="openDocScanner"] {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: none !important;
}
#edit-record-modal label.glass-btn {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
  font-weight: 700 !important;
}

/* 3. Thanh nút In & Tải đơn (Tab Kê khai) rõ nét trên nền sáng */
#ds-print-buttons-bar button {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.28) !important;
}
#ds-print-buttons-bar a.download-form-btn[href*=".docx"] {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border: 1.5px solid #10b981 !important;
  font-weight: 700 !important;
}
#ds-print-buttons-bar a.download-form-btn[href*=".pdf"] {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1.5px solid #ef4444 !important;
  font-weight: 700 !important;
}

/* 4. Ẩn bớt các khối cảnh báo dài ở cuối hộp dữ liệu C06 / VNPT để modal gọn hơn */
#doi-soat-modal #ds-current-data-view div[style*="border: 1px dashed"],
#doi-soat-modal #ds-current-data-view div[style*="Yêu cầu pháp lý"],
#doi-soat-modal #ds-current-data-view div[style*="rgba(255,152,0,0.15)"] {
  display: none !important;
}


/* ============================================================================
   TINH CHỈNH CỠ CHỮ & CĂN NGANG HÀNG TUYỆT ĐỐI TRÊN ĐIỆN THOẠI (LIGHT V5)
   ============================================================================ */
@media (max-width: 768px) {
  #edit-record-modal h3,
  #doi-soat-modal h3 {
    font-size: 14.5px !important;
    line-height: 1.25 !important;
  }
  #edit-record-modal label,
  #doi-soat-modal label {
    font-size: 11px !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-bottom: 4px !important;
  }
  #edit-record-modal [style*="grid-template-columns"],
  #doi-soat-modal [style*="grid-template-columns"] {
    align-items: end !important;
    gap: 8px !important;
  }
  #edit-record-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #edit-record-modal select,
  #edit-record-modal textarea,
  #doi-soat-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #doi-soat-modal select,
  #doi-soat-modal textarea {
    font-size: 13px !important;
    padding: 7px 9px !important;
    height: auto !important;
  }
  #edit-record-modal #edit-modal-subtitle {
    font-size: 11.5px !important;
  }
}


/* ============================================================================
   POPUP QUẢN LÝ LỚP BẢN ĐỒ (#layer-drawer) TÔNG XÁM HIỆN ĐẠI, CHỮ SIÊU NỔI BẬT (V6)
   ============================================================================ */
#layer-drawer.layer-drawer,
#layer-drawer.layer-drawer.glass {
  background: rgba(226, 232, 240, 0.97) !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.32) !important;
}

/* Header xám đậm hơn 1 tông, chữ tiêu đề đen đậm sắc nét */
#layer-drawer .drawer-header,
#layer-drawer .layer-drawer-header {
  background: #cbd5e1 !important;
  border-bottom: 1.5px solid #94a3b8 !important;
  color: #0f172a !important;
}
#layer-drawer .drawer-header *,
#layer-drawer .layer-drawer-header * {
  color: #0f172a !important;
  font-weight: 800 !important;
}
#layer-drawer .drawer-close-btn,
#layer-drawer #close-layer-drawer {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1.5px solid #64748b !important;
}

/* Khung thanh trượt độ rõ & các khung nhóm bên trong */
#layer-drawer .drawer-section,
#layer-drawer .layer-group-card,
#layer-drawer .layer-card,
#layer-drawer .opacity-control-box,
#layer-drawer div[style*="rgba(0, 210, 255"],
#layer-drawer div[style*="rgba(255,255,255,0.0"] {
  background: #f1f5f9 !important;
  border: 1px solid #94a3b8 !important;
  color: #0f172a !important;
}

/* Mọi tiêu đề nhóm & nhãn bên trong đều đậm rõ tương phản cao */
#layer-drawer .drawer-section-title,
#layer-drawer .layer-group-title,
#layer-drawer h4,
#layer-drawer [style*="#00d2ff"],
#layer-drawer [style*="#00e5ff"],
#layer-drawer [style*="#38bdf8"] {
  color: #0369a1 !important;
  font-weight: 800 !important;
}
#layer-drawer [style*="#cbd5e1"],
#layer-drawer [style*="#e2e8f0"],
#layer-drawer [style*="#94a3b8"],
#layer-drawer [style*="#a0aec0"],
#layer-drawer [style*="#aaa"],
#layer-drawer [style*="#fff"] {
  color: #0f172a !important;
}
#layer-drawer label,
#layer-drawer .layer-name,
#layer-drawer .layer-item,
#layer-drawer .layer-item span {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* Các ô vuông màu chú giải (swatch) luôn có viền mảnh để màu trắng không bị chìm */
#layer-drawer .layer-color-dot,
#layer-drawer .color-swatch,
#layer-drawer .layer-swatch {
  border: 1px solid rgba(15, 23, 42, 0.35) !important;
}

/* Các nút chọn Nền bản đồ (Base Map) */
#layer-drawer .basemap-pill {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
  font-weight: 700 !important;
}
#layer-drawer .basemap-pill:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}
#layer-drawer .basemap-pill.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0369a1 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35) !important;
}

/* Khu tra cứu 34 Tỉnh & 3.321 Xã ở cuối popup quản lý lớp */
#layer-drawer select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #64748b !important;
  font-weight: 600 !important;
}
#layer-drawer button:not(.drawer-close-btn):not(.basemap-pill) {
  background: #e0f2fe !important;
  color: #0c4a6e !important;
  border: 1.5px solid #0284c7 !important;
  font-weight: 800 !important;
}
#layer-drawer button[onclick*="zoomToTanHoi"],
#layer-drawer button[id*="btn-back-tanhoi"],
#layer-drawer button[style*="#ff5252"],
#layer-drawer button[style*="#f43f5e"] {
  background: #fff1f2 !important;
  color: #be123c !important;
  border: 1.5px solid #e11d48 !important;
  font-weight: 800 !important;
}


/* ============================================================================
   TỐI ƯU KHOA HỌC & CĂN NGANG HÀNG CHUẨN XÁC TRÊN ĐIỆN THOẠI (LIGHT V7)
   ============================================================================ */
/* 1. Luôn căn đỉnh (start) + chống tràn ngang (min-width: 0) cho mọi lưới 2-3 cột */
#doi-soat-modal [style*="grid-template-columns"],
#edit-record-modal [style*="grid-template-columns"] {
  align-items: start !important;
}
#doi-soat-modal [style*="grid-template-columns"] > div,
#edit-record-modal [style*="grid-template-columns"] > div {
  min-width: 0 !important;
}
#doi-soat-modal input,
#doi-soat-modal select,
#doi-soat-modal textarea,
#edit-record-modal input,
#edit-record-modal select,
#edit-record-modal textarea {
  box-sizing: border-box !important;
  max-width: 100% !important;
}

/* 2. Ẩn 2 dòng chú thích thừa dưới ô CCCD & SĐT để 2 cột ngang hàng tuyệt đối */
#ds-cccd-msg,
#ds-phone-msg {
  display: none !important;
}

/* 3. Nút Thêm Vợ/Chồng rõ nét trên nền sáng */
#btn-add-co-owner {
  background: #f0f9ff !important;
  border: 1.5px dashed #0284c7 !important;
  color: #0369a1 !important;
  font-weight: 700 !important;
}
#btn-add-co-owner span {
  color: #0369a1 !important;
}

@media (max-width: 768px) {
  /* Giảm cỡ chữ khoa học trên điện thoại để không nhảy dòng, không tràn mép phải */
  #doi-soat-modal > div,
  #edit-record-modal > div {
    padding: 14px 12px !important;
  }
  #doi-soat-modal label,
  #edit-record-modal label {
    font-size: 10.5px !important;
    line-height: 1.25 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-bottom: 3px !important;
  }
  #doi-soat-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #doi-soat-modal select,
  #doi-soat-modal textarea,
  #edit-record-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #edit-record-modal select,
  #edit-record-modal textarea {
    font-size: 12.5px !important;
    padding: 6px 8px !important;
  }
  /* Tỷ lệ cột khoa học: Năm sinh gọn (0.62fr), Số CCCD rộng rãi (1.38fr) */
  #doi-soat-modal div:has(> div > #ds-form-namsinh) {
    grid-template-columns: 0.62fr 1.38fr !important;
    gap: 8px !important;
  }
  #doi-soat-modal div:has(> div > #ds-form-phone) {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  #doi-soat-modal div:has(> div > #ds-form-thon) {
    grid-template-columns: 0.85fr 1.35fr !important;
    gap: 8px !important;
  }
  /* Badge "Đã xác thực" giữ gọn 1 dòng */
  #doi-soat-modal span[style*="Đã xác thực"],
  #doi-soat-modal div[style*="border-radius: 999px"],
  #doi-soat-modal span[style*="padding: 2px 8px"] {
    white-space: nowrap !important;
    font-size: 10.5px !important;
  }
}


/* ============================================================================
   CHỐNG CẮT DẤU CHỮ IN HOA TIẾNG VIỆT (Ầ, Ế, Ổ, Ứ...) TRONG Ô INPUT (LIGHT V8)
   ============================================================================ */
#doi-soat-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#doi-soat-modal select,
#edit-record-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#edit-record-modal select {
  line-height: 1.55 !important;
  padding-top: 9px !important;
  padding-bottom: 7px !important;
  min-height: 38px !important;
  overflow: visible !important;
}
#ds-form-hoten,
#edit-form-hoten,
#edit-rs-hoten {
  line-height: 1.65 !important;
  padding-top: 10px !important;
  padding-bottom: 8px !important;
  min-height: 42px !important;
}


/* ============================================================================
   GIỮ GỌN TIÊU ĐỀ & NÚT "ĐỐI SOÁT DÂN CƯ & KÊ KHAI ĐẤT ĐAI" TRÊN 1 HÀNG (V9)
   ============================================================================ */
#doi-soat-modal .slip-header h3 {
  font-size: 15px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
#sidebar .parcel-act-btn.doi-soat {
  white-space: nowrap !important;
  font-size: 12.5px !important;
}
@media (max-width: 768px) {
  #doi-soat-modal .slip-header h3 {
    font-size: 12.5px !important;
    letter-spacing: -0.2px !important;
  }
  #sidebar .parcel-act-btn.doi-soat {
    font-size: 12px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}


/* ============================================================================
   SỬA CẮT DẤU TIÊU ĐỀ "ĐỐI SOÁT..." & NÉN KHOẢNG TRẮNG HIỂN THỊ NHIỀU HƠN (V10)
   ============================================================================ */
/* 1. Bỏ overflow:hidden & tăng line-height để không bao giờ cắt dấu Ố, Ấ trên tiêu đề */
#doi-soat-modal .slip-header h3 {
  overflow: visible !important;
  line-height: 1.55 !important;
  padding-top: 2px !important;
  margin-top: 2px !important;
}
#doi-soat-modal .slip-header {
  padding-bottom: 6px !important;
  margin-bottom: 6px !important;
}

/* 2. Giảm khoảng trắng thừa giữa các khối trong cửa sổ Đối soát & Chỉnh sửa */
#doi-soat-status-badge {
  margin-bottom: 6px !important;
}
#doi-soat-status-badge:empty {
  display: none !important;
  margin: 0 !important;
}
#doi-soat-modal .doi-soat-status-box {
  padding: 6px 10px !important;
  font-size: 11.5px !important;
}
#doi-soat-modal .doi-soat-tabs {
  margin-bottom: 8px !important;
  padding-bottom: 6px !important;
  gap: 6px !important;
}
#doi-soat-modal .doi-soat-tabs button {
  padding: 6px 8px !important;
  font-size: 11.5px !important;
  line-height: 1.25 !important;
}

@media (max-width: 768px) {
  #doi-soat-modal > div,
  #edit-record-modal > div {
    padding: 10px 10px !important;
  }
  #doi-soat-modal .slip-header h3 {
    font-size: 12px !important;
  }
  /* Nén khoảng cách dọc giữa các khối form để hiện nhiều dòng thông tin hơn trên 1 màn hình */
  #doi-soat-modal #doi-soat-form > div,
  #doi-soat-modal #tab-ke-khai > div,
  #edit-record-modal form > div {
    margin-bottom: 7px !important;
  }
  #doi-soat-modal div[style*="padding: 12px 14px"],
  #doi-soat-modal div[style*="padding: 10px 12px"],
  #doi-soat-modal div[style*="padding: 12px"],
  #edit-record-modal div[style*="padding: 12px"] {
    padding: 8px 10px !important;
  }
  #doi-soat-modal div[style*="margin-bottom: 14px"],
  #doi-soat-modal div[style*="margin-bottom: 16px"],
  #doi-soat-modal div[style*="margin-bottom: 12px"],
  #doi-soat-modal div[style*="margin-bottom: 10px"] {
    margin-bottom: 6px !important;
  }
  #doi-soat-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #doi-soat-modal select,
  #edit-record-modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  #edit-record-modal select {
    min-height: 34px !important;
    padding-top: 7px !important;
    padding-bottom: 5px !important;
    line-height: 1.5 !important;
  }
  #ds-form-hoten,
  #edit-form-hoten,
  #edit-rs-hoten {
    min-height: 38px !important;
    padding-top: 8px !important;
    padding-bottom: 6px !important;
    line-height: 1.6 !important;
  }
}


/* ============================================================================
   ĐỒNG BỘ HIỆU ỨNG NÚT CHỌN FILE/PDF, SCAN, GỬI HỒ SƠ & QUAY LẠI (LIGHT V11)
   ============================================================================ */
/* 1. 2 nút Scan tài liệu: nền xanh dương đậm sắc nét, chữ trắng nổi bật */
#doi-soat-modal button[onclick*="openDocScanner"] {
  background: linear-gradient(135deg, #0284c7, #2563eb) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.32) !important;
  font-weight: 800 !important;
}

/* 2. Ô "Chụp thường" và ô "Chọn File / PDF" đồng bộ y hệt nhau, rõ nét trên nền sáng */
#doi-soat-modal button[onclick*="ds-cccd-camera"],
#doi-soat-modal button[onclick*="ds-cccd-gallery"],
#doi-soat-modal button[onclick*="ds-input-camera"],
#doi-soat-modal button[onclick*="ds-input-gallery"] {
  background: #e0f2fe !important;
  border: 1.5px solid #0284c7 !important;
  color: #0369a1 !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.14) !important;
}
#doi-soat-modal button[onclick*="ds-cccd-camera"]:active,
#doi-soat-modal button[onclick*="ds-cccd-gallery"]:active,
#doi-soat-modal button[onclick*="ds-input-camera"]:active,
#doi-soat-modal button[onclick*="ds-input-gallery"]:active {
  background: #bae6fd !important;
}

/* 3. Nút "Gửi Hồ Sơ Xác Minh / Đăng Ký" và nút "Quay lại" đồng bộ hiệu ứng nổi bật */
#doi-soat-modal #btn-submit-doi-soat {
  background: linear-gradient(135deg, #0284c7, #1d4ed8) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.35) !important;
}
#doi-soat-modal button[onclick*="switchDoiSoatTab('status')"] {
  background: linear-gradient(135deg, #475569, #334155) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 12px rgba(51, 65, 85, 0.3) !important;
}


/* ============================================================================
   BẢNG QUẢN LÝ HỒ SƠ (#admin-records-modal) CHỮ ĐẬM SIÊU RÕ NÉT (LIGHT V12)
   ============================================================================ */
#admin-records-modal #admin-modal-title {
  color: #0c4a6e !important;
  text-shadow: none !important;
}
#admin-records-modal #admin-modal-sub {
  color: #334155 !important;
  font-weight: 600 !important;
}
#admin-records-modal .btn-modal-action {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
}
#admin-records-modal .btn-modal-action[style*="#ff5252"] {
  color: #dc2626 !important;
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
}

/* Thanh công cụ lọc & các nút bấm */
#admin-records-modal .admin-toolbar {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 10px !important;
}
#admin-records-modal .admin-toolbar span,
#admin-records-modal .admin-toolbar div {
  color: #0f172a !important;
}
#admin-records-modal #btn-toggle-admin-filters {
  background: #0284c7 !important;
  color: #ffffff !important;
  border: none !important;
}
#admin-records-modal #btn-toggle-admin-filters span {
  color: #ffffff !important;
}
#admin-records-modal .admin-toolbar button.glass-btn {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
  font-weight: 700 !important;
}
#admin-records-modal #admin-btn-load-all {
  background: #fffbeb !important;
  color: #b45309 !important;
  border-color: #f59e0b !important;
}
#admin-records-modal #admin-btn-export {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #10b981 !important;
}
#admin-records-modal #admin-btn-export-zip {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #0284c7 !important;
}
#admin-records-modal #admin-records-stats,
#admin-records-modal #admin-records-stats * {
  color: #0369a1 !important;
  font-weight: 700 !important;
}

/* Mọi chữ bên trong bảng danh sách hồ sơ (#admin-records-tbody) đều đậm rõ 100% */
#admin-records-tbody td,
#admin-records-tbody td div,
#admin-records-tbody td span,
#admin-records-tbody td p,
#admin-records-tbody td small,
#admin-records-tbody td a {
  color: #0f172a !important;
}
#admin-records-tbody td b,
#admin-records-tbody td strong {
  color: #0f172a !important;
  font-weight: 800 !important;
}

/* Chuyển đổi màu ngữ nghĩa sáng cũ -> màu đậm sắc nét trên nền trắng */
#admin-records-tbody [style*="#00d2ff"],
#admin-records-tbody [style*="#00e5ff"],
#admin-records-tbody [style*="#38bdf8"],
#admin-records-tbody [style*="#7dd3fc"] {
  color: #0369a1 !important;
  font-weight: 700 !important;
}
#admin-records-tbody [style*="#00e676"],
#admin-records-tbody [style*="#86efac"],
#admin-records-tbody [style*="#4ade80"],
#admin-records-tbody [style*="#34d399"],
#admin-records-tbody [style*="#4CAF50"],
#admin-records-tbody [style*="#4caf50"],
#admin-records-tbody [style*="#81c784"] {
  color: #047857 !important;
  font-weight: 700 !important;
}
#admin-records-tbody [style*="#fde047"],
#admin-records-tbody [style*="#ffb74d"],
#admin-records-tbody [style*="#fbbf24"],
#admin-records-tbody [style*="#fcd34d"],
#admin-records-tbody [style*="#ff9800"] {
  color: #b45309 !important;
  font-weight: 700 !important;
}
#admin-records-tbody [style*="#ff5252"],
#admin-records-tbody [style*="#ff8a80"],
#admin-records-tbody [style*="#fca5a5"],
#admin-records-tbody [style*="#ef9a9a"],
#admin-records-tbody [style*="#ff1744"] {
  color: #b91c1c !important;
  font-weight: 700 !important;
}

/* Các nút thao tác trong bảng (Sửa, Định vị, Xóa, Xem ảnh...) rõ nét */
#admin-records-tbody button {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1px solid #94a3b8 !important;
  font-weight: 700 !important;
}
#admin-records-tbody button[style*="linear-gradient"],
#admin-records-tbody button[style*="background:#0284c7"],
#admin-records-tbody button[style*="background: #0284c7"] {
  color: #ffffff !important;
  border: none !important;
}
#admin-records-tbody button[title*="Xóa"],
#admin-records-tbody button[onclick*="delete"] {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border-color: #fca5a5 !important;
}
#admin-records-tbody button[title*="Sửa"],
#admin-records-tbody button[onclick*="openEditRecordModal"] {
  background: #fffbeb !important;
  color: #b45309 !important;
  border-color: #f59e0b !important;
}
#admin-records-tbody button[title*="Vị trí"],
#admin-records-tbody button[onclick*="locate"] {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #38bdf8 !important;
}

/* Thanh phân trang ở đáy bảng (#admin-pagination-container) nền sáng chữ đậm */
#admin-pagination-container {
  background: #f1f5f9 !important;
  border-top: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}
#admin-pagination-container div,
#admin-pagination-container span {
  color: #0f172a !important;
  font-weight: 600 !important;
}
#admin-pagination-container button {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1.5px solid #94a3b8 !important;
  font-weight: 700 !important;
}
#admin-pagination-container button.active,
#admin-pagination-container button[style*="background:#00d2ff"],
#admin-pagination-container button[style*="background: #00d2ff"] {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}


/* ============================================================================
   THANH LỌC NHANH ĐỢT 5 (553 THỬA MỤC TIÊU + 10 THÔN MỚI) - DESKTOP & MOBILE
   ============================================================================ */
.dot5-filter-bar {
  position: fixed;
  top: 18px;
  left: 416px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(15, 23, 42, 0.14);
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.18);
  max-width: calc(100vw - 650px);
  flex-wrap: wrap;
}
.dot5-filter-bar.hidden {
  display: none !important;
}
.dot5-pills-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}
.dot5-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}
.dot5-pill:hover {
  background: #e2e8f0;
}
.dot5-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.dot5-pill.pill-xm.active {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
}
.dot5-pill.pill-d10.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0369a1;
}
.dot5-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  background: rgba(15, 23, 42, 0.1);
  color: inherit;
}
.dot5-pill.active .dot5-badge {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
}
.dot5-thon-select {
  height: 30px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1.5px solid #94a3b8;
  background: #ffffff;
  color: #0f172a;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  max-width: 178px;
  text-overflow: ellipsis;
  outline: none;
}
.dot5-thon-select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* Tablet / Laptop hẹp: đưa xuống hàng 2 ngay dưới search-box nếu màn hình < 1360px để không bao giờ đụng nút Quản lý hồ sơ */
@media (max-width: 1359px) and (min-width: 769px) {
  .dot5-filter-bar {
    top: 70px;
    left: 20px;
    max-width: calc(100vw - 40px);
  }
}

/* Mobile First: 2 dòng cực gọn, đẩy nút Lớp bản đồ xuống dưới để không chồng đè */
@media (max-width: 768px) {
  .dot5-filter-bar {
    top: 62px;
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 5px 6px;
    gap: 5px;
    border-radius: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  body.dot5-active .layer-manager-btn {
    top: 146px !important;
  }
  body.dot5-active .layer-drawer {
    top: 194px !important;
  }
  .dot5-pills-row {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: space-between;
  }
  .dot5-pills-row::-webkit-scrollbar {
    display: none;
  }
  .dot5-pill {
    flex: 1;
    justify-content: center;
    padding: 5px 6px;
    font-size: 11px;
  }
  .dot5-thon-select {
    width: 100%;
    max-width: none;
    height: 30px;
    font-size: 11.5px;
  }
}


/* === WEBGIS PHƯỜNG XUÂN HƯƠNG - ĐÀ LẠT: UI POLISH & CONTRAST FIXES === */
/* 1. Bảo đảm nút Đăng nhập / Quản lý hồ sơ luôn rõ nét kể cả trên nền bản đồ Giao thông sáng */
#auth-btn,
#btn-admin-records,
#btn-install-pwa {
  background: rgba(15, 23, 42, 0.86) !important;
  color: #f8fafc !important;
  border: 1.5px solid rgba(0, 210, 255, 0.72) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
  backdrop-filter: blur(12px);
}
#auth-btn:hover,
#btn-admin-records:hover {
  background: rgba(2, 132, 199, 0.92) !important;
  color: #ffffff !important;
}

/* 2. Khắc phục triệt để lỗi chữ trắng trên nền thẻ trắng ở Phiếu Tra Cứu Thông Tin Thửa Đất */
#parcel-slip-modal .parcel-slip-box,
#parcel-slip-modal .slip-body {
  color: #0f172a !important;
}
#parcel-slip-modal .slip-header h3 {
  color: #0f172a !important;
}
#parcel-slip-modal .slip-row {
  color: #334155 !important;
}
#parcel-slip-modal .slip-row span {
  color: #475569 !important;
}
#parcel-slip-modal .slip-row strong {
  color: #0f172a !important;
}
#parcel-slip-modal .slip-footer-note {
  color: #475569 !important;
}

/* 3. Thanh lọc nhanh 1.499 thửa Nhóm 2 theo 37 Tổ dân phố */
.dot5-filter-bar {
  background: rgba(11, 18, 28, 0.88) !important;
  border: 1.5px solid rgba(0, 210, 255, 0.45) !important;
  backdrop-filter: blur(14px);
}
.dot5-pill.pill-xm.active,
.dot5-pill.pill-n23.active {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #f59e0b !important;
  color: #fbbf24 !important;
}
.dot5-pill.pill-d10.active,
.dot5-pill.pill-n21.active {
  background: rgba(0, 210, 255, 0.22) !important;
  border-color: #00d2ff !important;
  color: #00e5ff !important;
}


/* === ROUND 2 POLISH FIXES (VERIFIED IN BROWSER) === */
/* Đưa thanh lọc Nhóm 2 ra giữa-trên trên PC để không bao giờ bị Sidebar bên trái che */
@media (min-width: 769px) {
  .dot5-filter-bar {
    left: 50% !important;
    transform: translateX(-50%) !important;
    top: 14px !important;
    max-width: 560px !important;
  }
  .dot5-thon-select {
    white-space: nowrap !important;
    min-width: 220px !important;
  }
  .ui-container {
    width: 345px !important;
  }
}

/* Độ tương phản sắc nét trong Modal Đăng nhập (nền thẻ trắng) */
#login-modal #auth-error {
  background: #fee2e2 !important;
  border: 1.5px solid #ef4444 !important;
  color: #991b1b !important;
  font-weight: 600 !important;
}
#login-modal .auth-tab-btn:not(.active) {
  color: #334155 !important;
  background: rgba(255, 255, 255, 0.72) !important;
}
#login-modal .auth-tab-btn.active {
  background: linear-gradient(135deg, #00d2ff, #0284c7) !important;
  color: #ffffff !important;
}

/* Độ tương phản nhãn thanh trượt trong Drawer Quản lý lớp bản đồ */
#layer-drawer .opacity-header,
#layer-drawer .opacity-header span,
#layer-drawer .opacity-header strong {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* Căn lề gọn đẹp cho Header Modal Đối soát & Phiếu TT */
#doi-soat-modal .slip-header {
  padding-left: 2px !important;
}
#parcel-slip-modal .slip-agency {
  font-size: 11px !important;
  white-space: nowrap !important;
}


/* === ROUND 3 FINAL POLISH === */
/* Đảm bảo Modal Đăng nhập luôn nổi trên Modal Đối soát */
#login-modal {
  z-index: 100020 !important;
}
/* Đảm bảo khung Yêu cầu đăng nhập trong Tab 2 Đối soát luôn rõ nét */
#ds-form-auth-gate,
#ds-form-auth-gate p,
#ds-form-auth-gate b {
  color: #f1f5f9 !important;
}
@media (min-width: 769px) {
  .dot5-filter-bar {
    max-width: 680px !important;
    width: auto !important;
    padding: 6px 10px !important;
  }
  .dot5-thon-select {
    max-width: 260px !important;
    text-overflow: ellipsis !important;
    overflow: hidden !important;
  }
}
