:root {
  --bg-rail: #111114;
  --bg-sidebar: #16161a;
  --bg-main: #1c1c21;
  --bg-stage: #121216;
  --bg-elevated: #23232a;
  --bg-hover: #26262f;
  --bg-active: #2e2e38;
  --border-subtle: #25252d;
  --border-strong: #32323c;
  --text-primary: #f2f2f5;
  --text-secondary: #a4a4b0;
  --text-muted: #70707c;
  --accent-white: #f4f4f6;
  --accent-ink: #111114;
  --online: #23a55a;
  --warning: #eab308;
  --danger: #da373c;
  --danger-soft: rgba(218, 55, 60, 0.14);
  --danger-text: #f38b8e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html,
body {
  height: 100%;
  background: var(--bg-rail);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #2b2b34;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a46;
}

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  animation: toastIn 160ms var(--ease);
}

.toast-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-secondary);
  flex-shrink: 0;
}

.toast.success .toast-dot {
  background: var(--online);
}

.toast.error .toast-dot {
  background: var(--danger);
}

.toast.warn .toast-dot {
  background: var(--warning);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-rail);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  animation: cardEnter 200ms var(--ease);
  transition: max-width 180ms var(--ease);
}

.auth-card.wide {
  max-width: 490px;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
}

.auth-brand h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-brand p {
  font-size: 12px;
  color: var(--text-muted);
}

.auth-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.auth-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.captcha-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.captcha-img-wrap {
  min-height: 40px;
  display: flex;
  align-items: center;
}

.captcha-img {
  display: block;
  height: 40px;
  width: auto;
  border-radius: 4px;
  background: #ffffff;
}

.reg-back-btn {
  margin-top: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field input,
.select-input {
  width: 100%;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 140ms ease;
}

.select-sm {
  padding: 7px 10px;
  font-size: 12.5px;
}

.field input:focus,
.select-input:focus {
  border-color: #545464;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 38px;
}

.icon-btn-inline {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 120ms ease;
}

.icon-btn-inline:hover {
  color: var(--text-primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease, opacity 140ms ease;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 7px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11.5px;
}

.btn-primary {
  background: var(--accent-white);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: #ffffff;
}

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: #444452;
}

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(218, 55, 60, 0.35);
  color: var(--danger-text);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-register-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-register-box p {
  font-size: 12.5px;
  color: var(--text-secondary);
  text-align: center;
}

.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.4;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid rgba(218, 55, 60, 0.35);
  color: #fecaca;
  margin-bottom: 14px;
}

.alert-info {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.app-view {
  display: flex;
  height: 100%;
  width: 100%;
  background: var(--bg-rail);
  position: relative;
}

.server-rail {
  width: 68px;
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  flex-shrink: 0;
  z-index: 20;
}

.rail-top,
.rail-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.rail-sep {
  width: 32px;
  height: 2px;
  border-radius: 2px;
  background: var(--border-strong);
  margin: 4px 0;
}

.rail-item {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-radius 160ms var(--ease), background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.rail-item:hover {
  border-radius: 14px;
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.rail-item.active {
  border-radius: 14px;
  background: var(--bg-active);
  color: var(--text-primary);
  border-color: #464654;
}

.rail-pill {
  position: absolute;
  left: -12px;
  width: 4px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--accent-white);
  transition: height 160ms var(--ease);
}

.rail-item:hover .rail-pill {
  height: 16px;
}

.rail-item.active .rail-pill {
  height: 30px;
}

.rail-monogram {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.rail-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.server-banner {
  width: 100%;
  height: 106px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-rail);
  flex-shrink: 0;
}

.server-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rail-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  border: 2px solid var(--bg-rail);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.channels-sidebar {
  position: relative;
  width: 252px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 25;
}

.sidebar-header {
  height: 50px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
}

.sidebar-header-trigger {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: background 120ms ease;
  -webkit-touch-callout: none;
  user-select: none;
}

.sidebar-header-trigger:hover,
.sidebar-header-trigger.open {
  background: var(--bg-hover);
}

.sidebar-chevron {
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 150ms ease;
}

.sidebar-header-trigger.open .sidebar-chevron {
  transform: rotate(180deg);
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.server-dropdown {
  position: absolute;
  top: 54px;
  left: 8px;
  right: 8px;
  background: #141418;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.62);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 70;
  max-height: calc(100dvh - 68px);
  overflow-y: auto;
}

.server-dd-item {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 100ms ease, color 100ms ease;
}

.server-dd-item:hover {
  background: var(--bg-hover);
}

.server-dd-item svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.server-dd-item.danger {
  color: var(--danger-text);
}

.server-dd-item.danger svg {
  color: var(--danger-text);
}

.server-dd-item.danger:hover {
  background: var(--danger-soft);
}

.server-dd-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 6px;
}

.dd-check-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
}

.dd-check-box.checked {
  background: #5865f2;
  border-color: #5865f2;
  color: #ffffff;
}

.dd-id-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-active);
  color: var(--text-secondary);
}

