.chat-page {
  display: flex;
  gap: 12px;

  height: 100%;
  width: 100%;

  overflow: hidden;
}
.chat-left { width: 330px; display:flex; flex-direction:column; }
.chat-left-header { display:flex; justify-content:space-between; align-items:center; padding:14px; border-radius:14px; background: rgba(255,255,255,0.04); }
.chat-left-header h1 { margin:0; font-size:18px; }
.chat-left-header p { margin:2px 0 0; opacity:.7; font-size:12px; }
.chat-left-actions .btn { height:34px; min-width:34px; border-radius:10px; }

.chat-servers { margin-top:12px; flex:1; border-radius:14px; background: rgba(255,255,255,0.04); padding:10px; overflow:auto; }

.chat-tree { display:flex; flex-direction:column; gap:10px; }
.chat-cat { user-select:none; }
.chat-cat-title { display:flex; align-items:center; justify-content:space-between; padding:8px 10px; border-radius:10px; opacity:.85; font-weight:600; }
.chat-cat-title .caret { opacity:.6; }
.chat-channels { margin-top:6px; display:flex; flex-direction:column; gap:4px; padding-left:8px; }

.chat-channel { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:10px; cursor:pointer; opacity:.85; }
.chat-channel:hover { background: rgba(255,255,255,0.06); }
.chat-channel.active { background: rgba(255,255,255,0.10); opacity:1; }
.chat-channel .hash { opacity:.6; }
.chat-channel .name { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-channel .badge { font-size:12px; padding:2px 8px; border-radius:999px; background: rgba(255,255,255,0.14); }
.chat-channel.unread .name { font-weight:700; }
.chat-channel.unread::before { content:""; width:6px; height:6px; border-radius:999px; background: rgba(255,255,255,0.8); margin-left:-4px; }

.chat-main { flex:1; display:flex; flex-direction:column; border-radius:14px; background: rgba(255,255,255,0.04); overflow:hidden; }
.chat-main-header { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.chat-main-title { display:flex; gap:10px; align-items:flex-start; }
.chat-main-title .hash { margin-top:2px; opacity:.6; }
.chat-main-title .title { font-weight:800; }
.chat-main-title .topic { font-size:12px; opacity:.7; margin-top:2px; }

.chat-messages { flex:1; overflow:auto; padding:14px; display:flex; flex-direction:column; gap:10px; }
.msg { display:flex; gap:10px; padding:8px 10px; border-radius:12px; }
.msg:hover { background: rgba(255,255,255,0.04); }
.msg .avatar { width:36px; height:36px; border-radius:12px; background: rgba(255,255,255,0.08); overflow:hidden; flex:0 0 auto; }
.msg .avatar img { width:100%; height:100%; object-fit:cover; }
.msg .meta { display:flex; flex-direction:column; gap:3px; }
.msg .head { display:flex; gap:10px; align-items:baseline; }
.msg .name { font-weight:800; }
.msg .time { font-size:12px; opacity:.55; }
.msg .content { white-space:pre-wrap; line-height:1.35; }
.msg .mention { padding:1px 6px; border-radius:8px; background: rgba(255,255,255,0.12); font-weight:700; }

.chat-composer { padding:12px 14px; border-top: 1px solid rgba(255,255,255,0.06); display:flex; gap:10px; align-items:flex-end; position:relative; }
.chat-input { flex:1; min-height:42px; max-height:120px; resize:none; border-radius:12px; padding:10px 12px; background: rgba(0,0,0,0.22); border: 1px solid rgba(255,255,255,0.08); color: #fff; outline:none; }
.mention-pop { position:absolute; bottom:64px; left:14px; width:420px; max-height:220px; overflow:auto; border-radius:14px; background: rgba(20,20,20,0.95); border: 1px solid rgba(255,255,255,0.10); display:none; padding:6px; }
.mention-item { padding:8px 10px; border-radius:10px; cursor:pointer; display:flex; justify-content:space-between; gap:10px; }
.mention-item:hover { background: rgba(255,255,255,0.08); }
.mention-item small { opacity:.65; }

.chat-messages-wrap { position:relative; flex:1; display:flex; flex-direction:column; overflow:hidden; }
.chat-load-older {
  margin:10px auto 0;
  border-radius: 999px;
  padding:8px 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  color:#fff; cursor:pointer;
}

.chat-jumpbar, .chat-newbar {
  position:absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 10px;
  z-index: 5;
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 12px;
  border-radius: 999px;
  background: rgba(20,20,20,0.96);
  border: 1px solid rgba(255,255,255,0.12);
}
.chat-newbar { top: 52px; }
.chat-jumpbar span, .chat-newbar span { opacity:.9; }

/* .modal {
  position:fixed;
  inset:0;
  background: rgba(0,0,0,0.55);
  display:none;
  align-items:center;
  justify-content:center;
  z-index: 9999;
}
.modal.active { display:flex; }

.modal-card {
  width: 520px;
  max-width: calc(100vw - 30px);
  border-radius: 16px;
  background: rgba(25,25,25,0.98);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  overflow:hidden;
}
.modal-card.big { width: 980px; }

.modal-head {
  padding: 14px 14px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.modal-head h2 { margin:0; font-size:16px; }
.modal-head p { margin:4px 0 0; opacity:.65; font-size:12px; }

.modal-body { padding: 14px; display:flex; flex-direction:column; gap:12px; }
.modal-actions {
  padding: 12px 14px;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  border-top: 1px solid rgba(255,255,255,0.08);
} */

.field { display:flex; flex-direction:column; gap:6px; }
.field span { font-size:12px; opacity:.7; }
.field.row { flex-direction:row; align-items:center; justify-content:space-between; }
.toggle { display:flex; align-items:center; gap:8px; opacity:.9; }
.hint { font-size:12px; opacity:.7; line-height:1.3; }

.acl-top { display:flex; gap:14px; }
.acl-left { width: 340px; display:flex; flex-direction:column; gap:10px; }
.acl-right { flex:1; display:grid; grid-template-columns: 1fr 1fr; gap:12px; }

.acl-section {
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  overflow:hidden;
}
.acl-title {
  padding:10px 12px;
  font-weight:800;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  opacity:.9;
}
.acl-list { max-height: 360px; overflow:auto; padding:8px; display:flex; flex-direction:column; gap:6px; }
.acl-item {
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; padding:8px 10px; border-radius:12px;
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.06);
}
.acl-item:hover { background: rgba(255,255,255,0.06); }
.acl-item small { opacity:.6; font-size:12px; }

.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip {
  display:flex; align-items:center; gap:8px;
  padding:6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
  font-size:12px;
}
.chip button {
  height:18px; width:18px; border-radius:999px;
  border:none; cursor:pointer;
  background: rgba(0,0,0,0.25);
  color:#fff;
}

/* =========================
   CHAT - PATCH UI BTN + INPUT
========================= */

/* Buttons */
.chat-left-actions .btn,
.chat-main-tools .btn,
.modal-actions .btn,
.modal-actions .btn-success,
#chatSendBtn,
#chatCreateCategoryBtn,
#chatCreateChannelBtn,
#chatRefreshBtn,
#chatChannelAclBtn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.92);
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
}

.chat-left-actions .btn:hover,
.chat-main-tools .btn:hover,
.modal-actions .btn:hover,
#chatSendBtn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.18);
}

