:root {
  --primary: #313338;
  --secondary: #2b2d31;
  --tertiary: #1e1f22;
  --quaternary: #232428;
  --quinary: #383a40;
  --senary: #949ba4;
  --text: #dbdee1;
  --title: #f2f3f5;
  --line: #26272b;
  --brand: #5865f2;
  --brand-2: #7782ff;
  --success: #23a55a;
  --danger: #f23f42;
  /* Discord doesn't publicly distribute "gg sans", so this is its own real
     fallback stack (what actually renders for anyone without the font
     installed) rather than an unrelated font pretending to be it. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--primary);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Custom Discord-style thin scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #1a1b1e transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #1a1b1e;
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #030303;
}

/* Auth — flat, solid, no glassmorphism. Discord's actual login page is a
   plain dark card centered on a slightly darker flat background. */
.auth-view {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #1e1f22;
}

.auth-noise {
  display: none;
}

.auth-card {
  width: min(92vw, 480px);
  position: relative;
  background: var(--secondary);
  border-radius: 4px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
  padding: 32px;
}

.auth-brand {
  font-family: var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cad0ff;
  font-size: 0.77rem;
}

.auth-card h1 {
  margin: 10px 0 6px;
  color: var(--title);
  font-size: 1.58rem;
}

.auth-card p {
  margin: 0;
  color: #bec2cc;
}

.auth-switch-line {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #a3a6b1;
}

.auth-link {
  border: none;
  background: none;
  color: #00a8fc;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-form {
  margin-top: 20px;
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: #b5bac1;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.auth-form input {
  border: 1px solid #1e1f22;
  border-radius: 3px;
  background: var(--tertiary);
  color: var(--text);
  padding: 10px 12px;
}

.auth-form input:focus {
  border-color: var(--brand-2);
  outline: none;
}

.remember-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.remember-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.auth-status {
  min-height: 1.2rem;
  color: #ffbac1;
  margin-top: 8px;
  font-size: 0.88rem;
}

/* Main layout — Discord's real desktop client column widths */
.app {
  display: grid;
  height: 100vh;
  grid-template-columns: 72px 240px minmax(420px, 1fr) 240px;
}

.server-rail {
  background: var(--tertiary);
  border-right: 1px solid #17191c;
  padding: 12px 10px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 10px;
}

.server-pill {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #d8d9de;
  font-family: var(--font);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: border-radius 0.15s ease, background 0.15s ease;
}

.server-pill::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 8px;
  border-radius: 0 4px 4px 0;
  background: #ffffff;
  opacity: 0;
  transition: height 0.15s ease, opacity 0.15s ease;
}

.server-pill:hover::before {
  height: 20px;
  opacity: 1;
}

.server-pill.active::before {
  height: 40px;
  opacity: 1;
}

.server-pill.active,
.server-pill:hover {
  border-radius: 16px;
  background: var(--brand);
  color: #ffffff;
}

.server-pill.add {
  color: #23a55a;
  font-size: 20px;
  font-weight: 400;
}

.server-pill.add:hover {
  background: #23a55a;
  color: #ffffff;
}

.server-rail-divider {
  width: 32px;
  height: 2px;
  border-radius: 1px;
  background: var(--line);
  margin: 2px 0 4px;
}

