:root {
  --bg: #ECEFF6;            /* nacre froide : fait ressortir les couleurs au lieu de les eteindre */
  --bg-2: #F2EFF6;
  --bg-3: #EBF2F1;
  --card: #FFFFFF;
  --ink: #111823;
  --ink-2: #49556A;
  --ink-3: #8390A5;
  --line: #DCE2EE;
  --pos: #0E7A4B;
  --pos-soft: #D8EFE1;
  --neg: #BC4430;
  --neg-soft: #F8E2DD;
  --warn: #9A6A00;
  --warn-soft: #F7EBCB;
  --act: #2447E5;
  --act-soft: #E1E6FC;
  /* teintes de nacre : chaque famille d'information a la sienne */
  --teal: #0A6E73;        --teal-soft: #D5EBEC;     /* quartier, meuble */
  --violet: #6A48A8;      --violet-soft: #E8E2F5;   /* tension, colocation */
  --rose: #B23A63;        --rose-soft: #F8E0E8;     /* courte duree */
  --slate: #4A5C6A;       --slate-soft: #E3E8F1;    /* location vide */
  --bar-loan: #9FB0AA;
  --bar-charges: #D4DBD7;
  --radius: 14px;
  /* Deux roles nets : un serif editorial porte l'identite, un sans technique porte les chiffres. */
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1219; --bg-2: #141220; --bg-3: #101A1A; --card: #181D28; --ink: #EDF1F8; --ink-2: #A7B2C4; --ink-3: #6B7689; --line: #252C3A;
    --pos: #4FC77F; --pos-soft: #17342A; --neg: #E8705B; --neg-soft: #3B221E; --warn: #E2B04A; --warn-soft: #3A2F12;
    --act: #8FA3FF; --act-soft: #202A4B; --bar-loan: #3D4B47; --bar-charges: #2C3733;
    --teal: #4FBCC4; --teal-soft: #11332F; --violet: #A98FE0; --violet-soft: #241E3A;
    --rose: #E68BAA; --rose-soft: #341A24; --slate: #9FB2BF; --slate-soft: #202A30;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1219; --bg-2: #141220; --bg-3: #101A1A; --card: #181D28; --ink: #EDF1F8; --ink-2: #A7B2C4; --ink-3: #6B7689; --line: #252C3A;
  --pos: #4FC77F; --pos-soft: #17342A; --neg: #E8705B; --neg-soft: #3B221E; --warn: #E2B04A; --warn-soft: #3A2F12;
  --act: #8FA3FF; --act-soft: #202A4B; --bar-loan: #3D4B47; --bar-charges: #2C3733;
  --teal: #4FBCC4; --teal-soft: #11332F; --violet: #A98FE0; --violet-soft: #241E3A;
  --rose: #E68BAA; --rose-soft: #341A24; --slate: #9FB2BF; --slate-soft: #202A30;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html { height: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  /* voile de nacre : trois teintes a tres faible saturation, jamais un aplat mort */
  background: var(--bg);
  background-image: linear-gradient(168deg, var(--bg-2) 0%, var(--bg) 46%, var(--bg-3) 100%);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  /* coquille fixe : l'en-tete et la barre d'onglets ne defilent jamais */
  height: 100%; overflow: hidden; display: flex; flex-direction: column;
}
.top, .filters, .tabbar { flex: 0 0 auto; }
.scroller { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.scroller.map-mode { overflow: hidden; display: flex; flex-direction: column; }
.scroller.map-mode .mapwrap { flex: 1 1 auto; display: flex; flex-direction: column; margin: 8px 16px 8px; }
.scroller.map-mode .mapview { flex: 1 1 auto; height: auto; min-height: 220px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--act); }
h2 { font-family: var(--font-display); font-size: 23px; font-weight: 600; margin: 8px 0 12px; letter-spacing: 0; line-height: 1.2; }

/* ---------- en-tête ---------- */
.top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 18px 8px;
}
.top-note { color: var(--ink-3); font-size: 12.5px; }
.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 23px; letter-spacing: -0.01em; line-height: 1; }
.brand-sub { color: var(--ink-3); font-size: 13px; }
.icon-btn { background: none; border: 0; padding: 8px; margin: -8px; color: var(--ink-2); border-radius: 10px; }
.icon-btn:focus-visible, .chip:focus-visible, .btn:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--act); outline-offset: 2px; }

