/* ==========================================================================
   Pommard — Feuille de style principale
   ========================================================================== */

:root {
  --bg: #F4F6FB;
  --bg-alt: #EDF1F9;
  --surface: #FFFFFF;
  --ink: #101A33;
  --ink-soft: #3A4661;
  --muted: #6B7690;
  --line: #E4E8F2;
  --line-soft: #F0F3FA;

  --brand: #4C6FFF;
  --brand-600: #3B54D3;
  --brand-700: #2B3AA8;
  --brand-50: #EEF2FF;
  --brand-100: #DFE6FF;

  --accent: #8E2C4A;
  --success: #16A34A;
  --success-50: #E9F9EF;
  --warn: #F59E0B;
  --warn-50: #FEF5E4;
  --danger: #DC2626;
  --danger-50: #FDECEC;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-xs: 0 1px 2px rgba(16, 26, 51, .06);
  --shadow-sm: 0 2px 8px rgba(16, 26, 51, .07);
  --shadow: 0 8px 24px rgba(16, 26, 51, .09);
  --shadow-lg: 0 24px 60px rgba(16, 26, 51, .18);

  --sidebar-w: 252px;
  --topbar-h: 68px;
  --bottom-h: 66px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img { max-width: 100%; display: block; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 8px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 12px; }
[hidden] { display: none !important; }

::selection { background: var(--brand-100); }

/* ---------- Scrollbar ---------- */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #CBD3E6; border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   Structure de l'application
   ========================================================================== */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #101A33;
  color: #C9D2E8;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(150deg, var(--brand) 0%, var(--brand-700) 100%);
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  box-shadow: 0 6px 16px rgba(76, 111, 255, .4);
}

.brand-name { color: #fff; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-sub { font-size: 11.5px; color: #7B87A5; margin-top: -2px; }

.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #66728F;
  padding: 16px 12px 6px;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  color: #C9D2E8;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .16s, color .16s;
  position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(76, 111, 255, .32); }
