* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f4f5f7;
  color: #1f2328;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #14532d;
  color: #fff;
  padding: 14px 24px;
}

.brand {
  font-size: 18px;
  font-weight: 600;
}

/* Header "Image" checkbox off -> approved parcel photos hidden, revealing
   the parcel's normal fill already drawn underneath (see app.js
   applyParcelImageVisibility). */
body.parcel-images-off .parcel-image-override {
  display: none;
}

.village-tag {
  font-size: 14px;
  color: #fff;
  background: rgba(255,255,255,0.15);
  padding: 4px 12px;
  border-radius: 999px;
}

/* register.html "My Villages" table (max 5 villages per account). */
.register-village-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.register-village-table th,
.register-village-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #e5e7eb;
}

.register-village-table th {
  font-weight: 600;
  color: #374151;
  background: #f9fafb;
}

.register-village-empty td {
  color: #9ca3af;
  text-align: center;
}

.register-village-remove {
  border: none;
  background: none;
  color: #dc2626;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
}

.register-village-default {
  font-size: 11px;
  color: #166534;
  margin-left: 4px;
}

/* Topbar "Report" dropdown (index.html) - groups the report-ish pages
   (Family Report, Manage Families, Qibala / Registry) under one button. */
.nav-menu {
  position: relative;
}

.nav-menu-trigger {
  border: none;
  font-family: inherit;
  cursor: pointer;
}

.nav-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1000;
  min-width: 200px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  padding: 6px 0;
}

.nav-menu-list a {
  display: block;
  padding: 9px 16px;
  font-size: 14px;
  color: #14532d;
  text-decoration: none;
  white-space: nowrap;
}

.nav-menu-list a:hover {
  background: #f0fdf4;
}

/* .village-tag is also used on <a> nav links in the topbar (Calibrate
   Map, Manage Families, Manage Customers, Back to Search) - without this,
   the browser's default link color overrides the inherited white and
   they become nearly invisible against the dark green topbar. */
a.village-tag:hover,
a.village-tag:visited,
a.village-tag:active {
  color: #fff;
}

a.village-tag:hover {
  background: rgba(255,255,255,0.28);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* Laptop/desktop only (above the tablet/phone breakpoint below) - use
   most of the available width instead of capping at 1100px, so wide
   screens don't waste space in empty side margins. Left as a separate
   min-width override, rather than folded into the base rule, so phone
   sizing is untouched. */
@media (min-width: 801px) {
  .container {
    max-width: min(94vw, 1800px);
  }
}

.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid #d7dbe0;
  border-radius: 10px;
  padding: 8px;
}

/* State -> City/District -> Thana -> Village picker above the search bar
   (public/locationSelector.js, same component register.html uses) - sets
   which village's Naksha/search this page operates against. See
   showLocationSelector/hideLocationSelector in app.js for when this shows
   vs. stays collapsed (a logged-in customer's own village auto-fills it
   without needing to be shown at all). */
.location-selector-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.location-selector-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #6b7280;
  flex: 1 1 180px;
  min-width: 160px;
}

.location-selector-field select {
  width: 100%;
  height: 42px;
}

.search-bar input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 10px 12px;
}

.map-selector {
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  padding: 0 10px;
  height: 42px;
  font-size: 14px;
  color: #1f2328;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

.map-selector:focus {
  outline: 2px solid #14532d;
  outline-offset: -1px;
}

.icon-btn {
  border: 1px solid #d7dbe0;
  background: #fff;
  border-radius: 8px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  border-color: #14532d;
  color: #14532d;
}

.icon-btn.mic-listening {
  background: #dc2626;
  border-color: #b91c1c;
  color: #fff;
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.icon-btn::after {
  content: "";
}

/* Spoken welcome help - app.js initWelcomeHelp */
#welcomeHelpBtn {
  font-size: 19px;
}

.icon-btn.is-playing {
  background: #14532d;
  border-color: #14532d;
  color: #fff;
  animation: help-pulse 1.4s ease-in-out infinite;
}

@keyframes help-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(20, 83, 45, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(20, 83, 45, 0); }
}

.welcome-help-banner {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 8px 10px;
}

.welcome-help-banner[hidden] {
  display: none;
}

.welcome-help-play {
  flex: 1 1 220px;
  text-align: start;
  background: none;
  border: none;
  color: #14532d;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}

.welcome-help-off {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.welcome-help-close {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.submit-btn {
  background: #14532d;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 22px;
  height: 42px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.submit-btn:hover {
  background: #0f3d21;
}

.submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.status-line {
  margin-top: 10px;
  font-size: 14px;
  color: #6b7280;
  min-height: 20px;
}

.status-line.error {
  color: #b91c1c;
}

/* Search progress bar - see startSearchProgress in app.js */
.search-progress {
  margin-top: 8px;
  max-width: 520px;
}

.search-progress-track {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.search-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #15803d, #22c55e);
  border-radius: 999px;
  transition: width 0.2s linear;
}

.search-progress-text {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.ambiguous-box {
  margin-top: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
}

.ambiguous-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ambiguous-row + .ambiguous-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #fed7aa;
}

.ambiguous-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ambiguous-choice {
  padding: 6px 14px;
  height: 32px;
  border: 1px solid #14532d;
  background: #fff;
  color: #14532d;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.ambiguous-choice:hover {
  background: #14532d;
  color: #fff;
}

.results {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 20px;
  margin-top: 20px;
}

.earth-panel {
  grid-column: 1 / -1;
}

@media (max-width: 800px) {
  .results {
    grid-template-columns: 1fr;
  }
}

/* "All Naksha" preview (no active search yet): every sheet gets its own
   map panel, one per row on phone, two per row on tablet/laptop. */
#mapsRow.naksha-preview-grid {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 801px) {
  #mapsRow.naksha-preview-grid {
    grid-template-columns: 1fr 1fr;
  }
}

#mapsRow.naksha-preview-grid .map-panel {
  width: auto;
}

.panel {
  background: #fff;
  border: 1px solid #e2e5e9;
  border-radius: 12px;
  padding: 18px 20px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #14532d;
}

.active-map-badge {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
}

/* Speak/Image checkboxes beside the Naksha heading - same dark green as
   the topbar they used to sit in, so they still read as app controls
   rather than part of the heading text. */
.map-toggles {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-left: 12px;
  padding: 3px 10px;
  background: #14532d;
  border-radius: 4px;
  vertical-align: middle;
}

.map-toggles label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  color: #fff;
  cursor: pointer;
  user-select: none;
}

.field-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f1f3;
  font-size: 14px;
}

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

.field-label {
  color: #6b7280;
}

