/* ═══════════════════════════════════════════════════════════════════
   星语 NovaChat — Design System
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg: #070a13;
  --bg-soft: #0a0e1b;
  --panel: rgba(15, 21, 38, 0.72);
  --panel-solid: #10162a;
  --panel-raised: #151c33;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1fb;
  --text-soft: #c5cbe0;
  --muted: #8c95b1;
  --muted-2: #666f8d;
  --violet: #8b7cff;
  --violet-deep: #6d5efc;
  --cyan: #22d3ee;
  --pink: #f472b6;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-lg: 0 30px 90px rgba(0, 0, 0, 0.48);
  --shadow-md: 0 16px 46px rgba(0, 0, 0, 0.32);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.app-active,
body.admin-active {
  height: 100svh;
  overflow: hidden;
}

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

button {
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4, h5, p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
}

li {
  list-style: none;
}

img, svg {
  display: block;
}

::selection {
  background: rgba(139, 124, 255, 0.35);
  color: #fff;
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
}

:focus-visible {
  outline: 2px solid rgba(139, 124, 255, 0.8);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.ico {
  display: inline-block;
  vertical-align: -0.18em;
  flex: 0 0 auto;
}

.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  letter-spacing: -0.2px;
}

.text-green { color: var(--green) !important; }
.text-amber { color: var(--amber) !important; }
.text-muted { color: var(--muted) !important; }

/* ────────────────────────────── Boot ────────────────────────────── */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 42%, rgba(109, 94, 252, 0.16), transparent 36%),
    #070a13;
  transition: opacity 0.38s ease, visibility 0.38s ease;
}

.boot-screen.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-mark {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 0 26px rgba(109, 94, 252, 0.5));
  animation: bootPulse 1.8s ease-in-out infinite;
}

.boot-mark svg {
  width: 100%;
  height: 100%;
}

.boot-screen p {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 3px;
}

@keyframes bootPulse {
  0%, 100% { transform: scale(1); opacity: 0.82; }
  50% { transform: scale(1.06); opacity: 1; }
}

/* ────────────────────────────── Buttons ────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn:active {
  transform: translateY(1px) scale(0.995);
}

.btn-primary {
  background: linear-gradient(135deg, #8b7cff, #6d5efc 60%, #5b8cff);
  color: #fff;
  box-shadow: 0 8px 26px rgba(109, 94, 252, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 10px 32px rgba(109, 94, 252, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  filter: brightness(1.04);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line);
  color: var(--text-soft);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
  color: #fff;
}

.btn-danger {
  background: rgba(251, 113, 133, 0.13);
  border-color: rgba(251, 113, 133, 0.28);
  color: #ff9baa;
}

.btn-danger:hover {
  background: rgba(251, 113, 133, 0.2);
  border-color: rgba(251, 113, 133, 0.42);
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
  min-height: 48px;
  font-size: 14.5px;
}

.btn.is-loading .btn-label {
  opacity: 0.28;
}

.btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

.btn-primary:not(.is-loading) .btn-spinner {
  display: none;
}

.btn-primary.is-loading .btn-spinner {
  display: inline-block;
  position: absolute;
}

.btn-primary.is-loading {
  position: relative;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -3px;
}

/* ────────────────────────────── Avatar ────────────────────────────── */

.avatar {
  --avatar: #8b5cf6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  background: var(--avatar);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.34), transparent 45%),
    linear-gradient(145deg, var(--avatar), color-mix(in srgb, var(--avatar) 55%, #111a31));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 16px rgba(0, 0, 0, 0.18);
  user-select: none;
}

.avatar-xs { width: 26px; height: 26px; border-radius: 9px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; border-radius: 10px; font-size: 11px; }
.avatar-md { width: 42px; height: 42px; border-radius: 14px; font-size: 14px; }
.avatar-xl { width: 68px; height: 68px; border-radius: 22px; font-size: 23px; }

/* ────────────────────────────── Toasts ────────────────────────────── */

.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 14px 14px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(18, 24, 43, 0.92);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: toastIn 0.32s var(--ease);
  pointer-events: auto;
}

.toast-out {
  animation: toastOut 0.24s ease forwards;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.06);
  color: var(--violet);
}

.toast-success { border-color: rgba(52, 211, 153, 0.25); }
.toast-success .toast-icon { color: var(--green); background: rgba(52, 211, 153, 0.1); }
.toast-error { border-color: rgba(251, 113, 133, 0.28); }
.toast-error .toast-icon { color: var(--red); background: rgba(251, 113, 133, 0.1); }
.toast-warning { border-color: rgba(251, 191, 36, 0.25); }
.toast-warning .toast-icon { color: var(--amber); background: rgba(251, 191, 36, 0.1); }

.toast-copy {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.toast-copy b {
  display: block;
  font-size: 12.5px;
  margin-bottom: 2px;
}

.toast-copy p {
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.toast-close {
  color: var(--muted-2);
  padding: 2px 4px;
  font-size: 18px;
  line-height: 1;
}

.toast-close:hover { color: #fff; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

/* ────────────────────────────── Modal ────────────────────────────── */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 10020;
  pointer-events: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(4, 7, 15, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: auto;
  z-index: 9999;
}

.modal-overlay.is-open {
  opacity: 1;
}

.modal {
  width: min(560px, 100%);
  max-height: min(86svh, 850px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 0%, rgba(139, 124, 255, 0.12), transparent 34%),
    #101629;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.24s var(--ease);
  overflow: hidden;
}

.modal-overlay.is-open .modal {
  transform: translateY(0) scale(1);
}

.modal-sm { width: min(440px, 100%); }
.modal-md { width: min(620px, 100%); }
.modal-lg { width: min(760px, 100%); }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  font-size: 18px;
  letter-spacing: -0.3px;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  margin-top: -3px;
  transition: background 0.16s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  min-height: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.08);
}

.confirm-message {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.8;
}

/* ────────────────────────────── Form primitives ────────────────────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.label-hint {
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0;
}

.field-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 47px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 11, 22, 0.55);
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.input-shell:focus-within {
  border-color: rgba(139, 124, 255, 0.58);
  box-shadow: 0 0 0 3px rgba(139, 124, 255, 0.1);
  background: rgba(7, 11, 22, 0.8);
}

.input-icon {
  color: var(--muted-2);
  font-size: 14px;
  font-family: var(--mono);
  width: 16px;
  text-align: center;
  flex: 0 0 auto;
}

.input-shell input,
.input-shell textarea {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
}

.input-shell input {
  height: 45px;
}

.input-shell textarea {
  padding: 12px 0;
  resize: vertical;
  min-height: 64px;
  line-height: 1.6;
}

.input-shell input::placeholder,
.input-shell textarea::placeholder {
  color: #5d6581;
}

.input-shell input[disabled] {
  color: var(--muted);
}

.input-readonly {
  opacity: 0.62;
}

.input-textarea {
  align-items: flex-start;
  padding: 2px 13px;
}

.password-toggle {
  color: var(--muted-2);
  font-size: 11px;
  padding: 4px;
  flex: 0 0 auto;
}

.password-toggle:hover { color: var(--text-soft); }

.form-error {
  display: none;
  padding: 10px 12px;
  border: 1px solid rgba(251, 113, 133, 0.24);
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.08);
  color: #ff9baa;
  font-size: 12px;
  line-height: 1.55;
}

.form-error.show {
  display: block;
}

.form-error:empty {
  display: none !important;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.check-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.check-label input {
  position: absolute;
  left: 0;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: 0;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
}

.fake-check {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  flex: 0 0 auto;
  transition: all 0.15s;
}

.check-label input:checked + .fake-check {
  background: var(--violet-deep);
  border-color: var(--violet-deep);
}

.check-label input:checked + .fake-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(42deg);
}

.check-label a {
  color: var(--violet);
}

.link-btn {
  display: inline;
  padding: 0;
  color: var(--violet);
  font-size: inherit;
  font-weight: 650;
  transition: color 0.15s;
}

.link-btn:hover { color: #b1a6ff; }

.shake {
  animation: shake 0.38s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

/* ══════════════════════════════ AUTH ══════════════════════════════ */

.auth-view {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 10% 0%, rgba(109, 94, 252, 0.18), transparent 55%),
    radial-gradient(ellipse 55% 55% at 96% 12%, rgba(34, 211, 238, 0.1), transparent 50%),
    linear-gradient(180deg, #070a14 0%, #080b17 50%, #060811 100%);
}

.auth-ambient {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.44;
  animation: orbFloat 16s ease-in-out infinite alternate;
}

.orb-a {
  width: 420px;
  height: 420px;
  top: -170px;
  left: -120px;
  background: #5b4df0;
}

.orb-b {
  width: 360px;
  height: 360px;
  top: 34%;
  right: -180px;
  background: #0d9db8;
  animation-delay: -5s;
}

.orb-c {
  width: 300px;
  height: 300px;
  bottom: -150px;
  left: 34%;
  background: #8b2e74;
  opacity: 0.22;
  animation-delay: -9s;
}

@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(38px, 28px, 0) scale(1.12); }
}

