/* GlobalChat - WhatsApp/TG inspired dark theme */
:root {
  --bg: #0b141a;
  --panel: #111b21;
  --panel-head: #202c33;
  --hover: #202c33;
  --active: #2a3942;
  --outgoing: #005c4b;
  --incoming: #202c33;
  --accent: #00a884;
  --accent-dark: #008069;
  --text: #e9edef;
  --text-2: #8696a0;
  --border: rgba(134, 150, 160, .15);
  --tick-read: #53bdeb;
  --danger: #ef697d;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
.hidden { display: none !important; }
svg { fill: currentColor; }

button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
img { -webkit-user-drag: none; }

.icon-btn {
  background: none; border: none; color: var(--text-2);
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

.avatar {
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: linear-gradient(135deg, #2f4650, #3b4a54);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); font-weight: 600; line-height: 1;
  overflow: hidden; user-select: none;
}
.avatar-sm { width: 40px; height: 40px; font-size: 16px; }
.avatar-lg { width: 160px; height: 160px; font-size: 64px; }

/* ==================== AUTH ==================== */
.auth-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #111b21 0%, #0b141a 55%, #002b20 100%);
  padding: 16px; overflow-y: auto;
}
.auth-card {
  width: 100%; max-width: 400px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 16px; padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.auth-brand { text-align: center; margin-bottom: 26px; }
.brand-logo { width: 56px; height: 56px; color: var(--accent); }
.auth-brand h1 { font-size: 26px; letter-spacing: .3px; margin-top: 8px; }
.auth-brand p { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }

.auth-tabs {
  display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 22px;
}
.auth-tab {
  flex: 1; padding: 9px; border: none; background: none; color: var(--text-2);
  border-radius: 8px; font-size: 14.5px; font-weight: 600; transition: all .15s;
}
.auth-tab.active { background: var(--panel-head); color: var(--text); }

.auth-form label {
  display: block; font-size: 12.5px; color: var(--accent); font-weight: 600;
  margin-bottom: 14px;
}
.auth-form input, .modal-body input {
  display: block; width: 100%; margin-top: 5px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 11px 12px; font-size: 15px; outline: none;
  transition: border-color .15s;
}
.auth-form input:focus, .modal-body input:focus { border-color: var(--accent); }
.auth-form input:disabled { opacity: .55; }

.auth-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

.btn-primary {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: var(--accent); color: #04231c; font-size: 15px; font-weight: 700;
  transition: background .15s;
}
.btn-primary:hover { background: #00c298; }
.btn-primary:disabled { opacity: .6; cursor: wait; }

/* ==================== APP LAYOUT ==================== */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 30%; min-width: 280px; max-width: 440px;
  background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: relative;
}

.fab {
  position: absolute; right: 18px; bottom: 18px;
  width: 54px; height: 54px; border-radius: 50%; border: none;
  background: var(--accent); color: #04231c; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  transition: transform .15s, background .15s;
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { background: #00c298; }
.fab:active { transform: scale(.92); }

.modal-search { margin: 4px 0 12px; padding-top: 2px; padding-bottom: 2px; }
.modal-hint { font-size: 12.5px; color: var(--text-2); line-height: 1.5; margin-bottom: 10px; }
.search-results { max-height: 320px; overflow-y: auto; }
.result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 8px; border-radius: 10px; cursor: pointer;
}
.result-item:hover { background: var(--hover); }
.result-info { min-width: 0; display: flex; flex-direction: column; }
.result-name { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-user { font-size: 12.5px; color: var(--text-2); }
.results-empty { text-align: center; color: var(--text-2); font-size: 13px; padding: 18px 6px; }
.side-head {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-head); padding: 10px 16px; flex-shrink: 0;
}
.side-myname { font-weight: 600; font-size: 16px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head-actions { display: flex; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  margin: 8px 12px; background: var(--panel-head); border-radius: 10px; padding: 0 12px;
  flex-shrink: 0;
}
.search-icon { width: 18px; height: 18px; color: var(--text-2); flex-shrink: 0; }
.search-box input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 14px; padding: 10px 0;
}
.search-box input::placeholder { color: var(--text-2); }

.chat-list { flex: 1; overflow-y: auto; }
.chat-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px; cursor: pointer; transition: background .12s;
}
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-mid { flex: 1; min-width: 0; }
.chat-top, .chat-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-name { font-size: 15.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-time { font-size: 11.5px; color: var(--text-2); flex-shrink: 0; }
.chat-preview {
  font-size: 13.5px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px;
}
.chat-badge {
  background: var(--accent); color: #04231c; font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.online-dot {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px;
  background: #21c063; border: 2.5px solid var(--panel); border-radius: 50%;
}
.avatar-wrap { position: relative; flex-shrink: 0; }
.chat-empty-note { text-align: center; color: var(--text-2); padding: 40px 24px; font-size: 14px; line-height: 1.7; }

/* ==================== CHAT PANE ==================== */
.chat-pane {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(0, 168, 132, .05) 0 2px, transparent 2px),
    radial-gradient(circle at 80% 60%, rgba(134, 150, 160, .05) 0 2px, transparent 2px),
    radial-gradient(circle at 45% 85%, rgba(83, 189, 235, .04) 0 2px, transparent 2px),
    #0b141a;
  background-size: 220px 220px;
}

.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--text-2); gap: 6px; padding: 20px; text-align: center;
  border-bottom: 6px solid var(--accent);
}
.empty-logo { width: 90px; height: 90px; color: #3b4a54; margin-bottom: 14px; }
.empty-state h2 { color: var(--text); font-weight: 400; font-size: 30px; }
.empty-state p { font-size: 14.5px; }

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel-head); padding: 9px 16px; flex-shrink: 0;
  z-index: 5;
}
.back-btn { display: none; }
.chat-head-info { display: flex; flex-direction: column; min-width: 0; }
.chat-head-info span { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-status { color: var(--text-2); font-size: 12.5px; }
.peer-status.typing { color: var(--accent); font-style: italic; }

.messages {
  flex: 1; overflow-y: auto; padding: 18px 7% 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.day-sep { align-self: center; margin: 14px 0 8px; }
.day-chip {
  background: #182229; color: var(--text-2); font-size: 12px;
  padding: 6px 12px; border-radius: 8px; letter-spacing: .2px;
}

.msg-row { display: flex; }
.msg-row.out { justify-content: flex-end; }
.bubble {
  position: relative; max-width: 65%; padding: 6px 9px 8px;
  border-radius: 9px; font-size: 14.6px; line-height: 1.42;
  word-wrap: break-word; overflow-wrap: break-word;
  box-shadow: 0 1px .5px rgba(0, 0, 0, .25);
  animation: pop .12s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.msg-row.in .bubble { background: var(--incoming); border-top-left-radius: 2px; }
.msg-row.out .bubble { background: var(--outgoing); border-top-right-radius: 2px; }
.bubble.pending { opacity: .65; }

.bubble-meta {
  float: right; display: inline-flex; align-items: center; gap: 3px;
  margin: 6px -2px -4px 10px; font-size: 11px; color: rgba(233, 237, 239, .55);
  user-select: none;
}
.ticks { font-size: 13px; letter-spacing: -3px; margin-right: -2px; }
.ticks.read { color: var(--tick-read); }
.ticks.delivered { opacity: 1; }

.bubble img.pic {
  display: block; max-width: 100%; max-height: 320px;
  border-radius: 6px; margin-bottom: 5px; cursor: zoom-in;
}
.file-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0, 0, 0, .18); border-radius: 8px; padding: 9px 12px; margin-bottom: 4px;
  color: var(--text); text-decoration: none; min-width: 180px;
}
.file-card svg { width: 26px; height: 26px; color: #7f66ff; flex-shrink: 0; }
.file-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 11.5px; color: var(--text-2); }

.typing-row { padding: 0 7% 4px; height: 24px; }
.typing-row span {
  display: inline-flex; gap: 4px; align-items: center;
  background: var(--incoming); border-radius: 12px; padding: 6px 12px; font-size: 12.5px; color: var(--text-2);
}
typing dot, .typing-row dot { animation: blink 1.2s infinite; display: inline-block; }
.typing-row dot:nth-child(2) { animation-delay: .2s; }
.typing-row dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.composer {
  display: flex; align-items: flex-end; gap: 6px;
  background: var(--panel-head); padding: 8px 14px; flex-shrink: 0;
}
#msg-input {
  flex: 1; background: var(--bg); border: none; outline: none;
  color: var(--text); font-size: 15px; line-height: 1.4;
  border-radius: 10px; padding: 11px 14px; resize: none; max-height: 130px;
}
.send-btn {
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: var(--accent); color: #04231c; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .12s, background .15s;
}
.send-btn:hover { background: #00c298; }
.send-btn:active { transform: scale(.92); }
.send-btn svg { width: 21px; height: 21px; margin-left: 2px; }

.load-more-wrap { text-align: center; padding: 6px 0 12px; }
.chip-btn {
  background: #182229; color: var(--text-2); border: none; border-radius: 20px;
  padding: 7px 16px; font-size: 12.5px;
}
.chip-btn:hover { color: var(--text); background: var(--active); }

/* ==================== MODAL / LIGHTBOX / TOAST ==================== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; gap: 6px;
  background: var(--panel-head); padding: 8px 12px;
}
.modal-head h3 { font-size: 16px; font-weight: 500; }
.modal-body { padding: 24px 28px 28px; }
.avatar-edit { position: relative; width: 160px; margin: 0 auto 22px; }
.avatar-cam {
  position: absolute; inset: auto auto 8px 8px;
  width: 46px; height: 46px; border-radius: 50%; border: none;
  background: rgba(11, 20, 26, .75); color: #c8d2d8;
  display: inline-flex; align-items: center; justify-content: center;
}
.avatar-cam svg { width: 22px; height: 22px; }
.avatar-cam:hover { color: #fff; background: rgba(11, 20, 26, .9); }
.modal-body label {
  display: block; font-size: 12.5px; color: var(--accent); font-weight: 600; margin-bottom: 14px;
}

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, .88);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 6px; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #233138; color: var(--text); font-size: 13.5px;
  border-radius: 10px; padding: 11px 20px; z-index: 300;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5); max-width: 86vw; text-align: center;
}

.conn-banner {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%);
  background: #4a3316; color: #ffd37a; border: 1px solid rgba(255, 211, 122, .35);
  font-size: 13px; padding: 8px 18px; border-radius: 20px; z-index: 150;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4); white-space: nowrap;
}

/* ==================== SCROLLBARS ==================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: rgba(134, 150, 160, .35); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ==================== MOBILE ==================== */
@media (max-width: 900px) {
  .sidebar { width: 100%; max-width: none; min-width: 0; }
  .chat-pane {
    position: fixed; inset: 0; z-index: 20;
    transform: translateX(100%); transition: transform .22s ease;
  }
  .chat-pane.open { transform: translateX(0); }
  .back-btn { display: inline-flex; }
  .bubble { max-width: 78%; }
  .messages { padding: 14px 4% 10px; }
}

/* ==================== v6: GROUPS / CHANNELS / COMMUNITIES ==================== */
.avatar-wrap { position: relative; flex-shrink: 0; }
.online-dot {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px;
  background: #06cf9c; border: 2px solid #111b21; border-radius: 50%;
}
.type-tag {
  font-size: 8.5px; font-weight: 700; letter-spacing: .5px;
  padding: 2px 5px; border-radius: 4px; margin-left: 6px; vertical-align: middle;
}
.tag-group { background: rgba(0, 168, 132, .18); color: #53bdeb; }
.tag-channel { background: rgba(83, 189, 235, .16); color: #7cc7ef; }
.tag-community { background: rgba(155, 121, 245, .16); color: #b39af7; }
.tag-bot { background: rgba(255, 193, 7, .16); color: #ffc107; }

/* avatar tints per chat type */
.g-channel { box-shadow: inset 0 0 0 2px rgba(124, 199, 239, .45); }
.g-community { box-shadow: inset 0 0 0 2px rgba(179, 154, 247, .45); }

.sender-name { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.msg-row.in .bubble .sender-name { display: block; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  background: #2a3942; color: var(--text); border-radius: 16px;
  padding: 5px 10px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 7px;
}
.chip b { cursor: pointer; color: #8696a0; font-weight: 700; padding: 0 1px; }
.chip b:hover { color: #e9edef; }

.create-box { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.create-label { font-size: 12px; color: #8696a0; white-space: nowrap; }
#chat-type {
  background: #2a3942; color: var(--text); border: none; border-radius: 8px;
  padding: 9px 8px; font-size: 13px; outline: none; cursor: pointer;
}
#chat-name-input {
  flex: 1; min-width: 110px; background: #2a3942; border: none; border-radius: 8px;
  color: var(--text); padding: 9px 12px; font-size: 13.5px; outline: none;
}
.btn-create {
  background: var(--accent); border: none; color: #fff; font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: 8px; cursor: pointer;
}
.btn-create:hover { filter: brightness(1.08); }
#create-error { margin-top: 8px; }

.results-divider {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 6px;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: #667781;
}
.results-divider::after { content: ""; flex: 1; height: 1px; background: #222d34; }
.results-group {
  font-size: 11px; letter-spacing: .8px; text-transform: uppercase;
  color: #00a884; margin: 10px 0 2px; padding-left: 4px;
}
.results-empty { color: #667781; font-size: 13px; text-align: center; padding: 18px 8px; }
.result-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 6px; border-radius: 10px; cursor: default;
}
.result-item:hover { background: #202c33; }
.result-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.result-name { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-user { font-size: 12.5px; color: #8696a0; }
.mini-btn {
  background: transparent; border: 1px solid #00a884; color: #00a884;
  font-size: 12.5px; font-weight: 600; border-radius: 18px; padding: 5px 14px; cursor: pointer;
  flex-shrink: 0;
}
.mini-btn:hover { background: rgba(0, 168, 132, .12); }
.chip-btn {
  background: #2a3942; border: none; color: #53bdeb; font-size: 13px;
  border-radius: 20px; padding: 8px 18px; cursor: pointer; margin: 10px auto; display: block;
}
.chip-btn:hover { background: #33454f; }
.load-more-wrap.hidden { display: none; }
.share-btn { margin-left: auto; flex-shrink: 0; }

/* ==================== v8: CREATE WIZARD + CHAT INFO ==================== */
.modal-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.mtab {
  flex: 1; background: #202c33; border: none; color: #8696a0;
  font-size: 13.5px; font-weight: 600; padding: 9px 0; border-radius: 8px; cursor: pointer;
}
.mtab.active { background: rgba(0, 168, 132, .15); color: #00a884; }

.field-label {
  display: block; font-size: 12px; color: #8696a0; margin: 12px 0 5px; letter-spacing: .3px;
}
#pane-create input[type="text"], #pane-create select,
#info-admin-tools input[type="text"] {
  width: 100%; box-sizing: border-box; background: #2a3942; border: none; border-radius: 8px;
  color: var(--text); padding: 10px 12px; font-size: 14px; outline: none;
}
.uname-row { display: flex; align-items: center; gap: 6px; }
.uname-at { color: #8696a0; font-size: 16px; font-weight: 600; }
.uname-status { font-size: 12px; margin-left: auto; white-space: nowrap; }
.uname-status.ok { color: #06cf9c; }
.uname-status.invalid { color: #f15c6d; }
.check-row {
  display: flex; align-items: center; gap: 9px; margin-top: 12px;
  font-size: 13.5px; color: var(--text); cursor: pointer; user-select: none;
}
.check-row input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.wizard-actions {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px;
}
.btn-ghost {
  background: transparent; border: 1px solid #3b4a54; color: #8696a0;
  font-size: 13.5px; padding: 9px 16px; border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: #55646e; }

.info-hero { text-align: center; padding: 4px 0 2px; }
.info-hero .avatar-lg { margin: 0 auto 10px; display: block; width: 84px; height: 84px; font-size: 34px; }
.info-hero h3 { margin: 0 0 4px; font-size: 18px; color: var(--text); word-break: break-word; }
.info-sub { font-size: 13px; color: #8696a0; margin-bottom: 10px; }
.info-link-row { display: flex; gap: 8px; align-items: center; }
.info-link-row input {
  flex: 1; min-width: 0; background: #2a3942; border: none; border-radius: 8px;
  color: #53bdeb; padding: 9px 11px; font-size: 12.5px; outline: none;
}
.info-about { color: #d1d7db; font-size: 13.5px; margin: 12px 0 0; word-break: break-word; white-space: pre-wrap; }
.save-chat-btn { margin-top: 12px; padding: 9px 22px; }

.member-list { max-height: 300px; overflow-y: auto; }
.member-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-radius: 10px;
}
.member-row:hover { background: #202c33; }
.mem-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mem-name { font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem-user { font-size: 12px; color: #8696a0; }
.role-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  padding: 3px 7px; border-radius: 10px; flex-shrink: 0;
}
.rb-owner { background: rgba(255, 193, 7, .15); color: #ffc107; }
.rb-admin { background: rgba(83, 189, 235, .15); color: #53bdeb; }
.rb-member { background: rgba(134, 150, 160, .15); color: #8696a0; }
.member-row .mini-btn { padding: 4px 10px; font-size: 11.5px; }
.you-tag { font-size: 11.5px; color: #667781; }

.danger-zone { display: flex; gap: 10px; margin-top: 16px; }
.btn-danger {
  flex: 1; background: transparent; border: 1px solid #f15c6d; color: #f15c6d;
  font-size: 13.5px; font-weight: 600; padding: 10px 0; border-radius: 8px; cursor: pointer;
}
.btn-danger:hover { background: rgba(241, 92, 109, .1); }
.btn-danger.danger-strong { border-color: #e5484d; background: rgba(229, 72, 77, .08); }

/* ==================== v9: input-rule conflict fixes ==================== */
.check-row input[type="checkbox"] {
  width: 16px; height: 16px; margin: 0; padding: 0;
  display: inline-block; flex-shrink: 0;
  background: none; border: none;
  accent-color: var(--accent); cursor: pointer;
}
.check-row.disabled { opacity: .45; pointer-events: none; }
.uname-row #chat-uname-input,
#info-admin-tools #edit-name, #info-admin-tools #edit-about {
  margin-top: 0;
}
.uname-row #chat-uname-input {
  flex: 1; min-width: 0; width: auto;
}
#pane-create select { margin-top: 0; }
.info-link-row input { margin-top: 0; }

/* ==================== v10: info modal avatar centering + scroll ==================== */
.info-avatar-wrap { display: flex; justify-content: center; align-items: center; margin-bottom: 10px; }
.info-hero .avatar-lg {
  width: 84px; height: 84px; font-size: 34px;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-overlay { overflow-y: auto; }
.modal { margin: auto; }
.member-list { overscroll-behavior: contain; }
@media (max-width: 480px) {
  .modal-body { padding: 18px 16px 22px; }
}

/* ==================== v11: permission toggles + pin banner ==================== */
.pin-banner {
  display: flex; align-items: center; gap: 10px;
  background: #202c33; border-bottom: 1px solid rgba(134, 150, 160, .15);
  padding: 7px 14px; cursor: pointer; flex-shrink: 0;
}
.pin-banner svg { width: 16px; height: 16px; fill: #ffc107; flex-shrink: 0; }
.pin-body {
  flex: 1; min-width: 0; font-size: 12.5px; color: #8696a0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pin-unpin { width: 28px; height: 28px; }
.pin-unpin svg { width: 14px; height: 14px; fill: currentColor; }

.perm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 2px;
}
.perm-label { font-size: 13.5px; color: var(--text); display: flex; align-items: center; gap: 8px; min-width: 0; }
.soon-tag {
  font-size: 9.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  background: rgba(255, 193, 7, .14); color: #ffc107; padding: 2px 6px; border-radius: 8px;
  white-space: nowrap;
}
.perm-row.soon .perm-label { color: #8696a0; }

.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; margin: 0; position: absolute; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #3b4a54; border-radius: 22px; transition: background .18s;
}
.switch .slider::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  transition: transform .18s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ==================== v12: attach menu, reactions, polls ==================== */

.attach-menu {
  position: absolute;
  bottom: 54px;
  left: 12px;
  background: #233138;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  padding: 6px;
  z-index: 60;
  min-width: 170px;
}
.composer { position: relative; }
.attach-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: #e9edef;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
}
.attach-item:hover { background: #2a3942; }
.attach-item svg { width: 20px; height: 20px; fill: #8696a0; flex-shrink: 0; }
.attach-item:hover svg { fill: var(--accent); }

.react-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.react-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.25);
  color: #e9edef;
  font-size: 13px;
  line-height: 18px;
  cursor: pointer;
}
.react-chip span { font-size: 11.5px; color: #c4ccd1; }
.react-chip.mine {
  border-color: var(--accent);
  background: rgba(37,211,102,.15);
}
.react-chip.mine span { color: var(--accent); }

.react-picker {
  position: fixed;
  display: flex;
  gap: 2px;
  padding: 5px 6px;
  background: #233138;
  border-radius: 24px;
  box-shadow: 0 6px 22px rgba(0,0,0,.5);
  z-index: 90;
}
.rp-emoji {
  border: 0;
  background: transparent;
  font-size: 21px;
  line-height: 34px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .12s, background .12s;
}
.rp-emoji:hover { transform: scale(1.25); background: #2a3942; }

.poll { min-width: 220px; max-width: 280px; }
.poll-q { font-weight: 600; margin-bottom: 8px; word-break: break-word; }
.poll-opt {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  padding: 7px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  overflow: hidden;
  font-size: 14px;
}
.poll-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(37,211,102,.16);
  transition: width .25s ease;
  pointer-events: none;
}
.poll-opt.mine .poll-fill { background: rgba(37,211,102,.28); }
.poll-txt { position: relative; z-index: 1; word-break: break-word; }
.poll-check {
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  margin-right: 5px;
}
.poll-count {
  position: absolute;
  right: 10px;
  top: 7px;
  z-index: 1;
  font-size: 12px;
  color: #c4ccd1;
}
.poll-total { font-size: 12px; color: #8696a0; margin-top: 2px; }

.poll-opt-input { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.poll-opt-input input {
  width: 100% !important;
  background: #2a3942;
  border: 1px solid #3b4a54;
  border-radius: 8px;
  color: #e9edef;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
}
.poll-opt-input input:focus { border-color: var(--accent); }
.poll-opt-del { width: 32px; height: 32px; font-size: 14px; color: #8696a0; }
.mini-btn {
  background: transparent;
  border: 1px dashed #3b4a54;
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 10px;
}
.mini-btn:hover { background: rgba(37,211,102,.08); }
