/* Revente CRM — thème clair « comptoir » : papier chaud, vert profond, accent citron. */
:root {
  --bg: #F2F1EC; --surface: #FFFFFF; --sunken: #F7F6F2; --line: #E4E2DA; --line2: #CFCDC3;
  --ink: #121512; --soft: #40463F; --muted: #666C62;
  --forest: #10362B; --forest-2: #1A4A3B; --on-forest: #F2F1EC; --on-forest-soft: #B9CBBF;
  --lime: #C6F432; --on-lime: #10362B;
  --green: #17693F; --green-bg: #DFF3E5; --amber: #8F5600; --amber-bg: #FBEBCB; --red: #B3261E; --red-bg: #FBE2DE;
  --blue: #1F4FB8; --blue-bg: #E1E9FB; --teal: #0F6B62; --teal-bg: #DAF1EE; --orange: #9A4A00; --orange-bg: #FCE6D2;
  --display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --radius: 20px; --shadow: 0 1px 2px rgba(18, 21, 18, .05), 0 8px 24px -18px rgba(18, 21, 18, .25);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, 'Segoe UI', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--forest); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; } a:hover { text-decoration-thickness: 2px; }
h1 { margin: 0; font: 700 38px/1.1 var(--display); letter-spacing: -0.02em; }
h2 { margin: 0; font: 650 20px/1.25 var(--display); letter-spacing: -0.01em; }
h3 { margin: 0; font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); } .soft { color: var(--soft); } .small { font-size: 13px; }
.green { color: var(--green); } .amber { color: var(--amber); } .red { color: var(--red); } .teal { color: var(--teal); } .orange { color: var(--orange); }
.num { font-family: var(--display); font-weight: 650; font-variant-numeric: tabular-nums; }
.right { text-align: right; } .grow { flex: 1 1 auto; min-width: 0; } .nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- barre du haut ---------- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 12px clamp(16px, 4vw, 40px); background: rgba(242, 241, 236, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--display); color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.logo { width: 34px; height: 34px; border-radius: 11px; background: var(--forest); color: var(--lime); display: grid; place-items: center; font-size: 19px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; color: var(--soft); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--line); color: var(--ink); }
.nav a[aria-current] { background: var(--forest); color: var(--on-forest); }
.count { font-size: 12px; font-weight: 600; min-width: 22px; padding: 2px 7px; border-radius: 999px; background: var(--lime); color: var(--on-lime); text-align: center; }
.count.warn { background: var(--amber-bg); color: var(--amber); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line2); flex: 0 0 auto; }
.dot.green { background: #2FA866; } .dot.amber { background: #E0A11B; } .dot.red { background: #D5483F; } .dot.teal { background: #1B9B8E; } .dot.orange { background: #E07B1B; }

main { max-width: 1320px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 80px; display: flex; flex-direction: column; gap: 24px; outline: none; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.sub { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; margin-top: 6px; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- boutons et champs ---------- */
button, .btn { font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--ink); text-decoration: none; }
button:disabled { opacity: .5; cursor: default; border-color: var(--line2); }
button.primary, .btn.primary { background: var(--forest); border-color: var(--forest); color: var(--on-forest); font-weight: 600; }
button.primary:hover, .btn.primary:hover { background: var(--forest-2); border-color: var(--forest-2); }
button.accent, button.orange { background: var(--lime); border-color: var(--lime); color: var(--on-lime); font-weight: 600; }
button.accent:hover, button.orange:hover { filter: brightness(.95); border-color: var(--lime); }
button.danger { color: var(--red); } button.danger:hover { border-color: var(--red); }
button.sm, .btn.sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
button.ghost { border-color: transparent; background: transparent; }
.chip { background: var(--surface); border-color: var(--line); color: var(--soft); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
input, select, textarea { font: inherit; font-size: 14px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); max-width: 100%; }
select { border-radius: 999px; padding-right: 30px; }
textarea { padding: 12px 14px; min-height: 80px; resize: vertical; width: 100%; }
input::placeholder { color: var(--muted); }
:is(input, select, textarea, button, a, summary):focus-visible { outline: 3px solid var(--forest); outline-offset: 2px; }
input.cost { width: 86px; min-height: 38px; padding: 0 10px; text-align: right; border-radius: 10px; background: var(--sunken); border-color: transparent; }
input.cost:hover, input.cost:focus { border-color: var(--line2); background: var(--surface); }
input[type=checkbox] { min-height: 0; width: 20px; height: 20px; padding: 0; accent-color: var(--forest); }

/* ---------- cartes et panneaux ---------- */
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 24px; } .row > .panel { flex: 1 1 440px; } .row > .panel.wide { flex: 2 1 560px; }
.card { border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--sunken); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: var(--line); color: var(--soft); white-space: nowrap; }
.badge.green { background: var(--green-bg); color: var(--green); } .badge.amber { background: var(--amber-bg); color: var(--amber); } .badge.red { background: var(--red-bg); color: var(--red); }
.badge.teal { background: var(--teal-bg); color: var(--teal); } .badge.orange { background: var(--orange-bg); color: var(--orange); } .badge.blue { background: var(--blue-bg); color: var(--blue); }
.banner { padding: 14px 18px; border-radius: 16px; background: var(--amber-bg); color: #5E3900; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.banner.info { background: var(--teal-bg); color: #0A4A44; }
.empty { padding: 36px 12px; text-align: center; color: var(--muted); }

/* ---------- vignettes ---------- */
.thumb { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 14px; object-fit: cover; background: var(--sunken); display: block; }
.thumb.ph { display: grid; place-items: center; background: var(--line); color: var(--muted); font: 700 22px var(--display); }
.thumbbtn { padding: 0; border: 0; min-height: 0; background: none; border-radius: 14px; flex: 0 0 56px; }
.thumbbtn:hover { filter: brightness(.94); }
.list-item { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; padding-top: 0; } .list-item:last-child { padding-bottom: 0; }
.title { font-weight: 600; }

/* ---------- Aujourd'hui ---------- */
.hero { background: var(--forest); color: var(--on-forest); border-radius: 28px; padding: clamp(24px, 3.4vw, 40px); display: flex; flex-wrap: wrap; gap: 32px; align-items: stretch; }
.hero .side-a { flex: 1 1 300px; display: flex; flex-direction: column; gap: 18px; justify-content: space-between; }
.hero .side-b { flex: 2 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 10px; justify-content: flex-end; }
.hero .label { color: var(--on-forest-soft); font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero .big { font: 750 clamp(48px, 7vw, 84px)/0.95 var(--display); letter-spacing: -0.035em; color: var(--lime); }
.hero .delta { display: inline-flex; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 13px; font-weight: 500; color: var(--on-forest); }
.hero .stats { display: flex; flex-wrap: wrap; gap: 28px; }
.hero .stat b { display: block; font: 650 26px/1.1 var(--display); letter-spacing: -0.01em; }
.hero .stat span { color: var(--on-forest-soft); font-size: 13px; }
.hero select { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); color: var(--on-forest); min-height: 36px; font-size: 13px; }
.hero select option { color: var(--ink); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 180px; }
.chart .bar { flex: 1 1 0; min-width: 2px; background: rgba(198, 244, 50, .38); border-radius: 5px 5px 2px 2px; min-height: 3px; }
.chart .bar.max { background: var(--lime); } .chart .bar.zero { background: rgba(255, 255, 255, .12); }
.chart .bar:hover { background: #E4FA9A; }
.axis { display: flex; justify-content: space-between; color: var(--on-forest-soft); font-size: 12.5px; }

.todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.tile { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); text-decoration: none; border: 2px solid transparent; min-height: 150px; }
.tile:hover { border-color: var(--ink); text-decoration: none; }
.tile .n { font: 750 52px/1 var(--display); letter-spacing: -0.03em; }
.tile .t { font-weight: 600; font-size: 16px; } .tile .h { color: var(--muted); font-size: 13.5px; margin-top: auto; }
.tile.hot { background: var(--lime); box-shadow: none; } .tile.hot .h { color: #2E4A12; }
.tile.calm .n { color: var(--line2); }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--forest); border-radius: 4px; }

