:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #0ea5e9;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.16);
}

body.dark-theme {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1e293b;
  --border: #273449;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 32px rgba(0, 0, 0, 0.6);
}

body.dark-theme .filter-bar input[type="search"],
body.dark-theme .form-row input,
body.dark-theme .form-row textarea,
body.dark-theme .cookie-body textarea,
body.dark-theme .map-control-group select {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark-theme .ms-btn,
body.dark-theme .owner-chip,
body.dark-theme .breakdown-pill,
body.dark-theme .btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark-theme .ms-btn:hover,
body.dark-theme .owner-chip:hover,
body.dark-theme .btn-secondary:hover {
  background: #273449;
}

body.dark-theme .owner-chip.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

body.dark-theme .ms-menu,
body.dark-theme .modal-card,
body.dark-theme .detail-panel,
body.dark-theme .map-legend,
body.dark-theme .map-active-filters,
body.dark-theme .map-side-table {
  background: #111827;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark-theme .ms-item:hover,
body.dark-theme #parcels-table tbody tr:hover,
body.dark-theme .map-mini-table tbody tr:hover,
body.dark-theme .lv-popup-table tbody tr:hover,
body.dark-theme .mini-table tbody tr:hover,
body.dark-theme .data-table tbody tr:hover {
  background: #1e3a5f !important;
}

body.dark-theme #parcels-table tbody tr:nth-child(even),
body.dark-theme .mini-table tbody tr:nth-child(even),
body.dark-theme .data-table tbody tr:nth-child(even),
body.dark-theme .map-mini-table tbody tr:nth-child(even),
body.dark-theme .lv-popup-table tbody tr:nth-child(even) {
  background: #162033;
}

body.dark-theme #parcels-table tbody tr:nth-child(odd),
body.dark-theme .mini-table tbody tr:nth-child(odd),
body.dark-theme .data-table tbody tr:nth-child(odd),
body.dark-theme .map-mini-table tbody tr:nth-child(odd),
body.dark-theme .lv-popup-table tbody tr:nth-child(odd) {
  background: #0f172a;
}

.map-mini-table thead th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

body.dark-theme #parcels-table thead th,
body.dark-theme .mini-table th,
body.dark-theme .lv-popup-table thead th,
body.dark-theme .map-side-header,
body.dark-theme .table-header-bar {
  background: #0f172a;
  color: #cbd5e1;
  border-color: #273449;
}

body.dark-theme #parcels-table tbody td,
body.dark-theme .mini-table td {
  border-color: #1e293b;
}

body.dark-theme .kpi-card.kpi-accent {
  background: linear-gradient(180deg, #172554 0%, #111827 100%);
}

body.dark-theme .meta-box,
body.dark-theme .owner-row,
body.dark-theme .preview-box,
body.dark-theme .pstat,
body.dark-theme .help-note,
body.dark-theme .pdf-res-row,
body.dark-theme .segmented {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-theme .seg-btn {
  color: #94a3b8;
}

body.dark-theme .seg-btn.active {
  background: #3b82f6;
  color: #fff;
}

body.dark-theme .owner-row.tracked {
  background: #172554;
  border-color: #3b82f6;
}

body.dark-theme .owner-row-text {
  color: #cbd5e1;
}

body.dark-theme .owner-tag {
  background: #1e293b;
  color: #e2e8f0;
}

body.dark-theme .lv-pill {
  background: #1e3a8a;
  color: #bfdbfe;
}

body.dark-theme .share-pct {
  color: #f8fafc;
}

body.dark-theme .pdf-drop-section {
  background: #0f172a;
  border-color: #1e3a8a;
}

body.dark-theme .pdf-drop-zone {
  background: #111827;
  border-color: #0284c7;
}

body.dark-theme .legend-title,
body.dark-theme .map-control-group {
  color: #e2e8f0;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Topbar */
.topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  background: #0f172a;
  color: #f8fafc;
  border-bottom: 1px solid #1e293b;
  flex-shrink: 0;
  position: relative;
  z-index: 900;
  max-width: 100%;
}

.topbar-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-quick-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-menu-btn,
.mobile-only-quick {
  display: none;
}

body:not(.mobile-compact) .topbar-menu-btn,
body:not(.mobile-compact) .mobile-only-quick {
  display: none !important;
}

.topbar-collapsible {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #fff;
}

.brand > div {
  display: none;
}

.nav-tabs {
  display: flex;
  flex-wrap: nowrap;
  background: #1e293b;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
}

.nav-tab {
  border: none;
  background: transparent;
  color: #cbd5e1;
  padding: 6px 9px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-tab:visited {
  color: #cbd5e1;
}

.nav-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.nav-tab.active,
.nav-tab.active:visited {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.topbar-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.topbar-actions .btn {
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

/* Buttons */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}

.topbar .btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

.topbar .btn-secondary:hover {
  background: #334155;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: #e2e8f0;
  color: var(--text);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: #fecaca;
}

.btn-danger-ghost:hover {
  background: #fef2f2;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #b91c1c;
}

.ms-only-btn {
  margin-left: auto;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.ms-only-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.parcel-map-label.interactive-label {
  pointer-events: auto !important;
  cursor: pointer;
}

.parcel-map-label.interactive-label:hover {
  border-color: #ef4444;
  background: rgba(15, 23, 42, 0.95);
}

/* Compact Single-Row Filter Bar + Multi-Select */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.search-box-wrap {
  position: relative;
  flex: 1 1 200px;
  min-width: 170px;
  max-width: 300px;
}

.search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  opacity: 0.65;
}

.filter-bar input[type="search"] {
  height: 31px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  padding: 0 8px 0 28px;
  outline: none;
  transition: border-color 0.15s;
}

.filter-bar input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.ms-dropdown {
  position: relative;
  display: inline-block;
}

.ms-btn {
  height: 31px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 0 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.ms-btn.has-active {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}

.ms-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 1200;
  min-width: 240px;
  width: max-content;
  max-width: min(560px, 92vw);
  max-height: 320px;
  overflow-y: auto;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
}

.ms-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.ms-item span {
  white-space: nowrap;
}

.ms-item:hover {
  background: #f1f5f9;
}

.ms-item input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
}

.owner-chips-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* Dual-thumb Logarithmic Share Range Slider */
.share-range-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 10px;
  height: 31px;
}

.share-range-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  min-width: 118px;
  font-variant-numeric: tabular-nums;
}

.dual-range-wrap {
  position: relative;
  width: 190px;
  height: 20px;
  display: flex;
  align-items: center;
}

.dual-range-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: 999px;
  background: #cbd5e1;
}

body.dark-theme .dual-range-track {
  background: #334155;
}

body.dark-theme .share-range-box {
  background: #1e293b;
  border-color: #334155;
}

.dual-range-fill {
  position: absolute;
  height: 5px;
  border-radius: 999px;
  background: var(--primary);
  left: 0%;
  width: 100%;
}

.dual-range-wrap input[type="range"] {
  position: absolute;
  left: 0;
  width: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  height: 20px;
}

.dual-range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.dual-range-wrap input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.owner-chip:hover {
  border-color: #94a3b8;
}

.owner-chip.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.hatch-swatch {
  width: 16px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.35);
  display: inline-block;
  flex-shrink: 0;
}

/* Main Content & Views */
.main-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 20px;
}

