* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  height: 100vh;
  display: flex;
  padding-top: 0;
  background: #0f172a;
}

/* --- Header (mobile only) --- */
#appHeader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 1100;
  background: #0f172a;
  color: #f1f5f9;
  border-bottom: 1px solid #1e293b;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
#headerTitle {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#headerIcon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.18);
  font-size: 13px;
  line-height: 1;
}
#headerRight { display: flex; align-items: center; }

/* --- Icon Rail (desktop) --- */
#iconRail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 56px;
  background: #0f172a;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  border-right: 1px solid #1e293b;
}
.rail-menu-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 50%;
  color: #94a3b8;
  cursor: pointer;
  margin-bottom: 12px;
  transition: color 0.15s, background 0.15s;
}
.rail-menu-btn:hover { color: #e2e8f0; background: rgba(148, 163, 184, 0.12); }

.app-menu-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1200;
  transition: opacity 0.2s;
}
.app-menu-backdrop.hidden { display: none; }

.app-menu {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: #0f172a;
  z-index: 1300;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  transition: left 0.25s ease;
}
.app-menu.open { left: 0; }
.app-menu.hidden { display: none; }

.app-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #1e293b;
}
.app-menu-title {
  font-size: 17px;
  font-weight: 700;
  color: #f1f5f9;
}
.app-menu-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.app-menu-close:hover { color: #e2e8f0; }

.app-menu-links {
  flex: 1;
  padding: 12px 0;
}
.app-menu-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.app-menu-link:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #f1f5f9;
}
.app-menu-link svg { color: #64748b; flex-shrink: 0; }

.app-menu-footer {
  padding: 16px 20px;
  border-top: 1px solid #1e293b;
  font-size: 12px;
  color: #475569;
}
.rail-btn {
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 0;
  background: none;
  border: none;
  border-radius: 8px;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.rail-btn:hover { color: #cbd5e1; background: rgba(148, 163, 184, 0.1); }
.rail-btn.active { color: #4a90d9; background: rgba(74, 144, 217, 0.1); }

/* --- Search Bar (desktop) --- */
#searchBar {
  position: fixed;
  top: 14px;
  left: 72px;
  z-index: 1060;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 16px;
  background: #1e293b;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  width: 360px;
  transition: background 0.15s;
  overflow: hidden;
}
#searchBar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #6b9eff;
  transition: none;
}
#searchBar.loading::after {
  width: 100%;
  animation: search-bar-progress 1.5s ease-in-out infinite;
}
@keyframes search-bar-progress {
  0% { left: -30%; width: 30%; }
  50% { left: 50%; width: 30%; }
  100% { left: 100%; width: 30%; }
}
#searchBarMain {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  cursor: pointer;
}
#searchBarMain:hover ~ #searchBarClear { opacity: 1; }
#searchBar:hover { background: #253347; }
#searchBar svg { color: #64748b; flex-shrink: 0; }
#searchBarText { color: #94a3b8; font-size: 14px; }
#searchBar.has-result #searchBarText { color: #f1f5f9; }
#searchBarClear {
  display: none;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
#searchBarClear:hover { color: #f1f5f9; }
#searchBar.has-result #searchBarClear { display: block; }

#authBtn {
  display: none;
}
#authBtnDesktop {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 1060;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 24px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
#authBtnDesktop:hover { background: #253347; cursor: pointer; }
#authBtnDesktop svg { flex-shrink: 0; color: #94a3b8; }

.user-menu {
  position: fixed;
  top: 56px;
  right: 16px;
  z-index: 1070;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  padding: 16px;
  min-width: 240px;
}
.user-menu.hidden { display: none; }
.user-menu-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.user-menu-info img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}
#userMenuName {
  color: #f1f5f9;
  font-size: 14px;
  font-weight: 600;
}
#userMenuEmail {
  color: #94a3b8;
  font-size: 12px;
}
#userMenuSignOut {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
#userMenuSignOut:hover { background: #334155; }

/* --- Sidebar / Floating Card (desktop) --- */
#sidebar {
  position: fixed;
  top: 66px;
  left: 72px;
  bottom: 16px;
  width: 360px;
  min-width: 0;
  background: #1e293b;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  z-index: 1050;
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 1;
  transform: scale(1);
}
#sidebar.hidden {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

.sidebar-header { display: none; }

.sidebar-tabs { display: none; }
.sidebar-tab { display: none; }

