/* ---------- Thèmes (inspiré de WhatsApp) ---------- */
:root,
[data-theme="light"] {
  --bg: #fcf5eb;
  --rail: #f0f2f5;
  --side: #ffffff;
  --head: #f0f2f5;
  --text: #111b21;
  --muted: #667781;
  --border: #e9edef;
  --hover: #f5f6f6;
  --active: #f0f2f5;
  --input: #f0f2f5;
  --accent: #0F8A55;
  --accent-hover: #0b6f44;
  --chip: #e4f3eb;
  --chip-text: #0b6f44;
  --in: #0F8A55;
  --out: #ea0038;
  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --chat-bg: #efeae2;
  --doodle: 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='%23d6cdc0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='20' cy='22' r='9'/%3E%3Cpath d='M20 17v10M17 19.5h5a2 2 0 0 1 0 3h-4a2 2 0 0 0 0 3h5'/%3E%3Cpath d='M70 14l18 8-18 8 3-8z'/%3E%3Cpath d='M98 60c0-4 6-4 6 0 0-4 6-4 6 0 0 5-6 8-6 8s-6-3-6-8z'/%3E%3Crect x='34' y='64' width='22' height='14' rx='3'/%3E%3Cpath d='M34 69h22'/%3E%3Cpath d='M12 92l6 6 10-12'/%3E%3Ccircle cx='80' cy='96' r='6'/%3E%3Ccircle cx='88' cy='100' r='6'/%3E%3C/g%3E%3C/svg%3E");
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --sheet-shadow: 0 17px 50px rgba(11, 20, 26, .19);
}
[data-theme="dark"] {
  --bg: #0c1317;
  --rail: #202c33;
  --side: #111b21;
  --head: #202c33;
  --text: #e9edef;
  --muted: #8696a0;
  --border: #222d34;
  --hover: #202c33;
  --active: #2a3942;
  --input: #202c33;
  --accent: #22b573;
  --accent-hover: #3cc98a;
  --chip: #0e2a1d;
  --chip-text: #5fd69a;
  --in: #3cc98a;
  --out: #f15c6d;
  --bubble-out: #005c4b;
  --bubble-in: #202c33;
  --chat-bg: #0b141a;
  --doodle: 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='%23182229' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='20' cy='22' r='9'/%3E%3Cpath d='M20 17v10M17 19.5h5a2 2 0 0 1 0 3h-4a2 2 0 0 0 0 3h5'/%3E%3Cpath d='M70 14l18 8-18 8 3-8z'/%3E%3Cpath d='M98 60c0-4 6-4 6 0 0-4 6-4 6 0 0 5-6 8-6 8s-6-3-6-8z'/%3E%3Crect x='34' y='64' width='22' height='14' rx='3'/%3E%3Cpath d='M34 69h22'/%3E%3Cpath d='M12 92l6 6 10-12'/%3E%3Ccircle cx='80' cy='96' r='6'/%3E%3Ccircle cx='88' cy='100' r='6'/%3E%3C/g%3E%3C/svg%3E");
  --shadow: 0 1px .5px rgba(0, 0, 0, .3);
  --sheet-shadow: 0 17px 50px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", "Apple Color Emoji", "Noto Color Emoji", "Segoe UI Emoji", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
p { margin: 0; }
button { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 500; font-size: 16px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.min0 { min-width: 0; }

/* ---------- Chargement ---------- */
.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 4px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Boutons ---------- */
.btn {
  border: 0; border-radius: 24px; padding: 11px 22px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; width: 100%; }
.btn.primary.auto { width: auto; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--hover); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
}
.icon-btn:hover { background: var(--active); }

/* ---------- Connexion ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; position: relative; background: var(--chat-bg); }
.login::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 220px; background: #0F8A55; }
[data-theme="dark"] .login::before { background: #202c33; }
.login-toggle { position: absolute; top: 12px; right: 12px; color: #fff; z-index: 1; }
.login-toggle:hover { background: rgba(255, 255, 255, .15); }
.login-inner {
  position: relative; background: var(--side); border-radius: 12px; box-shadow: var(--sheet-shadow);
  padding: 40px 28px 28px; width: 100%; max-width: 400px; text-align: center;
}
.logo {
  width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 16px;
  background: var(--accent); color: #fff; display: grid; place-items: center;
}
.login-inner h1 { font-size: 26px; margin: 0 0 8px; }
.login-inner .muted { margin-bottom: 28px; line-height: 1.5; }
.btn.wazochat { width: 100%; background: var(--side); color: var(--text); border: 1px solid var(--border); font-weight: 600; }
.btn.wazochat:hover { background: var(--hover); }
.btn.wazochat img { border-radius: 6px; }
.fine { margin-top: 20px; font-size: 12px; color: var(--muted); }

/* ---------- Logo ---------- */
.login-brand { margin: 0 0 14px; line-height: 0; }
.login-brand .brand-logo { height: 52px; width: auto; max-width: 100%; margin: 0 auto; }
.brand-dark { display: none !important; }
[data-theme="dark"] .brand-light { display: none !important; }
[data-theme="dark"] .brand-dark { display: block !important; }
.rail-logo { display: block; width: 36px; height: 36px; margin-bottom: 8px; }

/* ---------- Structure principale ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* Barre d'icônes */
.rail {
  width: 64px; flex-shrink: 0; background: var(--rail); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 12px 0;
}
.rail-top, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rail-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; display: grid; place-items: center;
}
.rail-btn:hover { background: var(--active); }
.rail-btn.active { background: var(--active); color: var(--text); }
.avatar { border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; display: block; }
.avatar.sm { width: 34px; height: 34px; margin-top: 4px; }