.view.active {
  display: flex;
  flex-direction: column;
}

#view-table.active {
  overflow: hidden;
}

#view-map.active {
  padding: 0;
  overflow: hidden;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.kpi-card.kpi-accent {
  border-left: 4px solid var(--primary);
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
  color: var(--text);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.breakdown-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.breakdown-pill {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.breakdown-pill strong {
  color: var(--primary);
}

/* Big Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.table-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  flex-shrink: 0;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: #e0e7ff;
  color: #3730a3;
}

.table-scroll {
  position: relative;
  overflow: auto;
  flex: 1 1 0;
  min-height: 0;
  overscroll-behavior: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
}

#parcels-table,
.data-table,
.mini-table,
.lv-popup-table {
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th,
.mini-table thead th,
.lv-popup-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  box-shadow: inset 0 -2px 0 var(--border), 0 2px 4px rgba(15, 23, 42, 0.06);
}

body.dark-theme .data-table thead th,
body.dark-theme .mini-table thead th,
body.dark-theme .lv-popup-table thead th,
body.dark-theme #parcels-table thead th {
  background: #0f172a;
  box-shadow: inset 0 -2px 0 #273449, 0 2px 6px rgba(0, 0, 0, 0.45);
}

#parcels-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  border-bottom: none;
  box-shadow: inset 0 -2px 0 var(--border), 0 2px 4px rgba(15, 23, 42, 0.08);
  padding: 6px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#parcels-table thead th:hover {
  background: #eef2ff;
}

#parcels-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

#parcels-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

#parcels-table tbody td {
  padding: 5px 8px;
  border-bottom: 1px solid #eef2f6;
  vertical-align: middle;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.3;
}

#parcels-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

#parcels-table tbody tr:hover {
  background: #dbeafe !important;
}

th.num, td.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty-cell {
  text-align: center;
  padding: 40px 20px !important;
  color: var(--text-muted);
}

.lv-pill {
  display: inline-block;
  font-weight: 800;
  color: #1e3a8a;
  background: #dbeafe;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reg-badge {
  display: inline-block;
  font-weight: 800;
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
}

.reg-C {
  background: #dcfce7;
  color: #166534;
}

.reg-E {
  background: #fef3c7;
  color: #92400e;
}

.loc-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.loc-1 {
  background: #fce7f3;
  color: #9d174d;
}

.loc-2 {
  background: #ecfdf5;
  color: #065f46;
}

.owner-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f1f5f9;
  font-size: 11.5px;
  font-weight: 600;
  margin: 1px 3px 1px 0;
  white-space: nowrap;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 11.5px;
  border-radius: 5px;
  text-decoration: none;
}

.btn-pdf-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(56, 189, 248, 0.22);
  color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
}

.btn-pdf-header:hover {
  background: rgba(56, 189, 248, 0.35);
}

.share-pct {
  font-weight: 700;
  color: #0f172a;
}

/* Map View */
.info-banner {
  background: #fef9c3;
  color: #854d0e;
  border-bottom: 1px solid #fde047;
  padding: 7px 16px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.map-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.map-control-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.map-control-group select {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 8px;
  font-size: 12.5px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.segmented {
  display: inline-flex;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #475569;
}

.seg-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.map-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-side-table {
  width: 420px;
  min-width: 240px;
  max-width: 75vw;
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
}

.map-side-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.map-pin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.map-pin-btn:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

body.dark-theme .map-pin-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.map-side-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.map-mini-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 11.5px;
}

.map-mini-table th,
.map-mini-table td {
  padding: 3px 6px;
  line-height: 1.25;
  white-space: nowrap;
}

.map-mini-table tbody tr {
  cursor: pointer;
}

.map-mini-table tbody tr:hover {
  background: #eff6ff;
}

.map-mini-table tbody tr.selected-row {
  background: #dbeafe;
}

.map-resizer {
  width: 6px;
  background: #e2e8f0;
  cursor: col-resize;
  flex-shrink: 0;
  transition: background 0.15s;
}

.map-resizer:hover,
.map-resizer.dragging {
  background: var(--primary);
}

.map-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.map-canvas {
  width: 100%;
  height: 100%;
  background: #0f172a;
}

.map-corner-table-btn {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 610;
  height: 32px;
  padding: 0 11px;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}

.map-corner-table-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.map-corner-table-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.dark-theme .map-corner-table-btn {
  background: rgba(15, 23, 42, 0.92);
  border-color: #334155;
  color: #f8fafc;
}

body.dark-theme .map-corner-table-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.map-active-filters {
  position: absolute;
  left: 14px;
  top: 54px;
  z-index: 600;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  max-width: 300px;
  max-height: 40vh;
  overflow-y: auto;
}

.map-active-filters.collapsed {
  padding: 7px 12px;
}

.map-active-filters.collapsed .legend-body {
  display: none;
}

.map-active-filter-chip {
  display: block;
  padding: 3px 7px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  font-size: 11.5px;
  line-height: 1.35;
}

.map-legend {
  position: absolute;
  left: 14px;
  bottom: 24px;
  z-index: 600;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  max-width: 300px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  font-size: 12px;
}

.map-legend.collapsed {
  padding: 7px 12px;
}

.map-legend.collapsed .legend-body {
  display: none;
}

.legend-header-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.legend-body {
  margin-top: 6px;
}

.legend-title {
  font-weight: 800;
  margin-bottom: 6px;
  font-size: 12px;
  color: #0f172a;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

/* Side Detail Panel */
.detail-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 400px;
  max-width: calc(100vw - 24px);
  z-index: 700;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0f172a;
  color: #fff;
}

.detail-title {
  font-size: 16px;
  font-weight: 800;
}

.detail-subtitle {
  font-size: 12.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.btn-icon-close {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
}

.btn-icon-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

.detail-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meta-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.meta-box .k {
  font-size: 11px;
  color: var(--text-muted);
}

.meta-box .v {
  font-size: 13.5px;
  font-weight: 700;
  margin-top: 2px;
}

.owner-row {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  background: #fff;
}

.owner-row.tracked {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.owner-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 12.5px;
}

.owner-share-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  overflow: hidden;
  margin: 5px 0 4px 0;
}

.owner-share-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.owner-row-text {
  font-size: 12px;
  color: #334155;
  margin-top: 3px;
}

.enc-item {
  padding: 8px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 6px;
  color: #7c2d12;
}

/* Import View */
#view-import.active {
  overflow: hidden;
}

.import-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.card-stretch {
  overflow: hidden;
}

.card h2 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.muted {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.form-row {
  margin-bottom: 12px;
}

.form-row label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 5px;
  color: #334155;
}

.form-row input,
.form-row textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
}

.form-row textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  resize: vertical;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.preview-box {
  margin-top: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.cookie-box {
  margin-top: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.cookie-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.cookie-body {
  margin-top: 10px;
}

.cookie-steps {
  margin: 0 0 8px 0;
  padding-left: 18px;
  font-size: 12px;
  color: #334155;
  line-height: 1.5;
}

.cookie-body textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  resize: vertical;
}

/* PDF Drag & Drop */
.pdf-drop-section {
  margin-top: 14px;
  padding: 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
}

.pdf-drop-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
  font-size: 13px;
}

.pdf-drop-zone {
  border: 2px dashed #38bdf8;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
}

.pdf-drop-zone:hover,
.pdf-drop-zone.dragover {
  background: #e0f2fe;
  border-color: var(--primary);
}

.pdf-drop-icon {
  font-size: 22px;
  margin-bottom: 4px;
}

.link-like {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

.pdf-upload-results {
  margin-top: 10px;
  font-size: 12px;
  max-height: 180px;
  overflow-y: auto;
}

.pdf-res-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid #e0f2fe;
  background: #fff;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.pstat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px;
  text-align: center;
}

.pstat .n {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.pstat .l {
  font-size: 11px;
  color: var(--text-muted);
}

.progress-wrap {
  margin-bottom: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
}

.progress-track {
  height: 9px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #06b6d4);
  transition: width 0.25s ease;
}

.fetch-log {
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11.5px;
  height: 115px;
  flex-shrink: 0;
  overflow-y: auto;
  margin: 0 0 12px 0;
  white-space: pre-wrap;
}

.sub-heading {
  font-size: 13px;
  margin: 6px 0 8px 0;
  flex-shrink: 0;
}

.mini-table-scroll {
  flex: 1;
  min-height: 160px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
}

.mini-table th, .mini-table td {
  padding: 9px 11px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12.5px;
  text-align: left;
  vertical-align: middle;
}

.mini-table td.num, .mini-table th.num,
.data-table td.num, .data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mini-table th {
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 2;
}

.mini-table tbody tr:nth-child(odd),
.map-mini-table tbody tr:nth-child(odd),
.lv-popup-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

.mini-table tbody tr:nth-child(even),
.map-mini-table tbody tr:nth-child(even),
.lv-popup-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.mini-table tbody tr:hover,
.map-mini-table tbody tr:hover,
.lv-popup-table tbody tr:hover {
  background: #eff6ff;
}

.status-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.status-done { background: #dcfce7; color: #166534; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-error { background: #fee2e2; color: #991b1b; }

/* Help Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2300;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#pdf-modal {
  z-index: 2500;
}

.modal-card {
  width: 680px;
  max-width: 100%;
  max-height: 90vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  font-size: 13.5px;
  line-height: 1.55;
}

.help-steps {
  margin: 0 0 14px 0;
  padding-left: 20px;
}

.help-steps li {
  margin-bottom: 10px;
}

.help-steps ul {
  margin-top: 4px;
  padding-left: 18px;
}

.help-note {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  font-size: 12.5px;
}

.help-code {
  margin: 8px 0 0 0;
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
}

/* Parcel zoom labels + PDF & LV Modals */
.parcel-map-label {
  display: inline-block;
  width: max-content;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.parcel-map-label::before {
  display: none;
}

.modal-pdf {
  width: 94vw;
  height: 92vh;
  max-height: 92vh;
}

.pdf-modal-pages {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  background: #1e293b;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.pdf-modal-pages canvas {
  max-width: 100%;
  height: auto !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  background: #fff;
}

.modal-backdrop-light {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.modal-lv-parcels {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  max-width: 94vw;
  max-height: 76vh;
  pointer-events: auto;
  border: 1px solid var(--border);
}

.modal-lv-parcels .detail-header {
  cursor: move;
  user-select: none;
}

.lv-modal-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.lv-popup-table {
  width: 100%;
  border-collapse: collapse;
}

.lv-popup-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.lv-popup-table tbody tr {
  cursor: pointer;
}

.lv-popup-table tbody tr:hover {
  background: #dbeafe;
}

.lv-clickable-pill {
  display: inline-block;
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 5px;
  padding: 1px 6px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
}

.lv-clickable-pill:hover {
  background: rgba(56, 189, 248, 0.4);
  color: #fff;
}

.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.detail-section-head h4 {
  margin: 0 !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2600;
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 9px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
}

/* Parcel map label */
.parcel-label-tooltip {
  pointer-events: none !important;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .import-grid { grid-template-columns: 1fr; }
}

/* --- Landing Page (Unauthenticated) --- */
.landing-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 45%),
              radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.1), transparent 45%),
              var(--bg, #f8fafc);
}

.landing-card {
  max-width: 820px;
  width: 100%;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  padding: 36px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1);
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.landing-logo {
  width: 54px;
  height: 54px;
  font-size: 20px;
}

.landing-brand h1 {
  margin: 0;
  font-size: 26px;
}

.landing-tagline {
  margin: 4px 0 0;
  color: var(--muted, #64748b);
  font-size: 14px;
}

.landing-intro {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 22px;
}

.landing-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.landing-feature {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-alt, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
}

.lf-icon {
  font-size: 22px;
  line-height: 1.2;
}

.landing-feature strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.landing-feature p {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #64748b);
  line-height: 1.45;
}

.landing-alert {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #b91c1c;
  font-size: 13px;
  margin-bottom: 18px;
}

.landing-cta {
  text-align: center;
  padding-top: 8px;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 24px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn-google:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.google-g {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: #2563eb;
  font-weight: 800;
  font-size: 14px;
}

@media (max-width: 640px) {
  .landing-view {
    padding: 12px;
  }

  .landing-card {
    padding: 20px 16px;
    border-radius: 14px;
  }

  .btn-google {
    width: 100%;
    padding: 12px 14px;
    font-size: 14px;
  }
}

.landing-note {
  margin: 14px auto 0;
  max-width: 620px;
  font-size: 12.5px;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

/* --- Topbar Auth & DB Switcher --- */
.db-switcher-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-alt, #f1f5f9);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  padding: 3px 8px;
}

.db-switcher-select {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
  max-width: 170px;
  cursor: pointer;
}

.role-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: #e2e8f0;
  color: #334155;
}

.role-badge.role-superuser {
  background: #fef3c7;
  color: #92400e;
}

.role-badge.role-admin {
  background: #dbeafe;
  color: #1e40af;
}

.role-badge.role-viewer {
  background: #e2e8f0;
  color: #475569;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
  border-left: 1px solid var(--border, #cbd5e1);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name-label {
  font-size: 12.5px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Admin & Superadmin Views --- */
#view-admin.active,
#view-superadmin.active {
  max-width: 1480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-shell-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#view-admin .panel-card,
#view-superadmin .panel-card {
  padding: 16px 18px;
  border-radius: 12px;
}

#view-admin .mini-table-scroll,
#view-superadmin .mini-table-scroll {
  max-height: 320px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

#view-admin .admin-grid .panel-card {
  display: flex;
  flex-direction: column;
}

/* --- What's New Subpage --- */
.whats-new-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px 24px;
}

.whats-new-md {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 12px;
}

.wn-date-group {
  border-left: 3px solid var(--primary, #2563eb);
  padding-left: 16px;
}

.wn-date-heading {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.wn-entries-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wn-entry {
  padding: 12px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--surface-alt, #f8fafc);
}

.wn-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.wn-entry-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.wn-entry-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
}

.wn-detail-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border, #cbd5e1);
  background: transparent;
  color: var(--text-muted, #475569);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.wn-detail-toggle:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary, #2563eb);
}

.wn-entry-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border, #cbd5e1);
  font-size: 12.8px;
  line-height: 1.55;
  color: var(--text, #1e293b);
}

body.dark-theme .wn-detail-toggle {
  border-color: #334155;
  color: #94a3b8;
}

body.dark-theme .wn-detail-toggle:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

body.dark-theme .wn-entry-details {
  border-top-color: #334155;
  color: #e2e8f0;
}

.wn-entry-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted, #475569);
}

body.dark-theme .wn-date-heading {
  color: #f1f5f9;
}

body.dark-theme .wn-entry {
  background: #0f172a;
  border-color: #1e293b;
}

body.dark-theme .wn-entry-body {
  color: #cbd5e1;
}

/* --- Active Filter Highlight --- */
.filter-active,
.ms-dropdown.filter-active .ms-btn,
body.dark-theme .filter-active,
body.dark-theme .ms-dropdown.filter-active .ms-btn {
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.12) !important;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
}

.map-control-group.filter-active,
label.checkbox-label.filter-active {
  border: 1px solid #ef4444;
  border-radius: 7px;
  padding: 2px 7px;
}

/* --- Center Map Accent Button --- */
.btn-center-accent {
  background: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  color: #ffffff;
  border: 1px solid rgba(14, 165, 233, 0.45);
  font-weight: 600;
}

.btn-center-accent:hover {
  filter: brightness(1.08);
}

/* --- Table Row Hover Map Cutout Preview --- */
.table-parcel-preview {
  position: fixed;
  z-index: 2500;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  padding: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  width: 276px;
}

.table-parcel-preview .tpp-title {
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-parcel-preview canvas {
  display: block;
  width: 260px;
  height: 170px;
  border-radius: 6px;
  background: #0b1120;
}

/* --- Parcel Hover Yellow Pulsing Glow --- */
@keyframes parcelYellowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(250, 204, 21, 1)) drop-shadow(0 0 20px rgba(250, 204, 21, 0.9)) drop-shadow(0 0 36px rgba(234, 179, 8, 0.75));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(254, 249, 195, 1)) drop-shadow(0 0 34px rgba(250, 204, 21, 1)) drop-shadow(0 0 56px rgba(250, 204, 21, 0.95));
  }
}