.channels-pane,
.members-pane {
  background: var(--secondary);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.members-pane {
  background: var(--secondary);
  border-left: 1px solid var(--line);
  border-right: 0;
  overflow: auto;
  padding-top: 16px;
  width: 240px;
  flex-shrink: 0;
}

/* New Sidebar Styles */
.pane-header {
  padding: 14px 12px;
  border-bottom: 1px solid #25282c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.server-name {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.server-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.server-info {
  min-width: 0;
}

.server-title {
  color: var(--title);
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
}

.status-badge {
  font-size: 0.72rem;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
  color: #b9bbbe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Discord-accurate status swatches: solid circle (online), crescent-cut
   circle (idle), dashed circle (dnd), plain gray circle (offline/invisible) */
.status-swatch {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3ba55d;
  flex-shrink: 0;
}

.status-swatch.status-online {
  background: #3ba55d;
}

.status-swatch.status-idle {
  background: #faa61a;
}

.status-swatch.status-idle::after {
  content: "";
  position: absolute;
  width: 65%;
  height: 65%;
  border-radius: 50%;
  background: var(--secondary);
  top: -18%;
  left: -18%;
}

.status-swatch.status-dnd {
  background: #ed4245;
}

.status-swatch.status-dnd::after {
  content: "";
  position: absolute;
  width: 58%;
  height: 22%;
  border-radius: 1px;
  background: #ffffff;
  top: 39%;
  left: 21%;
}

.status-swatch.status-offline {
  background: #747f8d;
}

/* Status button in the sidebar header — real swatch instead of a text dot */
.status-selector {
  width: 16px;
  height: 16px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-selector .status-swatch {
  width: 12px;
  height: 12px;
}

/* Self avatar in the footer user-card gets the same status-dot treatment
   as member rows */
.user-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.user-avatar-wrap .status-swatch {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--secondary);
  box-sizing: content-box;
}

/* Custom status modal (mimics Discord's "Set a custom status" dialog) */
.custom-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.emoji-trigger {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid #3a3f47;
  background: var(--tertiary);
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-trigger:hover {
  border-color: var(--brand);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.emoji-grid-btn {
  border: none;
  background: var(--tertiary);
  border-radius: 6px;
  padding: 6px 0;
  font-size: 16px;
  cursor: pointer;
}

.emoji-grid-btn:hover {
  background: #3a3f47;
}

/* Drag & drop avatar upload */
.avatar-drop-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 2px dashed #3a3f47;
  border-radius: 10px;
  background: var(--tertiary);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.avatar-drop-zone:hover,
.avatar-drop-zone.dragging {
  border-color: var(--brand);
  background: rgba(88, 101, 242, 0.08);
}

.avatar-drop-preview {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(145deg, #4f5562, #5e6775);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background-size: cover;
  background-position: center;
}

.avatar-drop-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.avatar-drop-text strong {
  color: var(--title);
}

.quick-actions {
  display: flex;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid #25282c;
  flex-shrink: 0;
}

.quick-action-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: #b9bbbe;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: background 0.12s ease, color 0.12s ease;
}

.quick-action-btn:hover {
  background: rgba(79, 84, 92, 0.32);
  color: #ffffff;
}

.pane-section {
  padding: 12px 10px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-header h3 {
  margin: 0;
  color: var(--senary);
  font-size: 0.73rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-weight: 700;
}

.channel-count {
  font-size: 0.65rem;
  color: #72767d;
  background: #2b2d31;
  padding: 2px 6px;
  border-radius: 3px;
}

.search-input {
  width: 100%;
  padding: 6px 8px;
  margin-bottom: 8px;
  border: 1px solid #3a3f47;
  background: #2b2d31;
  color: var(--text);
  border-radius: 4px;
  font-size: 13px;
}

.search-input:focus {
  outline: none;
  border-color: var(--brand);
  background: #313338;
}

.voice-meta {
  font-size: 0.75rem;
  color: #72767d;
  padding: 8px 0;
  margin: 4px 0;
}

.btn-small {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  margin-top: 4px;
}

/* Modern Modal System */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--secondary);
  border: 1px solid #3a3f47;
  border-radius: 8px;
  padding: 0;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  animation: slideUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid #25282c;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--title);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--senary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(88, 101, 242, 0.1);
  color: var(--brand);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #25282c;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-footer:empty {
  display: none;
}

.modal-body:has(.menu-list) {
  padding: 8px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--tertiary);
  border: 1px solid #3a3f47;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.1);
}

.form-input::placeholder {
  color: var(--senary);
}

.btn-group {
  display: flex;
  gap: 8px;
}

.btn-modal {
  padding: 8px 18px;
  border: none;
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  background: none;
  color: var(--text);
}

.btn-modal.primary {
  background: var(--brand);
  color: white;
}

.btn-modal.primary:hover {
  background: #4752c4;
}

.btn-modal.secondary {
  background: transparent;
  color: #dbdee1;
}

.btn-modal.secondary:hover {
  text-decoration: underline;
}

.btn-modal.danger {
  background: var(--danger);
  color: white;
}

.btn-modal.danger:hover {
  background: #c53537;
}

/* Discord-style dropdown menu (quick menu, member context menu) */
.menu-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: #dbdee1;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.menu-row:hover {
  background: var(--brand);
  color: #ffffff;
}

.menu-row.danger {
  color: #ed4245;
}

.menu-row.danger:hover {
  background: #ed4245;
  color: #ffffff;
}

.menu-row-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.menu-divider {
  height: 1px;
  background: #25282c;
  margin: 6px 2px;
}

/* Discord's real popout menus (account gear, member ⋯, status picker) are
   small floating panels anchored next to their trigger button — notably
   darker/near-black compared to modals, not a centered gray dialog. */
.popout-menu {
  position: fixed;
  z-index: 1100;
  min-width: 188px;
  max-width: 260px;
  background: #111214;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(0, 0, 0, 0.15);
  animation: popoutIn 0.12s ease;
}

.popout-menu.hidden {
  display: none;
}

.popout-menu-title {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--senary);
}