.auth-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 18% 26%, rgba(255, 255, 255, 0.75), transparent 100%),
    radial-gradient(1px 1px at 72% 14%, rgba(255, 255, 255, 0.55), transparent 100%),
    radial-gradient(1.2px 1.2px at 42% 64%, rgba(255, 255, 255, 0.5), transparent 100%),
    radial-gradient(1px 1px at 86% 52%, rgba(255, 255, 255, 0.65), transparent 100%),
    radial-gradient(1px 1px at 63% 82%, rgba(255, 255, 255, 0.4), transparent 100%),
    radial-gradient(1px 1px at 28% 90%, rgba(255, 255, 255, 0.5), transparent 100%);
  background-size: 420px 420px, 520px 520px, 600px 600px, 460px 460px, 700px 700px, 550px 550px;
  opacity: 0.65;
  animation: starDrift 90s linear infinite;
}

@keyframes starDrift {
  to { background-position: 420px 0, -520px 0, 600px 0, -460px 0, 700px 0, -550px 0; }
}

.auth-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 66px 66px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 10%, transparent 72%);
}

.auth-header {
  position: relative;
  z-index: 2;
  width: min(1320px, calc(100% - 72px));
  margin: 0 auto;
  padding: 26px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: block;
  filter: drop-shadow(0 7px 18px rgba(109, 94, 252, 0.35));
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-word {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-word strong {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 3px;
}

.brand-word small {
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 2.4px;
  margin-top: 4px;
}

.brand-small .brand-mark { width: 34px; height: 34px; }
.brand-small .brand-word strong { font-size: 15px; }
.brand-small .brand-word small { font-size: 7.5px; }

.auth-header-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12), 0 0 12px rgba(52, 211, 153, 0.7);
  display: inline-block;
  flex: 0 0 auto;
  animation: livePulse 2.2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.auth-main {
  position: relative;
  z-index: 2;
  width: min(1210px, calc(100% - 72px));
  margin: auto;
  padding: 16px 0 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 450px;
  align-items: center;
  gap: clamp(48px, 7vw, 108px);
}

.auth-story {
  padding-bottom: 6px;
  animation: fadeUp 0.8s var(--ease) both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 2.4px;
  font-weight: 600;
  margin-bottom: 24px;
}

.eyebrow-spark {
  color: var(--violet);
  font-size: 12px;
  letter-spacing: 0;
}

.auth-story h1 {
  font-size: clamp(44px, 5.2vw, 70px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -2.8px;
}

.gradient-text {
  background: linear-gradient(110deg, #c2b8ff 4%, #8b7cff 38%, #53d8eb 82%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 36px rgba(109, 94, 252, 0.22));
}

.story-lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
  margin-top: 22px;
}

.hero-chat {
  position: relative;
  width: min(430px, 100%);
  margin-top: 34px;
  padding: 17px 18px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(150deg, rgba(24, 31, 56, 0.7), rgba(12, 17, 31, 0.48));
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

.hero-chat-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  right: -80px;
  top: -100px;
  background: radial-gradient(circle, rgba(109, 94, 252, 0.28), transparent 65%);
  pointer-events: none;
}

.hero-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.hero-channel {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-soft);
}

.hero-online {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: 10px;
}

.hero-message {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  animation: fadeUp 0.7s var(--ease) both;
}

.hero-message:nth-child(3) { animation-delay: 0.12s; }
.hero-message:nth-child(4) { animation-delay: 0.22s; }
.hero-message:nth-child(5) { animation-delay: 0.32s; }

.mini-avatar {
  --avatar: #8b5cf6;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--avatar);
  background: linear-gradient(145deg, var(--avatar), color-mix(in srgb, var(--avatar) 50%, #10162a));
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.hero-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.hero-meta b {
  color: var(--text-soft);
  font-size: 11px;
}

.hero-meta span {
  color: var(--muted-2);
  font-size: 9px;
}

.hero-message p {
  color: #aab2c9;
  font-size: 11.5px;
  margin-top: 2px;
  line-height: 1.55;
}

.hero-message-last p {
  color: #c7c0ff;
}

.hero-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted-2);
  font-size: 9.5px;
  padding: 8px 0 2px 39px;
}

.hero-typing span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--violet);
  animation: typingBounce 1.2s ease-in-out infinite;
}

.hero-typing span:nth-child(2) { animation-delay: 0.14s; }
.hero-typing span:nth-child(3) { animation-delay: 0.28s; margin-right: 5px; }

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

.hero-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
}

.hero-features li {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  min-width: 0;
}

.feature-icon {
  width: 29px;
  height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 13px;
  flex: 0 0 auto;
}

.hero-features b {
  display: block;
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 650;
}

.hero-features small {
  display: block;
  color: var(--muted-2);
  font-size: 9.5px;
  margin-top: 3px;
  line-height: 1.5;
}

.auth-card-wrap {
  width: 100%;
  animation: fadeUp 0.8s 0.12s var(--ease) both;
}

.auth-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 0% 0%, rgba(139, 124, 255, 0.1), transparent 32%),
    linear-gradient(155deg, rgba(23, 30, 53, 0.88), rgba(11, 16, 30, 0.9));
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  overflow: hidden;
}

.auth-tabs {
  position: relative;
  display: flex;
  padding: 7px 30px 0;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  flex: 1;
  padding: 14px 0 13px;
  color: var(--muted-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  transition: color 0.18s;
}

.auth-tab.active { color: var(--text); }

.auth-tab-indicator {
  position: absolute;
  bottom: -1px;
  left: 30px;
  width: calc(50% - 30px);
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 14px rgba(139, 124, 255, 0.5);
  transition: transform 0.28s var(--ease), opacity 0.2s;
}

.auth-tabs[data-active="register"] .auth-tab-indicator {
  transform: translateX(calc(100% + 0px));
}

.auth-tabs[data-active="forgot"] .auth-tab-indicator {
  opacity: 0;
}

.auth-panel {
  padding: 24px 30px 26px;
  animation: panelIn 0.3s var(--ease);
}

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

.form-heading {
  margin-bottom: 20px;
}

.form-heading h2 {
  font-size: 23px;
  letter-spacing: -0.7px;
}

.form-heading p {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 6px;
}

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

.form-row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: -1px;
}

.form-row-between .check-label {
  font-size: 11.5px;
}

.code-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.code-row .input-shell {
  flex: 1;
}

.code-btn {
  flex: 0 0 auto;
  min-width: 113px;
  min-height: 47px;
  padding: 0 13px;
  font-size: 11.5px;
}

.auth-panel .btn-block {
  margin-top: 2px;
}

.auth-switch {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 17px;
}

.agree-label {
  align-items: flex-start;
  line-height: 1.6;
  font-size: 11px;
}

.agree-label .fake-check {
  margin-top: 1px;
}

.back-link {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 17px;
  padding: 0;
  transition: color 0.16s;
}

.back-link:hover { color: var(--text); }

.auth-card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.2px;
}

.shield-mini {
  font-size: 11px;
  filter: grayscale(0.2);
}

.auth-legal {
  text-align: center;
  color: var(--muted-2);
  font-size: 9.5px;
  margin-top: 16px;
  letter-spacing: 0.3px;
}

.auth-footer {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 9px;
  padding: 20px 24px 24px;
  color: var(--muted-2);
  font-size: 10px;
}

.auth-footer a:hover { color: var(--text-soft); }
.footer-dot { opacity: 0.4; }

.legal-copy {
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.85;
}

.legal-copy .legal-lead {
  color: var(--muted);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.legal-copy h4 {
  color: var(--text);
  font-size: 13px;
  margin: 18px 0 5px;
}

.legal-copy p {
  color: var(--muted);
}

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

/* ══════════════════════════════ CHAT APP ══════════════════════════════ */

.app-view {
  position: relative;
  display: flex;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background: #080b14;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.15;
}

.glow-a {
  width: 560px;
  height: 560px;
  background: #5b4df0;
  top: -260px;
  left: 22%;
}

.glow-b {
  width: 420px;
  height: 420px;
  background: #0e8ea8;
  bottom: -260px;
  right: 6%;
}

.app-noise {
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 0.6px, transparent 0.6px);
  background-size: 6px 6px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 70%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 70%);
}

