/* Messages web - DA de Hey : papier #F1EFE8, encre #2C2C2A, bleus de l'app, post-it jaune, titres manuscrits (Caveat),
   aplats francs (pas de dégradé ni d'ombre portée), rotations <= 3 degrés, pas d'emoji dans l'interface. */

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --paper: #f1efe8;
  --paper-card: #d3d1c7;
  --ink: #2c2c2a;
  --ink-soft: #6b6a63;
  --blue-50: #e6f1fb;
  --blue-100: #b5d4f4;
  --blue-600: #185fa5;
  --blue-800: #0c447c;
  --steel-100: #c9d4dc;
  --steel-800: #33475a;
  --teal-100: #9fe1cb;
  --teal-800: #085041;
  --postit: #ffff99;
  --red-100: #ffd6e0;
  --off-white: #f2e9d8;
  --error: #ff1f5b;
  --tape: rgba(255, 255, 255, 0.45);
}

html, body {
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
body { display: flex; flex-direction: column; min-height: 100dvh; }
img { -webkit-user-drag: none; user-select: none; }

/* ---------- Bandeau ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 2px solid var(--paper-card);
  background: var(--paper);
  flex: 0 0 auto;
}
.brand { font-family: "Caveat", cursive; font-weight: 700; font-size: 30px; color: var(--blue-800); text-decoration: none; }
.page-title { font-family: "Caveat", cursive; font-size: 30px; color: var(--blue-800); transform: rotate(-1.5deg); }
.topbar-logo { width: 34px; height: 34px; border-radius: 22%; display: block; flex: none; }
.spacer { flex: 1; }
.account-name { font-size: 13px; color: var(--ink-soft); }

/* ---------- Boutons ---------- */
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  padding: 9px 16px;
  background: var(--blue-600);
  color: #fff;
  cursor: pointer;
}
.btn:hover { background: var(--blue-800); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary { background: var(--blue-50); color: var(--blue-800); }
.btn.secondary:hover { background: var(--blue-100); }
.btn.danger { background: var(--error); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 4px 8px; border-radius: 12px; display: inline-flex; align-items: center; color: var(--blue-800); font-size: 20px; }
.icon-btn:hover { background: var(--blue-50); }
.icon-btn img { width: 22px; height: 22px; object-fit: contain; display: block; }
.icon-btn.small { font-size: 16px; padding: 2px 8px; }
.link-btn { background: none; border: none; font: inherit; font-size: inherit; color: var(--blue-600); text-decoration: underline; cursor: pointer; padding: 0; }

/* Boutons ronds de la barre de saisie (44 px, fond blanc, liseré papier, icônes de l'app) */
.round-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--paper-card);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.round-btn:hover { background: var(--blue-50); }
.round-btn img { width: 26px; height: 26px; object-fit: contain; display: block; }
.round-btn.on { background: var(--postit); }
.round-btn.urgent { background: var(--red-100); }
.send-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--blue-600);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}
.send-btn:disabled { background: var(--paper-card); cursor: default; }

