/* ════════════════════════════════════════════════════════════════════════
   und3rgr0und messenger — look MSN / Windows Live Messenger (ère Vista, Aero)
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* Aero blues */
  --aero-0: #f4faff;
  --aero-1: #eaf4fd;
  --aero-2: #d2e8fb;
  --aero-3: #b6d8f5;
  --aero-4: #8fbfe8;
  --blue:    #2e8bda;
  --blue-dk: #1567b0;
  --blue-dkr:#0e4f8c;
  --frame:   #6aa6dc;
  --frame-dk:#3d7cba;

  /* status */
  --green:   #76c043;
  --green-dk:#54a02c;
  --amber:   #f0a429;
  --red:     #df4a2e;
  --grey:    #a7b6c2;

  /* text */
  --ink:     #16334d;
  --ink-soft:#52708a;
  --psm:     #80929f;

  --win-radius: 7px;
  --shadow: 0 10px 34px rgba(8,40,80,.42), 0 2px 6px rgba(8,40,80,.28);
  --font: "Segoe UI", "Segoe UI Web", "Frutiger", "Helvetica Neue", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── Bureau / fond Vista "aurora" ─────────────────────────────────────────*/
#desktop {
  position: fixed;
  inset: 0;
  overflow: auto;
  background:
    radial-gradient(1200px 600px at 18% -10%, rgba(120,220,180,.55), transparent 60%),
    radial-gradient(1000px 700px at 90% 0%, rgba(90,170,250,.55), transparent 55%),
    radial-gradient(900px 900px at 60% 120%, rgba(40,120,210,.65), transparent 60%),
    linear-gradient(160deg, #0c3f78 0%, #11589e 38%, #1c74bd 70%, #2a8fcf 100%);
  background-attachment: fixed;
}
#desktop::after { /* voile de lumière en bas, façon Aurora Vista */
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(1400px 360px at 50% 118%, rgba(180,255,235,.40), transparent 70%);
}

.hidden { display: none !important; }