.sidebar-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.conn-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-secondary);
}

.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--online);
}

.conn-badge.offline .conn-dot {
  background: var(--danger);
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.channel-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.group-add-locked {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.group-add-locked:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}

.channel-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.channel-item.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

.ch-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.channel-item.active .ch-icon {
  color: var(--text-primary);
}

.count-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.voice-roster {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 14px;
  margin-top: 2px;
}

.voice-roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 120ms ease;
}

.voice-roster-row:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.voice-roster-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.voice-mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-active);
  border: 1.5px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  transition: border-color 120ms ease;
}

.voice-roster-row.speaking .voice-mini-avatar {
  border-color: var(--online);
}

.voice-roster-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-roster-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-muted);
}

.voice-roster-icons .muted-icon {
  color: var(--danger-text);
}

.voice-roster-icons .cam-icon {
  color: var(--text-primary);
}

.dm-maintenance-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.dm-maintenance-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}

.dm-staff-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dm-picker-row {
  display: flex;
  gap: 6px;
}

.dm-picker-row .select-input {
  flex: 1;
  min-width: 0;
}

.dm-thread-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dm-thread-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease;
}

.dm-thread-btn:hover {
  background: var(--bg-hover);
}

.dm-thread-btn.active {
  background: var(--bg-active);
}

.dm-thread-meta {
  flex: 1;
  min-width: 0;
}

.dm-thread-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.dm-thread-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-thread-preview {
  font-size: 11.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dm-maintenance-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dm-maintenance-card {
  max-width: 420px;
  width: 100%;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.dm-maintenance-card h2 {
  font-size: 17px;
  font-weight: 700;
}

.dm-maintenance-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.dm-profile-locked {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}

.voice-connection-dock {
  margin: 0 8px 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.voice-conn-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-conn-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--online);
  flex-shrink: 0;
}

.voice-conn-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.voice-conn-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.user-bar {
  padding: 8px 10px;
  background: var(--bg-rail);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.user-bar-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

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

.user-bar-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-bar-role {
  font-size: 11px;
  color: var(--text-muted);
}

.user-bar-controls {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-shrink: 0;
}

.avatar {
  border-radius: 50%;
  background: var(--bg-active);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  flex-shrink: 0;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.avatar-md {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.avatar-lg {
  width: 50px;
  height: 50px;
  font-size: 19px;
}

.icon-btn,
.icon-btn-sm {
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.icon-btn {
  width: 30px;
  height: 30px;
}

.icon-btn-sm {
  width: 26px;
  height: 26px;
}

.icon-btn:hover,
.icon-btn-sm:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.icon-btn.active,
.icon-btn-sm.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

.icon-btn.off,
.icon-btn-sm.off {
  color: var(--danger-text);
  background: var(--danger-soft);
}

.icon-btn.danger:hover,
.icon-btn-sm.danger:hover {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.main-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  position: relative;
}

.stage-header {
  height: 50px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg-main);
}

.stage-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stage-title {
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
}

.stage-divider {
  width: 1px;
  height: 15px;
  background: var(--border-strong);
}

.stage-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.header-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.header-pill-btn:hover {
  background: var(--bg-hover);
}

.notice-bar {
  padding: 8px 16px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-primary);
}

.notice-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.notice-content svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.notice-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.voice-stage {
  background: var(--bg-stage);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  max-height: 46vh;
  flex-shrink: 0;
}

.voice-stage.expanded {
  flex: 1;
  max-height: none;
  border-bottom: none;
}

.voice-stage-topbar {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.voice-stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.voice-stage-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.voice-grid {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  overflow-y: auto;
}

.voice-tile {
  position: relative;
  width: 170px;
  height: 112px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 140ms ease, width 160ms var(--ease);
}

.voice-tile.has-cam {
  width: 320px;
  height: auto;
  aspect-ratio: 16 / 9;
}

.voice-stage.expanded .voice-tile.has-cam {
  width: 440px;
}

.voice-tile.pinned {
  width: 560px;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.voice-tile:hover {
  border-color: #4a4a58;
}

.voice-tile.speaking {
  border-color: var(--online);
}

.voice-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #0a0a0c;
}

.voice-tile video.mirror {
  transform: scaleX(-1);
}

.voice-tile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-active);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  transition: border-color 140ms ease;
}

.voice-tile.speaking .voice-tile-avatar {
  border-color: var(--online);
}

.voice-tile-footer {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.voice-tile-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(14, 14, 18, 0.85);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.voice-tile-badges {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tile-badge {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  background: rgba(14, 14, 18, 0.85);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger-text);
}

.voice-stage-controls {
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-rail);
}

.stage-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}

.stage-ctrl-btn:hover {
  background: var(--bg-hover);
}

.stage-ctrl-btn.active {
  background: var(--accent-white);
  border-color: var(--accent-white);
  color: var(--accent-ink);
}

.stage-ctrl-btn.muted {
  background: var(--danger-soft);
  border-color: rgba(218, 55, 60, 0.35);
  color: var(--danger-text);
}

.stage-ctrl-btn.danger {
  background: var(--danger-soft);
  border-color: rgba(218, 55, 60, 0.35);
  color: var(--danger-text);
}

.stage-ctrl-btn.danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.chat-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.messages-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 8px;
  display: flex;
  flex-direction: column;
}