.banner { background: var(--postit); color: var(--ink); font-size: 14px; padding: 10px 20px; border-bottom: 2px solid var(--paper-card); }
.banner.error { background: var(--red-100); color: #7a0f26; }
.hint { font-size: 13px; color: var(--ink-soft); margin: 6px 0; }
.hint.error { color: var(--error); }

/* ---------- Connexion ---------- */
.login-panel { display: flex; justify-content: center; padding: 40px 16px; }
.postit { background: var(--postit); width: 100%; max-width: 420px; padding: 22px 22px 24px; transform: rotate(-1.2deg); display: flex; flex-direction: column; gap: 8px; }
.postit h2 { font-family: "Caveat", cursive; font-size: 32px; color: var(--blue-800); }
.postit p { font-size: 14px; line-height: 1.4; }
.postit label { font-size: 13px; font-weight: 700; margin-top: 6px; }
.postit input, .modal input[type=text] {
  font: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 2px solid var(--paper-card);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.postit .btn { margin-top: 10px; align-self: flex-start; }

/* ---------- Disposition ---------- */
.chat-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Liste des conversations ---------- */
.chat-list { border-right: 2px solid var(--paper-card); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 0 14px 20px; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 2px 10px; position: sticky; top: 0; background: var(--paper); z-index: 3; }
.list-head h2 { font-family: "Caveat", cursive; font-size: 28px; color: var(--blue-800); }
#convList { list-style: none; padding-top: 18px; }
.conv {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 6px;
  padding: 2px 12px;
  margin: 0 0 12px;
  min-height: 44px;
  cursor: pointer;
}
.conv:hover { background: var(--blue-50); }
.conv.active { outline: 2px solid var(--blue-600); }
.conv-avatar { flex: 0 0 44px; width: 44px; height: 32px; display: flex; align-items: flex-end; justify-content: center; z-index: 1; position: relative; }
.conv-text { min-width: 0; flex: 1; padding: 6px 0; }
.conv-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 12px; color: rgba(44, 44, 42, 0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .conv-name, .conv.unread .conv-preview { font-weight: 700; }
.conv.unread .conv-preview { color: rgba(44, 44, 42, 0.85); }
.list-empty { padding: 14px 2px; }

/* ---------- Timbres ---------- */
.stamp { position: relative; flex: 0 0 auto; }
.stamp-inner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.stamp-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stamp-photo { position: relative; width: 78%; height: 78%; border-radius: 2px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--blue-100); }
.stamp-photo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.stamp-initial { color: var(--blue-800); font-weight: 700; line-height: 1; }
.group-avatar { position: relative; flex: 0 0 auto; }
.group-avatar-empty { border-radius: 50%; background: var(--teal-100); }

/* ---------- Fil ---------- */
.chat-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px 10px; border-bottom: 2px solid var(--paper-card); min-height: 64px; }
.head-avatar { display: inline-flex; width: 44px; height: 36px; align-items: flex-end; justify-content: center; flex: 0 0 44px; position: relative; top: 4px; }
.head-text { min-width: 0; }
.thread-head h2 { font-family: "Caveat", cursive; font-size: 28px; color: var(--blue-800); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-sub { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { display: none; }

.thread { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 14px 16px; }
.thread.placing { cursor: crosshair; }
.thread-empty { margin: 40px auto; color: var(--ink-soft); font-size: 14px; text-align: center; }
.day-sep { text-align: center; font-size: 12px; color: var(--ink-soft); margin: 10px auto 6px; width: fit-content; background: var(--off-white); padding: 3px 12px; border-radius: 12px; }

.row { position: relative; display: flex; padding: 1px 0; }
.row.block-start { padding-top: 6px; }
.row.mine { justify-content: flex-end; }
.row.theirs { justify-content: flex-start; }
.row-col { display: flex; flex-direction: column; max-width: min(78%, 420px); min-width: 0; }
.row.mine .row-col { align-items: flex-end; }
.row.theirs .row-col { align-items: flex-start; }
.row.flash .bubble, .row.flash .photo-card { outline: 3px solid var(--postit); }
.row-head { display: flex; gap: 6px; align-items: center; padding: 2px 6px; font-size: 10px; color: rgba(44, 44, 42, 0.4); }
.row-name { font-size: 11px; font-weight: 700; color: rgba(44, 44, 42, 0.55); }
.row-important { font-weight: 700; color: rgba(44, 44, 42, 0.55); }

.bubble-wrap { position: relative; padding: 0; }
.bubble {
  width: fit-content;
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: pointer;
  user-select: text;
}
.row.mine .bubble { margin-left: auto; }
.bubble.pending, .photo-card.pending, .voice.pending { opacity: 0.6; }
.bubble-tag { position: absolute; font-size: 10px; font-style: italic; color: rgba(44, 44, 42, 0.6); white-space: nowrap; }
.bubble-tag.top { top: -15px; }
.bubble-tag.bottom { bottom: -14px; font-size: 9px; font-style: normal; color: rgba(44, 44, 42, 0.55); }
.row.mine .bubble-tag { right: 4px; }
.row.theirs .bubble-tag { left: 4px; }
.bubble-wrap:has(.bubble-tag.top) { margin-top: 15px; }
.bubble-wrap:has(.bubble-tag.bottom) { margin-bottom: 13px; }
.important-sticker { position: absolute; top: -15px; right: -15px; width: 45px; height: 45px; object-fit: contain; pointer-events: none; }
.more-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.9); cursor: pointer; padding: 3px; opacity: 0; transition: opacity 0.1s; }
.more-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* La flèche Répondre est toujours la plus proche de la bulle, le « ⋮ » juste après (demande de Tom). */
.row.mine .more-btn { left: -62px; }
.row.theirs .more-btn { right: -62px; }
.bubble-wrap:hover .more-btn, .more-btn:focus { opacity: 1; }
@media (hover: none) { .more-btn { display: none; } }
/* Répondre : toujours juste à GAUCHE du « ⋮ » (demande de Tom). */
.reply-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.9); color: #2c2c2a; cursor: pointer; padding: 4px; opacity: 0; transition: opacity 0.1s; }
.reply-btn img { width: 100%; height: 100%; object-fit: contain; display: block; }
.row.mine .reply-btn { left: -32px; }
.row.theirs .reply-btn { right: -32px; }
.bubble-wrap:hover .reply-btn, .reply-btn:focus { opacity: 1; }
@media (hover: none) { .reply-btn { display: none; } }

