/* ============================================================
   Pingly — Stylesheet principal
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=VT323&family=Nunito:wght@400;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-body:      #0d0d1a;
  --bg-app:       #1a1a2e;
  --bg-sidebar:   #16213e;
  --bg-chat:      #0f3460;
  --bg-input:     rgba(0,0,0,0.35);
  --bg-bubble-me:   #1a4a8a;
  --bg-bubble-them: #2a2a4a;

  --text-main:    #e0e0ff;
  --text-muted:   #8888bb;
  --text-system:  #44aaff;
  --text-nick:    #ff9944;

  --accent:       #00b4b4;
  --accent-hover: #00cccc;
  --green:        #00aa44;
  --away:         #ffaa00;
  --red:          #cc2222;
  --orange:       #ff6600;

  --border:       #2a2a5a;
  --border-light: #3a3a7a;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-main: 'Nunito', sans-serif;
  --font-mono: 'VT323', monospace;
}

html, body {
  height: 100%;
  background: var(--bg-body);
  font-family: var(--font-main);
  color: var(--text-main);
  overflow: hidden;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3a6a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #5a5a9a; }

/* ── Titlebar ────────────────────────────────────────────── */
#titlebar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 18px;
  background: var(--bg-body);
  border-bottom: 1px solid var(--border);
  height: 44px;
  user-select: none;
}

#titlebar .logo {
  font-family: var(--font-mono);
  font-size: 28px; color: var(--accent); letter-spacing: 2px;
}
#titlebar .logo span { color: var(--text-nick); }

#titlebar .tagline {
  font-size: 11px; color: var(--text-muted);
}

#titlebar .spacer { flex: 1; }

.conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); margin-right: 4px;
  animation: pulse 2s ease-in-out infinite;
  display: inline-block;
}

@keyframes pulse {
  0%,100% { opacity:1; } 50% { opacity: 0.35; }
}

#titlebar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm);
  transition: background 0.2s;
}
#titlebar-user:hover { background: rgba(255,255,255,0.05); }

.tb-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}

/* ── App layout ──────────────────────────────────────────── */
#app {
  display: flex;
  height: calc(100vh - 44px);
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  width: 240px; min-width: 240px;
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  transition: width 0.25s;
}

#my-profile {
  padding: 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; position: relative;
  transition: background 0.2s;
}
#my-profile:hover { background: rgba(0,180,180,0.06); }

.my-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0; position: relative;
}

.avatar-status-dot {
  position: absolute; bottom: 0; right: 0;
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--bg-sidebar);
}

.status-online  { background: var(--green) !important; }
.status-away    { background: var(--away)  !important; }
.status-busy    { background: var(--red)   !important; }
.status-offline { background: #555         !important; }

#my-display-name { font-size: 13px; font-weight: 700; color: var(--text-main); }
#my-status-msg   { font-size: 11px; color: var(--text-muted); max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status dropdown */
.status-menu {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-sidebar); border: 1px solid var(--border);
  border-radius: var(--radius-md); z-index: 200; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.status-menu.open { display: block; }

.status-opt {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; font-size: 12px; cursor: pointer;
  transition: background 0.15s;
}
.status-opt:hover { background: rgba(0,180,180,0.1); }

.sdot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* Tabs */
#tabs { display: flex; border-bottom: 1px solid var(--border); }

.tab-btn {
  flex: 1; padding: 9px 0;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 11px; font-weight: 700;
  font-family: var(--font-main); text-transform: uppercase; letter-spacing: 0.8px;
  cursor: pointer; transition: all 0.2s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text-main); }

/* Badge sur les onglets (non-lus MP) */
.tab-badge {
  display: inline-block; background: #e03030; color: #fff;
  font-size: 9px; font-weight: 700; padding: 1px 5px;
  border-radius: 8px; margin-left: 5px; vertical-align: middle;
}