/* Sidebar */

.sidebar {
  position: relative;
  z-index: 20;
  width: 294px;
  flex: 0 0 294px;
  display: flex;
  flex-direction: column;
  padding: 18px 13px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 17, 31, 0.92), rgba(9, 13, 24, 0.9));
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 17px;
}

.sidebar-close {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.space-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background:
    radial-gradient(circle at 90% 0%, rgba(139, 124, 255, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.space-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, #8b7cff, #5b4df0);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 7px 19px rgba(91, 77, 240, 0.35);
  flex: 0 0 auto;
}

.space-card div {
  min-width: 0;
  flex: 1;
}

.space-card b {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.space-card div span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: 9.5px;
  margin-top: 2px;
}

.space-card .live-dot {
  width: 5px;
  height: 5px;
}

.space-badge {
  align-self: flex-start;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.8px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 37px;
  margin-top: 12px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.16s, background 0.16s;
}

.search-box:focus-within {
  border-color: rgba(139, 124, 255, 0.28);
  background: rgba(255, 255, 255, 0.055);
}

.search-icon {
  color: var(--muted-2);
  font-size: 17px;
  line-height: 1;
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 11.5px;
}

.search-box input::placeholder { color: #5d6581; }

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 7px 0 12px;
  scrollbar-width: thin;
}

.side-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 10px 8px;
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.side-count {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 1px 5px;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 11px;
  border: 1px solid transparent;
  text-align: left;
  color: var(--text-soft);
  transition: background 0.14s, border-color 0.14s;
}

.room-item:hover {
  background: rgba(255, 255, 255, 0.045);
}

.room-item.active {
  background: linear-gradient(90deg, rgba(139, 124, 255, 0.17), rgba(139, 124, 255, 0.055));
  border-color: rgba(139, 124, 255, 0.16);
  color: #fff;
}

.room-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 14px;
  flex: 0 0 auto;
  transition: background 0.14s;
}

.room-item.active .room-icon {
  background: rgba(139, 124, 255, 0.16);
}

.room-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.room-name-row b {
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-name-row time {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-size: 8px;
}

.room-preview {
  color: var(--muted-2);
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-item.active .room-preview { color: #a99ff0; }

.room-unread {
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--violet-deep);
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  flex: 0 0 auto;
}

.mini-members {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mini-member {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 9px;
  border-radius: 9px;
  color: var(--muted);
  text-align: left;
  font-size: 11px;
  transition: background 0.14s;
}

.mini-member:hover { background: rgba(255, 255, 255, 0.04); }

.mini-member-avatar {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.mini-member span:nth-child(2) {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mini-member em {
  font-style: normal;
  color: var(--violet);
  font-size: 8px;
  border: 1px solid rgba(139, 124, 255, 0.22);
  padding: 1px 4px;
  border-radius: 4px;
}

.presence-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4b536b;
  border: 1.5px solid #0c1120;
}

.presence-dot.on {
  background: var(--green);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.7);
}

.side-empty {
  padding: 14px 10px;
  color: var(--muted-2);
  font-size: 10.5px;
}

.sidebar-user {
  flex: 0 0 auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border-radius: 11px;
  text-align: left;
  transition: background 0.14s;
}

.user-chip:hover { background: rgba(255, 255, 255, 0.045); }

.user-chip-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-chip-copy b {
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-chip-copy small {
  color: var(--muted-2);
  font-size: 9.5px;
}

.user-chip-chevron {
  color: var(--muted-2);
  font-size: 12px;
  transform: rotate(180deg);
}

.sidebar-user-actions {
  display: flex;
  gap: 5px;
  padding: 5px 3px 0;
}

.mini-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-radius: 8px;
  color: var(--muted-2);
  font-size: 9.5px;
  transition: background 0.14s, color 0.14s;
}

.mini-action:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

/* Scrim */

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(3, 5, 12, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.22s;
}

.scrim.show { display: block; opacity: 1; }

/* Chat main */

.chat-main {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  flex: 0 0 auto;
  height: 73px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 26, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.mobile-menu {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 17px;
}

.channel-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.channel-heading-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 37px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 16px;
  flex: 0 0 auto;
}

.channel-heading h2 {
  font-size: 15px;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-heading p {
  color: var(--muted-2);
  font-size: 10px;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.header-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 10px;
  transition: background 0.14s, color 0.14s;
}

.header-pill:hover {
  background: rgba(255, 255, 255, 0.065);
  color: var(--text-soft);
}

.header-avatar {
  border: 0;
  cursor: pointer;
}

.announcement {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 28px;
  border-bottom: 1px solid rgba(139, 124, 255, 0.13);
  background: linear-gradient(90deg, rgba(139, 124, 255, 0.1), rgba(34, 211, 238, 0.045));
}

.announcement-icon { font-size: 12px; }

.announcement p {
  flex: 1;
  color: #b8b1e8;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.announcement .icon-btn {
  width: 24px;
  height: 24px;
  color: var(--muted-2);
  font-size: 17px;
  line-height: 1;
}

/* Messages */

.message-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.channel-intro {
  max-width: 900px;
  margin: 30px auto 8px;
  padding: 0 33px;
}

.intro-icon {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.08), transparent 55%),
    rgba(139, 124, 255, 0.1);
  font-size: 27px;
  margin-bottom: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.channel-intro h3 {
  font-size: 25px;
  letter-spacing: -0.9px;
}

.channel-intro h3 span {
  background: linear-gradient(100deg, #d5cfff, #8b7cff 55%, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.channel-intro p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 7px;
}

.intro-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-2);
  font-size: 9.5px;
  margin-top: 12px;
}

.load-older {
  display: block;
  margin: 5px auto 17px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 9.5px;
  transition: all 0.15s;
}

.load-older:hover {
  border-color: var(--line-strong);
  color: var(--text-soft);
}

.message-list {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 23px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 10px;
  padding: 0 10px;
  color: var(--muted-2);
  font-size: 8.5px;
  letter-spacing: 0.8px;
}

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

.message {
  position: relative;
  display: flex;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 11px;
  transition: background 0.13s;
}

.message:hover {
  background: rgba(255, 255, 255, 0.027);
}

.message.own {
  background: linear-gradient(90deg, rgba(139, 124, 255, 0.045), transparent 60%);
}

.message.own:hover {
  background: linear-gradient(90deg, rgba(139, 124, 255, 0.075), rgba(255, 255, 255, 0.02));
}

.message-main {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.message-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-bottom: 2px;
}

.message-name {
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  height: 15px;
  padding: 0 4px;
  border: 1px solid rgba(139, 124, 255, 0.24);
  border-radius: 4px;
  background: rgba(139, 124, 255, 0.1);
  color: #b4a9ff;
  font-size: 7.5px;
  font-weight: 700;
  flex: 0 0 auto;
}

.role-badge.small {
  font-size: 7px;
  height: 14px;
}

.you-badge {
  color: var(--muted-2);
  font-size: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 14px;
}

.message-time {
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 400;
  flex: 0 0 auto;
}

.message-content {
  color: #cbd1e4;
  font-size: 13px;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message.own .message-content {
  color: #ded9ff;
}

.message-content a {
  color: #7ed8ee;
  text-decoration: underline;
  text-decoration-color: rgba(126, 216, 238, 0.35);
  text-underline-offset: 2px;
}

.message-content a:hover {
  text-decoration-color: #7ed8ee;
}

.message-actions {
  position: absolute;
  right: 7px;
  top: 4px;
  opacity: 0;
  transition: opacity 0.13s;
  background: #10162a;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
}

.message:hover .message-actions { opacity: 1; }

.message-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  border-radius: 5px;
  color: var(--muted-2);
}

.message-action:hover {
  background: rgba(251, 113, 133, 0.12);
  color: var(--red);
}

.message-loading,
.message-error {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 33px;
  color: var(--muted-2);
  font-size: 11px;
}

.message-error { color: var(--red); }

.empty-messages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 50px 20px 60px;
  color: var(--muted-2);
  font-size: 11px;
  text-align: center;
}

.empty-messages span {
  color: var(--violet);
  font-size: 20px;
  opacity: 0.7;
}

.typing-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 900px;
  margin: 6px auto 0;
  padding: 0 33px;
  color: var(--muted-2);
  font-size: 9.5px;
  min-height: 18px;
}

.typing-dots {
  display: inline-flex;
  gap: 2px;
}

.typing-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--violet);
  animation: typingBounce 1.1s infinite;
}

