/* =====================================================================
   Le Taulard — feuille de style MOBILE-FIRST
   Cibles prioritaires : iPhone SE (320/375), iPhone 12 mini (360),
   iPhone 12/13/14 (390). Les styles de base visent le petit écran ;
   les media queries `min-width` enrichissent pour tablette/desktop.
   ===================================================================== */
:root {
  --bg: #0b0f16;
  --bg-grad-1: #14202f;
  --panel: #131b26;
  --panel-2: #18222f;
  --panel-3: #1f2b3a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2f8;
  --muted: #94a4bb;
  --muted-2: #6f7f96;
  --accent: #f4a52a;
  --accent-2: #ffb949;
  --accent-ink: #241700;
  --accent-soft: rgba(244, 165, 42, 0.14);
  --danger: #ff6b6f;
  --blue: #62a8ff;
  --green: #4bd493;
  --purple: #b79bff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 22px 55px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.3);
  --maxw: 1040px;
  --tap: 44px; /* taille de cible tactile minimale (Apple HIG) */
}

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

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

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 500px at 50% -10%, var(--bg-grad-1) 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
  font-size: 16px; /* base 16px : évite le zoom auto d'iOS sur les champs */
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* CORRECTION BUG : garantit que tout élément [hidden] reste masqué,
   même si une classe (.form, .modal…) redéfinit `display`.
   -> corrige les modales connexion+inscription affichées ensemble. */
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding-inline: 16px; }

img, svg { max-width: 100%; }

/* ------------------------------ Bannière ------------------------------ */
.banner {
  background: linear-gradient(90deg, #3a2a08, #4a3410);
  color: #ffdf9e;
  border-bottom: 1px solid rgba(244, 165, 42, 0.3);
  padding: 0.7rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
}
.banner code { background: rgba(0,0,0,0.3); padding: 0.05rem 0.35rem; border-radius: 5px; }

/* ------------------------------ Boutons ------------------------------ */
.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.6rem 1rem;
  min-height: var(--tap);
  cursor: pointer;
  color: var(--text);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background .15s, border-color .15s, transform .06s, box-shadow .15s, color .15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-lg { padding: 0.85rem 1.3rem; font-size: 1.02rem; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; min-height: 34px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(244, 165, 42, 0.28);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-outline { border-color: var(--border-strong); background: rgba(255,255,255,0.02); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-2); }
.btn-ghost { background: rgba(255,255,255,0.04); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }
.btn-danger { border-color: rgba(255,107,111,0.4); color: #ff9a9d; }
.btn-danger:hover { background: rgba(255,107,111,0.14); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-plus { font-size: 1.2em; font-weight: 700; line-height: 1; }

/* ------------------------------ Topbar ------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(11, 15, 22, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; min-height: 58px; padding-block: 0.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(244,165,42,0.25);
  flex-shrink: 0;
}
.brand-text { font-family: "Oswald", sans-serif; font-size: 1.2rem; letter-spacing: 0.03em; text-transform: uppercase; font-weight: 600; }
.brand-text b { color: var(--accent); font-weight: 700; }

.nav { display: flex; align-items: center; gap: 0.4rem; }
/* Le bouton "Publier" du header est remplacé par un bouton flottant sur mobile */
#btnPublier { display: none; }
.auth-guest, .auth-user { display: inline-flex; align-items: center; gap: 0.4rem; }
/* Sur très petits écrans, l'inscription passe par l'onglet de la modale */
#btnInscription { display: none; }

.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); font-size: 0.74rem; font-weight: 800; flex-shrink: 0; }

/* Profil cliquable + menu déroulant */
.profile-menu { position: relative; }
.profile-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 0.28rem 0.5rem 0.28rem 0.3rem; border-radius: 999px;
  color: var(--text); font: inherit; font-weight: 600; font-size: 0.85rem;
  min-height: var(--tap); cursor: pointer; max-width: 55vw;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: border-color .15s, background .15s;
}
.profile-btn:hover { border-color: var(--border-strong); }
.profile-btn .profile-name { max-width: 24vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-btn .chevron { flex: 0 0 auto; color: var(--muted); transition: transform .18s; }
.profile-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; padding: 6px; z-index: 45;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: 14px; box-shadow: var(--shadow);
  animation: ddin .16s ease;
}
@keyframes ddin { from { opacity: 0; transform: translateY(-6px); } }
.dropdown-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.6rem 0.7rem; min-height: var(--tap); border: none; border-radius: 10px;
  background: none; color: var(--text); font: inherit; font-weight: 500; font-size: 0.92rem;
  cursor: pointer; text-align: left;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.dropdown-item svg { flex: 0 0 auto; color: var(--muted); }