.sidebar-view { display: none; flex-direction: column; gap: 16px; min-height: 0; flex: 1; }
.sidebar-view.active { display: flex; }

#sidebar label { display: block; font-size: 13px; font-weight: 600; color: #94a3b8; margin-bottom: 4px; }
#sidebar input, #sidebar select {
  width: 100%; padding: 8px 10px; border: 1px solid #334155; border-radius: 6px;
  font-size: 14px; outline: none; transition: border-color 0.2s;
  background: #0f172a; color: #f1f5f9;
}
#sidebar input::placeholder { color: #64748b; }
#sidebar input:focus, #sidebar select:focus { border-color: #3b82f6; }
#sidebar .field { margin-bottom: 2px; }
#searchBtn {
  width: 100%; padding: 10px; background: #4a90d9; color: #fff;
  border: none; border-radius: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
#searchBtn:hover { background: #3a7bc8; }
#searchBtn:disabled { background: #aaa; cursor: not-allowed; }
#addToListBtn {
  width: 100%;
  padding: 10px;
  background: #0ea5a0;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: -8px;
  display: none;
}
#addToListBtn:hover { background: #0b8f8a; }
.error { color: #f87171; font-size: 13px; display: none; }
.hint { color: #64748b; font-size: 12px; }
#listHint { display: none; color: #67e8f9; }
.list-action-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.show-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.show-all-btn:hover { color: #4a90d9; border-color: #4a90d9; }
.show-all-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.show-all-btn svg { flex-shrink: 0; }
.parcel-list-empty {
  color: #64748b;
  font-size: 12px;
}
.save-modal-card {
  max-width: 380px;
  max-height: 80vh;
  overflow-y: auto;
}
.save-modal-card .save-overlay-header {
  margin-bottom: 16px;
}
.save-modal-card .save-panel-title {
  font-size: 17px;
  font-weight: 700;
}
.save-modal-card .save-overlay-header button {
  font-size: 24px;
}
.save-overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.save-overlay-header button {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.save-overlay-header button:hover { color: #f1f5f9; }
.save-panel-title {
  color: #f1f5f9;
  font-size: 15px;
  margin: 0;
}
.save-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 6px;
}
.save-list-item:hover { background: #1e293b; }
.save-list-item.save-list-readonly { opacity: 0.6; cursor: default; }
.save-list-item.save-list-readonly:hover { background: #0f172a; }
.save-list-item.saved {
  border-color: #0ea5a0;
  color: #0ea5a0;
}
.save-list-item svg { flex-shrink: 0; }
.save-list-name { flex: 1; }
.save-check { margin-left: auto; }
.new-list-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed #475569;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.new-list-btn:hover { color: #cbd5e1; border-color: #cbd5e1; }
#viewSearch { overflow: hidden; }
#viewDetails { overflow-y: auto; }
#viewList { overflow: hidden; }
#viewListParcels { overflow-y: auto; }
#viewSaleDetail { overflow-y: auto; }
#viewSharedList { overflow-y: auto; }
#parcelListWrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#listsContainer {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.new-list-btn-top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 12px;
  flex-shrink: 0;
  margin-bottom: 12px;
  border-radius: 8px;
  border: none;
  background: #0ea5a0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.new-list-btn-top:hover { background: #0d9488; }
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop.hidden { display: none; }
.modal-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.modal-card h3 {
  color: #f1f5f9;
  font-size: 16px;
  margin-bottom: 16px;
}
#newListName {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 14px;
  margin-bottom: 16px;
}
#newListName:focus { border-color: #3b82f6; outline: none; }
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-btn-secondary {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.modal-btn-secondary:hover { background: #334155; }
.modal-btn-primary {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: #4a90d9;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.modal-btn-primary:hover { background: #3a7bc8; }

.lists-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #cbd5e1;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.15s;
}
.lists-item:hover { background: #1e293b; }
.lists-item-name { font-size: 13px; font-weight: 600; color: #f1f5f9; }
.lists-item-count { font-size: 11px; color: #64748b; }
.lists-item-actions { position: relative; display: flex; align-items: center; }
.lists-menu-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.lists-menu-btn:hover { color: #cbd5e1; background: #334155; }
.lists-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 120px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 50;
  padding: 4px;
}
.lists-menu-dropdown.hidden { display: none; }
.lists-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.lists-menu-dropdown button:hover { background: #334155; }
.lists-menu-dropdown button.menu-danger { color: #f87171; }

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 4px;
}
.back-btn:hover { color: #f1f5f9; }

.list-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 12px;
}
.list-detail-menu {
  position: relative;
  flex-shrink: 0;
}
.list-title-static {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
}
.list-title-input {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  background: #0f172a;
  border: 1px solid #0ea5a0;
  border-radius: 6px;
  padding: 4px 8px;
  outline: none;
}
.list-title-input.hidden { display: none; }

.list-auth-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 16px;
  text-align: center;
  color: #94a3b8;
}
.list-auth-prompt svg { color: #475569; }
.list-auth-prompt p { margin: 0; font-size: 13px; }
.list-auth-prompt button {
  padding: 10px 24px;
  border-radius: 24px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.list-auth-prompt button:hover { background: #253347; }
.parcel-list-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 6px;
  color: #cbd5e1;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.parcel-list-item:hover { background: #1e293b; }
.parcel-list-info { flex: 1; min-width: 0; }
.parcel-item-actions {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.parcel-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  color: #64748b;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.parcel-menu-btn:hover { color: #cbd5e1; background: #334155; }
.parcel-menu-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 130px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 50;
  padding: 4px;
}
.parcel-menu-dropdown.hidden { display: none; }
.parcel-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.parcel-menu-dropdown button:hover { background: #334155; }
.parcel-menu-dropdown button.menu-danger { color: #f87171; }
.parcel-note {
  margin-top: 4px;
  padding: 4px 8px;
  background: rgba(74, 144, 217, 0.08);
  border-radius: 4px;
}
.parcel-note-text {
  font-size: 11px;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-word;
}
.parcel-note-editor { margin-top: 6px; }
.parcel-note-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}
.parcel-note-input:focus { border-color: #4a90d9; }
.parcel-note-editor-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.note-save-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: #4a90d9;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.note-save-btn:hover { background: #3a7bc8; }
.note-cancel-btn {
  padding: 4px 10px;
  border: 1px solid #334155;
  border-radius: 4px;
  background: none;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
}
.note-cancel-btn:hover { background: #334155; }

#detailsContent h3 { font-size: 16px; color: #f1f5f9; margin-bottom: 8px; }
#detailsContent .label { color: #94a3b8; }
#detailsContent .value { color: #f1f5f9; font-weight: 600; }
#detailsContent .value.zone-detail { font-weight: 400; font-size: 12px; }
#detailsContent > div { padding: 4px 0; font-size: 13px; }

.details-divider {
  border: none;
  border-top: 1px solid #334155;
  margin: 12px 0 0;
}
#detailsActions {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-top: 12px;
}
.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.action-label {
  font-size: 11px;
  color: #e2e8f0;
}
#detailsActions button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #334155;
  background: #1e293b;
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
#detailsAddBtn.is-saved {
  background: #0ea5a0;
  border-color: #0ea5a0;
  color: #fff;
}
#detailsAddBtn.is-saved + .action-label {
  color: #0ea5a0;
}
#detailsActions button:hover {
  background: #0ea5a0;
  color: #fff;
  border-color: #0ea5a0;
}
#detailsActions button.done {
  background: #0ea5a0;
  color: #fff;
  border-color: #0ea5a0;
}


#backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.sheet-handle { display: none; }

#bottomBar {
  display: none;
}

/* Map area */
#map-wrap {
  position: fixed;
  top: 0;
  left: 56px;
  right: 0;
  bottom: 0;
}
#map { width: 100%; height: 100%; }

/* App-bar menu button (mobile only) */
#openBtnMobile {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-size: 24px;
  font-weight: 400;
  cursor: pointer;
  color: #f1f5f9;
  justify-content: center; align-items: center;
}
#openBtnMobile:hover { background: rgba(148, 163, 184, 0.18); }


@media (max-width: 640px) {
  body { padding-top: 0; padding-bottom: 56px; }

  #appHeader { display: none; }
  #iconRail { display: none; }

  #searchBar {
    display: flex;
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    z-index: 1060;
    padding: 12px 16px;
    border-radius: 12px;
    background: #1e293b;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
  #searchBar svg { color: #64748b; }
  #searchBarText { color: #94a3b8; font-size: 14px; }
  #searchBar.has-result #searchBarText { color: #f1f5f9; }
  #searchBarClear { color: #94a3b8; }
  #searchBarClear:hover { color: #f1f5f9; }

  #authBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #334155;
    background: #0f172a;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
  }
  #authBtn:hover { background: #253347; }
  #authBtnDesktop { display: none; }

  #map-wrap { left: 0; top: 0; bottom: 56px; }

  #bottomBar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    z-index: 1100;
  }
  .bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-tab.active { color: #4a90d9; }

  #sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 56px;
    top: auto;
    width: 100%;
    max-height: 65vh;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    transform: translateY(0);
    visibility: visible;
    opacity: 1;
    z-index: 1050;
  }
  #sidebar.hidden {
    transform: translateY(100%);
    visibility: hidden;
    pointer-events: none;
    opacity: 1;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.2s;
  }

  .sheet-handle {
    display: block;
    width: 100%;
    padding: 10px 0 2px;
    flex-shrink: 0;
    cursor: pointer;
  }
  .sheet-handle::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: #475569;
    border-radius: 2px;
    margin: 0 auto;
  }

  .sidebar-header { display: none; }
}

/* --- Share modal --- */
.share-modal-card { max-width: 420px; }
.share-modal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.share-modal-header h3 {
  margin: 0; font-size: 16px; color: #f1f5f9;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1;
}
.share-modal-x {
  background: none; border: none; color: #94a3b8; font-size: 22px; cursor: pointer; padding: 0 4px; flex-shrink: 0;
}

.share-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #334155;
}
.share-option:last-child { border-bottom: none; }
.share-option-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: #0f172a; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #94a3b8;
}
.share-option-info { flex: 1; min-width: 0; }
.share-option-title { font-size: 14px; font-weight: 500; color: #f1f5f9; }
.share-option-desc { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.share-copy-btn {
  background: #14b8a6; color: #fff; border: none; border-radius: 6px;
  padding: 8px 14px; cursor: pointer; font-size: 12px; font-weight: 500; white-space: nowrap;
  flex-shrink: 0;
}
.share-copy-btn:hover { background: #0d9488; }
.share-copied {
  font-size: 12px; color: #14b8a6; margin-top: 8px; text-align: center;
}
.share-copied.hidden { display: none; }

/* --- Shared list badge --- */
.shared-list-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: #94a3b8;
}
.shared-badge {
  font-size: 12px; color: #14b8a6; font-weight: 500;
}
.shared-parcel-item {
  background: #0f172a; border: 1px solid #334155; border-radius: 6px;
  padding: 8px; margin-bottom: 6px; color: #cbd5e1; font-size: 12px; cursor: pointer;
  transition: background 0.15s;
}
.shared-parcel-item:hover { background: #1e293b; }

/* Share indicator on list items */
.list-share-badge {
  font-size: 10px; color: #14b8a6; margin-left: 6px;
}
.list-role-badge {
  font-size: 10px; color: #4a90d9; margin-left: 6px;
  background: rgba(74, 144, 217, 0.12); padding: 1px 6px; border-radius: 4px;
}

/* Shared with me section */
.shared-with-me-label {
  font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase;
  letter-spacing: 0.5px; margin: 16px 0 8px; padding-top: 12px;
  border-top: 1px solid #334155;
}
.lists-item-shared {
  border-color: rgba(74, 144, 217, 0.2);
}

/* --- Sale panel --- */
#viewSale { overflow: hidden; }
.sale-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
#saleResults {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.sale-price-row {
  display: flex;
  gap: 8px;
}
.sale-filter-btn {
  width: 100%;
  padding: 10px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.sale-filter-btn:hover { background: #3a7bc8; }

.sale-browse-btn {
  width: 100%;
  padding: 8px;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.sale-browse-btn:hover { border-color: #475569; color: #e2e8f0; }

/* Listing cards */
.listing-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.listing-card:hover { background: #172033; }
.listing-card-body {
  display: flex;
  gap: 12px;
  align-items: center;
}
.listing-card-info {
  flex: 1;
  min-width: 0;
}
.listing-card-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
}
.listing-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.listing-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listing-card-price {
  font-size: 14px;
  font-weight: 700;
  color: #4a90d9;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.listing-card-loc {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}
.listing-poster-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

/* Verified badge */
.listing-verified {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Sale modal card */
.sale-modal-card {
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 28px;
}
.sale-modal-card .save-overlay-header {
  margin-bottom: 20px;
}
.sale-modal-card .save-panel-title {
  font-size: 18px;
  font-weight: 700;
}
.sale-modal-card .save-overlay-header button {
  font-size: 24px;
}

/* Sale form */
.sale-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sale-form .field {
  margin-bottom: 0;
}
.sale-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
}
.sale-form input,
.sale-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #334155;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #0f172a;
  color: #f1f5f9;
}
.sale-form input::placeholder { color: #64748b; }
.sale-form input:focus,
.sale-form select:focus { border-color: #3b82f6; }
.sale-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  color: #f1f5f9;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}
.sale-form textarea::placeholder { color: #64748b; }
.phone-row {
  display: flex;
  gap: 8px;
}
.phone-row select {
  width: auto;
  flex-shrink: 0;
  padding: 10px 8px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.phone-row input {
  flex: 1;
}
.sale-form textarea:focus { border-color: #3b82f6; }
.sale-submit-btn {
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.sale-submit-btn:hover { background: #3a7bc8; }
.sale-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.sale-remove-btn {
  width: 100%;
  padding: 12px;
  background: transparent;
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sale-remove-btn:hover { background: rgba(248, 113, 113, 0.1); border-color: #f87171; }

/* Upload area */
.upload-area {
  border: 1px dashed #475569;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: rgba(15, 23, 42, 0.5);
}
.upload-area:hover { border-color: #4a90d9; background: rgba(74, 144, 217, 0.05); }
.upload-placeholder {
  color: #64748b;
  font-size: 13px;
}
.upload-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.upload-preview img {
  max-width: 100%;
  max-height: 120px;
  border-radius: 6px;
  object-fit: contain;
}

/* Photo upload grid */
.photo-upload-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.photo-thumb {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-add {
  width: 60px;
  height: 60px;
  border: 1px dashed #475569;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.photo-add:hover { border-color: #4a90d9; color: #4a90d9; }

.sale-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
}

/* Listing detail */
.listing-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.listing-detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.listing-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listing-detail-price {
  font-size: 17px;
  font-weight: 700;
  color: #4a90d9;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.listing-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
}
.listing-detail-loc {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.listing-detail-parcel {
  display: inline;
}
.listing-detail-desc {
  font-size: 13px;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  padding: 10px 0;
  border-top: 1px solid #1e293b;
}
.listing-detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #0f172a;
  border-radius: 8px;
}
.listing-detail-poster-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e1;
  min-width: 0;
}
.listing-detail-poster-inline .listing-poster-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}
.listing-detail-poster-inline span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listing-detail-contact-inline {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: #94a3b8;
  flex-shrink: 0;
}
.listing-gallery {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.listing-gallery-img {
  height: 120px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.listing-cert {
  margin-top: 4px;
}
.listing-cert img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 6px;
  object-fit: contain;
}

/* Sale button listed state */
#detailsSaleBtn.is-listed {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}
#detailsSaleBtn.is-listed + .action-label {
  color: #f59e0b;
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox-backdrop.hidden { display: none; }
.lightbox-img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
  z-index: 1;
  line-height: 1;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 36px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.15s, background 0.15s;
}
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}
.listing-gallery-img,
.listing-cert img {
  cursor: zoom-in;
}

/* Sale map markers */
.sale-marker,
.sale-marker.leaflet-div-icon,
.leaflet-marker-icon.sale-marker,
.leaflet-div-icon.sale-marker,
div.sale-marker {
  overflow: visible !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.sale-marker-label {
  background: #1d4ed8;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  cursor: pointer;
  border: 1.5px solid #fff;
  width: max-content;
}
.sale-marker-label:hover {
  background: #2563eb;
}

.sale-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #94a3b8;
  font-size: 13px;
}
.sale-loading.hidden { display: none; }
.sale-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #334155;
  border-top-color: #6b9eff;
  border-radius: 50%;
  animation: sale-spin 0.7s linear infinite;
}
@keyframes sale-spin {
  to { transform: rotate(360deg); }
}

.listing-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}
.listing-status-pending {
  background: #422006;
  color: #fbbf24;
}
.listing-status-rejected {
  background: #450a0a;
  color: #f87171;
}

.listing-share-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  width: 100%;
  justify-content: center;
}
.listing-share-btn:hover {
  border-color: #475569;
  color: #e2e8f0;
}
