:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1c1a17;
  --muted: #7b7468;
  --line: #e7e1d7;
  --accent: #9c7a35;
  --accent-ink: #ffffff;
  --pos: #2e7a4d;
  --pos-bg: #e6f2ea;
  --neg: #b2453a;
  --neg-bg: #f8e8e5;
  --new: #1c1a17;
  --shadow: 0 1px 2px rgba(28, 26, 23, .05), 0 6px 20px rgba(28, 26, 23, .06);
  --radius: 10px;
  --display: Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --logo: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --mono: "Spline Sans Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Geist, system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12110f;
    --surface: #1b1916;
    --surface-2: #211f1b;
    --ink: #efe8db;
    --muted: #9b927f;
    --line: #2f2b25;
    --accent: #cfa448;
    --accent-ink: #15130f;
    --pos: #6fc48f;
    --pos-bg: #1c2e22;
    --neg: #e58276;
    --neg-bg: #33201d;
    --new: #cfa448;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 14px 24px 8px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 14px; margin-right: auto; }
.logo { font: 600 30px/1 var(--logo); letter-spacing: .32em; }
.tagline { color: var(--muted); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.scan-info { color: var(--muted); font-size: 12.5px; display: flex; gap: 18px; flex-wrap: wrap; }
.scan-info b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.tabs {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.tabs button {
  background: none;
  border: 0;
  padding: 10px 14px 12px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-weight: 500;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.topbar a.btn { color: var(--ink); text-decoration: none; }
.topbar a.btn-primary, .topbar a.btn-accent { color: var(--accent-ink); }
.tabs .tab-link { margin-left: auto; padding: 10px 14px 12px; color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.tabs .tab-link:hover { text-decoration: underline; }
.count {
  display: inline-block;
  min-width: 22px;
  padding: 0 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--line);
  color: var(--ink);
  font-size: 11.5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.count:empty { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 14px;
  cursor: pointer;
  font-weight: 500;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn[disabled] { opacity: .6; cursor: progress; }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: none;
  animation: spin .8s linear infinite;
}
.scanning .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font-size: 12.5px; }

.banner {
  max-width: 1440px;
  margin: 16px auto 0;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 8px;
  color: var(--muted);
  width: calc(100% - 48px);
}

/* ---------- Layout ---------- */
.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 24px 60px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* ---------- Filters ---------- */
.filters {
  position: sticky;
  top: 112px;
  max-height: calc(100vh - 128px);
  overflow-y: auto;
  padding-right: 4px;
}
.filters-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.filters h2 { font: 600 18px/1 var(--display); margin: 0; letter-spacing: -.02em; }
.field { display: block; margin: 0 0 18px; }
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 600;
}
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type=search], input[type=number], select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.range { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12.5px;
  cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }
.checklist {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
}
.checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.checklist label:hover { background: var(--surface-2); }
.checklist small { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.toggles { display: grid; gap: 9px; }
.toggle { display: flex; gap: 9px; align-items: center; cursor: pointer; font-size: 13px; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.result-count { margin: 0 auto 0 0; color: var(--muted); }
.result-count b { color: var(--ink); }
.sort { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.sort select { width: auto; }
.filters-toggle { display: none; }

/* ---------- Summary (selection) ---------- */
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}
.summary div { background: var(--surface); padding: 14px 16px; }
.summary span { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.summary b { font: 600 20px/1.2 var(--mono); word-spacing: -.3em; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

/* ---------- Cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  cursor: zoom-in;
  overflow: hidden;
  border: 0;
  padding: 0;
  width: 100%;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: opacity .25s; }
.card-media img.alt { position: absolute; inset: 0; opacity: 0; }
.card-media:hover img.alt { opacity: 1; }
.noimg { display: grid; place-items: center; height: 100%; color: var(--muted); font: 500 13px var(--mono); word-spacing: -.3em; letter-spacing: .2em; }
.badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--ink);
  border: 1px solid var(--line);
}
.badge.new { background: var(--new); color: var(--bg); border-color: var(--new); }
.badge.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.badge.auth { background: var(--pos-bg); color: var(--pos); border-color: var(--pos); }
.badge.sold { background: var(--neg); color: #fff; border-color: var(--neg); }
.sold-label { color: var(--neg); border-color: var(--neg-bg); background: var(--neg-bg); cursor: default; justify-content: center; }
.card-body { padding: 13px 14px 6px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card-brand { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.card-model { font: 600 16px/1.25 var(--display); letter-spacing: -.015em; margin: 0; cursor: pointer; }
.card-model.unknown { color: var(--muted); font-style: italic; font-weight: 500; }
.card-title {
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 36px;
}
.card-meta { display: flex; gap: 6px; margin-top: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; min-width: 0; }
.card-meta span:first-child { flex: none; }
.card-meta span + span { overflow: hidden; text-overflow: ellipsis; }
.card-meta span + span::before { content: "·"; margin-right: 6px; }
.prices { display: flex; align-items: baseline; justify-content: space-between; margin-top: 8px; gap: 8px; }
.price { font: 600 19px/1 var(--mono); word-spacing: -.3em; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.price-sub { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.margin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  background: var(--surface-2);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.margin b { font-size: 14px; }
.margin.pos { background: var(--pos-bg); color: var(--pos); }
.margin.neg { background: var(--neg-bg); color: var(--neg); }
.elsewhere { display: flex; flex-wrap: wrap; gap: 6px; }
.elsewhere .btn { font-size: 13px; padding: 7px 10px; }
.elsewhere .sub { color: var(--muted); font-size: 11.5px; }
.card-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; padding: 10px 14px 14px; }
.card-actions .btn { padding: 7px 10px; font-size: 13px; }
.icon-btn { width: 36px; padding: 0 !important; font-size: 16px !important; }
.icon-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty h3 { font: 600 20px var(--display); letter-spacing: -.02em; color: var(--ink); margin: 0 0 6px; }
.more { display: flex; justify-content: center; margin-top: 24px; }

/* ---------- Modal ---------- */
.modal {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
}
.modal::backdrop { background: rgba(15, 13, 10, .55); backdrop-filter: blur(3px); }
.modal-close {
  position: absolute;
  top: 10px; right: 12px;
  z-index: 2;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.modal-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.gallery { background: var(--surface-2); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.gallery-main { aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: var(--surface); }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.thumbs button { flex: 0 0 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 7px; overflow: hidden; cursor: pointer; background: var(--surface); }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail { padding: 26px 26px 22px; overflow-y: auto; max-height: calc(100vh - 50px); }
.detail h2 { font: 600 26px/1.15 var(--display); letter-spacing: -.03em; margin: 4px 0 6px; }
.detail .jp { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.detail .pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.breakdown { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 6px 0 16px; }
.breakdown td { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.breakdown td:last-child { text-align: right; }
.breakdown tr.total td { font-weight: 600; border-bottom: 2px solid var(--ink); }
.breakdown tr.result td { font-weight: 700; font-size: 15px; border-bottom: 0; padding-top: 10px; }
.breakdown .sub { color: var(--muted); }
.section-title { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 14px 0 2px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.note { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.55; }
.caption { font-size: 12px; color: var(--muted); white-space: pre-line; max-height: 120px; overflow-y: auto; }
.pos-t { color: var(--pos); }
.neg-t { color: var(--neg); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .topbar-inner, .tabs { padding-left: 16px; padding-right: 16px; }
  .banner { width: calc(100% - 32px); }
  .filters {
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    width: min(320px, 88vw);
    max-height: none;
    background: var(--bg);
    z-index: 40;
    padding: 20px;
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform .25s;
  }
  .filters.open { transform: none; }
  .filters-toggle { display: inline-flex; }
  .modal-body { grid-template-columns: 1fr; }
  .detail { max-height: none; }
  .tagline { display: none; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card-model { font-size: 14.5px; }
  .price { font-size: 16px; }
  .card-actions { grid-template-columns: 1fr auto; }
  .card-actions .buy { grid-column: 1 / -1; }
}

/* Comparaison et cote Vestiaire dans la fiche */
.cote-box { display: grid; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cote-box > a.btn { text-decoration: none; color: var(--ink); justify-content: center; }
.vc-query { font-size: 12px; color: var(--muted, #777); text-align: center; }
.vc-query a { color: inherit; }
.cote-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cote-form label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); }
.cote-form input { width: 110px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.cote-msg { color: var(--muted); font-size: 13px; width: 100%; }

/* Encheres NiTokyo */
.badge.ends { background: var(--surface-2); border-color: var(--accent); color: var(--ink); }
.bid { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; padding: 10px 12px;
  border: 1px solid var(--accent); border-radius: 8px; background: var(--surface-2); }
.bid span { color: var(--muted); font-size: 13px; }
.bid b { font-size: 18px; color: var(--ink); }
.bid small { color: var(--muted); font-size: 12px; margin-left: auto; }
.bid.low { border-color: var(--neg); }
.bid.low small { color: var(--neg); }

/* Raccourcis (recherches enregistrees) */
.shortcuts { margin-bottom: 14px; }
.sc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sc-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 4px; }
.sc { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.sc button { border: 0; background: none; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; padding: 5px 4px 5px 12px; }
.sc .sc-del { padding: 5px 10px 5px 6px; color: var(--muted); }
.sc .sc-del:hover, .sc .sc-del.confirm { color: #b3261e; }
.sc.on { background: var(--ink); border-color: var(--ink); }
.sc.on button { color: var(--bg); }
.sc-add { border: 1px dashed var(--muted); border-radius: 999px; background: none; color: var(--ink); font: inherit; font-size: 13px; padding: 5px 12px; cursor: pointer; }
.sc-add:hover { border-color: var(--accent); color: var(--accent); }
.sc-hint { font-size: 12.5px; color: var(--muted); }
.sc .sc-edit { display: inline-flex; align-items: center; padding: 0 2px 0 6px; color: var(--muted); text-decoration: none; font-size: 12px; }
.sc .sc-edit:hover { color: var(--accent); }
.sc.on .sc-edit { color: var(--bg); opacity: .7; }
a.sc-add { text-decoration: none; }
.sc-models { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.sc-models span { padding: 2px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

/* Page de creation d'un raccourci (/raccourci) */
.rc { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
.rc h1 { font-family: var(--display); font-weight: 600; font-size: 28px; letter-spacing: -.03em; margin: 8px 0 6px; }
.rc-lead { color: var(--muted); margin: 0 0 22px; }
.rc-block { padding: 16px 0; border-top: 1px solid var(--line); }
.rc-h { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.rc-h small { text-transform: none; letter-spacing: 0; opacity: .8; }
.rc-help { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.rc input[type=text], .rc input[type=search], .rc input[type=number], .rc select {
  width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.rc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.rc-brands { max-height: 260px; }
.rc .toggle { display: flex; margin: 4px 0; }
.rc-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rc-picked:empty { display: none; }
.rc-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13px; }
.rc-pill small { opacity: .65; }
.rc-pill button { border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; }
.rc-suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 10px; max-height: 340px; overflow-y: auto; }
.rc-suggest .rc-help { grid-column: 1 / -1; margin: 4px 0 0; }
.rc-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; }
.rc-opt small { color: var(--muted); font-size: 11.5px; }
.rc-opt.variant { padding-left: 18px; }
.rc-opt:hover { border-color: var(--muted); }
.rc-opt.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.rc-opt.on small { color: inherit; opacity: .7; }
.rc-foot { position: sticky; bottom: 0; padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--line); }
.rc-count { margin: 0 0 6px; }
.rc-msg { margin: 0 0 8px; color: #b3261e; font-size: 13px; }
.rc-msg:empty { display: none; }
.rc-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-size: 13.5px; }
.toast a { color: var(--accent); font-weight: 600; }

/* ---------- Mes achats & reventes ---------- */
.ac { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.ac-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.ac h1 { font: 600 28px/1.15 var(--display); letter-spacing: -.03em; margin: 8px 0 6px; }
.ac-head .rc-lead { margin: 0; max-width: 640px; }
.ac-kpis span + span { margin-top: 2px; text-transform: none; letter-spacing: 0; font-size: 12px; }
.ac-chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 12px; margin-bottom: 22px; }
.ac-chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ac-chart h2 { font: 600 18px var(--display); letter-spacing: -.02em; margin: 0; }
.ac-note { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; background: var(--surface-2); }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--ink); color: var(--bg); }

.bars { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; height: 210px; }
.bars .zero { position: absolute; left: 0; right: 0; top: calc(18px + (100% - 40px) * var(--zero) / 100); border-top: 1px solid var(--muted); opacity: .5; pointer-events: none; }
.col { display: grid; grid-template-rows: 18px 1fr 22px; min-width: 0; border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink); border-radius: 6px; }
.col:hover, .col.on { background: var(--surface-2); }
.col .v { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.col .area { position: relative; }
.col .bar { position: absolute; left: 18%; right: 18%; border-radius: 3px; min-height: 0; }
.col .bar.pos { bottom: calc(100% - var(--zero) * 1%); background: var(--pos); }
.col .bar.neg { top: calc(var(--zero) * 1%); background: var(--neg); }
.col.on .bar { filter: brightness(1.12); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
.col .lbl { font-size: 11.5px; color: var(--muted); align-self: center; white-space: nowrap; overflow: hidden; }
.col.on .lbl { color: var(--ink); font-weight: 600; }
.chart-detail { margin: 10px 0 0; font-size: 13.5px; }

.ac-stages { margin-bottom: 14px; }
.ac-list { display: grid; gap: 12px; }
.ac-item { display: grid; grid-template-columns: 120px minmax(0, 1fr) 240px; gap: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.ac-media { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.ac-media img { width: 100%; height: 100%; object-fit: cover; }
.ac-media .badge { position: absolute; left: 6px; top: 6px; }
.badge.stage-vendu { background: var(--pos); color: #fff; border-color: var(--pos); }
.badge.stage-en_vente { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ac-main h3 { font: 600 16px/1.25 var(--display); letter-spacing: -.015em; margin: 2px 0 2px; }
.ac-main .card-title { margin: 0 0 8px; }
.ac-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 10px; margin-top: 8px; }
.ac-f span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.ac-f input, .ac-f select, .ac-form input, .ac-form select, .ac-form textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font: inherit; min-height: 36px; }
.ac-f input:focus, .ac-f select:focus, .ac-form :is(input, select, textarea):focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.ac-side { display: flex; flex-direction: column; gap: 8px; }
.ac-side .margin { margin-top: 0; }
.ac-side .btn { justify-content: center; }
.ac-links { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
.ac-links a, .ac-form a { color: var(--accent); }
.link.danger { color: var(--neg); }

.ac-modal { width: min(680px, calc(100vw - 32px)); }
.ac-form { display: grid; gap: 12px; padding: 22px 22px 18px; }
.ac-form h2 { font: 600 21px var(--display); letter-spacing: -.02em; margin: 0; padding-right: 40px; }
.ac-form .rc-help { margin: 0; }
.ac-form label > .rc-h { display: flex; justify-content: space-between; align-items: baseline; }
.ac-form textarea { resize: vertical; line-height: 1.5; font-size: 13.5px; }
.ac-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

/* ---------- Telephone ---------- */
.filters-done { display: none; }
.show-sm { display: none; }
@media (max-width: 700px) {
  /* En-tete compact: logo + boutons sur une ligne, infos de scan en petit,
     onglets juste dessous. Il reste colle en haut sans manger l'ecran. */
  .topbar-inner { padding: 10px 16px 2px; gap: 6px 8px; }
  .logo { font-size: 21px; letter-spacing: .26em; }
  .brand { margin-right: auto; }
  .topbar .btn { padding: 7px 11px; font-size: 13px; min-height: 36px; }
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .scan-info { order: 3; flex-basis: 100%; gap: 4px 12px; font-size: 11.5px; }
  .scan-info span:nth-child(3) { display: none; }
  .tabs { gap: 0; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 8px 10px 10px; font-size: 14px; }
  .layout { padding: 12px; }
  .toolbar { gap: 10px; margin-bottom: 12px; }
  .sort > span { display: none; }
  .sort select { max-width: 52vw; }

  /* Filtres: panneau plein ecran, bouton "Voir N articles" toujours visible */
  .filters { width: 100vw; padding: 16px 16px 0; box-shadow: none; }
  .filters-done { display: block; position: sticky; bottom: 0; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--bg); border-top: 1px solid var(--line); }
  .filters-done .btn { width: 100%; justify-content: center; min-height: 46px; }

  /* Fiche article plein ecran */
  .modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .modal-close { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; width: 40px; height: 40px; box-shadow: var(--shadow); }
  .gallery { padding: 12px; }
  .detail-actions .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }

  /* Raccourcis: boutons plus faciles a toucher */
  .sc button, .sc-add { min-height: 34px; }
  .sc-row { gap: 6px; }
  .sc-label { flex-basis: 100%; }
}

@media (max-width: 700px) {
  /* Mes achats: fiche sur une colonne, graphique plus bas */
  .ac { padding: 16px 12px 48px; }
  .ac h1 { font-size: 28px; }
  .ac-head .btn { width: 100%; justify-content: center; min-height: 44px; }
  .ac-chart { padding: 14px 10px 10px; }
  .bars { height: 180px; gap: 2px; }
  .col .v { visibility: hidden; }
  .col .lbl { font-size: 10px; }
  .ac-item { grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .ac-side { grid-column: 1 / -1; }
  .ac-main h3 { font-size: 18px; }
  .ac-fields { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .ac-main { display: contents; }
  .ac-main > :not(.ac-fields) { grid-column: 2; }
  .ac-media { grid-row: span 3; align-self: start; }
  .ac-form { padding: 56px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .ac-form .rc-actions .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }
}
.empty a { color: var(--gold, #a8803a); font-weight: 600; }

.banner.install { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink); }
.banner.install .btn { margin-left: 8px; padding: 6px 14px; }
.banner.install .link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; }

/* Alertes push des raccourcis */
.sc .sc-bell { padding: 5px 2px 5px 6px; font-size: 12px; }
.sc .sc-bell.off { opacity: .45; }
.sc.on .sc-bell { color: var(--bg); }
.sc-push { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-top: 10px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 13px; color: var(--ink); }
.sc-push .btn { padding: 6px 14px; }
.sc-push.on { border-color: var(--accent); }
.sc-push .link { font-size: 13px; }

/* ================= Interface 2026-10 : plus claire sur telephone et ordinateur ================= */

/* Barre d'outils collee sous l'en-tete: filtres, nombre d'articles, tri */
.toolbar { position: sticky; top: 104px; z-index: 15; margin: 0 0 10px; padding: 8px 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); }
.filters-toggle svg { flex: none; }
.fcount { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.fcount:empty { display: none; }

/* Categories en acces direct */
.quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 10px; padding-bottom: 2px; }
.quick::-webkit-scrollbar { display: none; }
.quick:empty { display: none; }
.qchip { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.qchip:hover { border-color: var(--muted); }
.qchip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Filtres actifs, retirables */
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; }
.active-filters:empty { display: none; }
.afchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--ink); border-radius: 999px; padding: 4px 6px 4px 11px; font-size: 12.5px; cursor: pointer; }
.afchip span { font-size: 15px; line-height: 1; color: var(--muted); padding: 0 3px; }
.afchip:hover span { color: var(--neg); }

/* Cartes: photo, modele, prix et marge cote a cote */
.card { border-radius: 14px; }
.card-media { aspect-ratio: 1 / 1; background: #fff; }
.card-media img { object-fit: contain; padding: 8px; }
.badges { top: 8px; left: 8px; gap: 4px; }
.badge { font-size: 10px; padding: 2px 6px; }
.trust { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; font-weight: 600; color: var(--pos); background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--pos) 35%, transparent); border-radius: 999px; padding: 2px 8px; }
.card-body { padding: 12px 14px 4px; gap: 2px; }
.card-title { -webkit-line-clamp: 1; min-height: 0; font-size: 11.5px; }
.card-meta { margin-top: 2px; }
.card-shop { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figs { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.fig { display: flex; flex-direction: column; min-width: 0; }
.fig small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fig.mg { text-align: right; align-items: flex-end; }
.fig.mg b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.fig.mg.pos b { color: var(--pos); }
.fig.mg.neg b { color: var(--neg); }
.card-actions { padding: 10px 14px 14px; }
.card-actions .btn { min-height: 38px; }

/* Fiche: resume chiffre + barre d'achat toujours visible */
.hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; margin: 4px 0 14px; }
.hero > div { background: var(--surface-2); padding: 10px 12px; display: flex; flex-direction: column; }
.hero span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hero b { font: 600 19px/1.2 var(--mono); word-spacing: -.3em; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero small { font-size: 11.5px; color: var(--muted); }
.hero .pos { background: var(--pos-bg); } .hero .pos b { color: var(--pos); }
.hero .neg { background: var(--neg-bg); } .hero .neg b { color: var(--neg); }
.detail-actions { margin: 0 0 6px; }
.buybar { position: sticky; bottom: 0; z-index: 3; display: flex; gap: 8px; margin: 16px -26px -22px; padding: 12px 26px;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 20px rgba(28, 26, 23, .06); }
.buybar .btn { flex: 1 1 0; justify-content: center; min-height: 44px; font-size: 14px; }
.buybar .btn-accent { flex-grow: 1.6; font-weight: 600; }

/* Barre de navigation du bas: telephone uniquement */
.bottomnav { display: none; }

@media (max-width: 700px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .topbar .tabs { display: none; }
  .topbar-inner { padding-bottom: 8px; }
  .scan-info { display: none; }
  .toolbar { top: 56px; margin: 0 -12px 8px; padding: 8px 12px; }
  .toolbar .result-count { font-size: 13px; }
  .shortcuts { margin-bottom: 8px; }
  .sc-label { display: none; }
  .sc-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
  .sc-row::-webkit-scrollbar { display: none; }
  .sc, .sc-add { flex: none; }
  .sc-hint { white-space: nowrap; }
  .sc-push { font-size: 12.5px; padding: 8px 10px; }
  .quick { margin: 0 -12px 10px; padding: 0 12px 2px; }

  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: saturate(140%) blur(12px); border-top: 1px solid var(--line); }
  .bottomnav button, .bottomnav a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px;
    border: 0; background: none; color: var(--muted); font-size: 10.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
  .bottomnav svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .bottomnav .active { color: var(--accent); }
  .bottomnav .active svg { stroke-width: 2.2; }
  .bottomnav i { position: absolute; top: 2px; left: calc(50% + 8px); font-style: normal; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10px; line-height: 16px; text-align: center; }
  .bottomnav i:empty { display: none; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

  .grid { gap: 8px; }
  .card { border-radius: 12px; }
  .card:hover { transform: none; }
  .card-media img { padding: 6px; }
  .card-body { padding: 9px 10px 2px; }
  .card-brand { font-size: 10px; }
  .card-model { font-size: 16.5px; }
  .card-title { display: none; }
  .card-meta, .card-shop { font-size: 11px; }
  .figs { flex-direction: column; align-items: stretch; gap: 4px; margin-top: 8px; padding-top: 8px; }
  .fig.mg { flex-direction: row; justify-content: space-between; align-items: baseline; text-align: left;
    background: var(--surface-2); border-radius: 8px; padding: 5px 8px; }
  .fig.mg.pos { background: var(--pos-bg); }
  .fig.mg.neg { background: var(--neg-bg); }
  .fig.mg b { font-size: 15px; }
  .fig.mg small { font-size: 10.5px; }
  .fig.mg small::first-line { color: inherit; }
  .price { font-size: 19px; }
  .card-actions { grid-template-columns: 1fr auto auto; gap: 5px; padding: 8px 10px 10px; }
  .card-actions .buy { grid-column: auto; }
  .card-actions .btn { min-height: 36px; font-size: 13px; padding: 6px 8px; }
  .icon-btn { width: 34px; }
  .trust { font-size: 10px; left: 6px; bottom: 6px; padding: 1px 7px; }

  .gallery-main { aspect-ratio: auto; height: min(46vh, 360px); }
  .detail { padding: 18px 16px 0; }
  .detail h2 { font-size: 28px; }
  .hero b { font-size: 16px; }
  .hero > div { padding: 9px 10px; }
  .buybar { margin: 16px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
}
@media (min-width: 701px) {
  .card-actions { grid-template-columns: 1fr auto auto; }
}
/* Les rangees qui defilent (raccourcis, categories) ne doivent pas elargir la page */
.content { min-width: 0; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }
/* Barre d'achat: collee au bas de la zone qui defile */
.detail { padding-bottom: 0; }
.buybar { margin-bottom: 0; }
@media (max-width: 900px) { .detail { overflow: visible; } }
@media (max-width: 700px) {
  .toolbar { flex-wrap: nowrap; gap: 8px; }
  .toolbar .filters-toggle { padding: 7px 11px; min-height: 38px; }
  .toolbar .result-count { flex: 1 1 auto; white-space: nowrap; }
  .toolbar .sort { flex: none; }
  .toolbar .sort select { max-width: 40vw; min-height: 38px; padding: 6px 8px; font-size: 13px; }
  .gallery-main { height: min(40vh, 320px); }
  .detail-actions { gap: 6px; }
  .detail-actions .btn { flex: 1 1 0; min-height: 38px; font-size: 12.5px; padding: 6px 8px; }
  .fig.mg { padding: 5px 7px; }
}
.detail a.btn:not(.btn-accent) { color: var(--ink); }

/* ================= Refonte « outil pro » : accueil, score, liste, panneau, tri rapide ================= */

/* Note d'affaire A-D */
.grade { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: baseline; gap: 3px; padding: 3px 7px; border-radius: 8px;
  font: 700 13px/1 var(--mono); word-spacing: -.3em; color: #fff; background: #8a8378; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.grade small { font-size: 10px; font-weight: 600; opacity: .85; }
.grade.g-A { background: #1f7a4a; } .grade.g-B { background: #5b8f3a; } .grade.g-C { background: #b08a2e; } .grade.g-D { background: #8a8378; }
.grade.sm { position: static; box-shadow: none; padding: 2px 6px; font-size: 12px; }

/* Accueil */
body.on-home .layout { grid-template-columns: minmax(0, 1fr); }
body.on-home .filters { display: none; }
.home { max-width: 1240px; width: 100%; margin: 0 auto; }
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px 24px; flex-wrap: wrap; margin: 4px 0 18px; }
.home-head h1 { font: 650 32px/1.05 var(--display); letter-spacing: -.035em; margin: 2px 0 0; }
.home-date { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.home-bot { margin: 0; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); box-shadow: 0 0 0 3px var(--pos-bg); }
.dot.busy { background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi b { font: 600 24px/1.15 var(--mono); word-spacing: -.3em; letter-spacing: -.03em; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.kpi small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.hl { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.kpi.hl span, .kpi.hl small { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.home-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.btn.big { min-height: 48px; padding: 10px 22px; font-size: 15px; font-weight: 600; border-radius: 12px; }
.home-h { font: 600 19px/1.2 var(--display); letter-spacing: -.02em; margin: 6px 0 12px; }
.home-top { margin-bottom: 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tiles.two { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 20px; }
.tile { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.tile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tile b { font: 600 15.5px/1.2 var(--display); letter-spacing: -.015em; }
.tile span { font-size: 12.5px; color: var(--muted); }
.tile em { font-style: normal; color: var(--pos); font-weight: 600; }
.tile .tile-k { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.tile-add { border-style: dashed; }

/* Choix grille / liste */
.viewsw { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.viewsw button { border: 0; background: none; padding: 7px 9px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.viewsw button + button { border-left: 1px solid var(--line); }
body:not(.view-list) .viewsw [data-view="grid"], body.view-list .viewsw [data-view="list"] { background: var(--ink); color: var(--bg); }

/* Vue liste */
.grid.as-list { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.lrow { display: grid; grid-template-columns: 56px minmax(0, 2.6fr) 64px 84px 84px 90px 64px 92px 84px; align-items: center; gap: 12px;
  padding: 8px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.lrow:last-child { border-bottom: 0; }
.lrow:not(.lhead):hover { background: var(--surface-2); }
.lrow.current { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
.lhead { position: sticky; top: 160px; z-index: 2; background: var(--surface-2); cursor: default; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-top: 10px; padding-bottom: 10px; }
.lhead button { border: 0; background: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; text-align: left; }
.lhead button:hover, .lhead button.on { color: var(--ink); }
.l-img { width: 56px; height: 56px; border-radius: 8px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.l-img img { width: 100%; height: 100%; object-fit: contain; }
.l-main { min-width: 0; display: flex; flex-direction: column; }
.l-main b { font: 600 14.5px/1.25 var(--display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-main small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.l-main i { font-style: normal; }
.l-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.l-muted { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.l-act { display: flex; gap: 4px; justify-content: flex-end; }
.l-act .btn { height: 32px; width: 32px; }
.card.current { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Fiche a cote de la liste (grand ecran) */
.panel { display: none; }
.layout.with-panel { grid-template-columns: 230px minmax(0, 1fr) 460px; max-width: 1760px; }
.layout.with-panel .panel { display: block; position: sticky; top: 112px; max-height: calc(100vh - 124px); overflow-y: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.layout.with-panel .lrow { grid-template-columns: 48px minmax(0, 2fr) 60px 80px 0 86px 58px 0 76px; }
.layout.with-panel .lrow > :nth-child(5), .layout.with-panel .lrow > :nth-child(8) { visibility: hidden; overflow: hidden; }
.layout.with-panel .l-img { width: 48px; height: 48px; }
.panel .modal-body { grid-template-columns: 1fr; }
.panel .gallery { padding: 12px; }
.panel .gallery-main { aspect-ratio: auto; height: 280px; }
.panel .detail { max-height: none; overflow: visible; padding: 18px 20px 0; }
.panel .detail h2 { font-size: 28px; }
.panel .buybar { margin: 16px -20px 0; padding: 12px 20px; }
.panel-close { position: sticky; top: 8px; float: right; margin: 8px 8px -44px 0; z-index: 4; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); font-size: 20px; line-height: 1; cursor: pointer; }

/* Tri rapide */
body.no-scroll { overflow: hidden; }
.swipe { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; align-items: center;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
.sw-head { width: 100%; max-width: 460px; display: grid; grid-template-columns: 40px 1fr 60px; align-items: center; padding: 4px 0 10px; }
.sw-head b { text-align: center; font: 600 16px var(--display); letter-spacing: -.02em; }
.sw-head span { text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.sw-x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 20px; cursor: pointer; color: var(--ink); }
.sw-stack { position: relative; flex: 1; width: 100%; max-width: 460px; min-height: 0; }
.sw-card { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; box-shadow: 0 10px 30px rgba(28, 26, 23, .12); touch-action: none; user-select: none; transition: transform .18s ease-out; cursor: grab; }
.sw-card.drag { transition: none; cursor: grabbing; }
.sw-card.next { transform: scale(.95) translateY(10px); opacity: .7; pointer-events: none; }
.sw-media { position: relative; flex: 1; min-height: 0; background: #fff; }
.sw-media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; pointer-events: none; }
.sw-stamp { position: absolute; top: 18px; padding: 6px 12px; border: 3px solid; border-radius: 10px; font: 800 22px var(--sans); letter-spacing: .08em; opacity: 0; transition: opacity .1s; }
.sw-stamp.keep { left: 18px; color: var(--pos); transform: rotate(-12deg); }
.sw-stamp.skip { right: 18px; color: var(--neg); transform: rotate(12deg); }
.sw-card.to-keep .sw-stamp.keep, .sw-card.to-skip .sw-stamp.skip { opacity: 1; }
.sw-card .grade { top: 14px; right: 14px; font-size: 16px; padding: 5px 9px; }
.sw-card.to-skip .grade { opacity: 0; }
.sw-body { padding: 14px 18px 16px; border-top: 1px solid var(--line); }
.sw-body h3 { font: 600 26px/1.15 var(--display); margin: 2px 0 10px; }
.sw-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sw-figs div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.sw-figs span { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sw-figs b { font: 600 19px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.sw-figs .pos { background: var(--pos-bg); } .sw-figs .pos b { color: var(--pos); }
.sw-figs .neg { background: var(--neg-bg); } .sw-figs .neg b { color: var(--neg); }
.sw-sub { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-actions { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 14px 0 4px; }
.sw-btn { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 22px;
  cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center; }
.sw-btn.skip, .sw-btn.keep { width: 66px; height: 66px; font-size: 28px; }
.sw-btn.skip { color: var(--neg); } .sw-btn.keep { color: var(--pos); }
.sw-btn.info { font: italic 600 20px var(--display); }
.sw-btn:disabled { opacity: .35; cursor: default; }
.sw-hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.sw-done { margin: auto; text-align: center; display: grid; gap: 10px; max-width: 340px; }
.sw-done h2 { font: 600 34px var(--display); margin: 0; }
.sw-done p { color: var(--muted); margin: 0 0 8px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .viewsw { display: none; }
  .home-head h1 { font-size: 32px; }
  .home-head { margin-bottom: 12px; }
  .kpis { gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 10px 12px; border-radius: 12px; }
  .kpi b { font-size: 24px; }
  .home-cta .btn { flex: 1 1 100%; }
  .home-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tiles.two { grid-template-columns: 1fr 1fr; }
  .tile { padding: 12px; }
  .tile b { font-size: 17px; }
  .bottomnav { grid-template-columns: repeat(6, 1fr); }
  .bottomnav button, .bottomnav a { font-size: 10px; }
  .grade { top: 6px; right: 6px; font-size: 12px; padding: 2px 6px; }
}
.kpi .grade { color: #fff; font: 800 13px/1 var(--sans); letter-spacing: 0; text-transform: none; }
.kpi .grade small { color: #fff; font-size: 10px; }
.fig { flex: 1 1 auto; }
.fig small { overflow: hidden; text-overflow: ellipsis; }
.fig.mg { flex: none; }
.lhead { position: static; }
.home-bot { flex-wrap: nowrap; align-items: baseline; }
.home-bot .dot { flex: none; transform: translateY(-1px); }

/* Invitation a installer l'appli: fiche qui monte du bas */
.isheet-wrap { position: fixed; inset: 0; z-index: 70; }
.isheet-back { position: absolute; inset: 0; background: rgba(15, 13, 10, .45); backdrop-filter: blur(2px); opacity: 0; transition: opacity .25s; }
.isheet { position: absolute; left: 50%; bottom: 0; width: min(440px, 100%); transform: translate(-50%, 105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  background: var(--surface); color: var(--ink); border-radius: 22px 22px 0 0; padding: 10px 22px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .25); display: flex; flex-direction: column; }
.isheet-wrap.open .isheet { transform: translate(-50%, 0); }
.isheet-wrap.open .isheet-back { opacity: 1; }
.isheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 16px; }
.isheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.isheet-icon { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 6px 16px rgba(0, 0, 0, .18); flex: none; }
.isheet-head h2 { font: 600 26px/1.1 var(--display); margin: 0 0 3px; }
.isheet-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.isheet-perks { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }
.isheet-perks li { display: flex; gap: 12px; align-items: flex-start; }
.isheet svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.isheet-perks svg { width: 38px; height: 38px; padding: 8px; border-radius: 11px; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.isheet-perks b, .istep b { display: block; font-weight: 600; font-size: 14.5px; }
.isheet-perks span { font-size: 13px; color: var(--muted); line-height: 1.35; }
.isheet-perks span b { color: var(--ink); margin-bottom: 1px; }
.isheet-steps { display: grid; gap: 10px; margin: 0 0 18px; }
.istep { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
  font-size: 14.5px; animation: istep .35s both; animation-delay: var(--d); }
.istep small { display: block; color: var(--muted); font-size: 12px; }
.istep b { display: inline; font-size: inherit; }
.istep svg { color: var(--accent); }
.istep-n { width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
@keyframes istep { from { opacity: 0; transform: translateY(8px); } }
.isheet-go { min-height: 52px; font-size: 16px; font-weight: 600; border-radius: 14px; }
.isheet-later { margin: 12px auto 0; font-size: 14px; color: var(--muted); }
.isheet-arrow { position: absolute; left: 50%; bottom: calc(6px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); color: #fff; z-index: 2; pointer-events: none;
  animation: iarrow 1s ease-in-out infinite; }
.isheet-arrow svg { width: 44px; height: 44px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.isheet-arrow.up { top: calc(6px + env(safe-area-inset-top, 0px)); bottom: auto; left: auto; right: 18px; transform: none; }
@keyframes iarrow { 50% { translate: 0 8px; } }
.isheet-arrow.up { animation-name: iarrowup; }
@keyframes iarrowup { 50% { translate: 0 -8px; } }
/* Guide iPhone: la fiche remonte pour laisser voir la barre de Safari et la fleche */
.isheet.guide { bottom: 64px; border-radius: 22px; width: min(440px, calc(100% - 20px)); }
@media (min-width: 701px) { .isheet { bottom: 24px; border-radius: 22px; } .isheet-wrap.open .isheet { transform: translate(-50%, 0); } }

/* Chiffres (prix, marges, ROI, compteurs, scores) en Spline Sans Mono, alignes en colonnes */
.fig.mg b, .margin b, .count, .fcount, .breakdown td:last-child, .bid b,
.chip small, .checklist small, .col .v, .l-num, .ac-kpis b { font-family: var(--mono); word-spacing: -.3em; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.fig.mg b { font-weight: 600; }