.field-value {
  font-weight: 500;
  text-align: right;
  max-width: 60%;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.badge.auto { background: #dcfce7; color: #166534; }
.badge.review { background: #fee2e2; color: #991b1b; }
.badge.map-badge { background: #e0e7ff; color: #3730a3; letter-spacing: 0.03em; }

.record-card {
  border: 1px solid #eef0f2;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.record-card:last-child {
  margin-bottom: 0;
}

/* Family Name Group drag-and-drop reordering (public/families.js) - the
   card being dragged fades slightly so it's clear it's "picked up"; a
   top/bottom colored border on the row under the cursor shows exactly
   where it will land, matching whichever half of that row the cursor is
   currently over. */
.name-group-dragging {
  opacity: 0.4;
}

.name-group-drop-before {
  border-top: 3px solid #1d4ed8;
}

.name-group-drop-after {
  border-bottom: 3px solid #1d4ed8;
}

/* Family land report filter bar (public/app.js's renderOwnerLandsTable) -
   the "Include Sold" toggle, member multi-select, and Show button. */
.family-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid #e2e5e9;
  border-radius: 10px;
}

.family-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.family-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.family-filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  background: #fff;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.family-filter-toggle:hover {
  border-color: #14532d;
}

.family-filter-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #14532d;
  cursor: pointer;
}

.family-filter-dropdown {
  position: relative;
}

.family-filter-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 220px;
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  font-family: inherit;
  color: #1f2937;
  background: #fff;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  cursor: pointer;
}

.family-filter-dropdown-trigger:hover {
  border-color: #14532d;
}

.family-filter-dropdown-arrow {
  color: #9ca3af;
  font-size: 11px;
}

.family-filter-checklist {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 240px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.family-filter-select-all {
  font-weight: 700;
}

.family-filter-checklist-divider {
  height: 1px;
  margin: 4px 2px;
  background: #e5e7eb;
}

.family-filter-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: #1f2937;
  border-radius: 6px;
  cursor: pointer;
}

.family-filter-checklist-item:hover {
  background: #f3f4f6;
}

.family-filter-checklist-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: #14532d;
  cursor: pointer;
}

.family-filter-checklist-item:has(input:checked) {
  background: #dcfce7;
  color: #14532d;
  font-weight: 500;
}

.family-filter-hint {
  font-size: 11px;
  color: #9ca3af;
}

/* Registry panel's Seller / Buyer list boxes (index.html) - an always-open
   version of .family-filter-checklist, rows reuse .family-filter-checklist-item. */
.registry-name-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 260px;
  max-width: 380px;
}

.registry-name-box input[type="text"] {
  padding: 6px 8px;
}

.registry-number-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.registry-number-box input {
  width: 110px;
  padding: 6px 8px;
}

.registry-name-list {
  height: 200px;
  overflow-y: auto;
  padding: 4px;
  background: #fff;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
}

/* Registry dashboard: stat cards + sales-by-size table. */
#registryDashboard {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.registry-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.registry-stat {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.registry-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #14532d;
  line-height: 1.2;
}

.registry-stat-sub {
  font-size: 12px;
  color: #6b7280;
}

.registry-size-table {
  width: 100%;
  max-width: 560px;
  margin-top: 8px;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}

.registry-size-table td,
.registry-size-table th {
  padding: 6px 10px;
  border-bottom: 1px solid #eef0f2;
  text-align: left;
}

.registry-size-table td.num,
.registry-size-table th.num {
  text-align: right;
}

/* Registry viewer (one deed per page): nav row, deed header, Khesra tabs,
   Prev/Next Khesra - app.js renderRegistryDeedBar. */
.registry-deed-bar {
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.registry-deed-nav,
.registry-step-nav,
.registry-report-row,
.registry-khesra-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.registry-deed-head {
  font-size: 15px;
  line-height: 1.6;
}

.registry-deed-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  color: #374151;
}

.registry-nav-btn,
.registry-khesra-tab {
  padding: 6px 12px;
  border: 1px solid #14532d;
  background: #fff;
  color: #14532d;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.registry-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.registry-nav-btn.active,
.registry-khesra-tab.active {
  background: #14532d;
  color: #fff;
}

.registry-unplaced {
  font-size: 13px;
  color: #6b7280;
}

/* Clickable dashboard parts: size rows (count styled as the link) and the
   Registries / Total land "show all" cards. */
.registry-link {
  cursor: pointer;
}

.registry-size-table tr.registry-link:hover,
.registry-stat.registry-link:hover {
  background: #f0fdf4;
}

.registry-stat.registry-link:hover {
  border-color: #14532d;
}

.registry-count-link {
  color: #1d4ed8;
  font-weight: 700;
  text-decoration: underline;
}

.registry-size-table tr.registry-size-selected {
  background: #fee2e2;
}

.registry-size-table tr.registry-size-selected td:first-child {
  box-shadow: inset 3px 0 0 #ef4444;
  font-weight: 700;
}

.registry-name-count {
  margin-left: auto;
  color: #9ca3af;
  font-size: 12px;
}

.family-filter-show-btn {
  height: 38px;
  padding: 0 26px;
  font-size: 14px;
}

.record-card.not-found {
  border-color: #fecaca;
  background: #fff7f7;
}

.section-h {
  margin: 16px 0 4px;
  font-size: 14px;
  color: #374151;
}

.raiyat-card {
  border: 1px solid #eef0f2;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 14px;
}

.raiyat-card .name {
  font-weight: 600;
}

.chauhaddi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.chauhaddi-cell {
  background: #f8f9fb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.chauhaddi-cell .dir {
  font-weight: 600;
  color: #14532d;
  display: block;
  margin-bottom: 2px;
}

.note-box {
  margin-top: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.map-wrap {
  position: relative;
  background: #ffffff;
  border: 1px solid #eef0f2;
  border-radius: 8px;
  overflow: hidden;
  height: 560px;
}

@media (max-width: 800px) {
  .map-wrap {
    height: 420px;
  }
}

@media (min-width: 1600px) {
  .map-wrap {
    height: 660px;
  }
}

.naksha-overlay-svg {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Shown over #mapWrap while the real Naksha polygons are being fetched
   (khesra_village.imagePath) - a village photo/preview gives the user
   something meaningful to look at instead of a blank panel during the
   fetch+draw delay, and is removed the instant drawMap() actually paints. */
.map-placeholder-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback shown over #mapWrap instead of .map-placeholder-img whenever the
   viewer isn't a logged-in customer scoped to a village (guests, or an
   admin session with no villageId) - the actual village photo is only for
   an account that's actually tied to that village (see showMapPlaceholder
   in app.js). Same position/sizing as .map-placeholder-img so the two
   swap in cleanly. */
.khesra-banner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #14532d, #0f3d21);
}

/* A class selector beats the UA [hidden] rule (same gotcha documented
   above at .khesra-detail-modal-overlay[hidden]), so display:flex above
   would otherwise keep the banner visible - covering the village photo
   underneath it, or just showing an empty green box - even once
   showMapPlaceholder()/hideMapPlaceholder() set hidden=true. */