path.parcel-hover-glow {
  animation: parcelYellowPulse 0.95s ease-in-out infinite;
}

/* --- Export Spinner --- */
@keyframes exportSpin {
  to { transform: rotate(360deg); }
}

.export-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  border: 4px solid rgba(148, 163, 184, 0.25);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: exportSpin 0.8s linear infinite;
}

.btn-bars-collapse {
  margin-left: 2px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 31px;
  border-radius: 7px;
  border: 1px solid rgba(59, 130, 246, 0.55);
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

.btn-bars-collapse:hover {
  filter: brightness(1.1);
}

.topbar-collapsed-tools {
  display: none;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#topbar-collapsed-tools .search-box-wrap {
  flex: 0 1 230px;
  min-width: 170px;
  max-width: 260px;
}

#topbar-collapsed-tools input[type="search"] {
  height: 31px;
  width: 100%;
  border: 1px solid #334155;
  border-radius: 7px;
  background: #1e293b;
  color: #f8fafc;
  font-size: 12.5px;
  padding: 0 8px 0 28px;
  outline: none;
}

#topbar-collapsed-tools input[type="search"]::placeholder {
  color: #94a3b8;
}

#topbar-collapsed-tools input[type="search"]:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

body.bars-collapsed .brand > div,
body.bars-collapsed #tab-other-owners,
body.bars-collapsed #tab-import,
body.bars-collapsed #tab-admin,
body.bars-collapsed #tab-superadmin,
body.bars-collapsed #tab-whats-new,
body.bars-collapsed #btn-theme-toggle .btn-label,
body.bars-collapsed #btn-open-help .btn-label {
  display: none !important;
}

