:root {
  --dispo-a: #1E4A2D;
  --dispo-b: #1E4A2D;
  --notaire-a: #15311E;
  --notaire-b: #15311E;
  --reserve-a: #A6A6A6;
  --reserve-b: #8D8D8D;
  --indispo-a: #F2F2F2;
  --indispo-b: #D9D9D9;
  --ink: #21281f;
  --bg: #f6f4ee;
  --panel-bg: #ffffff;
  --border: #ddd7ca;
  --accent: #16301f;
  --accent-2: #1f4a2d;
  --gold: #b8923f;
  --gold-soft: #f5ead0;
  --red: #7d2530;
  --red-dark: #631d26;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", ui-serif, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

/* subtle geometric watermark, pure CSS/SVG, no image download — shown to everyone, including low-bandwidth mobile */
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(184,146,63,0.05), transparent 45%),
    radial-gradient(circle at 85% 90%, rgba(184,146,63,0.05), transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23b8923f' stroke-width='0.6' opacity='0.10'%3E%3Cpath d='M60 6 L114 60 L60 114 L6 60 Z'/%3E%3Ccircle cx='60' cy='60' r='30'/%3E%3Cpath d='M60 30 L90 60 L60 90 L30 60 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat, repeat, repeat;
  background-size: auto, auto, 120px 120px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 14px 20px;
  background: var(--accent);
  color: #fff;
}

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

.logo-mark {
  width: 34px;
  height: 34px;
  color: var(--gold);
  flex-shrink: 0;
}

.topbar-titles h1 {
  font-family: var(--serif);
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  margin: 0 0 3px;
  font-weight: 600;
  /* Stated here: the admin and login styles colour h1 dark green, invisible on this header. */
  color: #fff;
}

.subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: #cdd9d0;
  font-weight: 400;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.72rem;
  color: #dce6df;
  white-space: nowrap;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 11px 20px;
  background: var(--accent-2);
  color: #dce6df;
  font-size: 0.9rem;
}
.stats-bar strong { color: #fff; font-weight: 600; white-space: nowrap; }
.stats-bar .price-amount { color: #f0d488; }
.price-m2 { color: #cddace; white-space: nowrap; }
.stats-bar > :not([hidden]) ~ :not([hidden])::before { content: "·"; margin-right: 12px; color: var(--gold); }
@media (max-width: 799px) {
  .stats-bar { flex-direction: column; align-items: flex-start; }
  .stats-bar > :not([hidden]) ~ :not([hidden])::before { display: none; }
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (max-width: 799px) {
  .panel { order: -1; }
}

@media (min-width: 800px) {
  .layout {
    flex-direction: row;
    align-items: flex-start;
  }
  .map-wrap {
    flex: 1 1 65%;
  }
  .panel {
    flex: 1 1 35%;
    max-width: 380px;
  }
}

.map-wrap {
  position: relative;
  padding: 14px;
}

.map-frame {
  position: relative;
}

#map {
  width: 100%;
  height: auto;
  max-height: calc(78vh - 10px);
  background: #fffdf8;
  border: 1px solid var(--border);
  border-radius: 8px;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}
#map:active { cursor: grabbing; }
/* the ornamental frame is rendered as an in-SVG <image> by app.js (desktop only),
   so it zooms and pans together with the parcels instead of staying static as CSS. */

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 0.76rem;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 7px 16px;
  width: fit-content;
  max-width: 100%;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot.dispo { background: var(--dispo-a); }
.dot.reserve { background: var(--reserve-a); }
.dot.indispo { background: var(--indispo-a); }
.dot.notaire { background: var(--notaire-a); }

.legend-notary { color: var(--notaire-b); }

.zoom-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoom-controls button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent);
  font-size: 1.05rem;
  cursor: pointer;
}
.zoom-controls button:hover { background: #f2f0ea; }
.zoom-controls button:active { background: #e8e5dc; }
.zoom-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.reset-label { display: none; }

@media (max-width: 799px) {
  .desktop-only-control { display: none; }
  .zoom-controls {
    flex-direction: row;
  }
  .zoom-reset-btn {
    width: auto;
    height: auto;
    padding: 8px 14px;
    border-radius: 20px;
  }
  .reset-label {
    display: inline;
    font-size: 0.8rem;
    font-weight: 600;
  }
}

.control-sep {
  height: 1px;
  background: var(--border);
  margin: 2px 2px;
}

.north-arrow {
  position: absolute;
  left: 16px;
  top: 16px;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.export-btn:hover { background: #f2f0ea; }
.export-btn:disabled { opacity: 0.6; cursor: wait; }

.scale-bar {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.scale-line {
  display: block;
  height: 5px;
  border: 1.5px solid var(--accent);
  border-top: none;
  width: 80px;
}
.scale-label {
  font-size: 0.7rem;
  color: var(--accent);
  background: rgba(255,255,255,0.75);
  padding: 0 4px;
  border-radius: 3px;
}

.site-boundary {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.parcel {
  stroke: var(--gold);
  stroke-opacity: 0.55;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  transition: filter 0.1s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.parcel.clickable {
  cursor: pointer;
}

.parcel.clickable:hover, .parcel.clickable:focus {
  filter: brightness(0.94);
  outline: none;
}

.parcel.inert {
  cursor: default;
}

.parcel.selected {
  stroke: var(--gold);
  stroke-opacity: 1;
  stroke-width: 2.8;
  transform-box: fill-box;
  transform-origin: center;
  animation: parcel-select-bounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes parcel-select-bounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  70% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.parcel.status-dispo { fill: var(--dispo-a); }
.parcel.status-notaire { fill: var(--notaire-a); }
.parcel.status-reserve { fill: var(--reserve-a); }
.parcel.status-indispo { fill: var(--indispo-a); }

.parcel-label {
  font-size: 5px;
  font-weight: 400;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: middle;
}

.parcel-label.status-notaire {
  fill: url(#grad-notaire-text);
  font-weight: 600;
}
.parcel-label.status-dispo {
  fill: #faf8f2;
}
.parcel-label.status-reserve {
  fill: #21281f;
}
.parcel-label.status-indispo {
  fill: #8A8D86;
}

.panel {
  background: var(--panel-bg);
  border-top: 1px solid var(--border);
  padding: 20px;
  min-height: 160px;
}

@media (min-width: 800px) {
  .panel {
    border-top: none;
    border-left: 1px solid var(--border);
    margin: 14px 14px 14px 0;
    border-radius: 8px;
    border: 1px solid var(--border);
  }
}

.panel-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #6b5a30;
  font-size: 0.88rem;
  background: var(--gold-soft);
  border: 1px solid #e6d5ab;
  border-radius: 14px;
  padding: 12px 16px;
}

@media (max-width: 799px) {
  .panel.panel-empty {
    min-height: 0;
    padding: 14px 20px;
  }
}

.panel-eyebrow {
  margin: 0 0 12px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8a8779;
  font-weight: 600;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.mini-shape {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  overflow: visible;
}
.mini-shape polygon {
  stroke: var(--gold);
  stroke-width: 1.6;
}
.mini-shape.status-dispo polygon { fill: var(--dispo-a); }
.mini-shape.status-notaire polygon { fill: var(--notaire-a); }
.mini-shape.status-reserve polygon { fill: var(--reserve-a); }
.mini-shape.status-indispo polygon { fill: var(--indispo-a); }

.panel-parcel-number {
  font-family: var(--sans);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--ink);
}

.detail-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f0ece2;
  font-size: 0.9rem;
}

.detail-icon {
  color: var(--gold);
  display: flex;
}

.detail-label { color: #6b6a62; }

.detail-value {
  font-weight: 600;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.detail-value small { font-weight: 500; color: #8a8779; }
.detail-value .dot { width: 8px; height: 8px; }

.approx-note {
  margin-top: 4px;
  font-size: 0.78rem;
  color: #8a6b1f;
  background: #fff6e0;
  border: 1px solid #f0dca0;
  border-radius: 6px;
  padding: 8px 10px;
}

.whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
  padding: 13px 14px;
  background: #3FA36B;
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.whatsapp-btn:hover { background: #358A5A; }

.maps-link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}
.maps-link-btn:hover { background: #f2f0ea; }

/* ---- V2: login zone and role-dependent block ---- */
.topbar-right { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 12px; }
.user-zone { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; font-size: 13px; }
.user-name { opacity: .9; }
.user-link { color: #fff; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: 12.5px; text-decoration: none; cursor: pointer; }
.user-link:hover { background: rgba(255,255,255,.26); }
.extras { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 14px; }
.extras h4 { margin: 14px 0 6px; font-family: var(--serif); font-size: 15px; color: var(--accent); }
.extras .x-list { list-style: none; margin: 0 0 8px; padding: 0; }
.extras .x-list li { padding: 6px 0; border-bottom: 1px solid #eee9dc; }
.extras .x-meta, .extras .x-hint { color: #6b7466; font-size: 12.5px; }
.extras .x-hint { margin: 4px 0 8px; }
.extras .x-history summary { cursor: pointer; font-weight: 600; margin-top: 14px; color: var(--accent); }
.extras > :first-child { margin-top: 0; }
.edit-parcel-btn { display: flex; justify-content: center; padding: 12px 14px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; }
.edit-parcel-btn:hover { background: var(--accent-2); }

/* ---- header: Google Maps, after the address ---- */
.address-row { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 14px; }
.maps-site { display: inline-flex; align-items: center; gap: 4px; color: #f0d488; font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.maps-site:hover { text-decoration: underline; }
.maps-site[hidden], .stat[hidden], .legend-item[hidden], .stats-bar [hidden] { display: none; }

@media (max-width: 799px) {
  .topbar-right { width: 100%; justify-content: space-between; }
  /* The price banner already invites to touch a parcel. */
  .panel.panel-empty { display: none; }
}
@media (max-width: 799px) {
  /* Its label was spilling out of a 34 px button. */
  .zoom-controls button.zoom-reset-btn { width: auto; height: auto; padding: 7px 13px; border-radius: 20px; }
}