@keyframes popoutIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* Member row context menu trigger */
.member-context-btn {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #949ba4;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s ease, background 0.1s ease, color 0.1s ease;
}

.member-row:hover .member-context-btn {
  opacity: 1;
}

.member-context-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  color: #ffffff;
}

/* Call controls */
.call-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 14px 0 4px;
}

.call-control-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #383a40;
  color: #dbdee1;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.call-control-btn:hover {
  background: #4a4f57;
  transform: translateY(-1px);
}

.call-control-btn.danger {
  background: var(--danger);
  color: white;
}

.call-control-btn.danger:hover {
  background: #c53537;
}

.call-control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--secondary);
  border: 1px solid #3a3f47;
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--text);
  min-width: 300px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastSlideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

@keyframes toastSlideIn {
  from { transform: translateX(400px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.success {
  border-color: var(--success);
  background: rgba(67, 181, 129, 0.1);
}

.toast.success::before {
  content: "✓";
  color: var(--success);
  font-weight: bold;
  font-size: 18px;
}

.toast.error {
  border-color: #ef4747;
  background: rgba(237, 66, 69, 0.1);
}

.toast.error::before {
  content: "✕";
  color: #ef4747;
  font-weight: bold;
  font-size: 18px;
}

.toast.info {
  border-color: var(--brand);
  background: rgba(88, 101, 242, 0.1);
}

.toast.info::before {
  content: "ℹ";
  color: var(--brand);
  font-weight: bold;
  font-size: 18px;
}

.pane-footer {
  padding: 12px 10px;
  border-top: 1px solid #25282c;
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: rgba(88, 101, 242, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-card:hover {
  background: rgba(88, 101, 242, 0.15);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-name {
  color: var(--title);
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  color: #72767d;
  font-size: 0.75rem;
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-actions {
  flex-shrink: 0;
}

.status-selector {
  position: relative;
  font-size: 16px;
  color: var(--success);
  transition: all 0.2s;
}

.status-selector:hover {
  color: var(--brand);
}

.pane-title {
  padding: 14px 14px 13px;
  border-bottom: 1px solid #25282c;
  color: var(--title);
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.01em;
}

.pane-block {
  padding: 12px 10px;
}

.members-pane .pane-block {
  padding: 10px 12px;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.pane-block h2 {
  margin: 0;
  color: var(--senary);
  font-size: 0.73rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.icon-btn {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid #494d56;
  background: #3a3f47;
  color: #f0f1f3;
  font-weight: 700;
  cursor: pointer;
}

.icon-btn:hover {
  background: #4a5059;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.list li {
  border-radius: 4px;
  padding: 7px 8px;
  color: #b9bbbe;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-list li::before {
  content: "#";
  color: #72767d;
  margin-right: 6px;
}

.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 4px;
  padding: 6px 8px;
  color: #949ba4;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
}

.channel-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-row-name::before {
  content: "#";
  color: #6d7178;
  margin-right: 6px;
  font-weight: 700;
}

.channel-row:hover {
  background: rgba(79, 84, 92, 0.32);
  color: #dbdee1;
}

.channel-row.active {
  background: rgba(79, 84, 92, 0.48);
  color: #ffffff;
}

.channel-row.unread {
  color: #ffffff;
  font-weight: 700;
}

.channel-row.unread .channel-row-name::before {
  color: #dbdee1;
}

.channel-unread-badge {
  flex-shrink: 0;
  background: var(--danger);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}

.channel-row-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.channel-favorite-btn {
  border: none;
  background: transparent;
  color: #949ba4;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.1s ease, color 0.1s ease;
}

.channel-row:hover .channel-favorite-btn,
.channel-favorite-btn.active {
  opacity: 1;
}

.channel-favorite-btn.active {
  color: #faa61a;
}

.voice-list li::before {
  content: "🔊";
  margin-right: 6px;
  opacity: 0.9;
}

.user-list li::before {
  content: "";
}

.identity-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.identity-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4f5562, #5e6775);
  color: #f0f3f8;
  font-size: 0.72rem;
  font-weight: 700;
}

.identity-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.identity-presence {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--quaternary);
  background: #43b581;
}

.identity-presence.online {
  background: #43b581;
}

/* Discord-style Member List */
.member-list-block {
  position: relative;
  padding: 0 0 12px;
}

.member-refresh-btn {
  position: absolute;
  top: 2px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #949ba4;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  z-index: 1;
}

.member-list-block:hover .member-refresh-btn {
  opacity: 1;
}

.member-refresh-btn:hover {
  color: #dbdee1;
  background: rgba(79, 84, 92, 0.32);
}

.member-category {
  list-style: none;
  padding: 16px 8px 4px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #949ba4;
  cursor: default;
}

.member-category:first-child {
  padding-top: 4px;
}

.member-row {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  margin: 1px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.member-row:hover {
  background: rgba(79, 84, 92, 0.32);
}

.member-row.active {
  background: rgba(79, 84, 92, 0.48);
}

.member-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4f5562, #5e6775);
  color: #f0f3f8;
  font-size: 0.75rem;
  font-weight: 700;
  background-size: cover;
  background-position: center;
}

.member-status {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 3px solid var(--secondary);
  box-sizing: content-box;
  background: #747f8d;
}

.member-status.status-online {
  background: #3ba55d;
}

.member-status.status-idle {
  background: #faa61a;
}

.member-status.status-dnd {
  background: #ed4245;
}

.member-status.status-offline {
  background: #747f8d;
}

.member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 500;
  color: #dbdee1;
}

.member-row:hover .member-name {
  color: #ffffff;
}

.member-role-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 4px;
}

.member-role-badge.role-admin {
  background: rgba(237, 66, 69, 0.18);
  color: #ed4245;
}

.member-role-badge.role-mod {
  background: rgba(250, 166, 26, 0.18);
  color: #faa61a;
}

/* Offline members render dimmed, Discord-style */
.member-row.offline {
  opacity: 0.42;
}

.member-row.offline:hover {
  opacity: 0.7;
}

.list li:hover,
.list li.active {
  background: var(--quinary);
  color: #ffffff;
}

.self-card {
  margin-top: auto;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--quaternary);
  border-top: 1px solid var(--line);
}

.self-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(145deg, #5e68f3, #8291ff);
}

.self-user {
  font-size: 0.92rem;
  color: #ffffff;
  font-weight: 700;
  line-height: 1.1;
}

.self-meta {
  color: var(--senary);
  font-size: 0.78rem;
}

.self-icons {
  display: flex;
  gap: 4px;
}

.self-icons span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #3b3f46;
  color: #d6d8dd;
  font-size: 0.65rem;
  font-weight: 700;
}

/* Chat column */
.chat-pane {
  background: var(--primary);
  display: grid;
  /* header, search toolbar, poll banner, messages(fill), call panel,
     reply banner, composer, typing indicator — keep this count in sync
     with .chat-pane's direct children in index.html */
  grid-template-rows: auto auto auto 1fr auto auto auto auto;
  min-width: 0;
}

.chat-topbar {
  min-height: 48px;
  border-bottom: 1px solid #202328;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: #313338;
}

.channel-headline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hash {
  color: #72767d;
  font-size: 1.25rem;
  font-weight: 700;
}

.chat-title {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.chat-meta {
  margin-top: 3px;
  color: var(--senary);
  font-size: 0.78rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Discord's real topbar icons: plain glyph, no border/label chrome, just a
   subtle hover highlight — not the bordered text-label buttons this used
   to be ("Voice" / "Video" as words instead of icons). */
.icon-call {
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #b5bac1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.icon-call:hover {
  background: rgba(79, 84, 92, 0.32);
  color: #dbdee1;
}

.icon-call:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.top-actions-divider {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

.messages {
  overflow: auto;
  padding: 12px 0 12px;
  display: grid;
  align-content: start;
  gap: 2px;
}

.message-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--line);
}

.message-search-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
}

.message-search-input:focus {
  outline: none;
  border-color: var(--brand-2);
}

.poll-container.hidden {
  display: none;
}

.poll-card {
  margin: 10px 16px 0;
  padding: 14px 16px;
  background: var(--secondary);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.poll-question {
  font-weight: 700;
  color: var(--title);
  margin-bottom: 10px;
}

.poll-options {
  display: grid;
  gap: 6px;
}

.poll-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #3a3f47;
  border-radius: 6px;
  background: var(--tertiary);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  font-size: 13px;
}

.poll-option:hover {
  border-color: var(--brand);
}

.poll-option-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(88, 101, 242, 0.18);
  transition: width 0.25s ease;
  z-index: 0;
}

.poll-option-label,
.poll-option-count {
  position: relative;
  z-index: 1;
}

.poll-option-count {
  color: var(--senary);
  font-size: 12px;
  flex-shrink: 0;
}

.poll-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--senary);
}

