@import url('/css/pages/global.css');

* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-main);
  color: var(--text);
  margin: 0;
  transition: background .3s, color .3s;
}

/* ── DARK THEME OVERRIDES ── */

body.dark-theme #auth-overlay { background-color: #0f172a; }
body.dark-theme #auth-overlay > div { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .bubble-admin { background-color: #1e293b !important; border-color: #334155 !important; color: #f1f5f9 !important; }
body.dark-theme .order-card { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .order-body { background-image: radial-gradient(#475569 .5px, transparent .5px) !important; }
body.dark-theme .sidebar-item:hover { background-color: #334155 !important; }
body.dark-theme .active-contact { background-color: #334155 !important; border-color: #4f46e5 !important; }
body.dark-theme textarea,
body.dark-theme input[type=text] { background-color: #334155 !important; color: #f1f5f9 !important; }
body.dark-theme .ctx-menu { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .ctx-menu button { color: #f1f5f9 !important; }
body.dark-theme .ctx-menu button:hover { background-color: #334155 !important; }
body.dark-theme .qr-btn { background-color: #1e293b !important; border-color: #334155 !important; color: #94a3b8 !important; }
body.dark-theme .qr-btn:hover { background-color: #4f46e5 !important; color: #fff !important; }
body.dark-theme .emoji-panel { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .reply-prev { background-color: #1e293b !important; }
body.dark-theme .rxn-panel { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .pin-bar { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .admin-card { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .typing-indicator { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .rxn-pill { background-color: #2d3a4e !important; border-color: #334155 !important; }
body.dark-theme .rxn-pill.mine { background-color: #3730a3 !important; border-color: #4f46e5 !important; }
body.dark-theme .react-btn { background: #2a3447 !important; border-color: #475569 !important; }
body.dark-theme .bot-suggest-bar { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .bot-chip { background-color: #334155 !important; color: #a5b4fc !important; border-color: #475569 !important; }
body.dark-theme .bot-chip:hover { background-color: #4f46e5 !important; color: #fff !important; }
body.dark-theme .poll-card { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .poll-option-bar { background-color: #334155 !important; }
body.dark-theme .poll-option-btn:hover { background-color: #334155 !important; }
body.dark-theme .file-preview-item { background-color: #334155 !important; border-color: #475569 !important; }
body.dark-theme .canned-panel { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .canned-item:hover { background-color: #334155 !important; }
body.dark-theme .schedule-panel { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme .translate-bar { background-color: #1e293b !important; border-color: #334155 !important; }
body.dark-theme #modal-overlay-custom { background-color: #1e293b !important; border-color: #334155 !important; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; }

/* ── BUBBLES ── */
.bubble-card { display: inline-block; }
.bubble-client {
  background: var(--primary);
  color: #fff;
  border-radius: 1.25rem 1.25rem .25rem 1.25rem;
  box-shadow: 0 4px 15px rgba(79, 70, 229, .2);
}
.bubble-admin {
  background: #fff;
  color: #1e293b;
  border-radius: 1.25rem 1.25rem 1.25rem .25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
  border: 1px solid #e2e8f0;
}
.bubble-bot {
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
  color: #1e293b;
  border-radius: 1.25rem 1.25rem 1.25rem .25rem;
  box-shadow: 0 2px 10px rgba(99, 102, 241, .08);
  border: 1px solid #c7d2fe;
}
.bubble-client .reply-quote { border-left-color: rgba(255,255,255,.4); background: rgba(0,0,0,.1); }
.bubble-admin .reply-quote { border-left-color: #4f46e5; background: #f0f0ff; color: #4f46e5; }

.reply-quote {
  border-left: 3px solid;
  padding: 5px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  opacity: .85;
  cursor: pointer;
}
.msg-deleted { opacity: .5; font-style: italic; font-size: 12px; }
.msg-edited::after { content: ' (modifié)'; font-size: 10px; opacity: .55; }
.ticks { font-size: 11px; transition: color .4s; }
.ticks.received { color: #94a3b8; }
.ticks.read { color: #4f46e5; }

/* ── STATUS DOTS ── */
.dot-on {
  width: 10px; height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: pulse 2s infinite;
}
.dot-off {
  width: 10px; height: 10px;
  background: #94a3b8;
  border-radius: 50%;
  border: 2px solid #fff;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.sb-on {
  width: 8px; height: 8px;
  background: #22c55e;
  border-radius: 50%;
  border: 1.5px solid #fff;
  position: absolute; bottom: 0; right: 0;
  animation: pulse 2s infinite;
}
.sb-off {
  width: 8px; height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  border: 1.5px solid #fff;
  position: absolute; bottom: 0; right: 0;
}
.sb-typ {
  width: 8px; height: 8px;
  background: #f59e0b;
  border-radius: 50%;
  border: 1.5px solid #fff;
  position: absolute; bottom: 0; right: 0;
  animation: tp 1s infinite;
}
@keyframes tp { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── TYPING INDICATOR ── */
.typing-indicator {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  padding: 10px 14px;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.td {
  width: 7px; height: 7px;
  background: #94a3b8;
  border-radius: 50%;
  animation: td 1.4s infinite;
}
.td:nth-child(2) { animation-delay: .2s; }
.td:nth-child(3) { animation-delay: .4s; }
@keyframes td {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-9px); opacity: 1; }
}

/* ── SIDEBAR ── */
.sidebar-item {
  transition: all .2s cubic-bezier(.4,0,.2,1);
  border: 1px solid transparent;
  position: relative;
}
.sidebar-item:hover { background: #fff; transform: translateX(4px); border-color: #e2e8f0; }
.active-contact {
  background: #fff !important;
  border-color: #e0e7ff !important;
  box-shadow: 0 8px 15px -3px rgba(79,70,229,.1);
  transform: translateX(4px);
}
.unread-badge {
  position: absolute; top: 8px; right: 8px;
  min-width: 20px; height: 20px;
  background: #ef4444; color: #fff;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  box-shadow: 0 2px 8px rgba(239,68,68,.4);
  animation: bp 2s infinite;
}
@keyframes bp { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }

/* ── MESSAGE ANIMATION ── */
.msg-in {
  animation: mIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
  opacity: 0;
}
@keyframes mIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: none; }
}

/* ── SCROLL BUTTON ── */
#scroll-btn {
  position: absolute; bottom: 120px; right: 20px;
  width: 40px; height: 40px;
  background: var(--primary); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
  transition: all .3s; z-index: 10;
}
#scroll-btn.hidden { opacity: 0; pointer-events: none; transform: translateY(14px); }

/* ── CONTEXT MENU ── */
.ctx-menu {
  position: fixed; z-index: 400;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  overflow: hidden; min-width: 170px;
  animation: pop .15s ease;
}
@keyframes pop { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
.ctx-menu button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 14px;
  font-size: 12px; font-weight: 600; color: #1e293b;
  background: none; border: none; cursor: pointer; text-align: left;
  transition: background .15s;
}
.ctx-menu button:hover { background: #f8fafc; }
.ctx-menu button.danger { color: #ef4444; }
.ctx-menu button.danger:hover { background: #fef2f2; }
.ctx-menu hr { border: none; border-top: 1px solid #e2e8f0; margin: 3px 0; }

/* ── REACTIONS ── */
.rxn-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px; padding: 3px 8px;
  cursor: pointer; transition: transform .1s, background .15s;
  user-select: none;
}
.bubble-admin .rxn-pill,
.bubble-bot .rxn-pill { background: #f1f5f9; border-color: #e2e8f0; color: #1e293b; }
.rxn-pill.mine { background: rgba(79,70,229,.2); border-color: rgba(79,70,229,.4); }
.bubble-admin .rxn-pill.mine,
.bubble-bot .rxn-pill.mine { background: #e0e7ff; border-color: #c7d2fe; }
.rxn-pill:hover { transform: scale(1.08); }
.rxn-pill .cnt { font-size: 10px; font-weight: 700; }
.msg-rxns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rxn-panel {
  position: fixed; z-index: 500;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 2rem; padding: 8px 12px;
  display: none; gap: 4px; align-items: center;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
  animation: pop .15s ease;
}
.rxn-panel.open { display: flex; }
.rxn-panel button {
  background: none; border: none; cursor: pointer;
  transition: transform .15s, color .15s; padding: 4px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; width: 34px; height: 34px;
}
.rxn-panel button:hover { transform: scale(1.45); background: rgba(0,0,0,.05); color: #4f46e5; }

/* ── REACT BUTTON ── */
.react-btn {
  opacity: 0; transition: opacity .2s;
  width: 26px; height: 26px; border-radius: 50%;
  background: #fff; border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: absolute; top: 50%; transform: translateY(-50%);
  color: #94a3b8;
}
.msg-wrap:hover .react-btn { opacity: 1; }
.react-btn.lft { right: calc(100% + 8px); }
.react-btn.rgt { left: calc(100% + 8px); }
.react-btn:hover { color: #4f46e5; background: #f0f4ff; }
.msg-wrap { position: relative; }

/* ── ORDER CARD ── */
.order-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 8px 15px -3px rgba(0,0,0,.05); min-width: 250px;
}
.order-strip {
  background: #4f46e5; padding: 8px 14px;
  display: flex; justify-content: space-between; align-items: center;
}
.order-body {
  padding: 14px;
  background-image: radial-gradient(#e2e8f0 .5px, transparent .5px);
  background-size: 15px 15px;
}
.order-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; margin-bottom: 5px; font-family: monospace;
}
.order-dots { flex-grow: 1; border-bottom: 1px dotted #cbd5e1; margin: 0 8px; }
.order-total {
  border-top: 2px dashed #e2e8f0; margin-top: 10px; padding-top: 10px;
  display: flex; justify-content: space-between;
}

/* ── QUICK REPLY BUTTONS ── */
.qr-btn {
  display: inline-block; padding: 5px 13px;
  border-radius: 20px; border: 1px solid #e2e8f0;
  background: #fff; font-size: 11px; font-weight: 600;
  color: #64748b; cursor: pointer; transition: all .2s; white-space: nowrap;
}
.qr-btn:hover { background: #4f46e5; color: #fff; border-color: #4f46e5; }

/* ── REPLY PREVIEW ── */
.reply-prev {
  display: flex; align-items: center; gap: 9px;
  background: #f0f4ff; border-left: 3px solid #4f46e5;
  border-radius: 10px; padding: 7px 11px; margin-bottom: 8px;
  font-size: 11px; color: #4f46e5; font-weight: 600;
}

/* ── MESSAGE INPUT ── */
#msg-input {
  resize: none; overflow-y: auto;
  max-height: 120px; min-height: 24px; line-height: 1.5;
}

/* ── EMOJI PANEL ── */
.emoji-panel {
  display: none;
  position: absolute; bottom: calc(100% + 8px); left: 0;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; padding: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
  z-index: 150; width: 280px;
}
.emoji-panel.open { display: block; animation: pop .15s ease; }
.ep-icon {
  width: 28px; height: 28px; border: none; background: none;
  cursor: pointer; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; transition: all .15s; padding: 4px;
}
.ep-icon:hover { background: #f0f4ff; color: #4f46e5; transform: scale(1.2); }

/* ── TOASTS ── */
#toasts {
  position: fixed; top: 18px; right: 18px; z-index: 600;
  display: flex; flex-direction: column; gap: 7px; pointer-events: none;
}
.toast {
  background: #1e293b; color: #fff;
  border-radius: 12px; padding: 11px 16px;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 9px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  animation: tIn .3s ease; max-width: 300px; pointer-events: all;
}
@keyframes tIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.sh { background: #fef08a; border-radius: 2px; }

/* ── CHAT SEARCH ── */
#chat-sbar { display: none; }
#chat-sbar.open { display: flex; }

/* ── STATUS STRIP ── */
#status-strip {
  height: 3px;
  background: linear-gradient(90deg, #4f46e5, #8b5cf6, #ec4899);
  background-size: 200%;
  animation: ss 2s linear infinite;
}
@keyframes ss { 0% { background-position: 0%; } 100% { background-position: 200%; } }

/* ── CONNECTION BANNER ── */
#conn-banner { display: none; padding: 5px; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
#conn-banner.off { display: block; background: #fef2f2; color: #dc2626; border-bottom: 1px solid #fecaca; }
#conn-banner.ok { display: block; background: #f0fdf4; color: #16a34a; border-bottom: 1px solid #bbf7d0; animation: fo 2s forwards 2.5s; }
@keyframes fo { to { opacity: 0; height: 0; padding: 0; border: none; } }

/* ── PIN BAR ── */
.pin-bar {
  background: #fff; border-bottom: 1px solid #e2e8f0;
  padding: 7px 14px; display: flex; align-items: center; gap: 9px;
  font-size: 11px; font-weight: 600; color: #4f46e5;
  cursor: pointer; transition: background .15s;
}
.pin-bar:hover { background: #f0f4ff; }
.pinned-glow { outline: 2px solid rgba(79,70,229,.35); outline-offset: 2px; border-radius: inherit; }

/* ── ADMIN CARD ── */
.admin-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 14px; padding: 12px;
  margin: 6px 10px; overflow: hidden;
}

/* ── EDIT INPUT ── */
.edit-inp {
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
  color: inherit; border-radius: 8px; padding: 4px 8px;
  font-size: 13px; width: 100%; outline: none; font-family: inherit;
}
.bubble-admin .edit-inp { background: #f8fafc; border-color: #e2e8f0; color: #1e293b; }

/* ── TIMESTAMP TOOLTIP ── */
.ts { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.ts:hover .tt { display: block; }
.tt {
  display: none;
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff;
  border-radius: 8px; padding: 3px 8px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
  pointer-events: none; z-index: 30;
}

/* ── AVATARS ── */
.msg-av { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.msg-av-ph {
  width: 26px; height: 26px; border-radius: 50%;
  background: #e0e7ff; color: #4f46e5;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; flex-shrink: 0;
}
.av-spacer { width: 26px; flex-shrink: 0; }

/* ── STATUS BADGES ── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  cursor: pointer;
}
.status-active { background: #e0f2fe; color: #0284c7; }
.status-waiting { background: #fef3c7; color: #d97706; }
.status-resolved { background: #dcfce7; color: #16a34a; }
.status-archived { background: #f1f5f9; color: #64748b; }
.status-urgent { background: #fee2e2; color: #dc2626; animation: urgentPulse 2s infinite; }
@keyframes urgentPulse { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }

body.dark-theme .status-active { background: #0c4a6e; color: #7dd3fc; }
body.dark-theme .status-waiting { background: #451a03; color: #fcd34d; }
body.dark-theme .status-resolved { background: #052e16; color: #4ade80; }
body.dark-theme .status-archived { background: #1e293b; color: #64748b; }
body.dark-theme .status-urgent { background: #450a0a; color: #fca5a5; }

/* ── DATE SEPARATOR ── */
.date-sep { display: flex; align-items: center; gap: 10px; margin: 20px 0 8px; }
.date-sep::before,
.date-sep::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }
.date-sep span {
  font-size: 10px; font-weight: 800; color: #94a3b8;
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; padding: 0 8px;
}
body.dark-theme .date-sep::before,
body.dark-theme .date-sep::after { background: #334155; }

/* ── NOTES PANEL ── */
.notes-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 320px;
  background: #fff; border-left: 1px solid #e2e8f0;
  z-index: 200; transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -20px 0 60px rgba(0,0,0,.08);
}
.notes-panel.open { transform: translateX(0); }
body.dark-theme .notes-panel { background: #1e293b; border-color: #334155; }
.note-item {
  background: #fefce8; border: 1px solid #fef08a;
  border-radius: 10px; padding: 10px 12px; font-size: 11px; position: relative;
}
body.dark-theme .note-item { background: #2d2a0a; border-color: #453a00; }
.note-item textarea { background: transparent; border: none; outline: none; width: 100%; resize: none; font-family: inherit; font-size: 11px; color: #92400e; }
body.dark-theme .note-item textarea { color: #fde68a; }

/* ── STATS PANEL ── */
.stats-panel {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15,23,42,.7); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
}
.stats-panel.open { display: flex; }
.stats-box {
  background: #fff; border-radius: 2rem; padding: 2rem;
  max-width: 680px; width: calc(100% - 2rem); max-height: 90vh;
  overflow-y: auto; box-shadow: 0 40px 100px rgba(0,0,0,.3);
  animation: pop .3s cubic-bezier(.34,1.56,.64,1);
}
body.dark-theme .stats-box { background: #1e293b; }
.stat-card { background: #f8fafc; border-radius: 14px; padding: 14px 18px; text-align: center; }
body.dark-theme .stat-card { background: #0f172a; }
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 60px; padding-top: 8px; }
.bar {
  flex: 1; border-radius: 6px 6px 0 0; min-height: 4px;
  background: linear-gradient(to top, #4f46e5, #8b5cf6);
  transition: height .6s cubic-bezier(.34,1.56,.64,1);
}

/* ── SHORTCUTS PANEL ── */
.shortcuts-panel {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(15,23,42,.7); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
}
.shortcuts-panel.open { display: flex; }
.kbd {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; background: #f1f5f9;
  border: 1px solid #e2e8f0; border-bottom: 2px solid #cbd5e1;
  border-radius: 6px; font-size: 10px; font-weight: 700;
  font-family: monospace; color: #475569;
}
body.dark-theme .kbd { background: #334155; border-color: #475569; border-bottom-color: #1e293b; color: #94a3b8; }

/* ── FOCUS MODE ── */
body.focus-mode aside { width: 0 !important; overflow: hidden; padding: 0; }
body.focus-mode #status-strip { height: 2px; }

/* ── DRAFT INDICATOR ── */
.draft-dot { width: 6px; height: 6px; background: #f59e0b; border-radius: 50%; animation: tp 1.2s infinite; }

/* ── GLOBAL SEARCH ── */
.gsearch-panel {
  position: fixed; inset: 0; z-index: 350;
  background: rgba(15,23,42,.6); backdrop-filter: blur(6px);
  display: none; align-items: flex-start; justify-content: center; padding-top: 80px;
}
.gsearch-panel.open { display: flex; }
.gsearch-box {
  background: #fff; border-radius: 20px;
  width: calc(100% - 2rem); max-width: 580px;
  overflow: hidden; box-shadow: 0 40px 80px rgba(0,0,0,.3); animation: pop .2s ease;
}
body.dark-theme .gsearch-box { background: #1e293b; }
.gsearch-result { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid #f1f5f9; transition: background .12s; }
.gsearch-result:hover { background: #f0f4ff; }
body.dark-theme .gsearch-result { border-bottom-color: #334155; }
body.dark-theme .gsearch-result:hover { background: #334155; }

/* ── STATUS DROPDOWN ── */
.status-dd {
  position: fixed; z-index: 450;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.15);
  overflow: hidden; min-width: 200px; animation: pop .15s ease;
}
body.dark-theme .status-dd { background: #1e293b; border-color: #334155; }
.status-dd button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  font-size: 12px; font-weight: 700;
  background: none; border: none; cursor: pointer; text-align: left; transition: background .12s;
}
.status-dd button:hover { background: #f8fafc; }
body.dark-theme .status-dd button:hover { background: #334155; }

/* ── SIDEBAR BOTTOM BUTTONS ── */
.sb-bottom { border-top: 1px solid #e2e8f0; padding: 8px 10px; display: flex; gap: 5px; flex-shrink: 0; }
body.dark-theme .sb-bottom { border-color: #334155; }
.sb-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700; border: none; cursor: pointer;
  transition: all .2s; flex: 1; min-width: 0; white-space: nowrap;
  text-align: center; line-height: 1;
}
.sb-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.sb-btn.accent { background: #4f46e5; color: #fff; }
.sb-btn.accent:hover { background: #4338ca; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.sb-btn.muted { background: #f1f5f9; color: #64748b; }
.sb-btn.muted:hover { background: #e2e8f0; color: #475569; transform: translateY(-1px); }
body.dark-theme .sb-btn.muted { background: #334155; color: #94a3b8; }
body.dark-theme .sb-btn.muted:hover { background: #475569; color: #cbd5e1; }
.sb-badge { min-width: 16px; height: 16px; background: #ef4444; color: #fff; border-radius: 8px; font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ── BOT TOGGLE ── */
.bot-toggle-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 12px;
  font-size: 11px; font-weight: 700;
  cursor: pointer; transition: all .25s;
  border: 1.5px solid; white-space: nowrap;
}
.bot-toggle-btn.off { background: #f8fafc; color: #64748b; border-color: #e2e8f0; }
.bot-toggle-btn.off:hover { background: #f0f4ff; color: #4f46e5; border-color: #c7d2fe; }
.bot-toggle-btn.on {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
}
.bot-indicator { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.bot-indicator.on { background: #a5f3fc; animation: pulse 2s infinite; }
.bot-indicator.off { background: #94a3b8; }

/* ── BOT SUGGEST BAR ── */
.bot-suggest-bar {
  background: #fff; border-top: 1px solid #e2e8f0;
  padding: 8px 16px;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; min-height: 44px; transition: all .3s;
}
.bot-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; background: #f0f4ff; color: #4f46e5;
  border: 1px solid #c7d2fe; border-radius: 20px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: all .2s; white-space: nowrap; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis;
}
.bot-chip:hover { background: #4f46e5; color: #fff; border-color: #4f46e5; transform: translateY(-1px); }
.bot-chip-loading { opacity: .5; pointer-events: none; }
.bot-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px;
  background: linear-gradient(135deg, #e0e7ff, #ede9fe);
  color: #5b21b6; border-radius: 8px;
  font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid #c4b5fd;
}
.bubble-bot .bot-badge-inline {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 800; color: #7c3aed;
  background: #ede9fe; padding: 1px 6px; border-radius: 6px; margin-bottom: 4px;
  border: 1px solid #c4b5fd;
}
.bot-await-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: linear-gradient(90deg, #f0f4ff, #faf5ff);
  border: 1px solid #c7d2fe; border-radius: 10px;
  font-size: 11px; font-weight: 600; color: #5b21b6;
  margin: 4px 16px 2px;
}

/* ── POLL ── */
.poll-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 18px; overflow: hidden;
  min-width: 260px; max-width: 320px;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
}
.poll-header { background: linear-gradient(135deg, #4f46e5, #7c3aed); padding: 10px 14px; }
.poll-option-btn {
  width: 100%; text-align: left;
  background: none; border: 1.5px solid #e2e8f0;
  border-radius: 10px; padding: 8px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  position: relative; overflow: hidden;
  transition: border-color .2s; margin-bottom: 6px;
}
.poll-option-btn:hover { border-color: #4f46e5; }
.poll-option-bar {
  position: absolute; left: 0; top: 0; height: 100%;
  background: #e0e7ff; z-index: 0;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.poll-option-btn.voted-this { border-color: #4f46e5; background: #f0f4ff; }
.poll-option-text {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.poll-voted-badge { font-size: 9px; font-weight: 800; background: #4f46e5; color: #fff; padding: 1px 6px; border-radius: 10px; }

/* ── MULTI-FILE PREVIEW ── */
.file-preview-item {
  background: #f0f4ff; border: 1px solid #c7d2fe;
  border-radius: 10px; padding: 6px 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; color: #4f46e5;
}
.multi-img-grid { display: grid; gap: 4px; border-radius: 12px; overflow: hidden; }
.multi-img-grid.g1 { grid-template-columns: 1fr; }
.multi-img-grid.g2 { grid-template-columns: 1fr 1fr; }
.multi-img-grid.g3 { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
.multi-img-grid.g3 .img-thumb-wrap:first-child { grid-column: 1 / -1; }
.multi-img-grid .img-thumb-wrap { height: 130px; }
.multi-img-grid.g1 .img-thumb-wrap { height: 220px; }

/* ── CANNED RESPONSES ── */
.canned-panel {
  position: absolute; bottom: calc(100% + 8px); left: 0; right: 0;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0,0,0,.12);
  z-index: 200; max-height: 240px; overflow-y: auto; display: none;
}
.canned-panel.open { display: block; animation: pop .15s ease; }
.canned-item { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; font-size: 12px; transition: background .12s; }
.canned-item:hover { background: #f0f4ff; }
.canned-item strong { color: #4f46e5; font-size: 10px; display: block; margin-bottom: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ── SCHEDULE / POLL CREATOR PANELS ── */
.schedule-panel,
.poll-creator-panel {
  position: fixed; inset: 0; z-index: 350;
  background: rgba(15,23,42,.6); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
}
.schedule-panel.open,
.poll-creator-panel.open { display: flex; }

/* ── TRANSLATE BAR ── */
.translate-bar {
  background: #fff; border-top: 1px solid #e2e8f0;
  padding: 6px 16px; display: none;
  align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; color: #64748b;
}
.translate-bar.open { display: flex; }

/* ── CUSTOM MODAL ── */
#modal-overlay-custom {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(15,23,42,.6); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
}
#modal-overlay-custom.open { display: flex; }
#modal-overlay-custom > div {
  background: #fff; border-radius: 1.5rem; padding: 1.5rem;
  max-width: 480px; width: calc(100% - 2rem);
  box-shadow: 0 40px 80px rgba(0,0,0,.25);
  animation: pop .25s cubic-bezier(.34,1.56,.64,1);
}

/* ── CHECKLIST ── */
.checklist-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 14px; padding: 12px 14px; min-width: 220px;
}
.checklist-item {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; font-size: 12px; cursor: pointer;
}
.checklist-item input[type=checkbox] { accent-color: #4f46e5; width: 14px; height: 14px; }
.checklist-item.done span { text-decoration: line-through; opacity: .5; }

/* ── TOOLBAR BUTTONS ── */
.toolbar-btn { transition: all .2s; cursor: pointer; }
.toolbar-btn:hover { transform: scale(1.15); }

/* ── VOICE RECORDING ── */
.voice-recording {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 1.5px solid #fecaca; border-radius: 12px;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
}
.voice-wave span {
  display: inline-block; width: 3px;
  background: #ef4444; border-radius: 2px;
  animation: wv 0.8s ease infinite;
}
.voice-wave span:nth-child(1) { height: 8px; }
.voice-wave span:nth-child(2) { animation-delay: .1s; height: 16px; }
.voice-wave span:nth-child(3) { animation-delay: .2s; height: 22px; }
.voice-wave span:nth-child(4) { animation-delay: .3s; height: 14px; }
.voice-wave span:nth-child(5) { animation-delay: .4s; height: 18px; }
@keyframes wv { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }

/* ── VOICE PLAYER ── */
.voice-player {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: rgba(0,0,0,.06); border-radius: 12px; min-width: 220px;
}
.voice-play-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: #4f46e5; color: #fff; border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s;
}
.voice-play-btn:hover { background: #3730a3; transform: scale(1.05); }
.bubble-client .voice-player { background: rgba(255,255,255,.15); }
.bubble-client .voice-play-btn { background: rgba(255,255,255,.9); color: #4f46e5; }
.voice-progress-wrap { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.voice-prog {
  width: 100%; height: 4px;
  background: rgba(0,0,0,.12); border-radius: 2px;
  cursor: pointer; -webkit-appearance: none; appearance: none; outline: none;
}
.voice-prog::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: #4f46e5; cursor: pointer; margin-top: -4px;
}
.bubble-client .voice-prog::-webkit-slider-thumb { background: #fff; }
.voice-prog::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: transparent; }
.voice-time { font-size: 10px; font-weight: 700; opacity: .6; font-family: monospace; }

/* ── IMAGE GALLERY MODAL ── */
.gal-arrow {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff;
  border: none; cursor: pointer; font-size: 32px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, transform .2s;
  backdrop-filter: blur(8px); z-index: 200;
}
.gal-arrow:hover { background: rgba(255,255,255,.3); transform: translateY(-50%) scale(1.1); }
.gal-counter {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.5); color: #fff;
  padding: 4px 14px; border-radius: 20px;
  font-size: 13px; font-weight: 700; backdrop-filter: blur(8px); z-index: 200;
}
.gal-dots {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 200;
}
.gal-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.4); cursor: pointer; transition: all .2s;
}
.gal-dot.active { background: #fff; transform: scale(1.3); }

/* ── IMAGE THUMBNAIL WRAPPER ── */
.img-thumb-wrap {
  position: relative; cursor: zoom-in; overflow: hidden;
  border-radius: 4px;
}
.img-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; display: block; }
.img-thumb-wrap:hover img { transform: scale(1.04); }
.img-more-overlay {
  position: absolute; inset: 0;
  background: rgba(15,23,42,.6); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px; font-weight: 900;
  border-radius: 4px;
}

/* ── MULTI-IMG-GRID improvements ── */
.multi-img-grid .img-thumb-wrap { height: 130px; }
.multi-img-grid.g1 .img-thumb-wrap { height: 220px; border-radius: 12px; }
.multi-img-grid.g2 { border-radius: 12px; }
.multi-img-grid.g3 .img-thumb-wrap:first-child { height: 180px; }

/* ── UPLOAD PROGRESS BAR ── */
.upload-progress-bar {
  position: relative; background: #f1f5f9; border-radius: 20px;
  height: 24px; overflow: hidden; border: 1px solid #e2e8f0;
}
.upload-progress-fill {
  height: 100%; background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 20px; transition: width .3s ease;
  animation: shimmer 1.5s infinite;
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, #4f46e5 0%, #7c3aed 50%, #4f46e5 100%);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.upload-progress-txt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #4f46e5; mix-blend-mode: multiply;
}
body.dark-theme .upload-progress-bar { background: #334155; border-color: #475569; }
body.dark-theme .upload-progress-txt { color: #a5b4fc; mix-blend-mode: normal; }

/* ── AWAY MODE BUTTON ── */
.sb-btn.active {
  background: linear-gradient(135deg, #1e1b4b, #3730a3) !important;
  color: #a5b4fc !important;
  animation: awayglow 3s ease-in-out infinite;
}
@keyframes awayglow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,0); }
  50% { box-shadow: 0 0 0 4px rgba(79,70,229,.2); }
}

/* ── MESSAGE MARKDOWN ── */
.msg-code-block {
  background: rgba(0,0,0,.12); border-radius: 8px; padding: 8px 12px;
  font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-all; margin: 4px 0;
  overflow-x: auto;
}
.bubble-client .msg-code-block { background: rgba(0,0,0,.2); color: #e0e7ff; }
.msg-code-inline {
  background: rgba(0,0,0,.1); border-radius: 4px;
  padding: 1px 5px; font-family: monospace; font-size: 11px;
}
.bubble-client .msg-code-inline { background: rgba(0,0,0,.2); color: #e0e7ff; }
.msg-link {
  color: #4f46e5; text-decoration: underline; word-break: break-all;
  transition: opacity .15s;
}
.msg-link:hover { opacity: .75; }
.bubble-client .msg-link { color: #c7d2fe; }

/* ── CLIENT RESOLVE BUTTON ── */
#client-resolve-btn {
  animation: resolveGlow 2s ease-in-out infinite;
}
@keyframes resolveGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
  50% { box-shadow: 0 0 0 3px rgba(16,185,129,.15); }
}

/* ── DARK MODE code/link ── */
body.dark-theme .msg-code-block { background: rgba(255,255,255,.08); color: #c7d2fe; }
body.dark-theme .msg-code-inline { background: rgba(255,255,255,.1); color: #c7d2fe; }
body.dark-theme .msg-link { color: #818cf8; }

/* ══ IN-APP NOTIFICATIONS ══ */
#inapp-notifs { position:fixed; top:16px; right:16px; z-index:9999; display:flex; flex-direction:column; gap:8px; pointer-events:none; width:min(340px, calc(100vw - 32px)); }
.inapp-notif { display:flex; align-items:flex-start; gap:10px; padding:12px 14px 14px; background:#fff; border:1px solid #e2e8f0; border-radius:16px; box-shadow:0 8px 32px rgba(0,0,0,.12),0 2px 8px rgba(0,0,0,.06); pointer-events:all; opacity:0; transform:translateX(115%); transition:opacity .3s ease, transform .35s cubic-bezier(.34,1.4,.64,1); position:relative; overflow:hidden; }
.inapp-notif::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--accent,#4f46e5); }
.inapp-notif--in { opacity:1; transform:translateX(0); }
.inapp-notif--out { opacity:0; transform:translateX(115%); transition:opacity .2s ease, transform .2s ease; }
.inapp-notif--link { cursor:pointer; }
.inapp-notif--link:hover { filter:brightness(.97); }
.inapp-notif__title { font-size:12px; font-weight:800; color:#1e293b; line-height:1.3; margin-bottom:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.inapp-notif__body { font-size:11px; color:#64748b; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.inapp-notif__close:hover { background:#f1f5f9 !important; color:#ef4444 !important; }
.inapp-notif__prog { position:absolute; bottom:0; left:0; height:2px; background:var(--accent,#4f46e5); opacity:.35; border-radius:2px; animation:notif-shrink linear forwards; }
@keyframes notif-shrink { from{width:100%} to{width:0} }
body.dark-theme .inapp-notif { background:#1e293b; border-color:#334155; }
body.dark-theme .inapp-notif__title { color:#f1f5f9; }
body.dark-theme .inapp-notif__body { color:#94a3b8; }

/* ══ EMOJI PICKER CATEGORIES ══ */
.emoji-panel { position:absolute; bottom:calc(100% + 8px); left:0; background:#fff; border:1px solid #e2e8f0; border-radius:20px; padding:12px; box-shadow:0 12px 40px rgba(0,0,0,.14); z-index:200; width:288px; display:none; animation:pop .15s ease; max-height:320px; overflow-y:auto; }
.emoji-panel.open { display:block; }
.ep-search { width:100%; padding:6px 10px; border:1.5px solid #e2e8f0; border-radius:10px; font-size:11px; font-weight:600; color:#334155; background:#f8fafc; outline:none; margin-bottom:8px; }
.ep-search:focus { border-color:#4f46e5; background:#fff; }
.ep-cat { font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; color:#94a3b8; margin:8px 0 4px; }
.ep-cat:first-child { margin-top:0; }
.ep-row { display:flex; flex-wrap:wrap; gap:1px; }
.ep-icon { width:34px; height:34px; display:flex; align-items:center; justify-content:center; border:none; background:transparent; border-radius:10px; cursor:pointer; transition:background .1s, transform .1s; }
.ep-icon:hover { background:#f0f4ff; transform:scale(1.18); }
body.dark-theme .emoji-panel { background:#1e293b; border-color:#334155; }
body.dark-theme .ep-search { background:#0f172a; border-color:#334155; color:#e2e8f0; }
body.dark-theme .ep-icon:hover { background:#334155; }

/* ══ TRANSLATION BADGE ══ */
.msg-text[data-orig]::after { content:'traduit'; display:inline-block; margin-left:5px; font-size:8px; font-weight:800; color:#059669; background:#d1fae5; padding:1px 5px; border-radius:5px; text-transform:uppercase; vertical-align:middle; }
body.dark-theme .msg-text[data-orig]::after { background:#064e3b; color:#34d399; }