.khesra-banner[hidden] {
  display: none;
}

.khesra-banner-text {
  font-size: clamp(28px, 6vw, 52px);
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffffff;
}

.khesra-banner-dot {
  color: #86efac;
}

.khesra-banner-tagline {
  font-size: 14px;
  color: #d1fae5;
  letter-spacing: 0.5px;
}

/* Shown over #mapWrap while loadPolygons() is fetching a Naksha sheet's
   polygons/ownership data - covers the visible delay when switching sheets
   in the map dropdown (or any other loadPolygons() call), on top of
   whatever placeholder (village photo/banner) or previous sheet is still
   showing underneath. Hidden by hideMapLoadProgress(), called from
   loadPolygons()'s finally block so it always clears even on error. */
.map-load-progress {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.35);
}

.map-load-progress[hidden] {
  display: none;
}

.map-load-progress .report-progress-track {
  width: 70%;
  max-width: 260px;
}

.map-load-progress .report-progress-text {
  color: #ffffff;
  font-size: 12px;
}

.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}

.map-control-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #d7dbe0;
  background: #ffffff;
  color: #14532d;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.map-control-btn:hover {
  background: #f0fdf4;
}

.map-control-reset {
  width: auto;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
}

.map-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

/* On-map colour key - bottom-left of a Naksha panel (renderMapColorKey in
   app.js). pointer-events off so it never blocks panning/clicking parcels
   underneath it. */
.map-color-key {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font-size: 12px;
  color: #374151;
  max-width: 45%;
  pointer-events: none;
}

.map-color-key-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-color-key-swatch {
  flex: 0 0 auto;
  width: 18px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.swatch.highlight { background: #ef4444; border: 1px solid #b91c1c; }
.swatch.normal { background: #e5e7eb; border: 1px solid #9ca3af; }
.swatch.review { background: #fecaca; border: 1px solid #b91c1c; }

/* Owner Color Groups legend - per direct user request, shown under a
   Naksha panel whenever any of its parcels are currently colored by a
   Tree Color Group, so a viewer (not just the admin who set the colors
   up) can tell what each color means. Only ever lists colors actually
   present on that specific panel right now - see ownerColorLegendFor. */
.owner-color-legend {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e5e7eb;
}

.owner-color-legend-title {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 8px;
}

.owner-color-legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.owner-color-legend-row:last-child {
  margin-bottom: 0;
}

.owner-color-legend-bar {
  display: inline-block;
  width: 40px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.owner-color-legend-label {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

/* Per direct user request the legend now LEADS with a per-Owner-Colour-
   Group table (colour / name / plot counts / raqba split into Khatiyani
   vs Purchase), and every remaining colour - the permanent land-use
   tags - drops below it THREE per row instead of one. See
   ownerColorGroupStatsFor / renderOwnerColorLegend. */
.owner-color-legend-table-wrap {
  overflow-x: auto;
  margin-bottom: 8px;
}

.owner-color-legend-table {
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.owner-color-legend-table th,
.owner-color-legend-table td {
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
  text-align: left;
  vertical-align: middle;
}

.owner-color-legend-table th {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  background: #f9fafb;
}

.owner-color-legend-table .owner-color-legend-bar {
  width: 34px;
  height: 12px;
}

.owner-color-legend-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 20px;
  align-items: center;
}

.owner-color-legend-grid .owner-color-legend-row {
  margin-bottom: 0;
}

.empty-state {
  color: #6b7280;
  font-size: 14px;
}

.earth-frame-card {
  display: block;
  width: 100%;
  margin: 0 0 20px 0;
}

.earth-frame-card h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #374151;
}

.earth-frame-card iframe,
.earth-frame-card .leaflet-frame {
  width: 100%;
  height: 600px;
  border: 1px solid #eef0f2;
  border-radius: 8px;
}

#earthFrames {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

#earthFrames .earth-frame-card {
  flex: 1 1 480px;
  max-width: 100%;
  margin: 0;
}

.earth-unavailable {
  width: 100%;
  min-height: 100px;
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: #9a3412;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
}

.earth-unavailable a {
  color: #7c2d12;
  font-weight: 600;
}

.quick-calib-box {
  border: 1px solid #fed7aa;
  background: #fffaf5;
  border-radius: 8px;
  padding: 12px;
}

.quick-calib-note {
  font-size: 13px;
  color: #9a3412;
  margin-bottom: 10px;
}

.quick-calib-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.quick-calib-coord {
  font-size: 12px;
  color: #6b7280;
  flex: 1;
}

.quick-calib-save {
  padding: 0 18px;
  height: 36px;
  font-size: 13px;
}

.quick-calib-status {
  margin-top: 6px;
  font-size: 12px;
  color: #166534;
}

.calib-instructions {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #3730a3;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
}

.calib-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 800px) {
  .calib-grid { grid-template-columns: 1fr; }
}

#calibSvg {
  width: 100%;
  height: 420px;
  display: block;
  cursor: crosshair;
}

.pending-label {
  margin-top: 8px;
  font-size: 13px;
  color: #6b7280;
}

.coord-edit-row {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.coord-edit-row label {
  flex: 1;
  font-size: 12px;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coord-edit-row input {
  padding: 8px 10px;
  border: 1px solid #d7dbe0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.calib-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.calib-actions input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  font-size: 14px;
}

.gcp-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: #fff;
  border: 1px solid #e2e5e9;
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}

.gcp-table th {
  text-align: left;
  background: #f8f9fb;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e5e9;
  color: #6b7280;
  font-weight: 600;
}

.gcp-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f1f3;
}

.gcp-table button {
  background: none;
  border: none;
  color: #b91c1c;
  cursor: pointer;
  font-size: 13px;
}

/* ---------------------------------------------------------------------
   Personal Land Name feature - "+ Add Name" control, the saved-name
   pill, and the shared add/edit/delete popup. Only ever shown to a
   logged-in customer (see isCustomerLoggedIn() in app.js).
--------------------------------------------------------------------- */
.land-name-slot {
  display: inline-block;
  margin-left: 6px;
  vertical-align: middle;
}

.land-name-add-btn {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #14532d;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
}

.land-name-add-btn:hover {
  background: #bbf7d0;
}

.land-name-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.land-name-pill:hover {
  background: #e0e7ff;
}

.land-name-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.land-name-modal {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  width: 100%;
  max-width: 360px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.land-name-modal h3 {
  margin: 0 0 12px;
  font-size: 15px;
  color: #1f2328;
}

.land-name-modal input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d7dbe0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}

.land-name-modal-error {
  color: #b91c1c;
  font-size: 13px;
  margin-top: 8px;
}

.land-name-modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 8px;
}

.land-name-modal-actions-right {
  display: flex;
  gap: 8px;
}

.land-name-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.land-name-btn-delete {
  background: #fee2e2;
  color: #991b1b;
  margin-right: auto;
}

.land-name-btn-delete:hover {
  background: #fecaca;
}

.land-name-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.land-name-btn-cancel:hover {
  background: #e5e7eb;
}

.land-name-btn-save {
  background: #14532d;
  color: #fff;
}

.land-name-btn-save:hover {
  background: #166534;
}

/* Pop-up Khesra Details window - Family Report view only (see
   openKhesraDetailModal in app.js). The Family Report gives the whole
   results row to the Naksha map(s), so a clicked parcel's details open
   in this floating window over the map instead of an inline panel, with
   a close button that returns the map to full size. */
.khesra-detail-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

/* A class selector beats the UA [hidden] rule, so display:flex above
   would otherwise keep the overlay visible when hidden is set. */
.khesra-detail-modal-overlay[hidden] {
  display: none;
}

.khesra-detail-modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.khesra-detail-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex: 0 0 auto;
}