.dropdown-item:hover { background: var(--panel-2); }
.dropdown-item.is-current { background: var(--accent-soft); color: var(--accent); }
.dropdown-item.danger { color: #ff9a9d; }
.dropdown-item.danger svg { color: #ff9a9d; }
.dropdown-item.danger:hover { background: rgba(255,107,111,0.12); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* Toast (notifications légères) */
.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--panel-3); border: 1px solid var(--border-strong); color: var(--text);
  padding: 0.7rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow);
  font-size: 0.9rem; font-weight: 500; max-width: 90vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------- Hero -------------------------------- */
.hero { border-bottom: 1px solid var(--border); position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.4;
  background-image: repeating-linear-gradient(90deg, transparent 0 38px, rgba(255,255,255,0.03) 38px 40px);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), transparent 70%);
}
.hero-inner { padding: 2.2rem 0 2rem; text-align: center; position: relative; z-index: 1; }
.eyebrow {
  display: inline-block; margin-bottom: 0.9rem;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(244,165,42,0.25);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.35rem 0.8rem; border-radius: 999px;
}
.hero h1 {
  font-family: "Oswald", sans-serif; font-weight: 700;
  font-size: clamp(1.7rem, 8vw, 2.4rem); line-height: 1.08; letter-spacing: 0.01em;
  text-transform: uppercase; margin-bottom: 0.9rem;
}
.lead { color: var(--muted); font-size: 1rem; max-width: 40ch; margin: 0 auto 1.4rem; }
.hero-actions { display: flex; flex-direction: column; gap: 0.6rem; align-items: center; }
.hero-actions .btn { width: auto; }
.deploy-check {
  margin-top: 1.3rem;
  display: inline-block;
  color: var(--green);
  background: rgba(75, 212, 147, 0.12);
  border: 1px solid rgba(75, 212, 147, 0.3);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* ------------------------------- Main -------------------------------- */
.main { padding: 1.5rem 0 5.5rem; } /* padding-bottom pour laisser la place au FAB */

/* Barre de catégories : défilement horizontal sur mobile */
.cat-bar {
  display: flex; gap: 0.5rem; margin-bottom: 1rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 2px;
  scroll-snap-type: x proximity;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; scroll-snap-align: start;
  font: inherit; font-weight: 600; font-size: 0.88rem;
  padding: 0.5rem 0.95rem; min-height: 40px; border-radius: 999px; cursor: pointer;
  background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--border);
  transition: background .15s, color .15s, border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.cat.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cat[data-type="message"].is-active {
  background: rgba(98,168,255,0.22);
  color: #9ec7ff;
  border-color: rgba(98,168,255,0.5);
}
.cat[data-type="achat"].is-active {
  background: rgba(244,165,42,0.22);
  color: #ffd28a;
  border-color: rgba(244,165,42,0.55);
}

.toolbar { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.25rem; }
.toolbar-hint {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}
.search {
  display: flex; align-items: center; gap: 0.5rem; width: 100%;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 0 0.85rem; color: var(--muted);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; background: none; border: none; color: var(--text); font: inherit; font-size: 16px; padding: 0.7rem 0; min-height: var(--tap); outline: none; }

/* Champs génériques (recherche, filtre prison) */
.input, select, textarea {
  font: inherit; font-size: 16px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px;
  padding: 0.7rem 0.85rem; min-height: var(--tap);
  outline: none; transition: border-color .15s; width: 100%;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.count { color: var(--muted-2); font-size: 0.82rem; }

/* ------------------------------ Feed --------------------------------- */
.feed { display: grid; gap: 0.9rem; grid-template-columns: minmax(0, 1fr); }
.annonce {
  min-width: 0; /* autorise l'item de grille à rétrécir : évite le débordement horizontal */
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.05rem 1.1rem; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 0.6rem;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.annonce:active { transform: scale(0.995); }
.annonce-head { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; max-width: 100%; }
.chip {
  font-size: 0.68rem; font-weight: 700; padding: 0.26rem 0.6rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--panel-3); color: var(--muted);
}
.chip-message { background: rgba(98,168,255,0.16); color: var(--blue); }
.chip-achat { background: var(--accent-soft); color: var(--accent-2); }
.chip-deal { background: rgba(255,255,255,0.08); color: #d7e2f0; text-transform: none; letter-spacing: 0; }
.chip-prison  { background: rgba(255,255,255,0.06); color: var(--text); text-transform: none; letter-spacing: 0; display: inline-flex; align-items: center; gap: 0.3rem; min-width: 0; max-width: 100%; }
.chip-prison .pin { flex: 0 0 auto; }
.chip-prison .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.annonce-title { font-size: 1.1rem; font-weight: 700; line-height: 1.3; word-break: break-word; overflow-wrap: anywhere; }
.annonce-body { color: #c6d2e3; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.95rem; }
.annonce-meta {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.meta-item {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  padding: 0.26rem 0.55rem; border-radius: 999px; font-size: 0.82rem; color: #d7e2f0;
}
.annonce-foot {
  margin-top: auto; padding-top: 0.7rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  color: var(--muted-2); font-size: 0.8rem;
}
.author { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.author .avatar { width: 22px; height: 22px; font-size: 0.68rem; }
.author strong { color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Skeleton */
.skeleton { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.05rem 1.1rem; }
.sk-line { height: 12px; border-radius: 6px; background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.12), rgba(255,255,255,0.05)); background-size: 200% 100%; animation: shimmer 1.3s infinite; margin-bottom: 0.7rem; }
.sk-line.w40 { width: 40%; } .sk-line.w70 { width: 70%; } .sk-line.w90 { width: 90%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* État vide */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty svg { color: var(--muted-2); margin-bottom: 0.8rem; }
.empty h3 { color: var(--text); font-size: 1.1rem; margin-bottom: 0.3rem; }

/* ---------------------------- Pagination ----------------------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-top: 1.75rem; flex-wrap: wrap; }
.page-info { color: var(--muted); font-size: 0.88rem; }

/* -------------------------- Bouton flottant -------------------------- */
.fab {
  position: fixed; right: 16px; z-index: 40;
  bottom: calc(16px + env(safe-area-inset-bottom));
  min-height: 56px; height: 56px; padding: 0 1.15rem;
  border: none; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink); font: inherit; font-weight: 700; font-size: 1rem;
  display: inline-flex; align-items: center; gap: 0.4rem;
  box-shadow: 0 10px 26px rgba(244, 165, 42, 0.45);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.fab:active { transform: scale(0.96); }
.fab svg { width: 22px; height: 22px; }

/* ------------------------------ Footer ------------------------------- */
.site-footer { border-top: 1px solid var(--border); text-align: center; padding: 1.75rem 1rem; color: var(--muted-2); font-size: 0.86rem; margin-top: 1rem; }
.foot-brand { font-family: "Oswald", sans-serif; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); font-size: 1.1rem; margin-bottom: 0.2rem; }
.foot-brand b { color: var(--accent); }
.site-footer .fine { font-size: 0.76rem; margin-top: 0.4rem; opacity: 0.75; }

/* -------------------------- Pages compte ---------------------------- */
.account-main {
  padding-top: 1.25rem;
  padding-bottom: 3rem;
}
.back-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem;
  min-height: 38px; margin-bottom: 0.75rem;
}
.back-link:hover { color: var(--accent); }
.account-hero {
  display: flex; align-items: center; gap: 0.85rem;
  margin: 0.5rem 0 1.1rem;
}
.account-avatar {
  width: 58px; height: 58px; border-radius: 18px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink); font-weight: 800; font-size: 1.15rem;
  box-shadow: 0 8px 22px rgba(244,165,42,.25);
}
.eyebrow.small {
  font-size: 0.66rem; margin-bottom: 0.35rem; padding: 0.28rem 0.65rem;
}
.account-hero h1,
.account-card h1 {
  font-family: "Oswald", sans-serif; text-transform: uppercase; letter-spacing: 0.03em;
  line-height: 1.1; font-size: 1.8rem;
}
.account-muted { color: var(--muted); font-size: 0.92rem; }
.account-grid {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem;
}
.account-card {
  min-width: 0;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.05rem;
}
.account-card h2 {
  font-size: 1rem; margin-bottom: 0.9rem;
  color: var(--text); letter-spacing: 0.01em;
}
.account-form { gap: 0.9rem; }
.form-success {
  color: var(--green); font-size: 0.86rem; min-height: 1em;
}
.stat-line {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border);
  color: var(--muted); font-size: 0.9rem;
}
.stat-line strong {
  color: var(--text); text-align: right; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-side .btn { margin-top: 1rem; }
.account-note {
  margin-top: 0.85rem; color: var(--muted); font-size: 0.88rem;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.75rem;
}
.my-annonces-card { margin-top: 1rem; }
.my-annonces-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}
.my-annonces-list { display: grid; gap: 0.7rem; }
.my-annonce-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem;
  background: rgba(255,255,255,0.02);
}
.my-annonce-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.3rem;
}
.my-annonce-head h3 { font-size: 1rem; line-height: 1.25; }
.my-annonce-details summary { margin-top: 0.5rem; }
.my-annonce-details .annonce-body { margin-top: 0.6rem; }