/* Liste */
.sidebar {
  width: 400px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; }
.side-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.side-actions { display: flex; align-items: center; gap: 4px; }
.new-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  cursor: pointer; display: grid; place-items: center; margin-left: 4px;
}
.new-btn:hover { background: var(--accent-hover); }
.mobile-only { display: none; }

.wallet {
  margin: 4px 16px 12px; padding: 14px 16px; border-radius: 12px; background: var(--chip);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.wallet-label { font-size: 12px; color: var(--chip-text); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.wallet-balance { font-size: 26px; font-weight: 700; margin-top: 2px; white-space: nowrap; }
.wallet-balance-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 2px; padding: 0; border: 0; background: none;
  color: var(--text); cursor: pointer; font: inherit; text-align: left;
}
.wallet-balance-btn .wallet-balance { margin-top: 0; }
.wallet-balance.masked { letter-spacing: .04em; }
.wallet-eye {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  color: var(--chip-text); background: rgba(255, 255, 255, .55); transition: background .15s;
}
[data-theme="dark"] .wallet-eye { background: rgba(255, 255, 255, .08); }
.wallet-balance-btn:hover .wallet-eye { background: var(--side); }
.wallet-user { text-align: right; min-width: 0; font-size: 13px; }

.search {
  margin: 0 16px; display: flex; align-items: center; gap: 12px; background: var(--input);
  border-radius: 20px; padding: 0 14px; color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; padding: 10px 0; outline: none; }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; gap: 8px; padding: 12px 16px 8px; }
.chip {
  border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 18px;
  padding: 6px 13px; font-size: 14px; font-weight: 500; cursor: pointer;
}
.chip:hover { background: var(--hover); }
.chip.active { background: var(--chip); color: var(--chip-text); border-color: transparent; }

.chat-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.chat-list li { display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 10px; cursor: pointer; }
.chat-list li:hover { background: var(--hover); }
.chat-list li.selected { background: var(--active); }
.initials {
  border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-weight: 600;
}
.chat-body { flex: 1; min-width: 0; padding: 13px 0; }
.chat-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-row + .chat-row { margin-top: 3px; }
.chat-name { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.chat-time.fresh { color: var(--accent); font-weight: 500; }
.chat-sub { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; min-width: 0; }
.chat-sub span.txt { overflow: hidden; text-overflow: ellipsis; }
.chat-amount { font-weight: 600; font-size: 14px; white-space: nowrap; }
.chat-amount.in { color: var(--in); }
.chat-amount.out { color: var(--out); }
.tick { color: #53bdeb; flex-shrink: 0; display: inline-flex; }
.empty { color: var(--muted); text-align: center; padding: 32px 24px; font-size: 14px; line-height: 1.6; }

/* ---------- Conversation ---------- */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 12px; background: var(--rail); border-bottom: 6px solid var(--accent);
}
.hero-icon { width: 120px; height: 120px; border-radius: 50%; background: var(--chip); color: var(--accent); display: grid; place-items: center; margin-bottom: 8px; }
.chat-empty h2 { margin: 0; font-weight: 400; font-size: 30px; }
.chat-empty .muted { line-height: 1.6; margin-bottom: 8px; }

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  height: 64px; flex-shrink: 0; background: var(--head); display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-left: 1px solid var(--border);
}
.chat-head-info { min-width: 0; }
.back { display: none; }