.chat-left-actions .btn:active,
.chat-main-tools .btn:active,
.modal-actions .btn:active,
#chatSendBtn:active {
  transform: translateY(1px);
}

/* Success button */
.btn-success,
#chatSendBtn {
  border-color: rgba(80,255,150,0.22);
  background: rgba(80,255,150,0.14);
  color: rgba(230,255,240,0.95);
}
.btn-success:hover,
#chatSendBtn:hover {
  background: rgba(80,255,150,0.18);
  border-color: rgba(80,255,150,0.28);
}

/* Small square buttons (+Cat +Salon ↻) */
.chat-left-actions .btn {
  min-width: 40px;
  padding: 0 10px;
}

/* Disabled button (Accès) */
#chatChannelAclBtn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

/* Inputs */
.chat-left-header .input,
.chat-main-tools .input,
/* .modal .input, */
#chatSearch {
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.22);
  color: rgba(255,255,255,0.92);
  padding: 0 12px;
  outline: none;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}

.chat-left-header .input::placeholder,
.chat-main-tools .input::placeholder,
.modal .input::placeholder,
#chatSearch::placeholder {
  color: rgba(255,255,255,0.55);
}

.chat-left-header .input:focus,
.chat-main-tools .input:focus,
/* .modal .input:focus, */
#chatSearch:focus {
  border-color: rgba(120,180,255,0.35);
  box-shadow: 0 0 0 3px rgba(120,180,255,0.12);
  background: rgba(0,0,0,0.28);
}