.admin-stats { margin-bottom: 1rem; }
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}
.admin-stat {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  background: rgba(255,255,255,0.03);
}
.admin-stat span { display: block; color: var(--muted); font-size: 0.8rem; }
.admin-stat strong { display: block; margin-top: 0.15rem; font-size: 1.15rem; }

.admin-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.admin-users-list {
  display: grid;
  gap: 0.8rem;
}
.admin-user-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem;
  background: rgba(255,255,255,0.02);
}
.admin-user-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 0.35rem;
}
.admin-user-head h3 {
  font-size: 1rem;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}
.admin-user-main { min-width: 0; }
.admin-list-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.ban-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 80, 80, 0.16);
  border: 1px solid rgba(255, 80, 80, 0.45);
  color: #ff8d8d;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
}
.admin-user-edit {
  margin-top: 0.55rem;
  border-top: 1px solid var(--border);
  padding-top: 0.7rem;
}
.admin-user-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}
.admin-ban-reason {
  margin-top: 0.65rem;
}
.admin-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.admin-dropdown {
  position: relative;
}
.admin-dropdown summary {
  list-style: none;
}
.admin-dropdown summary::-webkit-details-marker { display: none; }
.admin-dropdown[open] .admin-dropdown-menu {
  display: flex;
}
.admin-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  flex-direction: column;
  gap: 0.2rem;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 12;
}
.admin-prison-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: stretch;
  margin-bottom: 0.7rem;
}
.admin-prison-form .field { flex: 1; }
.admin-prisons-list {
  display: grid;
  gap: 0.6rem;
}
.admin-prison-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem;
  background: rgba(255,255,255,0.02);
}
.admin-prison-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.45rem;
}
.center-card {
  text-align: center;
  max-width: 460px;
  margin: 2.2rem auto 0;
}
.center-card .btn { margin-top: 1rem; }

