/* ==================================================================
   Vision voisins — feuille de style principale
   ================================================================== */

:root {
  --green-900: #0f2e23;
  --green-800: #164034;
  --green-700: #1f7a5c;
  --green-600: #2a8f6b;
  --green-100: #dcece5;
  --green-50: #eef6f2;
  --amber: #e8a33d;
  --amber-soft: #fdf3e3;
  --danger: #c8563d;
  --ink: #16211c;
  --muted: #6d7c74;
  --line: #e4e8e4;
  --bg: #f7f8f5;
  --white: #ffffff;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 46, 35, .06), 0 4px 14px rgba(15, 46, 35, .05);
  --shadow-md: 0 10px 30px rgba(15, 46, 35, .10);
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 3vw, 1.55rem); font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .8em; }

[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { justify-content: center; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--green-700);
  margin: 0 0 .35em;
}

/* ---------------------------------------------------------------- */
/* En-tête                                                          */
/* ---------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  min-height: var(--topbar-h);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--green-700);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.brand-mark-lg { width: 52px; height: 52px; border-radius: 16px; margin-bottom: 14px; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: .98rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--green-100);
  background: var(--green-50);
  color: var(--green-800);
  font: inherit;
  font-size: .84rem;
  font-weight: 700;
  padding: 9px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.install-btn:hover { background: var(--green-100); }

/* ---------------------------------------------------------------- */
/* Boutons                                                          */
/* ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 20px;
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }

.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-600); }

.btn-outline { background: transparent; color: var(--green-800); border-color: var(--green-100); }
.btn-outline:hover { background: var(--green-50); }

.btn-ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn-ghost:hover { background: rgba(15, 46, 35, .06); }

.btn-light { background: #fff; color: var(--green-900); }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .5); }
.btn-outline-light:hover { background: rgba(255, 255, 255, .12); }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(200, 86, 61, .1); }

.btn-sm { padding: 9px 15px; font-size: .85rem; }
.btn-xs { padding: 7px 12px; font-size: .78rem; }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------- */
/* Structure de page                                                */
/* ---------------------------------------------------------------- */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px calc(110px + env(safe-area-inset-bottom, 0px));
}

.section { padding: 42px 0 8px; }
.section-tight { padding-top: 22px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--green-700);
  flex: none;
}

/* ---------------------------------------------------------------- */
/* Héros                                                            */
/* ---------------------------------------------------------------- */
.hero {
  position: relative;
  margin: 20px 0 30px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 440px;
  display: flex;
  align-items: center;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(15, 46, 35, .93) 12%, rgba(15, 46, 35, .72) 48%, rgba(15, 46, 35, .38) 100%);
}

.hero-content { position: relative; padding: 46px 40px; max-width: 660px; }
.hero-content .eyebrow { color: #9fd6c2; }
.hero h1 { color: #fff; margin-bottom: 14px; }
.hero-lead { font-size: 1.04rem; color: rgba(255, 255, 255, .88); max-width: 520px; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 18px; }
.hero-points { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 0; font-size: .87rem; }
.hero-points li { display: flex; align-items: center; gap: 7px; color: rgba(255, 255, 255, .9); }
.hero-points svg { color: #7fd0ad; flex: none; }

/* ---------------------------------------------------------------- */
/* Bandeau de chiffres                                              */
/* ---------------------------------------------------------------- */
.stats-band {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: -58px 0 0;
  position: relative;
  z-index: 2;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  text-align: center;
}
.stat-card strong { display: block; font-size: 1.7rem; font-weight: 800; color: var(--green-800); line-height: 1.1; }
.stat-card span { font-size: .8rem; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- */
/* Cartes d'annonces                                                */
/* ---------------------------------------------------------------- */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease, box-shadow .2s ease;
}
.card.is-visible { opacity: 1; transform: none; }
.card:hover { box-shadow: var(--shadow-md); }

.card-media {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--green-50);
  aspect-ratio: 16 / 10;
  cursor: pointer;
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.04); }
.card-noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--green-600); }

.card-tag {
  position: absolute;
  left: 12px;
  top: 12px;
  background: rgba(15, 46, 35, .82);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  letter-spacing: .02em;
}

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; }
.card-title { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; text-align: left; cursor: pointer; color: var(--ink); }
.card-title:hover { color: var(--green-700); }
.card-text { font-size: .88rem; color: var(--muted); margin: 0; }
.card-meta { font-size: .8rem; color: var(--muted); margin: 0; }