.chat-welcome {
  padding: 16px 20px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.chat-welcome h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 3px;
}

.chat-welcome p {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.msg-row {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 4px 20px;
  transition: background 100ms ease;
  animation: msgIn 130ms var(--ease);
}

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

.msg-row.group-start {
  margin-top: 10px;
  padding-top: 6px;
}

.msg-row:hover {
  background: #202026;
}

.msg-avatar-col {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

.msg-hover-time {
  font-size: 10.5px;
  color: var(--text-muted);
  opacity: 0;
  margin-top: 3px;
}

.msg-row:hover .msg-hover-time {
  opacity: 1;
}

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

.msg-reply-ref {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 3px;
  padding-left: 8px;
  border-left: 2px solid var(--border-strong);
}

.msg-reply-author {
  font-weight: 600;
  color: var(--text-secondary);
}

.msg-reply-snippet {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}

.msg-author {
  font-weight: 600;
  font-size: 13.8px;
  cursor: pointer;
}

.msg-author:hover {
  text-decoration: underline;
}

.msg-time {
  font-size: 11px;
  color: var(--text-muted);
}

.msg-text {
  font-size: 13.8px;
  color: #e2e2e8;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.msg-actions {
  position: absolute;
  top: -12px;
  right: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px;
  display: none;
  gap: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  z-index: 5;
}

.msg-row:hover .msg-actions {
  display: flex;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.role-badge.role-sistem {
  padding: 2px 7px;
  background: #19150d;
  color: #f5b942;
  border: 1px solid #a67c2e;
  outline: 1px solid rgba(245, 185, 66, 0.22);
  outline-offset: -2px;
  box-shadow: inset 0 1px 0 rgba(255, 224, 130, 0.16), 0 0 8px rgba(245, 185, 66, 0.18);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.avatar.frame-sistem-avatar {
  border: 2px solid #f5b942;
  box-shadow: 0 0 0 2px #14141a, 0 0 10px rgba(245, 185, 66, 0.3);
}

.member-row.frame-sistem {
  background: #17140f;
  border: 1px solid #7d5f25;
  outline: 1px solid rgba(245, 185, 66, 0.16);
  outline-offset: -3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 222, 138, 0.12);
  margin-bottom: 3px;
}

.member-row.frame-sistem:hover {
  background: #1e1912;
  border-color: #b88b34;
}

.profile-summary.frame-sistem {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #17140f;
  border: 1px solid #8a6829;
  outline: 1px solid rgba(245, 185, 66, 0.22);
  outline-offset: -4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 224, 140, 0.15);
}

.system-account-pill,
.bot-tick-mini {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #4752c4;
  border: 1px solid #6b76ee;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  flex-shrink: 0;
}

.bot-tick-mini {
  padding: 1px 5px;
  font-size: 9.5px;
  margin-left: auto;
}

.profile-system-card {
  background: var(--bg-elevated);
  border: 1px solid #3c4278;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-system-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.profile-system-tag {
  font-size: 11px;
  font-weight: 600;
  color: #b4bbf8;
}

.role-founder {
  color: #f0d37a;
  border-color: #463f2a;
}

.role-admin {
  color: #c7d2fe;
  border-color: #363c52;
}

.role-moderator {
  color: #a7f3d0;
  border-color: #2b443a;
}

.author-founder {
  color: #f0d37a;
}

.author-admin {
  color: #c7d2fe;
}

.author-moderator {
  color: #a7f3d0;
}

.jump-bottom-btn {
  position: absolute;
  right: 22px;
  bottom: 84px;
  padding: 7px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  z-index: 10;
}

.composer-wrap {
  padding: 4px 18px 14px;
  flex-shrink: 0;
}

.typing-indicator {
  min-height: 18px;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 0 4px 4px;
}

.reply-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 12px;
}

.reply-preview-text {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.reply-snippet {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mute-banner {
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 12.5px;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 7px 9px 7px 14px;
  transition: border-color 140ms ease;
}

.composer-box:focus-within {
  border-color: #4f4f5e;
}

.composer-box textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  max-height: 130px;
  font-size: 13.8px;
  line-height: 1.45;
  padding: 4px 0;
}

.composer-box textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent-white);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease, transform 100ms ease;
}