.typing-dots i:nth-child(2) { animation-delay: 0.13s; }
.typing-dots i:nth-child(3) { animation-delay: 0.26s; }

.new-messages {
  position: absolute;
  left: 50%;
  bottom: 112px;
  transform: translateX(-50%);
  z-index: 5;
  padding: 7px 13px;
  border: 1px solid rgba(139, 124, 255, 0.3);
  border-radius: 99px;
  background: #171e36;
  color: #cfc8ff;
  font-size: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: fadeUp 0.2s ease;
}

/* Composer */

.composer {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  padding: 3px 27px 13px;
  background: linear-gradient(to top, rgba(8, 11, 20, 0.98) 60%, rgba(8, 11, 20, 0.72) 85%, transparent);
}

.composer-box {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 864px;
  margin: 0 auto;
  padding: 7px 7px 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(17, 23, 41, 0.85);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 0.16s, box-shadow 0.16s;
}

.composer-box:focus-within {
  border-color: rgba(139, 124, 255, 0.34);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.24), 0 0 0 3px rgba(139, 124, 255, 0.06);
}

.composer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 20px;
  flex: 0 0 auto;
  transition: background 0.14s, color 0.14s;
}

.composer-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
}

.composer-box textarea {
  flex: 1;
  min-width: 0;
  height: 24px;
  min-height: 24px;
  max-height: 140px;
  padding: 3px 0 2px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  line-height: 1.62;
  resize: none;
}

.composer-box textarea::placeholder { color: #5b637d; }

.char-count {
  align-self: center;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  padding-right: 3px;
}

.char-count.near-limit { color: var(--amber); }

.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, #8b7cff, #6554ef);
  color: #fff;
  flex: 0 0 auto;
  box-shadow: 0 5px 14px rgba(101, 84, 239, 0.28);
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.send-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.send-btn.is-sending {
  opacity: 0.55;
  pointer-events: none;
}

.composer-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 864px;
  margin: 5px auto 0;
  padding: 0 2px;
  color: #515a74;
  font-size: 8.5px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
}

.connection-state i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.connection-online { color: #5cc9a0; }
.connection-online i { box-shadow: 0 0 6px rgba(52, 211, 153, 0.7); }
.connection-reconnecting, .connection-connecting { color: var(--amber); }
.connection-offline { color: var(--muted-2); }

/* Emoji */

.emoji-popover {
  position: absolute;
  left: 10px;
  bottom: 58px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  width: 292px;
  max-height: 230px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(16, 22, 40, 0.97);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  animation: fadeUp 0.16s ease;
}

.emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  font-size: 16px;
  transition: background 0.12s, transform 0.12s;
}

.emoji-item:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.12);
}

/* Members panel */

.members-panel {
  position: relative;
  z-index: 18;
  width: 274px;
  flex: 0 0 274px;
  display: flex;
  flex-direction: column;
  padding: 19px 13px 14px;
  border-left: 1px solid var(--line);
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.members-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 6px;
}

.members-head h3 {
  font-size: 13px;
  letter-spacing: 0.2px;
}

.members-head p {
  color: var(--muted-2);
  font-size: 9.5px;
  margin-top: 2px;
}

.members-head .icon-btn {
  display: none;
  width: 28px;
  height: 28px;
  color: var(--muted);
  font-size: 19px;
}

.members-search {
  margin-top: 13px;
  height: 34px;
}

.members-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 0;
}

.member-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 7px;
  border-radius: 9px;
  text-align: left;
  transition: background 0.13s;
}

.member-item:hover { background: rgba(255, 255, 255, 0.04); }
.member-item:not(.online) { opacity: 0.62; }

.member-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.member-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.member-copy b {
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-copy b em {
  font-style: normal;
  color: var(--muted-2);
  font-size: 8px;
}

.member-copy small {
  color: var(--muted-2);
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.members-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 7px 0;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8.5px;
}

.members-scrim { z-index: 17; }

/* Member card */

.member-card-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.member-card-head h3 {
  font-size: 19px;
  letter-spacing: -0.4px;
}

.member-card-head p {
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.member-bio {
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.8;
  padding: 17px 0;
}

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

.member-facts div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.member-facts span {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
  margin-bottom: 3px;
}

.member-facts b {
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
}

/* Profile modal */

.profile-block {
  padding: 0 0 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.profile-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.profile-hero h3 {
  font-size: 20px;
  letter-spacing: -0.4px;
}

.profile-hero p {
  color: var(--muted);
  font-size: 10.5px;
  margin: 2px 0 7px;
}

.profile-role {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid rgba(139, 124, 255, 0.22);
  border-radius: 5px;
  color: #b4a9ff;
  font-size: 8px;
}

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

.profile-form-actions {
  display: flex;
  justify-content: flex-end;
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-dot {
  width: 27px;
  height: 27px;
  border-radius: 9px;
  background: var(--dot);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  transition: transform 0.14s, border-color 0.14s;
}

.color-dot:hover { transform: scale(1.1); }

.color-dot.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(139, 124, 255, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.block-heading {
  margin-bottom: 13px;
}

.block-heading.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.block-heading h4 {
  font-size: 13px;
}

.block-heading p {
  color: var(--muted-2);
  font-size: 10px;
  margin-top: 2px;
}

.inline-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.my-logins {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 230px;
  overflow-y: auto;
}

.my-login-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.login-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.login-status.ok { background: var(--green); }
.login-status.bad { background: var(--red); }

.my-login-row div {
  flex: 1;
  min-width: 0;
}

.my-login-row b {
  display: block;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 600;
}

.my-login-row small {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
}

.my-login-row time {
  color: var(--muted-2);
  font-size: 8px;
  flex: 0 0 auto;
}

.muted-copy {
  color: var(--muted-2);
  font-size: 10.5px;
}

.danger-zone .block-heading {
  margin-bottom: 0;
}

/* ══════════════════════════════ ADMIN ══════════════════════════════ */

.admin-view {
  display: flex;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 55% 50% at 80% -10%, rgba(109, 94, 252, 0.09), transparent 60%),
    #080b14;
}

.admin-sidebar {
  width: 245px;
  flex: 0 0 245px;
  display: flex;
  flex-direction: column;
  padding: 20px 13px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 17, 30, 0.94), rgba(8, 12, 22, 0.96));
}

.admin-brand {
  padding: 0 8px 24px;
}

.admin-nav-label {
  padding: 15px 10px 7px;
  color: var(--muted-2);
  font-size: 8px;
  letter-spacing: 2px;
  font-weight: 700;
}

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

.admin-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 37px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 11.5px;
  text-align: left;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.admin-nav button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

.admin-nav button.active {
  background: linear-gradient(90deg, rgba(139, 124, 255, 0.16), rgba(139, 124, 255, 0.055));
  border-color: rgba(139, 124, 255, 0.14);
  color: #fff;
}

.nav-ico {
  width: 17px;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}

.admin-nav button.active .nav-ico { color: #b1a6ff; }

.admin-sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.admin-back-link {
  display: block;
  padding: 7px 10px;
  color: var(--muted-2);
  font-size: 10px;
  border-radius: 8px;
  transition: background 0.14s, color 0.14s;
}

.admin-back-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
}

.admin-user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 9px 8px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
}

.admin-user-card > div {
  flex: 1;
  min-width: 0;
}

.admin-user-card b {
  display: block;
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-user-card small {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
}

.admin-user-card .icon-btn {
  width: 28px;
  height: 28px;
  color: var(--muted-2);
  font-size: 14px;
  border-radius: 7px;
}

.admin-user-card .icon-btn:hover {
  background: rgba(251, 113, 133, 0.1);
  color: var(--red);
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.admin-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 32px 17px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 20, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.admin-breadcrumb {
  color: var(--muted-2);
  font-size: 8.5px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.admin-breadcrumb span { color: var(--muted); }

.admin-topbar h1 {
  font-size: 22px;
  letter-spacing: -0.6px;
}

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

.admin-menu-btn { display: none; }

.admin-live {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted-2);
  font-size: 9px;
}

.admin-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 25px 32px 44px;
}

.admin-loading {
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: var(--muted-2);
  font-size: 11px;
}

.admin-loading .spinner { width: 24px; height: 24px; border-width: 2px; }

.admin-error {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.admin-error-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: rgba(251, 113, 133, 0.1);
  color: var(--red);
  margin-bottom: 4px;
}

.admin-error h3 { font-size: 16px; }
.admin-error p { color: var(--muted); font-size: 11px; margin-bottom: 10px; }

/* Welcome */

.welcome-strip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 25px;
  border: 1px solid rgba(139, 124, 255, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 30%, rgba(34, 211, 238, 0.08), transparent 30%),
    radial-gradient(circle at 8% 0%, rgba(139, 124, 255, 0.16), transparent 44%),
    rgba(255, 255, 255, 0.022);
  overflow: hidden;
  margin-bottom: 18px;
}

.welcome-strip::after {
  content: "";
  position: absolute;
  right: 80px;
  top: -70px;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(139, 124, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.welcome-kicker {
  color: var(--violet);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 1.7px;
  margin-bottom: 6px;
}

.welcome-strip h2 {
  font-size: 21px;
  letter-spacing: -0.6px;
}

.welcome-strip h2 span {
  color: var(--violet);
  font-size: 16px;
}

.welcome-strip > div > p:last-child {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 6px;
}

.welcome-strip > div > p b { color: var(--text-soft); }

.welcome-orbit {
  position: relative;
  width: 98px;
  height: 98px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(139, 124, 255, 0.24);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 124, 255, 0.18), transparent 70%);
  box-shadow: 0 0 36px rgba(109, 94, 252, 0.14), inset 0 0 20px rgba(109, 94, 252, 0.08);
}

.welcome-orbit::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(139, 124, 255, 0.16);
  border-radius: 50%;
  animation: spin 24s linear infinite;
}