.card-foot { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 6px; }
.card-author { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; line-height: 1.25; min-width: 0; }
.card-author em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .74rem; }
.card-foot .btn { margin-left: auto; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  background: var(--green-100);
  display: inline-block;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 54px; height: 54px; }

.card-skeleton {
  min-height: 190px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, #eef1ee 20%, #f7f9f7 40%, #eef1ee 60%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty, .empty-state {
  text-align: center;
  color: var(--muted);
  padding: 34px 18px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  grid-column: 1 / -1;
}
.empty-state .btn { margin-top: 12px; }

/* ---------------------------------------------------------------- */
/* Chips et filtres                                                 */
/* ---------------------------------------------------------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  font: inherit;
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
}
.chip:hover { border-color: var(--green-600); color: var(--green-700); }
.chip.is-active { background: var(--green-700); border-color: var(--green-700); color: #fff; }

.toolbar { display: flex; flex-direction: column; gap: 14px; margin-bottom: 26px; }

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}
.search-field input {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .92rem;
  color: var(--ink);
  width: 100%;
  outline: none;
  min-width: 0;
}

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.result-count { font-size: .82rem; color: var(--muted); font-weight: 600; }

/* ---------------------------------------------------------------- */
/* « Comment ça marche »                                            */
/* ---------------------------------------------------------------- */
.how-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }

.how-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease, transform .5s ease;
}
.how-card.is-visible { opacity: 1; transform: none; }
.how-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--green-50);
  color: var(--green-700);
  margin-bottom: 14px;
}
.how-card p { margin: 0; font-size: .9rem; color: var(--muted); }