.tabbar {
  /* pilule flottante, icones seules : le contenu reste le sujet */
  align-self: stretch; margin: 4px 14px calc(8px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 999px;
  /* translucide : le contenu transparait sur les cotes, la barre ne fait pas bloc */
  background: color-mix(in srgb, var(--card) 55%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(200%); backdrop-filter: blur(22px) saturate(200%);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  box-shadow: 0 6px 26px rgba(17, 24, 35, .10);
}
.tabbar button {
  -webkit-appearance: none; appearance: none; background: none; border: 0; color: var(--ink-3);
  flex: 1 1 0; min-width: 0; height: 42px; border-radius: 999px; display: grid; place-items: center; transition: color .15s;
}
.tabbar button svg { width: 23px; height: 23px; stroke-width: 1.75; display: block; }
.tabbar button.on { color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); }
.tabbar button.on svg { stroke-width: 2.1; }

.filters { padding: 10px 16px 8px; border-bottom: 1px solid var(--line); }
.search input {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 12px; -webkit-appearance: none;
}
.search input:focus { outline: 2px solid var(--act); border-color: transparent; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 6px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 13px; font-size: 13.5px; color: var(--ink-2);
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.select { -webkit-appearance: none; appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }

.scanbar { margin: 6px 16px 0; padding: 8px 12px; border-radius: 10px; background: var(--act-soft); color: var(--act); font-size: 13px; }

/* ---------- liste ---------- */
.list { padding: 10px 14px 0; display: flex; flex-direction: column; gap: 12px; }
.count { text-align: center; color: var(--ink-3); font-size: 13px; margin: 14px 0; }
.more { text-align: center; margin-top: 14px; }
.more button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 18px; }
.empty { text-align: center; color: var(--ink-2); padding: 48px 24px; }
.empty strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }

.card {
  background: var(--card); border-radius: 18px; padding: 14px 16px 14px; border: 0;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "head cf" "meta cf" "tiles tiles" "flags flags"; gap: 2px 12px; text-align: left; width: 100%;
}
.card.warn { border: 0; }   /* l'alerte est deja portee par les etiquettes */
.card > * { min-width: 0; }
.card .head { grid-area: head; font-weight: 600; font-size: 15.5px; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.card .head small { color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.card .meta { grid-area: meta; color: var(--ink-2); font-size: 13.5px; display: flex; flex-wrap: wrap;
  align-items: baseline; column-gap: 11px; row-gap: 0; margin-top: 1px; }
.card .meta span { white-space: nowrap; }
.card .meta .pos { color: var(--pos); }
.card .meta b { color: var(--ink); font-weight: 600; }
.card .cf { grid-area: cf; text-align: right; align-self: start; flex: 0 0 auto; }
.card { overflow: hidden; }
.cf .num { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.cf .num.pos { color: var(--pos); } .cf .num.neg { color: var(--neg); }
.cf .lbl { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; }
.cf .alt { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; white-space: nowrap; }
.card .bar { grid-area: bar; margin-top: 10px; }
.card .flags { grid-area: flags; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bar-charges); }
.bar i { display: block; height: 100%; }
.bar .loan { background: var(--bar-loan); }
.bar .chg { background: var(--bar-charges); }
.bar .rest { background: var(--pos); }
.bar .deficit { background: var(--neg); }
.bar-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.bar-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; background: var(--bar-loan); }
.bar-legend .l-chg::before { background: var(--bar-charges); }
.bar-legend .l-rest::before { background: var(--pos); }
.bar-legend .l-def::before { background: var(--neg); }

.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--neg-soft); color: var(--neg); }
.tag.good { background: var(--pos-soft); color: var(--pos); }
.tag.ai { background: var(--act-soft); color: var(--act); }
.tag.neutral { background: var(--bg); color: var(--ink-2); }