/* ── Cadre de fenêtre générique (Aero glass) ──────────────────────────────*/
.window {
  background: linear-gradient(#ffffff, #fbfdff);
  border: 1px solid var(--frame-dk);
  border-radius: var(--win-radius) var(--win-radius) 4px 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

/* Barre de titre verre Aero */
.titlebar {
  display: flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 6px 0 9px;
  background:
    linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.18) 48%, rgba(255,255,255,0) 50%),
    linear-gradient(180deg, #dcecfb 0%, #c2def4 45%, #a9cef0 55%, #c7e3f8 100%);
  border-bottom: 1px solid #8fbce4;
  border-radius: var(--win-radius) var(--win-radius) 0 0;
  color: #14406e;
  text-shadow: 0 1px 0 rgba(255,255,255,.75);
  user-select: none;
  cursor: default;
}
.titlebar[data-drag] { cursor: move; }
.titlebar-icon {
  width: 16px; height: 16px; flex: none; border-radius: 3px;
  background: center/contain no-repeat;
}
.titlebar-icon[data-icon="logo"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%2390de54'/%3E%3Cstop offset='1' stop-color='%234e9e1f'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='24' height='24' rx='6' fill='url(%23g)'/%3E%3Cpath fill='%23fff' d='M12 5.4a3 3 0 110 6 3 3 0 010-6zm0 7.4c3.4 0 6.2 1.7 6.2 3.9V18H5.8v-1.3c0-2.2 2.8-3.9 6.2-3.9z'/%3E%3C/svg%3E");
}
.titlebar-icon[data-icon="chat"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect width='24' height='24' rx='6' fill='%232e8bda'/%3E%3Cpath fill='%23fff' d='M5 7.5A1.5 1.5 0 016.5 6h11A1.5 1.5 0 0119 7.5v6A1.5 1.5 0 0117.5 15H10l-3.4 2.8c-.5.4-1.1 0-1.1-.6V15z'/%3E%3C/svg%3E");
}
.titlebar-text {
  flex: 1; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Boutons de contrôle façon Vista (verre arrondi) */
.win-controls { display: flex; gap: 3px; }
.wc {
  width: 25px; height: 18px; font-size: 0; line-height: 0;
  border: 1px solid #7fa9cf; border-radius: 4px;
  background: linear-gradient(#fdfefe, #d6e6f5 49%, #bcd6ee 51%, #d9eaf8);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
  color: #194a78; cursor: pointer; display: grid; place-items: center;
}
.wc:hover  { background: linear-gradient(#ffffff, #e6f1fb 49%, #cfe4f7 51%, #eaf5ff); }
.wc:active { background: linear-gradient(#bcd6ee, #d9eaf8); }
.wc::before { font-size: 11px; font-weight: 700; line-height: 1; }
.wc-min::before  { content: "—"; font-size: 9px; transform: translateY(-3px); }
.wc-max::before  { content: "❐"; }
.wc-close { border-color: #c98; }
.wc-close::before { content: "✕"; }
.wc-close:hover { background: linear-gradient(#ffd9cf,#f3a78f 50%,#e4795c 52%,#f4b09a); color:#5a1500; border-color:#c46a4d;}

/* ── Avatars (display pictures) ───────────────────────────────────────────*/
.dp {
  flex: none; border-radius: 4px;
  background: linear-gradient(160deg, #6db4f0, #2c6fb5);
  border: 2px solid #fff;
  outline: 1px solid #6a9cc9;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.35);
  overflow: hidden; background-clip: padding-box;
}
.dp-lg { width: 76px; height: 76px; font-size: 32px; border-radius: 5px; }
.dp-md { width: 50px; height: 50px; font-size: 22px; }
.dp-sm { width: 30px; height: 30px; font-size: 14px; border-width: 1px; }
/* silhouette générique (avatar par défaut, ex. écran de connexion) */
.dp[data-avatar="classic"]::after,
.dp.is-empty::after {
  content: ""; width: 70%; height: 70%;
  background: center/contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,.92)' d='M12 5a3.2 3.2 0 110 6.4A3.2 3.2 0 0112 5zm0 7.8c3.6 0 6.6 1.8 6.6 4.1V19H5.4v-2.1c0-2.3 3-4.1 6.6-4.1z'/%3E%3C/svg%3E");
}
.dp[data-avatar="classic"], .dp.is-empty { color: transparent; }

/* ── Pastilles de statut (petit bonhomme MSN coloré) ──────────────────────*/
.status-dot {
  width: 13px; height: 13px; flex: none; border-radius: 50%;
  background: var(--grey) center/9px no-repeat;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.6), 0 0 0 1px rgba(0,0,0,.12);
  position: relative;
}
.status-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: center/8px 8px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,.95)' d='M12 5a3 3 0 110 6 3 3 0 010-6zm0 6.8c3.3 0 6 1.5 6 3.4V18H6v-2.8c0-1.9 2.7-3.4 6-3.4z'/%3E%3C/svg%3E");
}
.status-online   { background-color: var(--green);  box-shadow: inset 0 1px 1px rgba(255,255,255,.7), 0 0 4px rgba(118,192,67,.8), 0 0 0 1px rgba(0,0,0,.12); }
.status-away     { background-color: var(--amber); }
.status-busy     { background-color: var(--red); }
.status-busy::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='10.5' width='12' height='3' rx='1.5' fill='%23fff'/%3E%3C/svg%3E"); }
.status-invisible, .status-offline { background-color: var(--grey); }
.status-invisible::after, .status-offline::after { opacity: .55; }

/* ════════════════════════════════════════════════════════════════════════
   ÉCRAN DE CONNEXION
   ════════════════════════════════════════════════════════════════════════ */
.signin-window {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 340px; max-width: calc(100vw - 24px);
}
.signin-scene {
  height: 92px;
  background:
    radial-gradient(120px 60px at 80% 10%, rgba(255,255,255,.5), transparent 60%),
    linear-gradient(135deg, #1f8fd6, #1466ad 60%, #0d4f8f);
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid #0c4178;
  position: relative; overflow: hidden;
}
.signin-scene::before { /* reflet vitré */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 46px;
  background: linear-gradient(rgba(255,255,255,.32), rgba(255,255,255,0));
}
.signin-logo { display: flex; align-items: center; gap: 10px; z-index: 1; }
.butterfly {
  width: 46px; height: 46px; flex: none;
  background: center/contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='b' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23a6ec6a'/%3E%3Cstop offset='1' stop-color='%23409a17'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23b)' d='M24 14c5-9 20-10 20 1 0 7-9 12-20 12 11 0 20 5 20 12 0 11-15 10-20 1-5 9-20 10-20-1 0-7 9-12 20-12-11 0-20-5-20-12 0-11 15-10 20-1z'/%3E%3Cellipse cx='24' cy='24' rx='3.2' ry='8' fill='%232f7d10'/%3E%3C/svg%3E");
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
.signin-wordmark {
  font-size: 26px; font-weight: 300; letter-spacing: .5px; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.signin-body { padding: 16px 22px 6px; }
.signin-dp { display: flex; justify-content: center; margin: -54px 0 10px; position: relative; z-index: 2; }
.signin-dp .dp { box-shadow: 0 3px 10px rgba(0,0,0,.4); }

.signin-form { display: flex; flex-direction: column; gap: 9px; }
.form-intro { margin: 0 0 2px; font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
.field { display: flex; align-items: center; gap: 8px; }
.field-label { width: 92px; text-align: right; color: var(--ink-soft); font-size: 12px; flex: none; }
.field input, .status-select {
  flex: 1; min-width: 0; padding: 6px 8px; font: inherit; font-size: 13px;
  border: 1px solid #9cbcd8; border-radius: 4px; background: #fff; color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
}
.field input:focus, .status-select:focus {
  outline: none; border-color: var(--blue);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.07), 0 0 0 3px rgba(46,139,218,.22);
}
.field-status .field-label { width: 92px; }
.checkrow { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); padding-left: 100px; }
.signin-switch { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 8px 0 4px; }
.signin-switch a, a.link { color: var(--blue-dk); }
.signin-foot {
  text-align: center; font-size: 11px; color: #6f8aa3; padding: 6px 0 10px;
  background: linear-gradient(#f3f9ff, #e7f1fb); border-top: 1px solid #d6e6f4;
}
.form-error { color: #c0392b; font-size: 12px; min-height: 16px; margin: 0; text-align: center; }

/* Bouton principal (verre bleu) */
.btn-primary {
  appearance: none; border: 1px solid var(--blue-dk); border-radius: 5px;
  padding: 8px 16px; font: inherit; font-weight: 600; color: #fff; cursor: pointer;
  background: linear-gradient(#56a8e6, #2b7fcc 49%, #1f6fbd 51%, #2b86d4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 2px rgba(0,0,0,.2);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.btn-primary:hover  { background: linear-gradient(#6cb6ee, #3a8cd6 49%, #2a7ccb 51%, #3a93dd); }
.btn-primary:active { background: linear-gradient(#1f6fbd, #2b86d4); }
.btn-signin { align-self: center; min-width: 150px; margin-top: 4px; }

/* ════════════════════════════════════════════════════════════════════════
   FENÊTRE PRINCIPALE (liste de contacts)
   ════════════════════════════════════════════════════════════════════════ */
.main-window {
  position: absolute; top: 24px; left: 24px;
  width: 308px; height: calc(100vh - 48px); max-height: 760px;
  display: flex; flex-direction: column;
}

/* entête "moi" sur scène bleue */
.me-bar {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px;
  background:
    radial-gradient(140px 70px at 82% -20%, rgba(255,255,255,.45), transparent 60%),
    linear-gradient(135deg, #2a8ad2, #155fa6 65%, #0e4f90);
  color: #fff; border-bottom: 1px solid #0c4178;
}
.me-dp { cursor: pointer; }
.me-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.me-name-btn, .me-psm {
  appearance: none; background: transparent; border: 1px solid transparent; border-radius: 4px;
  color: #fff; font: inherit; text-align: left; cursor: pointer; padding: 2px 5px;
  display: flex; align-items: center; gap: 7px; max-width: 100%;
}
.me-name-btn:hover, .me-psm:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); }
.me-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.me-name-btn .status-dot { box-shadow: inset 0 1px 1px rgba(255,255,255,.7), 0 0 0 1px rgba(255,255,255,.5); }
.caret { font-size: 0; }
.caret::before { content: "▾"; font-size: 10px; }
.me-psm { font-size: 12px; color: rgba(255,255,255,.88); }
.me-psm-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
.me-psm-text.placeholder { opacity: .7; }

/* barre d'outils */
.toolbar {
  display: flex; align-items: center; gap: 2px; padding: 4px 6px;
  background: linear-gradient(#f3f9ff, #e2eefb); border-bottom: 1px solid #cfe0f0;
}
.tool-btn {
  appearance: none; border: 1px solid transparent; border-radius: 4px; background: transparent;
  font: inherit; font-size: 12px; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; gap: 5px; padding: 4px 8px;
}
.tool-btn:hover { background: #d7e9fb; border-color: #a9cdee; }
.tool-btn.icon-only { padding: 4px 6px; }
.toolbar-spacer { flex: 1; }
.ti { width: 16px; height: 16px; flex: none; background: center/contain no-repeat; }
.ti-add   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231f6fbd' d='M10 4a3.4 3.4 0 110 6.8A3.4 3.4 0 0110 4zm0 8c3.3 0 6 1.6 6 3.7V18H4v-2.3C4 13.6 6.7 12 10 12z'/%3E%3Cpath fill='%2354a02c' d='M18 12h2v3h3v2h-3v3h-2v-3h-3v-2h3z'/%3E%3C/svg%3E"); }
.ti-token { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e0a52b' d='M9 4a5 5 0 014.9 6H21l1 2-2 2-1.5-1-1.5 1-1.6-1.1A5 5 0 119 4zm-1.3 3.2A1.7 1.7 0 109 9.6a1.7 1.7 0 00-1.3-2.4z'/%3E%3C/svg%3E"); }
.ti-sound { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%231f6fbd' d='M4 9h3l4-3v12l-4-3H4z'/%3E%3Cpath fill='none' stroke='%231f6fbd' stroke-width='1.6' d='M14 8.5a4 4 0 010 7M16.5 6a7 7 0 010 12'/%3E%3C/svg%3E"); }
.tool-btn.muted .ti-sound { opacity: .4; }
.tool-btn.muted .ti-sound + * { text-decoration: line-through; }

/* recherche */
.search-row { padding: 6px 8px; background: #eef6ff; border-bottom: 1px solid #d8e7f5; }
.search-row input {
  width: 100%; padding: 5px 9px; font: inherit; font-size: 12px;
  border: 1px solid #a9c6e2; border-radius: 11px; background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
.search-row input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46,139,218,.18); }

/* liste */
.contacts-scroll { flex: 1; overflow-y: auto; background: linear-gradient(#ffffff, #f5faff); }
.group-head {
  width: 100%; appearance: none; border: 0; background: transparent; text-align: left;
  font-size: 12px; font-weight: 700; color: var(--blue-dk); cursor: pointer;
  padding: 7px 10px 4px; display: flex; align-items: center; gap: 6px;
}
.group-caret { font-size: 0; transition: transform .12s; }
.group-caret::before { content: "▾"; font-size: 10px; }
.group.collapsed .group-caret { transform: rotate(-90deg); }
.group.collapsed .group-body { display: none; }
.group-count { color: var(--ink-soft); font-weight: 400; }
.group-body { padding-bottom: 4px; }

.contact-row {
  width: 100%; appearance: none; border: 0; background: transparent; text-align: left;
  display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 16px; cursor: pointer;
}
.contact-row:hover { background: #dcecfd; background: linear-gradient(#eaf4ff, #d6e9fb); }
.contact-row .dp { transition: transform .1s; }
.contact-row.is-offline .dp, .contact-row.is-offline .contact-name { opacity: .5; filter: grayscale(.6); }
.contact-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.contact-name { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-psm { font-size: 11px; color: var(--psm); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-row .contact-status { width: 12px; height: 12px; }
.contact-row.has-unread { background: linear-gradient(#fff7d8, #ffeeb0); }
.contact-row.has-unread .contact-name { font-weight: 700; }
.contact-row .unread-badge {
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
  display: grid; place-items: center;
}

/* demandes d'ami */
.requests-block { border-bottom: 1px solid #ead9a0; background: linear-gradient(#fffdf2, #fff6d8); }
.requests-block .group-head { color: #9a6a12; }
.request-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px 8px 16px; }
.request-text { flex: 1; font-size: 12px; color: var(--ink); }
.request-actions { display: flex; gap: 4px; }
.mini-btn {
  appearance: none; border: 1px solid #9cbcd8; border-radius: 4px; cursor: pointer;
  font: inherit; font-size: 11px; padding: 3px 8px;
  background: linear-gradient(#fff, #e6f0fa);
}
.mini-btn:hover { background: linear-gradient(#fff, #d7e8f8); }
.mini-btn.accept { border-color: var(--green-dk); color: #2f6b14; background: linear-gradient(#eafbe0, #cdeeb6); }
.mini-btn.decline { color: #93341f; }

.empty-hint { padding: 22px 20px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; text-align: center; }

.main-foot {
  padding: 6px 10px; font-size: 11px; color: var(--ink-soft);
  background: linear-gradient(#eef6ff, #ddebf9); border-top: 1px solid #cfe0f0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ════════════════════════════════════════════════════════════════════════
   FENÊTRE DE CONVERSATION
   ════════════════════════════════════════════════════════════════════════ */
#chat-windows { position: absolute; inset: 0; pointer-events: none; }
.chat-window {
  position: absolute; width: 470px; height: 430px;
  display: flex; flex-direction: column; pointer-events: auto;
  min-width: 320px; min-height: 280px;
}
.chat-window.focused { box-shadow: 0 14px 44px rgba(8,40,80,.5), 0 0 0 1px var(--blue); }

.chat-menubar {
  display: flex; gap: 14px; padding: 3px 12px; font-size: 12px; color: #3a5a76;
  background: linear-gradient(#fbfdff, #eef5fc); border-bottom: 1px solid #dde9f4; user-select: none;
}
.chat-menubar span { cursor: default; }
.chat-menubar span:hover { color: var(--blue-dk); }

.chat-contact-strip {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  background: linear-gradient(#eaf4fe, #d6e9fb); border-bottom: 1px solid #b9d6ee;
}
.strip-name { font-weight: 700; color: var(--ink); }
.strip-psm { flex: 1; min-width: 0; color: var(--psm); font-style: italic; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lock-badge { flex: none; font-size: 11px; color: #9a6a12; background: #fff3d4; border: 1px solid #ecd28a; border-radius: 10px; padding: 1px 9px; white-space: nowrap; }
.lock-badge.on { color: #2f6b14; background: #e7f7da; border-color: #b6e097; }

.chat-main { flex: 1; display: flex; min-height: 0; }
.chat-left { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-right {
  width: 96px; flex: none; padding: 12px 10px; display: flex; flex-direction: column;
  align-items: center; gap: 12px; background: linear-gradient(#f0f7ff, #e0edfb);
  border-left: 1px solid #cfe0f0;
}
.chat-right .dp { width: 72px; height: 72px; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 10px 12px; background: #fff;
  display: flex; flex-direction: column; gap: 9px; min-height: 0;
}
.msg-line { font-size: 13px; line-height: 1.4; max-width: 100%; }
.msg-head { font-weight: 700; font-size: 12px; margin-bottom: 1px; }
.msg-head .msg-time { font-weight: 400; color: #9aa9b6; font-size: 11px; margin-left: 6px; }
.msg-line.from-me   .msg-head { color: #2b6fb5; }
.msg-line.from-them .msg-head { color: #3f8a2a; }
.msg-body { color: #1f2b36; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body .emoticon { width: 19px; height: 19px; vertical-align: -4px; }
.msg-sys {
  align-self: center; color: #8a98a4; font-size: 11.5px; font-style: italic;
  background: #f1f5f9; border-radius: 10px; padding: 2px 12px;
}
.msg-nudge { align-self: center; color: #b06a00; font-weight: 600; font-size: 12px; background: #fff4d6; border: 1px solid #f0d488; border-radius: 10px; padding: 3px 12px; }

.chat-typing { height: 18px; padding: 0 12px; font-size: 11.5px; color: #7a8893; font-style: italic; background: #fff; }

.chat-format-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 4px 8px;
  background: linear-gradient(#f4f9ff, #e6f0fa); border-top: 1px solid #d3e3f2;
}
.fmt-btn {
  appearance: none; border: 1px solid transparent; border-radius: 4px; background: transparent;
  font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; padding: 3px 7px;
  display: flex; align-items: center; gap: 4px;
}
.fmt-btn:hover { background: #d7e9fb; border-color: #a9cdee; }
.ti-smiley { width:16px;height:16px; background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='9' fill='%23ffcb3d' stroke='%23d99a00'/%3E%3Ccircle cx='7' cy='8.5' r='1.3' fill='%23000'/%3E%3Ccircle cx='13' cy='8.5' r='1.3' fill='%23000'/%3E%3Cpath d='M6 12c1.6 2.2 6.4 2.2 8 0' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ti-nudge  { width:16px;height:16px; background: center/contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e8a200' d='M13 2L4 14h6l-1 8 9-12h-6z'/%3E%3C/svg%3E"); }

.chat-input-area { display: flex; gap: 8px; padding: 8px; background: linear-gradient(#eef6ff, #e0edfb); border-top: 1px solid #c9dcef; }
.chat-input {
  flex: 1; resize: none; font: inherit; font-size: 13px; padding: 7px 9px;
  border: 1px solid #a9c6e2; border-radius: 5px; background: #fff; color: var(--ink);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
.chat-input:focus { outline: none; border-color: var(--blue); box-shadow: inset 0 1px 2px rgba(0,0,0,.06), 0 0 0 3px rgba(46,139,218,.18); }
.btn-send {
  align-self: stretch; min-width: 80px;
  appearance: none; border: 1px solid var(--blue-dk); border-radius: 5px; cursor: pointer;
  font: inherit; font-weight: 600; color: #fff;
  background: linear-gradient(#56a8e6, #2b7fcc 49%, #1f6fbd 51%, #2b86d4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-send:hover { background: linear-gradient(#6cb6ee, #3a8cd6 49%, #2a7ccb 51%, #3a93dd); }
.btn-send:disabled { opacity: .5; cursor: default; }

/* secousse "wizz" */
@keyframes nudge-shake {
  0%,100% { transform: translate(0,0); }
  10% { transform: translate(-6px,-4px); } 20% { transform: translate(7px,3px); }
  30% { transform: translate(-7px,4px); }  40% { transform: translate(6px,-3px); }
  50% { transform: translate(-5px,3px); }  60% { transform: translate(5px,-2px); }
  70% { transform: translate(-3px,2px); }  80% { transform: translate(3px,-1px); }
  90% { transform: translate(-1px,1px); }
}
.nudge-shake { animation: nudge-shake .55s ease-in-out; }

/* ── Sélecteur d'émoticônes ───────────────────────────────────────────────*/
.emoticon-picker {
  position: absolute; z-index: 60; width: 210px; padding: 6px;
  background: linear-gradient(#ffffff, #eef6ff); border: 1px solid var(--frame-dk);
  border-radius: 6px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px;
}
.emoticon-pick {
  appearance: none; border: 1px solid transparent; border-radius: 4px; background: transparent;
  cursor: pointer; padding: 4px; display: grid; place-items: center;
}
.emoticon-pick:hover { background: #d7e9fb; border-color: #a9cdee; }
.emoticon-pick img { width: 21px; height: 21px; }

/* ── Menus contextuels (statut, image…) ───────────────────────────────────*/
.popup-menu {
  position: absolute; z-index: 70; min-width: 188px; padding: 4px;
  background: linear-gradient(#ffffff, #f1f7fe); border: 1px solid var(--frame-dk);
  border-radius: 6px; box-shadow: var(--shadow);
}
.popup-item {
  width: 100%; appearance: none; border: 0; background: transparent; text-align: left;
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer;
  padding: 7px 10px; border-radius: 4px; display: flex; align-items: center; gap: 9px;
}
.popup-item:hover { background: linear-gradient(#eaf4ff, #d6e9fb); }
.popup-sep { height: 1px; background: #dbe8f3; margin: 4px 2px; }
.popup-item .status-dot { width: 14px; height: 14px; }

/* ── Modale (token, message perso, avatar) ───────────────────────────────*/
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(10,40,75,.42);
  display: grid; place-items: center; padding: 16px;
}
.modal {
  width: 380px; max-width: 100%;
}
.modal .titlebar { cursor: default; }
.modal-body { padding: 18px 20px; }
.modal-body h3 { margin: 0 0 8px; font-size: 15px; color: var(--blue-dk); }
.modal-body p { margin: 0 0 12px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.modal-body input[type=text], .modal-body textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 14px;
  border: 1px solid #9cbcd8; border-radius: 5px; box-shadow: inset 0 1px 2px rgba(0,0,0,.07);
}
.modal-body textarea { resize: vertical; min-height: 54px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn-ghost {
  appearance: none; border: 1px solid #9cbcd8; border-radius: 5px; cursor: pointer;
  font: inherit; padding: 8px 14px; background: linear-gradient(#fff, #e8f1fa); color: var(--ink);
}
.btn-ghost:hover { background: linear-gradient(#fff, #d9e9f8); }

/* champ token : gros, monospace, copiable */
.token-display {
  display: flex; align-items: center; gap: 8px; margin: 6px 0 4px;
}
.token-code {
  flex: 1; font-family: "Consolas", "Courier New", monospace; font-size: 21px; font-weight: 700;
  letter-spacing: 2px; text-align: center; color: var(--blue-dkr);
  background: #eef6ff; border: 1px dashed #8fbbe8; border-radius: 6px; padding: 12px 8px;
  user-select: all;
}
.copied-flash { color: var(--green-dk); font-size: 12px; min-height: 16px; }

/* ── Toasts (contact en ligne, etc.) ─────────────────────────────────────*/
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  width: 250px; pointer-events: auto; cursor: pointer;
  background: linear-gradient(#ffffff, #eef6ff); border: 1px solid var(--frame-dk);
  border-radius: 7px; box-shadow: var(--shadow); overflow: hidden;
  animation: toast-in .3s ease-out;
}
@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-head { background: linear-gradient(#dcecfb, #c2def4); padding: 4px 10px; font-size: 11px; font-weight: 700; color: #14406e; }
.toast-body { display: flex; align-items: center; gap: 10px; padding: 10px; }
.toast-body .dp { width: 40px; height: 40px; }
.toast-text { flex: 1; min-width: 0; }
.toast-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast-sub { font-size: 11px; color: var(--ink-soft); }

/* ── Réduit (titlebar only) ───────────────────────────────────────────────*/
.window.minimized { height: auto !important; }
.window.minimized > :not(.titlebar) { display: none; }

/* scrollbars discrètes façon Aero */
.contacts-scroll::-webkit-scrollbar, .chat-messages::-webkit-scrollbar { width: 12px; }
.contacts-scroll::-webkit-scrollbar-thumb, .chat-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(#cfe2f4, #a9cdee); border-radius: 6px; border: 3px solid transparent; background-clip: padding-box;
}
.contacts-scroll::-webkit-scrollbar-thumb:hover, .chat-messages::-webkit-scrollbar-thumb:hover { background: linear-gradient(#bcd6ee, #8fbce4); background-clip: padding-box; border: 3px solid transparent; }

/* ════════════════════════════════════════════════════════════════════════
   RESPONSIVE — sur petit écran, fenêtres en plein écran empilées
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  .main-window {
    top: 0; left: 0; width: 100vw; height: 100vh; max-height: none; border-radius: 0;
  }
  .chat-window {
    top: 0 !important; left: 0 !important; width: 100vw !important; height: 100vh !important;
    height: 100dvh !important; border-radius: 0; z-index: 50;
  }
  .chat-right { width: 64px; }
  .chat-right .dp, .chat-right .dp.dp-me { width: 48px; height: 48px; }
  .signin-window { width: calc(100vw - 20px); }
  #toasts { left: 10px; right: 10px; bottom: 10px; }
  .toast { width: auto; }
}