.khesra-detail-modal-head h2 {
  margin: 0;
  font-size: 16px;
  color: #1f2328;
}

.khesra-detail-modal-close {
  border: none;
  background: #f3f4f6;
  color: #374151;
  font-size: 22px;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
}

.khesra-detail-modal-close:hover {
  background: #e5e7eb;
}

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

/* Khesra Ownership & Sales History - the "Record Sale" button next to a
   current owner in the Current Ownership section (styled as a red pill -
   renamed from "Sold" since that read as a status badge, not an action,
   and both co-sharers showing it side by side looked like both had
   already sold when neither had). Reuses the land-name-modal-* classes
   for the Record Sale popup itself. */
.ownership-sold-btn {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.ownership-sold-btn:hover {
  background: #fee2e2;
}

/* Personal Land Groups - the badges shown for a Khesra's assigned
   groups, the "+" control that opens the assign popup, and the
   toggle-pills inside that popup for each of the owner's existing
   groups. */
.group-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #7c2d12;
  background: #ffedd5;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 2px 10px;
  margin-right: 4px;
  margin-bottom: 2px;
}

.group-add-btn {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  background: #fff7ed;
  border: 1px dashed #fdba74;
  border-radius: 999px;
  padding: 2px 10px;
  cursor: pointer;
}

.group-add-btn:hover {
  background: #ffedd5;
}

/* -----------------------------------------------------------------------
   Family Property Report (print) - see buildAndPrintFamilyReport() in
   app.js. #familyReportPrintArea is a real DOM subtree built fresh on
   every "Print Family Report" click, but it stays hidden on screen at
   all times; the printing-family-report class is added to <body> only
   for the duration of window.print()/"Save as PDF", at which point
   these @media print rules hide everything else and give the report
   pages A4-landscape sizing. No PDF library involved - the browser's own
   print pipeline produces the actual PDF.
   ----------------------------------------------------------------------- */
#familyReportPrintArea {
  display: none;
}

/* Browsers drop CSS background colors from printed output by default -
   the report needs them for the color-legend swatches, the blue table
   header bands, and the owner-group header rows. (SVG map fills are not
   "backgrounds" and print regardless.) */
#familyReportPrintArea,
#familyReportPrintArea * {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Crop modal for the Khesra "Select & Save Image" screen-capture flow
   (see public/app.js cropFrameModal). */
#satCropOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(17, 24, 39, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#satCropOverlay .sat-crop-box {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  max-width: 95vw;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
#satCropOverlay .sat-crop-hint {
  font-size: 13px;
  color: #374151;
  margin-bottom: 10px;
}
#satCropOverlay .sat-crop-stage {
  position: relative;
  line-height: 0;
  border: 1px solid #d1d5db;
}
#satCropOverlay .sat-crop-canvas {
  display: block;
  cursor: crosshair;
  max-width: 100%;
}
#satCropOverlay .sat-crop-rect {
  position: absolute;
  border: 2px dashed #dc2626;
  background: rgba(220, 38, 38, 0.12);
  pointer-events: none;
}
#satCropOverlay .sat-crop-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* Saved satellite image on a per-Khesra report page (opt-in via the
   "Satellite Image" report checkbox). Placed under the Naksha inside the
   map column, so the page mirrors the on-screen Khesra view: the wrap
   becomes a vertical split - Naksha on top, satellite below. Only the
   .has-sat-image variant changes layout, so plain map pages are
   untouched. */
#familyReportPrintArea .report-map-wrap.has-sat-image {
  display: flex;
  flex-direction: column;
}
#familyReportPrintArea .report-map-wrap.has-sat-image svg {
  flex: 1 1 60%;
  height: auto;
  min-height: 0;
}
#familyReportPrintArea .report-map-wrap.has-sat-image .report-area-image {
  flex: 0 0 40%;
  width: 100%;
  height: 40%;
  object-fit: cover;
  display: block;
  border-top: 1px solid #d7dbe0;
}

/* On-screen preview of a paid Khata / Khesra Report (showReportPreview in
   app.js): the same #familyReportPrintArea, shown as a scrollable
   full-screen overlay under a toolbar, pages shrunk to fit a normal
   screen. Screen only - printing still goes through the @media print
   rules below, which also hide the toolbar (a sibling of the area). */
@media screen {
  body.previewing-report {
    overflow: hidden;
  }
  body.previewing-report #familyReportPrintArea {
    display: block;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    background: #d1d5db;
    padding: 20px 12px;
    z-index: 9998;
  }
  body.previewing-report #familyReportPrintArea .report-page {
    zoom: 0.6;
    margin: 0 auto 28px;
    background: #fff;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
  }
  #reportPreviewBar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 16px;
    background: #111827;
    color: #fff;
    font-size: 15px;
  }
  #reportPreviewBar .report-preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  #reportPreviewBar .report-paper-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
  }
  #reportPreviewBar .report-paper-pick select {
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 14px;
  }
}

/* Khesra Report footer on EVERY printed page (per direct user request:
   site address + Report ID + date/time): a position:fixed element repeats
   on each page in Chrome's print output - browser print and the server's
   headless PDF alike. Hidden on screen (the preview bar shows the ID).
   Fixed-height report pages give up 7mm so the footer never sits on them;
   the auto-height table pages keep flowing as before. */
.report-print-footer {
  display: none;
}