.send-btn:hover:not(:disabled) {
  background: #ffffff;
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.members-sidebar {
  width: 228px;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 25;
}

.members-header {
  height: 50px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.members-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.member-group-title {
  padding: 0 8px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.member-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 120ms ease;
}

.member-row:hover {
  background: var(--bg-hover);
}

.member-row.offline {
  opacity: 0.48;
}

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

.member-avatar-wrap {
  position: relative;
}

.member-status-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--online);
  border: 2px solid var(--bg-sidebar);
}

.member-status-dot.offline {
  background: #52525e;
}

.member-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  animation: cardEnter 160ms var(--ease);
}

.modal-sm {
  max-width: 400px;
}

.modal-md {
  max-width: 560px;
}

.modal-lg {
  max-width: 620px;
}

.modal-xl {
  max-width: 820px;
  height: 620px;
  max-height: 90vh;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body.centered {
  align-items: center;
  text-align: center;
}

.modal-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
}

.lock-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.muted-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.muted-text-sm {
  font-size: 12px;
  color: var(--text-muted);
}

.meter-track {
  height: 7px;
  border-radius: 99px;
  background: var(--bg-rail);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--online);
  transition: width 60ms linear;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-summary-meta {
  min-width: 0;
  flex: 1;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.profile-name {
  font-size: 16px;
  font-weight: 700;
}

.profile-status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(35, 165, 90, 0.14);
  color: #5cd68d;
  border: 1px solid rgba(35, 165, 90, 0.35);
}

.profile-status-pill.offline {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-color: var(--border-strong);
}

