: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%; height: 100%; background-color: var(--bg); background-image: linear-gradient(168deg, var(--bg) 0%, var(--bg-2) 14%, var(--bg) 46%, var(--bg-3) 100%); background-attachment: fixed; }
body {
  margin: 0; color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5;
  background: transparent;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  height: 100%; overflow: hidden; display: flex; flex-direction: column;
}
.top, .filters, .tabbar { flex: 0 0 auto; }
.scroller { flex: 1 1 auto; min-height: 0; padding-bottom: calc(76px + max(6px, calc(env(safe-area-inset-bottom) - 16px))); 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; }
.scroller.map-mode .mapview { flex: 1 1 auto; height: auto; min-height: 220px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--act); }
[hidden] { display: none !important; }
h2 { font-family: var(--font-display); font-size: 24px; font-weight: 600; margin: 6px 0 10px; letter-spacing: -0.01em; line-height: 1.18; }
h3 { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 0 0 10px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- en-tête ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 16px 8px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--teal); text-decoration: none; margin-right: auto; }
.brand svg { width: 24px; height: 24px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.012em; color: var(--ink); line-height: 1; }
.top-note { color: var(--ink-3); font-size: 12.5px; }
.quota { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.quota b { color: var(--teal); font-weight: 600; }
.quota { flex: none; }
.avatar { flex: none; }
.brand { min-width: 0; }
@media (max-width: 520px) { .top { gap: 8px; } .brand-name { font-size: 20px; } .quota .ql { display: none; } }
.quota.low b { color: var(--neg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--teal-soft); color: var(--teal);
  font-weight: 600; font-size: 14px; padding: 0; overflow: hidden; display: grid; place-items: center; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- barre d'onglets ---------- */
.tabbar {
  position: fixed; z-index: 50; left: 14px; right: 14px; bottom: max(6px, calc(env(safe-area-inset-bottom) - 16px)); margin: 0;
  display: flex; justify-content: space-between; padding: 5px 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--card) 58%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(200%); backdrop-filter: blur(22px) saturate(200%);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: 0 6px 26px rgba(17, 24, 35, .09);
}
.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, background .15s; }
.tabbar button svg { width: 22px; height: 22px; stroke-width: 1.6; display: block; }
.tabbar button.on { color: var(--teal); background: color-mix(in srgb, var(--teal) 11%, transparent); }
.tabbar button.on svg { stroke-width: 2; }

/* ---------- filtres ---------- */
.filters { padding: 4px 16px 6px; }
.filter-row { display: flex; gap: 10px; align-items: center; }
.search { flex: 1 1 auto; min-width: 0; }
.search input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 13px; font-size: 15px; -webkit-appearance: none; }
.search input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.seg { display: none; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 3px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 7px 12px; font-size: 13.5px; color: var(--ink-2); }
.seg button.on { background: var(--teal); color: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 6px; scrollbar-width: none; margin: 0 -16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 13px; font-size: 13.5px; color: var(--ink-2); }
.chip.on { background: var(--teal); color: #fff; border-color: var(--teal); }
.chip.lock::after { content: ""; display: inline-block; width: 9px; height: 10px; margin-left: 6px; vertical-align: -1px; opacity: .55;
  background: currentColor; -webkit-mask: var(--lock) center/contain no-repeat; mask: var(--lock) center/contain no-repeat; }
:root { --lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10V8a5 5 0 0 1 10 0v2h1.5A1.5 1.5 0 0 1 20 11.500v9a1.500 1.500 0 0 1-1.500 1.500h-13A1.500 1.500 0 0 1 4 20.500v-9A1.500 1.500 0 0 1 5.500 10H7Zm2 0h6V8a3 3 0 0 0-6 0v2Z'/%3E%3C/svg%3E"); }
.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(--teal-soft); color: var(--teal); font-size: 13px; }

/* ---------- liste : cartes à photo ---------- */
.list { padding: 8px 14px 0; display: flex; flex-direction: column; gap: 16px; }
.count { text-align: center; color: var(--ink-3); font-size: 13px; margin: 16px 0; }
.more { text-align: center; margin-top: 14px; }
.more button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 9px 20px; }
.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 { --hue: var(--slate); --hue-soft: var(--slate-soft); position: relative; display: flex; flex-direction: column; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; cursor: pointer; padding: 0;
  transition: transform .15s ease, box-shadow .15s ease; }
.card[data-best="meuble"] { --hue: var(--teal); --hue-soft: var(--teal-soft); }
.card[data-best="coloc"] { --hue: var(--violet); --hue-soft: var(--violet-soft); }
.card[data-best="courte"] { --hue: var(--rose); --hue-soft: var(--rose-soft); }
@media (hover: hover) { .card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(17, 24, 35, .10); } }
.ph { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, var(--hue-soft), color-mix(in srgb, var(--hue-soft) 40%, var(--card))); overflow: hidden; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.none::after { content: ""; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; opacity: .35; background: var(--hue);
  -webkit-mask: var(--house) center/contain no-repeat; mask: var(--house) center/contain no-repeat; }