/* ---------- panneau ---------- */
.sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 18, 16, .45); }
.sheet-panel {
  position: relative; width: 100%; max-height: 94dvh; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .28s cubic-bezier(.2,.8,.2,1);
  overflow-x: hidden; overscroll-behavior: contain;
}
.sheet-panel > * { max-width: 100%; }
@media (prefers-reduced-motion: reduce) { .sheet-panel { animation: none; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 12px; }
@media (min-width: 720px) {
  .sheet { align-items: center; justify-content: center; }
  .sheet-panel { max-width: 640px; border-radius: 20px; max-height: 90vh; }
  .list, .filters, .top, .tabs { max-width: 640px; margin-left: auto; margin-right: auto; }
  .chips { margin: 0; padding-left: 0; padding-right: 0; }
  .scanbar { max-width: 608px; margin-left: auto; margin-right: auto; }
}

.photos { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 0 16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.photos img { height: 190px; width: auto; max-width: 88%; border-radius: 12px; object-fit: cover; scroll-snap-align: start; background: var(--line); flex: 0 0 auto; }
.d-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 12px; }
.d-title h2 { margin: 0; font-size: 24px; line-height: 1.15; }
.d-title .price { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; flex: 0 0 auto; }
.d-title h2 { min-width: 0; overflow-wrap: anywhere; }
.d-title .price small { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 500; text-align: right; }
.d-sub { color: var(--ink-2); margin: 4px 0 12px; }

.hero {
  display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 12px 0;
}
.hero div { background: var(--card); padding: 10px 10px; min-width: 0; }
.hero .v { font-size: 17.5px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.hero .v.pos { color: var(--pos); } .hero .v.neg { color: var(--neg); }
.hero .k { font-size: 12px; color: var(--ink-3); line-height: 1.35; margin-top: 2px; }

.block { background: var(--card); border: 0; border-radius: 16px; padding: 14px 16px; margin: 12px 0; }
.block h3 { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 0 0 8px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-of-type { border-top: 0; }
.kv > span:first-child { min-width: 0; flex: 1 1 auto; }
.kv > span:last-child { font-weight: 600; flex: 0 0 auto; max-width: 48%; text-align: right; overflow-wrap: anywhere; }
.kv.total { border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 8px; }
.kv .pos { color: var(--pos); } .kv .neg { color: var(--neg); }
.kv .sub { color: var(--ink-3); font-weight: 400; font-size: 12.5px; display: block; }
.ai-box { background: color-mix(in srgb, var(--ink) 4%, var(--card)); }
.ai-box p { margin: 4px 0; }
.ai-box ul { margin: 4px 0; padding-left: 18px; }
.ai-box li.p::marker { color: var(--pos); } .ai-box li.n::marker { color: var(--neg); }
.desc { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); max-height: 160px; overflow: hidden; position: relative; }
.desc.open { max-height: none; }
.desc:not(.open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 50px; background: linear-gradient(transparent, var(--card)); }
.link-btn { background: none; border: 0; color: var(--act); padding: 6px 0; }

.actions { display: flex; gap: 8px; margin-top: 14px; }
.btn { flex: 1; border: 0; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 14px; font-weight: 600; text-align: center; text-decoration: none; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.fav-on { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.btn.ghost { background: none; color: var(--ink-2); border: 1px solid var(--line); flex: 0 0 auto; }

/* ---------- réglages ---------- */
.settings-panel .status { font-size: 13.5px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.status b { color: var(--ink); }
.status .row { display: flex; justify-content: space-between; padding: 3px 0; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--ink-2); }
.field input { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 11px; width: 100%; }
.field input:focus { outline: 2px solid var(--act); border-color: transparent; }
.fgroup { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 14px 0 6px; grid-column: 1 / -1; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 12px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 13.5px; z-index: 1200; }

/* ---------- ajouts : scores, scénarios, message vendeur ---------- */
.scores { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 11.5px; padding: 3px 9px; border-radius: 7px; background: var(--bg); color: var(--ink-2);
  display: inline-flex; gap: 4px; align-items: center; }
.pill b { color: var(--ink); font-weight: 600; }
.pill.quartier { background: var(--teal-soft); color: var(--teal); } .pill.quartier b { color: var(--teal); }
.pill.tension { background: var(--violet-soft); color: var(--violet); } .pill.tension b { color: var(--violet); }
.pill.nego { background: var(--warn-soft); color: var(--warn); } .pill.nego b { color: var(--warn); }
.pill.loyer { background: var(--pos-soft); color: var(--pos); } .pill.loyer b { color: var(--pos); }
.pill.qpv { background: var(--neg-soft); color: var(--neg); } .pill.qpv b { color: var(--neg); }
.sc-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.sc-table col.c1 { width: 43%; } .sc-table col.c2 { width: 19%; } .sc-table col.c3 { width: 19%; } .sc-table col.c4 { width: 19%; }
.sc-table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12px; padding: 4px 0; }
.sc-table td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.sc-table td:not(:first-child), .sc-table th:not(:first-child) { text-align: right; padding-left: 4px; }
.sc-table td:first-child { overflow-wrap: anywhere; }
.sc-table tr.best td { font-weight: 600; }
.sc-table .sub { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; white-space: normal; }
.meter { height: 6px; border-radius: 3px; background: var(--bar-charges); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--teal); }
.meter.tension i { background: var(--violet); }
.poi { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.poi span { min-width: 0; }
.poi span b { color: var(--ink); font-weight: 600; }
.msg { white-space: pre-wrap; font-size: 14px; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.row-btns { display: flex; gap: 8px; }
.row-btns .btn { padding: 9px 12px; font-size: 14px; }
.toggle { display: flex; align-items: center; gap: 10px; }
.toggle input { width: auto; }

/* ---------- scénarios sur la carte ---------- */
.tiles { grid-area: tiles; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.tile { border: 1px solid transparent; border-radius: 10px; padding: 6px 8px 7px; display: flex; flex-direction: column; gap: 1px; min-width: 0; background: var(--bg); }
.tile .t-k { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-v { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; }
.tile.pos .t-v { color: var(--pos); } .tile.neg .t-v { color: var(--neg); } .tile.na .t-v { color: var(--ink-3); font-weight: 500; }
.tile[data-k="vide"]   { --hue: var(--slate);  --hue-soft: var(--slate-soft); }
.tile[data-k="meuble"] { --hue: var(--teal);   --hue-soft: var(--teal-soft); }
.tile[data-k="coloc"]  { --hue: var(--violet); --hue-soft: var(--violet-soft); }
.tile[data-k="courte"] { --hue: var(--rose);   --hue-soft: var(--rose-soft); }
.tile .t-k { color: var(--hue); font-weight: 600; opacity: .8; }
.tile.best { border-color: var(--hue); background: var(--hue-soft); }
.tile.best .t-k { opacity: 1; }
.card .cf .alt { color: var(--ink-2); }


/* ---------- carte ---------- */
.mapwrap { position: relative; z-index: 0; margin: 8px 16px 0; }
/* Leaflet place ses calques en z-index 400/800 : on les enferme dans leur propre
   contexte d'empilement, sinon ils passent devant les panneaux et l'onboarding. */
.mapview { isolation: isolate; }
.mapview { height: calc(100dvh - 250px); min-height: 340px; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--card); }
.map-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px 0; font-size: 13px; color: var(--ink-2); }
.map-bar b { color: var(--ink); }
.leaflet-container { font: inherit; background: var(--card); }
.leaflet-popup-content-wrapper { background: var(--card); color: var(--ink); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.leaflet-popup-tip { background: var(--card); }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-3); }
.leaflet-control-zoom a { background: var(--card); color: var(--ink); border-color: var(--line); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--card) 85%, transparent); color: var(--ink-3); }
.leaflet-control-attribution a { color: var(--ink-2); }
.pop-net { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }
.pop-net small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 500; letter-spacing: 0; }
.pop-l { margin-top: 4px; font-weight: 600; }
.pop-s { color: var(--ink-2); font-size: 13px; }
.pop-w { margin-top: 4px; font-size: 12px; color: var(--neg); }
.pop-v { margin-top: 2px; font-size: 12px; color: var(--act); }
.pop .btn { width: 100%; padding: 8px; font-size: 14px; }

