@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  --bg: #0f1117;
  --bg-2: #151822;
  --bg-3: #1b1f2b;
  --bg-4: #202638;
  --panel: #1c2130;
  --accent: #5865f2;
  --accent-2: #7b84ff;
  --text: #f1f3ff;
  --muted: #a3aec7;
  --danger: #ff6b6b;
  --success: #57f287;
  --shadow: 0 24px 60px rgba(0,0,0,0.4);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  background: #0c0e14;
  color: var(--text);
  overflow: hidden;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #2a2f42 transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: #2a2f42;
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: #3a425a;
}
#app { min-height: 100vh; }

button, input, select {
  font-family: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: #0f121a;
  color: var(--text);
}
button {
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.2s ease;
}
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }
.hidden { display: none !important; }
.hint { color: var(--muted); }
.mobile-only { display: none; }

/* Auth */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(123,132,255,0.35), transparent 60%),
    radial-gradient(700px 400px at 0% 20%, rgba(88,101,242,0.3), transparent 65%),
    #0c0e14;
  padding: 24px;
}
.auth-card {
  width: min(520px, 92vw);
  background: linear-gradient(180deg, rgba(28,33,48,0.98), rgba(18,20,30,0.98));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}
.auth-brand h1 { margin: 0; font-size: 28px; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); }
.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.auth-tabs .tab {
  background: #111522;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
}
.auth-tabs .tab.active {
  background: var(--accent);
  color: white;
}
.auth-form { display: grid; gap: 10px; }

/* App shell */
.app-shell {
  display: grid;
  grid-template-columns: 84px 260px 1fr 240px;
  gap: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

.panel {
  background: var(--panel);
  border: none;
  border-radius: 0;
  padding: 14px;
  box-shadow: none;
}

#servers { background: #121520; }
#channels { background: #161a26; }
#members { background: #151a27; }
#servers, #channels, #members {
  overflow-y: auto;
  height: 100%;
}
#serverInfo {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  margin-bottom: 10px;
  background: #1a2030;
  border-radius: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  cursor: pointer;
}
#serverInfo .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #2a2f42;
  font-weight: 700;
}
#serverInfo .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
#serverInfo .meta small { color: var(--muted); display: block; }
#serverInfo .actions { display: flex; gap: 6px; }
#serverInfo .actions button { background: #2a2f42; font-size: 14px; width: 34px; }
#channels { position: relative; }

#servers h3, #channels h3, #members h3 {
  margin: 6px 0 12px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#servers button {
  width: 100%;
  margin-bottom: 10px;
  background: #2a2f42;
}
#servers button:hover { background: #353b52; }

#servers .item {
  padding: 10px;
  margin-bottom: 10px;
  background: #1b2030;
  border-radius: 16px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  height: 56px;
}
#servers .item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2b3148, #2a2f42);
  color: var(--text);
  font-weight: 700;
}
#servers .item .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
#servers .item.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 20%;
  width: 4px;
  height: 60%;
  border-radius: 4px;
  background: var(--accent);
}

#channels .item, #members .item {
  padding: 10px;
  margin-bottom: 8px;
  background: var(--bg-3);
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}
#channels .item .avatar,
#members .item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #2a2f42;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
#channels .item .avatar.has-image,
#members .item .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.admin-user .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

/* Status Indicators */
.avatar-wrap {
  position: relative;
  display: inline-block;
}

.status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--panel);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
  z-index: 1;
}

.status-dot-small {
  width: 12px;
  height: 12px;
  border-width: 2px;
  bottom: -1px;
  right: -1px;
}

.mobile-icon {
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: 8px;
  background: white;
  border-radius: 50%;
  width: 10px;
  height: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.status-label {
  color: var(--muted) !important;
  font-size: 11px;
  margin-top: 2px;
}
#channels .item .meta,
#members .item .meta {
  display: grid;
  gap: 2px;
}
#channels .item .meta .preview {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
#members .item small {
  color: var(--muted);
}
#channels .item.active { outline: 2px solid var(--accent); }