.call-panel {
  border-top: 1px solid #24272c;
  padding: 10px 12px;
  background: #2b2f36;
}

.call-status {
  color: var(--senary);
  font-size: 0.84rem;
  margin-bottom: 7px;
}

.video-grid {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 8px;
}

.video-grid video {
  width: 100%;
  min-height: 120px;
  border-radius: 8px;
  border: 1px solid #474c57;
  background: #121418;
  object-fit: cover;
}

.reply-banner {
  margin: 0 14px;
  padding: 8px 12px;
  background: #2b2d31;
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--senary);
  border-bottom: 1px solid #26272b;
}

.reply-banner.hidden {
  display: none;
}

.reply-banner-text strong {
  color: var(--text);
}

.reply-banner-cancel {
  border: none;
  background: transparent;
  color: var(--senary);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
}

.reply-banner-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.msg-reply-quote {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px 0;
  padding-left: 12px;
  font-size: 13px;
  color: var(--senary);
  position: relative;
}

.msg-reply-quote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 22px;
  height: 12px;
  border-left: 2px solid #4e5058;
  border-top: 2px solid #4e5058;
  border-radius: 6px 0 0 0;
}

.reply-icon {
  display: none;
}

.reply-author {
  color: #dbdee1;
  font-weight: 600;
}