/* ---------- onboarding ---------- */
.onb { position: fixed; inset: 0; z-index: 1100; background: var(--bg); overflow-y: auto; }
.onb[hidden] { display: none; }
.onb-panel { max-width: 560px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-height: 100dvh; }
.onb-head h1 { font-family: var(--font-display); font-size: 33px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.12; margin: 0 0 8px; }
.onb-head p { color: var(--ink-2); margin: 0 0 16px; }
.onb-map { height: min(52dvh, 440px); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--card); }
.onb-sel { margin-top: 12px; font-size: 14px; color: var(--ink-2); min-height: 22px; }
.onb-sel b { color: var(--ink); }
.onb-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 20px; }
.onb-actions .btn { flex: 1; }
.onb-actions .btn.ghost { flex: 0 0 auto; padding-left: 20px; padding-right: 20px; }
.btn:disabled { opacity: .45; }
.onb-form { display: flex; flex-direction: column; gap: 6px; }
.onb-label { font-size: 12.5px; color: var(--ink-2); margin-top: 14px; }
.onb-cards { display: flex; flex-direction: column; gap: 8px; }
.onb-card { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; display: flex; flex-direction: column; gap: 2px; }
.onb-card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.onb-card .c-t { font-weight: 600; }
.onb-card .c-d { font-size: 13px; color: var(--ink-2); }
.onb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.onb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.suffixed { position: relative; }
.suffixed input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 30px 10px 11px; }
.suffixed input:focus { outline: 2px solid var(--act); border-color: transparent; }
.suffixed span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13px; }