@media print {
  body.printing-family-report #familyReportPrintArea .report-print-footer {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 6mm;
    justify-content: space-between;
    align-items: center;
    padding: 0 2mm;
    font-size: 10px;
    color: #374151;
    border-top: 1px solid #d1d5db;
    background: #fff;
  }
  body.printing-family-report #familyReportPrintArea.has-print-footer .report-page:not(.report-table-page) {
    height: 270mm;
  }
  body.printing-family-report #familyReportPrintArea.has-print-footer .report-table-page {
    padding-bottom: 8mm;
  }
  #reportPreviewBar {
    display: none !important;
  }
  body.printing-family-report > *:not(#familyReportPrintArea) {
    display: none !important;
  }
  body.printing-family-report #familyReportPrintArea {
    display: block !important;
  }
  /* Paper (per user, 2026-10-19): A4 landscape by default, A3 chosen in
     the report preview bar (applyReportPaper in app.js adds body.paper-a3
     and a <style> with the A3 @page - an @page rule can't hang off a body
     class). Every report page is laid out at A3 size (400 x 277 mm); A4
     has the same proportions, so on A4 the whole page is scaled down
     (277 x 190 mm printable / 400 x 277 = 0.686) instead of re-laid out. */
  @page {
    size: A4 landscape;
    margin: 10mm;
  }
  body.printing-family-report:not(.paper-a3) #familyReportPrintArea .report-page {
    zoom: 0.686;
  }
}

.report-page {
  page-break-after: always;
  break-after: page;
  width: 400mm; /* A3 landscape (420mm) minus 2 x 10mm @page margin (A4: scaled, see @page) */
  height: 277mm; /* A3 landscape (297mm) minus 2 x 10mm @page margin - FIXED,
                    not min-height: a long details column must clip rather
                    than grow the page, or the Naksha map (sized off this
                    same box via flex/height:100%, see .report-map-wrap)
                    would get pushed taller than one physical page and
                    print cut in half across a page break. */
  box-sizing: border-box;
  overflow: hidden;
}

.report-page:last-child {
  page-break-after: auto;
  break-after: auto;
}

.report-cover {
  display: flex;
  align-items: center;
  justify-content: center;
}

.report-cover-inner {
  text-align: center;
}

.report-cover-family-name {
  font-size: 64px;
  font-weight: 800;
  color: #14532d;
  margin-bottom: 18px;
  word-break: break-word;
}

.report-cover-subtitle {
  font-size: 24px;
  color: #374151;
  margin-bottom: 80px;
}

.report-cover-footer {
  font-size: 16px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 1px;
}

/* Per-owner section divider page (buildAndPrintFamilyReport, part 1 of
   each owner's section) - reuses the report cover's centered layout, but
   its subtitle is a plain count/area line, not the main cover's spaced
   block, so the big bottom margin that page needs is dropped here. */
.report-owner-cover .report-cover-subtitle {
  margin-bottom: 0;
}

.report-cover-date {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 6px;
}

.report-khesra-page {
  /* Column: a heading row (Naksha name left, owner name right) on top,
     then .report-khesra-body takes the rest. NOT its own height:100%
     here - .report-khesra-page is the SAME element as .report-page (both
     classes on one <section>), which already sets a fixed height: 277mm;
     re-declaring height here would just override that with 100% of the
     true parent (#familyReportPrintArea, no explicit height -> collapses
     to auto), silently undoing the fixed-page-height fix. */
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* The Khatiyan-detail + Naksha-map row of a per-Khesra page. flex:1 +
   min-height:0 makes it consume whatever's left under the heading row
   without pushing the fixed-height page taller (the map's fit still
   takes priority - see .report-page / .report-map-wrap svg). */
.report-khesra-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 16px;
  align-items: stretch;
}

/* Khatiyan PDF pages in the report - ONE Khatiyan page per landscape
   report page, scaled to fill it (rendered from Khata_<n>.pdf via pdf.js,
   see appendOwnerKhatiyanPages). A compact heading row, then the page
   image taking everything else. */