.welcome-orbit span {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.welcome-orbit small {
  color: var(--muted-2);
  font-size: 8px;
  margin-top: 5px;
}

/* Stats */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.stat-card {
  position: relative;
  display: flex;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.012));
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: -25px;
  top: -50px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: currentColor;
  filter: blur(45px);
  opacity: 0.1;
}

.stat-card.accent-violet { color: var(--violet); }
.stat-card.accent-cyan { color: var(--cyan); }
.stat-card.accent-pink { color: var(--pink); }
.stat-card.accent-amber { color: var(--amber); }

.stat-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: currentColor;
  color: #0b0f1d;
  flex: 0 0 auto;
  opacity: 0.9;
}

.stat-card > div:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.stat-card span {
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 0.2px;
}

.stat-card strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 23px;
  line-height: 1.25;
  font-weight: 700;
  margin: 2px 0;
}

.stat-card small {
  color: var(--muted-2);
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Overview cards */

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr);
  gap: 15px;
  margin-bottom: 15px;
}

.overview-grid.lower {
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.8fr);
}

.overview-grid.two-one {
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.012));
  padding: 18px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.card-head h3 {
  font-size: 13px;
  letter-spacing: -0.1px;
}

.card-head p {
  color: var(--muted-2);
  font-size: 9px;
  margin-top: 2px;
}

.card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(139, 124, 255, 0.1);
  color: var(--violet);
}

.chart-legend {
  display: flex;
  gap: 13px;
  color: var(--muted-2);
  font-size: 8.5px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  display: inline-block;
}

.dot-users { background: var(--violet); box-shadow: 0 0 5px rgba(139, 124, 255, 0.5); }
.dot-messages { background: var(--cyan); box-shadow: 0 0 5px rgba(34, 211, 238, 0.4); }

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  height: 172px;
  padding: 8px 2px 0;
  border-bottom: 1px solid var(--line);
}

.chart-day {
  flex: 1;
  height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chart-bars {
  flex: 1;
  width: 100%;
  max-width: 26px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.chart-bars i {
  flex: 1;
  min-height: 2px;
  border-radius: 3px 3px 1px 1px;
  transition: filter 0.15s;
}

.chart-bars i:hover { filter: brightness(1.35); }
.bar-users { background: linear-gradient(to top, rgba(139, 124, 255, 0.85), rgba(139, 124, 255, 0.28)); }
.bar-messages { background: linear-gradient(to top, rgba(34, 211, 238, 0.8), rgba(34, 211, 238, 0.18)); }

.chart-day small {
  color: var(--muted-2);
  font-size: 7px;
  font-family: var(--mono);
  white-space: nowrap;
  padding: 4px 0 6px;
}

.system-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.system-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.055);
  font-size: 10px;
}

.system-list > div:last-child { border-bottom: 0; }

.system-list span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.system-list .ico { color: var(--muted-2); }
.system-list b { font-weight: 600; color: var(--text-soft); font-size: 10px; }

.system-actions {
  display: flex;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.system-actions .btn { flex: 1; }

.text-btn {
  color: var(--violet);
  font-size: 9.5px;
  padding: 0;
  white-space: nowrap;
}

.text-btn:hover { color: #b7adff; }

.mini-note {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1px;
}

/* Table */

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 10.5px;
}

.admin-table th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
  color: var(--text-soft);
}

.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.admin-table.compact td { padding: 9px 10px; }

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

.table-user > div {
  min-width: 0;
}

.table-user b {
  display: block;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-user small {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.status-dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(52, 211, 153, 0.55); }
.status-dot.bad { background: var(--red); }

.cell-sub {
  display: block;
  color: var(--muted-2);
  font-size: 8px;
  margin-top: 2px;
  max-width: 210px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-time {
  color: var(--muted) !important;
  font-size: 9px;
  white-space: nowrap;
}

.cell-time b { font-weight: 500; }

.cell-email {
  color: var(--muted);
  font-size: 9.5px;
  word-break: break-all;
}

.cell-ip,
.ip-cell {
  font-size: 9.5px;
  color: var(--text-soft);
  white-space: nowrap;
}

.num-cell {
  text-align: center;
  font-family: var(--mono);
  font-size: 9.5px;
}

.recent-users {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.recent-user {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px;
  border-radius: 9px;
  text-align: left;
  transition: background 0.13s;
}

.recent-user:hover { background: rgba(255, 255, 255, 0.04); }

.recent-user > span {
  flex: 1;
  min-width: 0;
}

.recent-user b {
  display: block;
  font-size: 10px;
  color: var(--text-soft);
}

.recent-user small {
  display: block;
  color: var(--muted-2);
  font-size: 8px;
}

.recent-user em {
  font-style: normal;
  flex: 0 0 auto;
}

.region-list {
  display: flex;
  flex-direction: column;
}

.region-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.055);
}

.region-row:last-child { border-bottom: 0; }

.region-rank {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  width: 18px;
}

.region-row div { flex: 1; min-width: 0; }
.region-row b { display: block; font-size: 10px; color: var(--text-soft); font-weight: 500; }
.region-row small { display: block; color: var(--muted-2); font-size: 8px; }
.region-row > span:last-child { color: var(--violet); font-family: var(--mono); font-size: 9px; }

.quick-card .card-head { margin-bottom: 12px; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.quick-actions button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  transition: background 0.14s, border-color 0.14s;
}

.quick-actions button:hover {
  background: rgba(139, 124, 255, 0.06);
  border-color: rgba(139, 124, 255, 0.2);
}

.quick-actions button > span {
  color: var(--violet);
  margin-bottom: 2px;
}

.quick-actions b { font-size: 9.5px; color: var(--text-soft); }
.quick-actions small { font-size: 8px; color: var(--muted-2); }

/* Admin section / toolbar */

.admin-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.admin-section-head h2 {
  font-size: 17px;
  letter-spacing: -0.3px;
}

.admin-section-head p {
  color: var(--muted-2);
  font-size: 9.5px;
  margin-top: 3px;
}

.admin-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.total-pill {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.toolbar-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  min-width: 250px;
  flex: 1;
  max-width: 390px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 10, 19, 0.5);
}

.toolbar-search span { color: var(--muted-2); display: flex; }

.toolbar-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 10px;
}