body.bars-collapsed #btn-theme-toggle,
body.bars-collapsed #btn-open-help {
  padding: 5px 8px;
  min-width: 31px;
  justify-content: center;
}

body.bars-collapsed #shared-filter-bar,
body.bars-collapsed .map-toolbar {
  display: none !important;
}

body.bars-collapsed[data-active-view="table"] #topbar-collapsed-tools,
body.bars-collapsed[data-active-view="map"] #topbar-collapsed-tools {
  display: flex;
}

body.bars-collapsed:not([data-active-view="map"]) #topbar-collapsed-tools .map-keep-collapsed {
  display: none !important;
}

/* Table view (expanded): filters on top, search (left) + collapse arrow (right) on bottom row */
body[data-active-view="table"] #shared-filter-bar .zone-filters {
  order: 1;
  flex: 1 0 100%;
}

body[data-active-view="table"] #shared-filter-bar .zone-actions {
  order: 2;
  flex-wrap: nowrap;
  white-space: nowrap;
}

body[data-active-view="table"] #shared-filter-bar .btn-bars-collapse {
  order: 3;
  margin-left: auto;
  align-self: center;
}

/* Map view (expanded): search + Pohľady + Vycentrovať + Export 6K on top row, filters below */
body[data-active-view="map"] #shared-filter-bar .zone-actions {
  order: 1;
  flex: 1 0 100%;
  flex-wrap: nowrap;
  white-space: nowrap;
}

body[data-active-view="map"] #shared-filter-bar .zone-filters {
  order: 2;
  flex: 1 0 100%;
}

#shared-filter-bar .zone-actions .search-box-wrap {
  flex: 1 1 180px;
  min-width: 150px;
  max-width: 240px;
}

.map-toolbar .btn-bars-collapse {
  margin-left: auto;
  align-self: center;
}

body:not([data-active-view="map"]) #shared-filter-bar .map-only-action {
  display: none !important;
}

.min-share-box {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
}

body.bars-collapsed:not([data-active-view="map"]) #topbar-collapsed-tools .map-keep-collapsed {
  display: none !important;
}

/* --- 3 Visual Zones in Top Bars --- */
.bar-zone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.bar-zone.zone-actions {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.28);
}

.bar-zone.zone-filters {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.28);
}

.bar-zone.zone-visuals {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.28);
}

body.dark-theme .bar-zone.zone-actions {
  background: rgba(37, 99, 235, 0.14);
  border-color: rgba(59, 130, 246, 0.32);
}

body.dark-theme .bar-zone.zone-filters {
  background: rgba(217, 119, 6, 0.13);
  border-color: rgba(245, 158, 11, 0.3);
}