/* Align tools row better */
.chat-main-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
#chatSearch {
  width: 220px; /* ajuste si tu veux */
}

/* Optional: nicer header spacing */
.chat-left-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* =========================
   CHAT MODALS (namespaced)
   no conflict with global MDT
========================= */

.chat-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.chat-modal.is-open { display: flex; }

.chat-modal__card {
  width: 560px;
  max-width: calc(100vw - 36px);
  border-radius: 18px;
  overflow: hidden;

  background: rgba(18, 22, 30, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 24px 80px rgba(0,0,0,0.55);
}

.chat-modal__card--big {
  width: 980px;
}

.chat-modal__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;

  padding: 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-modal__head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  color: rgba(255,255,255,0.92);
}

.chat-modal__head p {
  margin: 6px 0 0;
  font-size: 12px;
  opacity: 0.65;
}

.chat-modal__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-modal__actions {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* close button (top right) */
.chat-modal__head .btn {
  min-width: 36px;
  padding: 0 10px;
}

/* form fields inside modal */
.chat-modal .field span {
  font-size: 12px;
  opacity: 0.70;
}

.chat-modal .hint {
  font-size: 12px;
  opacity: 0.65;
  line-height: 1.35;
}

/* prevent global white input */
.chat-modal .input {
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.92);
  padding: 0 12px;
  outline: none;
}

.chat-modal .input:focus {
  border-color: rgba(120,180,255,0.35);
  box-shadow: 0 0 0 3px rgba(120,180,255,0.12);
  background: rgba(0,0,0,0.30);
}

/* =========================
   CHAT MODAL CLOSE BUTTON
========================= */

.chat-modal__head .btn {
  width: 34px;
  height: 34px;
  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);

  color: rgba(255,255,255,0.75);
  font-size: 14px;
  font-weight: 700;

  cursor: pointer;
  transition: all .12s ease;
}

.chat-modal__head .btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.95);
}

.chat-modal__head .btn:active {
  transform: translateY(1px);
}

/* =========================
   CHAT CANCEL BUTTON
========================= */

.chat-modal__actions .btn {
  height: 36px;
  padding: 0 16px;

  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);

  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);

  font-weight: 700;
  font-size: 13px;

  cursor: pointer;
  transition: all .12s ease;
}

.chat-modal__actions .btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.20);
}

.chat-modal__actions .btn:active {
  transform: translateY(1px);
}

.chat-left {
  width: 320px;
  min-width: 320px;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}

/* container catégories + salons */
.chat-servers {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;

  padding-right: 4px;
}

.chat-main {
  flex: 1;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}

/* container messages + jumpbars */
.chat-messages-wrap {
  flex: 1;

  display: flex;
  flex-direction: column;

  overflow: hidden;
}

/* vraie zone scroll */
.chat-messages {
  flex: 1;

  overflow-y: auto;
  overflow-x: hidden;

  padding: 16px;
}

.chat-composer {
  flex-shrink: 0;

  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Scrollbar MDT style */

.chat-servers::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-servers::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-servers::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
}

.chat-servers::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}

#chatPageRoot {
  height: 100%;
  overflow: hidden;
}