.report-khatiyan-page {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-khatiyan-page .report-overview-title {
  font-size: 13px;
  margin: 0;
}

.report-khatiyan-imgs {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

/* The Khatiyan scans are A4 landscape (aspect ~1.414) and the report
   page is a touch wider (~1.444), so HEIGHT is always the binding
   dimension - fill it edge to edge. max-width:100% is only a safety net
   against a scan that's wider than expected (it would letterbox rather
   than clip). */
.report-khatiyan-imgs canvas {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border: 1px solid #d7dbe0;
}

.report-khatiyan-missing {
  margin-top: 20px;
  font-size: 14px;
  color: #6b7280;
}

/* Qibala deed-document pages in the report - TWO pages side by side per
   landscape report page (rendered from the uploaded Qibala / Dakhil
   Kharij PDFs via pdf.js, see appendDeedDocPages2Up). Compact heading
   row, then the two page images. */
.report-qibala-page {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-qibala-page .report-overview-title {
  font-size: 13px;
  margin: 0;
}

.report-qibala-imgs {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: center;
}

.report-qibala-slot {
  flex: 1 1 50%;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.report-qibala-slot canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border: 1px solid #d7dbe0;
}

/* Pointer note on a per-Khesra detail page when the deed's full pages
   were printed with a different Khesra of the same deed. */
.report-qibala-ref {
  margin-top: 6px;
  padding: 4px 6px;
  border: 1px dashed #d7dbe0;
  border-radius: 4px;
  font-size: 9px;
  color: #374151;
}

.report-details-col {
  flex: 0 0 40%;
  max-width: 40%;
  height: 100%;
  overflow: hidden; /* clips rather than growing the page taller - see
                        .report-page - the Naksha map takes priority */
  font-size: 10px;
}

.report-details-col .record-card {
  width: 100%;
  margin-bottom: 0;
}

.report-map-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0; /* let the flex item shrink so a sibling color legend / heading gets its space */
  border: 1px solid #d7dbe0;
  border-radius: 6px;
  overflow: hidden;
}

/* Report map page: the Naksha on the left, a small "what's on this map"
   table (No / Khesra / Decimal + total) on the right - per direct user
   request, on both the family overview and the per-owner maps. */
.report-overview-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.report-khesra-list {
  flex: 0 0 120mm;
  min-height: 0;
  overflow: hidden; /* fixed-height page - a very long list clips rather than growing the page */
  font-size: 10px;
}

.report-khesra-list table {
  width: 100%;
  border-collapse: collapse;
}

.report-khesra-list th,
.report-khesra-list td {
  border: 1px solid #d7dbe0;
  padding: 1px 5px;
  text-align: left;
  line-height: 1.3;
}

/* No + Decimal columns right-aligned; Khesra + Raqba left-aligned. */
.report-khesra-list th:first-child,
.report-khesra-list td:first-child,
.report-khesra-list th:nth-child(3),
.report-khesra-list td:nth-child(3) {
  text-align: right;
  white-space: nowrap;
}

.report-khesra-list td:nth-child(4) {
  white-space: normal; /* "2 Bigha - 5 Kattha - 6 Dhoor" may wrap */
}

.report-khesra-list thead th {
  background: #f1f5f9;
  font-weight: 700;
}

.report-khesra-list tfoot td {
  font-weight: 700;
  background: #f8fafc;
}

/* The on-screen Naksha color legend (renderOwnerColorLegend), reused
   below the report's map pages per direct user request. Kept at its
   natural height (never flex-stretched) so the map above it takes the
   rest of the page. The land-tag swatches sit THREE per row (grid)
   rather than one-per-line - per direct user request, one-per-line was
   squeezing the map - and the Owner Colour Group table is shrunk to
   print-friendly type above them. */
.report-overview-page .owner-color-legend {
  flex: 0 0 auto;
  margin-top: 6px;
  padding-top: 6px;
}

.report-overview-page .owner-color-legend-title {
  margin-bottom: 2px;
}

.report-overview-page .owner-color-legend-grid {
  gap: 3px 20px;
}

.report-overview-page .owner-color-legend-row {
  margin-bottom: 0;
}

.report-overview-page .owner-color-legend-bar {
  width: 26px;
  height: 11px;
}

.report-overview-page .owner-color-legend-label {
  font-size: 11px;
}

.report-overview-page .owner-color-legend-table-wrap {
  overflow-x: visible;
  margin-bottom: 4px;
}

.report-overview-page .owner-color-legend-table {
  font-size: 10px;
  white-space: normal;
}

.report-overview-page .owner-color-legend-table th {
  font-size: 9px;
}

.report-overview-page .owner-color-legend-table th,
.report-overview-page .owner-color-legend-table td {
  padding: 2px 4px;
}

.report-map-wrap svg {
  /* Fills the box exactly - no CSS-level shrink. An earlier 72%/72%
     shrink (meant to make the map look "smaller/framed") was itself the
     cause of the visible top/bottom margin the user flagged as the real
     problem: shrinking the svg ELEMENT below its wrap's own size adds a
     margin around it regardless of preserveAspectRatio="slice" (slice
     only controls how the viewBox's CONTENT fills the svg element
     itself, not the svg element's own size relative to its wrap) - the
     two were fighting each other. Both page types (overview and
     per-Khesra) share this one rule via .report-map-wrap, so they can't
     drift into different treatments again. */
  width: 100%;
  height: 100%;
  display: block;
}

/* One page per Naksha sheet, right after the cover - the whole sheet
   with every one of the family's Khesras on it highlighted together,
   before the per-Khesra detail pages. */
.report-overview-page {
  display: flex;
  flex-direction: column;
  /* NOT its own height:100% here - same element as .report-page (both
     classes on one <section>), which already fixes the height at 277mm;
     re-declaring height here would just override that with 100% of the
     true parent (#familyReportPrintArea, no explicit height -> collapses
     to auto), silently undoing the fixed-page-height fix. */
}

.report-overview-title {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
  color: #14532d;
}

/* Map-page heading (family overview, per-owner map pages) and the
   per-Khesra page heading: the Naksha / "Map of <village>" name on the
   left, the family/owner name (what all the colored land belongs to) on
   the right - both in the same bold heading font (.report-overview-title
   above), per direct user request. */
.report-map-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
}

.report-map-heading-left,
.report-map-heading-right {
  flex: 0 1 auto;
}

.report-map-heading-right {
  text-align: right;
}

/* .report-overview-map-wrap needs no rules of its own any more - it
   already carries .report-map-wrap (see above), which now gives both
   page types the identical small/framed treatment. */

/* Full Land Table / Owner-wise Breakdown report pages - unlike the map
   pages, a long table must never be clipped (that would silently drop
   land from the report), so these override .report-page back to natural,
   content-driven height and let the browser paginate the table across as
   many physical pages as it actually needs. */
.report-table-page {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.report-table-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

/* Registry Map Report deed table (app.js buildAndPrintRegistryReport) - may
   run over several printed pages; its header row repeats on each. */
/* Full Naksha print: the map alone fills the page under the header,
   centred (the SVG's xMidYMid meet keeps it in the middle). */
.naksha-full-map {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Land near a Landmark: Minimum / Maximum size boxes + their conversion
   hint ("5 - 10 Kattha = 21.83 - 43.67 Decimal"). */
.road-adj-size {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #374151;
}

.road-adj-size-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #52514e;
  min-height: 1em;
}

/* Naksha Map Report header: centred title block, date top-right. */
.nr-header {
  position: relative;
  flex: 0 0 auto;
  text-align: center;
  padding: 2mm 30mm 3mm;
  margin-bottom: 3mm;
  border-bottom: 2px solid #14532d;
}

.nr-header-date {
  position: absolute;
  top: 2mm;
  right: 0;
  font-size: 15px;
  font-weight: 700;
  color: #14532d;
}

.nr-header-title {
  font-size: 26px;
  font-weight: 700;
  color: #14532d;
  line-height: 1.2;
}

.nr-header-sub {
  font-size: 17px;
  font-weight: 600;
  color: #1f2937;
  margin-top: 1mm;
}

/* Landmark Print Report: the search criteria, boxed so it reads as "what
   was searched". */
.nr-header-criteria {
  display: inline-block;
  margin-top: 2mm;
  padding: 1mm 4mm;
  border: 1px solid #14532d;
  border-radius: 2mm;
  background: #f0fdf4;
  font-size: 14px;
  font-weight: 600;
  color: #14532d;
}

.nr-header-facts {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2mm;
}

.nr-header-meta {
  font-size: 11px;
  color: #52514e;
  margin-top: 1mm;
}

.nr-header-compact {
  padding: 0 30mm 1.5mm;
  margin-bottom: 2mm;
}

.nr-header-compact .nr-header-date {
  top: 0;
}

.nr-header-compact .nr-header-title {
  font-size: 20px;
}

.nr-header-compact .nr-header-facts {
  font-size: 12px;
  margin-top: 0.5mm;
}

.registry-report-summary {
  margin: 4px 0 10px;
  font-size: 14px;
  font-weight: 600;
}

/* "Print Map" by the Naksha dropdown (Naksha Map Report). */
.print-map-btn {
  padding: 0 14px;
  border: 1px solid #14532d;
  background: #fff;
  color: #14532d;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.print-map-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.registry-report-note {
  margin: 6px 0;
  font-size: 13px;
  color: #52514e;
}

/* 21 size rows - kept compact so it sits beside the other page-1 tables. */
.registry-size-band-table td,
.registry-size-band-table th {
  padding: 2px 6px !important;
  font-size: 13px;
}

/* Legend under each Naksha Map Report map - natural height, the map above
   takes the rest of the A3 page. */
.naksha-report-legend {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin-top: 6px;
  font-size: 14px;
}

/* Khesra / Decimal list beside each Naksha Map Report map (and on its
   "continued" pages). Fixed 3 mm rows, 80 per column, filled top to bottom
   - app.js NAKSHA_LIST_* relies on these sizes to know what fits. */
.naksha-khesra-list {
  flex: 0 0 auto;
  font-size: 8px;
  line-height: 3mm;
  font-variant-numeric: tabular-nums;
}

/* Each column's first cell. */
.naksha-khesra-list .nkl-head {
  font-weight: 700;
  border-bottom: 1px solid #898781;
}

.naksha-khesra-list .nkl-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(80, 3mm);
  grid-auto-columns: 44mm;
  column-gap: 4mm;
}

.naksha-khesra-list .nkl-row span:first-child {
  font-weight: 700;
  color: #0b0b0b;
}

.naksha-khesra-list .nkl-row span:nth-child(2) {
  color: #0b0b0b;
}

.naksha-khesra-list .nkl-row span:last-child {
  color: #52514e;
}

/* Khesra No | Khata | Decimal | B-K-D - left, centre, right, right. */
.naksha-khesra-list .nkl-row,
.naksha-khesra-list .nkl-head {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1.1fr 1.1fr;
  white-space: nowrap;
}

.naksha-khesra-list .nkl-row span:nth-child(2),
.naksha-khesra-list .nkl-head span:nth-child(2) {
  text-align: center;
}

.naksha-khesra-list .nkl-row span:nth-child(n + 3),
.naksha-khesra-list .nkl-head span:nth-child(n + 3) {
  text-align: right;
}

.naksha-khesra-list .nkl-row {
  border-bottom: 1px solid #f0efec;
  padding: 0 2px;
}

/* Government land, the same amber as on the map. */
.naksha-khesra-list .nkl-govt {
  background: rgba(237, 161, 0, 0.25);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

/* Print Map with Khesra numbers: detail pages, 7 rows each (app.js
   appendNakshaSelectedPages). */
.naksha-detail-page .naksha-selected-table {
  font-size: 12px;
}

.naksha-chauhaddi-cell {
  font-size: 10px;
  line-height: 1.35;
  min-width: 60mm;
}

/* Print Map with Khesra numbers: the chosen plots' table beside the map. */
.naksha-selected-side {
  flex: 0 0 185mm;
  min-width: 0;
  overflow: hidden;
}

.naksha-selected-table {
  font-size: 12px;
}

.naksha-selected-table td {
  vertical-align: top;
}

.naksha-selected-table .nkl-govt td {
  background: rgba(237, 161, 0, 0.25);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

/* The small Nazri Naksha per row (drawNazriThumbnails sets its size). */
.naksha-nazri-cell {
  padding: 2px !important;
  width: 1%;
}

.naksha-nazri {
  border: 1px solid #d7dbe0;
  background: #fff;
}

.naksha-nazri svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* 1-3 Khesras: map left, one card per Khesra stacked on the right. */
.naksha-cards-side {
  flex: 0 0 175mm;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4mm;
}

/* Always a third of the column, so a page with 1 card looks the same as
   one with 3 (no stretched card). */
.naksha-card {
  flex: 0 0 calc((100% - 8mm) / 3);
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1.5px solid #1f2937;
  border-radius: 4mm;
  padding: 3mm 4mm;
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  break-inside: avoid;
}

.naksha-card-head {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  border-bottom: 1px solid #d7dbe0;
  padding-bottom: 1mm;
  margin-bottom: 1mm;
}

.naksha-card-area {
  color: #0f5132;
  margin-bottom: 1mm;
}

.naksha-card-owner {
  margin-bottom: 2mm;
}

.naksha-card-source {
  font-size: 10px;
  color: #52514e;
}

.naksha-card-label {
  font-weight: 700;
  margin-bottom: 1mm;
}

/* Text on the left half, the Nazri Naksha filling the whole right half
   (per user: "full size on the right"). */
.naksha-card-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 3mm;
}

.naksha-card-text {
  flex: 0 0 48%;
  min-width: 0;
  overflow: hidden;
}

.naksha-card-body .naksha-nazri {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.naksha-selected-was {
  font-size: 10px;
  color: #52514e;
}

.naksha-selected-sheet {
  font-size: 10px;
  color: #52514e;
}

.naksha-legend-item {
  display: inline-flex;
  align-items: center;
}

.naksha-legend-note {
  flex-basis: 100%;
  font-size: 12px;
  color: #52514e;
}

.registry-report-subhead {
  margin: 14px 0 6px;
  font-size: 16px;
}

/* Page 1: summary tables on the left, the two charts in the space on the
   right (app.js registryYearDonutHtml / registryYearBarsHtml). */
.registry-summary-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.registry-summary-tables {
  flex: 1 1 58%;
  min-width: 0;
}

.registry-summary-charts {
  flex: 1 1 42%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 14px;
}

.registry-chart-title {
  font-size: 16px;
  font-weight: 700;
  color: #0b0b0b;
}

.registry-chart-sub {
  font-size: 12px;
  color: #52514e;
  margin-bottom: 6px;
}

/* Naksha Map Report: size-share donut + % bar chart side by side under the
   summary tables. */
.naksha-size-charts {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 14px;
}

.naksha-size-donut {
  flex: 0 0 auto;
}

.naksha-size-donut .registry-donut-row {
  gap: 10px;
}

.naksha-size-donut .registry-chart-legend {
  font-size: 11px;
}

.naksha-size-bars {
  flex: 1 1 auto;
  min-width: 0;
}

.registry-donut-row {
  display: flex;
  gap: 20px;
  align-items: center;
}

.registry-chart-legend {
  border-collapse: collapse;
  font-size: 13px;
}

.registry-chart-legend th,
.registry-chart-legend td {
  padding: 3px 8px;
  text-align: left;
  border-bottom: 1px solid #e1e0d9;
  white-space: nowrap;
}

.registry-chart-legend tfoot td {
  font-weight: 700;
  border-bottom: none;
  border-top: 1px solid #c3c2b7;
}

.registry-chart-legend .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.registry-chart-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 8px;
  vertical-align: -1px;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

/* Year-wise summary on page 1 - a short table, so not full page width. */
.registry-year-table {
  width: 100% !important;
  font-size: 15px !important;
}

.registry-report-table th,
.registry-report-table td {
  border: 1px solid #d7dbe0;
  padding: 3px 6px;
  text-align: left;
  vertical-align: top;
}

.registry-report-table thead {
  display: table-header-group;
}

.registry-report-table thead th {
  background: #f1f5f9;
}

.registry-report-table tr {
  break-inside: avoid;
}

.registry-report-table .num {
  text-align: right;
  white-space: nowrap;
}

.registry-report-table tfoot td {
  font-weight: 700;
  background: #f8fafc;
}

.report-owner-heading {
  margin: 20px 0 6px;
  font-size: 16px;
  color: #1d4ed8;
}

.report-owner-heading:first-of-type {
  margin-top: 8px;
}

.report-owner-table th,
.report-owner-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.report-owner-table thead tr {
  border-bottom: 2px solid #d1d5db;
}

/* Hides the live Khesra Details card and Google Earth panel on screen
   for the duration of a Family Property Report print (see
   buildAndPrintFamilyReport in app.js) - unrelated to the @media print
   rules above, this affects the ordinary on-screen view too, since the
   print dialog sits on top of the still-visible page behind it. */
.hidden-during-report {
  display: none !important;
}

/* Full-screen "building the report" overlay - see showReportProgress()/
   updateReportProgress()/hideReportProgress() in app.js. Removed from
   the DOM before window.print() is ever called, but hidden here too as
   a belt-and-suspenders safety net against any timing edge case. */
#reportProgressOverlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.97);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

@media print {
  #reportProgressOverlay {
    display: none !important;
  }
}

/* First-time page load overlay - see showPageLoadProgress()/
   updatePageLoadProgress()/hidePageLoadProgress() in app.js. Reuses the
   .report-progress-* classes above for the title/bar/text look, just
   under its own id so it can't collide with the Family Report overlay. */
#pageLoadOverlay {
  position: fixed;
  inset: 0;
  background: #f4f5f7;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

/* Set (via JS, once the village's khesra_village.imagePath is known) so the
   initial load shows that photo instead of a bare flat color - the dark
   scrim keeps the progress text/track readable over an arbitrary photo. */
#pageLoadOverlay.has-bg-image {
  background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), var(--page-load-bg, none);
  background-size: cover;
  background-position: center;
}

