/* ============================================================
   EACK — feuille de style (design moderne, clair et sombre)
   Couleur principale : bleu du logo #38B6FF
   ============================================================ */
:root {
  --brand: #38B6FF;
  --brand-600: #1A9BE6;
  --brand-700: #0B7FC2;
  --brand-50: #EAF7FF;
  --brand-100: #D3EEFF;
  --ink: #0E2233;
  --bg: #FFFFFF;
  --bg-soft: #F4F7FA;
  --bg-muted: #EBF0F5;
  --surface: #FFFFFF;
  --chat-bg: #EEF5FA;
  --bubble-in: #FFFFFF;
  --bubble-out: #D6F0FF;
  --text: #0E2233;
  --text-2: #4A5D6E;
  --muted: #7C8C9A;
  --border: #E2E8EE;
  --danger: #E5484D;
  --success: #22A06B;
  --warn: #C27A00;
  --read: #1A9BE6;
  --shadow-sm: 0 1px 2px rgba(14, 34, 51, .08);
  --shadow: 0 6px 24px rgba(14, 34, 51, .12);
  --shadow-lg: 0 18px 50px rgba(14, 34, 51, .22);
  --radius: 14px;
  --rail-w: 76px;
  --side-w: 400px;
  --pattern-op: .06;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-50: #0F2A3B; --brand-100: #123A52;
    --bg: #0C151D; --bg-soft: #111D27; --bg-muted: #182733; --surface: #13202B;
    --chat-bg: #0A1219; --bubble-in: #172632; --bubble-out: #0D4566;
    --text: #E7EEF4; --text-2: #B3C2CE; --muted: #8295A5; --border: #1F3140;
    --read: #5CC8FF; --warn: #F2B24C; --pattern-op: .035;
    --shadow: 0 6px 24px rgba(0,0,0,.4); --shadow-lg: 0 18px 50px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand-50: #0F2A3B; --brand-100: #123A52;
  --bg: #0C151D; --bg-soft: #111D27; --bg-muted: #182733; --surface: #13202B;
  --chat-bg: #0A1219; --bubble-in: #172632; --bubble-out: #0D4566;
  --text: #E7EEF4; --text-2: #B3C2CE; --muted: #8295A5; --border: #1F3140;
  --read: #5CC8FF; --warn: #F2B24C; --pattern-op: .035;
  --shadow: 0 6px 24px rgba(0,0,0,.4); --shadow-lg: 0 18px 50px rgba(0,0,0,.55);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; background: var(--bg); color: var(--text); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: var(--brand-700); }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0; font-size: 14px; }