/* ---------------------------------------------------------------- */
/* Bandeau d'appel                                                  */
/* ---------------------------------------------------------------- */
.cta-band {
  margin: 48px 0 10px;
  background: linear-gradient(120deg, var(--green-900), var(--green-700));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-md);
}
.cta-band h2 { color: #fff; margin-bottom: 6px; }
.cta-band p { color: rgba(255, 255, 255, .85); margin: 0; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------- */
/* En-tête de page interne                                          */
/* ---------------------------------------------------------------- */
.page-head { padding: 34px 0 6px; max-width: 720px; }
.page-lead { color: var(--muted); }

/* ---------------------------------------------------------------- */
/* Authentification                                                 */
/* ---------------------------------------------------------------- */
.auth-split { display: grid; grid-template-columns: 1fr; gap: 0; margin: 24px 0; }

.auth-visual {
  position: relative;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
  min-height: 200px;
}
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.auth-visual-overlay {
  position: relative;
  padding: 30px 26px;
  background: linear-gradient(160deg, rgba(15, 46, 35, .86), rgba(15, 46, 35, .55));
  color: #fff;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 200px;
}
.auth-visual-overlay h2 { color: #fff; margin-bottom: 6px; }
.auth-visual-overlay p { color: rgba(255, 255, 255, .85); margin: 0; font-size: .92rem; }

.auth-form-wrap { display: flex; justify-content: center; }

.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px 26px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}
.auth-lead { color: var(--muted); font-size: .92rem; }
.auth-switch { margin: 18px 0 0; font-size: .88rem; color: var(--muted); }
.auth-switch a { color: var(--green-700); font-weight: 700; }
.auth-note { display: flex; align-items: flex-start; gap: 8px; font-size: .8rem; color: var(--muted); margin: 14px 0 0; }
.auth-note svg { flex: none; margin-top: 2px; color: var(--green-600); }

.admin-auth { display: flex; justify-content: center; padding-top: 34px; }
.admin-login-card { max-width: 460px; }

/* ---------------------------------------------------------------- */
/* Formulaires                                                      */
/* ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field label { font-size: .82rem; font-weight: 700; color: var(--green-800); }
.field input, .field select, .field textarea {
  font: inherit;
  font-size: .94rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fdfefd;
  color: var(--ink);
  width: 100%;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(42, 143, 107, .14);
}
.field textarea { resize: vertical; }

.field-row { display: grid; grid-template-columns: 1fr; gap: 0 14px; }

.card-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.form-error {
  background: rgba(200, 86, 61, .1);
  color: #9c3f2b;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  font-weight: 600;
  margin: 0 0 14px;
}
.form-success {
  background: var(--green-50);
  color: var(--green-800);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  font-weight: 600;
  margin: 0 0 14px;
}

.preview { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.preview-label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.preview img { width: 120px; height: 78px; object-fit: cover; border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- */
/* Espace voisin                                                    */
/* ---------------------------------------------------------------- */
.app-header {
  background: linear-gradient(130deg, var(--green-900), var(--green-700));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 22px 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow-md);
}
.app-header-user { display: flex; align-items: center; gap: 16px; }
.app-header-user h1 { color: #fff; margin: 0; font-size: 1.35rem; }
.app-header-user .eyebrow { color: #9fd6c2; }
.app-header-user .muted { color: rgba(255, 255, 255, .8); margin: 0; font-size: .85rem; }

.app-header-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.app-header-stats div {
  flex: 1 1 30%;
  min-width: 92px;
  background: rgba(255, 255, 255, .13);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
}
.app-header-stats strong { display: block; font-size: 1.25rem; font-weight: 800; }
.app-header-stats span { font-size: .72rem; color: rgba(255, 255, 255, .85); display: block; }

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 5px;
  margin-bottom: 24px;
}
.seg {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.seg.is-active { background: var(--green-700); color: #fff; }

.tab-badge {
  font-style: normal;
  background: var(--amber);
  color: #3d2a06;
  font-size: .68rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-head h2 { margin-bottom: 2px; }
.panel-head .muted { margin: 0; font-size: .87rem; }

.feed { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }

.feed-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.feed-thumb { background: var(--green-50); min-height: 150px; }
.feed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.feed-thumb .card-noimg { height: 100%; }
.feed-main { padding: 16px 18px; }
.feed-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.feed-time { font-size: .76rem; color: var(--muted); font-weight: 600; }
.feed-main h3 { margin-bottom: 6px; }
.feed-main p { font-size: .88rem; color: var(--muted); margin-bottom: 12px; }
.feed-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feed-author { display: flex; flex-direction: column; font-size: .8rem; font-weight: 700; line-height: 1.2; }
.feed-author em { font-style: normal; font-weight: 500; color: var(--muted); font-size: .74rem; }
.feed-actions { display: flex; gap: 6px; margin-left: auto; }

.pill {
  display: inline-block;
  background: var(--green-50);
  color: var(--green-800);
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
}

/* Messagerie */
.chat-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.chat-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.chat-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.chat-list-head h2 { margin: 0; font-size: 1.1rem; }
.search-compact { padding: 8px 13px; margin-bottom: 12px; }

.thread-list, .member-picker { display: flex; flex-direction: column; gap: 6px; max-height: 460px; overflow-y: auto; }
.member-picker { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }

.thread {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}
.thread:hover { background: var(--green-50); }
.thread.is-active { background: var(--green-50); }
.thread-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.thread-name { font-size: .88rem; font-weight: 700; display: flex; gap: 6px; align-items: baseline; }
.thread-name em { font-style: normal; font-size: .72rem; font-weight: 600; color: var(--muted); }
.thread-preview {
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-preview .you { color: var(--green-700); font-weight: 700; }
.thread-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.thread-time { font-size: .7rem; color: var(--muted); }
.thread-unread {
  background: var(--green-700);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
}
.chat-hint { font-size: .85rem; color: var(--muted); padding: 18px 4px; margin: 0; }
.chat-hint.centered { text-align: center; }

.chat-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 380px;
  overflow: hidden;
}
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  padding: 40px 24px;
  text-align: center;
}
.chat-empty svg { color: var(--green-600); }

.chat-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fcfdfc;
}
.chat-who { display: flex; flex-direction: column; font-size: .88rem; line-height: 1.2; }
.chat-who em { font-style: normal; font-size: .74rem; color: var(--muted); }

.chat-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 240px;
  max-height: 460px;
  background: #fafbf9;
}
.bubble {
  max-width: 78%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  padding: 9px 13px;
  align-self: flex-start;
}
.bubble p { margin: 0; font-size: .89rem; }
.bubble-time { font-size: .68rem; color: var(--muted); }
.bubble-mine {
  align-self: flex-end;
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
}
.bubble-mine .bubble-time { color: rgba(255, 255, 255, .8); }

.chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.chat-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  font: inherit;
  font-size: .9rem;
  outline: none;
  min-width: 0;
}
.chat-form input:focus { border-color: var(--green-600); }
.chat-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--green-700);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.chat-back {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}