/* ------------------------------ Modales ------------------------------ */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 0; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,7,12,0.72); backdrop-filter: blur(3px); animation: fade .2s ease; }
.modal-card {
  position: relative; background: var(--panel);
  border: 1px solid var(--border-strong); border-bottom: none;
  border-radius: 20px 20px 0 0; padding: 1.3rem 1.15rem calc(1.3rem + env(safe-area-inset-bottom));
  width: 100%; box-shadow: var(--shadow);
  max-height: 92vh; max-height: 92dvh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: sheet .26s cubic-bezier(.2,.8,.3,1);
}
/* Poignée type "bottom sheet" */
.modal-card::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 999px;
  background: var(--border-strong); margin: -0.3rem auto 1rem;
}
@keyframes fade { from { opacity: 0; } }
@keyframes sheet { from { opacity: 0.4; transform: translateY(100%); } }
.modal-close { position: absolute; top: 0.6rem; right: 0.7rem; width: 38px; height: 38px; background: none; border: none; color: var(--muted); font-size: 1.8rem; cursor: pointer; line-height: 1; display: grid; place-items: center; }
.modal-close:hover { color: var(--text); }
.modal-title { font-family: "Oswald", sans-serif; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 1rem; font-size: 1.25rem; }

.tabs { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; background: var(--panel-2); padding: 0.3rem; border-radius: 12px; border: 1px solid var(--border); }
.tab { flex: 1; background: none; border: none; border-radius: 9px; color: var(--muted); font: inherit; font-weight: 600; padding: 0.6rem 0; min-height: 42px; cursor: pointer; transition: background .15s, color .15s; }
.tab.is-active { color: var(--accent-ink); background: var(--accent); }

