/* =====================================================================
   Travaux — feuille de style
   Thèmes : clair (défaut), sombre, auto (suit l'appareil)
   ===================================================================== */

/* ---------- Couleurs ---------- */
:root {
    --bg: #f7f4ef;
    --surface: #ffffff;
    --surface-2: #f0ebe3;
    --field: #ffffff;
    --text: #231f1a;
    --muted: #6b6258;
    --line: #e6dfd3;
    --primary: #d9480f;
    --primary-dark: #b83a0a;
    --on-primary: #ffffff;
    --primary-soft: #fdeee6;
    --offer: #0f766e;
    --offer-soft: #def4f1;
    --danger: #c92a2a;
    --danger-soft: #fdebea;
    --success: #1b7a3d;
    --success-soft: #e3f4e8;
    --star: #f08c00;
    --overlay: rgba(20, 16, 12, .88);
    --radius: 18px;
    --radius-sm: 12px;
    --nav-h: 68px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #14120f;
    --surface: #1e1b17;
    --surface-2: #28241f;
    --field: #17140f;
    --text: #f3eee7;
    --muted: #a59b8e;
    --line: #342f28;
    --primary: #ff8a4c;
    --primary-dark: #ffa06b;
    --on-primary: #1a0f06;
    --primary-soft: #3a2518;
    --offer: #2dd4bf;
    --offer-soft: #12302c;
    --danger: #ff8787;
    --danger-soft: #3a1f1f;
    --success: #69db7c;
    --success-soft: #1a2f20;
    --star: #ffb020;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
        --bg: #14120f;
        --surface: #1e1b17;
        --surface-2: #28241f;
        --field: #17140f;
        --text: #f3eee7;
        --muted: #a59b8e;
        --line: #342f28;
        --primary: #ff8a4c;
        --primary-dark: #ffa06b;
        --on-primary: #1a0f06;
        --primary-soft: #3a2518;
        --offer: #2dd4bf;
        --offer-soft: #12302c;
        --danger: #ff8787;
        --danger-soft: #3a1f1f;
        --success: #69db7c;
        --success-soft: #1a2f20;
        --star: #ffb020;
        color-scheme: dark;
    }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-wrap: anywhere;
}

body.has-nav {
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px);
}

a { color: inherit; text-decoration: none; }
h1, h2 { letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 750; margin-bottom: 12px; }
img { max-width: 100%; }
.muted { color: var(--muted); font-size: .92rem; }
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.ic {
    width: 1.1em; height: 1.1em; flex: none;
    fill: none; stroke: currentColor; stroke-width: 2;
    stroke-linecap: round; stroke-linejoin: round;
    vertical-align: -.2em;
}
.ic-lg { width: 1.6em; height: 1.6em; }
.ic-xl { width: 2.4em; height: 2.4em; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Mise en page ---------- */
.main {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 16px 24px;
}
.main-wide { max-width: 1120px; }

.page-title { margin-bottom: 14px; }
.chips { margin-top: 2px; }

/* ---------- En-tête ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 58px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; font-size: 1.2rem; letter-spacing: -.02em; }
.brand-mark {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--on-primary);
    transform: rotate(-8deg);
}
.brand-mark .ic { width: 20px; height: 20px; }

.top-links { display: none; gap: 4px; margin-left: 12px; }
.top-links a {
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 650;
    font-size: .95rem;
    color: var(--muted);
}
.top-links a:hover { color: var(--text); background: var(--surface-2); }
.top-links a.active { color: var(--text); background: var(--surface-2); }

.top-right { margin-left: auto; display: flex; align-items: center; }
.top-user { display: block; border-radius: 50%; }

/* ---------- Cartes ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .ic { color: var(--primary); margin-bottom: 10px; }
.empty strong { color: var(--text); }
.empty p + p { margin-top: 6px; }

/* ---------- Accueil ---------- */

.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: none;
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 650;
    font-size: .92rem;
    color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }

/* Grille d'annonces */
.ads { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.ad {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s, border-color .15s;
}
.ad:hover { transform: translateY(-3px); border-color: var(--muted); }

.ad-media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    color: var(--muted);
    overflow: hidden;
}
.ad-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-media-empty { background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, var(--bg) 14px 28px); }