body.dark-theme .bar-zone.zone-visuals {
  background: rgba(5, 150, 105, 0.13);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Integrated bottom-right map controls (+, -, Vycentrovať, Export 6K) */
.map-bottom-right-controls {
  position: absolute;
  right: 14px;
  bottom: 20px;
  z-index: 610;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transition: right 0.2s ease;
}

body.dark-theme .map-bottom-right-controls {
  background: rgba(15, 23, 42, 0.92);
  border-color: #334155;
}

.map-br-btn {
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}

.map-br-accent {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: #fff;
}

.map-br-primary {
  background: var(--primary);
  color: #fff;
}

.map-br-btn:hover {
  filter: brightness(1.08);
}

.map-br-zoom {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
}

body.dark-theme .map-br-zoom {
  border-color: #334155;
  background: #1e293b;
}

.map-br-zoom-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.map-br-zoom-btn + .map-br-zoom-btn {
  border-left: 1px solid var(--border);
}

body.dark-theme .map-br-zoom-btn {
  color: #f8fafc;
}

body.dark-theme .map-br-zoom-btn + .map-br-zoom-btn {
  border-left-color: #334155;
}

.map-br-zoom-btn:hover {
  background: rgba(37, 99, 235, 0.12);
}

.map-stage:has(#detail-panel:not(.hidden)) .map-bottom-right-controls {
  right: 424px;
}

body.mobile-compact .map-stage:has(#detail-panel:not(.hidden)) .map-bottom-right-controls {
  right: 8px !important;
}

body.mobile-compact .map-bottom-right-controls {
  right: 8px;
  bottom: 58px;
  padding: 4px;
  gap: 4px;
}

body.mobile-compact .map-br-btn {
  height: 28px;
  padding: 0 7px;
  font-size: 11.5px;
}

body.mobile-compact .map-br-zoom-btn {
  width: 28px;
  height: 28px;
}

/* Shift Leaflet +/- zoom control left when parcel detail panel is open */
.map-stage:has(#detail-panel:not(.hidden)) .leaflet-bottom.leaflet-right {
  right: 424px;
  transition: right 0.2s ease;
}

/* --- Global Centered Loading Spinner --- */
.global-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.global-loading-card {
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 14px;
  padding: 18px 24px;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(6px);
}

.saved-view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
}

.saved-view-row:hover {
  background: rgba(59, 130, 246, 0.1);
}

.saved-view-load-btn {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  padding: 2px 4px;
}

.saved-view-del-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 4px;
}

.saved-view-del-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

.admin-inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.admin-inline-form input,
.admin-inline-form select {
  flex: 1;
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  font-size: 13px;
}

.admin-label {
  font-size: 13px;
  font-weight: 600;
}

.admin-superuser-card {
  margin-top: 8px;
}

.admin-member-chip {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--surface-alt, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
}

@media (max-width: 900px) {
  .landing-features,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Owner Count Filter & Other Owners View --- */
.filter-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  background: var(--surface, #fff);
  color: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.other-owners-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.oo-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.oo-stats-pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-alt, #f1f5f9);
  border: 1px solid var(--border, #cbd5e1);
}

.oo-addr-chip {
  display: inline-block;
  padding: 2px 7px;
  margin: 2px;
  border-radius: 6px;
  font-size: 11.5px;
  background: var(--surface-alt, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
}

/* Other Owners ("Iní vlastníci") tables: zebra striping, centered cells, sortable headers & column filters */
#view-other-owners .table-scroll {
  max-height: calc(100vh - 280px);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
}

#view-other-owners .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  border-bottom: 1px solid var(--border, #cbd5e1);
  padding: 7px 8px;
  text-align: center;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  user-select: none;
}

#view-other-owners .data-table thead th[data-sort] {
  cursor: pointer;
}

#view-other-owners .data-table thead th[data-sort]:hover {
  background: #eef2ff;
}

#view-other-owners .data-table thead tr.oo-col-filter-row th {
  position: sticky;
  top: 30px;
  z-index: 2;
  padding: 4px 6px;
  background: #f1f5f9;
  border-bottom: 2px solid var(--border, #cbd5e1);
  text-transform: none;
  letter-spacing: 0;
}

.oo-col-filter {
  width: 100%;
  min-width: 60px;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  text-align: center;
}

.oo-col-filter:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
}

#view-other-owners .data-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

#view-other-owners .data-table tbody tr:nth-child(odd) {
  background: #ffffff;
}

#view-other-owners .data-table tbody tr {
  transition: background 0.12s;
}

#view-other-owners .data-table tbody tr:hover {
  background: #dbeafe !important;
}

#view-other-owners .data-table tbody td {
  padding: 7px 8px;
  border-bottom: 1px solid #eef2f6;
  vertical-align: middle;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.35;
}

body.dark-theme #view-other-owners .table-scroll {
  border-color: #273449;
}

body.dark-theme #view-other-owners .data-table thead th {
  background: #0f172a;
  color: #cbd5e1;
  border-color: #273449;
}

body.dark-theme #view-other-owners .data-table thead th[data-sort]:hover {
  background: #1e293b;
}

body.dark-theme #view-other-owners .data-table thead tr.oo-col-filter-row th {
  background: #111827;
  border-bottom-color: #334155;
}

body.dark-theme .oo-col-filter {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark-theme #view-other-owners .data-table tbody tr:nth-child(even) {
  background: #162033;
}

body.dark-theme #view-other-owners .data-table tbody tr:nth-child(odd) {
  background: #0f172a;
}

body.dark-theme #view-other-owners .data-table tbody tr:hover {
  background: #1e3a5f !important;
}

body.dark-theme #view-other-owners .data-table tbody td {
  border-color: #1e293b;
}

.track-mode-radios {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 12px;
  font-size: 13px;
}

.track-mode-radios label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.track-modal-variants {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.track-variant-item {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-alt, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  font-size: 12.5px;
}

.track-variant-occ {
  margin-left: 20px;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}

/* --- Site Logo, Step Badges & Prominent DB Switcher --- */
.brand-logo-img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(29, 78, 216, 0.28);
  flex-shrink: 0;
}

.landing-logo-img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(29, 78, 216, 0.3);
  flex-shrink: 0;
}

.db-switcher-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f8fafc;
  height: 31px;
  padding: 0 9px;
  border-radius: 8px;
  gap: 6px;
}

.db-switcher-btn:hover {
  border-color: #3b82f6;
  background: #273549;
}

.db-switcher-label {
  max-width: 165px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

#db-switcher-menu {
  right: 0;
  left: auto;
  min-width: 240px;
  color: var(--text);
}

.db-switcher-item {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.db-switcher-item.active {
  background: rgba(37, 99, 235, 0.14);
  color: var(--primary);
  font-weight: 700;
}

body.dark-theme .db-switcher-item.active {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.db-item-check {
  width: 14px;
  font-weight: 800;
  color: var(--primary);
  flex-shrink: 0;
}

.db-switcher-prefix {
  font-size: 11.5px;
  font-weight: 800;
  color: #1d4ed8;
  white-space: nowrap;
}

body.dark-theme .db-switcher-prefix {
  color: #93c5fd;
}

.db-switcher-select {
  font-size: 12px !important;
  font-weight: 800 !important;
  max-width: 155px !important;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 13.5px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e2e8f0);
}

/* --- Export Dropdown --- */
.export-dropdown {
  position: relative;
  display: inline-flex;
}

.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 1200;
}