.reply-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 420px;
}

.msg-inline-code {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.85em;
}

.msg-codeblock {
  background: #1e1f22;
  border: 1px solid #131416;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 4px 0;
  overflow-x: auto;
}

.msg-codeblock code {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.85em;
  color: #dbdee1;
  white-space: pre;
}

.msg-body del {
  color: var(--senary);
}

.composer {
  padding: 0 14px 10px;
}

.composer input {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: #383a40;
  color: #dbdee1;
  padding: 12px 14px;
}

.composer input::placeholder {
  color: #9ba0a6;
}

.composer input:focus {
  outline: none;
}

#sendBtn {
  display: none;
}

.typing-indicator {
  min-height: 22px;
  padding: 0 16px 10px;
  color: var(--senary);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.typing-indicator strong {
  color: var(--text);
  font-weight: 700;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: 24px;
}

.typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--senary);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Cards/messages/actions */
.msg {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  padding: 2px 16px 2px 12px;
}

.msg:not(.msg-grouped) {
  margin-top: 14px;
  padding-top: 2px;
}

.msg:hover {
  background: #32353b;
}

.msg-gutter {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
}

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4f5562, #5e6775);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #f0f3f8;
  background-size: cover;
  background-position: center;
  cursor: pointer;
}

.msg-hover-ts {
  display: none;
  width: 40px;
  text-align: center;
  font-size: 10px;
  color: var(--senary);
  padding-top: 5px;
}