/* ------------------------------- Forms ------------------------------- */
.form { display: flex; flex-direction: column; gap: 0.85rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field > span { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field > span em { color: var(--accent); font-style: normal; }
/* CORRECTION BUG : les champs texte étaient minuscules faute de largeur.
   On applique ici un style complet à TOUS les champs des formulaires. */
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 16px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 12px;
  padding: 0.7rem 0.85rem; min-height: var(--tap);
  outline: none; transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.hint { color: var(--muted-2); font-size: 0.78rem; }
.row { display: flex; flex-direction: column; gap: 0.85rem; }
.row .field { flex: 1; }
.form-error { color: #ff9a9d; font-size: 0.86rem; min-height: 1em; }
.field textarea { min-height: 120px; resize: vertical; font-family: inherit; line-height: 1.5; }

.input-icon-wrap {
  position: relative;
}
.input-icon {
  position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
  font-size: 1rem; pointer-events: none; opacity: 0.9;
}
.input-icon-wrap input { padding-left: 2rem !important; }

.type-toggle {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.type-opt {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0.7rem 0.8rem;
  background: var(--panel-2);
  cursor: pointer;
}
.type-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.type-opt .label-main {
  display: block;
  font-weight: 700;
  color: var(--text);
}
.type-opt .label-sub {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.type-opt:has(input:checked) {
  border-color: rgba(244,165,42,0.55);
  box-shadow: inset 0 0 0 1px rgba(244,165,42,0.2);
}
.type-opt.message:has(input:checked) {
  border-color: rgba(98,168,255,0.65);
  background: rgba(98,168,255,0.16);
}
.type-opt.achat:has(input:checked) {
  border-color: rgba(244,165,42,0.65);
  background: rgba(244,165,42,0.16);
}

.mini-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.mini-opt {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.mini-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.mini-opt:has(input:checked) {
  color: var(--accent-ink);
  border-color: rgba(244,165,42,0.7);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

/* =====================================================================
   ≥ 480px  (grands téléphones en paysage / petits écrans)
   ===================================================================== */
@media (min-width: 480px) {
  #btnInscription { display: inline-flex; }
  .hero-actions { flex-direction: row; justify-content: center; }
  .hero-actions .btn { width: auto; }
  .row { flex-direction: row; }
}

/* =====================================================================
   ≥ 640px  (tablettes) : header "Publier", pas de FAB, feed 2 colonnes
   ===================================================================== */
@media (min-width: 640px) {
  .wrap { padding-inline: 24px; }
  #btnPublier { display: inline-flex; }
  .fab { display: none; }
  .main { padding-bottom: 2.5rem; }
  .brand-text { font-size: 1.35rem; }
  .brand-mark { width: 38px; height: 38px; }
  .topbar-inner { min-height: 66px; }
  .hero-inner { padding: 3.5rem 0 3rem; }
  .hero h1 { font-size: clamp(2.2rem, 5vw, 3rem); }
  .lead { font-size: 1.1rem; }
  .toolbar { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .search { flex: 1; min-width: 220px; }
  .toolbar-hint { flex: 1 1 100%; order: 2; }
  .count { margin-left: auto; }
  .type-toggle { grid-template-columns: 1fr 1fr; }
  .my-annonces-head { margin-bottom: 0.85rem; }
  .admin-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-toolbar { flex-direction: row; align-items: center; }
  .admin-toolbar .search { flex: 1; }
  .admin-user-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-prison-form { flex-direction: row; align-items: flex-end; }
  .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
  .account-main { padding-top: 1.75rem; }
  .account-hero { gap: 1rem; margin-bottom: 1.25rem; }
  .account-avatar { width: 66px; height: 66px; border-radius: 20px; font-size: 1.25rem; }
  .account-hero h1,
  .account-card h1 { font-size: 2.15rem; }
  .account-card { padding: 1.3rem; }
  /* Retour à une modale centrée classique */
  .modal { align-items: center; padding: 1rem; }
  .modal-card { max-width: 440px; border: 1px solid var(--border-strong); border-radius: 18px; padding: 1.6rem; animation: pop .22s cubic-bezier(.2,.8,.3,1.2); }
  .modal-card::before { display: none; }
  @keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
}

/* =====================================================================
   ≥ 960px  (desktop) : feed 3 colonnes
   ===================================================================== */
@media (min-width: 960px) {
  .hero h1 { font-size: clamp(2.6rem, 4vw, 3.4rem); }
  .feed { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .account-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 1.1rem; }
}

/* Respect des préférences de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