.export-menu-item {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.export-menu-item:hover {
  background: var(--surface-alt, #f1f5f9);
}

/* --- Compact Filter Toggle Bar (Mobile / Touch) --- */
.compact-filter-toggle-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface, #ffffff);
  border-bottom: 1px solid var(--border, #e2e8f0);
  flex-shrink: 0;
  z-index: 800;
}

.compact-toggle-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

/* --- Mobile / Touch Compact Mode (applies in both mobile & desktop-site view on phones) --- */
.table-stats-bar {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.table-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.mobile-compact .table-stats-bar {
  display: none;
}

body.mobile-compact .topbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 6px 8px;
}

body.mobile-compact .topbar-main-row {
  width: 100%;
  flex-wrap: nowrap;
  gap: 6px;
}

body.mobile-compact .topbar {
  padding-top: max(6px, env(safe-area-inset-top));
  position: relative;
  z-index: 960;
}

body.mobile-compact .topbar-main-row {
  flex-wrap: nowrap;
  gap: 6px;
}

body.mobile-compact .brand {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

body.mobile-compact .topbar-quick-btns {
  margin-left: auto;
  gap: 4px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

body.mobile-compact .topbar-quick-btns .btn-sm {
  padding: 5px 8px;
  min-height: 36px;
  font-size: 11.5px;
  white-space: nowrap;
}

body.mobile-compact .topbar-quick-btns .btn-icon-only {
  width: 34px;
  height: 34px;
  font-size: 14px;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  body.mobile-compact #btn-fullscreen-toggle {
    display: none;
  }
  body.mobile-compact .brand h1 {
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

body.mobile-compact .mobile-only-quick {
  display: inline-flex;
  align-items: center;
}

body.mobile-compact .brand-sub {
  display: none;
}

body.mobile-compact .brand h1 {
  font-size: 15px;
}

body.mobile-compact .brand-logo-img {
  width: 28px;
  height: 28px;
}

body.mobile-compact .topbar-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

body.mobile-compact .topbar-collapsible {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: calc(48px + env(safe-area-inset-top));
  max-height: calc(100dvh - 48px - env(safe-area-inset-top));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 950;
  background: var(--topbar-bg, #0f172a);
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
  margin-top: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

body.mobile-compact .topbar-collapsible.open {
  display: flex;
}

body.mobile-compact .nav-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

body.mobile-compact .nav-tab {
  padding: 8px 10px;
  min-height: 40px;
  font-size: 12.5px;
  justify-content: flex-start;
  border-radius: 8px;
}

body.mobile-compact .topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

@media (max-width: 768px) {
  .app-shell {
    min-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #view-table .data-table th:first-child,
  #view-table .data-table td:first-child,
  #view-other-owners .data-table th:first-child,
  #view-other-owners .data-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--surface, #ffffff);
    box-shadow: 2px 0 6px rgba(15, 23, 42, 0.08);
  }
  .filter-bar input,
  .filter-bar select {
    font-size: 16px;
  }
  .modal-card,
  .modal-content {
    max-height: 90dvh;
    overflow-y: auto;
  }
}

body.mobile-compact .compact-filter-toggle-bar {
  display: none !important;
}

body.mobile-compact .filter-bar {
  display: none;
  max-height: 55vh;
  overflow-y: auto;
  padding: 8px 10px;
}

body.mobile-compact .filter-bar.mobile-expanded {
  display: flex;
}

body.mobile-compact .map-toolbar {
  display: none;
  max-height: 45vh;
  overflow-y: auto;
  padding: 8px 10px;
  gap: 8px 10px;
}

body.mobile-compact .map-toolbar.mobile-expanded {
  display: flex;
}

body.mobile-compact #view-table .kpi-grid {
  display: none;
}

body.mobile-compact #view-table .kpi-grid.mobile-expanded {
  display: grid;
}

body.mobile-compact .map-corner-table-btn {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 610;
  height: 32px;
  padding: 0 11px;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
}

.map-corner-table-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.map-corner-table-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.dark-theme .map-corner-table-btn {
  background: rgba(15, 23, 42, 0.92);
  border-color: #334155;
  color: #f8fafc;
}

body.dark-theme .map-corner-table-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.map-active-filters {
  position: absolute;
  left: 14px;
  top: 54px;
  z-index: 600;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  max-width: 300px;
  max-height: 40vh;
  overflow-y: auto;
}

.map-active-filters.collapsed {
  padding: 7px 12px;
}

.map-active-filters.collapsed .legend-body {
  display: none;
}

.map-active-filter-chip {
  display: block;
  padding: 3px 7px;
  margin-top: 4px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  font-size: 11.5px;
  line-height: 1.35;
}

body.mobile-compact .map-stage:has(#detail-panel:not(.hidden)) .leaflet-bottom.leaflet-right {
  right: 4px !important;
}

body.mobile-compact .leaflet-bottom.leaflet-right {
  right: 4px;
  bottom: 58px;
}

body.mobile-compact .map-legend {
  left: 10px;
  bottom: 12px;
  max-width: calc(100vw - 24px);
  max-height: 48vh;
}

body.mobile-compact .map-legend.collapsed {
  padding: 7px 11px;
}

/* Mobile Parcel Detail: collapsed pill bar -> full-screen on click */
body.mobile-compact .detail-panel.detail-collapsed-bar {
  top: auto;
  left: 10px;
  right: 10px;
  bottom: 54px;
  width: auto;
  max-width: none;
  height: auto;
  border-radius: 12px;
  z-index: 850;
}

body.mobile-compact .detail-panel.detail-collapsed-bar .detail-header {
  padding: 10px 12px;
  cursor: pointer;
  align-items: center;
}

body.mobile-compact .detail-panel.detail-collapsed-bar .detail-body,
body.mobile-compact .detail-panel.detail-collapsed-bar #detail-export-pdf,
body.mobile-compact .detail-panel.detail-collapsed-bar #detail-pdf-link {
  display: none !important;
}

body.mobile-compact .detail-panel.detail-fullscreen {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  border-radius: 0;
  z-index: 2200;
}

body.dark-theme .export-menu {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

body.dark-theme .export-menu-item:hover {
  background: #334155;
}

body.dark-theme .compact-filter-toggle-bar {
  background: #0f172a;
  border-color: #1e293b;
}

/* Parcel Lists (Detail & Modal) */
.parcel-lists-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.parcel-list-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.parcel-list-chip-remove {
  border: none;
  background: transparent;
  color: #1d4ed8;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.75;
}

.parcel-list-chip-remove:hover {
  opacity: 1;
}

.parcel-list-existing-wrap {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.parcel-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #eef2f6;
}

.parcel-list-row:last-child {
  border-bottom: none;
}

.parcel-list-row-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.parcel-list-row-name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parcel-list-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

body.dark-theme .parcel-list-chip {
  background: #1e3a5f;
  color: #93c5fd;
  border-color: #2563eb;
}

body.dark-theme .parcel-list-chip-remove {
  color: #93c5fd;
}

body.dark-theme .parcel-list-row {
  border-bottom-color: #334155;
}

/* ==========================================================================
   MIND MAP VIEW (Full-Viewport 60/40 Split-Pane & Organic SVG Canvas)
   ========================================================================== */
#view-mindmap {
  padding: 12px 18px 16px;
}

.mm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.mm-title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.mm-title-row h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--text);
}

.mm-title-row #mindmap-subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.mm-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mm-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mm-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.mm-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.mm-filter-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mm-select,
.mm-search {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12.5px;
  height: 32px;
}

.mm-search {
  min-width: 210px;
}

.mm-layer-toggles {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.mm-layer-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.mm-layer-chip input {
  margin: 0;
  accent-color: var(--primary);
}

.mm-owner-chips-bar {
  margin-bottom: 10px;
  flex-shrink: 0;
}

.mindmap-grid {
  --mm-split: 60%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.mm-splitter {
  display: none;
}

.mindmap-canvas-card,
.mindmap-detail-card,
.mindmap-bottom-grid > .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.mindmap-canvas-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.mm-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12.5px;
}

.mm-crumb-btn {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.mm-crumb-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.mm-crumb-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.mm-zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mm-canvas-wrap {
  position: relative;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 45%, rgba(37, 99, 235, 0.06), rgba(15, 23, 42, 0.03));
  overflow: hidden;
  min-height: 440px;
  user-select: none;
}

body.dark-theme .mm-canvas-wrap {
  background: radial-gradient(circle at 50% 45%, rgba(59, 130, 246, 0.14), rgba(2, 6, 23, 0.85));
}

#mindmap-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#mindmap-svg.is-panning {
  cursor: grabbing;
}

.mm-hint-bar {
  position: absolute;
  left: 10px;
  bottom: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  backdrop-filter: blur(4px);
}

.mindmap-right-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mindmap-bottom-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 0;
}

.mm-detail-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.mm-detail-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.mm-detail-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.mm-kpi {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}

.mm-kpi-label {
  font-size: 11px;
  color: var(--text-muted);
}

.mm-kpi-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.mm-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.mm-detail-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 210px;
  overflow-y: auto;
}