.toolbar-search input::placeholder { color: #555e79; }

.admin-select,
.admin-input {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #0c1120;
  color: var(--text-soft);
  font-size: 10px;
  cursor: pointer;
}

.admin-input { cursor: text; width: 100%; }
.admin-select:focus, .admin-input:focus { border-color: rgba(139, 124, 255, 0.4); }

.toolbar-note {
  color: var(--muted-2);
  font-size: 8.5px;
  margin-left: auto;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.icon-text-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
  transition: background 0.13s, color 0.13s;
}

.icon-text-btn:hover {
  background: rgba(139, 124, 255, 0.1);
  color: #b5abff;
}

.icon-text-btn.danger { color: #d7808b; }
.icon-text-btn.danger:hover { background: rgba(251, 113, 133, 0.1); color: var(--red); }
.icon-text-btn.success { color: #6dcaa2; }
.icon-text-btn.success:hover { background: rgba(52, 211, 153, 0.1); color: var(--green); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 8px;
  line-height: 1.45;
  white-space: nowrap;
  margin-right: 3px;
}

.status-active {
  background: rgba(52, 211, 153, 0.09);
  border-color: rgba(52, 211, 153, 0.18);
  color: #62d6a6;
}

.status-banned {
  background: rgba(251, 113, 133, 0.09);
  border-color: rgba(251, 113, 133, 0.18);
  color: #ff9baa;
}

.status-admin {
  background: rgba(139, 124, 255, 0.11);
  border-color: rgba(139, 124, 255, 0.2);
  color: #b3a8ff;
}

.status-user {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line);
  color: var(--muted);
}

.status-muted {
  background: rgba(251, 191, 36, 0.09);
  border-color: rgba(251, 191, 36, 0.18);
  color: #e8c259;
}

.online-mark {
  display: inline-block;
  vertical-align: 1px;
  margin-left: 3px;
  color: var(--green);
  font-size: 7px;
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 3px;
  padding: 1px 3px;
}

.table-empty {
  padding: 36px 10px;
  text-align: center;
  color: var(--muted-2);
  font-size: 10px;
}

.region-cell {
  color: var(--text-soft);
  font-size: 9.5px;
  white-space: nowrap;
}

.device-cell {
  color: var(--text-soft);
  font-size: 9.5px;
  white-space: nowrap;
}

.message-cell {
  max-width: 320px;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.room-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 8.5px;
  white-space: nowrap;
}

.row-deleted {
  opacity: 0.52;
}

.row-deleted .message-cell {
  text-decoration: line-through;
}

/* Pagination */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding-top: 14px;
  color: var(--muted-2);
  font-size: 8.5px;
}

.page-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.page-btn {
  min-width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 9px;
  transition: background 0.13s, border-color 0.13s;
}

.page-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.page-btn.active {
  background: rgba(139, 124, 255, 0.16);
  border-color: rgba(139, 124, 255, 0.22);
  color: #c1b8ff;
}

.page-ellipsis {
  color: var(--muted-2);
  font-size: 9px;
  padding: 0 2px;
}

/* User admin modal */

.admin-user-head {
  display: flex;
  gap: 15px;
  align-items: center;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.admin-user-head h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 18px;
}

.admin-user-head p {
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 3px;
}

.admin-user-head small {
  display: block;
  color: var(--muted-2);
  font-size: 8.5px;
  margin-top: 4px;
}

.user-facts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 16px 0;
}

.user-facts div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  min-width: 0;
}

.user-facts span {
  display: block;
  color: var(--muted-2);
  font-size: 7.5px;
  margin-bottom: 2px;
}

.user-facts b {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-input {
  height: 27px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.modal-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.admin-user-danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.admin-user-danger h4 { font-size: 11px; }
.admin-user-danger p { color: var(--muted-2); font-size: 8.5px; margin-top: 2px; }

.temp-password {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px;
  border: 1px dashed rgba(139, 124, 255, 0.28);
  border-radius: 13px;
  background: rgba(139, 124, 255, 0.05);
  text-align: center;
}

.temp-password > span { color: var(--muted); font-size: 9.5px; }

.temp-password strong {
  font-family: var(--mono);
  font-size: 23px;
  letter-spacing: 1px;
  color: #cfc8ff;
}

/* Rooms admin */

.room-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.room-admin-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.034), rgba(255, 255, 255, 0.012));
  transition: border-color 0.15s;
}

.room-admin-card:hover { border-color: var(--line-strong); }

.room-admin-icon {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(139, 124, 255, 0.08);
  font-size: 20px;
  flex: 0 0 auto;
}

.room-admin-copy {
  flex: 1;
  min-width: 0;
}

.room-admin-copy h3 {
  font-size: 12px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.room-admin-copy h3 span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 400;
}

.room-admin-copy p {
  color: var(--muted);
  font-size: 9.5px;
  margin: 4px 0 7px;
  line-height: 1.55;
}

.room-admin-facts {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  color: var(--muted-2);
  font-size: 7.5px;
}

.room-admin-actions {
  display: flex;
  gap: 3px;
  flex: 0 0 auto;
}

.room-admin-actions .icon-btn {
  width: 27px;
  height: 27px;
  border-radius: 7px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.13s, color 0.13s;
}

.room-admin-actions .icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.room-admin-actions .icon-btn.danger:hover { background: rgba(251, 113, 133, 0.1); color: var(--red); }

.info-banner {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(34, 211, 238, 0.12);
  border-radius: 9px;
  background: rgba(34, 211, 238, 0.04);
  color: var(--muted);
  font-size: 9px;
}

.info-banner .ico { color: var(--cyan); }

/* Settings */

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 15px;
  padding-bottom: 80px;
}

.settings-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-layout .field-label { font-size: 10.5px; }
.settings-layout .input-shell { min-height: 40px; }
.settings-layout .input-shell input { height: 38px; font-size: 11.5px; }
.settings-layout .input-shell textarea { font-size: 11.5px; }
.settings-layout .field { gap: 6px; }
.settings-layout .field-grid { gap: 9px; }

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

.switch-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
}

.switch-row > span {
  min-width: 0;
}

.switch-row b {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.switch-row small {
  display: block;
  font-size: 8px;
  color: var(--muted-2);
  margin-top: 1px;
}

.switch-row input {
  position: absolute;
  right: 9px;
  top: 50%;
  width: 31px;
  height: 18px;
  margin: 0;
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
}

.switch-row i {
  width: 31px;
  height: 18px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  flex: 0 0 auto;
  transition: background 0.18s;
}

.switch-row i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #78819b;
  transition: transform 0.18s, background 0.18s;
}

.switch-row input:checked + i {
  background: rgba(109, 94, 252, 0.65);
}

.switch-row input:checked + i::after {
  transform: translateX(13px);
  background: #fff;
}

.smtp-guide {
  padding: 11px 12px;
  border: 1px solid rgba(34, 211, 238, 0.13);
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.035);
  margin-bottom: 13px;
}