/* Flash rouge sur l'onglet quand nouveau message */
@keyframes tab-flash {
  0%,100% { color: var(--text-muted); }
  25%,75% { color: #ff4444; background: rgba(255,68,68,0.15); border-radius: 6px; }
}
.tab-btn.tab-flash { animation: tab-flash 0.6s ease 3; }

/* Item liste avec message non-lu */
.list-item.item-unread .item-name { color: var(--text-main); font-weight: 700; }

/* Badge rouge (MP non-lus) */
.badge-red { background: #e03030 !important; }

/* Flash sur un item de liste */
@keyframes item-flash {
  0%,100% { background: transparent; }
  30%,70% { background: rgba(224,48,48,0.18); }
}
.list-item.item-flash { animation: item-flash 0.5s ease 3; }

/* Search */
.search-wrap { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.search-input {
  width: 100%; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-main); font-family: var(--font-main);
  font-size: 12px; padding: 6px 10px; outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

/* List panes */
.tab-pane { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.tab-pane.active { display: flex; }

.list-scroll { flex: 1; overflow-y: auto; padding: 4px 0; }

.section-header {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  padding: 10px 12px 3px; text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: 5px; user-select: none;
}
.section-header::before { content: '▾'; font-size: 9px; }

/* Contact / Channel items */
.list-item {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; cursor: pointer;
  transition: background 0.15s; border-radius: var(--radius-sm); margin: 1px 6px;
}
.list-item:hover { background: rgba(0,180,180,0.08); }
.list-item.active { background: rgba(0,180,180,0.16); }

.contact-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; position: relative;
}

.channel-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: rgba(0,180,180,0.12);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 22px; color: var(--accent); flex-shrink: 0;
}

.item-info { min-width: 0; flex: 1; }
.item-name { font-size: 12px; font-weight: 700; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub  { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  background: var(--orange); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; flex-shrink: 0;
}

/* Add buttons */
.add-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; cursor: pointer; margin: 2px 6px;
  border-radius: var(--radius-sm); transition: background 0.15s;
  color: var(--accent); font-size: 12px; font-weight: 700;
}
.add-btn:hover { background: rgba(0,180,180,0.08); }

/* ── Chat area ───────────────────────────────────────────── */
#chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

#chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; height: 56px;
  background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#chat-header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}

#chat-header-name { font-size: 15px; font-weight: 700; color: var(--text-main); }
#chat-header-sub  { font-size: 11px; color: var(--text-muted); }

.header-actions { margin-left: auto; display: flex; gap: 6px; }

.hdr-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); padding: 5px 11px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.hdr-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Messages ────────────────────────────────────────────── */
#messages {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-chat);
}

.msg-system {
  text-align: center; color: var(--text-system);
  font-family: var(--font-mono); font-size: 15px;
  padding: 5px 0; opacity: 0.75; letter-spacing: 0.5px;
}

/* Menu contextuel clic droit sur un user */
#user-ctx-menu {
  animation: modal-in 0.12s ease;
}
.msg-system-irc {
  text-align: left !important; font-style: normal !important;
  font-family: var(--font-main) !important; opacity: 1 !important;
  background: rgba(0,180,180,0.06); border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0; padding: 7px 12px !important;
  margin: 3px 8px; font-size: 12px !important;
  color: var(--text-main) !important; line-height: 1.8;
}
.msg-system-irc code {
  background: rgba(0,180,180,0.15); color: var(--accent);
  padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono);
  font-size: 11px;
}

.msg-date {
  text-align: center; font-size: 10px; color: var(--text-muted);
  padding: 10px 0; display: flex; align-items: center; gap: 8px;
}
.msg-date::before, .msg-date::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.irc-action {
  text-align: center; font-style: italic;
  color: var(--orange); font-size: 12px; padding: 3px 0;
}

.msg-row { display: flex; align-items: flex-end; gap: 8px; margin: 2px 0; }
.msg-row.me { flex-direction: row-reverse; }

.msg-av {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0;
}

.msg-group { display: flex; flex-direction: column; max-width: 65%; gap: 2px; }
.msg-row.me .msg-group { align-items: flex-end; }

.msg-nick { font-size: 10px; font-weight: 700; color: var(--text-nick); padding: 0 4px; margin-bottom: 1px; }
.msg-row.me .msg-nick { color: var(--accent); }

.bubble {
  background: var(--bg-bubble-them);
  padding: 8px 13px; font-size: 13px; line-height: 1.55;
  border-radius: 14px 14px 14px 2px; word-break: break-word;
  color: var(--text-main);
}
.msg-row.me .bubble { background: var(--bg-bubble-me); border-radius: 14px 14px 2px 14px; }

.bubble-ts { font-size: 10px; color: var(--text-muted); display: block; text-align: right; margin-top: 3px; }

.nudge-bubble {
  background: rgba(255,102,0,0.15); border: 1px solid var(--orange);
  padding: 7px 13px; border-radius: 10px; font-size: 12px;
  color: var(--orange); font-style: italic;
}

.typing-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.typing-dots span {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--text-muted); animation: blink 1.2s infinite; margin: 0 1px;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink { 0%,80%,100% { opacity:0.2; transform:scale(0.8); } 40% { opacity:1; transform:scale(1); } }

/* Nudge screen shake */
@keyframes nudge-shake {
  0%,100% { transform:translateX(0); }
  10%     { transform:translateX(-8px); }
  30%     { transform:translateX(8px); }
  50%     { transform:translateX(-6px); }
  70%     { transform:translateX(6px); }
  90%     { transform:translateX(-3px); }
}
.nudge-anim { animation: nudge-shake 0.5s ease; }

