:root {
  --green: #0b7a4b; --green-dark: #085c38; --green-soft: #e6f4ec;
  --gold: #f5b301; --gold-soft: #fff6d6;
  --ink: #1d2521; --muted: #66726b; --line: #e3e8e5; --bg: #f6f8f7; --card: #fff;
  --red: #c0392b; --red-soft: #fdecea; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--green-dark); }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.center { text-align: center; } .mt { margin-top: 20px; } .mb { margin-bottom: 20px; }

/* En-tête */
.topbar { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 58px; }
.logo { font-weight: 800; font-size: 1.5rem; color: #fff; text-decoration: none; letter-spacing: -.5px; }
.logo span { color: var(--gold); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav a, .nav button.linklike { color: #fff; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .95rem; background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a:hover, .nav button.linklike:hover { background: rgba(255,255,255,.15); }
.nav .sell { background: var(--gold); color: #3a2c00; font-weight: 700; }
.nav .sell:hover { background: #ffc61f; }
.badge-count { background: var(--red); color: #fff; border-radius: 99px; font-size: .72rem; padding: 1px 7px; margin-left: 4px; font-weight: 700; }
.nav-extra { display: none; }
@media (max-width: 720px) {
  .nav a.hide-sm { display: none; }
  .nav-extra { display: block; }
}
.tabbar { display: none; }
@media (max-width: 720px) {
  body { padding-bottom: 64px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 20; }
  .tabbar a { text-align: center; padding: 8px 2px 10px; font-size: .72rem; color: var(--muted); text-decoration: none; position: relative; }
  .tabbar a b { display: block; font-size: 1.25rem; line-height: 1.2; }
  .tabbar a.on { color: var(--green); font-weight: 700; }
  .tabbar .badge-count { position: absolute; top: 2px; left: 55%; }
}

/* Recherche */
.searchbar { background: var(--green); padding: 0 0 16px; }
.searchform { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.searchform .row2 { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 720px) { .searchform { grid-template-columns: 1fr 190px 190px auto; } .searchform .row2 { display: contents; } }

/* Formulaires */
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 11px 12px; font: inherit; border: 1px solid #cfd8d3; border-radius: 10px; background: #fff; color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; border-color: var(--green); }
label { display: block; font-weight: 600; margin: 14px 0 5px; font-size: .95rem; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.inline input { width: auto; }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.btn { display: inline-block; padding: 11px 18px; border-radius: 10px; border: 0; background: var(--green); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--green-dark); }
.btn.gold { background: var(--gold); color: #3a2c00; } .btn.gold:hover { background: #ffc61f; }
.btn.ghost { background: #fff; color: var(--green-dark); border: 1px solid var(--green); } .btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: var(--red); } .btn.danger:hover { background: #a22f23; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.block { display: block; width: 100%; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.narrow { max-width: 480px; margin: 24px auto; }
.page { padding-top: 20px; padding-bottom: 40px; }

/* Messages flash */
.flashes { margin: 14px 0 0; }
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 8px; font-size: .95rem; }
.flash.success { background: var(--green-soft); color: var(--green-dark); }
.flash.error { background: var(--red-soft); color: var(--red); }
.flash.info { background: #eaf1fb; color: #1f4f8f; }

/* Grille d'annonces */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.ad-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; position: relative; }
.ad-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.ad-card .ph { aspect-ratio: 4 / 3; background: #e9eeeb; object-fit: cover; width: 100%; }
.ad-card .body { padding: 10px 12px 12px; }
.ad-card .t { font-weight: 600; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.ad-card .p { color: var(--green-dark); font-weight: 800; margin: 4px 0 2px; }
.ad-card .m { color: var(--muted); font-size: .8rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.tag.premium { background: var(--gold); color: #3a2c00; }
.tag.pro { background: var(--green); color: #fff; }
.tag.ok { background: var(--green-soft); color: var(--green-dark); }
.tag.warn { background: var(--gold-soft); color: #7a5b00; }
.tag.bad { background: var(--red-soft); color: var(--red); }
.tag.grey { background: #eceff0; color: #55616a; }
.ad-card .tag { position: absolute; top: 8px; left: 8px; }
.sold-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.6); display: grid; place-items: center; font-weight: 800; color: var(--red); font-size: 1.2rem; }

/* Catégories */
.cats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .cats { grid-template-columns: repeat(5, 1fr); } }
.cat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 8px; text-align: center; text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 600; }
.cat:hover { border-color: var(--green); background: var(--green-soft); }
.cat small { display: block; color: var(--muted); font-weight: 400; }

/* Bannière pub */
.adbox { display: block; position: relative; margin: 18px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #fff; }
.adbox img { width: 100%; max-height: 200px; object-fit: cover; }
.adbox .lbl { position: absolute; top: 6px; right: 8px; font-size: .68rem; background: rgba(0,0,0,.55); color: #fff; padding: 1px 7px; border-radius: 99px; }

/* Annonce */
.detail { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "gallery" "side" "desc"; }
.detail .gallery { grid-area: gallery; } .detail .side { grid-area: side; } .detail .desc-card { grid-area: desc; }
@media (min-width: 860px) {
  .detail { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); grid-template-areas: "gallery side" "desc side"; align-items: start; }
  .detail .desc-card { margin-top: 0; }
}
.gallery .main { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #111; border-radius: var(--radius); }
.thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; flex: none; }
.thumbs img.on { border-color: var(--green); }
.price { font-size: 1.6rem; font-weight: 800; color: var(--green-dark); }
.desc { white-space: pre-wrap; word-wrap: break-word; }
.seller-box { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; flex: none; }
.safe-box { background: var(--gold-soft); border: 1px solid #f0dc8c; border-radius: 12px; padding: 12px 14px; font-size: .9rem; margin-top: 14px; }

/* Messagerie */
.conv { display: flex; gap: 12px; padding: 12px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); align-items: center; }
.conv:hover { background: #fafcfb; }
.conv img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #e9eeeb; flex: none; }
.conv .txt { min-width: 0; flex: 1; }
.conv .txt div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chatbox { display: flex; flex-direction: column; gap: 8px; padding: 14px; max-height: 60vh; min-height: 200px; overflow-y: auto; background: #f0f4f2; border-radius: 12px; }
.bubble { max-width: 80%; padding: 9px 13px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.me { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.bubble small { display: block; font-size: .7rem; opacity: .7; margin-top: 3px; }
.sendrow { display: flex; gap: 8px; margin-top: 10px; }
.sendrow textarea { min-height: 46px; height: 46px; }

/* Tableaux & admin */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.tablewrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat b { display: block; font-size: 1.6rem; color: var(--green-dark); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.subnav a { padding: 7px 13px; border-radius: 99px; background: #fff; border: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
.subnav a.on { background: var(--green); color: #fff; border-color: var(--green); }
.inline-form { display: inline; }

/* Formules */
.plans { display: grid; gap: 14px; }
@media (min-width: 760px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; }
.plan.star { border-color: var(--gold); }
.plan .pp { font-size: 1.8rem; font-weight: 800; color: var(--green-dark); }
.plan ul { padding-left: 18px; margin: 12px 0; } .plan li { margin: 5px 0; }
.pagination { display: flex; gap: 8px; justify-content: center; margin: 24px 0 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 8px; background: #fff; border: 1px solid var(--line); text-decoration: none; }
.pagination .cur { background: var(--green); color: #fff; border-color: var(--green); }
.photo-edit { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-edit label { display: block; margin: 0; font-weight: 400; font-size: .75rem; text-align: center; }
.photo-edit img { width: 90px; height: 68px; object-fit: cover; border-radius: 8px; }
footer { border-top: 1px solid var(--line); padding: 24px 0 30px; color: var(--muted); font-size: .88rem; background: #fff; margin-top: 30px; }
footer a { color: var(--muted); margin-right: 14px; }
.hero { background: linear-gradient(135deg, var(--green), #0f9b62); color: #fff; padding: 22px 0 18px; }
.hero h1 { font-size: 1.5rem; margin-bottom: 4px; } .hero p { margin: 0 0 14px; opacity: .92; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 10px; }
.section-title h2 { margin: 0; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* Zone de l'acheteur */
.locbar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 16px; }
.locbar form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.locbar label { margin: 0; font-weight: 700; }
.locbar select { width: auto; flex: 1; min-width: 150px; max-width: 260px; padding: 8px 10px; }
.locbar .small { margin-top: 6px; }