.msg-grouped:hover .msg-hover-ts {
  display: block;
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg .who {
  margin-bottom: 4px;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.92rem;
}

.msg.system {
  background: #343941;
  padding-left: 16px;
}

.msg.system .who {
  color: #f5cf8e;
}

.msg-body {
  color: #d1d3d7;
}

.msg-toolbar {
  position: absolute;
  top: -14px;
  right: 12px;
  display: none;
  gap: 3px;
  background: #2a2d33;
  border: 1px solid #383a40;
  border-radius: 7px;
  padding: 2px 4px;
  z-index: 9;
}

.msg:hover .msg-toolbar {
  display: flex;
}

.msg-toolbar button {
  border: 0;
  background: transparent;
  color: #b8bcc2;
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
}

.msg-toolbar button:hover {
  background: #3b4048;
  color: #ffffff;
}

.react-row {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.react-btn,
.react-add-btn {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.79rem;
  cursor: pointer;
}

.react-btn {
  border: 1px solid #444955;
  background: #2f3339;
  color: #e5e7eb;
}

.react-btn.reacted {
  border-color: var(--brand);
  background: #2a3360;
}

.react-add-btn {
  border: 1px dashed #4c515c;
  background: transparent;
  color: var(--senary);
  display: none;
}

.msg:hover .react-add-btn {
  display: inline-block;
}

.emoji-picker {
  position: absolute;
  z-index: 100;
  border-radius: 9px;
  border: 1px solid #383a40;
  background: #2a2d33;
  padding: 6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  box-shadow: 0 10px 30px #00000066;
}

.emoji-picker button {
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 5px;
  font-size: 1.1rem;
  padding: 4px;
}

.emoji-picker button:hover {
  background: #414750;
}

.mention {
  color: #99b3ff;
  font-weight: 600;
}

.mention-self {
  padding: 0 3px;
  border-radius: 3px;
  color: #c8d4ff;
  background: #5865f24a;
}

.edited-mark,
.msg-ts,
.subhead,
.submeta {
  color: var(--senary);
}

.subhead {
  margin: 8px 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.msg-deleted .msg-body {
  color: #9ea2a8;
  font-style: italic;
}

.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 7px;
}

.btn {
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 700;
}

.btn.primary {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  color: #ffffff;
}

.btn.ghost {
  border: 1px solid #4a4f59;
  background: #3a3f47;
  color: #f2f3f5;
}

.btn.ghost:hover {
  background: #4a505a;
}

.btn.ghost.danger {
  border-color: #704247;
  background: #4f3438;
  color: #ffd6db;
}

.menu-panel {
  display: grid;
  gap: 2px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #383c45;
  background: #2b2f36;
}

.menu-item {
  width: 100%;
  text-align: left;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: #d7dadf;
  padding: 8px 10px;
  font-weight: 600;
  font-size: 0.86rem;
}

.menu-item:hover {
  background: #4752c4 !important;
  color: #ffffff;
}

.menu-item:disabled {
  opacity: 0.45;
  background: transparent !important;
}

.menu-item-danger {
  color: #f59ca8;
}

.menu-item-danger:hover {
  background: #d83c3e !important;
  color: #fff6f6;
}

.btn:disabled,
.btn.ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.stack {
  display: grid;
  gap: 8px;
}

.friend-action-row {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 64px 220px minmax(260px, 1fr) 240px;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }

  .server-rail {
    grid-auto-flow: column;
    grid-auto-columns: 48px;
    justify-content: start;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .channels-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .members-pane {
    display: none;
  }

  .chat-pane {
    min-height: 60vh;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }
}