/* ── Input area ──────────────────────────────────────────── */
#input-area {
  padding: 10px 14px; border-top: 1px solid var(--border);
  background: var(--bg-sidebar); display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
}

.fmt-bar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

.fmt-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); width: 27px; height: 24px; border-radius: 5px;
  font-size: 11px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; flex-shrink: 0;
}
.fmt-btn.emoji { font-size: 14px; width: 30px; }
.fmt-btn:hover { color: var(--accent); border-color: var(--accent); }
.fmt-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(0,180,180,0.1); }

.fmt-sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; }

.hints { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin-left: auto; }

.input-row { display: flex; gap: 8px; align-items: center; }

.nudge-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: var(--radius-sm);
  padding: 0 10px; height: 38px; font-size: 18px; cursor: pointer;
  transition: all 0.2s; flex-shrink: 0;
}
.nudge-btn:hover { color: var(--orange); border-color: var(--orange); }

#msg-input {
  flex: 1; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-main); font-family: var(--font-main);
  font-size: 13px; padding: 0 12px; outline: none; height: 38px;
  transition: border-color 0.2s;
}
#msg-input:focus { border-color: var(--accent); }
#msg-input::placeholder { color: var(--text-muted); }

.send-btn {
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 0 18px; height: 38px;
  font-size: 13px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; white-space: nowrap; transition: all 0.2s; flex-shrink: 0;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:active { transform: scale(0.97); }

/* ── Users panel ─────────────────────────────────────────── */
#users-panel {
  width: 175px; min-width: 175px; display: none;
  background: var(--bg-sidebar); border-left: 1px solid var(--border);
  flex-direction: column; overflow: hidden;
}

.users-header {
  padding: 12px 10px 6px; border-bottom: 1px solid var(--border);
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}

.user-group-hdr {
  font-size: 9px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  padding: 8px 10px 2px;
}

.user-entry {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; font-size: 11px; cursor: pointer;
  border-radius: 4px; margin: 1px 4px; transition: background 0.15s;
}
.user-entry:hover { background: rgba(0,180,180,0.08); }

.user-mode { font-family: var(--font-mono); font-size: 15px; color: var(--orange); width: 13px; text-align: center; flex-shrink: 0; }
.user-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Toast ───────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--bg-sidebar); border: 1px solid var(--accent);
  border-radius: var(--radius-md); padding: 12px 16px;
  max-width: 270px; z-index: 999;
  box-shadow: 0 8px 24px rgba(0,180,180,0.18);
  transform: translateY(80px); opacity: 0;
  transition: all 0.35s cubic-bezier(.34,1.56,.64,1);
  cursor: pointer;
}
#toast.show { transform: translateY(0); opacity: 1; }
.toast-name { font-size: 12px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.toast-body { font-size: 11px; color: var(--text-muted); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.72); align-items: center; justify-content: center;
  z-index: 500;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-sidebar); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 32px;
  width: 360px; max-width: 95vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal h2 { font-size: 18px; font-weight: 700; color: var(--text-main); margin-bottom: 20px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 5px; }

.form-input, .form-select {
  width: 100%; background: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-main); font-family: var(--font-main);
  font-size: 13px; padding: 9px 12px; outline: none;
  transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus { border-color: var(--accent); }
.form-select option { background: #1a1a2e; }

.modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.btn-cancel {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); padding: 8px 18px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; transition: all 0.2s;
}
.btn-cancel:hover { border-color: var(--text-muted); color: var(--text-main); }

.btn-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 8px 20px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }

.error-msg { color: #ff6666; font-size: 12px; margin-top: 6px; }
.success-msg { color: var(--green); font-size: 12px; margin-top: 6px; }

/* Search results (add contact) */
.search-result-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.search-result-item:last-child { border-bottom: none; }

.small-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
  background: var(--accent);
}

.btn-add-sm {
  margin-left: auto; background: none; border: 1px solid var(--accent);
  color: var(--accent); padding: 3px 10px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; transition: all 0.2s; flex-shrink: 0;
}
.btn-add-sm:hover { background: var(--accent); color: #fff; }
.btn-add-sm:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar { width: 200px; min-width: 200px; }
  #users-panel { display: none !important; }
  .hdr-btn.users-btn { display: none; }
}

@media (max-width: 520px) {
  #sidebar { position: absolute; left: -240px; z-index: 100; height: calc(100vh - 44px); transition: left 0.3s; }
  #sidebar.open { left: 0; }
  #titlebar .tagline { display: none; }
  .hdr-btn:not(.mobile-menu) { display: none; }
}