.ad-type, .type-tag {
    font-size: .75rem;
    font-weight: 750;
    letter-spacing: .02em;
    padding: 5px 11px;
    border-radius: 999px;
}
.ad-type { position: absolute; top: 12px; left: 12px; }
.ad-demande .ad-type, .ad-demande .type-tag { background: var(--primary); color: var(--on-primary); }
.ad-offre .ad-type, .ad-offre .type-tag { background: var(--offer); color: var(--bg); }
.type-tag { display: inline-block; margin-bottom: 10px; }

.ad-count {
    position: absolute; right: 12px; bottom: 12px;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(20, 16, 12, .72);
    color: #fff;
    font-size: .78rem;
    font-weight: 700;
}

.ad-body { padding: 14px 16px 8px; flex: 1; }
.ad-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ad-title { font-size: 1.08rem; font-weight: 750; margin: 0; }
.ad-title a::after { content: ""; position: absolute; inset: 0; z-index: 0; } /* toute la carte est cliquable */
.ad-price { flex: none; font-weight: 850; color: var(--primary); white-space: nowrap; }
.ad-offre .ad-price { color: var(--offer); }

.ad-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 8px; font-size: .85rem; color: var(--muted); }
.ad-meta .ic { margin-right: 4px; }
.ad-desc { color: var(--muted); font-size: .93rem; }

.clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ad-author {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px 14px;
    border-top: 1px dashed var(--line);
    margin: 8px 0 0;
    font-size: .88rem;
    font-weight: 650;
}
.ad-author:hover span:first-of-type { text-decoration: underline; }

/* ---------- Avatars ---------- */
.avatar {
    flex: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    display: grid; place-items: center;
    font-weight: 750;
}
.avatar-sm { width: 30px; height: 30px; font-size: .8rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.4rem; }
.avatar-xl { width: 88px; height: 88px; font-size: 2.2rem; }
img.avatar { display: block; object-fit: cover; background: var(--surface-2); }

.pro-pill {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--text);
    color: var(--bg);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    vertical-align: middle;
}
.pro-pill.pill-neutral { background: var(--surface-2); color: var(--muted); }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    min-height: 44px;
    transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: var(--surface-2); color: var(--text); }