/* l'attribut hidden doit l'emporter sur le display des vues */
.list[hidden], .mapwrap[hidden], .more[hidden], .count[hidden], .scanbar[hidden] { display: none; }
.leaflet-control-attribution { font-size: 10px; line-height: 1.3; }

/* ---------- choix des zones : rendre la selection evidente ---------- */
.onb-search { margin-bottom: 10px; }
.onb-search input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 11px;
  padding: 11px 13px; font-size: 16px; -webkit-appearance: none; }
.onb-search input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.onb-hint { min-height: 18px; margin: 6px 2px 0; font-size: 12.5px; color: var(--teal); }
.onb-map { cursor: pointer; }
.zone-chip { border: 1px solid var(--teal); background: var(--teal-soft); color: var(--teal);
  border-radius: 999px; padding: 7px 12px; font-size: 13.5px; font-weight: 500; display: inline-flex; gap: 7px; align-items: center; }
.zone-chip span { opacity: .65; font-size: 15px; line-height: 1; }
.leaflet-tooltip.dep-tip { background: var(--ink); color: var(--bg); border: 0; box-shadow: none;
  font-size: 12.5px; font-weight: 500; padding: 4px 9px; border-radius: 7px; }
.leaflet-tooltip.dep-tip::before { border-top-color: var(--ink); }
.onb-map-wrap { position: relative; }
.map-reset { position: absolute; right: 10px; bottom: 10px; z-index: 500; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); border-radius: 9px; padding: 7px 11px; font-size: 12.5px; font-weight: 500; }
/* le tableau des scenarios reprend les teintes des tuiles */
.sc-table tr[data-k="vide"]   { --hue: var(--slate); }
.sc-table tr[data-k="meuble"] { --hue: var(--teal); }
.sc-table tr[data-k="coloc"]  { --hue: var(--violet); }
.sc-table tr[data-k="courte"] { --hue: var(--rose); }
.sc-table .sc-name { color: var(--hue); font-weight: 600; }

/* ---------- web : même code, disposition adaptée (détection par media query, pas par User-Agent) ---------- */
@media (min-width: 900px) {
  body {
    display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "nav top" "nav filters" "nav main";
  }
  .top { grid-area: top; padding: 20px 28px 10px; }
  .filters { grid-area: filters; padding: 0 28px 14px; }
  .scroller { grid-area: main; padding: 0 12px; }

  /* la pilule devient une colonne de navigation */
  .tabbar {
    grid-area: nav; grid-row: 1 / -1; align-self: stretch; margin: 0;
    flex-direction: column; justify-content: flex-start; gap: 3px;
    padding: 20px 12px; border-radius: 0; border: 0; border-right: 1px solid var(--line);
    background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none;
  }
  .tabbar button {
    flex: 0 0 auto; width: 100%; height: 44px; border-radius: 12px;
    display: flex; align-items: center; gap: 12px; padding: 0 12px; font-size: 14.5px; font-weight: 500;
  }
  .tabbar button::after { content: attr(aria-label); }       /* le libellé revient sur grand écran */
  .tabbar button:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }

  /* la liste passe en grille : on exploite la largeur au lieu de l'étirer */
  .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
          gap: 14px; align-content: start; padding: 14px 16px 24px; max-width: 1360px; }
  .count, .more { max-width: 1360px; }
  .scroller.map-mode .mapwrap { margin: 14px 16px 18px; }
  .filters .search input { max-width: 520px; }
}

@media (min-width: 1400px) {
  .list { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
}
@media (min-width: 900px) {
  /* tout s'aligne sur la même marge gauche que les cartes */
  .top { justify-content: flex-start; gap: 14px; padding-left: 30px; }
  .filters { padding-left: 30px; }
  .filters .search, .filters .chips { margin-left: 0; }
  .list, .count, .more { margin-left: 0; margin-right: auto; }
}
@media (min-width: 900px) {
  /* neutralise le cadrage central hérité de la règle ≥720px */
  .top, .filters, .list, .count, .more { max-width: none; margin-left: 0; margin-right: 0; }
  .list { max-width: 1360px; }
}