/* Profil */
.profile-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.install-card h3 { margin-bottom: 6px; }
.store-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.os-badge {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--green-50);
  color: var(--green-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* ---------------------------------------------------------------- */
/* Détail d'une annonce (modale)                                    */
/* ---------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 46, 35, .55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow-y: auto;
}
.modal-card {
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 26px 22px calc(26px + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 560px;
  position: relative;
  margin-top: 40px;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-wide { max-width: 680px; }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(15, 46, 35, .07);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.detail-media { border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; aspect-ratio: 16 / 10; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-title { margin: 10px 0 12px; }
.detail-author { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.detail-author strong { display: block; font-size: .92rem; }
.detail-author em { font-style: normal; font-size: .78rem; color: var(--muted); }
.detail-text { white-space: pre-line; font-size: .94rem; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }

.ios-steps { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.ios-steps li { display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.ios-ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--green-50);
  color: var(--green-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

body.no-scroll { overflow: hidden; }

/* ---------------------------------------------------------------- */
/* Toast                                                            */
/* ---------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(16px);
  background: var(--green-900);
  color: #fff;
  font-size: .86rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 999px;
  z-index: 90;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: var(--shadow-md);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%); }
.toast-error { background: #8f3524; }

/* ---------------------------------------------------------------- */
/* Pied de page                                                     */
/* ---------------------------------------------------------------- */
.footer { background: var(--green-900); color: rgba(255, 255, 255, .82); margin-top: 40px; }
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 18px 26px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
}
.footer-col { display: flex; flex-direction: column; gap: 7px; }
.footer-col strong { color: #fff; font-size: .95rem; }
.footer-col p { font-size: .85rem; margin: 0; color: rgba(255, 255, 255, .7); }
.footer-col a { font-size: .85rem; color: rgba(255, 255, 255, .82); }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 16px 18px calc(96px + env(safe-area-inset-bottom, 0px));
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  font-size: .78rem;
  color: rgba(255, 255, 255, .6);
}

/* ---------------------------------------------------------------- */
/* Barre de navigation basse                                        */
/* ---------------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  justify-content: space-around;
  box-shadow: 0 -4px 18px rgba(15, 46, 35, .06);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 4px 8px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  position: relative;
  min-width: 0;
}
.tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab.is-active { color: var(--green-700); }
.tab.is-active svg { color: var(--green-700); }
.tab-badge { position: absolute; top: 6px; right: 50%; margin-right: -20px; font-style: normal; background: var(--amber); color: #3d2a06; font-size: .62rem; font-weight: 800; border-radius: 999px; padding: 0 6px; min-width: 18px; text-align: center; }

/* ---------------------------------------------------------------- */
/* Administration                                                   */
/* ---------------------------------------------------------------- */
.admin-page { max-width: 1320px; }

.admin-shell { display: grid; grid-template-columns: 1fr; gap: 18px; padding-top: 20px; }

.admin-side { display: flex; flex-direction: column; gap: 12px; }

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}