/* ── Auth pages ──────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-body); padding: 20px;
}

.auth-card {
  background: var(--bg-sidebar); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.auth-logo {
  text-align: center; margin-bottom: 28px;
}
.auth-logo .logo { font-family: var(--font-mono); font-size: 38px; color: var(--accent); letter-spacing: 3px; }
.auth-logo .logo span { color: var(--text-nick); }
.auth-logo p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.auth-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.auth-tab {
  flex: 1; padding: 10px 0; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 13px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; text-transform: uppercase; letter-spacing: 0.8px; transition: all 0.2s;
}
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.auth-submit {
  width: 100%; background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 11px; margin-top: 6px;
  font-size: 14px; font-weight: 700; font-family: var(--font-main);
  cursor: pointer; transition: all 0.2s;
}
.auth-submit:hover { background: var(--accent-hover); }

.auth-error   { color: #ff7070; font-size: 12px; text-align: center; margin-top: 10px; min-height: 18px; }
.auth-success { color: var(--green); font-size: 12px; text-align: center; margin-top: 10px; min-height: 18px; }

/* ── Modal view-profile ──────────────────────────────────── */
#modal-view-profile .modal { padding: 22px 24px; }
#vp-stats > div:hover { background: rgba(0,180,180,0.1); transition: background 0.15s; }

/* Textarea dans modal profil */
#prof-bio {
  width: 100%; box-sizing: border-box;
  background: var(--bg-chat); color: var(--text-main);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px;
}
#prof-bio:focus { outline: none; border-color: var(--accent); }

/* Champ âge */
#prof-age { -moz-appearance: textfield; }
#prof-age::-webkit-inner-spin-button,
#prof-age::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Reply / Edit bar ─────────────────────────────────────── */
.reply-bar-ui {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; background: rgba(0,180,180,0.08);
  border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  margin-bottom: 6px; font-size: 12px; color: var(--text-muted);
}
.reply-bar-ui button {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 14px;
  padding: 2px 6px; border-radius: 4px;
}
.reply-bar-ui button:hover { color: var(--text-main); background: rgba(255,255,255,0.05); }
.reply-bar-line {
  width: 3px; height: 28px; background: var(--accent);
  border-radius: 2px; flex-shrink: 0;
}

/* ── Citation dans bulle ─────────────────────────────────── */
.msg-reply-preview {
  display: flex; gap: 6px; align-items: stretch;
  margin-bottom: 6px; opacity: 0.7;
}
.reply-bar { width: 3px; background: var(--accent); border-radius: 2px; flex-shrink: 0; }
.reply-text {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}

/* ── Hover actions sur les messages ─────────────────────── */
.msg-row { position: relative; }
.msg-hover-actions {
  display: none; position: absolute;
  top: 0; right: 4px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 2px 4px;
  gap: 2px; z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.msg-row:hover .msg-hover-actions { display: flex; }
.msg-row.me .msg-hover-actions { right: auto; left: 4px; }
.msg-hover-actions button {
  background: none; border: none; cursor: pointer;
  font-size: 14px; padding: 3px 5px; border-radius: 5px;
  color: var(--text-muted); transition: all 0.1s;
}
.msg-hover-actions button:hover { background: rgba(0,180,180,0.1); color: var(--text-main); }

/* ── @Mentions ───────────────────────────────────────────── */
.mention {
  color: var(--accent); font-weight: 700;
  background: rgba(0,180,180,0.1);
  border-radius: 4px; padding: 0 3px;
}
.mention-me {
  color: #fff; background: rgba(0,180,180,0.3);
  animation: mention-pulse 1s ease 2;
}
@keyframes mention-pulse {
  0%,100% { background: rgba(0,180,180,0.3); }
  50%      { background: rgba(0,180,180,0.6); }
}

/* ── Aperçu de lien ──────────────────────────────────────── */
.link-preview {
  display: flex; gap: 10px; margin: 8px 0 4px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 8px; cursor: pointer; max-width: 320px;
  transition: background 0.15s;
}
.link-preview:hover { background: rgba(0,180,180,0.06); }
.link-preview img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 6px; flex-shrink: 0;
}
.lp-text { min-width: 0; flex: 1; }
.lp-title { font-size: 12px; font-weight: 700; color: var(--text-main); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-desc  { font-size: 11px; color: var(--text-muted); line-height: 1.4; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lp-url   { font-size: 10px; color: var(--accent); opacity: 0.7; }
.msg-link { color: var(--accent); text-decoration: underline; }

/* ── Message édité ───────────────────────────────────────── */
.bubble-ts { font-size: 10px; color: var(--text-muted); display: block; text-align: right; margin-top: 3px; }

/* ── MOTD modal overlay ──────────────────────────────────── */
#modal-motd { display: none; }
#modal-motd.open { display: flex; }

