: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: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 20px 16px;
  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;
}

.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;
  background: var(--accent-2);
  color: #fff;
  padding: 12px 20px;
  gap: 28px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stat-value {
  font-family: var(--sans);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.7rem;
  color: #cddace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

@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;
  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. */

.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;
  margin: 10px auto 0;
  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; }
.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 {
  position: absolute;
  right: 16px;
  top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.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;
}

.parcel.clickable {
  cursor: pointer;
}

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

.parcel.inert {
  cursor: default;
}

.parcel.selected {
  stroke: var(--ink);
  stroke-opacity: 1;
  stroke-width: 2;
}

.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 {
  color: #767267;
  font-size: 0.9rem;
}

.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; }