.admin-nav-item {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.admin-nav-item:hover { background: var(--green-50); color: var(--green-800); }
.admin-nav-item.is-active { background: var(--green-700); color: #fff; }
.admin-nav-badge {
  font-style: normal;
  background: var(--danger);
  color: #fff;
  font-size: .66rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 7px;
}

.admin-main { min-width: 0; }

.admin-view { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-head h1 { margin: 0; font-size: 1.5rem; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.kpi-label { display: block; font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi strong { display: block; font-size: 1.85rem; font-weight: 800; color: var(--green-800); line-height: 1.15; margin: 4px 0 2px; }
.kpi-sub { font-size: .76rem; color: var(--muted); }

.chart-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 20px; }
.panel-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.panel-card h2 { font-size: 1rem; margin-bottom: 14px; }
.chart-box { position: relative; height: 280px; }

.top-members { display: flex; flex-direction: column; gap: 10px; }
.top-member { display: flex; align-items: center; gap: 12px; }
.top-member-main { display: flex; flex-direction: column; font-size: .88rem; line-height: 1.2; flex: 1; min-width: 0; }
.top-member-main em { font-style: normal; font-size: .74rem; color: var(--muted); }
.top-member-count { font-size: .78rem; font-weight: 700; color: var(--green-700); flex: none; }

.admin-table { display: flex; flex-direction: column; gap: 12px; }

.row-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row-card.is-muted { opacity: .62; }
.row-main { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.row-thumb { width: 62px; height: 48px; border-radius: var(--radius-sm); overflow: hidden; flex: none; background: var(--green-50); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-id strong { font-size: .92rem; }
.row-id em { font-style: normal; font-size: .78rem; color: var(--muted); word-break: break-word; }
.row-sub { font-size: .74rem !important; }
.row-message { font-size: .84rem !important; color: var(--ink) !important; }
.tag-apt { background: var(--green-50); color: var(--green-800); font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.row-stats { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .78rem; color: var(--muted); }
.row-stats strong { color: var(--ink); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.status { font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 3px 10px; }
.status-on { background: var(--green-50); color: var(--green-800); }
.status-off { background: rgba(200, 86, 61, .12); color: #9c3f2b; }

.settings-grid { display: grid; grid-template-columns: 1fr; gap: 0; }

.toolbar-inline { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }

/* ---------------------------------------------------------------- */
/* Bureau                                                           */
/* ---------------------------------------------------------------- */
@media (min-width: 700px) {
  .page { padding-left: 26px; padding-right: 26px; }
  .topbar-inner { padding: 10px 26px; }
  .stats-band { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .how-grid { grid-template-columns: repeat(3, 1fr); }
  .field-row { grid-template-columns: 1fr 1fr; }
  .toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .toolbar-inline { flex-direction: row; align-items: center; justify-content: space-between; }
  .toolbar-inline .search-field { max-width: 340px; }
  .cta-band { flex-direction: row; align-items: center; justify-content: space-between; }
  .cta-actions { flex: none; }
  .hero-content { padding: 56px 52px; }
  .footer-inner { grid-template-columns: 1.4fr 1fr 1fr; }
  .footer-bottom { padding-bottom: 20px; }
  .chat-layout { grid-template-columns: 340px 1fr; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .chart-grid { grid-template-columns: 1.6fr 1fr; }
  .modal { align-items: center; padding: 24px; }
  .modal-card { border-radius: var(--radius-lg); margin: 0; padding: 30px; max-height: 88vh; overflow-y: auto; }
  .auth-split { grid-template-columns: 1fr 1fr; align-items: stretch; }
  .auth-visual { border-radius: var(--radius-lg) 0 0 var(--radius-lg); min-height: 460px; }
  .auth-visual-overlay { min-height: 460px; padding: 40px; }
  .auth-form-wrap { align-items: center; }
  .auth-card { max-width: 460px; }
  .feed-item { grid-template-columns: 240px 1fr; }
  .feed-thumb { min-height: 100%; }
  .profile-grid { grid-template-columns: 1.3fr 1fr; gap: 20px; }
  .profile-grid .card-form:first-child { margin-bottom: 0; }
  .settings-grid { grid-template-columns: 1.2fr 1fr; gap: 20px; }
  .settings-grid .card-form { margin-bottom: 20px; }
  .admin-shell { grid-template-columns: 230px 1fr; gap: 24px; }
  .admin-nav { flex-direction: column; overflow: visible; }
  .admin-nav-item { width: 100%; }
  .row-card { flex-direction: row; align-items: center; justify-content: space-between; }
  .row-main { flex: 1; }
  .row-stats { flex: none; }
  .row-actions { flex: none; }
  .search-compact { margin-bottom: 14px; }
}

@media (min-width: 1000px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }
  .page-head { padding-top: 46px; }
}

/* Très petits écrans */
@media (max-width: 400px) {
  .app-header-stats div { min-width: 84px; }
  .app-header-stats span { font-size: .66rem; }
  .kpi-grid { grid-template-columns: 1fr; }
  .hero-content { padding: 34px 22px; }
  .stat-card strong { font-size: 1.45rem; }
}

/* Messagerie sur téléphone : une seule vue à la fois */
@media (max-width: 699px) {
  .chat-layout.is-open .chat-list { display: none; }
  .chat-back { display: inline-flex; }
  .chat-body { max-height: none; min-height: 300px; max-height: 58vh; }
  .seg svg { display: none; }
  .field-row { grid-template-columns: 1fr; }
}

/* En-tête : bouton d'installation en icône seule sur téléphone */
@media (max-width: 700px) {
  .install-btn span { display: none; }
  .install-btn { padding: 9px; border-radius: 50%; width: 40px; height: 40px; justify-content: center; }
  .brand-text small { display: none; }
}

/* Le bouton d'installation ne s'affiche jamais quand il est inactif */
[hidden] { display: none !important; }