.mm-detail-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
}

.mm-detail-list li:hover {
  border-color: var(--primary);
}

.mm-legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text);
}

.mm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mm-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.mm-node-group {
  cursor: pointer;
}

.mm-edge-path {
  fill: none;
  stroke-linecap: round;
  pointer-events: none;
}

/* Desktop full-viewport split-pane */
@media (min-width: 1024px) {
  body.mm-view-active {
    overflow: hidden;
  }
  body.mm-view-active #app-shell {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
  }
  body.mm-view-active .main-content {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body.mm-view-active #view-mindmap.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .mindmap-grid {
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(320px, var(--mm-split, 60%)) 12px minmax(280px, 1fr);
    gap: 0;
    align-items: stretch;
  }
  .mindmap-canvas-card,
  .mm-canvas-wrap {
    height: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  #mindmap-svg {
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
  }
  .mm-splitter {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
  }
  .mm-splitter-handle {
    width: 4px;
    height: 48px;
    border-radius: 99px;
    background: rgba(147, 161, 184, 0.35);
    transition: background 0.15s ease, height 0.15s ease, width 0.15s ease;
  }
  .mm-splitter:hover .mm-splitter-handle,
  .mm-splitter.is-dragging .mm-splitter-handle {
    background: var(--primary);
    height: 76px;
    width: 5px;
  }
  .mindmap-right-col {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(147, 161, 184, 0.3) transparent;
  }
  .mindmap-right-col > .card,
  .mindmap-right-col .mindmap-bottom-grid > .card {
    flex-shrink: 0;
  }
}

/* Fullscreen mode */
body.mm-fullscreen {
  overflow: hidden !important;
}
body.mm-fullscreen #mindmap-canvas-card {
  position: fixed;
  inset: 0;
  z-index: 70;
  width: 100vw;
  height: 100dvh;
  margin: 0;
  padding: 12px 16px;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
}
body.mm-fullscreen .mm-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.mm-fullscreen #mindmap-svg {
  width: 100%;
  height: 100%;
  flex: 1;
}


/* --- Valuation ("Ocenenie mojich pozemkov"), Potential Building Plot & LV Wizard --- */
.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
}
.kpi-card.kpi-valuation {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.10), rgba(245, 158, 11, 0.08));
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.kpi-card.kpi-valuation:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.16);
}
.val-open-pill {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
  font-weight: 700;
}
[data-theme="dark"] .val-open-pill {
  color: #34d399;
}
.kpi-pot-highlight {
  color: #d97706 !important;
  font-weight: 700;
}
[data-theme="dark"] .kpi-pot-highlight {
  color: #fbbf24 !important;
}

.price-cell {
  white-space: nowrap;
  line-height: 1.28;
}
.price-main {
  font-weight: 700;
  color: var(--text, #0f172a);
}
.price-main.is-pot-bldg {
  color: #d97706;
}
[data-theme="dark"] .price-main.is-pot-bldg {
  color: #fbbf24;
}
.price-sub {
  font-size: 11px;
  color: var(--text-muted, #64748b);
}
.btn-pot-bldg {
  border: 1px solid var(--border, #cbd5e1);
  background: transparent;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.14s ease;
  color: var(--text-muted, #64748b);
}
.btn-pot-bldg:hover {
  border-color: #f59e0b;
  color: #d97706;
}
.btn-pot-bldg.active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
  color: #b45309;
  font-weight: 700;
}
[data-theme="dark"] .btn-pot-bldg.active {
  color: #fbbf24;
}

.val-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.val-hero-box {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--bg-subtle, #f8fafc);
}
.val-hero-box.pot {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(16, 185, 129, 0.06));
}
.val-hero-box .vh-label {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  font-weight: 600;
}
.val-hero-box .vh-val {
  font-size: 22px;
  font-weight: 800;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.val-hero-box .vh-sub {
  font-size: 11.5px;
  color: var(--text-muted, #64748b);
  margin-top: 3px;
}

/* Wizard Styles */
.wizard-card {
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.05), transparent 85%);
  overflow: visible !important;
  position: relative;
  z-index: 40;
}
.wizard-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.wizard-form-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 10px;
  align-items: end;
}
@media (max-width: 900px) {
  .wizard-form-grid {
    grid-template-columns: 1fr;
  }
}
.wizard-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-muted, #64748b);
}
.wizard-field input {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  font-size: 13.5px;
}
body.dark-theme .wizard-field input,
body.dark-theme .wizard-suggestions {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}
.wizard-actions-col {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wizard-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 120;
  max-height: 250px;
  overflow-y: auto;
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.22);
}
.wizard-sug-item {
  padding: 7px 11px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.wizard-sug-item:hover {
  background: rgba(59, 130, 246, 0.10);
}
.wizard-price-banner {
  margin-top: 8px;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.30);
}
.wizard-steps-strip {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--text-muted, #64748b);
  padding-top: 8px;
  border-top: 1px dashed var(--border, #cbd5e1);
}
.wizard-address-results {
  margin-top: 10px;
}
.bookmarklet-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  cursor: grab;
}
.price-map-label-icon {
  display: inline-block;
  width: max-content;
  transform: translate(-50%, 6px);
  background: rgba(15, 23, 42, 0.90);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.40);
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 10.5px;
  line-height: 1.3;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.filter-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--border, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.14s ease;
}
body.dark-theme .filter-toggle-pill {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}
.filter-toggle-pill.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}
body.dark-theme .filter-toggle-pill.active {
  color: #fbbf24;
}
.tpp-prices {
  padding: 6px 10px;
  font-size: 11.5px;
  line-height: 1.4;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
}
.district-price-badge {
  display: inline-block;
  width: max-content;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.90);
  color: #f8fafc;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 10.5px;
  line-height: 1.3;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}