.nav-link svg { flex: 0 0 20px; }
.nav-link .count {
  margin-left: auto;
  background: var(--warn);
  color: #2B1B00;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 20px;
  text-align: center;
}
.nav-link.active .count { background: #fff; color: var(--brand-700); }

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, .09);
  padding-top: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
}
.user-chip .name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.2; }
.user-chip .apt { color: #7B87A5; font-size: 12px; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 19px; margin: 0; }
.topbar .sub { font-size: 12.5px; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content {
  padding: 26px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.bottom-nav { display: none; }

/* ==========================================================================
   Composants
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side-l { grid-template-columns: 340px minmax(0, 1fr); }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }

/* ---------- KPI ---------- */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  box-shadow: var(--shadow-xs);
  transition: transform .18s, box-shadow .18s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.kpi-icon {
  width: 44px; height: 44px;
  border-radius: 13px;
  display: grid; place-items: center;
  flex: 0 0 44px;
  background: var(--brand-50);
  color: var(--brand-600);
}
.kpi-icon.green { background: var(--success-50); color: var(--success); }
.kpi-icon.amber { background: var(--warn-50); color: #B26B00; }
.kpi-icon.red { background: var(--danger-50); color: var(--danger); }
.kpi-value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-trend { font-size: 12px; color: var(--success); font-weight: 600; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s, box-shadow .16s, transform .1s, color .16s;
  white-space: nowrap;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(76, 111, 255, .26);
}
.btn:hover { background: var(--brand-600); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn svg { flex: 0 0 auto; }

.btn-ghost { background: var(--surface); color: var(--ink-soft); border-color: var(--line); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-alt); color: var(--ink); }
.btn-soft { background: var(--brand-50); color: var(--brand-600); box-shadow: none; }
.btn-soft:hover { background: var(--brand-100); color: var(--brand-700); }
.btn-danger { background: var(--danger); box-shadow: 0 4px 12px rgba(220, 38, 38, .25); }
.btn-danger:hover { background: #B91C1C; }
.btn-success { background: var(--success); box-shadow: 0 4px 12px rgba(22, 163, 74, .25); }
.btn-success:hover { background: #15803D; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 15.5px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; width: 38px; height: 38px; border-radius: 11px; }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-700);
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge.green { background: var(--success-50); color: #15803D; }
.badge.amber { background: var(--warn-50); color: #B26B00; }
.badge.red { background: var(--danger-50); color: #B91C1C; }
.badge.grey { background: var(--line-soft); color: var(--muted); }
.badge.dot::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand-600); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* ---------- Avatars ---------- */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 40px;
  letter-spacing: .02em;
  user-select: none;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; flex-basis: 32px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; flex-basis: 56px; }
.avatar.xl { width: 84px; height: 84px; font-size: 28px; flex-basis: 84px; }
.avatar-wrap { position: relative; }
.avatar-status {
  position: absolute;
  right: -1px; bottom: -1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--success);
  border: 2.5px solid var(--surface);
}

/* ---------- Listes ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  gap: 14px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
  transition: background .14s;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #FAFBFF; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.list-item .title { font-weight: 650; font-size: 14.5px; }
.list-item .meta { font-size: 12.5px; color: var(--muted); }
.list-item .excerpt {
  color: var(--ink-soft);
  font-size: 13.5px;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Annonces ---------- */
.feed { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.post:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #D8DFF2; }
.post.is-pinned { border-color: #F5D08A; background: linear-gradient(180deg, #FFFCF5 0%, #fff 42%); }
.post-media { height: 172px; background: var(--bg-alt); overflow: hidden; }
.post-media img { width: 100%; height: 100%; object-fit: cover; }
.post-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.post-title { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.post-title a { color: var(--ink); }
.post-title a:hover { color: var(--brand-600); text-decoration: none; }
.post-desc {
  color: var(--ink-soft);
  font-size: 13.8px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.post-foot .stat { display: inline-flex; align-items: center; gap: 5px; }
.media-placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #EEF2FF 0%, #E4E9F8 100%);
  color: var(--brand-600);
  opacity: .75;
}

/* ---------- Formulaires ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 6px;
  color: var(--ink-soft);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(76, 111, 255, .14);
}
.textarea { min-height: 118px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7690' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 38px; }

.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }

.switch { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { display: none; }
.switch .track {
  width: 46px; height: 26px;
  border-radius: 999px;
  background: #D6DDEC;
  position: relative;
  flex: 0 0 46px;
  transition: background .2s;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: transform .2s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch .switch-text { flex: 1; }
.switch .switch-text strong { display: block; font-size: 14px; font-weight: 600; }
.switch .switch-text span { font-size: 12.5px; color: var(--muted); }

/* ---------- Alertes ---------- */
.alert {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.8px;
  border: 1px solid;
}
.alert.info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.alert.warn { background: var(--warn-50); border-color: #F7E0B0; color: #8A5400; }
.alert.danger { background: var(--danger-50); border-color: #F7C9C9; color: #991B1B; }
.alert.success { background: var(--success-50); border-color: #BFE9CE; color: #15803D; }
.alert svg { flex: 0 0 18px; margin-top: 1px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #FAFBFF;
  white-space: nowrap;
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #FAFBFF; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: 0; border-left: 0; border-right: 0;
  font-family: inherit;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-600); border-bottom-color: var(--brand); }

/* ---------- Chat ---------- */
.chat-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - 52px);
  min-height: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.chat-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-convos { overflow-y: auto; flex: 1; }
.convo {
  display: flex;
  gap: 12px;
  padding: 13px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
  transition: background .14s;
  align-items: center;
}
.convo:hover { background: #FAFBFF; }
.convo.active { background: var(--brand-50); }
.convo .grow { flex: 1; min-width: 0; }
.convo .name { font-weight: 650; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.convo .preview {
  font-size: 12.8px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.convo .unread-dot {
  background: var(--brand);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  padding: 1px 6px;
}

.chat-main { display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  background: #FCFDFF;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #FBFCFE 0%, #F6F8FD 100%);
}
.bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.2px;
  box-shadow: var(--shadow-xs);
  position: relative;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.bubble .time { display: block; font-size: 11px; margin-top: 4px; opacity: .68; }
.bubble.them { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; }
.bubble.me {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 5px;
  align-self: flex-end;
  box-shadow: 0 4px 14px rgba(76, 111, 255, .28);
}
.chat-form {
  display: flex;
  gap: 10px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  align-items: flex-end;
}
.chat-form .input { border-radius: 14px; }
.day-sep {
  align-self: center;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
  margin: 6px 0;
}
.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 51, .5);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .16s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: popIn .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.modal-wide { max-width: 760px; }
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px 14px;
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 4px 24px 8px; }
.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px 22px;
  flex-wrap: wrap;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  background: #101A33;
  color: #fff;
  padding: 13px 16px;
  border-radius: 13px;
  box-shadow: var(--shadow);
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: slideIn .22s ease;
}
.toast.success { background: #0E7A3C; }
.toast.error { background: #A81818; }
.toast svg { flex: 0 0 18px; margin-top: 2px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ---------- États vides / squelettes ---------- */
.empty {
  text-align: center;
  padding: 52px 24px;
  color: var(--muted);
}
.empty .empty-icon {
  width: 62px; height: 62px;
  border-radius: 20px;
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty p { max-width: 380px; margin: 0 auto 18px; font-size: 14px; }

.skeleton {
  background: linear-gradient(90deg, #EEF1F8 25%, #F7F9FD 50%, #EEF1F8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 8px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Upload ---------- */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: all .16s;
  background: #FAFBFF;
  font-size: 13.5px;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: var(--brand-50); color: var(--brand-600); }
.dropzone svg { margin-bottom: 6px; }
.thumb {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  margin-top: 12px;
}
.thumb img { width: 100%; max-height: 240px; object-fit: cover; }
.thumb .remove {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(16, 26, 51, .78);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

/* ---------- Barres / graphiques ---------- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 170px;
  padding-top: 10px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%;
  max-width: 46px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-700) 100%);
  border-radius: 8px 8px 4px 4px;
  min-height: 4px;
  transition: height .5s cubic-bezier(.2, .9, .3, 1);
  position: relative;
}
.bar-value { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.bar-label { font-size: 11.5px; color: var(--muted); }

.progress { height: 8px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .5s; }

.donut-legend { display: flex; flex-direction: column; gap: 10px; }
.donut-legend .item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.donut-legend .dot { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 11px; }
.donut-legend .val { margin-left: auto; font-weight: 700; color: var(--ink-soft); }

/* ---------- Page auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.auth-visual {
  background: linear-gradient(150deg, #1B2450 0%, var(--brand-700) 55%, var(--brand) 100%);
  color: #fff;
  padding: 52px 46px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.auth-visual::after {
  content: '';
  position: absolute;
  width: 460px; height: 460px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .07);
  right: -160px; bottom: -170px;
}
.auth-visual::before {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .05);
  left: -110px; top: -90px;
}
.auth-visual h1 { font-size: 34px; line-height: 1.18; margin-top: auto; position: relative; }
.auth-visual p { color: rgba(255, 255, 255, .82); font-size: 15.5px; max-width: 420px; position: relative; }
.auth-features { display: flex; flex-direction: column; gap: 14px; margin: 26px 0 0; position: relative; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; font-size: 14.5px; color: rgba(255, 255, 255, .92); }
.auth-feature svg { flex: 0 0 20px; margin-top: 2px; }
.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 26px;
}
.auth-card { width: 100%; max-width: 430px; }
.auth-card .card { padding: 30px; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }

/* ---------- Install PWA ---------- */
.install-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: linear-gradient(120deg, #101A33 0%, #24325C 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.install-card .ico { display: flex; gap: 10px; align-items: center; color: #fff; opacity: .95; }
.install-card h3 { margin: 0 0 3px; font-size: 16px; }
.install-card p { margin: 0; font-size: 13.2px; color: rgba(255, 255, 255, .78); }
.install-card .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.btn-install { background: #fff; color: #101A33; box-shadow: none; font-weight: 700; }
.btn-install:hover { background: #EAF0FF; color: var(--brand-700); }

/* ---------- Détail annonce ---------- */
.detail-hero {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.detail-hero img { width: 100%; max-height: 400px; object-fit: cover; }
.comment {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.comment:last-child { border-bottom: 0; }
.comment .bubble-plain {
  background: var(--bg-alt);
  border-radius: 4px 14px 14px 14px;
  padding: 11px 14px;
  font-size: 14px;
  margin-top: 4px;
}

/* ---------- Utilitaires ---------- */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.hidden { display: none !important; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side, .grid-side-l { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: 300px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  body { font-size: 14.5px; }

  .sidebar { display: none; }

  .topbar {
    height: auto;
    min-height: 58px;
    padding: 10px 14px;
    gap: 10px;
  }
  .topbar h1 { font-size: 16.5px; }
  .topbar .sub { font-size: 11.5px; }

  .content {
    padding: 14px 14px calc(var(--bottom-h) + 22px);
    max-width: 100%;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    z-index: 50;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 12px;
    position: relative;
    text-decoration: none;
  }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav a.active::after {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 22px; height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--brand);
  }
  .bottom-nav .count {
    position: absolute;
    top: 2px;
    right: 50%;
    transform: translateX(22px);
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 5px;
    min-width: 16px;
  }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .feed { grid-template-columns: minmax(0, 1fr); }

  .card-head { padding: 14px 16px; }
  .card-pad { padding: 16px; }
  .list-item { padding: 13px 15px; }

  .chat-layout {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
    border-radius: var(--radius);
  }
  .chat-layout.show-thread .chat-side { display: none; }
  .chat-layout:not(.show-thread) .chat-main { display: none; }
  .chat-body { min-height: 52vh; max-height: 58vh; }
  .bubble { max-width: 86%; }

  .toasts { right: 12px; left: 12px; bottom: calc(var(--bottom-h) + 12px); max-width: none; }

  .auth-card .card { padding: 22px; }
  .auth-form-side { padding: 24px 16px; }

  .install-card { padding: 18px; }
  .install-card .actions { margin-left: 0; width: 100%; }
  .install-card .actions .btn { flex: 1; }

  .tabs { gap: 0; }
  .tab { padding: 11px 13px; font-size: 13.5px; }

  h1 { font-size: 22px; }
  h2 { font-size: 18px; }

  .modal { max-width: 100%; border-radius: 18px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .modal-foot .btn { flex: 1; }

  .row-between { gap: 10px; }
}

@media (max-width: 420px) {
  .kpi { padding: 14px; gap: 11px; }
  .kpi-value { font-size: 21px; }
  .kpi-icon { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .avatar.xl { width: 68px; height: 68px; font-size: 23px; flex-basis: 68px; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .toasts { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }
}
