:root {
  --accent: #c0512c;
  --accent-dark: #9c3f21;
  --ink: #1b1b1a;
  --ink-soft: #5f6360;
  --line: #e2e0dc;
  --bg: #f7f5f2;
  --card: #ffffff;
  --panel-w: 400px;
  --topbar-h: 60px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
}

/* ---------- barre du haut ---------- */

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand-name { font-weight: 650; letter-spacing: -0.2px; }
.brand-by {
  color: var(--ink-soft);
  font-size: 12.5px;
  text-decoration: none;
  padding-left: 9px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}
.brand-by:hover { color: var(--accent); }

.search { position: relative; flex: 1; max-width: 560px; }

.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
.search input:focus { border-color: var(--accent); background: #fff; }

.suggestions {
  position: absolute;
  z-index: 1200;
  top: 46px; left: 0; right: 0;
  margin: 0; padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.14);
  max-height: 340px;
  overflow-y: auto;
}
.suggestions li {
  padding: 9px 11px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1.35;
}
.suggestions li small { display: block; color: var(--ink-soft); font-size: 12.5px; }
.suggestions li.active, .suggestions li:hover { background: #f2efe9; }

.topbar-link {
  flex: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}
.topbar-link:hover { text-decoration: underline; }

/* ---------- mise en page ---------- */

.layout {
  display: flex;
  height: calc(100% - var(--topbar-h));
}

.map-wrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: #d9d6d0; }

.panel {
  width: var(--panel-w);
  flex: none;
  background: var(--card);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px 22px 40px;
}

/* ---------- outils sur la carte ---------- */

.map-hint {
  position: absolute;
  z-index: 900;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  padding: 9px 16px;
  background: rgba(27,27,26,.88);
  color: #fff;
  border-radius: 999px;
  font-size: 13.5px;
  white-space: nowrap;
  pointer-events: none;
}
.map-hint strong { color: #ffbf9c; margin-right: 4px; }

.map-tools {
  position: absolute;
  z-index: 900;
  left: 14px; bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(100% - 28px);
}

.tool {
  font: inherit;
  font-size: 13.5px;
  padding: 8px 13px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  cursor: pointer;
}
.tool:hover { background: #f2efe9; }
.tool.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.tool.primary:hover { background: var(--accent-dark); }
.tool.toggle { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.tool.toggle input { margin: 0; accent-color: var(--accent); }

/* poignées de tracé */
.vx {
  background: #fff;
  border: 2.5px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  cursor: grab;
}
.vx:active { cursor: grabbing; }
.vx-mid {
  border-width: 2px;
  border-color: #fff;
  background: var(--accent);
  opacity: .55;
}
.vx-mid:hover { opacity: 1; }

/* ---------- panneau : état vide ---------- */

.empty { padding-top: 26px; text-align: center; }
.empty-icon { color: var(--accent); opacity: .9; }
.empty h2 { font-size: 19px; margin: 14px 0 18px; letter-spacing: -0.3px; }

.steps {
  text-align: left;
  margin: 0 auto;
  padding-left: 22px;
  color: var(--ink-soft);
  line-height: 1.75;
  max-width: 300px;
}
.empty-note {
  margin-top: 26px;
  font-size: 13px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

/* ---------- panneau : résultats ---------- */

.headline {
  background: linear-gradient(160deg, #fdf3ee, #f8ece5);
  border: 1px solid #f0ddd2;
  border-radius: 12px;
  padding: 18px 18px 15px;
  margin-bottom: 22px;
}
.headline-value {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--accent-dark);
}
.headline-value small {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 8px;
  color: var(--ink-soft);
}
.headline-sub { margin-top: 9px; font-size: 13px; color: var(--ink-soft); }
.headline-sub b { color: var(--ink); }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field select:focus { outline: none; border-color: var(--accent); }

.section-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  margin: 26px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.kv { width: 100%; border-collapse: collapse; }
.kv th, .kv td { padding: 9px 0; text-align: left; vertical-align: top; font-weight: 400; }
.kv th { color: var(--ink-soft); }
.kv td { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv tr + tr th, .kv tr + tr td { border-top: 1px solid #f0eeea; }
.hint-inline { color: #a3a6a2; font-size: 12px; }

.quotes { display: flex; flex-direction: column; gap: 8px; }
.quote {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  background: var(--bg);
  border-radius: 9px;
}
.quote-label { font-size: 13.5px; }
.quote-label small { display: block; color: var(--ink-soft); font-size: 11.5px; }
.quote-value { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

.disclaimer {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 16px 0 0;
}

.actions { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.btn {
  display: block;
  width: 100%;
  padding: 12px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.btn:hover { background: #f2efe9; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .layout { flex-direction: column; height: auto; }
  .map-wrap { height: 58vh; flex: none; }
  .panel { width: 100%; border-left: none; border-top: 1px solid var(--line); }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .topbar-link, .brand-by { display: none; }
}

/* ---------- impression ---------- */

.print-sheet { display: none; }

@media print {
  .topbar, .layout { display: none !important; }
  .print-sheet { display: block; padding: 8mm; color: #000; }
  .print-sheet h1 { font-size: 20pt; margin: 0 0 2mm; }
  .print-sheet .addr { color: #444; margin: 0 0 6mm; }
  .print-sheet h2 { font-size: 11pt; text-transform: uppercase; letter-spacing: .05em;
                    border-bottom: 1px solid #999; padding-bottom: 1.5mm; margin: 7mm 0 2mm; }
  .print-sheet table { width: 100%; border-collapse: collapse; font-size: 10.5pt; }
  .print-sheet td { padding: 1.8mm 0; border-bottom: 1px solid #eee; }
  .print-sheet td + td { text-align: right; font-weight: bold; }
  .print-sheet .foot { margin-top: 8mm; font-size: 8.5pt; color: #555; line-height: 1.5; }
}