.messages {
  flex: 1; overflow-y: auto; padding: 16px 7% 12px; background-color: var(--chat-bg);
  background-image: var(--doodle); background-size: 240px;
  display: flex; flex-direction: column; gap: 4px;
}
.day-sep { align-self: center; margin: 10px 0 6px; }
.day-sep span {
  display: inline-block; background: var(--side); color: var(--muted); font-size: 12.5px;
  padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow); text-transform: uppercase;
}
.msg-row { display: flex; }
.msg-row.out { justify-content: flex-end; }
.bubble {
  max-width: min(360px, 80%); padding: 8px 10px 6px; border-radius: 8px; box-shadow: var(--shadow);
  background: var(--bubble-in); position: relative;
}
.msg-row.out .bubble { background: var(--bubble-out); border-top-right-radius: 0; }
.msg-row.in .bubble { border-top-left-radius: 0; }
.msg-row.first.out .bubble::after,
.msg-row.first.in .bubble::after {
  content: ""; position: absolute; top: 0; width: 8px; height: 13px;
}
.msg-row.first.out .bubble::after { right: -8px; background: var(--bubble-out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg-row.first.in .bubble::after { left: -8px; background: var(--bubble-in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.bubble-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.bubble-label svg { flex-shrink: 0; }
.msg-row.in .bubble-label { color: var(--in); }
.bubble-amount { font-size: 24px; font-weight: 700; margin: 2px 0; }
.bubble-note { font-size: 14.5px; line-height: 1.4; word-wrap: break-word; }
.bubble-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.messages .first { margin-top: 6px; }

.toast {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 8px; font-size: 14px;
  box-shadow: var(--sheet-shadow); z-index: 3;
}
.toast.ok { background: var(--accent); color: #fff; }
.toast.err { background: var(--out); color: #fff; }

.composer {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--head);
}
.comp-field {
  display: flex; align-items: center; gap: 8px; background: var(--side); border-radius: 22px;
  padding: 0 14px; color: var(--muted); border: 1px solid transparent;
}
.comp-field:focus-within { border-color: var(--accent); }
.comp-field input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; padding: 11px 0; outline: none; }
.comp-field input::placeholder { color: var(--muted); }
.amount-field { width: 150px; flex-shrink: 0; }
.amount-field span { font-weight: 600; }
.comp-field.grow { flex: 1; min-width: 0; }
.comp-field.boxed { background: var(--input); margin-top: 14px; border-radius: 10px; }
.send-round {
  width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
}
.send-round:hover:not(:disabled) { background: var(--accent-hover); }
.send-round:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Fenêtres ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(11, 20, 26, .6);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20;
}
.sheet {
  background: var(--side); width: 100%; max-width: 420px; padding: 22px; border-radius: 12px;
  box-shadow: var(--sheet-shadow); animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.sheet-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.recipient { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.bubble-preview { margin: 18px 0 4px; padding: 18px; border-radius: 10px; text-align: center; background: var(--chat-bg); background-image: var(--doodle); background-size: 240px; }
.c-amount {
  display: inline-block; background: var(--bubble-out); color: var(--text); box-shadow: var(--shadow);
  padding: 8px 18px; border-radius: 8px 0 8px 8px; font-size: 28px; font-weight: 700;
}
#c-note { margin-top: 8px; }
#c-note:empty { display: none; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.note.err { background: rgba(234, 0, 56, .1); color: var(--out); }
.row { display: flex; gap: 10px; margin-top: 18px; }
.row .btn { flex: 1; }

/* ---------- Tablette / téléphone ---------- */
@media (max-width: 1000px) {
  .sidebar { width: 340px; }
}
@media (max-width: 760px) {
  .rail { display: none; }
  .mobile-only { display: grid; }
  .sidebar { width: 100%; border-right: 0; }
  .chat { display: none; }
  .app.chat-open .sidebar { display: none; }
  .app.chat-open .chat { display: flex; }
  .chat-empty { display: none; }
  .back { display: grid; margin-left: -8px; }
  .chat-head { padding: 0 8px; gap: 8px; }
  .messages { padding: 12px 12px 8px; }
  .composer { padding: 8px; gap: 6px; }
  .amount-field { width: 112px; }
  .side-head { padding-left: 16px; }
  .chat-list { padding: 0 0 8px; }
  .chat-list li { border-radius: 0; padding: 0 16px; }
}

/* =====================================================================
   Comptes entreprise, onglets, cartes, formulaires, documentation
   ===================================================================== */
.pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.strong-sm { font-weight: 600; font-size: 15px; }
.mono, code, pre { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; }
a.btn { text-decoration: none; }
.btn.sm { padding: 7px 14px; font-size: 13px; }

.badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: var(--active); color: var(--muted); vertical-align: middle; white-space: nowrap;
}
.badge.green { background: var(--chip); color: var(--chip-text); }

.biz-intro { padding: 2px 20px 12px; line-height: 1.5; }

/* Toast global */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 40; }

/* Onglets (téléphone) */
.mobile-tabs { display: none; }

/* Tableau de bord */
.biz-tabs {
  display: flex; gap: 4px; padding: 0 16px; background: var(--head); border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border); overflow-x: auto; flex-shrink: 0;
}
.biz-tab {
  border: 0; background: transparent; color: var(--muted); padding: 12px 14px; font-weight: 500; cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.biz-tab:hover { color: var(--text); }
.biz-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.biz-content {
  flex: 1; overflow-y: auto; padding: 20px 7% 40px; background-color: var(--chat-bg);
  background-image: var(--doodle); background-size: 240px;
}
.card {
  background: var(--side); border-radius: 12px; padding: 18px 20px; margin: 0 auto 16px; max-width: 820px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card h3 { margin: 0; font-size: 17px; font-weight: 600; }
.card h4 { margin: 20px 0 8px; font-size: 15px; font-weight: 600; color: var(--accent); }
.card .empty { padding: 16px 8px; }
.balance-card { border-top: 4px solid var(--accent); }
.big-balance { font-size: 36px; font-weight: 700; margin: 4px 0 16px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.balance-card .card-actions { margin-top: 0; }

.ledger, .members { list-style: none; margin: 0; padding: 0; }
.ledger li, .members li {
  display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border);
}
.ledger li:last-child, .members li:last-child { border-bottom: 0; }
.members li.revoked { opacity: .55; }
.ledger-icon {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.ledger-icon.in { background: var(--chip); color: var(--in); }
.ledger-icon.out { background: rgba(234, 0, 56, .1); color: var(--out); }
.ledger-info { flex: 1; min-width: 0; }
.ledger-info p + p { margin-top: 2px; }
.ledger-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.ledger-right .badge { margin-left: 0; }
.link-btn {
  border: 0; background: transparent; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; padding: 2px 0;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--out); }

/* Formulaires */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.form-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.text-input {
  width: 100%; border: 1px solid transparent; background: var(--input); color: var(--text); border-radius: 10px;
  padding: 11px 13px; font: inherit; font-size: 15px; font-weight: 400; outline: none;
}
.text-input:focus { border-color: var(--accent); }
select.text-input { cursor: pointer; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form .text-input { flex: 1; min-width: 180px; }
.inline-form select.text-input { flex: 0 0 auto; min-width: 150px; width: auto; }
.note.warn { background: rgba(245, 158, 11, .14); color: #b45309; margin-top: 0; }
[data-theme="dark"] .note.warn { color: #fbbf24; }
.sheet.wide { max-width: 560px; }

.copy-box {
  display: flex; align-items: center; gap: 10px; background: var(--input); border-radius: 10px; padding: 8px 8px 8px 12px;
}
.copy-box code { flex: 1; min-width: 0; font-size: 13px; overflow-x: auto; white-space: nowrap; }

/* Documentation */
.doc-p { line-height: 1.6; color: var(--text); margin: 6px 0; }
.code-wrap { position: relative; margin: 8px 0; }
.code-wrap pre {
  margin: 0; background: #0b141a; color: #d1f4e0; border-radius: 10px; padding: 14px 16px; font-size: 12.5px;
  line-height: 1.55; overflow-x: auto;
}
[data-theme="dark"] .code-wrap pre { background: #0b141a; border: 1px solid var(--border); }
.copy-abs { position: absolute; top: 8px; right: 8px; background: rgba(255, 255, 255, .08); color: #d1f4e0; border-color: transparent; }
.copy-abs:hover { background: rgba(255, 255, 255, .16) !important; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.doc-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.doc-table .method { color: var(--accent); font-weight: 600; width: 50px; }

.composer-note {
  flex-shrink: 0; background: var(--head); color: var(--muted); text-align: center; padding: 16px; font-size: 14px;
}

@media (max-width: 760px) {
  .app.chat-open .chat { display: flex; }
  .biz-content { padding: 12px 10px 32px; }
  .card { padding: 16px; }
  .biz-tabs { padding: 0 4px; }
  .big-balance { font-size: 30px; }
}

/* ---------- Code PIN ---------- */
.pin-field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.pin-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 10px; }
.pin-field .pin-label { margin-top: 0; }
.pin-input {
  width: 100%; text-align: center; font-size: 26px; letter-spacing: .6em; padding: 10px 0 10px .6em;
  font-variant-numeric: tabular-nums;
}
.pin-input::placeholder { letter-spacing: .4em; }
.pin-form { display: flex; flex-direction: column; gap: 6px; }
.pin-form .muted { margin-bottom: 4px; line-height: 1.45; }
.link-btn {
  background: none; border: 0; padding: 6px 0 0; color: var(--accent); font-weight: 600; font-size: 13px;
  cursor: pointer; align-self: flex-start;
}
.link-btn:hover { text-decoration: underline; }
.pin-chip {
  margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border);
  background: var(--side); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 12px;
  font-weight: 600; cursor: pointer;
}
.pin-chip:hover { background: var(--hover); }
.pin-chip.warn { color: #b45309; border-color: rgba(245, 158, 11, .5); }
[data-theme="dark"] .pin-chip.warn { color: #fbbf24; }

/* ---------- QR code du lien de paiement ---------- */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; margin: 4px 0 12px; }
.qr-img { width: 200px; max-width: 70vw; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.qr-img svg { display: block; width: 100%; height: 100%; }
.qr-box .spinner { margin: 80px auto; }

/* ---------- Scanner de QR code ---------- */
.scan-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--side);
  color: var(--accent); cursor: pointer; display: grid; place-items: center;
}
.scan-btn:hover { background: var(--hover); }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.scan-form { display: flex; flex-direction: column; gap: 10px; }
.scan-form .btn { width: 100%; }
.scan-view {
  position: relative; width: 100%; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  background: #0b141a; display: grid; place-items: center;
}
.scan-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.scan-view.live video { opacity: 1; }
.scan-frame {
  position: absolute; inset: 18%; border-radius: 16px; pointer-events: none;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .35); border: 3px solid rgba(255, 255, 255, .9);
}
.scan-status {
  position: absolute; left: 12px; right: 12px; bottom: 12px; text-align: center; color: #fff; font-size: 13px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.scan-view:not(.live) .scan-frame { display: none; }
.scan-view:not(.live) .scan-status { position: static; padding: 0 20px; }

/* ---------- Lien de paiement payé ---------- */
.paid-view { text-align: center; padding: 16px 8px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.paid-icon {
  width: 76px; height: 76px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 40px;
  display: grid; place-items: center; margin-bottom: 8px; animation: paid-pop .3s ease-out;
}
.paid-title { font-size: 20px; font-weight: 700; }
.paid-amount { font-size: 30px; font-weight: 800; color: var(--accent); }
@keyframes paid-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Paramètres ---------- */
.settings { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 24px; display: flex; flex-direction: column; }
.set-profile {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; margin: 2px 0 4px;
  border: 0; border-radius: 16px; background: var(--chip); color: var(--text); cursor: pointer; text-align: left;
  transition: filter .15s;
}
.set-profile:hover { filter: brightness(.97); }
.set-profile .avatar { width: 56px; height: 56px; }
.set-name { display: block; font-size: 17px; font-weight: 700; }
.set-qr-mini {
  width: 40px; height: 40px; border-radius: 12px; background: var(--side); color: var(--accent);
  display: grid; place-items: center; flex-shrink: 0;
}
.set-group { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 8px 6px; }
.set-list { background: var(--side); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; flex-shrink: 0; }
.set-last { margin-top: 18px; }
.set-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 0; background: transparent;
  color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.set-item + .set-item { border-top: 1px solid var(--border); }
.set-item:hover { background: var(--hover); }
.set-item.active { background: var(--active); }
.set-ic {
  width: 36px; height: 36px; border-radius: 10px; background: var(--chip); color: var(--accent);
  display: grid; place-items: center; flex-shrink: 0;
}
.set-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-t { font-size: 15px; font-weight: 500; }
.set-s { font-size: 13px; color: var(--muted); }
.set-item .chev { color: var(--muted); flex-shrink: 0; }
.set-value { color: var(--muted); font-size: 13px; white-space: nowrap; }
.set-value.on { color: var(--accent); font-weight: 600; }
.set-value.warn { color: #b45309; font-weight: 600; }
[data-theme="dark"] .set-value.warn { color: #fbbf24; }
.set-switch { width: 42px; height: 24px; border-radius: 12px; background: var(--border); position: relative; flex-shrink: 0; transition: background .15s; }
.set-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.set-switch.on { background: var(--accent); }
.set-switch.on::after { transform: translateX(18px); }
.set-logout { justify-content: center; color: var(--out); }
.set-logout .set-ic { background: rgba(234, 0, 56, .1); color: var(--out); }
.set-logout .set-txt { flex: 0 0 auto; }

/* Carte « Mon QR code » (partie droite ; plein écran sur téléphone) */
.settings-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sv-head { display: none; align-items: center; gap: 8px; height: 60px; padding: 0 8px; background: var(--head); flex-shrink: 0; }
.sv-title { font-size: 17px; font-weight: 600; }
.sv-body {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center;
  gap: 18px; padding: 24px 16px;
}
/* Centré verticalement, mais défilable si l'écran est trop bas */
.sv-body > :first-child { margin-top: auto; }
.sv-body > :last-child { margin-bottom: auto; }
.id-card {
  width: 100%; max-width: 360px; background: var(--side); border-radius: 24px; box-shadow: var(--sheet-shadow);
  overflow: hidden; text-align: center; padding-bottom: 18px; flex-shrink: 0;
}
.id-top { height: 78px; background: linear-gradient(135deg, #0F8A55, #0a6239); position: relative; margin-bottom: 48px; }
.id-top .avatar {
  position: absolute; left: 50%; bottom: -42px; transform: translateX(-50%);
  width: 84px; height: 84px; border: 4px solid var(--side); background: var(--side);
}
.id-top .initials { position: absolute; left: 50%; bottom: -42px; transform: translateX(-50%); border: 4px solid var(--side); }
.id-name { font-size: 20px; font-weight: 700; padding: 0 16px; }
.id-email { font-size: 13px; color: var(--muted); padding: 0 16px; word-break: break-all; }
.id-qr { width: 220px; max-width: 70%; margin: 14px auto 0; }
.id-qr .qr-img { width: 100%; border: 0; border-radius: 14px; box-shadow: 0 0 0 1px var(--border); }
.id-qr .spinner { margin: 90px auto; }
.id-hint { font-size: 13px; color: var(--muted); margin: 10px 28px 0; line-height: 1.4; }
.id-actions { display: flex; justify-content: center; gap: 4px; margin: 16px 12px 0; }
.id-act {
  flex: 1; max-width: 104px; border: 0; background: transparent; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 500; padding: 4px;
}
.id-act > span {
  width: 46px; height: 46px; border-radius: 50%; background: var(--chip); color: var(--accent);
  display: grid; place-items: center; transition: transform .12s;
}
.id-act.primary > span { background: var(--accent); color: #fff; }
.id-act:hover > span { transform: scale(1.06); }
.id-act:disabled { opacity: .5; cursor: default; }
.sv-scan { white-space: nowrap; }
@media (max-width: 760px) {
  .settings-view { display: none; }
  .app.chat-open .settings-view:not(.hidden) { display: flex; }
  .sv-head { display: flex; }
  .sv-body { padding-top: 20px; }
  .sv-body > :first-child { margin-top: 0; }
}

/* Sur téléphone, thème et déconnexion sont déjà dans le menu Paramètres */
.view-settings .side-actions .mobile-only { display: none; }

/* ---------- Reçu d'opération ---------- */
.bubble[role="button"] { cursor: pointer; }
.bubble[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.receipt { text-align: center; }
.receipt-icon {
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 28px;
  display: grid; place-items: center; margin: 4px auto 10px;
}
.receipt-amount { font-size: 30px; font-weight: 800; }
.receipt-amount.in { color: var(--in); }
.receipt-status { font-size: 13px; color: var(--muted); margin-top: 2px; }
.receipt-rows { margin-top: 16px; border-top: 1px solid var(--border); text-align: left; }
.receipt-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.receipt-row span:first-child { color: var(--muted); flex-shrink: 0; }
.receipt-row span:last-child { text-align: right; word-break: break-word; min-width: 0; }
.receipt-row .mono { font-size: 12px; }
a.set-item { text-decoration: none; }
.set-foot { font-size: 12px; color: var(--muted); margin: 10px 8px 0; line-height: 1.4; }

/* ---------- Numéro de téléphone ---------- */
.phone-form { display: flex; flex-direction: column; gap: 12px; }
.phone-form .text-input { width: 100%; text-align: center; font-size: 18px; letter-spacing: .02em; }
.phone-form .note { margin-top: 0; }
.login-inner .strong { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.phone-out { margin: 14px auto 0; display: block; color: var(--muted); }

/* ---------- Session verrouillée ---------- */
.lock-screen { position: fixed; inset: 0; z-index: 15; overflow-y: auto; }
.lock-who { display: flex; justify-content: center; margin-bottom: 12px; }
.lock-screen .pin-input { margin: 0 auto; }
.lock-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.lock-out { color: var(--muted); }

/* ---------- Application installée (PWA) ---------- */
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }
.note.ok { background: var(--chip); color: var(--chip-text); }
.net-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: 6px 12px; text-align: center;
  font-size: 12px; font-weight: 600; background: #10231A; color: #fff;
}
@media (max-width: 760px) {
  /* 16 px au minimum : évite le zoom automatique d'iOS quand on touche un champ */
  .text-input:not(.pin-input):not(.pay-amount-input), .search input, .composer input { font-size: 16px; }
}
@media (display-mode: standalone) {
  .app, .login, .install { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  input, textarea, code, .mono, .bubble-note, .receipt-row, .copy-box { -webkit-user-select: text; user-select: text; }
}

/* Écran d'installation */
.install {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px 16px;
  background: linear-gradient(180deg, #0F8A55 0, #0F8A55 210px, var(--chat-bg) 210px);
}
[data-theme="dark"] .install { background: linear-gradient(180deg, #12302a 0, #12302a 210px, var(--chat-bg) 210px); }
.install-card {
  width: 100%; max-width: 420px; background: var(--side); border-radius: 22px; box-shadow: var(--sheet-shadow);
  padding: 28px 22px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.install-icon { border-radius: 20px; box-shadow: 0 8px 22px rgba(15, 138, 85, .35); margin-top: -4px; }
.install-card h1 { font-size: 24px; margin: 6px 0 0; letter-spacing: -.01em; }
.install-card > .muted { line-height: 1.5; }
.install-points { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; align-self: stretch; }
.install-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; background: var(--chip); color: var(--text); border-radius: 12px; padding: 10px 12px; }
.install-points svg { color: var(--accent); flex-shrink: 0; }
.install-card .btn { width: 100%; padding: 14px; font-size: 16px; }
.install-how { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }
.install-steps { align-self: stretch; text-align: left; }
.install-steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 10px; }
.install-steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; }
.install-steps li::before {
  content: counter(step); flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700; display: grid; place-items: center; margin-top: -1px;
}
.install-steps svg { display: inline-block; vertical-align: -3px; color: var(--accent); }
.install-qr { width: 190px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.install-qr svg { display: block; width: 100%; height: auto; }
.install-card .note { margin-top: 0; align-self: stretch; }

/* ---------- Code PIN : changement et code oublié ---------- */
.pin-form .pin-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 10px; }
.pin-form .pin-head .pin-label { margin-top: 0; }
.pin-form .pin-head .link-btn { padding: 0; }
.forgot-main { font-size: 15px; line-height: 1.5; background: var(--chip); border-radius: 12px; padding: 12px 14px; margin: 4px 0; }

/* ---------- Barre d'envoi en deux étapes : montant, puis motif ---------- */
.composer { position: relative; }
.composer.step-amount .note-field { display: none; }
.composer.step-amount .amount-field { flex: 1; width: auto; min-width: 0; }
.composer.step-amount .amount-field input { font-size: 18px; font-weight: 600; }
.composer.step-note .amount-field { display: none; }
.composer.step-amount .ic-send, .composer.step-note .ic-next { display: none; }
.amount-chip {
  position: absolute; left: 16px; bottom: calc(100% + 10px); z-index: 2;
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 8px 14px 8px 12px;
  background: var(--accent); color: #fff; font: inherit; cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .22); animation: chip-up .22s ease-out;
}
.amount-chip small { font-size: 12px; font-weight: 500; opacity: .85; }
.amount-chip b { font-size: 16px; font-weight: 700; white-space: nowrap; }
.amount-chip svg { opacity: .9; }
.amount-chip:hover { background: var(--accent-hover); }
@keyframes chip-up { from { transform: translateY(18px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 760px) { .amount-chip { left: 8px; } }
@media (prefers-reduced-motion: reduce) { .amount-chip { animation: none; } }

/* ---------- Nouveau transfert : profil trouvé ---------- */
#new-search .link-btn { margin-top: 8px; }
.found-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; margin-top: 12px;
  padding: 18px 14px; border-radius: 16px; background: var(--chip);
}
.found-card .avatar, .found-card .initials { margin-bottom: 6px; }
.found-name { font-size: 19px; font-weight: 700; }
.found-card .muted { word-break: break-word; }

/* ---------- Confirmation avec le code du téléphone ---------- */
#c-usepin { display: none; }
#confirm.use-device .pin-field, #confirm.use-device #c-forgot { display: none; }
#confirm.use-device #c-usepin { display: inline-block; margin-top: 12px; }
#confirm.use-device .row { flex-direction: column-reverse; }
.lock-device { width: 100%; margin-top: 4px; }
.lock-or { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.lock-screen .phone-form .btn { width: 100%; }

/* ---------- Application fixe : pas de zoom (pincement ou double appui), pas de texte agrandi par le navigateur ---------- */
.app-fixed, .app-fixed body { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.app-fixed body { overscroll-behavior: none; }

/* =====================================================================
   Liquid glass : surfaces translucides et floutées, barre d'onglets flottante (téléphone)
   ===================================================================== */
:root, [data-theme="light"] {
  --blur: blur(22px) saturate(170%);
  --glass: rgba(255, 255, 255, .64);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-border: rgba(255, 255, 255, .7);
  --glass-line: rgba(15, 35, 28, .08);
  --glass-field: rgba(255, 255, 255, .62);
  --glass-active: rgba(15, 138, 85, .14);
  --glass-shadow: 0 10px 30px rgba(11, 31, 26, .16), 0 2px 6px rgba(11, 31, 26, .06);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .75);
}
[data-theme="dark"] {
  --glass: rgba(38, 50, 58, .56);
  --glass-strong: rgba(24, 34, 40, .84);
  --glass-border: rgba(255, 255, 255, .1);
  --glass-line: rgba(255, 255, 255, .07);
  --glass-field: rgba(255, 255, 255, .09);
  --glass-active: rgba(255, 255, 255, .14);
  --glass-shadow: 0 12px 34px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .12);
}
/* Appareils modestes, navigateur sans flou, ou « réduire la transparence » : surfaces pleines (plus rapide) */
html.no-glass { --blur: none; --glass: var(--side); --glass-strong: var(--side); --glass-field: var(--input); }
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  :root { --blur: none; --glass: var(--side); --glass-strong: var(--side); --glass-field: var(--input); }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --blur: none; --glass: var(--side); --glass-strong: var(--side); --glass-field: var(--input); }
}

/* Fenêtres, messages : verre */
.modal { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
html.no-glass .modal { -webkit-backdrop-filter: none; backdrop-filter: none; }
.sheet {
  background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-hi), var(--sheet-shadow); border-radius: 22px;
}
.toast { -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border-radius: 22px; padding: 10px 18px; }
.login-inner { background: var(--glass-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); }

/* Écran calé sur la zone visible (téléphone, tablette) : rien ne défile derrière le clavier, les en-têtes restent en place */
@media (max-width: 760px), (pointer: coarse) {
  .app-fixed body { position: fixed; inset: 0; width: 100%; overflow: hidden; }
  .app-fixed .app { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100%); }
  .app-fixed .modal, .app-fixed .login, .app-fixed .install {
    position: fixed; inset: auto; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100%); min-height: 0;
    overflow-y: auto; align-items: flex-start;
  }
  .app-fixed .modal > *, .app-fixed .login-inner, .app-fixed .install-card { margin: auto; }
}

@media (max-width: 760px) {
  /* Barre d'onglets flottante en verre */
  .sidebar { position: relative; }
  .mobile-tabs {
    position: absolute; z-index: 6; display: flex; gap: 2px; padding: 6px;
    left: max(14px, env(safe-area-inset-left)); right: max(14px, env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    border: 1px solid var(--glass-border); border-radius: 34px;
    background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--glass-hi), var(--glass-shadow);
    transition: transform .25s ease, opacity .2s ease;
  }
  .mobile-tabs button {
    flex: 1; min-width: 0; border: 0; border-radius: 28px; background: transparent; color: var(--muted);
    padding: 9px 0 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-size: 11.5px; font-weight: 600; transition: background .18s, color .18s, transform .12s;
  }
  .mobile-tabs button svg { display: block; }
  .mobile-tabs button.active { color: var(--accent); background: var(--glass-active); }
  .mobile-tabs button:active { transform: scale(.96); }
  /* Le contenu défile sous la barre : de la place en bas pour atteindre le dernier élément */
  .chat-list, .settings { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  html.kb-open .mobile-tabs { transform: translateY(160%); opacity: 0; pointer-events: none; }

  /* Conversation : en-tête et zone de saisie en verre, les messages défilent dessous */
  #chat-view { position: relative; }
  #chat-view .chat-head {
    position: absolute; top: 0; left: 0; right: 0; z-index: 4; border-left: 0;
    background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    border-bottom: 1px solid var(--glass-line); box-shadow: var(--glass-hi);
  }
  #chat-view .messages { padding-top: 78px; padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  #chat-view .composer {
    position: absolute; z-index: 4; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 6px; gap: 6px; border: 1px solid var(--glass-border); border-radius: 34px;
    background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
    box-shadow: var(--glass-hi), var(--glass-shadow);
  }
  #chat-view .comp-field { background: var(--glass-field); }
  html.kb-open #chat-view .composer { bottom: 10px; }
  html.kb-open #chat-view .messages { padding-bottom: 84px; }

  /* Messages d'information : en haut, à l'abri du clavier */
  .toast { top: calc(var(--vvt, 0px) + 12px); bottom: auto; }
  .net-bar {
    left: 50%; right: auto; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px);
    bottom: calc(92px + env(safe-area-inset-bottom)); border-radius: 999px; padding: 6px 14px; box-shadow: var(--glass-shadow);
  }
}

/* Reçu du marchand : boutons sous « Paiement effectué » */
.paid-actions { width: 100%; margin-top: 16px; }

.bubble-cancel { margin-top: 6px; font-weight: 600; text-decoration: underline; color: inherit; opacity: .9; }

/* Nouveau transfert : contacts correspondant à la recherche */
.new-results { list-style: none; margin: 10px 0 0; padding: 0; max-height: 252px; overflow-y: auto; }
.new-results li { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px; cursor: pointer; }
.new-results li:hover, .new-results li:focus-visible { background: var(--hover); outline: none; }
.new-results .nr-head { cursor: default; padding: 4px 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.new-results .nr-head:hover { background: none; }
.new-results .nr-empty { cursor: default; padding: 10px 6px; font-size: 13px; color: var(--muted); }
.new-results .nr-empty:hover { background: none; }
.new-results .nr-info { min-width: 0; }
.new-results .nr-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-results .nr-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.new-results .nr-ic { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #0F8A55; color: #fff; }

/* Nouveau transfert : panneau plein hauteur, comme « Nouvelle discussion » de WhatsApp */
#new-modal { align-items: stretch; justify-content: flex-start; padding: 0; background: rgba(11, 20, 26, .35); }
#new-modal .new-panel {
  margin: 0; width: 100%; max-width: 440px; height: 100%; max-height: none; padding: 0; border-radius: 0;
  border-width: 0 1px 0 0; display: flex; flex-direction: column; overflow: hidden; animation: panel-in .2s ease-out;
}
@media (min-width: 761px) { #new-modal .new-panel { margin-left: 64px; } }       /* à droite de la barre d'icônes */
@media (max-width: 760px) { #new-modal .new-panel { max-width: none; border-width: 0; } }
@keyframes panel-in { from { transform: translateX(-18px); opacity: 0; } }
.np-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px 10px; flex: none; }
.np-head .sheet-title { margin: 0; font-size: 19px; }
.np-search {
  display: flex; align-items: center; gap: 10px; margin: 4px 16px 10px; padding: 0 16px; height: 44px; flex: none;
  border-radius: 22px; border: 2px solid var(--accent); background: var(--side); color: var(--muted);
}
.np-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.np-search input::placeholder { color: var(--muted); }
#new-search { display: flex; flex-direction: column; min-height: 0; flex: 1; }
#new-search.hidden { display: none; }
.np-row {
  display: flex; align-items: center; gap: 16px; width: 100%; padding: 8px 16px; border: 0; background: transparent;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.np-row:hover, .np-row:focus-visible { background: var(--hover); outline: none; }
.np-row.hidden { display: none; }
.np-ic { flex: none; width: 49px; height: 49px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; }
.np-txt b { display: block; font-weight: 500; font-size: 16px; }
.np-txt small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
.np-actions { flex: none; }
.new-results { flex: 1; max-height: none; margin: 4px 0 0; padding: 0 0 16px; }
.new-results li { padding: 8px 16px; border-radius: 0; }
.new-results .nr-head { padding: 16px 16px 4px; font-size: 14px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.new-results .nr-new { background: transparent; }
.new-results .nr-new:hover { background: var(--hover); }
.new-results .nr-empty { padding: 14px 16px; }
#new-form > #new-found { padding: 8px 16px 0; overflow-y: auto; }
#new-form > #new-msg { margin: 8px 16px 0; }
#new-form > .row { margin: auto 0 0; padding: 14px 16px 16px; }
#new-form:not(.step-found) > .row { display: none; }
.new-results .nr-foot { cursor: default; padding: 18px 16px 4px; justify-content: center; }
.new-results .nr-foot:hover { background: none; }
#new-form > #new-msg:not(.err) { background: rgba(15, 138, 85, .12); color: var(--accent); }

/* Nouveau transfert : tout le panneau défile (la recherche reste en haut), lignes plus aérées, emojis nets */
#new-search { overflow-y: auto; overscroll-behavior: contain; }
#new-search > * { flex-shrink: 0; }
.new-results { overflow: visible; max-height: none; flex: none; margin-top: 2px; padding-bottom: 28px; }
.np-searchbar { position: sticky; top: 0; z-index: 3; padding: 2px 0 12px; background: var(--side); }
.np-searchbar .np-search { margin: 0 16px; transition: box-shadow .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.np-searchbar .np-search:focus-within { box-shadow: 0 0 0 4px rgba(15, 138, 85, .16); }
.np-row { padding: 10px 16px; transition: background .12s; }
.new-results li { position: relative; padding: 10px 16px; gap: 14px; transition: background .12s; }
.new-results li:not(.nr-head):not(.nr-empty):not(.nr-foot):not(.nr-new)::after {
  content: ""; position: absolute; left: 79px; right: 16px; bottom: 0; height: 1px; background: var(--border);
}
.new-results .nr-head { padding: 20px 16px 4px; font-size: 13px; font-weight: 700; letter-spacing: .05em; color: var(--accent); }
.new-results .nr-head.nr-count { padding-top: 22px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-top: 8px solid var(--hover); }
.new-results .nr-name { font-size: 16px; font-weight: 500; line-height: 1.3; }
.new-results .nr-sub { margin-top: 2px; font-size: 13.5px; }
.new-results .avatar, .new-results .initials { box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.nr-name, .chat-name, .bubble-note, .found-name { font-variant-emoji: emoji; text-rendering: optimizeLegibility; }