.smtp-guide b { color: #a8e8f2; font-size: 9.5px; }
.smtp-guide p { color: var(--muted); font-size: 8.5px; line-height: 1.7; margin: 3px 0 5px; }
.smtp-guide strong { color: #d9b4ff; }
.smtp-guide ol { padding-left: 14px; }
.smtp-guide li { list-style: decimal; color: var(--muted-2); font-size: 8px; line-height: 1.7; }
.smtp-guide code { color: #a9dff0; font-family: var(--mono); font-size: 8px; }

.check-line {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.check-line input { accent-color: var(--violet-deep); }

.test-mail-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
}

.test-mail-box b { font-size: 9.5px; }
.test-mail-box p { color: var(--muted-2); font-size: 8px; margin-top: 1px; }

.test-mail-row {
  display: flex;
  gap: 5px;
  align-items: center;
  flex: 1;
  max-width: 280px;
}

.test-mail-row .admin-input { height: 31px; font-size: 9px; }
.test-mail-row .btn { min-height: 31px; }

.settings-save-bar {
  position: fixed;
  right: 32px;
  bottom: 20px;
  left: calc(245px + 32px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(16, 22, 40, 0.94);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(20px);
}

.settings-save-bar b { display: block; font-size: 10.5px; }
.settings-save-bar span { display: block; color: var(--muted-2); font-size: 8.5px; margin-top: 1px; }
.settings-save-bar .btn { min-height: 36px; }

/* Audit */

.admin-audit-avatar {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(139, 124, 255, 0.1);
  color: #b4a9ff;
  font-size: 9px;
  font-weight: 700;
  flex: 0 0 auto;
}

.action-chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.audit-details {
  max-width: 330px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* ══════════════════════════════ Responsive ══════════════════════════════ */

@media (max-width: 1180px) {
  .auth-main {
    width: min(1060px, calc(100% - 56px));
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 50px;
  }

  .auth-story h1 { font-size: clamp(42px, 5vw, 58px); }
  .hero-features { grid-template-columns: 1fr; gap: 8px; }
  .hero-features li { align-items: center; }

  .members-panel { width: 248px; flex-basis: 248px; }
  .sidebar { width: 274px; flex-basis: 274px; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid, .overview-grid.lower, .overview-grid.two-one { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: 1fr; }
  .user-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .auth-main {
    display: block;
    width: min(460px, calc(100% - 40px));
    padding-top: 10px;
  }

  .auth-story {
    text-align: center;
    margin-bottom: 20px;
  }

  .auth-story h1 { font-size: 36px; letter-spacing: -1.5px; }
  .story-lead { font-size: 12px; margin-top: 12px; }
  .story-lead br { display: none; }
  .hero-chat, .hero-features, .eyebrow { display: none; }
  .auth-card-wrap { max-width: 460px; margin: 0 auto; }
  .auth-header { width: calc(100% - 40px); padding: 15px 0; }
  .auth-header-note { display: none; }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 288px;
    flex-basis: 288px;
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease);
    box-shadow: 26px 0 70px rgba(0, 0, 0, 0.35);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; align-items: center; justify-content: center; }
  .mobile-menu { display: flex; align-items: center; justify-content: center; }
  .members-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    flex-basis: 280px;
    transform: translateX(102%);
    transition: transform 0.28s var(--ease);
    box-shadow: -26px 0 70px rgba(0, 0, 0, 0.35);
  }

  .members-panel.open { transform: translateX(0); }
  .members-head .icon-btn { display: flex; align-items: center; justify-content: center; }
  .chat-header { padding: 0 18px; }
  .message-list, .channel-intro, .typing-bar { padding-left: 18px; padding-right: 18px; }
  .composer { padding-left: 15px; padding-right: 15px; }

  .admin-sidebar {
    width: 216px;
    flex-basis: 216px;
  }

  .admin-content { padding: 20px 20px 42px; }
  .admin-topbar { padding: 17px 20px 15px; }
  .settings-save-bar { left: calc(216px + 20px); right: 20px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-admin-grid { grid-template-columns: 1fr; }
  .welcome-orbit { display: none; }
  .overview-grid .admin-card { padding: 15px; }
}

@media (max-width: 760px) {
  .admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    width: 226px;
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease);
  }

  .admin-sidebar.open { transform: translateX(0); }
  .admin-view::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(3, 6, 14, 0.65);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    z-index: 55;
  }

  .admin-view.sidebar-open::after { opacity: 1; pointer-events: auto; }
  .admin-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--muted);
    flex: 0 0 auto;
  }

  .admin-topbar { align-items: center; }
  .admin-topbar > div:first-child { flex: 1; }
  .admin-live { display: none; }
  .admin-content { padding: 16px 14px 42px; }
  .settings-save-bar { left: 14px; right: 14px; bottom: 12px; }
  .admin-section-head { flex-direction: column; gap: 8px; align-items: stretch; }
  .admin-section-actions { justify-content: flex-start; }
  .stat-grid { gap: 8px; }
  .stat-card { padding: 12px; gap: 9px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-card strong { font-size: 19px; }
  .stat-card small { font-size: 7.5px; }
  .trend-chart { height: 140px; gap: 4px; }
  .chart-legend { display: none; }
  .admin-toolbar { gap: 6px; }
  .toolbar-search { min-width: 100%; max-width: none; flex-basis: 100%; }
  .toolbar-note { margin-left: 0; }
  .quick-actions { grid-template-columns: 1fr; }
  .user-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-user-head { align-items: flex-start; }
  .admin-user-danger { flex-direction: column; align-items: flex-start; }
  .admin-table th, .admin-table td { padding: 8px 7px; }
  .pagination { flex-direction: column; align-items: flex-start; gap: 8px; }
  .test-mail-box { flex-direction: column; align-items: stretch; }
  .test-mail-row { max-width: none; }
  .settings-save-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .settings-save-bar .btn { width: 100%; }
}