.btn-light:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-danger { background: var(--danger-soft); color: var(--danger); min-height: 40px; padding: 8px 12px; }
.btn-danger:hover { border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.btn-lg { min-height: 50px; padding: 12px 22px; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 650; font-size: .92rem; min-width: 0; }
.field-label { font-weight: 650; font-size: .92rem; }
.optional { font-weight: 400; color: var(--muted); }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 400;
    background: var(--field);
    color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Prix : champ avec « € » */
.input-suffix { position: relative; display: block; }
.input-suffix input { padding-right: 40px; }
.input-suffix > span {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-weight: 700; pointer-events: none;
}

/* Choix entre deux options */
.segmented { border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented legend { font-weight: 650; font-size: .92rem; margin-bottom: 6px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
    display: block; text-align: center;
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--field);
    font-weight: 650;
    font-size: .93rem;
    cursor: pointer;
}
.segmented input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Envoi de photos ---------- */
.file-btn { position: relative; cursor: pointer; }
.file-btn input, .dropzone input {
    position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.file-btn:focus-within, .dropzone:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Photo de profil */
.avatar-picker {
    display: flex; align-items: center; gap: 18px;
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.avatar-preview { flex: none; }
.avatar-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.check-chip { position: relative; display: inline-flex; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-chip span {
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: .85rem;
    color: var(--muted);
}
.check-chip input:checked + span { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.check-chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Photos d'annonce */
.dropzone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 22px 16px;
    border: 2px dashed var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.dropzone .ic { color: var(--primary); }
.dropzone small { color: var(--muted); font-weight: 400; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.is-full { opacity: .5; }

.thumbs { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-top: 12px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-remove {
    position: absolute; top: 6px; right: 6px;
    width: 28px; height: 28px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: rgba(20, 16, 12, .75);
    color: #fff;
    cursor: pointer;
}
.thumb-remove:hover { background: var(--danger); }
.photo-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: .85rem; color: var(--muted); font-weight: 400; }
.photo-msg { color: var(--danger); }

/* ---------- Alertes ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; font-size: .92rem; font-weight: 550; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }

/* ---------- Connexion ---------- */
.auth { max-width: 440px; margin: 12px auto 0; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-mark {
    display: inline-grid; place-items: center;
    width: 56px; height: 56px;
    margin-bottom: 14px;
    border-radius: 18px;
    background: var(--primary);
    color: var(--on-primary);
    transform: rotate(-8deg);
}
.auth-mark .ic { width: 28px; height: 28px; }
.auth-head h1 { font-size: 1.7rem; font-weight: 850; margin-bottom: 6px; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 20px;
}
.auth-foot { text-align: center; margin-top: 18px; font-weight: 650; }
.auth-foot a:hover { color: var(--text); }
.auth .form { gap: 14px; }
@media (min-width: 700px) { .auth-card { padding: 28px; } .auth { margin-top: 32px; } }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--surface-2); border-radius: var(--radius-sm); }
.tab {
    background: none; border: 0;
    padding: 10px;
    border-radius: 9px;
    font: inherit; font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* ---------- Page d'une annonce ---------- */
.back { margin-bottom: 14px; font-weight: 650; color: var(--muted); }
.back a:hover { color: var(--text); }

.detail { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 112px)); gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.g-item { display: block; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-2); aspect-ratio: 1; }
.g-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.g-item:hover img { transform: scale(1.03); }

.detail-card { margin-bottom: 0; }
.detail-title { font-size: 1.6rem; font-weight: 850; }
.detail-card .ad-meta { margin: 8px 0 14px; }
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.detail-top .type-tag { margin-bottom: 0; }
.detail-price { font-size: 1.4rem; font-weight: 850; color: var(--primary); white-space: nowrap; }
.ad-offre .detail-price { color: var(--offer); }
.detail-desc { white-space: normal; }

.detail-side .card { margin-bottom: 14px; }
.author-card { display: flex; align-items: center; gap: 14px; }
.author-card > div { display: flex; flex-direction: column; min-width: 0; }
.author-card:hover { border-color: var(--muted); }

.listing-actions { display: flex; gap: 8px; }
.listing-actions .btn { flex: 1; }

.contact-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-row span { color: var(--muted); }
.contact-row strong { text-align: right; }
.contact .listing-actions { margin-top: 14px; }

.blur-wrap { position: relative; }
.blur-content { filter: blur(7px); -webkit-user-select: none; user-select: none; pointer-events: none; }
.blur-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; text-align: center; }

/* ---------- Visionneuse de photos ---------- */
body.lb-open { overflow: hidden; }
.lightbox {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center;
    background: var(--overlay);
    padding: 56px 12px;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }
.lb-btn {
    position: absolute;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .28); }
.lb-close { top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; text-align: center; color: #fff; font-size: .85rem; font-weight: 650; }

/* ---------- Profils ---------- */
.profile-layout { display: flex; flex-direction: column; }
.pl-side, .pl-col { display: contents; }
.pl-head { order: 1; }
.pl-flash { order: 2; }
.pl-edit { order: 3; }
.pl-listings { order: 4; }
.pl-reviews { order: 5; }
.pl-theme { order: 6; }
.pl-logout { order: 7; }
.pl-flash:empty { display: none; }

.profile-card { padding: 0; overflow: hidden; }
.profile-card-body { padding: 22px 18px 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.profile-card-body .avatar-xl { margin: 0; }
.profile-card-body h1 { margin-top: 10px; }

.reviews, .my-listings { list-style: none; }
.reviews li, .my-listings li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.reviews li:last-child, .my-listings li:last-child { border-bottom: 0; padding-bottom: 0; }
.reviews li:first-child, .my-listings li:first-child { padding-top: 0; }
.review-top { display: flex; justify-content: space-between; gap: 8px; }
.stars { color: var(--star); letter-spacing: 1px; white-space: nowrap; }
.my-listings li { display: flex; align-items: center; gap: 12px; }
.my-info { flex: 1; min-width: 0; }
.mini-thumb {
    flex: none;
    width: 52px; height: 52px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--muted);
    overflow: hidden;
}
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reviews a:hover, .my-listings a:hover { text-decoration: underline; }
.logout { margin-bottom: 14px; }

.rating-input { position: relative; display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.rating-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rating-input label { display: block; font-size: 2.2rem; line-height: 1; font-weight: 400; color: var(--line); cursor: pointer; padding: 2px; }
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label { color: var(--star); }
.rating-input input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* Choix du thème */
.theme-options { border: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-opt { position: relative; }
.theme-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.theme-opt span {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--field);
    font-weight: 650;
    font-size: .9rem;
    cursor: pointer;
}
.theme-opt input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.theme-opt input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-hint { margin-top: 10px; }

/* ---------- Barre du bas (mobile) ---------- */
.bottom-nav {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    max-width: 420px;
    margin: 0 auto;
    height: var(--nav-h);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    height: 100%;
    color: var(--muted);
    font-size: .72rem; font-weight: 700;
}
.nav-item .ic { width: 24px; height: 24px; }
.nav-item.active { color: var(--primary); }
.nav-add {
    width: 54px; height: 54px;
    display: grid; place-items: center;
    border-radius: 18px;
    background: var(--primary);
    color: var(--on-primary);
    transform: rotate(-6deg);
}
.nav-add .ic { width: 26px; height: 26px; stroke-width: 2.6; }
.nav-add.active { background: var(--primary-dark); }

/* ---------- Petits écrans ---------- */
@media (max-width: 420px) {
    .row { grid-template-columns: 1fr; }
    .avatar-picker { flex-direction: column; align-items: flex-start; }
}

/* ---------- Tablette ---------- */
@media (min-width: 700px) {
    .main { padding-top: 24px; }
    .card { padding: 22px; }
    .ads { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
}

/* ---------- Ordinateur ---------- */
@media (min-width: 900px) {
    body.has-nav { padding-bottom: 0; }
    .bottom-nav { display: none; }
    .top-links { display: flex; }
    .main { padding-bottom: 48px; }

    .detail { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
    .detail-side { position: sticky; top: 82px; }

    .profile-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
    .pl-side, .pl-col { display: flex; flex-direction: column; }
    .pl-head, .pl-flash, .pl-edit, .pl-listings, .pl-reviews, .pl-theme, .pl-logout { order: 0; }
    .pl-side { position: sticky; top: 82px; }
}

@media (min-width: 1000px) {
    .ads { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

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

/* ---------- Barre d'action (page d'annonce, mobile) ---------- */
.action-bar { display: none; }

/* ---------- Mobile : annonces en 3 colonnes compactes ---------- */
@media (max-width: 699px) {
    .main-wide { padding-left: 10px; padding-right: 10px; }
    .ads { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .ad { border-radius: 12px; }
    .ad:hover { transform: none; }
    .ad-media { aspect-ratio: 1; }
    .ad-media .ic-xl { width: 1.8em; height: 1.8em; }
    .ad-type { top: 5px; left: 5px; font-size: .6rem; padding: 2px 6px; }
    .ad-count { right: 5px; bottom: 5px; font-size: .65rem; padding: 2px 6px; gap: 3px; }
    .ad-body { padding: 8px 8px 2px; }
    .ad-top { flex-direction: column; gap: 2px; }
    .ad-title { font-size: .8rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .ad-price { font-size: .8rem; }
    .ad-meta { font-size: .68rem; margin: 4px 0 0; }
    .ad-meta .ic { display: none; }
    .ad-meta span + span { display: none; }
    .ad-desc { display: none; }
    .ad-author { padding: 6px 8px 8px; margin-top: 4px; gap: 5px; font-size: .68rem; }
    .ad-author .avatar-sm { width: 20px; height: 20px; font-size: .6rem; }
    .ad-author span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ad-author .pro-pill { display: none; }
    .chip { padding: 7px 13px; font-size: .86rem; }
}

/* ---------- Mobile : lecture d'une annonce ---------- */
@media (max-width: 899px) {
    body.has-actionbar { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
    .action-bar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        display: flex; gap: 10px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--surface);
        border-top: 1px solid var(--line);
    }
    .action-bar .btn { flex: 1; }
    .detail { gap: 12px; }
    .detail-card { padding: 18px 16px; }
    .detail-title { font-size: 1.45rem; }
    .detail-desc { font-size: 1.02rem; line-height: 1.6; }
    .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .author-card { padding: 14px; }
    .detail-side .contact { display: none; }
}

/* ---------- Barre de recherche ---------- */
.searchbar {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
    padding: 6px 6px 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--field);
}
.searchbar:focus-within { outline: 2px solid var(--primary); border-color: var(--primary); }
.searchbar-ic { flex: none; color: var(--muted); }
.searchbar input[type="search"] {
    flex: 1; min-width: 0;
    border: 0; background: transparent; color: var(--text);
    font: inherit; padding: 8px 0;
    appearance: none; -webkit-appearance: none;
}
.searchbar input[type="search"]:focus { outline: none; }
.searchbar input[type="search"]::-webkit-search-cancel-button { display: none; }
.searchbar input::placeholder { color: var(--muted); opacity: .8; }
.searchbar-clear { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--muted); }
.searchbar-clear:hover { background: var(--surface-2); color: var(--text); }
.searchbar .btn { flex: none; border-radius: 999px; }
.search-info { margin: -4px 0 14px; font-size: .92rem; }
@media (max-width: 480px) { .searchbar .btn { display: none; } }

/* ---------- Métier : champ avec recherche ---------- */
.job-picker { position: relative; }
.job-list {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
    max-height: 260px; overflow-y: auto;
    margin: 0; padding: 6px; list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}
.job-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.job-list li:hover, .job-list li.is-active { background: var(--primary-soft); color: var(--primary); }
.job-list li.job-empty { color: var(--muted); cursor: default; }
.job-list li.job-empty:hover { background: none; color: var(--muted); }
.field-hint { font-weight: 400; }

.ad-job { margin: 0 0 6px; font-size: .82rem; font-weight: 650; color: var(--primary); }
.ad-offre .ad-job { color: var(--offer); }
.detail-job { margin: 0 0 12px; }
.job-tag {
    display: inline-block; padding: 5px 12px; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary); font-size: .88rem;
}

/* ---------- Notifications ---------- */
.top-bell {
    position: relative; display: grid; place-items: center;
    width: 40px; height: 40px; margin-right: 6px;
    border-radius: 50%; color: var(--muted);
}
.top-bell:hover, .top-bell.active { background: var(--surface-2); color: var(--text); }
.badge {
    position: absolute; top: 2px; right: 0;
    min-width: 18px; height: 18px; padding: 0 5px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--primary); color: var(--on-primary);
    font-size: .68rem; font-weight: 800; line-height: 1;
    border: 2px solid var(--bg);
    box-sizing: content-box;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head .page-title { margin: 0; }
.notifs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notif {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
}
.notif:hover { border-color: var(--muted); }
.notif.is-unread { border-color: var(--primary); background: var(--primary-soft); }
.notif-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.notif.is-unread .notif-dot { background: var(--primary); }
.notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-go { flex: none; color: var(--muted); }
.alert-info { background: var(--surface-2); color: var(--text); margin-bottom: 14px; }
.alert-info a { color: var(--primary); font-weight: 650; text-decoration: underline; }

/* ---------- Suppression du compte ---------- */
.danger-zone { border-color: var(--danger-soft); }
.danger-zone h2 { color: var(--danger); }
.danger-zone p { margin: 6px 0 14px; }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { filter: brightness(.92); }
.dialog {
    /* Centrée au milieu de l'écran (le reset CSS retire les marges automatiques par défaut) */
    position: fixed; inset: 0; margin: auto;
    height: fit-content; max-height: 86vh;
    width: min(92vw, 420px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
}
.dialog::backdrop { background: var(--overlay); }
.dialog-form { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.dialog-form h2 { margin: 0; }
.dialog-form p { margin: 0; color: var(--muted); }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 6px; }

/* Fenêtre des notifications */
.dialog-notifs { width: min(94vw, 480px); overflow: hidden; }
.dialog-notifs[open] { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; }
.dialog-x { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.dialog-x:hover { background: var(--surface-2); color: var(--text); }
.dialog-body { padding: 14px 16px; overflow-y: auto; flex: 1; min-height: 0; }
.dialog-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.notif-empty { text-align: center; padding: 24px 8px; color: var(--muted); }
.notif-empty p { margin: 6px 0; }
.notif-empty strong { color: var(--text); }
.top-bell { border: 0; background: none; cursor: pointer; padding: 0; font: inherit; }