.not-member { color: var(--text); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 16px; padding: 16px; text-align: center; }
.not-member .nm-icon { font-size: 34px; line-height: 1; }
.not-member .nm-title { font-weight: 700; font-size: 16px; margin: 8px 0 4px; color: var(--brand-700); }
.not-member p { margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.not-member .btn { text-decoration: none; display: flex; justify-content: center; }
.hint { font-size: 12.5px; color: var(--muted); margin: -4px 0 8px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(124, 140, 154, .35); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Boutons et champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); transition: background .15s, transform .05s; }
.btn:hover { background: var(--bg-soft); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand-700); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.block { width: 100%; }
.btn.lg { padding: 13px 18px; font-size: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); transition: background .15s; flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--bg-muted); }
.icon-btn.active { color: var(--brand-700); background: var(--brand-50); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select, .input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(56, 182, 255, .18); }
.phone-input, .pw-input { display: flex; align-items: center; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.phone-input:focus-within, .pw-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(56, 182, 255, .18); }
.phone-input input, .pw-input input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 0; }
.prefix { padding: 0 4px 0 14px; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.pw-toggle { padding: 0 14px; opacity: .6; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--bg-muted); border-radius: 26px; transition: .2s; cursor: pointer; border: 1px solid var(--border); }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-sm); }
.switch input:checked + span { background: var(--brand-700); border-color: transparent; }
.switch input:checked + span::before { transform: translateX(18px); }
.segmented { display: flex; background: var(--bg-muted); border-radius: 12px; padding: 4px; margin: 18px 0; }
.seg { flex: 1; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Démarrage ---------- */
.splash { position: fixed; inset: 0; background: linear-gradient(160deg, #38B6FF, #0B7FC2); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 90; color: #fff; }
.splash img { width: 150px; border-radius: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.2); animation: pop .5s ease; }
.splash-name { font-weight: 800; font-size: 30px; letter-spacing: 6px; margin-top: 18px; }
.splash-lock { position: absolute; bottom: 40px; font-size: 13px; opacity: .85; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Connexion ---------- */
.auth { position: fixed; inset: 0; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); overflow: auto; }
.auth-hero { background: linear-gradient(160deg, #38B6FF 0%, #1A9BE6 55%, #0B6FA8 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-hero img { width: 120px; border-radius: 24px; box-shadow: 0 16px 40px rgba(0,0,0,.18); }
.auth-hero h1 { font-size: 44px; letter-spacing: 6px; margin: 24px 0 6px; }
.auth-hero p { font-size: 18px; opacity: .95; margin: 0 0 28px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; font-size: 15.5px; }
.auth-points li { display: flex; gap: 12px; align-items: center; }
.auth-points span { width: 38px; height: 38px; border-radius: 12px; background: rgba(255,255,255,.18); display: inline-flex; align-items: center; justify-content: center; }
.auth-card { padding: 48px 56px; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.auth-card h2 { font-size: 28px; margin: 14px 0 4px; }
.members-only { align-self: flex-start; background: var(--brand-50); color: var(--brand-700); font-weight: 700; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; }
:root[data-theme="dark"] .members-only { color: var(--brand); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 36px 24px 28px; text-align: center; align-items: center; }
  .auth-hero img { width: 84px; }
  .auth-hero h1 { font-size: 30px; margin-top: 14px; }
  .auth-hero p { font-size: 15px; margin-bottom: 0; }
  .auth-points { display: none; }
  .auth-card { padding: 24px 20px 40px; }
}

/* ---------- Structure ---------- */
.app { display: flex; height: 100dvh; background: var(--bg); }
.rail { width: var(--rail-w); flex: none; background: var(--bg-soft); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 14px 0; gap: 4px; }
.rail-logo { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 14px; }
.rail-btn { position: relative; width: 60px; padding: 8px 0 6px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-2); font-size: 10.5px; font-weight: 600; transition: background .15s, color .15s; }
.rail-btn svg { width: 24px; height: 24px; }
.rail-btn:hover { background: var(--bg-muted); }
.rail-btn.active { color: var(--brand-700); background: var(--brand-50); }
:root[data-theme="dark"] .rail-btn.active { color: var(--brand); }
.rail-badge { position: absolute; top: 2px; right: 6px; background: var(--brand-700); color: #fff; font-size: 10.5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.rail-badge.red { background: var(--danger); }
.rail-dot { position: absolute; top: 6px; right: 16px; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--bg-soft); }
.rail-spacer { flex: 1; }
.rail-me { margin-top: 8px; border-radius: 50%; }
.sidebar { width: var(--side-w); flex: none; border-right: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#pane { flex: 1; min-height: 0; }
.pane { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pane-head { display: flex; align-items: center; gap: 6px; padding: 16px 14px 8px 20px; min-height: 64px; }
.pane-head h1 { flex: 1; font-size: 22px; margin: 0; font-weight: 800; letter-spacing: -.2px; }
.pane-body { flex: 1; overflow-y: auto; min-height: 0; }
.pane-search { margin: 4px 14px 8px; position: relative; }
.pane-search input { width: 100%; border: 0; background: var(--bg-muted); border-radius: 12px; padding: 10px 14px 10px 40px; outline: none; }
.pane-search input:focus { box-shadow: 0 0 0 2px var(--brand); background: var(--surface); }
.pane-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.chips { display: flex; gap: 8px; padding: 2px 14px 10px; overflow-x: auto; }
.chip { padding: 6px 14px; border-radius: 999px; background: var(--bg-muted); color: var(--text-2); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.chip.active { background: var(--brand-100); color: var(--brand-700); }
:root[data-theme="dark"] .chip.active { color: #fff; }
.section-title { padding: 14px 20px 6px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.e2e-foot { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 24px 24px; }
.e2e-foot b { color: var(--brand-700); font-weight: 600; }

.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); position: relative; }
.chat::before { content: ""; position: absolute; inset: 0; opacity: var(--pattern-op); pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%230B7FC2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M14 20c6-6 14-6 20 0'/%3E%3Ccircle cx='86' cy='22' r='7'/%3E%3Cpath d='M60 58l6 6-6 6-6-6z'/%3E%3Cpath d='M18 84h18M27 75v18'/%3E%3Cpath d='M82 82c4 8 14 8 18 0'/%3E%3Ccircle cx='104' cy='104' r='3'/%3E%3Ccircle cx='46' cy='110' r='3'/%3E%3C/g%3E%3C/svg%3E"); }
.drawer { width: 380px; flex: none; border-left: 1px solid var(--border); background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }

/* ---------- Liste des discussions ---------- */
.list { list-style: none; margin: 0; padding: 0 8px 8px; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; cursor: pointer; position: relative; transition: background .12s; }
.row:hover { background: var(--bg-soft); }
.row.active { background: var(--brand-50); }
.row-main { flex: 1; min-width: 0; }
.row-top, .row-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.row-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15.5px; }
.row-time { font-size: 12px; color: var(--muted); flex: none; }
.row.unread .row-time { color: var(--brand-700); font-weight: 700; }
.row-sub { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; min-width: 0; }
.row-sub .t { overflow: hidden; text-overflow: ellipsis; }
.row.unread .row-sub { color: var(--text-2); font-weight: 500; }
.row-sub.typing { color: var(--brand-700); font-style: italic; }
.row-icons { display: flex; gap: 4px; align-items: center; color: var(--muted); flex: none; }
.row-icons svg { width: 16px; height: 16px; }
.badge { background: var(--brand-700); color: #fff; border-radius: 12px; min-width: 22px; height: 22px; padding: 0 7px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.badge.muted-badge { background: var(--muted); }
.row-menu { position: absolute; right: 10px; bottom: 10px; opacity: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.row:hover .row-menu { opacity: 1; }
.archived-row { display: flex; gap: 16px; align-items: center; padding: 12px 20px; cursor: pointer; font-weight: 600; color: var(--text-2); }
.archived-row:hover { background: var(--bg-soft); }
.archived-row .count { margin-left: auto; color: var(--brand-700); font-size: 13px; }
.empty { padding: 40px 28px; text-align: center; color: var(--muted); }
.empty .big { font-size: 46px; margin-bottom: 8px; }
.fab { position: absolute; right: 22px; bottom: 22px; width: 56px; height: 56px; border-radius: 18px; background: var(--brand-700); color: #fff; box-shadow: var(--shadow); display: none; align-items: center; justify-content: center; z-index: 5; }
.fab svg { width: 26px; height: 26px; }

/* ---------- Avatars ---------- */
.avatar { width: 48px; height: 48px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; position: relative; font-size: 17px; background: var(--brand-700); background-size: cover; background-position: center; user-select: none; }
.avatar.xs { width: 30px; height: 30px; font-size: 12px; }
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.avatar.md { width: 64px; height: 64px; font-size: 23px; }
.avatar.lg { width: 120px; height: 120px; font-size: 42px; }
.avatar.xl { width: 160px; height: 160px; font-size: 56px; }
.avatar.has-img { color: transparent; }
.avatar.online { outline: 2.5px solid #22C55E; outline-offset: 2px; animation: presence 2.4s ease-in-out infinite; }
.avatar.offline { outline: 2px solid var(--muted); outline-offset: 2px; opacity: 1; }
@keyframes presence { 50% { outline-color: rgba(34, 197, 94, .45); } }
@media (prefers-reduced-motion: reduce) { .avatar.online { animation: none; } }
.avatar.online::after { content: ""; position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; background: #22C55E; border: 2.5px solid var(--bg); border-radius: 50%; }
.avatar.group { background: linear-gradient(135deg, #38B6FF, #0B7FC2); }
.avatar.group svg { width: 55%; height: 55%; fill: #fff; }
.avatar.ring { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 5px var(--brand); }
.avatar.ring.seen { box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 5px var(--border); }

/* ---------- En-tête de discussion ---------- */
.chat-placeholder { margin: auto; text-align: center; padding: 24px; max-width: 460px; position: relative; }
.chat-placeholder img { width: 140px; border-radius: 28px; box-shadow: var(--shadow); }
.chat-placeholder h2 { font-size: 26px; margin: 22px 0 8px; }
.chat-placeholder p { color: var(--text-2); }
.placeholder-foot { margin-top: 40px; font-size: 12.5px; color: var(--muted); }
.chat-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.chat-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; min-height: 64px; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 2; padding-top: max(8px, env(safe-area-inset-top)); }
.chat-head .back { display: none; }
.chat-id { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; padding: 4px 6px; border-radius: 12px; }
.chat-id-text { display: flex; flex-direction: column; min-width: 0; }
#chat-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub.live { color: var(--brand-700); }
.chat-actions { display: flex; gap: 2px; }
.search-bar { display: flex; gap: 4px; align-items: center; padding: 6px 10px; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 2; }
.search-bar input { flex: 1; border: 0; background: var(--bg-muted); border-radius: 10px; padding: 9px 12px; outline: none; }
#search-count { font-size: 12.5px; padding: 0 6px; white-space: nowrap; }

/* ---------- Messages ---------- */
.messages-wrap { flex: 1; position: relative; min-height: 0; }
.messages { position: absolute; inset: 0; overflow-y: auto; padding: 14px 7% 10px; display: flex; flex-direction: column; gap: 2px; scroll-behavior: auto; }
.day-sep { align-self: center; position: sticky; top: 6px; z-index: 1; background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 10px; margin: 10px 0; box-shadow: var(--shadow-sm); }
.sys { align-self: center; background: var(--surface); color: var(--text-2); font-size: 12.5px; padding: 6px 14px; border-radius: 10px; margin: 6px 0; text-align: center; max-width: 85%; box-shadow: var(--shadow-sm); }
.sys.call { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.sys.call svg { width: 16px; height: 16px; }
.sys.call.missed { color: var(--danger); }
.e2e-banner { align-self: center; display: flex; gap: 8px; align-items: flex-start; max-width: 480px; background: #FFF7D9; color: #5B4A12; font-size: 12.5px; padding: 9px 14px; border-radius: 10px; margin: 4px 0 12px; box-shadow: var(--shadow-sm); text-align: center; }
.e2e-banner svg { width: 15px; height: 15px; margin-top: 2px; }
:root[data-theme="dark"] .e2e-banner { background: #2E2A17; color: #EAD9A0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .e2e-banner { background: #2E2A17; color: #EAD9A0; } }
.unread-sep { align-self: stretch; text-align: center; margin: 10px 0; }
.unread-sep span { background: var(--brand-100); color: var(--brand-700); font-size: 12px; font-weight: 700; padding: 5px 14px; border-radius: 10px; }

.msg-row { display: flex; align-items: flex-end; gap: 6px; position: relative; }
.msg-row.out { justify-content: flex-end; }
.msg-row.first { margin-top: 8px; }
.msg-row.flash .msg { animation: flash 1.4s ease; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: var(--shadow-sm); } }
.msg { max-width: min(72%, 560px); padding: 6px 9px 5px; border-radius: 12px; box-shadow: var(--shadow-sm); background: var(--bubble-in); word-wrap: break-word; overflow-wrap: anywhere; position: relative; min-width: 76px; }
.msg-row.out .msg { background: var(--bubble-out); }
.msg-row.first:not(.out) .msg { border-top-left-radius: 4px; }
.msg-row.first.out .msg { border-top-right-radius: 4px; }
.msg-row.first:not(.out) .msg::before { content: ""; position: absolute; left: -7px; top: 0; border: 8px solid transparent; border-top-color: var(--bubble-in); border-right-color: var(--bubble-in); border-width: 0 8px 10px 0; }
.msg-row.first.out .msg::before { content: ""; position: absolute; right: -7px; top: 0; border-style: solid; border-color: var(--bubble-out) transparent transparent var(--bubble-out); border-width: 0 0 10px 8px; }
.msg-sender { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.msg-fwd { font-size: 12px; color: var(--muted); font-style: italic; display: flex; gap: 4px; align-items: center; margin-bottom: 2px; }
.msg-fwd svg { width: 14px; height: 14px; }
.msg-text { white-space: pre-wrap; font-size: 15px; }
.msg-text.big-emoji { font-size: 38px; line-height: 1.2; }
.msg-text mark { background: #FFE066; color: #000; border-radius: 3px; }
.msg-meta { float: right; display: inline-flex; gap: 3px; align-items: center; font-size: 11px; color: var(--muted); margin: 6px 0 -3px 10px; white-space: nowrap; position: relative; top: 2px; }
.msg-meta svg { width: 16px; height: 16px; }
.msg-meta .star { width: 12px; height: 12px; }
.ticks { color: var(--muted); display: inline-flex; }
.ticks.read { color: var(--read); }
.msg-deleted { font-style: italic; color: var(--muted); display: flex; gap: 6px; align-items: center; font-size: 14px; }
.msg-deleted svg { width: 16px; height: 16px; }
.quote { display: flex; gap: 0; border-radius: 8px; background: rgba(0,0,0,.05); margin-bottom: 4px; overflow: hidden; cursor: pointer; }
:root[data-theme="dark"] .quote { background: rgba(255,255,255,.06); }
.quote::before { content: ""; width: 4px; background: var(--brand); flex: none; }
.quote-body { padding: 5px 9px; min-width: 0; }
.quote-name { font-size: 12.5px; font-weight: 700; color: var(--brand-700); }
:root[data-theme="dark"] .quote-name { color: var(--brand); }
.quote-text { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.reactions { position: absolute; bottom: -18px; left: 8px; display: flex; gap: 2px; background: var(--surface); border-radius: 999px; padding: 2px 7px; box-shadow: var(--shadow-sm); font-size: 14px; cursor: pointer; border: 1px solid var(--border); z-index: 1; }
.reactions small { font-size: 11.5px; color: var(--muted); margin-left: 2px; align-self: center; }
.msg-row.has-reactions { margin-bottom: 20px; }
.msg-actions { opacity: 0; display: flex; gap: 2px; transition: opacity .12s; align-self: center; }
.msg-row:hover .msg-actions { opacity: 1; }
.msg-actions button { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--muted); background: var(--surface); box-shadow: var(--shadow-sm); }
.msg-actions button svg { width: 17px; height: 17px; }
.msg-row.out .msg-actions { order: -1; }
.msg-media { margin: -2px -5px 4px; }
.msg-media img, .msg-media video { display: block; max-width: 100%; width: 330px; max-height: 360px; object-fit: cover; border-radius: 9px; background: var(--bg-muted); }
.msg-media img { cursor: zoom-in; }
.msg-media img.loading { height: 220px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.voice { display: flex; align-items: center; gap: 10px; width: 270px; max-width: 100%; padding: 4px 2px; }
.voice .play { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-700); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.voice .play svg { width: 18px; height: 18px; }
.voice-bar { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.voice-bar i { flex: 1; background: var(--muted); opacity: .45; border-radius: 2px; min-height: 3px; }
.voice-bar i.on { background: var(--brand-700); opacity: 1; }
.voice-time { font-size: 11.5px; color: var(--muted); width: 36px; text-align: right; }
.file-card { display: flex; gap: 12px; align-items: center; padding: 10px; background: rgba(0,0,0,.045); border-radius: 10px; text-decoration: none; color: inherit; min-width: 220px; cursor: pointer; }
:root[data-theme="dark"] .file-card { background: rgba(255,255,255,.06); }
.file-icon { width: 40px; height: 48px; border-radius: 6px; background: var(--brand-700); color: #fff; font-size: 10px; font-weight: 800; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; flex: none; }
.file-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.file-size { font-size: 12px; color: var(--muted); }
.loc-card { display: block; width: 260px; border-radius: 9px; overflow: hidden; text-decoration: none; color: inherit; background: rgba(0,0,0,.045); }
.loc-map { height: 120px; background: linear-gradient(135deg, #CFEAFB, #E6F4EA); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.loc-text { padding: 8px 10px; font-size: 13.5px; font-weight: 600; }
.expiry { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); margin: 4px 4px 0; }
.expiry svg { width: 13px; height: 13px; }
.expiry.soon { color: var(--warn); font-weight: 600; }
.expired-box { display: flex; gap: 10px; align-items: center; padding: 12px; border: 1.5px dashed var(--border); border-radius: 10px; color: var(--muted); font-style: italic; font-size: 13.5px; min-width: 220px; }
.expired-box svg { width: 20px; height: 20px; }
.load-more { align-self: center; margin: 8px; }
.scroll-down { position: absolute; right: 22px; bottom: 16px; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; color: var(--text-2); z-index: 3; }
.scroll-down b { position: absolute; top: -6px; right: -4px; background: var(--brand-700); color: #fff; font-size: 11px; border-radius: 10px; min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ---------- Saisie ---------- */
.composer-zone { background: var(--bg-soft); z-index: 2; padding-bottom: env(safe-area-inset-bottom); }
.compose-context { display: flex; align-items: center; gap: 10px; padding: 8px 12px 0 16px; }
.compose-context .quote { flex: 1; margin: 0; }
.blocked-bar { padding: 14px; text-align: center; color: var(--text-2); font-size: 14px; }
.composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px 10px; }
#msg-input { flex: 1; resize: none; border: 0; border-radius: 22px; padding: 11px 16px; background: var(--surface); max-height: 160px; outline: none; box-shadow: var(--shadow-sm); line-height: 1.4; }
.send-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--brand-700); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; transition: transform .1s, background .15s; }
.send-btn:hover { background: var(--brand-600); }
.send-btn:active { transform: scale(.93); }
.send-btn .ico-send { display: none; }
.send-btn.has-text .ico-send { display: block; }
.send-btn.has-text .ico-mic { display: none; }
.recording { display: flex; align-items: center; gap: 12px; padding: 8px 12px; }
.rec-dot { width: 10px; height: 10px; background: var(--danger); border-radius: 50%; animation: blink 1s infinite; }
#rec-time { font-variant-numeric: tabular-nums; font-weight: 600; width: 44px; }
.rec-wave { flex: 1; height: 28px; display: flex; align-items: center; gap: 2px; overflow: hidden; justify-content: flex-end; }
.rec-wave i { width: 3px; background: var(--brand-700); border-radius: 2px; flex: none; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Popover, menus, sélecteur d'émojis ---------- */
.popover { position: fixed; z-index: 92; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); min-width: 210px; padding: 6px; animation: pop .12s ease; max-width: calc(100vw - 16px); }
.menu-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-align: left; font-size: 14.5px; }
.menu-item:hover { background: var(--bg-soft); }
.menu-item svg { width: 19px; height: 19px; color: var(--text-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger svg { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.react-bar { display: flex; gap: 2px; padding: 4px; }
.react-bar button { font-size: 24px; width: 42px; height: 42px; border-radius: 50%; transition: transform .1s, background .1s; }
.react-bar button:hover { background: var(--bg-muted); transform: scale(1.15); }
.react-bar button.mine { background: var(--brand-100); }
.emoji-picker { width: 340px; max-width: calc(100vw - 24px); }
.emoji-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding-bottom: 4px; overflow-x: auto; }
.emoji-tabs button { font-size: 18px; padding: 6px; border-radius: 8px; opacity: .6; }
.emoji-tabs button.active { opacity: 1; background: var(--bg-muted); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; height: 240px; overflow-y: auto; padding-top: 6px; align-content: start; }
.emoji-grid button { font-size: 24px; height: 38px; border-radius: 8px; }
.emoji-grid button:hover { background: var(--bg-muted); }

/* ---------- Modales et volets ---------- */
.modal { position: fixed; inset: 0; background: rgba(8, 20, 30, .5); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 16px; backdrop-filter: blur(2px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: var(--surface); border-radius: 20px; width: 100%; max-width: 460px; max-height: 90dvh; overflow: auto; padding: 22px; box-shadow: var(--shadow-lg); animation: pop .15s ease; }
.modal-card h3 { margin: 0 0 14px; font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pick-list { list-style: none; padding: 0; margin: 8px 0; max-height: 48dvh; overflow: auto; }
.pick-list li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.pick-list li:hover { background: var(--bg-soft); }
.pick-list li.selected { background: var(--brand-50); }
.pick-check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; flex: none; }
li.selected .pick-check { background: var(--brand-700); border-color: var(--brand-700); }
.u-name { font-weight: 600; }
.u-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-media { max-width: 100%; max-height: 300px; border-radius: 12px; display: block; margin: 0 auto 12px; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; margin-bottom: 12px; }
.preview-grid img, .preview-grid .file-card { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; min-width: 0; }
.progress { height: 6px; background: var(--bg-muted); border-radius: 3px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px; min-height: 64px; border-bottom: 1px solid var(--border); padding-top: max(12px, env(safe-area-inset-top)); }
.drawer-head h2 { font-size: 17px; margin: 0; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; }
.profile-top { text-align: center; padding: 26px 20px 18px; }
.profile-top h2 { margin: 14px 0 2px; font-size: 22px; }
.profile-top .muted { font-size: 14px; }
.profile-actions { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }
.profile-actions button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--border); min-width: 82px; font-size: 12.5px; color: var(--brand-700); font-weight: 600; }
.profile-actions button:hover { background: var(--bg-soft); }
.block-card { border-top: 8px solid var(--bg-soft); padding: 14px 20px; }
.block-card h4 { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.setting { display: flex; align-items: center; gap: 14px; padding: 13px 20px; cursor: pointer; }
.setting:hover { background: var(--bg-soft); }
.setting .s-ico { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-700); flex: none; font-size: 18px; }
.setting .s-main { flex: 1; min-width: 0; }
.setting .s-title { font-weight: 600; }
.setting .s-sub { font-size: 13px; color: var(--muted); }
.setting.danger .s-title, .setting.danger .s-ico { color: var(--danger); }
.setting.danger .s-ico { background: rgba(229, 72, 77, .1); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.media-grid .cell { aspect-ratio: 1; border-radius: 8px; background: var(--bg-muted) center/cover; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 22px; position: relative; overflow: hidden; }
.media-grid .cell video { width: 100%; height: 100%; object-fit: cover; }
.safety-code { display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: 6px 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 17px; letter-spacing: 1px; background: var(--bg-soft); padding: 14px; border-radius: 12px; margin: 10px 0; }
.avatar-edit { position: relative; display: inline-block; cursor: pointer; }
.avatar-edit .cam { position: absolute; right: 4px; bottom: 4px; width: 38px; height: 38px; border-radius: 50%; background: var(--brand-700); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); border: 3px solid var(--bg); }
.avatar-edit .cam svg { width: 18px; height: 18px; }
.cropper { position: relative; width: 280px; height: 280px; margin: 0 auto; border-radius: 16px; overflow: hidden; background: #000; touch-action: none; cursor: grab; }
.cropper img { position: absolute; max-width: none; max-height: none; left: 0; top: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; }
.cropper::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.55); pointer-events: none; }
.zoom-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; }
.zoom-row input { flex: 1; accent-color: var(--brand-700); }

/* ---------- Visionneuse photo ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(4, 10, 16, .94); z-index: 80; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 96vw; max-height: 86dvh; border-radius: 6px; }
.lb-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 12px 14px; color: #fff; }
.lb-top span { flex: 1; font-weight: 600; }
.lb-top .icon-btn { color: #fff; font-size: 20px; }
.lb-top .icon-btn:hover { background: rgba(255,255,255,.12); }

/* ---------- Statuts ---------- */
.status-mine { display: flex; gap: 14px; align-items: center; padding: 12px 20px; cursor: pointer; }
.status-mine:hover { background: var(--bg-soft); }
.status-add { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-700); color: #fff; border: 2px solid var(--bg); font-size: 14px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.viewer { position: fixed; inset: 0; z-index: 85; background: #000; display: flex; align-items: center; justify-content: center; color: #fff; }
.viewer-bars { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; gap: 4px; z-index: 2; padding-top: env(safe-area-inset-top); }
.viewer-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); overflow: hidden; }
.viewer-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.viewer-head { position: absolute; top: 22px; left: 12px; right: 12px; display: flex; align-items: center; gap: 10px; z-index: 2; padding-top: env(safe-area-inset-top); }
.viewer-head .icon-btn { color: #fff; }
.viewer-content { max-width: 100%; max-height: 100%; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.viewer-content img, .viewer-content video { max-width: 100%; max-height: 100%; }
.status-text { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 40px; font-size: clamp(22px, 5vw, 38px); font-weight: 600; text-align: center; white-space: pre-wrap; }
.viewer-foot { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; z-index: 2; padding-bottom: env(safe-area-inset-bottom); }
.viewer-foot .caption { margin-bottom: 12px; font-size: 16px; text-shadow: 0 1px 4px rgba(0,0,0,.6); padding: 0 20px; }
.viewer-nav { position: absolute; top: 0; bottom: 0; width: 30%; z-index: 1; }
.viewer-nav.prev { left: 0; } .viewer-nav.next { right: 0; }
.status-compose { width: 100%; min-height: 220px; border-radius: 16px; display: flex; align-items: center; justify-content: center; padding: 18px; }
.status-compose textarea { width: 100%; background: transparent; border: 0; outline: none; color: #fff; font-size: 24px; font-weight: 600; text-align: center; resize: none; }
.status-compose textarea::placeholder { color: rgba(255,255,255,.75); }
.color-dots { display: flex; gap: 8px; justify-content: center; margin: 12px 0; }
.color-dots button { width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; }
.color-dots button.active { border-color: var(--text); }

/* ---------- Appels ---------- */
.call-screen { position: fixed; inset: 0; z-index: 88; background: radial-gradient(circle at 50% 30%, #1B4F72, #0A1A26 70%); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 60px 20px 40px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.call-screen video.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-screen video.local { position: absolute; right: 16px; top: 16px; width: 120px; height: 170px; object-fit: cover; border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 2; background: #000; transform: scaleX(-1); }
.call-info { text-align: center; z-index: 2; }
.call-info h2 { margin: 18px 0 6px; font-size: 26px; }
.call-info .state { opacity: .85; }
.call-info .e2e { font-size: 12px; opacity: .7; margin-top: 10px; }
.call-buttons { display: flex; gap: 22px; z-index: 2; }
.call-btn { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.call-btn svg { width: 28px; height: 28px; }
.call-btn.off { background: #fff; color: #0A1A26; }
.call-btn.hang { background: var(--danger); }
.call-btn.accept { background: var(--success); animation: ring 1.2s infinite; }
@keyframes ring { 50% { transform: scale(1.08); } }
.call-screen.video-on .call-info { position: absolute; top: 0; left: 0; right: 0; padding: 36px 20px 40px; background: linear-gradient(rgba(0,0,0,.55), transparent); text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.call-screen.video-on .call-info h2 { margin-top: 0; }
.call-screen.video-on .call-buttons { position: absolute; left: 0; right: 0; bottom: 0; justify-content: center; padding: 50px 20px max(32px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.55)); }
.call-screen.video-on video.local { top: auto; bottom: 150px; }
.call-screen.video-on .call-info .avatar { display: none; }
.call-mini { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 87; background: var(--success); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }

.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: #142533; color: #fff; padding: 11px 20px; border-radius: 14px; z-index: 95; max-width: 90vw; box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .15s; }

/* ---------- Proposition d'installation ---------- */
.install-sheet { position: fixed; inset: 0; z-index: 96; background: rgba(8, 20, 30, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.install-card { position: relative; width: 100%; max-width: 480px; background: var(--surface); color: var(--text); border-radius: 22px 22px 0 0; padding: 22px 20px max(20px, env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: slideup .25s ease; }
.install-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.install-head img { width: 56px; height: 56px; border-radius: 14px; }
.install-head h3 { margin: 0 0 2px; font-size: 19px; }
.install-close { position: absolute; top: 10px; right: 10px; }
.install-steps { list-style: none; padding: 0; margin: 12px 0 4px; display: grid; gap: 12px; }
.install-steps li { display: flex; align-items: center; gap: 12px; }
.install-steps .n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.install-steps .ios-share { color: #0A84FF; font-size: 18px; }
.install-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.install-actions .btn { flex: 1; }
@keyframes slideup { from { transform: translateY(100%); } }

/* ---------- Tablette ---------- */
@media (max-width: 1200px) { .drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: var(--shadow-lg); width: min(400px, 100vw); } }
@media (max-width: 1024px) { :root { --side-w: 340px; } }

/* ---------- Mobile : une colonne, onglets en bas ---------- */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .rail { order: 2; width: 100%; flex-direction: row; justify-content: space-around; padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); background: var(--bg); gap: 0; }
  .rail-logo, .rail-spacer, .rail-me, .rail-btn[data-pane="starred"] { display: none; }
  .rail-btn { width: auto; flex: 1; font-size: 11px; }
  .rail-btn.active { background: transparent; }
  .rail-btn.active svg { background: var(--brand-100); border-radius: 999px; width: 56px; padding: 2px 16px; box-sizing: content-box; height: 22px; }
  .sidebar { order: 1; width: 100%; flex: 1 1 0; min-height: 0; overflow: hidden; border-right: 0; position: relative; }
  .rail { flex: none; }
  .app { overflow: hidden; }
  .pane-head { padding-top: max(14px, env(safe-area-inset-top)); }
  .fab { display: flex; }
  .head-new { display: none; }
  .chat { position: fixed; inset: 0; transform: translateX(100%); transition: transform .22s ease; z-index: 20; }
  .app.chat-open .chat { transform: none; }
  .chat-head .back { display: inline-flex; }
  .chat-head .icon-btn { width: 38px; }
  .messages { padding: 10px 10px 8px; }
  .msg { max-width: 84%; }
  .msg-actions { display: none; }
  .drawer { position: fixed; inset: 0; width: 100%; z-index: 45; }
  .row-menu { display: none; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: 22px 22px 0 0; max-height: 92dvh; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
}

/* ---------------------------------------------------------------- Administration des comptes */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 0 14px 10px; }
.adm-stat { background: var(--bg-muted); border-radius: 14px; padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-stat b { font-size: 18px; font-weight: 800; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-stat span { font-size: 12px; color: var(--muted); }
.adm-stat.ok b { color: #16a34a; }
.adm-stat.bad b { color: var(--danger); }
.adm-user { display: flex; align-items: center; gap: 12px; padding: 11px 16px 11px 20px; cursor: pointer; border-bottom: 1px solid var(--border); }
.adm-user:hover { background: var(--bg-soft); }
.adm-user.suspended { background: color-mix(in srgb, var(--danger) 6%, transparent); }
.adm-user > svg { flex: none; transform: rotate(-90deg); color: var(--muted); width: 18px; height: 18px; }
.adm-main { flex: 1; min-width: 0; }
.adm-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.adm-name .u-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.adm-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--bg-muted); color: var(--text-2); white-space: nowrap; flex: none; }
.adm-badge.admin { background: var(--brand-100); color: var(--brand-700); }
.adm-badge.ok { background: color-mix(in srgb, #16a34a 14%, transparent); color: #15803d; }
.adm-badge.warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #b45309; }
.adm-badge.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.adm-more { margin: 14px auto 24px; width: calc(100% - 40px); }
.admin-loading { padding: 24px 20px; text-align: center; }
.adm-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.adm-head h3 { margin: 0 0 2px; }
.adm-lines { display: grid; gap: 0; margin: 6px 0 14px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.adm-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 14px; font-size: 14px; }
.adm-line + .adm-line { border-top: 1px solid var(--border); }
.adm-line span:last-child { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.adm-actions { display: grid; gap: 8px; }
.adm-actions:empty { display: none; }
@media (max-width: 560px) {
  .adm-stats { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .adm-stat { padding: 7px 8px; border-radius: 12px; }
  .adm-stat b { font-size: 15px; }
  .adm-stat span { font-size: 10.5px; line-height: 1.2; }
}

/* v2.12 — carnet de contacts (ajout d'un numéro dans « Nouvelle discussion ») */
.contact-add { display: flex; gap: 8px; margin-bottom: 10px; }
.contact-add .input { flex: 1; min-width: 0; }
.contact-add .btn { flex: none; }
.pick-list li .pick-remove { width: 32px; height: 32px; opacity: .6; }
.pick-list li .pick-remove:hover { opacity: 1; }
.pick-list li .pick-remove svg { width: 16px; height: 16px; }

/* v2.14 — création de groupe simplifiée (participants cochés, puces, puis nom et photo) */
.head-group { display: inline-flex; }
.new-group-entry { margin-bottom: 8px; padding: 12px; background: var(--brand-50); }
.new-group-entry:hover { background: var(--brand-100); }
.new-group-entry > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.new-group-entry small { color: var(--muted); font-size: 12.5px; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.empty-actions .btn svg { width: 18px; height: 18px; margin-right: 6px; fill: currentColor; vertical-align: -3px; }
.modal-card.ng-card { max-width: 480px; display: flex; flex-direction: column; padding: 0; overflow: hidden; height: min(720px, 90dvh); }
.modal-card.ng-card #modal-body { flex: 1; min-height: 0; display: flex; }
.ng { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 18px 18px; overflow: auto; }
.ng-head { display: flex; align-items: center; gap: 10px; padding: 14px 0 10px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.ng-title { min-width: 0; }
.ng-head h3 { margin: 0; font-size: 18px; }
.ng-sub { font-size: 13px; color: var(--muted); }
.ng-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; flex: none; }
.ng-chips::-webkit-scrollbar { display: none; }
.ng-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: 999px; background: var(--bg-muted); flex: none; font-size: 13.5px; font-weight: 600; color: var(--text); animation: pop .15s ease; }
.ng-chip .avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.ng-chip i { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; background: var(--text-2); color: var(--surface); align-items: center; justify-content: center; }
.ng-chip i svg { width: 11px; height: 11px; }
.ng-search { margin-bottom: 8px; flex: none; }
.ng .contact-add { flex: none; }
.ng-list { max-height: none; flex: 1; margin: 0 -8px; padding-bottom: 76px; overflow: visible; }
.ng-list li { padding: 9px 10px; }
.ng-list li:focus-visible { outline: 2px solid var(--brand-700); outline-offset: -2px; }
.ng-box { margin-left: auto; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex: none; color: transparent; transition: background .12s, border-color .12s; }
.ng-box svg { width: 16px; height: 16px; }
.ng-list li.selected .ng-box { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.ng-next { position: sticky; bottom: 0; align-self: flex-end; margin-top: auto; display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px 0 22px; border-radius: 999px; background: var(--brand-700); color: #fff; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); opacity: .45; transform: translateY(0); transition: opacity .15s; z-index: 2; }
.ng-next.on { opacity: 1; }
.ng-next svg { width: 20px; height: 20px; }
.ng-ident { display: flex; align-items: center; gap: 14px; margin: 8px 0 14px; }
.ng-photo { position: relative; width: 84px; height: 84px; border-radius: 50%; flex: none; background: var(--bg-muted); color: var(--text-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background-size: cover; background-position: center; border: 2px dashed var(--border); }
.ng-photo svg { width: 28px; height: 28px; }
.ng-photo.has-img { border: 0; }
.ng-photo-lbl { font-size: 11.5px; font-weight: 600; }
.ng-name { flex: 1; min-width: 0; }
.ng-name-row { position: relative; }
.ng-name-row .input { padding-right: 40px; font-size: 16px; }
.ng-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); }
.ng-name .hint { margin: 6px 0 0; }
.ng-members-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; color: var(--text-2); margin: 6px 0 8px; }
.ng-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px 6px; margin-bottom: 16px; }
.ng-member { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; min-width: 0; }
.ng-member span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ng-foot { position: sticky; bottom: 0; margin-top: auto; padding-top: 10px; background: var(--surface); }
.ng-create { height: 50px; font-size: 15.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.ng-create svg { width: 20px; height: 20px; }
@media (max-width: 760px) {
  .modal-card.ng-card { height: 100dvh; max-height: 100dvh; border-radius: 0; padding-bottom: 0; }
  .ng { padding: 0 14px max(14px, env(safe-area-inset-bottom)); }
  .ng-head { padding-top: max(12px, env(safe-area-inset-top)); }
}
.avatar.group.has-img { background-size: cover; background-position: center; }
.empty-actions .btn:not(.primary) { color: var(--brand-700); border-color: var(--brand-100); }

/* v2.16 — photo du groupe modifiable par les administrateurs du groupe */
.group-photo { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.group-photo-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 999px; background: var(--brand-50); color: var(--brand-700); font-weight: 700; font-size: 14px; }
.group-photo-btn:hover { background: var(--brand-100); }
.group-photo-btn svg { width: 18px; height: 18px; }

/* ---- v2.18 : mot de passe oublié ---- */
.link-btn { display: block; margin: -6px 0 12px auto; padding: 4px 0; background: none; border: 0; color: var(--brand-700); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.reset-box form > .btn, .reset-box > div > .btn { margin-top: 8px; }
.reset-done { text-align: center; background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: 16px; padding: 16px; margin-bottom: 8px; }
.reset-done .nm-icon { font-size: 34px; line-height: 1; }
.reset-done p { margin: 10px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.reset-warn { background: color-mix(in srgb, #faad14 13%, var(--surface)); border: 1px solid color-mix(in srgb, #faad14 45%, transparent); color: var(--text); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.45; margin: 2px 0 12px; }
.adm-resets { margin: 0 14px 12px; border: 1.5px solid color-mix(in srgb, #faad14 45%, transparent); background: color-mix(in srgb, #faad14 8%, var(--surface)); border-radius: 16px; padding: 10px 12px; }
.adm-resets-title { font-weight: 700; font-size: 14px; margin: 2px 2px 8px; }
.adm-reset { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 2px; }
.adm-reset-state { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.adm-reset + .adm-reset { border-top: 1px solid var(--border); }
.adm-reset .adm-main { flex: 1; min-width: 0; }
.adm-reset .u-sub { white-space: normal; }
.adm-reset-btns { display: flex; gap: 6px; width: 100%; justify-content: flex-end; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.adm-actions a.btn { text-decoration: none; }
.adm-tel { color: inherit; text-decoration: none; }
.adm-tel:hover { text-decoration: underline; }