:root { --house: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linejoin='round'%3E%3Cpath d='M3 11 12 4l9 7v9H3z'/%3E%3Cpath d='M10 20v-6h4v6'/%3E%3C/svg%3E"); }
.ph::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 56px; z-index: 1; pointer-events: none;
  background: linear-gradient(rgba(10, 14, 22, .38), transparent); }
.ph .badges { position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; gap: 6px; flex-wrap: wrap; }
.badge { background: rgba(255, 255, 255, .92); color: #111823; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; letter-spacing: .01em; }
.badge.new { background: var(--teal); color: #fff; }
.badge.src { background: rgba(17, 24, 35, .62); color: #fff; font-weight: 500; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ph .fav { position: absolute; right: 10px; top: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .92); display: grid; place-items: center; color: #5B6679; padding: 0; }
.ph .fav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ph .fav.on { color: #C23A5A; }
.ph .fav.on svg { fill: currentColor; }
.ph .count-ph { position: absolute; right: 10px; bottom: 10px; z-index: 2; background: rgba(17, 24, 35, .62); color: #fff; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; }
.cbody { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.crow { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.cprice { font-family: var(--font-display); font-size: 25px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.05; }
.cprice small { display: block; font-family: var(--font); font-size: 12.5px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; margin-top: 3px; }
.cmain { min-width: 0; }
.cspec { font-size: 14px; color: var(--ink); font-weight: 500; }
.cplace { font-size: 13.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnet { text-align: right; flex: 0 0 auto; }
.cnet .num { display: block; font-family: var(--font-display); font-size: 31px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; color: var(--ink); }
.cnet .num.pos { color: var(--pos); } .cnet .num.neg { color: var(--neg); }
.cnet .lbl { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tile { --hue: var(--slate); --hue-soft: var(--slate-soft); padding: 6px 4px 7px; text-align: center; display: flex; flex-direction: column; gap: 1px; font-size: 12px; border-left: 1px solid var(--line); }
.tile:first-child { border-left: 0; }
.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; font-size: 11px; }
.tile .t-v { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.tile.pos .t-v { color: var(--ink); } .tile.neg .t-v { color: var(--ink-3); } .tile.na .t-v { color: var(--ink-3); font-weight: 400; }
.tile.best { background: var(--hue-soft); }
.piste-note { margin-top: 6px; font-size: 11.5px; color: var(--ink-3); }
.block.piste .sc-table { opacity: .8; }
.flags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--ink-2); background: transparent; }
.tag.bad { border-color: color-mix(in srgb, var(--neg) 40%, transparent); color: var(--neg); }
.tag.good { border-color: color-mix(in srgb, var(--pos) 40%, transparent); color: var(--pos); }
.tag.ai { border-color: color-mix(in srgb, var(--act) 40%, transparent); color: var(--act); }
.tag.neutral { color: var(--ink-3); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--ink-2); }
.pill b { font-weight: 600; color: var(--ink); }
.pill.quartier { border-color: color-mix(in srgb, var(--teal) 45%, transparent); } .pill.quartier b { color: var(--teal); }
.pill.tension { border-color: color-mix(in srgb, var(--violet) 45%, transparent); } .pill.tension b { color: var(--violet); }
.pill.qpv { border-color: color-mix(in srgb, var(--neg) 45%, transparent); } .pill.qpv b { color: var(--neg); }
.pill.nego, .pill.loyer { border-color: color-mix(in srgb, var(--warn) 45%, transparent); } .pill.nego b, .pill.loyer b { color: var(--warn); }


/* ---------- barre d'outils : tri, période, affichage ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 2px 0 4px; }
.period { order: -1; flex: 1 0 100%; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; width: max-content; max-width: 100%; }
.period::-webkit-scrollbar, .sorts::-webkit-scrollbar { display: none; }
.period button { flex: 1 0 auto; border: 0; background: none; border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.period button.on { background: var(--ink); color: var(--bg); font-weight: 600; }
.sorts { flex: 1 1 0; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: -10px; padding-left: 10px;
  -webkit-mask: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 14px), transparent); mask: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 14px), transparent); }
.sp { flex: 0 0 auto; border: 0; background: none; padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.sp:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.sp.on { background: var(--teal-soft); color: var(--teal); font-weight: 600; }
.sp.lock::after { content: ""; display: inline-block; width: 9px; height: 10px; margin-left: 5px; vertical-align: -1px; opacity: .5;
  background: currentColor; -webkit-mask: var(--lock) center/contain no-repeat; mask: var(--lock) center/contain no-repeat; }
.tools { flex: 0 0 auto; display: flex; gap: 6px; align-items: center; }
.tool { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); display: grid; place-items: center; padding: 0; }
.tool svg { width: 18px; height: 18px; transition: transform .2s; }
.tool.flip { color: var(--teal); border-color: var(--teal); }
.viewseg { display: flex; border: 1px solid var(--line); border-radius: 11px; background: var(--card); padding: 2px; }
.viewseg button { width: 34px; height: 32px; border: 0; background: none; border-radius: 9px; color: var(--ink-3); display: grid; place-items: center; padding: 0; }
.viewseg button.on { background: var(--teal); color: #fff; }
.viewseg svg { width: 18px; height: 18px; }
.only-wide { display: none !important; }

/* ---------- synthèse de la sélection ---------- */
.summary { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(138px, 1fr); gap: 8px; padding: 8px 14px 0; overflow-x: auto; scrollbar-width: none; }
.summary::-webkit-scrollbar { display: none; }
.sum { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sum b { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.15; white-space: nowrap; }
.sum span { font-size: 12px; color: var(--ink-3); }
.sum.up { border-style: dashed; border-color: color-mix(in srgb, var(--teal) 50%, transparent); background: color-mix(in srgb, var(--teal-soft) 50%, transparent); cursor: pointer; }
.sum.up b { font-family: var(--font); font-size: 14px; color: var(--teal); }

/* ---------- cartes enrichies ---------- */
.cspec { display: flex; justify-content: space-between; gap: 8px; }
.cspec > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ago { flex: 0 0 auto; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.ph .badge.src { position: absolute; left: 10px; bottom: 10px; z-index: 2; }
.ring { position: absolute; right: 10px; bottom: 10px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--hue) calc(var(--w) * 1%), rgba(255, 255, 255, .38) 0); color: #111823; font-size: 12px; box-shadow: 0 1px 6px rgba(10, 14, 22, .25); }
.ring::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: rgba(255, 255, 255, .95); }
.ring b { position: relative; font-weight: 700; }
.metric { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--act-soft); color: var(--act); }
.dayhead { grid-column: 1 / -1; margin: 6px 2px -4px; font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: capitalize; display: flex; align-items: center; gap: 12px; }
.dayhead::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.dayhead:first-child { margin-top: 0; }

/* affichage en liste compacte */
.list[data-view="list"] { gap: 10px; }
.list[data-view="list"] .card { flex-direction: row; border-radius: 16px; }
.list[data-view="list"] .ph { flex: 0 0 118px; aspect-ratio: auto; min-height: 112px; }
.list[data-view="list"] .ph::before, .list[data-view="list"] .ring, .list[data-view="list"] .badge.src, .list[data-view="list"] .ph .badge:not(.new) { display: none; }
.list[data-view="list"] .ph .fav { width: 28px; height: 28px; right: 6px; top: 6px; }
.list[data-view="list"] .ph .fav svg { width: 15px; height: 15px; }
.list[data-view="list"] .ph .badges { left: 6px; top: 6px; }
.list[data-view="list"] .cbody { flex: 1; min-width: 0; padding: 10px 12px; gap: 6px; justify-content: center; }
.list[data-view="list"] .cprice { font-size: 20px; }
.list[data-view="list"] .cnet .num { font-size: 22px; }
.list[data-view="list"] .cnet .lbl { max-width: 110px; }
.list[data-view="list"] .cprice small { white-space: nowrap; font-size: 11.5px; }
.list[data-view="list"] .cnet .lbl { display: none; }
.sum { padding: 8px 12px; } .sum b { font-size: 19px; }
.list[data-view="list"] .tiles, .list[data-view="list"] .piste-note, .list[data-view="list"] .vs { display: none; }
.list[data-view="list"] .flags { flex-wrap: nowrap; overflow: hidden; }
.list[data-view="list"] .flags > * { flex: 0 0 auto; }
.list[data-view="list"] .lockbox { padding: 7px 10px; }
.list[data-view="list"] .lockbox span:first-child { font-size: 12px; }
.list[data-view="list"] .lockbox b { font-size: 12.5px; }

/* affichage en tableau (grand écran) */
.tablewrap { grid-column: 1 / -1; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; padding: 11px 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; border-bottom: 1px solid var(--line); user-select: none; }
.tbl th:first-child { text-align: left; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th.on { color: var(--teal); }
.tbl th i { display: inline-block; margin-left: 5px; vertical-align: middle; border: 4px solid transparent; }
.tbl th i.desc { border-top-color: currentColor; border-bottom-width: 0; }
.tbl th i.asc { border-bottom-color: currentColor; border-top-width: 0; }
.tbl td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.sm { font-size: 12.5px; color: var(--ink-3); }
.tbl td.pos { color: var(--pos); } .tbl td.neg { color: var(--neg); }
.tbl tr.trow { cursor: pointer; }
.tbl tr.trow:hover td { background: color-mix(in srgb, var(--teal) 6%, var(--card)); }
.tbl .t-bien { text-align: left; }
.tb { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.tb b { display: block; font-weight: 600; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.tb small { display: block; font-size: 12px; color: var(--ink-3); }
.t-ph { position: relative; flex: 0 0 auto; width: 58px; height: 44px; border-radius: 9px; overflow: hidden; background: var(--slate-soft); }
.t-ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dayrow td { background: var(--bg); color: var(--ink-2); font-weight: 600; font-size: 13px; text-align: left; text-transform: capitalize; padding: 8px 12px; }
.tbl td.lk { text-align: center; }
.tbl td.lk .go { background: var(--teal); color: #fff; border-radius: 999px; padding: 5px 13px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.t-fav .fav { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--ink-3); padding: 0; }
.t-fav .fav svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.t-fav .fav.on { color: #C23A5A; border-color: transparent; }
.t-fav .fav.on svg { fill: currentColor; }

/* carte verrouillée : l'aperçu donne envie, l'analyse se débloque */
.card.locked .cnet { display: none; }
.lockbox { border: 1px dashed color-mix(in srgb, var(--teal) 50%, transparent); background: color-mix(in srgb, var(--teal-soft) 55%, transparent); border-radius: 12px;
  padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-2); }
.lockbox b { color: var(--ink); display: block; font-size: 13.5px; }
.lockbox .go { flex: 0 0 auto; background: var(--teal); color: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; }
.card.locked .ph img { filter: saturate(.85); }

/* primo : mensualité contre loyer */
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.vs > div { padding: 7px 10px; font-size: 12px; color: var(--ink-3); }
.vs > div + div { border-left: 1px solid var(--line); }
.vs b { display: block; font-size: 15px; color: var(--ink); font-weight: 600; }
.vs .pos b { color: var(--pos); }

/* ---------- fiches et panneaux ---------- */
.sheet { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 22, .48); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .2s ease; }
.sheet-panel { position: relative; width: 100%; max-width: 680px; max-height: 94dvh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0;
  padding: 0 0 calc(24px + env(safe-area-inset-bottom)); animation: rise .26s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; }
.sheet-panel > :not(.photos):not(.gal) { margin-left: 18px; margin-right: 18px; }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 12px !important; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.x { position: absolute; right: 12px; top: 12px; z-index: 5; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: #111823; display: grid; place-items: center; padding: 0; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.x svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; }
.gal { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 0; background: var(--slate-soft); border-radius: 24px 24px 0 0; position: relative; margin: 0 !important; }
.gal::-webkit-scrollbar { display: none; }
.gal img { flex: 0 0 100%; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; scroll-snap-align: center; display: block; }
.gal-wrap { position: relative; margin: 0 !important; }
.gal-n { position: absolute; left: 14px; bottom: 12px; background: rgba(17, 24, 35, .62); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.d-title { margin-top: 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.d-title h2 { margin: 0; font-size: 21px; flex: 1; min-width: 0; }
.d-title .price { font-family: var(--font-display); font-size: 26px; font-weight: 600; text-align: right; line-height: 1.05; }
.d-title .price small { display: block; font-family: var(--font); font-size: 12px; font-weight: 400; color: var(--ink-3); margin-top: 3px; }
.d-sub { color: var(--ink-2); font-size: 13.5px; margin: 8px 18px 14px; }
.hero { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 18px; background: var(--card); overflow: hidden; margin-bottom: 14px; }
.hero > div { padding: 14px 12px; text-align: center; }
.hero > div + div { border-left: 1px solid var(--line); }
.hero .v { font-family: var(--font-display); font-size: 27px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; }
.hero .v.pos { color: var(--pos); } .hero .v.neg { color: var(--neg); }
.hero .k { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.3; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.block p { margin: 0 0 8px; }
.block ul { margin: 6px 0 0; padding-left: 18px; }
.ai-box { border-color: color-mix(in srgb, var(--act) 28%, var(--line)); background: color-mix(in srgb, var(--act-soft) 38%, var(--card)); }
.ai-box li.p::marker { color: var(--pos); } .ai-box li.n::marker { color: var(--neg); }
.hint { color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv:first-of-type { border-top: 0; }
.kv > span:first-child { color: var(--ink-2); }
.kv .sub { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.kv > span:last-child { font-weight: 600; text-align: right; white-space: nowrap; }
.kv .pos { color: var(--pos); } .kv .neg { color: var(--neg); }
.kv.total { border-top: 1px solid var(--ink-3); }
.bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); }
.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; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.meter { height: 4px; background: var(--line); border-radius: 2px; margin: 2px 0 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--teal); border-radius: 2px; } .meter.tension i { background: var(--violet); }
.poi { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.poi b { color: var(--ink); }
.desc { max-height: 6.5em; overflow: hidden; white-space: pre-wrap; color: var(--ink-2); font-size: 14px; -webkit-mask: linear-gradient(#000 60%, transparent); mask: linear-gradient(#000 60%, transparent); }
.desc.open { max-height: none; -webkit-mask: none; mask: none; }
.link-btn { background: none; border: 0; color: var(--teal); font-weight: 600; padding: 4px 0; font-size: 14px; }
.msg { white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 12px; font-size: 14px; margin-bottom: 10px; }
.row-btns { display: flex; gap: 8px; }
.sc-table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.sc-table col.c1 { width: 44%; } .sc-table th { text-align: right; font-size: 11.5px; color: var(--ink-3); font-weight: 500; padding: 0 0 6px; } .sc-table th:first-child { text-align: left; }
.sc-table td { padding: 8px 0; border-top: 1px solid var(--line); text-align: right; font-weight: 600; } .sc-table td:first-child { text-align: left; font-weight: 500; }
.sc-table .sub { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.sc-table tr.best td { background: color-mix(in srgb, var(--hue) 8%, transparent); }
.sc-table td.pos { color: var(--pos); } .sc-table td.neg { color: var(--neg); }
.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; }
.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }

/* ---------- boutons et champs ---------- */
.btn { border: 0; background: var(--ink); color: var(--bg); border-radius: 13px; padding: 12px 18px; font-weight: 600; font-size: 15px; text-align: center; text-decoration: none; display: inline-block; }
.btn.primary { background: var(--teal); color: #fff; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--neg); border: 1px solid color-mix(in srgb, var(--neg) 40%, transparent); }
.btn.fav-on { color: #C23A5A; border-color: color-mix(in srgb, #C23A5A 40%, transparent); }
.btn:disabled { opacity: .45; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fgroup { grid-column: 1 / -1; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-top: 10px; }
.field.wide { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.field input, .field select, textarea { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 11px; padding: 10px 12px; font-size: 16px; -webkit-appearance: none; }
.field input:focus, textarea:focus { outline: 2px solid var(--teal); border-color: transparent; }
.field.toggle { display: flex; align-items: center; gap: 10px; } .field.toggle input { width: auto; } .field.toggle label { margin: 0; }
.suffixed { position: relative; }
.suffixed input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 30px 10px 11px; font-size: 16px; }
.suffixed input:focus { outline: 2px solid var(--teal); border-color: transparent; }
.suffixed span { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13px; }

/* ---------- compte ---------- */
.acct { display: flex; align-items: center; gap: 14px; margin-top: 18px; margin-bottom: 14px; }
.acct .avatar { width: 54px; height: 54px; font-size: 20px; }
.acct h2 { margin: 0; font-size: 20px; }
.acct small { color: var(--ink-3); }
.planbox { border: 1px solid var(--line); border-radius: 18px; background: var(--card); padding: 16px; margin-bottom: 12px; }
.planbox .pn { display: flex; justify-content: space-between; align-items: baseline; }
.planbox .pn b { font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.planbox .pn span { color: var(--ink-3); font-size: 13px; }
.use { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.use .meter { height: 5px; margin: 5px 0 0; }
.menu { border: 1px solid var(--line); border-radius: 18px; background: var(--card); overflow: hidden; margin-bottom: 12px; }
.menu a, .menu button { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; text-align: left; border: 0; border-top: 1px solid var(--line); background: none;
  padding: 14px 16px; font-size: 15px; color: var(--ink); text-decoration: none; }
.menu > :first-child { border-top: 0; }
.menu .arrow::after { content: "›"; color: var(--ink-3); font-size: 20px; line-height: 1; }
.menu .dng { color: var(--neg); }
.legal { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; margin: 6px 18px 0; }
.legal a { color: var(--ink-3); }
.status { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 12px; }
.status .row { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.status .row:first-child { border-top: 0; }

/* ---------- blocage payant ---------- */
.paywall-panel { text-align: center; padding-top: 6px; }
.paywall-panel .pw-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; margin: 12px auto 12px; }
.paywall-panel .pw-ico svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.paywall-panel p { color: var(--ink-2); margin: 0 auto 16px; max-width: 30em; }
.pw-plans { display: grid; gap: 8px; text-align: left; margin-bottom: 14px; }
.pw-plan { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: var(--ink); }
.pw-plan b { display: block; } .pw-plan small { color: var(--ink-3); font-size: 12.5px; }
.pw-plan .pp { font-family: var(--font-display); font-size: 21px; font-weight: 600; white-space: nowrap; }
.pw-plan.rec { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }

/* ---------- assistant ---------- */
.chat-panel { display: flex; flex-direction: column; height: min(92dvh, 760px); padding-bottom: 0; overflow: hidden; }
.chat-panel > * { flex: 0 0 auto; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.chat-head h2 { margin: 0; font-size: 20px; }
.chat-log { flex: 1 1 auto !important; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 8px 0 12px; }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: 14.5px; white-space: pre-wrap; line-height: 1.5; }
.bubble.u { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 6px; }
.bubble.a { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.wait { color: var(--ink-3); }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 8px 0 calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.chat-form textarea { resize: none; max-height: 120px; min-height: 44px; }
.chat-form .btn { padding: 12px 16px; }

/* ---------- guide d'installation ---------- */
.install-panel h2 { margin-top: 16px; }
.steps { list-style: none; padding: 0; margin: 14px 18px; display: grid; gap: 12px; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; font-size: 14.5px; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-weight: 600; display: grid; place-items: center; font-size: 14px; }
.steps svg { width: 20px; height: 20px; vertical-align: -4px; stroke: var(--act); fill: none; stroke-width: 1.8; }
.steps kbd { font: inherit; font-weight: 600; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 1px 7px; }
.install-note { font-size: 13px; color: var(--ink-3); margin: 0 18px 12px; }

/* ---------- consentement ---------- */
.consent { position: fixed; z-index: 1200; left: 14px; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .18); font-size: 13.5px; color: var(--ink-2); }
.consent p { margin: 0 0 10px; }
.consent .row-btns .btn { padding: 9px 14px; font-size: 14px; flex: 1; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 10px 18px; font-size: 14px; z-index: 1300; max-width: 90vw; text-align: center; animation: fade .2s; }

/* ---------- carte ---------- */
.mapwrap { position: relative; z-index: 0; margin: 8px 16px 0; }
.mapview { isolation: isolate; height: calc(100dvh - 250px); min-height: 340px; border-radius: 18px; 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: 14px; 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); font-size: 10px; line-height: 1.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; margin-top: 8px; }

/* ---------- onboarding ---------- */
.onb { position: fixed; inset: 0; z-index: 1100; background: var(--bg); background-image: linear-gradient(168deg, var(--bg-2), var(--bg) 46%, var(--bg-3)); overflow-y: auto; }
.onb-panel { max-width: 580px; margin: 0 auto; padding: calc(22px + env(safe-area-inset-top)) 18px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-height: 100dvh; }
.onb-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.onb-steps i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); } .onb-steps i.on { background: var(--teal); }
.onb-head h1 { font-family: var(--font-display); font-size: 33px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; margin: 0 0 8px; }
.onb-head p { color: var(--ink-2); margin: 0 0 16px; }
.onb-map { height: min(58dvh, 560px, calc(100vw - 20px)); border-radius: 18px; border: 1px solid var(--line); overflow: hidden; background: var(--card); cursor: pointer; }
.onb-map-wrap { position: relative; }
.onb-map-wrap .map-reset { top: 10px; bottom: auto; }
.onb-sel { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; min-height: 36px; }
.onb-cap { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.onb-cap b { color: var(--teal); }
.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; }
.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: 14px; padding: 12px 15px; display: flex; flex-direction: column; gap: 2px; }
.onb-card.on { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.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; }
.onb-search { margin-bottom: 10px; }
.onb-search input { width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px; 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); }
.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); }
.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; }

/* ---------- grand écran : navigation latérale, grille de cartes, fiche en tiroir ---------- */
@media (min-width: 900px) {
  body { display: grid; grid-template-columns: 228px 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 30px 10px; }
  .brand { display: none; }
  .top-note { margin-right: auto; }
  .filters { grid-area: filters; padding: 0 30px 12px; }
  .seg { display: flex; }
  .search input { max-width: 520px; }
  .chips { padding-left: 30px; margin: 0 -30px; }
  .scroller { grid-area: main; padding: 0 14px; }
  .tabbar { position: static; 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::before { content: "ScanRendement"; font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -0.012em; padding: 4px 12px 22px; color: var(--ink); }
  .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); }
  .tabbar button:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
  .tabbar button.on:hover { background: color-mix(in srgb, var(--teal) 11%, transparent); }
  .toolbar { flex-wrap: nowrap; padding: 2px 0 6px; }
  .period { order: 0; flex: 0 0 auto; }
  .only-wide { display: grid !important; }
  .summary { padding: 12px 16px 0; max-width: 1500px; grid-auto-columns: minmax(150px, 1fr); }
  .list[data-view="list"] { grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 12px; }
  .list[data-view="list"] .ph { flex-basis: 150px; }
  .list[data-view="list"] .tiles { display: grid; }
  .list[data-view="list"] .cnet .lbl { display: block; }
  .sum { padding: 10px 14px; } .sum b { font-size: 22px; }
  .list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; align-content: start; padding: 10px 16px 28px; max-width: 1500px; }
  .count, .more { max-width: 1500px; }
  .scroller.map-mode .mapwrap { margin: 12px 16px 18px; }
  .sheet { align-items: stretch; justify-content: flex-end; }
  .sheet-panel { max-width: 640px; max-height: none; height: 100%; border-radius: 24px 0 0 24px; animation: slide .26s cubic-bezier(.2, .8, .2, 1); }
  .gal { border-radius: 24px 0 0 0; }
  .paywall-panel, .install-panel { align-self: center; height: auto; max-height: 90dvh; border-radius: 24px; max-width: 520px; margin: auto; animation: rise .26s; }
  .sheet:has(.paywall-panel), .sheet:has(.install-panel) { justify-content: center; align-items: center; }
  .chat-panel { height: 100%; }
  .consent { left: 250px; right: auto; bottom: 24px; margin: 0; }
  .toast { bottom: 28px; }
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 1500px) { .list { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); } }
@media (max-width: 380px) { .cnet .num { font-size: 27px; } .cprice { font-size: 22px; } .hero .v { font-size: 23px; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* texture de fond : grain + trame de points, fixe, sans animation */
body::before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;
  background-image:var(--tex-grain),radial-gradient(circle,var(--tex-dot) 1px,transparent 1.5px);
  background-size:240px 240px,28px 28px;opacity:var(--tex-op,.5)}
:root{--tex-dot:rgba(17,24,35,.11);--tex-op:.33;
  --tex-grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .08 0 0 0 0 .12 0 0 0 0 .2 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}
@media(prefers-color-scheme:dark){:root:not([data-theme="light"]){--tex-dot:rgba(237,241,248,.14);--tex-op:.32;
  --tex-grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .95 0 0 0 0 1 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}}
:root[data-theme="dark"]{--tex-dot:rgba(237,241,248,.14);--tex-op:.32;
  --tex-grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .95 0 0 0 0 1 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E")}

/* ---------- vues / déjà vu ---------- */
.vu { display: none; font-weight: 600; color: var(--act); }
.seen .vu { display: inline; }
.card.seen .ph img { opacity: .6; filter: saturate(.7); }
.card.seen .cprice { color: var(--ink-2); }
.trow.seen td { opacity: .62; }
.trow.seen td:last-child, .trow.seen .t-fav { opacity: 1; }

/* ---------- assistant : texte contenu dans le panneau ---------- */
.chat-hint { margin-top: 0; margin-bottom: 6px; overflow-wrap: anywhere; }
.chat-panel { min-width: 0; }
.bubble { overflow-wrap: anywhere; min-width: 0; }
.sugg .chip { flex: 0 1 auto; max-width: 100%; text-align: left; white-space: normal; line-height: 1.3; }
.chat-form textarea { flex: 1 1 auto; min-width: 0; width: 100%; }
.chat-form .btn { flex: 0 0 auto; }

/* ---------- filtres, tri : tout tient dans l'écran du téléphone ---------- */
.fbtn, .sortsel { display: none; }
.fbtn { position: relative; flex: 0 0 auto; }
.fbtn i { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--teal); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; display: grid; place-items: center; }
.fbtn[aria-expanded="true"] { border-color: var(--teal); color: var(--teal); }
@media (max-width: 899px) {
  .fbtn { display: grid; width: 44px; height: 44px; }
  .filter-row { flex-wrap: wrap; }
  .seg { display: flex; order: 3; flex: 1 1 100%; }
  .seg[hidden] { display: none; }
  .seg button { flex: 1 1 0; padding: 7px 4px; font-size: 13px; }
  .chips { display: none; flex-wrap: wrap; overflow: visible; margin: 0; padding: 10px 0 2px; }
  .filters.open .chips { display: flex; }
  .chips .chip.select { flex: 1 1 100%; }
  .chips .chip.select#typo, .chips .chip.select#surf { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .sorts { display: none; }
  .sortsel { display: block; flex: 1 1 0; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 0 32px 0 12px; font-size: 14px; font-weight: 500; color: var(--ink); -webkit-appearance: none; appearance: none; text-overflow: ellipsis;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238390A5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }
  .toolbar { flex-wrap: wrap; gap: 8px; padding: 8px 0 2px; flex-wrap: wrap; }
  .period { width: 100%; flex: 1 0 100%; overflow: visible; }
  .period button { flex: 1 1 0; padding: 6px 4px; }
  .tool { width: 40px; height: 40px; }
  .viewseg button { height: 34px; }
  .summary { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; padding: 6px 16px 0; gap: 6px; }
  .summary .sum.x-m { display: none; }
  .sum { padding: 8px 10px; border-radius: 12px; }
  .sum b { font-size: 18px; }
  .sum span { font-size: 11.5px; line-height: 1.25; }
  .sum.up b { font-size: 12.5px; line-height: 1.25; white-space: normal; }
  .summary:has(.sum.up) { grid-template-columns: 1fr 2fr; }
}

/* bande du haut : même aplat que la barre d'état iOS (theme-color), sans texture */
.top { position: relative; z-index: 3; background: var(--bg); }
.top { padding-bottom: 10px; }
.filters { padding-top: 6px; }

/* ---------- analyser ma propre annonce ---------- */
.adbtn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.adbtn svg { width: 17px; height: 17px; color: var(--teal); flex: none; }
@media (max-width: 520px) { .adbtn span { display: none; } .adbtn { width: 34px; height: 34px; padding: 0; justify-content: center; } }
.ad-h { font-size: 22px; margin: 18px 0 4px; }
.adform { margin-top: 14px; }
.adform textarea { min-height: 120px; resize: vertical; font-family: inherit; line-height: 1.4; margin-bottom: 4px; }
.adform .fgrid { margin-top: 8px; }
.adform .field { min-width: 0; }
.form-err { color: var(--neg); font-size: 13.5px; margin: 10px 0 0; }
.hyp { margin: 0 0 8px; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.hyp li { margin: 3px 0; }
.ad-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--line); padding: 11px 2px; color: var(--ink); font-size: 14.5px; }
.ad-row:first-of-type { border-top: 0; }
.ad-row .t { min-width: 0; } .ad-row .sub { display: block; font-size: 12.5px; color: var(--ink-3); }
.ad-row .pos, .ad-row .neg { font-weight: 600; white-space: nowrap; }
.ad-row .pos { color: var(--pos); } .ad-row .neg { color: var(--neg); }

/* ---------- visite guidée ---------- */
.tour { position: fixed; inset: 0; z-index: 1300; }
.tour-hole { position: fixed; border-radius: 16px; box-shadow: 0 0 0 100vmax rgba(14, 18, 25, .66); outline: 2px solid var(--teal); transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-card { position: fixed; width: min(360px, calc(100vw - 32px)); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .35); }
.tour-card h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: var(--ink); margin: 8px 0 6px; }
.tour-card p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.45; color: var(--ink-2); }
.tour-dots { display: flex; gap: 5px; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--teal); width: 16px; border-radius: 3px; }
.tour-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.tour-actions .btn { flex: 0 0 auto; padding: 9px 16px; }
.tour-skip { margin-right: auto; background: none; border: 0; color: var(--ink-3); font-size: 14px; padding: 8px 2px; }

.map-pro { all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink-2); font-size: 13px; line-height: 1.35; cursor: pointer; }
.map-pro[hidden] { display: none; }
.map-pro b { color: var(--ink); }
.map-pro u { flex: none; color: var(--ink); font-weight: 600; }

/* assistant : lisibilité */
.chat-ctx { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 14px; }
.chat-ctx .t { display: grid; gap: 1px; font-weight: 600; color: var(--ink); min-width: 0; }
.chat-ctx small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.chat-ctx .cf { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; flex: none; }
.chat-ctx .cf.pos { color: var(--pos); } .chat-ctx .cf.neg { color: var(--neg); }
.chat-hint { font-size: 12.5px; }
.chat-log { gap: 12px; }
.bubble.a { max-width: 100%; white-space: normal; padding: 12px 14px; border-radius: 16px; border-bottom-left-radius: 6px; }
.bubble.md p { margin: 0 0 8px; }
.bubble.md p:first-child { font-weight: 600; color: var(--ink); }
.bubble.md p:last-child, .bubble.md ul:last-child { margin-bottom: 0; }
.bubble.md ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 7px; }
.bubble.md li { position: relative; padding-left: 14px; color: var(--ink-2); }
.bubble.md li::before { content: ""; position: absolute; left: 0; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.bubble.md li b, .bubble.md p b { color: var(--ink); font-weight: 600; }
.bubble.wait { display: inline-flex; gap: 5px; padding: 14px 16px; }
.bubble.wait i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: typing 1s ease-in-out infinite; }
.bubble.wait i:nth-child(2) { animation-delay: .15s; } .bubble.wait i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bubble.wait i { animation: none; } }

.resume { position: relative; margin: 8px 16px 0; padding: 10px 34px 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--teal); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink); }
.resume > span { flex: 1 1 200px; }
.resume .btn { padding: 8px 14px; font-size: 13.5px; }
.resume .x { position: absolute; top: 2px; right: 4px; border: 0; background: none; color: var(--ink-3); font-size: 20px; line-height: 1; padding: 4px 8px; cursor: pointer; }

/* avis des testeurs */
.fb-back { position: fixed; inset: 0; z-index: 90; background: rgba(10, 14, 22, .5); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.fb { position: relative; width: 100%; max-width: 420px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 12px; margin-bottom: env(safe-area-inset-bottom, 0px); }
.fb h3 { margin: 0; font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.fb p { margin: 0; color: var(--ink-2); font-size: 14px; }
.fb-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ink-3); padding: 6px 10px; }
.fb-stars { display: flex; gap: 4px; }
.fb-stars button { border: 0; background: none; font-size: 34px; line-height: 1; color: var(--line); padding: 2px 4px; }
.fb-stars button.on { color: #F5A623; }
.fb textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 15px; resize: vertical; }
.fb-send { align-self: stretch; }
.fb-msg { color: var(--ink-3); min-height: 1em; }
.fb-fab { position: fixed; right: 14px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 40; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); border-radius: 999px; padding: 8px 14px; font-size: 13px; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
@media (min-width: 900px) { .fb-back { align-items: center; } .fb-fab { bottom: 20px; } }

/* le compte est déjà dans l'avatar du haut : pas d'onglet en doublon sur téléphone */
@media (max-width: 899px) { .tabbar #btn-settings { display: none; } }