/* Emoji rapide : clic dans le vide = 5 préférés près du clic ; appui long = le premier, qui grandit puis suit la souris. */
.quick-stickers { position: fixed; z-index: 60; display: flex; gap: 4px; padding: 6px 8px; background: #fff; border-radius: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.quick-stickers button { width: 36px; height: 36px; border: none; background: none; padding: 2px; cursor: pointer; border-radius: 8px; }
.quick-stickers button:hover, .quick-stickers button:focus-visible { background: rgba(44, 44, 42, 0.08); }
.quick-stickers img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hold-sticker { position: fixed; z-index: 60; width: 32px; height: 32px; object-fit: contain; pointer-events: none; transform-origin: center; }

.reply-quote {
  max-width: 220px;
  margin-bottom: 3px;
  border: none;
  background: rgba(44, 44, 42, 0.06);
  border-radius: 8px;
  padding: 5px 8px;
  font: inherit;
  font-size: 11px;
  color: rgba(44, 44, 42, 0.6);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.quote-name { font-weight: 700; }

.note-line { font-size: 12px; font-style: italic; color: rgba(44, 44, 42, 0.45); padding: 4px 14px; max-width: 260px; }
.status { font-size: 10px; color: rgba(44, 44, 42, 0.45); padding: 2px 6px 0; }
.status.failed { color: var(--error); }
.status .link-btn { color: inherit; }

/* Photos : cadre bleu-gris, ruban adhésif, légende */
.photo-card { background: var(--steel-100); border-radius: 4px; padding: 6px; width: fit-content; }
.photo-frame { position: relative; width: 180px; height: 180px; cursor: pointer; }
.photo-img { width: 180px; height: 180px; object-fit: cover; border-radius: 2px; display: block; background: var(--blue-50); }
.tape { position: absolute; top: -12px; left: 50%; margin-left: -23px; width: 46px; height: 12px; border-radius: 2px; background: var(--tape); transform: rotate(3deg); }
.photo-dots { display: flex; gap: 4px; padding: 6px 4px 0; }
.photo-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; }
.photo-dots .dot.on { background: var(--steel-800); }
.photo-caption { max-width: 180px; padding: 6px 4px 0; font-size: 13px; overflow-wrap: anywhere; }
.photo-open { font-size: 11px; padding: 4px 4px 0; display: block; }
.voice { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 20px; padding: 6px 12px; }
.voice-icon { width: 22px; height: 22px; object-fit: contain; }
.voice audio { height: 32px; max-width: 200px; }
.voice-duration { font-size: 11px; color: var(--ink-soft); }

/* Stickers posés */
.placed-sticker { position: absolute; width: 32px; height: 32px; object-fit: contain; opacity: 0.9; pointer-events: none; z-index: 2; transform-origin: center; }
.placed-sticker.own-sticker { pointer-events: auto; cursor: pointer; }

/* Sondages et autres cartes */
.poll-card, .bump-card { background: #fff; border-radius: 12px; padding: 10px 12px; width: 260px; display: flex; flex-direction: column; gap: 6px; }
.poll-title { font-size: 15px; }
.poll-meta { font-size: 11px; color: var(--ink-soft); }
.poll-option { position: relative; display: flex; justify-content: space-between; gap: 8px; align-items: center; border: 2px solid var(--paper-card); background: #fff; border-radius: 10px; padding: 7px 10px; font: inherit; font-size: 14px; cursor: pointer; text-align: left; overflow: hidden; }
.poll-option.on { border-color: var(--blue-600); background: var(--blue-50); }
.poll-option .poll-label, .poll-option .poll-count { position: relative; z-index: 1; }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue-100); opacity: 0.55; z-index: 0; }
.bump-card span { font-size: 13px; color: var(--ink-soft); }

/* ---------- Saisie ---------- */
.compose-zone { flex: 0 0 auto; padding: 6px 14px 14px; position: relative; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding-top: 8px; }
.composer textarea {
  flex: 1;
  min-height: 45px;
  max-height: 140px;
  font: inherit;
  font-size: 15px;
  resize: none;
  padding: 11px 18px;
  border: none;
  border-radius: 28px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.composer textarea:focus { box-shadow: inset 0 0 0 2px var(--blue-100); }
.plus-wrap { position: relative; flex: 0 0 auto; }
.plus-menu { position: absolute; bottom: 52px; left: 0; display: flex; flex-direction: column; gap: 8px; z-index: 5; }
.context-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--blue-50); border-left: 4px solid var(--blue-600); border-radius: 8px; padding: 6px 8px 6px 10px; margin-top: 6px; }
.context-text { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.context-text strong { color: var(--blue-800); }
.pending-images { display: flex; gap: 8px; padding: 8px 0 2px; overflow-x: auto; }
.pending-thumb { position: relative; flex: 0 0 auto; width: 64px; height: 64px; }
.pending-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; display: block; }
.pending-thumb button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--ink); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; }
.sticker-bar { display: flex; flex-wrap: wrap; gap: 6px; background: #fff; border-radius: 14px; padding: 8px; margin-top: 8px; max-height: min(290px, 40dvh); overflow-y: auto; }
.sticker-bar button { width: 44px; height: 44px; border: none; background: none; border-radius: 10px; cursor: pointer; padding: 4px; }
.sticker-bar button:hover { background: var(--blue-50); }
.sticker-bar button.on { background: var(--postit); }
.sticker-bar button { position: relative; }
.sticker-bar button[data-fav]::after { content: attr(data-fav); position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--blue-800, #1f4e8c); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-weight: 700; }
.sticker-panel.fav-editing .sticker-bar { outline: 2px dashed var(--blue-800, #1f4e8c); outline-offset: -2px; }
.fav-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 0 2px 6px; }
.fav-hint { font-size: 12px; color: var(--ink-soft); }
.quick-stickers .quick-edit { color: #2c2c2a; padding: 8px; }
.quick-stickers .quick-edit svg { width: 100%; height: 100%; display: block; }
.sticker-bar img { width: 100%; height: 100%; object-fit: contain; display: block; }
.emoji-panel { display: flex; flex-wrap: wrap; gap: 2px; background: #fff; border-radius: 14px; padding: 8px; margin-top: 8px; max-height: min(220px, 35dvh); overflow-y: auto; }
.emoji-panel button { width: 40px; height: 40px; border: none; background: none; border-radius: 10px; cursor: pointer; font-size: 24px; line-height: 1; padding: 0; }
.emoji-panel button:hover { background: var(--blue-50); }
.plus-new { background: none; border: none; padding: 4px; }
.plus-new img { width: 30px; height: 30px; object-fit: contain; display: block; }
.plus-new:hover { background: none; opacity: .7; }
.place-hint { font-size: 12px; color: var(--blue-800); padding-top: 6px; }

/* ---------- Fenêtres ---------- */
.msg-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; font-weight: 600; }
.link-confirm p { font-size: 14px; }
.link-url { font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; background: #fff; border-radius: 10px; padding: 8px 10px; }
.link-hint { font-size: 12px !important; color: var(--ink-soft); }
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(44, 44, 42, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--paper); border: 2px solid var(--paper-card); border-radius: 18px; padding: 18px; width: 100%; max-width: 440px; max-height: 85dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.modal.actions { background: #fff; border: none; border-radius: 20px; padding: 8px; max-width: 320px; gap: 0; }
.modal h2 { font-family: "Caveat", cursive; font-size: 30px; color: var(--blue-800); }
.row-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.action-row { display: block; width: 100%; text-align: left; font: inherit; font-size: 15px; padding: 14px 16px; border: none; background: none; border-radius: 12px; cursor: pointer; color: var(--ink); }
.action-row:hover { background: var(--blue-50); }
.action-row.danger { color: var(--error); }
.pick-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pick-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border: 2px solid var(--paper-card); border-radius: 12px; padding: 9px 12px; font-size: 14px; }
.pick-item.clickable { cursor: pointer; }
.pick-item.clickable:hover { background: var(--blue-50); }
.pick-item.selected { border-color: var(--blue-600); background: var(--blue-50); }
.pick-item small { display: block; color: var(--ink-soft); font-size: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 4px; }
#pollOptions { display: flex; flex-direction: column; gap: 6px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--blue-100); color: var(--blue-800); }
.tag.off { background: var(--paper-card); color: var(--ink-soft); }

.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.92); display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 96vw; max-height: 90vh; object-fit: contain; }
.viewer-close { position: absolute; top: 14px; right: 18px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 18px; cursor: pointer; }
.viewer-nav { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; color: #fff; }
.viewer-nav button { width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 24px; cursor: pointer; }

/* ---------- Téléphone : une seule colonne à la fois ---------- */
@media (max-width: 760px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-list { border-right: none; }
  .chat-layout.in-thread .chat-list { display: none; }
  .chat-layout:not(.in-thread) .chat-thread { display: none; }
  .back-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar .btn.small { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
  .account-name { display: none; }
  .brand { font-size: 26px; }
  .page-title { display: none; }
  .row-col { max-width: 86%; }
}

/* Réglage de la taille des emojis */
.sticker-panel { margin-top: 8px; }
.sticker-panel .sticker-bar { margin-top: 0; }
.sticker-size { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-soft); padding: 6px 4px 0; }
.sticker-size input { flex: 1; }
.sticker-edit-preview { display: flex; align-items: center; justify-content: center; height: 150px; background: #fff; border-radius: 12px; overflow: hidden; }
.sticker-edit-preview img { width: 32px; height: 32px; object-fit: contain; transition: transform 0.12s; }
.sticker-edit-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Enregistrement vocal, appareil photo */
.record-bar { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 8px 12px; margin-top: 8px; font-size: 14px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--error); animation: rec-blink 1s infinite; }
@keyframes rec-blink { 50% { opacity: 0.25; } }
.record-text { flex: 1; color: var(--ink-soft); font-size: 13px; }
.pending-voice { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 14px; padding: 6px 10px; margin-top: 8px; }
.pending-voice audio { height: 34px; flex: 1; min-width: 0; }
.camera video { width: 100%; max-height: 55dvh; background: #000; border-radius: 12px; object-fit: cover; }

/* Agenda : disponibilités par demi-heure */
.agenda { max-width: 520px; }
.agenda-nav { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--blue-800); }
.agenda-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.agenda-daytile { position: relative; overflow: hidden; border: 2px solid var(--paper-card); background: #fff; border-radius: 10px; padding: 6px 2px 8px; font: inherit; font-size: 12px; cursor: pointer; text-align: center; }
.agenda-daytile.on { border-color: var(--blue-600); }
.agenda-daytile .dow { display: block; font-size: 11px; color: var(--ink-soft); text-transform: capitalize; }
.agenda-daytile .dom { display: block; font-size: 16px; font-weight: 700; }
.agenda-daytile .mine { display: block; font-size: 10px; color: var(--blue-800); min-height: 12px; }
.agenda-daytile .heat { position: absolute; left: 0; right: 0; bottom: 0; background: var(--blue-100); opacity: 0.7; }
.agenda-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 6px 0; font-size: 14px; }
.agenda-slots { display: grid; grid-template-columns: 44px 1fr 1fr; gap: 3px; max-height: 38dvh; overflow-y: auto; }
.agenda-hour { font-size: 11px; color: var(--ink-soft); text-align: right; padding-right: 6px; align-self: center; }
.agenda-slot { position: relative; border: 2px solid var(--paper-card); background: #fff; border-radius: 6px; height: 26px; cursor: pointer; padding: 0; font: inherit; font-size: 10px; color: var(--ink-soft); overflow: hidden; }
.agenda-slot .heat { position: absolute; inset: 0; background: var(--blue-100); }
.agenda-slot span { position: relative; z-index: 1; }
.agenda-slot.mine { border-color: var(--blue-600); background: var(--blue-50); }
.agenda-slot.mine span { color: var(--blue-800); font-weight: 700; }

/* Récupération d'anciens messages (QR) */
.history { max-width: 460px; }
.history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.history-menu-wrap { position: relative; }
.history-menu { position: absolute; right: 0; top: 36px; z-index: 5; background: #fff; border: 2px solid var(--paper-card); border-radius: 14px; padding: 8px 10px; min-width: 230px; max-height: 260px; overflow-y: auto; }
.history-menu ul { list-style: none; }
.history-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 2px; font-size: 14px; cursor: pointer; }
.qr-box { display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 14px; padding: 14px; min-height: 240px; }
.qr-box { overflow: hidden; min-width: 0; }
.qr-box img { width: 240px; max-width: 100%; height: auto; aspect-ratio: 1 / 1; flex: 0 1 auto; min-width: 0; image-rendering: pixelated; display: block; }
.history-steps { font-size: 13px; color: var(--ink-soft); padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* Connexion : onglets mot de passe / QR code */
.login-tabs { display: flex; gap: 6px; margin: 4px 0 2px; }
.login-tabs button { flex: 1; font: inherit; font-size: 13px; font-weight: 700; padding: 7px 8px; border: none; border-radius: 12px; background: rgba(255, 255, 255, 0.55); color: var(--blue-800); cursor: pointer; }
.login-tabs button.on { background: var(--blue-600); color: #fff; }
.login-pass { display: flex; flex-direction: column; gap: 8px; }
.login-qr { display: flex; flex-direction: column; gap: 8px; }
.login-qr .qr-box { min-height: 200px; }

.postit.qr-mode { transform: none; }

.note-line.explainable { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.note-explain { max-width: 360px; margin: 2px 14px 6px; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; background: #fff; border: 1px dashed rgba(0,0,0,.25); border-radius: 6px; color: #374151; }

.conv-star { position: absolute; top: -14px; right: -10px; width: 42px; height: 42px; z-index: 2; pointer-events: none; }

/* ---------- Faux message d'un message illisible (récupération automatique) ---------- */
.recovery-card { max-width: 320px; margin: 4px 0; padding: 10px 14px 12px; background: #fff; border: 2px dashed var(--paper-card); border-radius: 20px; }
.recovery-card.mine { margin-left: auto; }
.recovery-title { font-size: 14px; font-weight: 700; color: var(--blue-800); }
.recovery-text { font-size: 12px; color: var(--ink-soft); margin: 4px 0 8px; }
.recovery-bar { height: 6px; border-radius: 999px; background: var(--blue-50); margin: 8px 0 6px; overflow: hidden; }
.recovery-fill { display: block; height: 100%; background: var(--blue-600); border-radius: 999px; transition: width .4s; }
.recovery-steps { list-style: none; display: flex; flex-direction: column; gap: 1px; font-size: 11px; color: var(--ink-soft); }
.recovery-actions { display: flex; gap: 14px; margin-top: 8px; }
.recovery-link { background: none; border: none; padding: 0; font: inherit; font-size: 12px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }
.recovery-steps li { opacity: .45; }
.recovery-steps li.current { color: var(--blue-800); font-weight: 700; opacity: 1; }
.recovery-steps li.done { color: var(--blue-600); opacity: .6; }
.recovery-error { margin-top: 6px; font-size: 11px; color: #d6264f; }


/* Menu du « + » (rechercher / ajouter un ami, créer un groupe) */
.new-wrap { position: relative; }
.new-menu { position: absolute; top: calc(100% + 6px); right: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: #fff; border-radius: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16); z-index: 10; white-space: nowrap; }

/* Réglages d'une conversation */
.settings-btn { margin-left: auto; }
.modal-sub { font-family: "Caveat", cursive; font-size: 22px; color: var(--blue-800); margin-top: 6px; }
.cat-option { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 2px solid var(--paper-card); border-radius: 12px; padding: 8px 10px; cursor: pointer; }
.cat-option:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); }
.cat-option input { margin-top: 3px; }
.cat-option span { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.cat-option small { font-size: 12px; color: var(--ink-soft); }
.restricted-box { display: flex; flex-direction: column; gap: 6px; padding: 4px 4px 4px 12px; font-size: 13px; }
.inline-choice { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.hours-box { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nickname-fields { display: flex; flex-direction: column; gap: 6px; }
.nickname-row { display: flex; align-items: center; gap: 8px; }
.nickname-row span { flex: 0 0 38%; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nickname-row input { flex: 1; min-width: 0; }

/* Chargement des messages plus anciens (en haut de la conversation, sans décaler les messages) */
/* Écrit sur un post-it (demande de Tom, DA scrapbook : aplat jaune, Caveat, légère rotation, bout de scotch). */
.older-loading { position: absolute; left: 50%; transform: translateX(-50%) rotate(-2deg); top: 74px; z-index: 4; background: var(--postit); color: var(--ink); font-family: "Caveat", cursive; font-size: 19px; font-weight: 700; line-height: 1.1; padding: 10px 16px 8px; border-radius: 2px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14); display: flex; align-items: center; gap: 8px; pointer-events: none; white-space: nowrap; }
.older-loading::before { content: ""; position: absolute; top: -8px; left: 50%; width: 46px; height: 16px; transform: translateX(-50%) rotate(3deg); background: rgba(150, 180, 230, 0.6); }
.older-loading .spin { width: 12px; height: 12px; border: 2px solid rgba(44, 44, 42, 0.15); border-top-color: var(--ink); border-radius: 50%; animation: older-spin 0.8s linear infinite; }
@keyframes older-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .older-loading .spin { animation: none; } }

/* Timbre à gauche du nom au-dessus des messages */
.row-stamp { border: none; background: none; padding: 0; margin: 0 2px 0 0; cursor: pointer; display: inline-flex; align-items: center; line-height: 0; }
.row-stamp:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; border-radius: 4px; }
.head-avatar { cursor: pointer; }

/* Photos partagées (réglages de la conversation) */
.shared-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.shared-photos button { border: none; padding: 0; background: #fff; border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: pointer; }
.shared-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }

.settings-status-ok { color: var(--blue-800); }