#pageLoadOverlay.has-bg-image .report-progress-title,
#pageLoadOverlay.has-bg-image .report-progress-text {
  color: #ffffff;
}

.report-progress-title {
  font-size: 17px;
  font-weight: 700;
  color: #14532d;
}

.report-progress-track {
  width: 320px;
  max-width: 80vw;
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.report-progress-fill {
  width: 0%;
  height: 100%;
  background: #14532d;
  transition: width 0.2s ease;
}

.report-progress-text {
  font-size: 13px;
  color: #6b7280;
}

.group-toggle-pill {
  border: 1px solid #d7dbe0;
  background: #f8f9fb;
  color: #374151;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}

.group-toggle-pill:hover {
  background: #eef0f2;
}

.group-toggle-pill-active {
  background: #ffedd5;
  border-color: #fdba74;
  color: #7c2d12;
  font-weight: 600;
}

/* "My Land Group" bulk-create shortcut next to an owner's name in the
   Khesra Details panel. */
.bulk-group-btn {
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #92400e;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.bulk-group-btn:hover {
  background: #ffedd5;
}

/* ---------------------------------------------------------------------
   Responsive / device tiers - applies site-wide since every page shares
   this stylesheet. Three tiers, matching how the site is actually used:
     - Desktop (default, no query): full multi-column layout.
     - Tablet (<=800px): the existing .results/.calib-grid breakpoint
       already collapses two-column panels to one column; this section
       adds the topbar/search-bar/table tightening that applies from
       here down to phone width too.
     - Phone (<=480px): tighter spacing/type on top of the tablet tier,
       for one-handed use.
   Data tables built by public/app.js (owner-lands table, ownership
   columns) set padding/font-size via INLINE styles on each generated
   <td>/<th> - !important is used deliberately here, only inside these
   mobile-only rules, to shrink them without a template rewrite; nothing
   outside these media queries uses !important.
--------------------------------------------------------------------- */
@media (max-width: 800px) {
  .container {
    padding: 16px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }

  /* The topbar's nav-pills group (Calibrate Map / Manage Families /
     Manage Customers / Village tag) is built with an inline flex style
     on every page rather than a shared class - targeted structurally
     (last child of .topbar) so this works everywhere without touching
     each page's markup. */
  .topbar > div:last-child {
    flex-wrap: wrap;
    gap: 8px !important;
  }

  .search-bar {
    flex-wrap: wrap;
  }

  .search-bar input[type="text"] {
    flex-basis: 100%;
    order: -1;
  }

  .map-selector {
    flex: 1;
  }

  /* Every data table in the app (owner-lands table, GCP table, etc.)
     gets tighter cell padding/type so more columns stay legible before
     the horizontal scroll (already provided by each table's own
     overflow-x:auto wrapper) kicks in. */
  table td,
  table th {
    padding: 5px 7px !important;
    font-size: 12px !important;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 12px;
  }

  .brand {
    font-size: 16px;
  }

  .village-tag {
    font-size: 12px;
    padding: 3px 10px;
  }

  .panel {
    padding: 14px 14px;
  }

  .panel h2 {
    font-size: 14px;
  }

  .search-bar input[type="text"] {
    font-size: 15px;
  }

  table td,
  table th {
    padding: 4px 6px !important;
    font-size: 11px !important;
  }
}

/* Searched-parcel "Blink 3 times" display option (per village - see
   blinkSearchedParcels in app.js). The parcel keeps its normal highlight
   color; this only flashes it 3 times in place, then it stays colored. */
@keyframes parcel-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.05; }
}
.parcel-blink-3 {
  animation: parcel-blink 0.7s ease-in-out 3;
}