/* ---------- onglets ---------- */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; background: var(--line); border-radius: 999px; align-self: flex-start; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: 999px; color: var(--soft); text-decoration: none; font-weight: 500; font-size: 14px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(18, 21, 18, .12); }
.tabs .count { background: var(--forest); color: var(--on-forest); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 4px; }
.kpi .label { color: var(--muted); font-size: 14px; } .kpi .value { font: 700 34px/1.15 var(--display); letter-spacing: -0.02em; } .kpi .delta { font-size: 13px; color: var(--muted); }

/* ---------- tableaux ---------- */
.tablebox { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 860px; }
th { color: var(--muted); font-weight: 500; font-size: 13px; text-align: left; padding: 8px 14px 12px; white-space: nowrap; }
td { padding: 14px; border-top: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; } th:last-child, td:last-child { padding-right: 0; }
th.right, td.right { text-align: right; }
.cell { display: flex; align-items: center; gap: 14px; min-width: 240px; }

/* ---------- offres ---------- */
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.offer { background: var(--sunken); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.offer .price { font: 700 28px/1 var(--display); letter-spacing: -0.02em; }

/* ---------- BBDBuy ---------- */
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.flow button { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; min-height: 112px; padding: 16px; border-radius: 18px; border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.flow button:hover { border-color: var(--ink); }
.flow button[aria-pressed="true"] { background: var(--forest); color: var(--on-forest); box-shadow: none; }
.flow button[aria-pressed="true"] .muted { color: var(--on-forest-soft); }
.flow .n { font: 750 36px/1 var(--display); letter-spacing: -0.02em; } .flow .l { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.wcard { border-radius: 18px; overflow: hidden; background: var(--sunken); display: flex; flex-direction: column; border: 2px solid transparent; }
.wcard.selected { border-color: var(--forest); }
.wphoto { aspect-ratio: 4 / 3; position: relative; background: var(--line); }
.wphoto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wphoto .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font: 700 44px var(--display); }
.wphoto .tags { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.wphoto .tags .badge { box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.wphoto button.open { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; background: transparent; padding: 0; }
.wphoto .more { position: absolute; right: 10px; bottom: 10px; background: rgba(18, 21, 18, .78); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; pointer-events: none; }
.wbody { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; font-size: 12.5px; color: var(--muted); } .trio b { display: block; font: 650 16px var(--display); color: var(--ink); }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.steps div { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 7px; } .steps i { height: 7px; border-radius: 4px; background: var(--line2); }
.steps div.on { color: var(--ink); font-weight: 600; } .steps div.on i { background: var(--forest); }
details > summary { cursor: pointer; }
.selbar { position: sticky; bottom: 16px; z-index: 10; align-self: center; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 10px 10px 22px; border-radius: 999px; background: var(--ink); color: #fff; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); }

/* ---------- boîtes de dialogue ---------- */
dialog { border: 0; border-radius: 24px; background: var(--surface); color: var(--ink); padding: 0; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); }
dialog::backdrop { background: rgba(16, 54, 43, .5); }
dialog form, dialog .dbody { padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--soft); font-weight: 500; } .field.full { grid-column: 1 / -1; }
.field input, .field select { width: 100%; border-radius: 12px; }
.dfoot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photos figure { margin: 0; position: relative; } .photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; display: block; }
.photos figure button { position: absolute; top: 6px; right: 6px; min-height: 28px; padding: 0 10px; font-size: 12px; }
.viewer img { max-width: 100%; border-radius: 16px; display: block; margin: 0 auto 14px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%); } #toast.err { background: var(--red); }

/* ---------- guide ---------- */
.guide { max-width: 880px; margin: 0 auto; width: 100%; }
.guide .step { display: flex; gap: 18px; align-items: flex-start; }
.guide .n { flex: 0 0 42px; height: 42px; border-radius: 50%; background: var(--lime); color: var(--on-lime); display: grid; place-items: center; font: 750 20px var(--display); }
.guide ol, .guide ul { margin: 8px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 9px; color: var(--soft); }
.guide p { margin: 0 0 4px; color: var(--soft); }
.guide b { color: var(--ink); }
.guide code { background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 13px; }
.guide .note { background: var(--teal-bg); border-radius: 14px; padding: 14px 16px; color: #0A4A44; font-size: 14px; margin-top: 8px; }
.guide .warn { background: var(--amber-bg); border-radius: 14px; padding: 14px 16px; color: #5E3900; font-size: 14px; margin-top: 8px; }

@media (max-width: 760px) {
  h1 { font-size: 30px; }
  .top { gap: 10px; flex-wrap: wrap; } .nav a { padding: 0 12px; } .top-tools { margin-left: 0; width: 100%; justify-content: flex-start; }
  .panel { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wphoto .tags { flex-wrap: wrap; }

/* Statut d'une vente, modifiable : même allure qu'une étiquette. */
select.stage { min-height: 34px; padding: 0 28px 0 12px; font-size: 12.5px; font-weight: 600; border: 1px solid transparent; background-color: var(--line); color: var(--soft); cursor: pointer; }
select.stage:hover { border-color: var(--line2); }
select.stage.green { background-color: var(--green-bg); color: var(--green); } select.stage.amber { background-color: var(--amber-bg); color: var(--amber); }
select.stage.red { background-color: var(--red-bg); color: var(--red); } select.stage.teal { background-color: var(--teal-bg); color: var(--teal); } select.stage.blue { background-color: var(--blue-bg); color: var(--blue); }
select.stage option { background: var(--surface); color: var(--ink); font-weight: 400; }
input.cost.num { font-size: 15px; }

/* Suivi des colis */
.track { display: flex; flex-direction: column; gap: 10px; }
.track-now { font: 650 17px var(--display); }
.track-log { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.track-log li { display: grid; grid-template-columns: 118px 1fr; gap: 12px; }
.parcels { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.tracklink { min-height: 0; padding: 4px 0 0; }

/* Comparatif achats / reventes */
.versus { display: grid; grid-template-columns: 1fr auto 1fr 1.15fr; gap: 24px; align-items: center; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow); padding: clamp(22px, 3vw, 36px); }
.versus .label { color: var(--muted); font-size: 14px; }
.versus .big { font: 750 clamp(34px, 4.4vw, 54px)/1.05 var(--display); letter-spacing: -0.03em; }
.versus .arrow { font: 700 38px var(--display); color: var(--line2); }
.versus .result { background: var(--forest); color: var(--on-forest); border-radius: 22px; padding: 22px 24px; }
.versus .result .label { color: var(--on-forest-soft); } .versus .result .big { color: var(--lime); }
select.linker { max-width: 210px; min-height: 38px; font-size: 13px; flex: 0 1 210px; }
@media (max-width: 900px) { .versus { grid-template-columns: 1fr; } .versus .arrow { display: none; } }