@media (max-width: 560px) {
  .auth-header { width: calc(100% - 32px); padding: 18px 0; }
  .auth-main { width: calc(100% - 28px); padding-top: 0; }
  .auth-story h1 { font-size: 29px; letter-spacing: -1px; }
  .story-lead { display: none; }
  .auth-card { border-radius: 20px; }
  .auth-tabs { padding-left: 20px; padding-right: 20px; }
  .auth-tab-indicator { left: 20px; width: calc(50% - 20px); }
  .auth-panel { padding: 21px 20px 22px; }
  .form-heading h2 { font-size: 21px; }
  .field-grid { grid-template-columns: 1fr; }
  .code-btn { min-width: 102px; font-size: 10.5px; }
  .auth-footer { font-size: 9px; padding: 14px 18px 20px; }
  .auth-legal { font-size: 8.5px; }
  .modal-overlay { padding: 12px; }
  .modal { max-height: 92svh; border-radius: 18px; }
  .modal-head { padding: 18px 18px 14px; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 12px 18px; }
  .member-facts { grid-template-columns: 1fr; }
  .toast-root { right: 12px; bottom: 12px; width: calc(100vw - 24px); }
  .chat-header { height: 64px; padding: 0 12px; gap: 7px; }
  .channel-heading-icon { width: 33px; height: 33px; font-size: 14px; }
  .channel-heading h2 { font-size: 13.5px; }
  .channel-heading p { font-size: 8.5px; }
  .header-pill { height: 29px; padding: 0 8px; font-size: 9px; }
  .announcement { padding: 8px 14px; }
  .announcement p { font-size: 9.5px; }
  .message-list { padding: 0 9px; }
  .channel-intro { padding: 0 16px; margin-top: 22px; }
  .intro-icon { width: 48px; height: 48px; font-size: 23px; border-radius: 15px; }
  .channel-intro h3 { font-size: 20px; }
  .message { padding: 7px 8px; gap: 9px; }
  .message .avatar-md { width: 36px; height: 36px; border-radius: 11px; font-size: 12px; }
  .message-content { font-size: 12.5px; }
  .message-name { font-size: 10.5px; }
  .message-actions { opacity: 1; background: transparent; border: 0; top: -4px; right: 0; }
  .message-action { background: rgba(16, 22, 42, 0.8); border: 1px solid var(--line); }
  .composer { padding: 2px 9px 9px; }
  .composer-box { border-radius: 13px; }
  .composer-hint span:first-child { display: none; }
  .composer-hint { justify-content: flex-end; }
  .new-messages { bottom: 98px; }
  .emoji-popover { left: 2px; width: 272px; grid-template-columns: repeat(8, 1fr); }
  .members-panel { width: 86vw; }
  .sidebar { width: 86vw; }
  .admin-topbar { padding: 13px 12px; gap: 10px; }
  .admin-topbar h1 { font-size: 18px; }
  .admin-top-actions .btn { font-size: 0; gap: 0; min-width: 34px; padding: 0 8px; }
  .admin-top-actions .btn::before { content: "↻"; font-size: 14px; }
  .welcome-strip { padding: 17px; }
  .welcome-strip h2 { font-size: 18px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 13px 15px; }
  .admin-card { padding: 14px; }
  .chart-day small { font-size: 6px; }
  .room-admin-card { padding: 12px; }
  .admin-table { font-size: 9.5px; }
  .admin-section-head h2 { font-size: 16px; }
  .admin-breadcrumb { font-size: 7.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Lightweight utility */
.nowrap { white-space: nowrap; }

/* Native agreement checkbox (separate from its label for reliable toggling) */
.agree-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.native-check {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.native-check:checked {
  background: var(--violet-deep);
  border-color: var(--violet-deep);
}

.native-check:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(42deg);
}

.agree-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  cursor: pointer;
  user-select: none;
}

.agree-label a { color: var(--violet); }

/* Custom consent toggle */
.agree-row {
  cursor: pointer;
  outline: none;
  border-radius: 6px;
}

.agree-row:focus-visible {
  outline: 2px solid rgba(139, 124, 255, 0.65);
  outline-offset: 3px;
}

.consent-box {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.consent-box[data-checked="true"] {
  background: var(--violet-deep);
  border-color: var(--violet-deep);
}

.consent-box[data-checked="true"]::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(42deg);
}

.agree-row .agree-label {
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════
   QQ 风格气泡（覆盖默认聊天样式）
   ═══════════════════════════════════════════════════════ */
.message {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px;
  padding: 6px 14px;
  background: transparent !important;
  border-radius: 0;
}
.message:hover { background: transparent !important; }
.message.own {
  flex-direction: row-reverse;
  background: transparent !important;
}
.message.own:hover { background: transparent !important; }

.message .avatar { flex: 0 0 auto; }

.message-main {
  display: flex;
  flex-direction: column;
  max-width: 68%;
  min-width: 0;
  padding: 0;
}

.message-head {
  margin-bottom: 3px;
  gap: 6px;
  font-size: 11px;
}
.message.own .message-head {
  flex-direction: row-reverse;
}
.message-name {
  font-size: 11.5px;
  color: var(--muted-2);
}
.message.own .message-name { display: none; }  /* 我的消息不显示昵称，像 QQ */
.message-time { font-size: 10px; }

/* 气泡本体 */
.message-content {
  position: relative;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: #e8ecf7;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  word-break: break-word;
  white-space: pre-wrap;
  align-self: flex-start;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
/* 气泡小尾巴（对方：左下） */
.message-content::before {
  content: "";
  position: absolute;
  left: -6px;
  bottom: 10px;
  width: 0; height: 0;
  border: 6px solid transparent;
  border-right-color: rgba(255, 255, 255, 0.06);
  border-left: none;
}
/* 我的消息气泡：右对齐，紫色渐变 */
.message.own .message-content {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, #7c6cf0, #9b5cf6);
  border-color: rgba(255,255,255,0.1);
  border-bottom-right-radius: 4px;
}
.message.own .message-content::before {
  left: auto;
  right: -6px;
  border-right: none;
  border-left-color: #9b5cf6;
}
/* 对方消息气泡：左下圆角小 */
.message:not(.own) .message-content {
  border-bottom-left-radius: 4px;
}

/* 删除消息按钮位置微调 */
.message-actions {
  position: absolute;
  top: -8px;
  right: 10px;
}
.message.own .message-actions {
  right: auto;
  left: 10px;
}

/* 日期分隔条 */
.date-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 6px;
}
.date-divider span {
  font-size: 11px;
  color: var(--muted-2);
  background: rgba(255,255,255,0.05);
  padding: 2px 10px;
  border-radius: 10px;
}

/* 移动端气泡宽度 */
@media (max-width: 760px) {
  .message-main { max-width: 78%; }
  .message-content { font-size: 13.5px; padding: 8px 11px; }
}

/* ═══════════════════════════════════════════════════════
   用户管理卡片 + 抽屉详情
   ═══════════════════════════════════════════════════════ */
.user-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.user-card {
  position: relative;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  cursor: pointer;
  transition: all 0.18s;
}
.user-card:hover {
  background: rgba(139, 124, 255, 0.08);
  border-color: rgba(139, 124, 255, 0.3);
  transform: translateY(-2px);
}
.user-card:active { transform: scale(0.98); }
.user-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-card-avatar {
  position: relative;
  flex: 0 0 auto;
}
.user-card-dot {
  position: absolute;
  right: 0; bottom: 0;
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid #101629;
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #fff;
  flex-wrap: wrap;
}
.user-card-info small {
  display: block;
  margin-top: 3px;
  color: #8892aa;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-card-meta {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
  color: #8892aa;
  font-size: 11.5px;
}
.user-card-meta i { font-style: normal; margin-right: 3px; }
.user-card-status {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
}
.role-badge.muted { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: rgba(245,158,11,0.3); }
.role-badge.self { background: rgba(34,197,94,0.15); color: #22c55e; border-color: rgba(34,197,94,0.3); }

/* 抽屉详情 */
.drawer-user { padding: 4px 0; }
.drawer-hero {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(139,124,255,0.15), rgba(34,211,238,0.05));
  margin-bottom: 16px;
}
.drawer-hero h3 { margin: 0; font-size: 18px; color: #fff; }
.drawer-hero p { margin: 4px 0 0; color: #8892aa; font-size: 12.5px; }
.drawer-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.drawer-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.drawer-stats > div {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.drawer-stats span { display: block; color: #8892aa; font-size: 11px; margin-bottom: 4px; }
.drawer-stats b { color: #fff; font-size: 14px; word-break: break-all; }
.drawer-stats .mono { font-family: monospace; font-size: 12.5px; }

@media (max-width: 600px) {
  .user-card-grid { grid-template-columns: 1fr; }
  .drawer-stats { grid-template-columns: 1fr 1fr; }
}

/* @昵称高亮 */
.message-content .mention {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.15);
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 600;
}

/* 聊天搜索框 */
.chat-search-bar {
  display: none;
  padding: 8px 16px;
  background: rgba(139,124,255,0.08);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chat-search-bar.show { display: flex; gap: 8px; }
.chat-search-bar input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 8px 12px;
  color: #fff;
  font-size: 13px;
}
.message-row.search-hit { background: rgba(139,124,255,0.12); }
.message-row.search-hidden { display: none; }

/* ═══════════════════════════════════════════════════════
   UI 美化重写 - 用户管理卡片 + 弹窗 + 整体
   ═══════════════════════════════════════════════════════ */

:root {
  --nova-bg: #0b1020;
  --nova-card: rgba(255, 255, 255, 0.04);
  --nova-border: rgba(255, 255, 255, 0.08);
  --nova-primary: #8b5cf6;
  --nova-primary-gradient: linear-gradient(135deg, #8b5cf6, #6366f1);
  --nova-text: #f1f5f9;
  --nova-text-dim: #94a3b8;
}

/* 用户卡片 - 更精致 */
.user-card-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}
@media (min-width: 700px) {
  .user-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .user-card-grid { grid-template-columns: repeat(3, 1fr); }
}
.user-card {
  padding: 14px;
  border-radius: 14px;
  background: var(--nova-card);
  border: 1px solid var(--nova-border);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.user-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--nova-primary-gradient);
  opacity: 0;
  transition: opacity 0.2s;
}
.user-card:hover {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.3);
  transform: translateY(-1px);
}
.user-card:hover::before { opacity: 1; }
.user-card-head { gap: 10px; }
.user-card-name { font-size: 14px; align-items: center; }
.user-card-info small { font-size: 11.5px; color: var(--nova-text-dim); }
.user-card-meta {
  margin-top: 10px;
  gap: 10px;
  font-size: 11px;
  color: var(--nova-text-dim);
}
.user-card-meta i { font-style: normal; opacity: 0.7; }
.user-card-status { font-size: 11.5px; margin-top: 8px; font-weight: 500; }

/* 弹窗 - 更现代 */
.modal-overlay {
  background: rgba(4, 7, 15, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0;
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: 100vh;
  margin: 0;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(180deg, #131a2e, #0d1322);
  border: 1px solid rgba(139, 92, 246, 0.2);
  box-shadow: 0 -20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease;
}
@media (min-width: 600px) {
  .modal {
    margin: auto;
    border-radius: 20px;
    max-height: 85vh;
    animation: fadeInScale 0.2s ease;
  }
}
.modal-lg { max-width: 640px; }
.modal-head {
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--nova-border);
}
.modal-head h3 { font-size: 17px; color: var(--nova-text); }
.modal-head p { font-size: 12px; color: var(--nova-text-dim); margin-top: 3px; }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--nova-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  color: var(--nova-text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}
.modal-close:hover { background: rgba(255,255,255,0.12); }

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeInScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 抽屉详情头 */
.drawer-hero {
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(99,102,241,0.05));
  border: 1px solid rgba(139,92,246,0.2);
}
.drawer-stats > div {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--nova-border);
}

/* 角色徽章 */
.role-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(139,92,246,0.15);
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.3);
  font-weight: 500;
}

/* 按钮统一 */
.btn {
  border-radius: 10px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--nova-primary-gradient);
  border: none;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }
.btn-ghost {
  background: rgba(255,255,255,0.06);
  color: var(--nova-text);
  border: 1px solid var(--nova-border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); }

/* 输入框统一 */
.input-shell, .admin-select, .toolbar-search input {
  border-radius: 10px !important;
  background: rgba(255,255,255,0.05) !important;
  border: 1px solid var(--nova-border) !important;
}
.input-shell:focus-within, .admin-select:focus, .toolbar-search input:focus {
  border-color: var(--nova-primary) !important;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

/* 顶栏在线人数 */
.header-pill {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--nova-border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--nova-text-dim);
}

/* 空状态 */
.table-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--nova-text-dim);
  font-size: 14px;
}

/* 加载转圈 */
.spinner {
  display: inline-block;
  width: 24px; height: 24px;
  border: 3px solid rgba(139,92,246,0.2);
  border-top-color: var(--nova-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 频道图标 SVG 样式 */
.room-icon, #channelIcon, #introIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a78bfa;
}
.room-icon svg, #channelIcon svg, #introIcon svg {
  width: 20px;
  height: 20px;
}
#introIcon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.15);
  margin-bottom: 16px;
}
#introIcon svg {
  width: 28px;
  height: 28px;
}
#channelIcon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.15);
}