#chat {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  background: #171b27;
  min-height: 0;
}
.chat-empty {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.chat-empty .friends-list {
  width: min(420px, 90vw);
  margin-top: 12px;
  text-align: left;
}
.chat-empty .friend-item {
  background: #1a2030;
}
.chat-empty .empty-state h2 {
  margin: 0 0 6px;
  color: var(--text);
}
#chat.empty {
  grid-template-rows: 1fr;
}
#chat.empty #chatHeader,
#chat.empty #messages,
#chat.empty #messageForm,
#chat.empty #uploadForm {
  display: none;
}
#chat.empty #chatEmpty {
  display: grid;
}
#chatHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #1a1f2d;
  padding: 12px 14px;
  border-radius: 0;
}
#chatHeader h2 { margin: 0; font-size: 18px; }
#chatHeader small { color: var(--muted); }
#chatHeader .actions button { background: #2a2f42; color: var(--text); }
#chatHeader .actions button:hover { background: #353b52; }

#serverMenuBtn {
  width: 40px;
  font-size: 20px;
  padding: 6px 0;
}

#messages {
  overflow-y: auto;
  padding: 12px;
  background: #121622;
  border-radius: 0;
  min-height: 0;
}
#voicePanel {
  display: none;
  background: #141a28;
  border-radius: 12px;
  padding: 12px;
  max-height: calc(100vh - 200px);
  overflow: hidden;
  grid-template-rows: auto auto 1fr auto;
  min-height: 0;
}
.voice-panel .voice-header {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}
.voice-participants {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  margin-bottom: 10px;
}
.voice-user {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: #1a2030;
  border-radius: 10px;
}
.voice-user .muted-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #ffb3b3;
  margin-left: 8px;
}
.voice-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 12px;
}
.voice-user .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.voice-user.speaking .avatar {
  box-shadow: 0 0 0 2px #2ecc71;
}
.voice-volume {
  width: 100%;
  margin-top: 6px;
}
.voice-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 6px;
  position: sticky;
  bottom: 0;
  background: #141a28;
  padding-top: 4px;
  overflow-x: auto;
  align-items: center;
}
.voice-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  min-width: 44px;
}
.voice-controls button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.voice-controls button::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  background: #0f131d;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  box-shadow: var(--shadow);
}
.voice-controls button:hover::after,
.voice-controls button:focus-visible::after {
  opacity: 1;
}
.voice-controls button.danger { background: #3a1f1f; color: #ffb3b3; }
.voice-controls .ghost { background: #1a2030; border: 1px solid rgba(255,255,255,0.08); }
.voice-screens {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.voice-screens[data-count="1"] { grid-template-columns: 1fr; }
.voice-screens[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.voice-screens[data-count="3"],
.voice-screens[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.voice-screens[data-count="5"],
.voice-screens[data-count="6"],
.voice-screens[data-count="7"],
.voice-screens[data-count="8"] { grid-template-columns: repeat(3, 1fr); }
.voice-screens.has-focus { grid-template-columns: 1fr; }
.voice-screens.has-focus .voice-screen { display: none; }
.voice-screens.has-focus .voice-screen.focused { display: block; }
.voice-media {
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
  overflow: auto;
  min-height: 0;
}
.voice-preview {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  align-items: center;
}
.voice-preview .avatar {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 10px;
}
.voice-preview .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.voice-preview-more {
  font-size: 11px;
  color: var(--muted);
}
.voice-preview-names {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.voice-screen {
  background: #101525;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.voice-screen video {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}
.voice-screen.focused video {
  max-height: 70vh;
  object-fit: contain;
  cursor: zoom-out;
}

#chat.voice #messages,
#chat.voice #messageForm,
#chat.voice #uploadForm {
  display: none;
}
#chat.voice #voicePanel { display: grid; }
#messages.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
  background: #141a2b;
}
.load-older-btn {
  background: #2a2f42;
  color: var(--text);
  width: 100%;
  margin-bottom: 10px;
}
.message {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.message strong { color: white; }
.message small { color: var(--muted); display: block; }
.message-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}
.message .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #2a2f42;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.message .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.message-image {
  max-width: min(420px, 70vw);
  max-height: 360px;
  border-radius: 10px;
  margin-top: 6px;
  display: block;
  cursor: zoom-in;
}
.mention-token {
  display: inline-block;
  padding: 0 6px;
  border-radius: 7px;
  background: rgba(88, 166, 255, 0.22);
  color: #9ecbff;
  font-weight: 600;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1200;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5,7,12,0.85);
}
#lightboxImg {
  position: relative;
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #1a2030;
  color: var(--text);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(10px);
  background: #1a2030;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1200;
  box-shadow: var(--shadow);
  font-size: 13px;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 700px) {
  .message-image {
    max-width: 88vw;
    max-height: 260px;
  }
}

.reactions { margin-top: 6px; display: flex; gap: 8px; }
.reaction {
  font-size: 13px;
  cursor: pointer;
  padding: 2px 8px;
  background: #2a2f40;
  border-radius: 999px;
}

#messageForm {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 8px;
  background: #1a2030;
  padding: 8px;
  border-radius: 0;
  position: relative;
}
#messageForm .composer-btn {
  background: #2a2f42;
  color: var(--text);
  width: 40px;
}
#messageForm input {
  background: #0f131d;
  border-radius: 10px;
}
.mention-autocomplete {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: calc(100% + 6px);
  max-height: 220px;
  overflow: auto;
  background: #111726;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: grid;
  gap: 4px;
  z-index: 25;
}
.mention-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
}
.mention-item small {
  color: var(--muted);
}
.mention-item.active,
.mention-item:hover {
  background: #283248;
}
.mention-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 8px 10px;
}
#uploadForm {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.section-title {
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.member-actions { display: flex; gap: 6px; margin-top: 6px; }
.member-actions button { padding: 4px 6px; font-size: 12px; background: #2a2f42; }
.member-actions button:hover { background: #3a4058; }

.user-bar {
  margin-top: 12px;
  padding: 10px;
  background: #121826;
  border-radius: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  position: fixed;
  left: 0;
  bottom: 0;
  width: calc(84px + 260px);
  z-index: 10;
}
.voice-dock {
  padding: 10px;
  background: #101522;
  border-radius: 0;
  display: grid;
  gap: 8px;
  position: fixed;
  left: 0;
  bottom: 64px;
  width: calc(84px + 260px);
  z-index: 10;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.voice-dock.hidden { display: none; }
.voice-dock-info {
  display: grid;
  gap: 2px;
}
.voice-dock-info small { color: var(--muted); }
.voice-dock-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.voice-dock-actions button {
  background: #2a2f42;
  color: var(--text);
  padding: 6px 0;
  font-size: 12px;
}
.voice-dock-actions button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.voice-dock-actions button.active {
  background: #3a4058;
}
.voice-dock-actions button.danger {
  background: #3a1f1f;
  color: #ffb3b3;
}
.user-bar .avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #2a2f42;
  color: var(--text);
  font-weight: 700;
}
.user-bar .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.user-bar .meta small { color: var(--muted); display: block; }
.user-bar .user-menu-btn {
  background: #2a2f42;
  padding: 6px 10px;
}

.context-menu {
  position: fixed;
  min-width: 320px;
  max-width: min(92vw, 460px);
  background: #151a27;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px;
  box-shadow: var(--shadow);
  z-index: 2100;
}
.context-menu .item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.context-menu .item:hover { background: #232a3b; }
.context-menu .item.danger { color: var(--danger); }
.context-menu .item.muted { color: var(--muted); }
.role-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}
.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #3b6cff;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.verified-badge svg {
  width: 12px;
  height: 12px;
  fill: #fff;
}
.badge-wrap {
  display: inline-flex;
  gap: 6px;
  margin-left: 6px;
}
.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 6px 0 10px;
}
.admin-tabs .tab {
  padding: 6px 10px;
  border-radius: 10px;
  background: #1a2030;
}
.admin-tabs .tab.active {
  background: #2a2f42;
}
.admin-dashboard {
  width: min(1820px, 99vw);
  height: min(96vh, 1100px);
  max-height: 96vh;
  overflow: auto;
}
.admin-server-manage-card {
  width: min(760px, 96vw);
  max-height: 92vh;
  overflow: auto;
}
.admin-server-manage-card .avatar {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}
.admin-server-manage-card .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.admin-dashboard-tabs {
  margin: 0 0 10px;
}
.admin-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.admin-stat {
  background: #121826;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
}
.admin-stat strong {
  font-size: 22px;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}