.profile-time-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.profile-time-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-stats-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.profile-stat-card {
  background: var(--bg-rail);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-stat-label {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-stat-val {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-sync-box,
.profile-role-assign {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.profile-sync-row {
  display: flex;
  gap: 6px;
}

.profile-sync-row input {
  flex: 1;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
}

.profile-sync-row select {
  flex: 1;
}

.mod-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.mod-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mod-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mod-btn-row .btn {
  flex: 1;
}

.admin-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.admin-nav {
  width: 196px;
  background: var(--bg-rail);
  border-right: 1px solid var(--border-subtle);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex-shrink: 0;
}

.admin-nav-btn {
  width: 100%;
  text-align: left;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.admin-nav-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.admin-nav-btn.active {
  background: var(--bg-active);
  color: var(--text-primary);
  font-weight: 600;
}

.admin-content {
  flex: 1;
  min-width: 0;
  padding: 18px;
  overflow-y: auto;
}

.asset-editor-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.asset-editor-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.asset-icon-preview {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.asset-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-banner-preview {
  width: 100%;
  height: 92px;
  border-radius: var(--radius-sm);
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.asset-banner-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-editor-controls {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-editor-controls input[type="text"] {
  width: 100%;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
}

.asset-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.file-pick-btn {
  cursor: pointer;
}

.roles-studio {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.roles-sidebar-col {
  background: var(--bg-rail);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
}

.roles-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.roles-order-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.roles-side-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.role-side-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-elevated);
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.role-side-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.role-side-item.active {
  background: var(--bg-active);
  border-color: var(--accent-white);
}

.role-side-item.dragging {
  opacity: 0.45;
}

.role-side-item.drag-over {
  border-color: #f5b942;
  background: #232019;
}

.role-drag-grip {
  cursor: grab;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  user-select: none;
  padding: 2px;
}

.role-side-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  padding: 2px 0;
}

.role-side-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-side-tag {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  flex-shrink: 0;
}

.role-side-arrows {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.role-move-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-rail);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.role-move-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.role-move-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.roles-base-divider {
  padding-top: 6px;
  margin-top: 2px;
  border-top: 1px solid var(--border-subtle);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.roles-editor-col {
  min-width: 0;
}

.roles-editor-form {
  margin-top: 0;
}

.roles-toggles-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.automod-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#automod-settings-wrap textarea {
  width: 100%;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: inherit;
  resize: vertical;
  outline: none;
}

#automod-settings-wrap textarea:focus {
  border-color: var(--accent-white);
}

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

.color-swatch {
  width: 40px !important;
  height: 36px;
  padding: 2px !important;
  cursor: pointer;
}

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

.role-badge-toggle-wrap {
  justify-content: flex-end;
  padding-bottom: 6px;
}

.audit-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-toolbar select {
  width: 170px;
}

.audit-toolbar input {
  flex: 1;
  min-width: 150px;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
}

.audit-list {
  max-height: 410px;
  overflow-y: auto;
}

.audit-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.audit-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.audit-actor {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.audit-time {
  font-size: 11px;
  color: var(--text-muted);
}

.audit-summary {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.admin-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.staff-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.staff-form-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 10px;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.perm-check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.perm-check input {
  accent-color: var(--text-primary);
}

.admin-list-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.admin-row-info {
  min-width: 0;
}

.admin-row-name {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.admin-row-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.danger-zone {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.mode-choice:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.mode-choice input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--text-primary);
  flex-shrink: 0;
}

.mode-choice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mode-choice-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.mode-choice-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.mobile-only {
  display: none;
}

.mobile-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 22;
}

.member-row,
.voice-roster-row,
.voice-tile,
.channel-item,
.dm-thread-item,
.msg-header {
  -webkit-touch-callout: none;
  user-select: none;
}

.modal-fullscreen {
  padding: 0;
  background: var(--bg-main);
}

.settings-shell {
  width: 100%;
  height: 100dvh;
  display: flex;
  background: var(--bg-main);
  overflow: hidden;
}

.settings-sidebar {
  flex: 0 0 26%;
  min-width: 224px;
  max-width: 320px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
}

.settings-sidebar-inner {
  width: 220px;
  padding: 28px 12px;
  overflow-y: auto;
}

.settings-server-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 10px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-sidebar .admin-nav {
  width: 100%;
  background: transparent;
  border-right: none;
  padding: 0;
  gap: 14px;
}

.settings-nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 4px 10px;
}

.settings-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  overflow: hidden;
}

.settings-mobile-bar {
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sidebar);
  flex-shrink: 0;
}

.settings-mobile-title {
  font-size: 14px;
  font-weight: 700;
}

.settings-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 36px 28px 64px;
}

.settings-content-wrap {
  max-width: 920px;
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.settings-content-wrap .admin-content {
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow: visible;
}

.settings-pane-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.settings-pane-header h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 268px;
  gap: 24px;
  align-items: start;
}

.settings-profile-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.settings-preview-col {
  position: sticky;
  top: 0;
}

.srv-preview-card,
.server-info-modal-card {
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
}

.srv-preview-banner,
.srv-info-banner {
  position: relative;
  height: 92px;
  background: #26262f;
  overflow: hidden;
}

.srv-preview-banner img,
.srv-info-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.srv-info-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(14, 14, 18, 0.72);
  color: #ffffff;
  border-radius: 50%;
}

.srv-preview-body,
.srv-info-body {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.srv-preview-icon,
.srv-info-icon {
  width: 56px;
  height: 56px;
  margin-top: -28px;
  border-radius: 16px;
  border: 4px solid var(--bg-rail);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.srv-preview-icon img,
.srv-info-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.srv-preview-name,
.srv-info-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.srv-preview-stats,
.srv-info-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.srv-stat-dot.online {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--online);
}

.srv-stat-sep {
  color: var(--text-muted);
}

.srv-preview-created,
.srv-info-created {
  font-size: 11.5px;
  color: var(--text-muted);
}

.srv-preview-desc,
.srv-info-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.srv-traits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.srv-trait-pill {
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-primary);
}

.srv-info-footer {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.srv-id-code {
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-muted);
}

.banner-swatches-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.banner-swatch {
  height: 36px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 110ms ease, border-color 110ms ease;
}

.banner-swatch:hover {
  transform: translateY(-1px);
}

.banner-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px #1c1c21;
}

.banner-swatch[data-color="#26262f"] { background-color: #26262f; }
.banner-swatch[data-color="#1f3a5f"] { background-color: #1f3a5f; }
.banner-swatch[data-color="#5c2849"] { background-color: #5c2849; }
.banner-swatch[data-color="#6b2525"] { background-color: #6b2525; }
.banner-swatch[data-color="#6e4220"] { background-color: #6e4220; }
.banner-swatch[data-color="#5c4f1d"] { background-color: #5c4f1d; }
.banner-swatch[data-color="#3e2b5c"] { background-color: #3e2b5c; }
.banner-swatch[data-color="#1f4e5f"] { background-color: #1f4e5f; }
.banner-swatch[data-color="#1d4d3e"] { background-color: #1d4d3e; }
.banner-swatch[data-color="#303824"] { background-color: #303824; }

.traits-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.trait-input {
  width: 100%;
  background: var(--bg-rail);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
}

.trait-input:focus {
  border-color: var(--text-secondary);
}

.settings-esc-rail {
  width: 48px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.esc-circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.esc-circle-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.esc-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.perm-groups-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.perm-group-box {
  background: var(--bg-rail);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.perm-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.member-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.member-admin-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  flex: 1;
}

.member-admin-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.member-perm-preset-wrap {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.profile-quick-row {
  margin-top: 6px;
}

.rc-context-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2999;
  background: transparent;
}

.rc-context-menu {
  position: fixed;
  z-index: 3000;
  min-width: 215px;
  max-width: min(296px, calc(100vw - 16px));
  max-height: min(470px, calc(100dvh - 16px));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #131317;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.68);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rc-ctx-header {
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rc-ctx-item {
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  transition: background 90ms ease, color 90ms ease;
}

.rc-ctx-item:hover {
  background: var(--bg-hover);
}

.rc-ctx-item.danger {
  color: var(--danger-text);
}

.rc-ctx-item.danger:hover {
  background: var(--danger-soft);
}

.rc-ctx-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 6px;
}

.rc-ctx-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.rc-ctx-roles-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 8px 6px;
}

.rc-ctx-role-pill {
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  border-radius: 99px;
  padding: 4px 9px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rc-ctx-role-pill.active {
  border-color: #ffffff;
  background: var(--bg-active);
}

.rc-ctx-role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

@media (max-width: 980px) {
  .settings-profile-layout {
    grid-template-columns: 1fr;
  }

  .settings-preview-col {
    position: static;
    order: -1;
    max-width: 340px;
  }
}

@media (max-width: 900px) {
  .mobile-only {
    display: inline-flex;
  }

  .server-rail {
    display: none;
  }

  .channels-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 200ms var(--ease);
  }

  .channels-sidebar.open {
    transform: translateX(0);
  }

  .members-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    transform: translateX(100%);
    transition: transform 200ms var(--ease);
  }

  .members-sidebar.open {
    transform: translateX(0);
  }

  .stage-sub,
  .stage-divider {
    display: none;
  }

  .staff-form-row,
  .perm-grid,
  .auth-grid-2,
  .profile-stats-grid,
  .profile-time-strip,
  .traits-inputs-grid,
  .roles-studio {
    grid-template-columns: 1fr;
  }

  .roles-sidebar-col {
    position: static;
  }

  .settings-shell {
    flex-direction: column;
  }

  .settings-sidebar {
    flex: none;
    max-width: none;
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .settings-sidebar-inner {
    width: 100%;
    padding: 8px 10px;
  }

  .settings-server-heading,
  .settings-nav-label,
  .settings-esc-rail {
    display: none;
  }

  .settings-sidebar .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
  }

  .settings-nav-section {
    flex-direction: row;
    gap: 4px;
  }

  .admin-nav-btn {
    width: auto;
    white-space: nowrap;
  }

  .settings-scroll-area {
    padding: 18px 14px 36px;
  }
}

@media (max-width: 640px), (max-height: 520px) {
  .rc-context-backdrop.sheet-active {
    background: rgba(0, 0, 0, 0.48);
  }

  .rc-context-menu.is-sheet {
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    top: auto !important;
    max-width: 520px;
    width: auto;
    margin: 0 auto;
    max-height: min(74dvh, 460px);
    border-radius: 14px;
    padding: 8px;
  }

  .banner-swatches-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