/* "3D lift + blink" option: the parcel (already drawn with the raised 3D
   emboss look - shaded fill + drop shadow) rises a little and grows around
   its own center, stays raised (forwards), and keeps blinking non-stop
   (per user request) until the map is redrawn by the next search/click. */
@keyframes parcel-lift {
  from { transform: translateY(0) scale(1); }
  to { transform: translateY(-6%) scale(1.25); }
}
.parcel-lift-3d {
  transform-box: fill-box;
  transform-origin: center;
  animation:
    parcel-lift 0.5s ease-out forwards,
    parcel-blink 0.9s ease-in-out 0.5s infinite;
}

/* Khesra Report: a deed page in the Registration Department's "Deed
   Details" layout - app.js deedDetailsGovtStyleHtml */
.deed-govt {
  font-size: 11px;
  color: #111827;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.deed-govt-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  text-decoration: underline;
  margin: 4px 0 2px;
}

.deed-govt-source {
  text-align: center;
  font-size: 10px;
  color: #6b7280;
  margin-bottom: 8px;
}

.deed-govt h4 {
  font-size: 14px;
  margin: 14px 0 6px;
}

.deed-govt-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.deed-govt-table th {
  background: #1f9c8a;
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 7px 5px;
  border: 1px solid #e5e7eb;
}

.deed-govt-table td {
  padding: 6px 5px;
  border: 1px solid #e5e7eb;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.deed-govt-table tr.deed-govt-this td {
  background: #fef08a;
  font-weight: 600;
}