.admin-card {
  background: #121826;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.admin-card-header h4 {
  margin: 0;
}
.admin-actions-row {
  display: grid;
  gap: 8px;
}
.admin-actions-row input {
  background: #0f131d;
  border-radius: 10px;
}
.admin-list {
  display: grid;
  gap: 8px;
  max-height: 78vh;
  overflow: auto;
}
@media (max-width: 900px) {
  .admin-hero { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-list { max-height: 40vh; }
}
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 900;
}
.audio-sink {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -1000px;
  top: -1000px;
}
.impersonate-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #2b2342;
  color: #fff;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1001;
}
.impersonate-bar button {
  background: #3a2f58;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5,7,12,0.7);
  display: grid;
  place-items: center;
  z-index: 1000;
}
.modal-card {
  width: min(520px, 92vw);
  background: #161b28;
  border-radius: 16px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.08);
}
.profile-modal-card {
  width: min(640px, 94vw);
  max-height: 88vh;
  overflow: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-header h3 { margin: 0; }
.modal-body { display: grid; gap: 10px; }
.modal-body textarea {
  min-height: 90px;
  resize: vertical;
}
.setting-group {
  background: #121826;
  padding: 12px;
  border-radius: 12px;
  display: grid;
  gap: 8px;
}
.setting-group label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.setting-group.danger {
  border: 1px solid rgba(255, 107, 107, 0.2);
}
.setting-group.danger label {
  color: #ffb3b3;
}
.setting-group.danger button.danger {
  background: #3a1f1f;
  color: #ffb3b3;
  border: 1px solid rgba(255, 107, 107, 0.25);
}
.profile-main-group {
  gap: 10px;
}
.profile-main-group > .hint {
  margin-bottom: -4px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tabs .tab {
  background: #1a2030;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
}
.tabs .tab.active {
  background: var(--accent);
  color: white;
}
.tab-content {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.roles-list {
  display: grid;
  gap: 6px;
}
.role-item {
  padding: 8px;
  border-radius: 10px;
  background: #1a2030;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
.role-item small {
  color: var(--muted);
}
.role-actions {
  display: flex;
  gap: 6px;
}
.role-actions button {
  background: #2a2f42;
  font-size: 12px;
}
.role-actions button.danger {
  background: #3a1f1f;
  color: #ffb3b3;
}
.role-item.dragging {
  opacity: 0.6;
}
.invites-list {
  display: grid;
  gap: 8px;
}
.invite-item {
  padding: 8px;
  background: #1a2030;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.invite-item small { color: var(--muted); display: block; }
.invite-actions { display: flex; gap: 6px; }
.invite-actions button { background: #2a2f42; font-size: 12px; }
.invite-actions button.danger { background: #3a1f1f; color: #ffb3b3; }
.profile-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #2a2f42;
  font-weight: 700;
}
.profile-avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.profile-actions input[type="file"] {
  background: #0f121a;
}
.profile-actions .hint {
  display: block;
}
.member-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: #141a28;
  border-radius: 12px;
}
.member-card.dm-profile {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}
.member-card.dm-profile .avatar {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  font-size: 24px;
}
.member-card.dm-profile strong {
  display: block;
  margin-top: 8px;
}
.mutual-section {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}
.mutual-list {
  display: grid;
  gap: 6px;
}
.mutual-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  background: #1a2030;
  border-radius: 10px;
  cursor: pointer;
}
.mutual-item:hover {
  background: #21283a;
}
.mutual-item .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 12px;
}
.mutual-item .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.member-card .avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #2a2f42;
  font-weight: 700;
}
.member-card .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.member-card small { color: var(--muted); display: block; }
.member-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.member-actions-grid button {
  background: #2a2f42;
}
.member-actions-grid button.danger {
  background: #3a1f1f;
  color: #ffb3b3;
}

.friends-section {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.friends-list {
  display: grid;
  gap: 8px;
}
.friend-item {
  padding: 8px;
  border-radius: 10px;
  background: #1a2030;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
}
.friend-item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #2a2f42;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.friend-item .avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.friend-item .meta small {
  color: var(--muted);
  display: block;
}
.friend-item { cursor: context-menu; }
.friends-filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.ghost {
  background: #1a2030;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 12px;
}
.ghost.active {
  background: var(--accent);
  color: #fff;
}
.friends-search {
  background: #0f131d;
}

#pushStatus {
  color: var(--muted);
}

.admin-panel {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.admin-user {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  background: #1a2030;
  margin-bottom: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.admin-user:hover {
  border-color: rgba(255,255,255,0.18);
  transform: translateY(-1px);
}
.admin-user:active {
  transform: translateY(0);
}
.admin-user .meta small { color: var(--muted); }
.admin-user .badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #2a2f40;
  color: var(--muted);
  margin-left: 6px;
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 70px 1fr; }
  .mobile-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
  }
  #servers {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    width: 70px;
    z-index: auto;
    box-shadow: none;
    transform: none;
    transition: none;
  }
  #channels {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    width: auto;
    z-index: auto;
    box-shadow: none;
    transform: none;
    transition: none;
  }
  #members {
    position: fixed;
    top: 0;
    bottom: 0;
    left: auto;
    right: 0;
    width: min(320px, 85vw);
    z-index: 950;
    box-shadow: var(--shadow);
    transform: translateX(110%);
    transition: transform 0.25s ease;
  }
  #members {
    right: 0;
    left: auto;
    transform: translateX(110%);
  }
  body.show-servers #servers { transform: none; }
  body.show-channels #channels { transform: none; }
  body.show-members #members { transform: translateX(0); }
  body.show-servers .mobile-overlay,
  body.show-channels .mobile-overlay,
  body.show-members .mobile-overlay {
    opacity: 1;
    pointer-events: auto;
  }
  .user-bar {
    display: grid;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100vw;
    grid-template-columns: auto 1fr auto;
  }
  .voice-dock {
    width: 100vw;
    left: 0;
    bottom: 64px;
  }
  .user-bar .meta { display: grid; }
  .user-bar .user-menu-btn { width: auto; }

  #chat {
    position: fixed;
    inset: 0;
    z-index: 980;
    display: none;
  }
  body.show-chat #chat { display: grid; }
  body.show-chat .user-bar { display: none; }
  body.show-chat .voice-dock { display: none; }
}

@media (max-width: 700px) {
  #chatHeader {
    flex-wrap: wrap;
    row-gap: 8px;
  }
  #messageForm input { font-size: 14px; }
  #uploadForm { grid-template-columns: 1fr; }
  #uploadForm button { width: 100%; }
  .tabs { grid-template-columns: 1fr 1fr; }
  .member-actions-grid { grid-template-columns: 1fr; }
  #servers .item { height: 64px; }
  #servers .item .avatar { width: 44px; height: 44px; border-radius: 14px; }
  #channels .item, #members .item, .friend-item {
    padding: 12px;
    border-radius: 12px;
  }
  #channels .item .avatar, #members .item .avatar, .friend-item .avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    font-size: 14px;
  }
  .section-title { font-size: 12px; }
  button, input, select { padding: 12px 14px; }
}