/* =========================================================================
   LAND CONSOLIDATION SANDBOX (POKUSNÝ REŽIM SCEĽOVANIA POZEMKOV)
   ========================================================================= */
#view-consolidation.active {
  padding: 10px 16px;
  overflow: hidden;
}

.cs-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  padding-bottom: 0;
}

.cs-workspace-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.cs-workspace-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cs-page-tab {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.cs-page-tab:hover:not(:disabled) {
  border-color: var(--accent);
}

.cs-page-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.cs-page-tab:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.cs-workspace-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.cs-page-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.cs-page-pane.hidden {
  display: none;
}

.cs-res-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.cs-full-table-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.cs-hero-card {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}

.cs-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cs-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
}

@media (max-width: 960px) {
  .cs-kpi-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

.cs-kpi-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cs-kpi-card.cs-kpi-accent {
  border-color: rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), var(--surface-alt));
}

.cs-kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cs-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.cs-kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.cs-frag-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
  margin: 2px 0;
}

.cs-frag-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.cs-solver-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.cs-tol-control,
.cs-strategy-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.cs-run-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.cs-progress-panel {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(14, 165, 233, 0.07);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cs-progress-top,
.cs-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.cs-progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.cs-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #22c55e);
  transition: width 0.25s ease;
}

.cs-mini-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2.2px solid rgba(56, 189, 248, 0.28);
  border-top-color: #38bdf8;
  animation: cs-spin 0.75s linear infinite;
  flex-shrink: 0;
}

.cs-mini-spinner.hidden {
  display: none;
}

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

.cs-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(270px, 1fr);
  gap: 12px;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
}

#view-consolidation.active.cs-has-results .cs-setup-grid {
  flex: 0 0 auto;
  height: clamp(320px, 46vh, 520px);
}

@media (max-width: 1080px) {
  #view-consolidation.active {
    overflow: auto;
  }
  .cs-setup-grid {
    grid-template-columns: 1fr;
    flex: 0 0 auto;
    height: auto;
  }
}

.cs-parcels-card,
.cs-owners-card,
.cs-results-card {
  padding: 12px 14px;
}

.cs-parcels-card,
.cs-owners-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.cs-parcels-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.cs-filters-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.cs-owner-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.cs-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.cs-chip-rm {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 11px;
}

.cs-chip-rm:hover {
  color: var(--danger);
}

.cs-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.cs-parcels-table tr.cs-row-selected td {
  background: rgba(56, 189, 248, 0.06);
}

.cs-owners-cell {
  max-width: 280px;
  font-size: 11.5px;
  line-height: 1.45;
}

.cs-mini-owner {
  display: inline-block;
  margin-right: 4px;
  color: var(--text-muted);
}

.cs-mini-owner.tracked {
  color: var(--text);
  font-weight: 600;
}

.cs-owners-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.cs-owners-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding-right: 3px;
}

.cs-owner-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.cs-owner-item:hover {
  border-color: var(--accent);
}

.cs-owner-item.excluded {
  opacity: 0.58;
  border-style: dashed;
}

.cs-owner-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.cs-owner-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cs-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
}

.cs-lock-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: #f59e0b;
  margin-left: 4px;
}

.cs-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.cs-badge-ok {
  background: rgba(34, 197, 94, 0.16);
  color: #16a34a;
}

body.dark-theme .cs-badge-ok {
  color: #4ade80;
}

.cs-badge-warn {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

body.dark-theme .cs-badge-warn {
  color: #fbbf24;
}

.cs-badge-frag {
  background: rgba(239, 68, 68, 0.16);
  color: #dc2626;
}

body.dark-theme .cs-badge-frag {
  color: #f87171;
}

.cs-badge-info {
  background: rgba(14, 165, 233, 0.16);
  color: #0284c7;
}

body.dark-theme .cs-badge-info {
  color: #38bdf8;
}

.cs-badge-give {
  background: rgba(244, 63, 94, 0.16);
  color: #e11d48;
}

body.dark-theme .cs-badge-give {
  color: #fb7185;
}

.cs-badge-recv {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

body.dark-theme .cs-badge-recv {
  color: #34d399;
}

.cs-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.cs-res-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.cs-res-tab {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.cs-res-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.cs-steps-panel {
  flex: 0 0 auto;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.cs-steps-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 12.5px;
}

.cs-steps-table th,
.cs-steps-table td {
  padding: 5px 8px;
  font-size: 12px;
}

.cs-subbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.cs-compare-table th.cs-th-group-before {
  text-align: center;
  background: rgba(244, 63, 94, 0.12);
}

.cs-compare-table th.cs-th-group-after {
  text-align: center;
  background: rgba(16, 185, 129, 0.12);
}

.cs-compare-table th.cs-th-group-diff {
  text-align: center;
  background: rgba(56, 189, 248, 0.12);
}

.cs-pos {
  color: #22c55e;
}

.cs-neg {
  color: #f87171;
}

.cs-legend-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cs-legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.cs-split-maps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}

@media (max-width: 960px) {
  .cs-split-maps {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
}

.cs-map-pane {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  height: 100%;
  min-height: 0;
}

.cs-map-pane-single {
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}

.cs-leaflet-box {
  width: 100%;
  height: 100%;
  background: #0b1120;
}

.cs-map-badge {
  position: absolute;
  top: 10px;
  left: 52px;
  z-index: 600;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.cs-map-badge-before {
  background: rgba(225, 29, 72, 0.85);
}

.cs-map-badge-after {
  background: rgba(5, 150, 105, 0.85);
}

.cs-blocks-wrap {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cs-blocks-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.cs-blocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.cs-block-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cs-block-title {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
}

.cs-block-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cs-block-tag {
  font-size: 10.5px;
  font-weight: 700;
  min-width: 56px;
  color: var(--text-muted);
}

.cs-block-bar {
  flex: 1;
  height: 15px;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  border: 1px solid rgba(15, 23, 42, 0.4);
  background: rgba(15, 23, 42, 0.2);
}

.cs-bar-seg {
  height: 100%;
  border-right: 1px solid rgba(15, 23, 42, 0.55);
}

.cs-bar-seg:last-child {
  border-right: none;
}
